RM: Build scripts

* war expanded in entirety and dependancies used as needed
  * Eclipse projects now building
  * Eclipse runtime helthier since have access to expanded WAR 'config' files on projects classpath
  * Custom Groovy task class added to construct AMP's
  * AMPs for both server and client build as part of the standard java 'assemble' task (called during 'build')
  * TODO check AMPs deploy
  * TODO extract properties
  * TODO construct correct Jar and Amp names based on version, etc



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@34706 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2012-03-23 07:54:45 +00:00
parent 96075afea4
commit 372ceff749
5 changed files with 93 additions and 57 deletions

View File

@@ -1,3 +1,39 @@
class AMPTask extends DefaultTask {
def String dist = 'build/dist'
def String amp = null
def String module = null
def String jar = null
def String config = 'config'
def String web = 'source/web'
@TaskAction
def assembleAMP() {
// assemble the AMP file
ant.zip(destfile: dist + '/' + amp, update: 'true') {
ant.zipfileset(file: module + '/module.properties')
ant.zipfileset(file: module + '/file-mapping.properties')
if (jar != null) {
ant.zipfileset(file: jar, prefix: 'lib')
}
if (config != null) {
ant.zipfileset(dir: config, prefix: 'config') {
ant.exclude(name: '**/module.properties')
ant.exclude(name: '**/file-mapping.properties')
}
}
if (web != null) {
ant.zipfileset(file: web, prefix: 'web')
}
}
}
}
subprojects { subprojects {
apply plugin: 'java' apply plugin: 'java'
@@ -48,43 +84,18 @@ subprojects {
} }
} }
task amp << {} task amp(type: AMPTask)
amp.doFirst {
// ensure the dist directory exists
def distDir = file(dist)
if (distDir.exists() == false) {
distDir.mkdir()
}
}
assemble.doLast { assemble.doLast {
tasks.amp.execute() tasks.amp.execute()
}
}
void assembleAmp(amp, module, jar, config, web){
ant.zip(destfile: amp, update: 'true') {
def moduleProperties = module + '/module.properties'
def fileMapping = module + '/file-mapping.properties'
if (file(moduleProperties).exists() == true) {
ant.zipfileset(file: moduleProperties)
}
if (file(fileMapping).exists() == true) {
ant.zipfileset(file: fileMapping)
}
if (jar != null) {
ant.zipfileset(file: jar, prefix: 'lib')
}
if (config != null) {
ant.zipfileset(dir: config, prefix: 'config') {
ant.exclude(name: '**/module.properties')
ant.exclude(name: '**/file-mapping.properties')
}
}
if (web != null) {
ant.zipfileset(file: web, prefix: 'web')
}
} }
}
}

View File

@@ -18,7 +18,6 @@
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/activiti-engine-5.7.jar"/> <classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/activiti-engine-5.7.jar"/>
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/activiti-spring-5.7.jar"/> <classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/activiti-spring-5.7.jar"/>
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/addressing-1.0.jar"/> <classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/addressing-1.0.jar"/>
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/alfresco-community-rm-2.0.jar"/>
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/alfresco-core-4.0.d.jar"/> <classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/alfresco-core-4.0.d.jar"/>
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/alfresco-data-model-4.0.d.jar"/> <classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/alfresco-data-model-4.0.d.jar"/>
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/alfresco-deployment-4.0.d.jar"/> <classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/war/WEB-INF/lib/alfresco-deployment-4.0.d.jar"/>

View File

@@ -4,8 +4,16 @@ repositories {
} }
dependencies { dependencies {
compile fileTree(dir: 'libs/test', include: '*.jar') compile fileTree(dir: 'libs', include: '*.jar')
compile group: 'javax.servlet', name: 'servlet-api', version: '2.5' compile 'javax.servlet:servlet-api:2.5'
compile 'org.springframework:spring-test:2.5' compile 'org.springframework:spring-test:2.5'
} }
amp {
amp 'rm-server.amp'
module 'config/alfresco/module/org_alfresco_module_rm'
jar 'build/libs/rm-server.jar'
}

View File

@@ -350,7 +350,8 @@ public class RMEntryVoter extends RMSecurityCommon
} }
private int checkCapability(MethodInvocation invocation, Class[] params, ConfigAttributeDefintion cad) @SuppressWarnings("unchecked")
private int checkCapability(MethodInvocation invocation, Class[] params, ConfigAttributeDefintion cad)
{ {
NodeRef testNodeRef = getTestNode(getNodeService(), getRecordsManagementService(), invocation, params, cad.parameters.get(0), cad.parent); NodeRef testNodeRef = getTestNode(getNodeService(), getRecordsManagementService(), invocation, params, cad.parameters.get(0), cad.parent);
if (testNodeRef == null) if (testNodeRef == null)
@@ -421,7 +422,8 @@ public class RMEntryVoter extends RMSecurityCommon
throw new ACLEntryVoterException("Unknown type"); throw new ACLEntryVoterException("Unknown type");
} }
private static Map<QName, Serializable> getProperties(MethodInvocation invocation, Class[] params, int position) @SuppressWarnings("unchecked")
private static Map<QName, Serializable> getProperties(MethodInvocation invocation, Class[] params, int position)
{ {
if (invocation.getArguments()[position] == null) if (invocation.getArguments()[position] == null)
{ {
@@ -438,7 +440,8 @@ public class RMEntryVoter extends RMSecurityCommon
throw new ACLEntryVoterException("Unknown type"); throw new ACLEntryVoterException("Unknown type");
} }
private static NodeRef getTestNode(NodeService nodeService, RecordsManagementService rmService, MethodInvocation invocation, Class[] params, int position, boolean parent) @SuppressWarnings("unchecked")
private static NodeRef getTestNode(NodeService nodeService, RecordsManagementService rmService, MethodInvocation invocation, Class[] params, int position, boolean parent)
{ {
NodeRef testNodeRef = null; NodeRef testNodeRef = null;
if (position < 0) if (position < 0)
@@ -558,7 +561,8 @@ public class RMEntryVoter extends RMSecurityCommon
return testNodeRef; return testNodeRef;
} }
private int checkPolicy(MethodInvocation invocation, Class[] params, ConfigAttributeDefintion cad) @SuppressWarnings("unchecked")
private int checkPolicy(MethodInvocation invocation, Class[] params, ConfigAttributeDefintion cad)
{ {
Policy policy = policies.get(cad.policyName); Policy policy = policies.get(cad.policyName);
if (policy == null) if (policy == null)
@@ -577,7 +581,8 @@ public class RMEntryVoter extends RMSecurityCommon
} }
private List<ConfigAttributeDefintion> extractSupportedDefinitions(ConfigAttributeDefinition config) @SuppressWarnings("unchecked")
private List<ConfigAttributeDefintion> extractSupportedDefinitions(ConfigAttributeDefinition config)
{ {
List<ConfigAttributeDefintion> definitions = new ArrayList<ConfigAttributeDefintion>(2); List<ConfigAttributeDefintion> definitions = new ArrayList<ConfigAttributeDefintion>(2);
Iterator iter = config.getConfigAttributes(); Iterator iter = config.getConfigAttributes();
@@ -792,7 +797,8 @@ public class RMEntryVoter extends RMSecurityCommon
* @param cad * @param cad
* @return * @return
*/ */
int evaluate( @SuppressWarnings("unchecked")
int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilitiesService, CapabilityService capabilitiesService,
@@ -804,7 +810,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class ReadPolicy implements Policy private static class ReadPolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -821,7 +828,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class CreatePolicy implements Policy private static class CreatePolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -848,7 +856,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class MovePolicy implements Policy private static class MovePolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -884,7 +893,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class UpdatePolicy implements Policy private static class UpdatePolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -919,7 +929,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class DeletePolicy implements Policy private static class DeletePolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -948,7 +959,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class UpdatePropertiesPolicy implements Policy private static class UpdatePropertiesPolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -986,7 +998,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class AssocPolicy implements Policy private static class AssocPolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -1010,7 +1023,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class WriteContentPolicy implements Policy private static class WriteContentPolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -1027,7 +1041,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class CapabilityPolicy implements Policy private static class CapabilityPolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -1044,7 +1059,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class DeclarePolicy implements Policy private static class DeclarePolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,
@@ -1061,7 +1077,8 @@ public class RMEntryVoter extends RMSecurityCommon
private static class ReadPropertyPolicy implements Policy private static class ReadPropertyPolicy implements Policy
{ {
public int evaluate( @SuppressWarnings("unchecked")
public int evaluate(
NodeService nodeService, NodeService nodeService,
RecordsManagementService rmService, RecordsManagementService rmService,
CapabilityService capabilityService, CapabilityService capabilityService,

View File

@@ -45,7 +45,8 @@ public abstract class AbstractCapability extends RMSecurityCommon
implements Capability, RecordsManagementModel, RMPermissionModel implements Capability, RecordsManagementModel, RMPermissionModel
{ {
/** Logger */ /** Logger */
private static Log logger = LogFactory.getLog(AbstractCapability.class); @SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(AbstractCapability.class);
/** RM entry voter */ /** RM entry voter */
protected RMEntryVoter voter; protected RMEntryVoter voter;