Commit 11d9d0ee2d0e4e4c5710e5797a969eae81f5e0c1
1 parent
1c96e3eb79
Exists in
master
alfresco java code formatting
Showing
12 changed files
with
391 additions
and
342 deletions
Show diff stats
alfresco-trashcan-cleaner-amp/jetty/jetty.xml
... | ... | @@ -2,20 +2,17 @@ |
2 | 2 | <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> |
3 | 3 | |
4 | 4 | <Configure id="Server" class="org.mortbay.jetty.Server"> |
5 | - <New id="myDataSource" | |
6 | - class="org.mortbay.jetty.plus.naming.Resource"> | |
7 | - <Arg>jdbc/dataSource</Arg> | |
8 | - <Arg> | |
9 | - <!--<New class="${alfresco.db.datasource.class}"> | |
10 | - <Set name="URL">${alfresco.db.url}</Set> | |
11 | - <Set name="User">${alfresco.db.username}</Set> | |
12 | - <Set name="Password">${alfresco.db.password}</Set> | |
13 | - </New>--> | |
14 | - <New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"> | |
15 | - <Set name="URL">${alfresco.db.url}</Set> | |
16 | - <Set name="User">${alfresco.db.username}</Set> | |
17 | - <Set name="Password">${alfresco.db.password}</Set> | |
18 | - </New> | |
19 | - </Arg> | |
20 | - </New> | |
5 | + <New id="myDataSource" class="org.mortbay.jetty.plus.naming.Resource"> | |
6 | + <Arg>jdbc/dataSource</Arg> | |
7 | + <Arg> | |
8 | + <!--<New class="${alfresco.db.datasource.class}"> <Set name="URL">${alfresco.db.url}</Set> | |
9 | + <Set name="User">${alfresco.db.username}</Set> <Set name="Password">${alfresco.db.password}</Set> | |
10 | + </New> --> | |
11 | + <New class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"> | |
12 | + <Set name="URL">${alfresco.db.url}</Set> | |
13 | + <Set name="User">${alfresco.db.username}</Set> | |
14 | + <Set name="Password">${alfresco.db.password}</Set> | |
15 | + </New> | |
16 | + </Arg> | |
17 | + </New> | |
21 | 18 | </Configure> |
22 | 19 | \ No newline at end of file | ... | ... |
alfresco-trashcan-cleaner-amp/pom.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
3 | - <modelVersion>4.0.0</modelVersion> | |
4 | - <artifactId>alfresco-trashcan-cleaner-amp</artifactId> | |
5 | - <name>Alfresco Trashcan Cleaner AMP Module</name> | |
6 | - <packaging>amp</packaging> | |
7 | - <description>This is the AMP project, depended upon by the alfresco WAR module</description> | |
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
4 | + <modelVersion>4.0.0</modelVersion> | |
5 | + <artifactId>alfresco-trashcan-cleaner-amp</artifactId> | |
6 | + <name>Alfresco Trashcan Cleaner AMP Module</name> | |
7 | + <packaging>amp</packaging> | |
8 | + <description>This is the AMP project, depended upon by the alfresco WAR module</description> | |
8 | 9 | |
9 | - <parent> | |
10 | - <groupId>org.alfresco</groupId> | |
11 | - <artifactId>alfresco-trashcan-cleaner</artifactId> | |
12 | - <version>1.2-SNAPSHOT</version> | |
13 | - </parent> | |
10 | + <parent> | |
11 | + <groupId>org.alfresco</groupId> | |
12 | + <artifactId>alfresco-trashcan-cleaner</artifactId> | |
13 | + <version>1.2-SNAPSHOT</version> | |
14 | + </parent> | |
15 | + | |
16 | + <!-- Following dependencies are needed for compiling Java code in src/main/java; | |
17 | + <scope>provided</scope> is inherited for each of the following; for more | |
18 | + info, please refer to alfresco-integration-parent POM definition @TODO - | |
19 | + document --> | |
20 | + <dependencies> | |
21 | + <dependency> | |
22 | + <groupId>${alfresco.groupId}</groupId> | |
23 | + <artifactId>alfresco-repository</artifactId> | |
24 | + </dependency> | |
25 | + <dependency> | |
26 | + <groupId>junit</groupId> | |
27 | + <artifactId>junit</artifactId> | |
28 | + <version>4.8.1</version> | |
29 | + <scope>test</scope> | |
30 | + </dependency> | |
31 | + <dependency> | |
32 | + <groupId>mysql</groupId> | |
33 | + <artifactId>mysql-connector-java</artifactId> | |
34 | + <version>5.1.18</version> | |
35 | + </dependency> | |
36 | + </dependencies> | |
37 | + | |
38 | + <properties> | |
39 | + <!-- This property allow to switch Repo AMP vs Share AMP. Set alfresco.client.war=share | |
40 | + to run this AMP against Share --> | |
41 | + <alfresco.client.war>alfresco</alfresco.client.war> | |
42 | + </properties> | |
14 | 43 | |
15 | - <!-- | |
16 | - Following dependencies are needed for compiling | |
17 | - Java code in src/main/java; <scope>provided</scope> | |
18 | - is inherited for each of the following; for more | |
19 | - info, please refer to alfresco-integration-parent | |
20 | - POM definition | |
21 | - @TODO - document | |
22 | - --> | |
23 | - <dependencies> | |
24 | - <dependency> | |
25 | - <groupId>${alfresco.groupId}</groupId> | |
26 | - <artifactId>alfresco-repository</artifactId> | |
27 | - </dependency> | |
28 | - <dependency> | |
29 | - <groupId>junit</groupId> | |
30 | - <artifactId>junit</artifactId> | |
31 | - <version>4.8.1</version> | |
32 | - <scope>test</scope> | |
33 | - </dependency> | |
34 | - <dependency> | |
35 | - <groupId>mysql</groupId> | |
36 | - <artifactId>mysql-connector-java</artifactId> | |
37 | - <version>5.1.18</version> | |
38 | - </dependency> | |
39 | - </dependencies> | |
40 | - | |
41 | - <properties> | |
42 | - <!-- This property allow to switch Repo AMP vs Share AMP. | |
43 | - Set alfresco.client.war=share to run this AMP against Share | |
44 | - --> | |
45 | - <alfresco.client.war>alfresco</alfresco.client.war> | |
46 | - </properties> | |
47 | - | |
48 | 44 | </project> | ... | ... |
alfresco-trashcan-cleaner-amp/src/main/amp/config/alfresco/module/alfresco-trashcan-cleaner-amp/module-context.xml
1 | 1 | <?xml version='1.0' encoding='UTF-8'?> |
2 | -<!-- | |
3 | - Licensed to the Apache Software Foundation (ASF) under one or more | |
4 | - contributor license agreements. See the NOTICE file distributed with | |
5 | - this work for additional information regarding copyright ownership. | |
6 | - The ASF licenses this file to You under the Apache License, Version 2.0 | |
7 | - (the "License"); you may not use this file except in compliance with | |
8 | - the License. You may obtain a copy of the License at | |
9 | - | |
10 | - http://www.apache.org/licenses/LICENSE-2.0 | |
11 | - | |
12 | - Unless required by applicable law or agreed to in writing, software | |
13 | - distributed under the License is distributed on an "AS IS" BASIS, | |
14 | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | - See the License for the specific language governing permissions and | |
16 | - limitations under the License. | |
17 | - | |
18 | ---> | |
2 | +<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor | |
3 | + license agreements. See the NOTICE file distributed with this work for additional | |
4 | + information regarding copyright ownership. The ASF licenses this file to | |
5 | + You under the Apache License, Version 2.0 (the "License"); you may not use | |
6 | + this file except in compliance with the License. You may obtain a copy of | |
7 | + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required | |
8 | + by applicable law or agreed to in writing, software distributed under the | |
9 | + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | |
10 | + OF ANY KIND, either express or implied. See the License for the specific | |
11 | + language governing permissions and limitations under the License. --> | |
19 | 12 | <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> |
20 | 13 | |
21 | 14 | <beans> |
22 | - | |
23 | - <import resource="classpath:alfresco/module/${artifactId}/context/service-context.xml" /> | |
24 | - | |
15 | + | |
16 | + <import | |
17 | + resource="classpath:alfresco/module/${artifactId}/context/service-context.xml" /> | |
18 | + | |
25 | 19 | </beans> | ... | ... |
alfresco-trashcan-cleaner-amp/src/main/java/org/alfresco/schedule/AbstractScheduledLockedJob.java
... | ... | @@ -7,32 +7,35 @@ import org.springframework.scheduling.quartz.QuartzJobBean; |
7 | 7 | |
8 | 8 | /** |
9 | 9 | * |
10 | - * @author rjmfernandes@gmail.com | |
10 | + * @author Rui Fernandes | |
11 | 11 | * |
12 | 12 | */ |
13 | -public abstract class AbstractScheduledLockedJob extends QuartzJobBean { | |
13 | +public abstract class AbstractScheduledLockedJob extends QuartzJobBean | |
14 | +{ | |
14 | 15 | |
15 | 16 | private ScheduledJobLockExecuter locker; |
16 | 17 | |
17 | 18 | @Override |
18 | 19 | protected final void executeInternal(final JobExecutionContext jobContext) |
19 | - throws JobExecutionException { | |
20 | - if (locker == null) { | |
20 | + throws JobExecutionException | |
21 | + { | |
22 | + if (locker == null) | |
23 | + { | |
21 | 24 | JobLockService jobLockServiceBean = (JobLockService) jobContext |
22 | - .getJobDetail().getJobDataMap().get("jobLockService"); | |
25 | + .getJobDetail().getJobDataMap().get("jobLockService"); | |
23 | 26 | if (jobLockServiceBean == null) |
24 | 27 | throw new JobExecutionException( |
25 | - "Missing setting for bean jobLockService"); | |
28 | + "Missing setting for bean jobLockService"); | |
26 | 29 | String name = (String) jobContext.getJobDetail().getJobDataMap() |
27 | - .get("name"); | |
30 | + .get("name"); | |
28 | 31 | String jobName = name == null ? this.getClass().getSimpleName() |
29 | - : name; | |
32 | + : name; | |
30 | 33 | locker = new ScheduledJobLockExecuter(jobLockServiceBean, jobName, |
31 | - this); | |
34 | + this); | |
32 | 35 | } |
33 | 36 | locker.execute(jobContext); |
34 | 37 | } |
35 | 38 | |
36 | 39 | public abstract void executeJob(JobExecutionContext jobContext) |
37 | - throws JobExecutionException; | |
40 | + throws JobExecutionException; | |
38 | 41 | } | ... | ... |
alfresco-trashcan-cleaner-amp/src/main/java/org/alfresco/schedule/ScheduledJobLockExecuter.java
... | ... | @@ -6,20 +6,22 @@ import org.alfresco.service.namespace.NamespaceService; |
6 | 6 | import org.alfresco.service.namespace.QName; |
7 | 7 | import org.alfresco.util.Pair; |
8 | 8 | import org.alfresco.util.VmShutdownListener.VmShutdownException; |
9 | -import org.apache.log4j.Logger; | |
9 | +import org.apache.commons.logging.Log; | |
10 | +import org.apache.commons.logging.LogFactory; | |
10 | 11 | import org.quartz.JobExecutionContext; |
11 | 12 | import org.quartz.JobExecutionException; |
12 | 13 | |
13 | 14 | /** |
14 | 15 | * |
15 | - * @author rjmfernandes@gmail.com | |
16 | - * | |
16 | + * @author Rui Fernandes | |
17 | + * | |
17 | 18 | */ |
18 | 19 | |
19 | -public class ScheduledJobLockExecuter { | |
20 | +public class ScheduledJobLockExecuter | |
21 | +{ | |
20 | 22 | |
21 | - private static Logger logger = Logger | |
22 | - .getLogger(ScheduledJobLockExecuter.class.getName()); | |
23 | + private static Log logger = LogFactory | |
24 | + .getLog(ScheduledJobLockExecuter.class.getName()); | |
23 | 25 | |
24 | 26 | private static final long LOCK_TTL = 30000L; |
25 | 27 | private static ThreadLocal<Pair<Long, String>> lockThreadLocal = new ThreadLocal<Pair<Long, String>>(); |
... | ... | @@ -28,39 +30,49 @@ public class ScheduledJobLockExecuter { |
28 | 30 | private AbstractScheduledLockedJob job; |
29 | 31 | |
30 | 32 | public ScheduledJobLockExecuter(JobLockService jobLockService, String name, |
31 | - AbstractScheduledLockedJob job) { | |
33 | + AbstractScheduledLockedJob job) | |
34 | + { | |
32 | 35 | this.jobLockService = jobLockService; |
33 | 36 | lockQName = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, |
34 | - name); | |
37 | + name); | |
35 | 38 | this.job = job; |
36 | 39 | } |
37 | 40 | |
38 | 41 | public void execute(JobExecutionContext jobContext) |
39 | - throws JobExecutionException { | |
40 | - try { | |
41 | - if (logger.isDebugEnabled()) { | |
42 | + throws JobExecutionException | |
43 | + { | |
44 | + try | |
45 | + { | |
46 | + if (logger.isDebugEnabled()) | |
47 | + { | |
42 | 48 | logger.debug(String.format(" Job %s started.", |
43 | - lockQName.getLocalName())); | |
49 | + lockQName.getLocalName())); | |
44 | 50 | } |
45 | 51 | refreshLock(); |
46 | 52 | job.executeJob(jobContext); |
47 | - if (logger.isDebugEnabled()) { | |
53 | + if (logger.isDebugEnabled()) | |
54 | + { | |
48 | 55 | logger.debug(String.format(" Job %s completed.", |
49 | - lockQName.getLocalName())); | |
56 | + lockQName.getLocalName())); | |
50 | 57 | } |
51 | - } catch (LockAcquisitionException e) { | |
58 | + } catch (LockAcquisitionException e) | |
59 | + { | |
52 | 60 | // Job being done by another process |
53 | - if (logger.isDebugEnabled()) { | |
61 | + if (logger.isDebugEnabled()) | |
62 | + { | |
54 | 63 | logger.debug(String.format(" Job %s already underway.", |
55 | - lockQName.getLocalName())); | |
64 | + lockQName.getLocalName())); | |
56 | 65 | } |
57 | - } catch (VmShutdownException e) { | |
66 | + } catch (VmShutdownException e) | |
67 | + { | |
58 | 68 | // Aborted |
59 | - if (logger.isDebugEnabled()) { | |
69 | + if (logger.isDebugEnabled()) | |
70 | + { | |
60 | 71 | logger.debug(String.format(" Job %s aborted.", |
61 | - lockQName.getLocalName())); | |
72 | + lockQName.getLocalName())); | |
62 | 73 | } |
63 | - } finally { | |
74 | + } finally | |
75 | + { | |
64 | 76 | releaseLock(); |
65 | 77 | } |
66 | 78 | } |
... | ... | @@ -69,20 +81,24 @@ public class ScheduledJobLockExecuter { |
69 | 81 | * Lazily update the job lock |
70 | 82 | * |
71 | 83 | */ |
72 | - private void refreshLock() { | |
84 | + private void refreshLock() | |
85 | + { | |
73 | 86 | Pair<Long, String> lockPair = lockThreadLocal.get(); |
74 | - if (lockPair == null) { | |
87 | + if (lockPair == null) | |
88 | + { | |
75 | 89 | String lockToken = jobLockService.getLock(lockQName, LOCK_TTL); |
76 | 90 | Long lastLock = new Long(System.currentTimeMillis()); |
77 | 91 | // We have not locked before |
78 | 92 | lockPair = new Pair<Long, String>(lastLock, lockToken); |
79 | 93 | lockThreadLocal.set(lockPair); |
80 | - } else { | |
94 | + } else | |
95 | + { | |
81 | 96 | long now = System.currentTimeMillis(); |
82 | 97 | long lastLock = lockPair.getFirst().longValue(); |
83 | 98 | String lockToken = lockPair.getSecond(); |
84 | 99 | // Only refresh the lock if we are past a threshold |
85 | - if (now - lastLock > (long) (LOCK_TTL / 2L)) { | |
100 | + if (now - lastLock > (long) (LOCK_TTL / 2L)) | |
101 | + { | |
86 | 102 | jobLockService.refreshLock(lockToken, lockQName, LOCK_TTL); |
87 | 103 | lastLock = System.currentTimeMillis(); |
88 | 104 | lockPair = new Pair<Long, String>(lastLock, lockToken); |
... | ... | @@ -93,13 +109,17 @@ public class ScheduledJobLockExecuter { |
93 | 109 | /** |
94 | 110 | * Release the lock after the job completes |
95 | 111 | */ |
96 | - private void releaseLock() { | |
112 | + private void releaseLock() | |
113 | + { | |
97 | 114 | Pair<Long, String> lockPair = lockThreadLocal.get(); |
98 | - if (lockPair != null) { | |
115 | + if (lockPair != null) | |
116 | + { | |
99 | 117 | // We can't release without a token |
100 | - try { | |
118 | + try | |
119 | + { | |
101 | 120 | jobLockService.releaseLock(lockPair.getSecond(), lockQName); |
102 | - } finally { | |
121 | + } finally | |
122 | + { | |
103 | 123 | // Reset |
104 | 124 | lockThreadLocal.set(null); |
105 | 125 | } |
... | ... | @@ -108,4 +128,3 @@ public class ScheduledJobLockExecuter { |
108 | 128 | } |
109 | 129 | |
110 | 130 | } |
111 | - | ... | ... |
alfresco-trashcan-cleaner-amp/src/main/java/org/alfresco/trashcan/TrashcanCleaner.java
... | ... | @@ -14,10 +14,11 @@ import org.apache.commons.logging.LogFactory; |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * |
17 | - * @author rjmfernandes@gmail.com | |
17 | + * @author Rui Fernandes | |
18 | 18 | * |
19 | 19 | */ |
20 | -public class TrashcanCleaner { | |
20 | +public class TrashcanCleaner | |
21 | +{ | |
21 | 22 | |
22 | 23 | private static Log logger = LogFactory.getLog(TrashcanCleaner.class); |
23 | 24 | |
... | ... | @@ -27,80 +28,95 @@ public class TrashcanCleaner { |
27 | 28 | private int daysToKeep = -1; |
28 | 29 | private static final long DAYS_TO_MILLIS = 1000 * 60 * 60 * 24; |
29 | 30 | |
30 | - public TrashcanCleaner(NodeService nodeService) { | |
31 | + public TrashcanCleaner(NodeService nodeService) | |
32 | + { | |
31 | 33 | this.nodeService = nodeService; |
32 | 34 | } |
33 | 35 | |
34 | 36 | public TrashcanCleaner(NodeService nodeService, int deleteBatchCount, |
35 | - int daysToKeep) { | |
37 | + int daysToKeep) | |
38 | + { | |
36 | 39 | this(nodeService); |
37 | 40 | this.deleteBatchCount = deleteBatchCount; |
38 | 41 | this.daysToKeep = daysToKeep; |
39 | 42 | } |
40 | 43 | |
41 | 44 | public TrashcanCleaner(NodeService nodeService, String archiveStoreUrl, |
42 | - int deleteBatchCount, int daysToKeep) { | |
45 | + int deleteBatchCount, int daysToKeep) | |
46 | + { | |
43 | 47 | this(nodeService, deleteBatchCount, daysToKeep); |
44 | 48 | this.archiveStoreUrl = archiveStoreUrl; |
45 | 49 | } |
46 | 50 | |
47 | - public void clean() { | |
51 | + public void clean() | |
52 | + { | |
48 | 53 | List<NodeRef> nodes = getBatchToDelete(); |
49 | 54 | |
50 | - if (logger.isDebugEnabled()) { | |
51 | - logger.debug(String.format("Number of nodes to delete: %s", nodes | |
52 | - .size())); | |
55 | + if (logger.isDebugEnabled()) | |
56 | + { | |
57 | + logger.debug(String.format("Number of nodes to delete: %s", | |
58 | + nodes.size())); | |
53 | 59 | } |
54 | 60 | |
55 | 61 | deleteNodes(nodes); |
56 | 62 | |
57 | - if (logger.isDebugEnabled()) { | |
63 | + if (logger.isDebugEnabled()) | |
64 | + { | |
58 | 65 | logger.debug("Nodes deleted"); |
59 | 66 | } |
60 | 67 | } |
61 | 68 | |
62 | - private void deleteNodes(List<NodeRef> nodes) { | |
63 | - for (int i = nodes.size(); i > 0; i--) { | |
69 | + private void deleteNodes(List<NodeRef> nodes) | |
70 | + { | |
71 | + for (int i = nodes.size(); i > 0; i--) | |
72 | + { | |
64 | 73 | nodeService.deleteNode(nodes.get(i - 1)); |
65 | 74 | } |
66 | 75 | } |
67 | 76 | |
68 | - private List<NodeRef> getBatchToDelete() { | |
77 | + private List<NodeRef> getBatchToDelete() | |
78 | + { | |
69 | 79 | List<ChildAssociationRef> childAssocs = getTrashcanChildAssocs(); |
70 | 80 | List<NodeRef> nodes = new ArrayList<NodeRef>(deleteBatchCount); |
71 | - if (logger.isDebugEnabled()) { | |
81 | + if (logger.isDebugEnabled()) | |
82 | + { | |
72 | 83 | logger.debug(String.format("Found %s nodes on trashcan", |
73 | - childAssocs.size())); | |
84 | + childAssocs.size())); | |
74 | 85 | } |
75 | 86 | return fillBatchToDelete(nodes, childAssocs); |
76 | 87 | } |
77 | 88 | |
78 | 89 | private List<NodeRef> fillBatchToDelete(List<NodeRef> batch, |
79 | - List<ChildAssociationRef> trashChildAssocs) { | |
90 | + List<ChildAssociationRef> trashChildAssocs) | |
91 | + { | |
80 | 92 | for (int j = trashChildAssocs.size(); j > 0 |
81 | - && batch.size() < deleteBatchCount; j--) { | |
93 | + && batch.size() < deleteBatchCount; j--) | |
94 | + { | |
82 | 95 | ChildAssociationRef childAssoc = trashChildAssocs.get(j - 1); |
83 | 96 | NodeRef childRef = childAssoc.getChildRef(); |
84 | - if (olderThanDaysToKeep(childRef)) { | |
97 | + if (olderThanDaysToKeep(childRef)) | |
98 | + { | |
85 | 99 | batch.add(childRef); |
86 | 100 | } |
87 | 101 | } |
88 | 102 | return batch; |
89 | 103 | } |
90 | 104 | |
91 | - private List<ChildAssociationRef> getTrashcanChildAssocs() { | |
105 | + private List<ChildAssociationRef> getTrashcanChildAssocs() | |
106 | + { | |
92 | 107 | StoreRef archiveStore = new StoreRef(archiveStoreUrl); |
93 | 108 | NodeRef archiveRoot = nodeService.getRootNode(archiveStore); |
94 | 109 | return nodeService.getChildAssocs(archiveRoot); |
95 | 110 | } |
96 | 111 | |
97 | - private boolean olderThanDaysToKeep(NodeRef node) { | |
98 | - if(daysToKeep<=0) | |
112 | + private boolean olderThanDaysToKeep(NodeRef node) | |
113 | + { | |
114 | + if (daysToKeep <= 0) | |
99 | 115 | return true; |
100 | 116 | Date archivedDate = (Date) nodeService.getProperty(node, |
101 | - ContentModel.PROP_ARCHIVED_DATE); | |
117 | + ContentModel.PROP_ARCHIVED_DATE); | |
102 | 118 | return daysToKeep * DAYS_TO_MILLIS < System.currentTimeMillis() |
103 | - - archivedDate.getTime(); | |
119 | + - archivedDate.getTime(); | |
104 | 120 | } |
105 | 121 | |
106 | 122 | } | ... | ... |
alfresco-trashcan-cleaner-amp/src/main/java/org/alfresco/trashcan/TrashcanCleanerJob.java
... | ... | @@ -10,10 +10,11 @@ import org.quartz.JobExecutionException; |
10 | 10 | |
11 | 11 | /** |
12 | 12 | * |
13 | - * @author rjmfernandes@gmail.com | |
13 | + * @author Rui Fernandes | |
14 | 14 | * |
15 | 15 | */ |
16 | -public class TrashcanCleanerJob extends AbstractScheduledLockedJob { | |
16 | +public class TrashcanCleanerJob extends AbstractScheduledLockedJob | |
17 | +{ | |
17 | 18 | |
18 | 19 | protected NodeService nodeService; |
19 | 20 | protected TransactionService transactionService; |
... | ... | @@ -23,45 +24,51 @@ public class TrashcanCleanerJob extends AbstractScheduledLockedJob { |
23 | 24 | |
24 | 25 | @Override |
25 | 26 | public void executeJob(JobExecutionContext jobContext) |
26 | - throws JobExecutionException { | |
27 | + throws JobExecutionException | |
28 | + { | |
27 | 29 | setUp(jobContext); |
28 | 30 | authenticationComponent.setSystemUserAsCurrentUser(); |
29 | 31 | cleanInTransaction(); |
30 | 32 | } |
31 | 33 | |
32 | - private void cleanInTransaction() { | |
33 | - RetryingTransactionCallback<Object> txnWork = new RetryingTransactionCallback<Object>() { | |
34 | - public Object execute() throws Exception { | |
35 | - TrashcanCleaner cleaner = new TrashcanCleaner(nodeService,deleteBatchCount,daysToKeep); | |
34 | + private void cleanInTransaction() | |
35 | + { | |
36 | + RetryingTransactionCallback<Object> txnWork = new RetryingTransactionCallback<Object>() | |
37 | + { | |
38 | + public Object execute() throws Exception | |
39 | + { | |
40 | + TrashcanCleaner cleaner = new TrashcanCleaner(nodeService, | |
41 | + deleteBatchCount, daysToKeep); | |
36 | 42 | cleaner.clean(); |
37 | 43 | return null; |
38 | 44 | } |
39 | 45 | }; |
40 | 46 | transactionService.getRetryingTransactionHelper().doInTransaction( |
41 | - txnWork); | |
47 | + txnWork); | |
42 | 48 | } |
43 | 49 | |
44 | - private void setUp(JobExecutionContext jobContext) { | |
50 | + private void setUp(JobExecutionContext jobContext) | |
51 | + { | |
45 | 52 | nodeService = (NodeService) jobContext.getJobDetail().getJobDataMap() |
46 | - .get("nodeService"); | |
53 | + .get("nodeService"); | |
47 | 54 | transactionService = (TransactionService) jobContext.getJobDetail() |
48 | - .getJobDataMap().get("transactionService"); | |
55 | + .getJobDataMap().get("transactionService"); | |
49 | 56 | authenticationComponent = (AuthenticationComponent) jobContext |
50 | - .getJobDetail().getJobDataMap().get("authenticationComponent"); | |
57 | + .getJobDetail().getJobDataMap().get("authenticationComponent"); | |
51 | 58 | daysToKeep = getSetupValue("trashcan.daysToKeep", daysToKeep, |
52 | - jobContext); | |
59 | + jobContext); | |
53 | 60 | deleteBatchCount = getSetupValue("trashcan.deleteBatchCount", |
54 | - deleteBatchCount, jobContext); | |
61 | + deleteBatchCount, jobContext); | |
55 | 62 | |
56 | 63 | } |
57 | 64 | |
58 | 65 | private static int getSetupValue(String parameterName, int defaultValue, |
59 | - JobExecutionContext jobContext) { | |
66 | + JobExecutionContext jobContext) | |
67 | + { | |
60 | 68 | String parameterValue = (String) jobContext.getJobDetail() |
61 | - .getJobDataMap().get(parameterName); | |
69 | + .getJobDataMap().get(parameterName); | |
62 | 70 | return parameterValue != null && !parameterValue.trim().equals("") ? Integer |
63 | - .parseInt(parameterValue) | |
64 | - : defaultValue; | |
71 | + .parseInt(parameterValue) : defaultValue; | |
65 | 72 | } |
66 | 73 | |
67 | 74 | } | ... | ... |
alfresco-trashcan-cleaner-amp/src/test/java/org/alfresco/trashcan/TrashcanCleanerTest.java
... | ... | @@ -24,102 +24,117 @@ import org.springframework.context.ApplicationContext; |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * |
27 | - * @author rjmfernandes@gmail.com | |
27 | + * @author Rui Fernandes | |
28 | 28 | * |
29 | 29 | */ |
30 | -public class TrashcanCleanerTest extends TestCase { | |
30 | +public class TrashcanCleanerTest extends TestCase | |
31 | +{ | |
31 | 32 | |
32 | 33 | private static final int BATCH_SIZE = 1000; |
33 | 34 | |
34 | - //private static Log logger = LogFactory.getLog(TrashcanCleanerTest.class); | |
35 | + // private static Log logger = LogFactory.getLog(TrashcanCleanerTest.class); | |
35 | 36 | |
36 | 37 | private static ApplicationContext applicationContext = ApplicationContextHelper |
37 | - .getApplicationContext(); | |
38 | + .getApplicationContext(); | |
38 | 39 | protected NodeService nodeService; |
39 | 40 | protected TransactionService transactionService; |
40 | 41 | protected Repository repository; |
41 | 42 | protected AuthenticationComponent authenticationComponent; |
42 | 43 | |
43 | 44 | @Override |
44 | - public void setUp() { | |
45 | + public void setUp() | |
46 | + { | |
45 | 47 | nodeService = (NodeService) applicationContext.getBean("nodeService"); |
46 | 48 | authenticationComponent = (AuthenticationComponent) applicationContext |
47 | - .getBean("authenticationComponent"); | |
49 | + .getBean("authenticationComponent"); | |
48 | 50 | transactionService = (TransactionService) applicationContext |
49 | - .getBean("transactionComponent"); | |
51 | + .getBean("transactionComponent"); | |
50 | 52 | repository = (Repository) applicationContext |
51 | - .getBean("repositoryHelper"); | |
53 | + .getBean("repositoryHelper"); | |
52 | 54 | |
53 | 55 | // Authenticate as the system user |
54 | 56 | authenticationComponent.setSystemUserAsCurrentUser(); |
55 | 57 | } |
56 | 58 | |
57 | 59 | @Override |
58 | - public void tearDown() { | |
60 | + public void tearDown() | |
61 | + { | |
59 | 62 | authenticationComponent.clearCurrentSecurityContext(); |
60 | 63 | } |
61 | 64 | |
62 | - public void testCleanSimple() throws Throwable { | |
65 | + public void testCleanSimple() throws Throwable | |
66 | + { | |
63 | 67 | cleanBatchTest(1, 0); |
64 | 68 | } |
65 | 69 | |
66 | - public void testCleanBatch() throws Throwable { | |
70 | + public void testCleanBatch() throws Throwable | |
71 | + { | |
67 | 72 | cleanBatchTest(BATCH_SIZE + 1, 1); |
68 | 73 | } |
69 | 74 | |
70 | 75 | private void cleanBatchTest(int nodesCreate, int nodesRemain) |
71 | - throws Throwable { | |
76 | + throws Throwable | |
77 | + { | |
72 | 78 | UserTransaction userTransaction1 = transactionService |
73 | - .getUserTransaction(); | |
74 | - try { | |
79 | + .getUserTransaction(); | |
80 | + try | |
81 | + { | |
75 | 82 | userTransaction1.begin(); |
76 | - TrashcanCleaner cleaner = new TrashcanCleaner(nodeService,BATCH_SIZE,-1); | |
83 | + TrashcanCleaner cleaner = new TrashcanCleaner(nodeService, | |
84 | + BATCH_SIZE, -1); | |
77 | 85 | createAndDeleteNodes(nodesCreate); |
78 | 86 | long nodesToDelete = getNumberOfNodesInTrashcan(); |
79 | 87 | System.out.println(String.format("Existing nodes to delete: %s", |
80 | - nodesToDelete)); | |
88 | + nodesToDelete)); | |
81 | 89 | cleaner.clean(); |
82 | 90 | nodesToDelete = getNumberOfNodesInTrashcan(); |
83 | - System.out.println(String.format("Existing nodes to delete after: %s", | |
84 | - nodesToDelete)); | |
91 | + System.out.println(String.format( | |
92 | + "Existing nodes to delete after: %s", nodesToDelete)); | |
85 | 93 | assertEquals(nodesToDelete, nodesRemain); |
86 | 94 | System.out.println("Clean trashcan..."); |
87 | 95 | cleaner.clean(); |
88 | 96 | userTransaction1.commit(); |
89 | - } catch (Throwable e) { | |
90 | - try { | |
97 | + } catch (Throwable e) | |
98 | + { | |
99 | + try | |
100 | + { | |
91 | 101 | userTransaction1.rollback(); |
92 | - } catch (IllegalStateException ee) { | |
102 | + } catch (IllegalStateException ee) | |
103 | + { | |
93 | 104 | } |
94 | 105 | throw e; |
95 | 106 | } |
96 | 107 | } |
97 | 108 | |
98 | - private void createAndDeleteNodes(int n) { | |
99 | - for (int i = n; i > 0; i--) { | |
109 | + private void createAndDeleteNodes(int n) | |
110 | + { | |
111 | + for (int i = n; i > 0; i--) | |
112 | + { | |
100 | 113 | createAndDeleteNode(); |
101 | 114 | } |
102 | 115 | |
103 | 116 | } |
104 | 117 | |
105 | - private void createAndDeleteNode() { | |
118 | + private void createAndDeleteNode() | |
119 | + { | |
106 | 120 | NodeRef companyHome = repository.getCompanyHome(); |
107 | 121 | String name = "Sample (" + System.currentTimeMillis() + ")"; |
108 | 122 | Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>(); |
109 | 123 | contentProps.put(ContentModel.PROP_NAME, name); |
110 | 124 | ChildAssociationRef association = nodeService.createNode(companyHome, |
111 | - ContentModel.ASSOC_CONTAINS, QName.createQName( | |
112 | - NamespaceService.CONTENT_MODEL_PREFIX, name), | |
113 | - ContentModel.TYPE_CONTENT, contentProps); | |
125 | + ContentModel.ASSOC_CONTAINS, | |
126 | + QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, name), | |
127 | + ContentModel.TYPE_CONTENT, contentProps); | |
114 | 128 | nodeService.deleteNode(association.getChildRef()); |
115 | 129 | |
116 | 130 | } |
117 | - | |
118 | - private long getNumberOfNodesInTrashcan() { | |
131 | + | |
132 | + private long getNumberOfNodesInTrashcan() | |
133 | + { | |
119 | 134 | StoreRef archiveStore = new StoreRef("archive://SpacesStore"); |
120 | 135 | NodeRef archiveRoot = nodeService.getRootNode(archiveStore); |
121 | 136 | List<ChildAssociationRef> childAssocs = nodeService |
122 | - .getChildAssocs(archiveRoot); | |
137 | + .getChildAssocs(archiveRoot); | |
123 | 138 | return childAssocs.size(); |
124 | 139 | |
125 | 140 | } | ... | ... |
alfresco/pom.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor |
3 | - license agreements. See the NOTICE file distributed with this work for additional | |
4 | - information regarding copyright ownership. The ASF licenses this file to | |
5 | - You under the Apache License, Version 2.0 (the "License"); you may not use | |
6 | - this file except in compliance with the License. You may obtain a copy of | |
7 | - the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required | |
8 | - by applicable law or agreed to in writing, software distributed under the | |
9 | - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | |
10 | - OF ANY KIND, either express or implied. See the License for the specific | |
11 | - language governing permissions and limitations under the License. --> | |
12 | - | |
3 | + license agreements. See the NOTICE file distributed with this work for additional | |
4 | + information regarding copyright ownership. The ASF licenses this file to | |
5 | + You under the Apache License, Version 2.0 (the "License"); you may not use | |
6 | + this file except in compliance with the License. You may obtain a copy of | |
7 | + the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required | |
8 | + by applicable law or agreed to in writing, software distributed under the | |
9 | + License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS | |
10 | + OF ANY KIND, either express or implied. See the License for the specific | |
11 | + language governing permissions and limitations under the License. --> | |
12 | + | |
13 | 13 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
14 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
15 | - <modelVersion>4.0.0</modelVersion> | |
16 | - <artifactId>alfresco</artifactId> | |
17 | - <name>Alfresco Repository and Explorer Client</name> | |
18 | - <packaging>war</packaging> | |
19 | - <description>Alfresco Repository and Explorer Client</description> | |
14 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
15 | + <modelVersion>4.0.0</modelVersion> | |
16 | + <artifactId>alfresco</artifactId> | |
17 | + <name>Alfresco Repository and Explorer Client</name> | |
18 | + <packaging>war</packaging> | |
19 | + <description>Alfresco Repository and Explorer Client</description> | |
20 | 20 | |
21 | - <parent> | |
22 | - <groupId>org.alfresco</groupId> | |
23 | - <artifactId>alfresco-trashcan-cleaner</artifactId> | |
24 | - <version>1.2-SNAPSHOT</version> | |
25 | - </parent> | |
21 | + <parent> | |
22 | + <groupId>org.alfresco</groupId> | |
23 | + <artifactId>alfresco-trashcan-cleaner</artifactId> | |
24 | + <version>1.2-SNAPSHOT</version> | |
25 | + </parent> | |
26 | 26 | |
27 | - <dependencies> | |
28 | - <dependency> | |
29 | - <groupId>${alfresco.groupId}</groupId> | |
30 | - <artifactId>alfresco</artifactId> | |
31 | - <type>war</type> | |
32 | - </dependency> | |
33 | - <!-- Demonstrating the dependency on the AMP developed in the 'amp' project --> | |
34 | - <dependency> | |
35 | - <groupId>${project.groupId}</groupId> | |
36 | - <artifactId>alfresco-trashcan-cleaner-amp</artifactId> | |
37 | - <version>${project.version}</version> | |
38 | - <type>amp</type> | |
39 | - </dependency> | |
40 | - </dependencies> | |
27 | + <dependencies> | |
28 | + <dependency> | |
29 | + <groupId>${alfresco.groupId}</groupId> | |
30 | + <artifactId>alfresco</artifactId> | |
31 | + <type>war</type> | |
32 | + </dependency> | |
33 | + <!-- Demonstrating the dependency on the AMP developed in the 'amp' project --> | |
34 | + <dependency> | |
35 | + <groupId>${project.groupId}</groupId> | |
36 | + <artifactId>alfresco-trashcan-cleaner-amp</artifactId> | |
37 | + <version>${project.version}</version> | |
38 | + <type>amp</type> | |
39 | + </dependency> | |
40 | + </dependencies> | |
41 | 41 | |
42 | - <build> | |
43 | - <plugins> | |
44 | - <plugin> | |
45 | - <artifactId>maven-war-plugin</artifactId> | |
46 | - <configuration> | |
47 | - <!-- Here is can control the order of overlay of your (WAR, AMP, etc.) dependencies | |
48 | - | NOTE: At least one WAR dependency must be uncompressed first | |
49 | - | NOTE: In order to have a dependency effectively added to the WAR you need to | |
50 | - | explicitly mention it in the overlay section. | |
51 | - | NOTE: First-win resource strategy is used by the WAR plugin | |
52 | - --> | |
53 | - <overlays> | |
54 | - <!-- Current project customizations --> | |
55 | - <overlay/> | |
56 | - <!-- The Alfresco WAR --> | |
57 | - <overlay> | |
58 | - <groupId>${alfresco.groupId}</groupId> | |
59 | - <artifactId>alfresco</artifactId> | |
60 | - <type>war</type> | |
61 | - <!-- To allow inclusion of META-INF --> | |
62 | - <excludes/> | |
63 | - </overlay> | |
64 | - <!-- Add / order your AMPs here --> | |
65 | - <overlay> | |
66 | - <groupId>${project.groupId}</groupId> | |
67 | - <artifactId>alfresco-trashcan-cleaner-amp</artifactId> | |
68 | - <type>amp</type> | |
69 | - </overlay> | |
70 | - </overlays> | |
71 | - </configuration> | |
72 | - </plugin> | |
73 | - </plugins> | |
74 | - </build> | |
42 | + <build> | |
43 | + <plugins> | |
44 | + <plugin> | |
45 | + <artifactId>maven-war-plugin</artifactId> | |
46 | + <configuration> | |
47 | + <!-- Here is can control the order of overlay of your (WAR, AMP, etc.) | |
48 | + dependencies | NOTE: At least one WAR dependency must be uncompressed first | |
49 | + | NOTE: In order to have a dependency effectively added to the WAR you need | |
50 | + to | explicitly mention it in the overlay section. | NOTE: First-win resource | |
51 | + strategy is used by the WAR plugin --> | |
52 | + <overlays> | |
53 | + <!-- Current project customizations --> | |
54 | + <overlay /> | |
55 | + <!-- The Alfresco WAR --> | |
56 | + <overlay> | |
57 | + <groupId>${alfresco.groupId}</groupId> | |
58 | + <artifactId>alfresco</artifactId> | |
59 | + <type>war</type> | |
60 | + <!-- To allow inclusion of META-INF --> | |
61 | + <excludes /> | |
62 | + </overlay> | |
63 | + <!-- Add / order your AMPs here --> | |
64 | + <overlay> | |
65 | + <groupId>${project.groupId}</groupId> | |
66 | + <artifactId>alfresco-trashcan-cleaner-amp</artifactId> | |
67 | + <type>amp</type> | |
68 | + </overlay> | |
69 | + </overlays> | |
70 | + </configuration> | |
71 | + </plugin> | |
72 | + </plugins> | |
73 | + </build> | |
75 | 74 | </project> | ... | ... |
runner/jetty/jetty.xml
... | ... | @@ -2,33 +2,33 @@ |
2 | 2 | <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> |
3 | 3 | |
4 | 4 | <Configure id="Server" class="org.mortbay.jetty.Server"> |
5 | - <New id="myDataSource" class="org.mortbay.jetty.plus.naming.Resource"> | |
6 | - <Arg>jdbc/dataSource</Arg> | |
7 | - <Arg> | |
8 | - <New class="${alfresco.db.datasource.class}"> | |
9 | - <Set name="URL">${alfresco.db.url}</Set> | |
10 | - <Set name="User">${alfresco.db.username}</Set> | |
11 | - <Set name="Password">${alfresco.db.password}</Set> | |
12 | - </New> | |
13 | - </Arg> | |
14 | - </New> | |
15 | - <Call name="addConnector"> | |
16 | - <Arg> | |
17 | - <New class="org.mortbay.jetty.nio.SelectChannelConnector"> | |
18 | - <Set name="host"> | |
19 | - <Property name="jetty.host" default="${runner.host}" /> | |
20 | - </Set> | |
21 | - <Set name="port"> | |
22 | - <Property name="jetty.port" default="${runner.port}" /> | |
23 | - </Set> | |
24 | - <Set name="maxIdleTime">300000</Set> | |
25 | - <Set name="Acceptors">2</Set> | |
26 | - <Set name="statsOn">false</Set> | |
27 | - <Set name="confidentialPort">8443</Set> | |
28 | - <Set name="lowResourcesConnections">20000</Set> | |
29 | - <Set name="lowResourcesMaxIdleTime">5000</Set> | |
30 | - </New> | |
31 | - </Arg> | |
32 | - </Call> | |
5 | + <New id="myDataSource" class="org.mortbay.jetty.plus.naming.Resource"> | |
6 | + <Arg>jdbc/dataSource</Arg> | |
7 | + <Arg> | |
8 | + <New class="${alfresco.db.datasource.class}"> | |
9 | + <Set name="URL">${alfresco.db.url}</Set> | |
10 | + <Set name="User">${alfresco.db.username}</Set> | |
11 | + <Set name="Password">${alfresco.db.password}</Set> | |
12 | + </New> | |
13 | + </Arg> | |
14 | + </New> | |
15 | + <Call name="addConnector"> | |
16 | + <Arg> | |
17 | + <New class="org.mortbay.jetty.nio.SelectChannelConnector"> | |
18 | + <Set name="host"> | |
19 | + <Property name="jetty.host" default="${runner.host}" /> | |
20 | + </Set> | |
21 | + <Set name="port"> | |
22 | + <Property name="jetty.port" default="${runner.port}" /> | |
23 | + </Set> | |
24 | + <Set name="maxIdleTime">300000</Set> | |
25 | + <Set name="Acceptors">2</Set> | |
26 | + <Set name="statsOn">false</Set> | |
27 | + <Set name="confidentialPort">8443</Set> | |
28 | + <Set name="lowResourcesConnections">20000</Set> | |
29 | + <Set name="lowResourcesMaxIdleTime">5000</Set> | |
30 | + </New> | |
31 | + </Arg> | |
32 | + </Call> | |
33 | 33 | |
34 | 34 | </Configure> |
35 | 35 | \ No newline at end of file | ... | ... |
runner/jetty/root-web.xml
... | ... | @@ -5,6 +5,6 @@ |
5 | 5 | "http://java.sun.com/dtd/web-app_2_3.dtd"> |
6 | 6 | |
7 | 7 | <web-app> |
8 | - <display-name>Alfresco Runner</display-name> | |
9 | - <description>Alfresco Runner</description> | |
8 | + <display-name>Alfresco Runner</display-name> | |
9 | + <description>Alfresco Runner</description> | |
10 | 10 | </web-app> |
11 | 11 | \ No newline at end of file | ... | ... |
runner/pom.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
3 | - <modelVersion>4.0.0</modelVersion> | |
4 | - <artifactId>runner</artifactId> | |
5 | - <name>Alfresco Runner</name> | |
6 | - <packaging>pom</packaging> | |
7 | - <description>Alfresco Runner</description> | |
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
4 | + <modelVersion>4.0.0</modelVersion> | |
5 | + <artifactId>runner</artifactId> | |
6 | + <name>Alfresco Runner</name> | |
7 | + <packaging>pom</packaging> | |
8 | + <description>Alfresco Runner</description> | |
8 | 9 | |
9 | - <parent> | |
10 | - <groupId>org.alfresco</groupId> | |
11 | - <artifactId>alfresco-trashcan-cleaner</artifactId> | |
12 | - <version>1.2-SNAPSHOT</version> | |
13 | - </parent> | |
10 | + <parent> | |
11 | + <groupId>org.alfresco</groupId> | |
12 | + <artifactId>alfresco-trashcan-cleaner</artifactId> | |
13 | + <version>1.2-SNAPSHOT</version> | |
14 | + </parent> | |
14 | 15 | |
15 | - <profiles> | |
16 | - <profile> | |
17 | - <id>run</id> | |
18 | - <activation> | |
19 | - <property> | |
20 | - <name>run</name> | |
21 | - </property> | |
22 | - </activation> | |
23 | - <properties> | |
24 | - <runner.host>127.0.0.1</runner.host> | |
25 | - <runner.port>8080</runner.port> | |
26 | - </properties> | |
27 | - <build> | |
28 | - <plugins> | |
29 | - <plugin> | |
30 | - <groupId>org.mortbay.jetty</groupId> | |
31 | - <artifactId>maven-jetty-plugin</artifactId> | |
32 | - <executions> | |
33 | - <execution> | |
34 | - <id>run</id> | |
35 | - <goals><goal>run</goal></goals> | |
36 | - <phase>integration-test</phase> | |
37 | - </execution> | |
38 | - </executions> | |
39 | - <configuration> | |
40 | - <!-- Following 3 properties set an empty ROOT context, | |
41 | - which is mandatory to run jetty:run plugin --> | |
42 | - <contextPath>/</contextPath> | |
43 | - <webAppSourceDirectory>.</webAppSourceDirectory> | |
44 | - <webXml>jetty/root-web.xml</webXml> | |
45 | - <contextHandlers> | |
46 | - <contextHandler implementation="org.mortbay.jetty.webapp.WebAppContext"> | |
47 | - <war>${project.basedir}/../alfresco/target/alfresco.war</war> | |
48 | - <contextPath>/alfresco</contextPath> | |
49 | - </contextHandler> | |
50 | - </contextHandlers> | |
51 | - </configuration> | |
52 | - </plugin> | |
53 | - </plugins> | |
54 | - </build> | |
55 | - </profile> | |
56 | - </profiles> | |
16 | + <profiles> | |
17 | + <profile> | |
18 | + <id>run</id> | |
19 | + <activation> | |
20 | + <property> | |
21 | + <name>run</name> | |
22 | + </property> | |
23 | + </activation> | |
24 | + <properties> | |
25 | + <runner.host>127.0.0.1</runner.host> | |
26 | + <runner.port>8080</runner.port> | |
27 | + </properties> | |
28 | + <build> | |
29 | + <plugins> | |
30 | + <plugin> | |
31 | + <groupId>org.mortbay.jetty</groupId> | |
32 | + <artifactId>maven-jetty-plugin</artifactId> | |
33 | + <executions> | |
34 | + <execution> | |
35 | + <id>run</id> | |
36 | + <goals> | |
37 | + <goal>run</goal> | |
38 | + </goals> | |
39 | + <phase>integration-test</phase> | |
40 | + </execution> | |
41 | + </executions> | |
42 | + <configuration> | |
43 | + <!-- Following 3 properties set an empty ROOT context, which is mandatory | |
44 | + to run jetty:run plugin --> | |
45 | + <contextPath>/</contextPath> | |
46 | + <webAppSourceDirectory>.</webAppSourceDirectory> | |