From Venus to Mars 
Developer land 
Real world
Maven Alfresco SDK is fun! 
-Pamp-to-war 
Share AMP Archetype 
Alfresco AMP Archetype
What about deployments? 
Real world has environments…! 
!! 
TEST PRE PRO 
… and integrated systems! 
TEST PRE PRO
Properties everywhere 
REPO SHARE! 
!!!!! 
INT 
1 
INT 
2 
TEST + PRE + PRO! 
INT 
3 
INT 
1 
INT 
2 
INT 
3
Shared properties 
REPO SHARE!
Alfresco Repo properties 
alfresco-global.properties! 
! 
• Packaging this file inside AMP module ! 
• Or including new entries in Alfresco 
shared folder original file! 
No possibility to configure it by 
environment
Alfresco Share properties 
• No visibility for resources in shared 
alfresco-global.properties ! 
• Custom properties files or custom 
messages files! 
No possibility to configure it by 
environment 
No possibility to share props with repo
TEST 
PRE 
profiles 
properties-maven-plugin 
maven-antrun-plugin 
PRO 
Our approach 
Maven Alfresco SDK to the rescue 
TEST 
PRE 
PRO 
AMP! 
TEST 
PRE 
PRO
TEST 
PRE 
profiles 
properties-maven-plugin 
maven-antrun-plugin 
PRO 
Our approach 
Maven Alfresco SDK to the rescue 
TEST 
PRE 
PRO 
AMP! 
TEST 
PRE 
PRO
Properties files 
external.system.url=test.external-system.com 
conf/test.alfresco-amp.properties 
external.system.url=pre.external-system.com 
conf/pre.alfresco-amp.properties 
external.system.url=external-system.com 
conf/pro.alfresco-amp.properties 
TEST 
PRE 
PRO
pom.xml - environments 
<profiles> 
<profile> 
<id>test</id> 
<properties><env>test</env></properties> 
</profile> 
<profile> 
<id>pre</id> 
<properties><env>pre</env></properties> 
</profile> 
<profile> 
<id>pro</id> 
<properties><env>pro</env></properties> 
</profile> 
</profiles>
pom.xml – properties plugin 
<plugin> 
<groupId>org.codehaus.mojo</groupId> 
<artifactId>properties-maven-plugin</artifactId> 
<configuration> 
<files> 
<file>${user.dir}/conf/${env}.alfresco-amp.properties</file> 
</files> 
</configuration> 
<executions> 
<execution> 
<phase>validate</phase> 
<goals><goal>read-project-properties</goal></goals> 
</execution> 
</executions> 
</plugin>
pom.xml – AntRun plugin 
<plugin> 
<artifactId>maven-antrun-plugin</artifactId> 
<executions> 
<execution> 
<phase>package</phase> 
<goals><goal>run</goal></goals> 
<configuration> 
<tasks> 
<copy todir="${dist}/${env}/amps" failonerror="false"> 
<fileset dir="${basedir}/target”><include name="*.amp"/> 
</fileset> 
</copy> 
</tasks> 
</configuration> 
</execution> 
</executions> 
</plugin> Repo + Share!
Using values 
<bean id="externalConnection" 
class="es.keensoft.alfresco.ExternalConnection”> 
<property name="url" value="${external.system.url}" /> 
</bean> 
!!!! 
amp/config/alfresco/module/service-context.xml 
… or by message property injection!
Packaging 
!! 
$ mvn clean package -Ptest 
AMPs for TEST environment available at! 
• dist/test/amps! 
• dist/test/amps_share! 
AMP!
Server signature 
VerificationClient signature 
eSignature service 
Real life 
A sample on where it can be useful
Server signature 
VerificationClient signature 
eSignature service 
Real life 
A sample on where it can be useful
Properties 
# Server signature 
url.SignatureServer=http://preservicios3.aragon.es/asf/services/ 
SignatureServer 
# Verification 
url.PolicyManager=http://preservicios3.aragon.es/asf/services/ 
PolicyManager 
# Client signature 
url.websigner=https://preservicios3.aragon.es/firma/js/WS.js 
conf/pre.alfresco-ast.properties
Use case 
AMP Repo! 
<bean id="asfSignatureSystem” 
class="es.aragon.ast.alfresco.sign.impl.external.ASFSignatureSystem" > 
<property name="asfUrlSignatureServer" value="${asf.url.SignatureServer}" /> 
<property name="asfUrlPolicyManager" value="${asf.url.PolicyManager}" /> 
</bean> 
! 
AMP Share! 
<ast:getCAs policyManagerUrl="${asf.url.PolicyManager}" app="${asf.app}" /> 
!
Final marks 
• Using additional maven plugins to 
extend Maven Alfresco SDK 
functionalities! 
• Ready to deploy AMPs are produced 
by environment! 
• Version organization can be added to 
store each distributed AMP!
Resources 
GitHub" 
http://github.com/keensoft 
Twitter 
@AngelBorroy 
Blog 
http://www.keensoft.es/blog

Summit2014 topic 0153 - Alfresco Maven for shared properties

  • 2.
    From Venus toMars Developer land Real world
  • 3.
    Maven Alfresco SDKis fun! -Pamp-to-war Share AMP Archetype Alfresco AMP Archetype
  • 4.
    What about deployments? Real world has environments…! !! TEST PRE PRO … and integrated systems! TEST PRE PRO
  • 5.
    Properties everywhere REPOSHARE! !!!!! INT 1 INT 2 TEST + PRE + PRO! INT 3 INT 1 INT 2 INT 3
  • 6.
  • 7.
    Alfresco Repo properties alfresco-global.properties! ! • Packaging this file inside AMP module ! • Or including new entries in Alfresco shared folder original file! No possibility to configure it by environment
  • 8.
    Alfresco Share properties • No visibility for resources in shared alfresco-global.properties ! • Custom properties files or custom messages files! No possibility to configure it by environment No possibility to share props with repo
  • 9.
    TEST PRE profiles properties-maven-plugin maven-antrun-plugin PRO Our approach Maven Alfresco SDK to the rescue TEST PRE PRO AMP! TEST PRE PRO
  • 10.
    TEST PRE profiles properties-maven-plugin maven-antrun-plugin PRO Our approach Maven Alfresco SDK to the rescue TEST PRE PRO AMP! TEST PRE PRO
  • 11.
    Properties files external.system.url=test.external-system.com conf/test.alfresco-amp.properties external.system.url=pre.external-system.com conf/pre.alfresco-amp.properties external.system.url=external-system.com conf/pro.alfresco-amp.properties TEST PRE PRO
  • 12.
    pom.xml - environments <profiles> <profile> <id>test</id> <properties><env>test</env></properties> </profile> <profile> <id>pre</id> <properties><env>pre</env></properties> </profile> <profile> <id>pro</id> <properties><env>pro</env></properties> </profile> </profiles>
  • 13.
    pom.xml – propertiesplugin <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>properties-maven-plugin</artifactId> <configuration> <files> <file>${user.dir}/conf/${env}.alfresco-amp.properties</file> </files> </configuration> <executions> <execution> <phase>validate</phase> <goals><goal>read-project-properties</goal></goals> </execution> </executions> </plugin>
  • 14.
    pom.xml – AntRunplugin <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals><goal>run</goal></goals> <configuration> <tasks> <copy todir="${dist}/${env}/amps" failonerror="false"> <fileset dir="${basedir}/target”><include name="*.amp"/> </fileset> </copy> </tasks> </configuration> </execution> </executions> </plugin> Repo + Share!
  • 15.
    Using values <beanid="externalConnection" class="es.keensoft.alfresco.ExternalConnection”> <property name="url" value="${external.system.url}" /> </bean> !!!! amp/config/alfresco/module/service-context.xml … or by message property injection!
  • 16.
    Packaging !! $mvn clean package -Ptest AMPs for TEST environment available at! • dist/test/amps! • dist/test/amps_share! AMP!
  • 17.
    Server signature VerificationClientsignature eSignature service Real life A sample on where it can be useful
  • 18.
    Server signature VerificationClientsignature eSignature service Real life A sample on where it can be useful
  • 19.
    Properties # Serversignature url.SignatureServer=http://preservicios3.aragon.es/asf/services/ SignatureServer # Verification url.PolicyManager=http://preservicios3.aragon.es/asf/services/ PolicyManager # Client signature url.websigner=https://preservicios3.aragon.es/firma/js/WS.js conf/pre.alfresco-ast.properties
  • 20.
    Use case AMPRepo! <bean id="asfSignatureSystem” class="es.aragon.ast.alfresco.sign.impl.external.ASFSignatureSystem" > <property name="asfUrlSignatureServer" value="${asf.url.SignatureServer}" /> <property name="asfUrlPolicyManager" value="${asf.url.PolicyManager}" /> </bean> ! AMP Share! <ast:getCAs policyManagerUrl="${asf.url.PolicyManager}" app="${asf.app}" /> !
  • 21.
    Final marks •Using additional maven plugins to extend Maven Alfresco SDK functionalities! • Ready to deploy AMPs are produced by environment! • Version organization can be added to store each distributed AMP!
  • 22.
    Resources GitHub" http://github.com/keensoft Twitter @AngelBorroy Blog http://www.keensoft.es/blog