Skip to content

Commit 611a7e5

Browse files
authored
Merge pull request #25 from dgradecak/dev
release 8.0.0
2 parents 919d2a6 + a3464b3 commit 611a7e5

34 files changed

+1021
-398
lines changed

.github/workflows/ci.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: build
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
compile:
8+
name: "compile"
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- uses: actions/setup-java@v1
15+
with:
16+
java-version: 11
17+
- name: Build with Maven
18+
run: ./mvnw compile
19+
20+
test:
21+
name: "tests (Alfresco version ${{ matrix.alfresco-version }})"
22+
runs-on: ubuntu-latest
23+
continue-on-error: ${{ matrix.experimental }}
24+
strategy:
25+
matrix:
26+
include:
27+
- alfresco-version: 6.1.2-ga
28+
experimental: false
29+
- alfresco-version: 6.2.0-ga
30+
experimental: false
31+
- alfresco-version: 7.1.0.1
32+
experimental: false
33+
- alfresco-version: 7.2.0
34+
experimental: false
35+
- alfresco-version: 7.3.0
36+
experimental: false
37+
steps:
38+
- uses: actions/checkout@v2
39+
with:
40+
fetch-depth: 0
41+
- uses: actions/setup-java@v1
42+
with:
43+
java-version: 11
44+
- name: Run tests
45+
run: ./mvnw test -Pcommunity-${{ matrix.alfresco-version }}

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ local
1111
.idea
1212
*iml
1313
*.log
14-
*.log.*
14+
*.log.*
15+
16+
private-key.gpg

.mvn/wrapper/maven-wrapper.jar

57.4 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
2+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

README.md

+26-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
The missing glue between Alfresco and Spring MVC
22
===
3-
Personally I do not like webscripts because of the boilerplate code that comes with them (XML, FTL, Java/Javascript). Also I am not a big fan of javascript on the server side esither, as in a medium sized application this becomes unmaintainable. That is why I wrote Alfresco @MVC.
3+
Personally, I do not like Alfresco Webscripts because of the boilerplate code that comes with them (XML, FTL, Java/Javascript). Also, I am not a big fan of Javascript on the server side either, as in a medium sized application this becomes unmaintainable. That is why I wrote Alfresco @MVC.
44

55
Alfresco @MVC consists of several libraries for REST, AOP
6-
- Alfresco MVC REST enables the usage of the full Spring MVC stack within the context of a webscript, benefiting of Alfresco standard authentication and security
6+
- Alfresco MVC REST enables the usage of the full Spring MVC stack within the context of an Alfresco Webscript, benefiting of Alfresco standard authentication and security
77
- Alfresco MVC AOP enables simple handling of Alfresco transactions and Alfresco runAs mechanism with simple annotations
88

99
[Distributed on Maven Central](https://search.maven.org/search?q=g:com.gradecak.alfresco-mvc)
@@ -23,22 +23,40 @@ Alfresco @MVC consists of several libraries for REST, AOP
2323
```
2424

2525
Works on Enterprise as well as on Community and it reuses a widely accepted REST framework.
26-
For the correct version supported on your Alfresco version [please check the wiki](https://github.com/dgradecak/alfresco-mvc/wiki) or
27-
[the release page](https://github.com/dgradecak/alfresco-mvc/releases).
26+
For the correct version supported by your Alfresco version [please check the wiki](https://github.com/dgradecak/alfresco-mvc/wiki) or
27+
[The release page](https://github.com/dgradecak/alfresco-mvc/releases).
2828

2929
[The docs are on the wiki page](https://github.com/dgradecak/alfresco-mvc/wiki)
3030

31+
[The Samples are provided on](https://github.com/dgradecak/alfresco-mvc-sample)
32+
3133
You should use it when
3234
-
3335
- You need custom APIs
3436
- You want to be more productive
35-
- You write custom webscripts
37+
- You write custom Alfresco Webscripts
3638

37-
You would benefit of
39+
You would benefit from
3840
-
3941
- Faster and cleaner development
40-
- Java developers know how to use Spring MVC while new comers tend to avoid webscripts
42+
- Java developers know how to use Spring MVC while newcomers tend to avoid Alfresco Webscripts
43+
44+
45+
For supported Alfresco versions, check the [release notes](https://github.com/dgradecak/alfresco-mvc/releases)
46+
47+
48+
Maven local installation
49+
-
50+
mvn clean install -Dgpg.skip
51+
4152

53+
Profiles
54+
-
55+
We are using profiles to test against different Alfresco versions. If no configured Maven profiles are provided the default will be used and is specified by <activeByDefault>true</activeByDefault> in the pom.xml
4256

43-
For supported Alfresco versions check the [release notes](https://github.com/dgradecak/alfresco-mvc/releases)
57+
example: mvn package -Pcommunity-7.2.0
58+
59+
Testing
60+
-
61+
From v8.0.0 we have decided to only run our unit tests against the Alfresco Community versions. Despite not being tested on Alfresco Enterprise it has to be compatible with the respectively tested Alfresco Community distribution
4462

alfresco-mvc-aop/pom.xml

+1-28
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.gradecak.alfresco-mvc</groupId>
88
<version>8.0.0</version>
9-
<artifactId>alfresco-mvc-bom</artifactId>
9+
<artifactId>alfresco-mvc-parent</artifactId>
1010
<relativePath>../</relativePath>
1111
</parent>
1212

@@ -15,10 +15,6 @@
1515
<name>Alfresco MVC aop</name>
1616
<description>Glue between Spring AOP and Alfresco. This library enables the usage of Spring AOP within Alfresco.</description>
1717

18-
<properties>
19-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20-
</properties>
21-
2218
<dependencies>
2319
<dependency>
2420
<groupId>org.alfresco</groupId>
@@ -57,27 +53,4 @@
5753
<scope>test</scope>
5854
</dependency>
5955
</dependencies>
60-
61-
<build>
62-
<plugins>
63-
<plugin>
64-
<artifactId>maven-source-plugin</artifactId>
65-
<executions>
66-
<execution>
67-
<id>attach-sources</id>
68-
<phase>package</phase>
69-
<goals>
70-
<goal>jar-no-fork</goal>
71-
</goals>
72-
</execution>
73-
</executions>
74-
</plugin>
75-
76-
<plugin>
77-
<groupId>org.apache.maven.plugins</groupId>
78-
<artifactId>maven-compiler-plugin</artifactId>
79-
</plugin>
80-
</plugins>
81-
</build>
82-
8356
</project>

alfresco-mvc-aop/src/main/java/com/gradecak/alfresco/mvc/annotation/EnableAlfrescoMvcAop.java

+2
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@
4343
String[] basePackages() default {};
4444

4545
Class<?>[] basePackageClasses() default {};
46+
47+
boolean defaultPropertiesSupport() default true;
4648
}

alfresco-mvc-aop/src/main/java/com/gradecak/alfresco/mvc/aop/AlfrescoProxyRegistrar.java

+14-8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.springframework.beans.factory.support.RootBeanDefinition;
2727
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
2828
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
29+
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
2930
import org.springframework.core.Ordered;
3031
import org.springframework.core.annotation.AnnotationAttributes;
3132
import org.springframework.core.type.AnnotationMetadata;
@@ -48,6 +49,11 @@ public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanD
4849
Assert.notNull(annotationMetadata, "AnnotationMetadata must not be null!");
4950
Assert.notNull(registry, "BeanDefinitionRegistry must not be null!");
5051

52+
// Guard against calls for sub-classes
53+
if (annotationMetadata.getAnnotationAttributes(EnableAlfrescoMvcAop.class.getName()) == null) {
54+
return;
55+
}
56+
5157
boolean proxyBeanRegistered = false;
5258
for (String beanName : PackageAutoProxyCreator.DEFAULT_INTERCEPTORS) {
5359
if (registry.containsBeanDefinition(beanName)) {
@@ -61,15 +67,16 @@ public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanD
6167
xmlReader.loadBeanDefinitions("classpath:com/gradecak/alfresco-mvc/alfresco-mvc-aop.xml");
6268
}
6369

64-
// Guard against calls for sub-classes
65-
if (annotationMetadata.getAnnotationAttributes(EnableAlfrescoMvcAop.class.getName()) == null) {
66-
return;
67-
}
68-
6970
this.attributes = new AnnotationAttributes(
7071
annotationMetadata.getAnnotationAttributes(EnableAlfrescoMvcAop.class.getName()));
7172
this.metadata = annotationMetadata;
7273

74+
boolean defaultPropertiesSupport = attributes.getBoolean("defaultPropertiesSupport");
75+
if (defaultPropertiesSupport) {
76+
RootBeanDefinition beanDefinition = new RootBeanDefinition(PropertySourcesPlaceholderConfigurer.class);
77+
registry.registerBeanDefinition("propertySourcesPlaceholderConfigurer", beanDefinition);
78+
}
79+
7380
Iterable<String> basePackages = getBasePackages();
7481
for (String basePackage : basePackages) {
7582
registerOrEscalateApcAsRequired(PackageAutoProxyCreator.class, registry, null, basePackage);
@@ -115,13 +122,13 @@ public Iterable<String> getBasePackages() {
115122
return packages;
116123
}
117124

118-
public static BeanDefinition registerOrEscalateApcAsRequired(Class<PackageAutoProxyCreator> cls,
125+
public static void registerOrEscalateApcAsRequired(Class<PackageAutoProxyCreator> cls,
119126
BeanDefinitionRegistry registry, Object source, String basePackage) {
120127
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
121128

122129
String proxyPackageBeanName = PACKAGE_PROXY_CREATOR_BEAN_NAME + "." + basePackage;
123130
if (registry.containsBeanDefinition(proxyPackageBeanName)) {
124-
return null;
131+
return;
125132
}
126133

127134
RootBeanDefinition beanDefinition = new RootBeanDefinition(cls);
@@ -130,6 +137,5 @@ public static BeanDefinition registerOrEscalateApcAsRequired(Class<PackageAutoPr
130137
beanDefinition.getPropertyValues().add("basePackage", basePackage);
131138
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
132139
registry.registerBeanDefinition(proxyPackageBeanName, beanDefinition);
133-
return beanDefinition;
134140
}
135141
}

alfresco-mvc-bom/pom.xml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<parent>
9+
<groupId>com.gradecak.alfresco-mvc</groupId>
10+
<version>8.0.0</version>
11+
<artifactId>alfresco-mvc-parent</artifactId>
12+
<relativePath>../</relativePath>
13+
</parent>
14+
15+
<artifactId>alfresco-mvc-bom</artifactId>
16+
<packaging>pom</packaging>
17+
18+
<name>Alfresco MVC dependencies</name>
19+
<description>Dependencies for Alfresco @MVC project</description>
20+
<url>https://github.com/dgradecak/alfresco-mvc</url>
21+
22+
<licenses>
23+
<license>
24+
<name>The Apache License, Version 2.0</name>
25+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
26+
</license>
27+
</licenses>
28+
29+
<developers>
30+
<developer>
31+
<name>Daniel Gradečak</name>
32+
<email>[email protected]</email>
33+
<organization>PleoSoft</organization>
34+
<organizationUrl>http://pleosoft.com/</organizationUrl>
35+
</developer>
36+
</developers>
37+
38+
<dependencyManagement>
39+
<dependencies>
40+
<dependency>
41+
<groupId>com.gradecak.alfresco-mvc</groupId>
42+
<artifactId>alfresco-mvc-rest</artifactId>
43+
<version>${project.version}</version>
44+
<scope>compile</scope>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>com.gradecak.alfresco-mvc</groupId>
49+
<artifactId>alfresco-mvc-aop</artifactId>
50+
<version>${project.version}</version>
51+
<scope>compile</scope>
52+
</dependency>
53+
</dependencies>
54+
</dependencyManagement>
55+
</project>

alfresco-mvc-rest/pom.xml

+1-40
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.gradecak.alfresco-mvc</groupId>
88
<version>8.0.0</version>
9-
<artifactId>alfresco-mvc-bom</artifactId>
9+
<artifactId>alfresco-mvc-parent</artifactId>
1010
<relativePath>../</relativePath>
1111
</parent>
1212

@@ -15,10 +15,6 @@
1515
<name>Alfresco MVC rest</name>
1616
<description>Glue between SpringMVC and Alfresco. This library enables the usage of Spring @MVC within Alfresco.</description>
1717

18-
<properties>
19-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20-
</properties>
21-
2218
<dependencies>
2319
<dependency>
2420
<groupId>javax.servlet</groupId>
@@ -68,39 +64,4 @@
6864
<scope>test</scope>
6965
</dependency>
7066
</dependencies>
71-
72-
<build>
73-
<plugins>
74-
<plugin>
75-
<artifactId>maven-source-plugin</artifactId>
76-
<executions>
77-
<execution>
78-
<id>attach-sources</id>
79-
<phase>package</phase>
80-
<goals>
81-
<goal>jar-no-fork</goal>
82-
</goals>
83-
</execution>
84-
</executions>
85-
</plugin>
86-
87-
<plugin>
88-
<groupId>org.apache.maven.plugins</groupId>
89-
<artifactId>maven-jar-plugin</artifactId>
90-
<executions>
91-
<execution>
92-
<goals>
93-
<goal>test-jar</goal>
94-
</goals>
95-
</execution>
96-
</executions>
97-
</plugin>
98-
99-
<plugin>
100-
<groupId>org.apache.maven.plugins</groupId>
101-
<artifactId>maven-compiler-plugin</artifactId>
102-
</plugin>
103-
</plugins>
104-
</build>
105-
10667
</project>

alfresco-mvc-rest/src/main/java/com/gradecak/alfresco/mvc/rest/annotation/EnableAlfrescoMvcDispatcherServlet.java

-45
This file was deleted.

0 commit comments

Comments
 (0)