Commit 55a23d394f8710bf88a5a66e5b98913c76a054f7

Authored by Steven Glover
1 parent 3e27a1b94c
Exists in master

REPO-1486 "Create Build Plans" add distribution management to pom, tidy up Readme

Showing 2 changed files with 17 additions and 23 deletions   Show diff stats
1 This library adds a scheduled job that will empty your Alfresco trashcan according to configuration. 1 This library adds a scheduled job that will empty your Alfresco trashcan according to configuration. The following properties can be configured in alfresco-global.properties:
2 It receives as parameters (configured on alfresco-global.properties):
3 2
4 trashcan.cron=0 30 * * * ? 3 trashcan.cron=0 30 * * * ?
5 4 trashcan.daysToKeep=P1D
6 trashcan.daysToKeep=1
7
8 trashcan.deleteBatchCount=1000 5 trashcan.deleteBatchCount=1000
9 6
10 In the above configuration the scheduled process will clean all deleted items older than one day to a maximum of 1000 (each execution) each hour at the middle of the hour (30 minutes). 7 In the above configuration the scheduled process will clean all deleted items older than one day to a maximum of 1000 (each execution) each hour at the middle of the hour (30 minutes).
11 In case you wish to delete all items (to the max number set) irrespective of the archived date just set trashcan.daysToKeep to -1.
12
13 The major differences with existing addon (http://addons.alfresco.com/addons/trashcan-cleaner) is the fact this job is not based on search engine and the scheduled job is cluster aware (uses the Alfresco org.alfresco.schedule.ScheduledJobLockExecuter).
14
15 This has been tested for:
16
17 - Alfresco Enterprise 4.1.1.3 (use version https://github.com/rjmfernandes/alfresco-trashcan-cleaner/tree/1.2.0)
18
19 - Alfresco Community 4.2.e (use version - https://github.com/rjmfernandes/alfresco-trashcan-cleaner/tree/v2.0.0) - only unit tests
20
21 - Alfresco Enterprise 4.2.0 (last version - https://github.com/rjmfernandes/alfresco-trashcan-cleaner/tree/v2.1.0) - only unit tests
22
23 If you want to add log related to this job, just add to log4j.properties:
24 8
25 log4j.logger.org.alfresco.trashcan=debug 9 To enable debug logging:
26 10
27 This new version takes into account the new way Alfresco 4.2 trashes content keeping a secondary parent reference inside trashcan to the original owner (those references dont have an archive date associated with it what caused an error when trying past versions of the cleaner with 4.2). 11 log4j.logger.org.alfresco.trashcan=debug
28 The new trashcan cleaner does not try to delete those references.
29
1 <?xml version="1.0" encoding="UTF-8"?> 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" 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"> 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> 4 <modelVersion>4.0.0</modelVersion>
5 <artifactId>alfresco-trashcan-cleaner</artifactId> 5 <artifactId>alfresco-trashcan-cleaner</artifactId>
6 <version>2.1-SNAPSHOT</version> 6 <version>2.1-SNAPSHOT</version>
7 <name>alfresco-trashcan-cleaner project</name> 7 <name>alfresco-trashcan-cleaner project</name>
8 <packaging>jar</packaging> 8 <packaging>jar</packaging>
9 <description>The Alfresco Trash Can Cleaner (Alfresco Module)</description> 9 <description>The Alfresco Trash Can Cleaner (Alfresco Module)</description>
10 10
11 <parent> 11 <parent>
12 <groupId>org.alfresco</groupId> 12 <groupId>org.alfresco</groupId>
13 <artifactId>alfresco-super-pom</artifactId> 13 <artifactId>alfresco-super-pom</artifactId>
14 <version>7</version> 14 <version>7</version>
15 </parent> 15 </parent>
16 16
17 <properties> 17 <properties>
18 <!-- Defines the alfresco edition to compile against. Allowed values are [org.alfresco|org.alfresco.enterprise]--> 18 <!-- Defines the alfresco edition to compile against. Allowed values are [org.alfresco|org.alfresco.enterprise]-->
19 <alfresco.groupId>org.alfresco</alfresco.groupId> 19 <alfresco.groupId>org.alfresco</alfresco.groupId>
20 <!-- Defines the alfresco version to compile against --> 20 <!-- Defines the alfresco version to compile against -->
21 <alfresco.version>5.2.1-SNAPSHOT</alfresco.version> 21 <alfresco.version>5.2.1-SNAPSHOT</alfresco.version>
22 22
23 <db.drop.command>drop database if exists ${db.name}</db.drop.command> 23 <db.drop.command>drop database if exists ${db.name}</db.drop.command>
24 <db.create.command>create database ${db.name}</db.create.command> 24 <db.create.command>create database ${db.name}</db.create.command>
25 <db.driver>org.postgresql.Driver</db.driver> 25 <db.driver>org.postgresql.Driver</db.driver>
26 <db.name>alfresco</db.name> 26 <db.name>alfresco</db.name>
27 <db.url>jdbc:postgresql:${db.name}</db.url> 27 <db.url>jdbc:postgresql:${db.name}</db.url>
28 <db.master.url>jdbc:postgresql:template1</db.master.url> 28 <db.master.url>jdbc:postgresql:template1</db.master.url>
29 <db.master.username>alfresco</db.master.username> 29 <db.master.username>alfresco</db.master.username>
30 <db.master.password>alfresco</db.master.password> 30 <db.master.password>alfresco</db.master.password>
31 </properties> 31 </properties>
32 32
33 <!-- Here we realize the connection with the Alfresco selected platform 33 <!-- Here we realize the connection with the Alfresco selected platform
34 (e.g.version and edition) --> 34 (e.g.version and edition) -->
35 <dependencyManagement> 35 <dependencyManagement>
36 <dependencies> 36 <dependencies>
37 <!-- 37 <!--
38 This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition 38 This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition
39 (see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies) 39 (see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
40 NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults 40 NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults
41 to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom 41 to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom
42 --> 42 -->
43 <dependency> 43 <dependency>
44 <groupId>${alfresco.groupId}</groupId> 44 <groupId>${alfresco.groupId}</groupId>
45 <artifactId>alfresco-platform-distribution</artifactId> 45 <artifactId>alfresco-platform-distribution</artifactId>
46 <version>${alfresco.version}</version> 46 <version>${alfresco.version}</version>
47 <type>pom</type> 47 <type>pom</type>
48 <scope>import</scope> 48 <scope>import</scope>
49 </dependency> 49 </dependency>
50 </dependencies> 50 </dependencies>
51 </dependencyManagement> 51 </dependencyManagement>
52 52
53 <!-- Following dependencies are needed for compiling Java code in src/main/java; 53 <!-- Following dependencies are needed for compiling Java code in src/main/java;
54 <scope>provided</scope> is inherited for each of the following; 54 <scope>provided</scope> is inherited for each of the following;
55 for more info, please refer to alfresco-platform-distribution POM --> 55 for more info, please refer to alfresco-platform-distribution POM -->
56 <dependencies> 56 <dependencies>
57 <dependency> 57 <dependency>
58 <groupId>${alfresco.groupId}</groupId> 58 <groupId>${alfresco.groupId}</groupId>
59 <artifactId>alfresco-repository</artifactId> 59 <artifactId>alfresco-repository</artifactId>
60 </dependency> 60 </dependency>
61 <dependency> 61 <dependency>
62 <groupId>javax.servlet</groupId> 62 <groupId>javax.servlet</groupId>
63 <artifactId>servlet-api</artifactId> 63 <artifactId>servlet-api</artifactId>
64 <version>2.5</version> 64 <version>2.5</version>
65 <scope>provided</scope> 65 <scope>provided</scope>
66 </dependency> 66 </dependency>
67 <!-- Test dependencies --> 67 <!-- Test dependencies -->
68 <dependency> 68 <dependency>
69 <groupId>junit</groupId> 69 <groupId>junit</groupId>
70 <artifactId>junit</artifactId> 70 <artifactId>junit</artifactId>
71 <scope>test</scope> 71 <scope>test</scope>
72 </dependency> 72 </dependency>
73 <dependency> 73 <dependency>
74 <groupId>xml-apis</groupId> 74 <groupId>xml-apis</groupId>
75 <artifactId>xml-apis</artifactId> 75 <artifactId>xml-apis</artifactId>
76 <scope>test</scope> 76 <scope>test</scope>
77 </dependency> 77 </dependency>
78 <dependency> 78 <dependency>
79 <groupId>org.postgresql</groupId> 79 <groupId>org.postgresql</groupId>
80 <artifactId>postgresql</artifactId> 80 <artifactId>postgresql</artifactId>
81 <scope>test</scope> 81 <scope>test</scope>
82 </dependency> 82 </dependency>
83 </dependencies> 83 </dependencies>
84 84
85 <build> 85 <build>
86 <resources> 86 <resources>
87 <resource> 87 <resource>
88 <filtering>true</filtering> 88 <filtering>true</filtering>
89 <directory>src/main/config</directory> 89 <directory>src/main/config</directory>
90 </resource> 90 </resource>
91 </resources> 91 </resources>
92 92
93 <pluginManagement> 93 <pluginManagement>
94 <plugins> 94 <plugins>
95 <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> 95 <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
96 <plugin> 96 <plugin>
97 <groupId>org.eclipse.m2e</groupId> 97 <groupId>org.eclipse.m2e</groupId>
98 <artifactId>lifecycle-mapping</artifactId> 98 <artifactId>lifecycle-mapping</artifactId>
99 <version>1.0.0</version> 99 <version>1.0.0</version>
100 <configuration> 100 <configuration>
101 <lifecycleMappingMetadata> 101 <lifecycleMappingMetadata>
102 <pluginExecutions> 102 <pluginExecutions>
103 <pluginExecution> 103 <pluginExecution>
104 <pluginExecutionFilter> 104 <pluginExecutionFilter>
105 <groupId> 105 <groupId>
106 org.codehaus.mojo 106 org.codehaus.mojo
107 </groupId> 107 </groupId>
108 <artifactId> 108 <artifactId>
109 sql-maven-plugin 109 sql-maven-plugin
110 </artifactId> 110 </artifactId>
111 <versionRange> 111 <versionRange>
112 [1.5,) 112 [1.5,)
113 </versionRange> 113 </versionRange>
114 <goals> 114 <goals>
115 <goal>execute</goal> 115 <goal>execute</goal>
116 </goals> 116 </goals>
117 </pluginExecutionFilter> 117 </pluginExecutionFilter>
118 <action> 118 <action>
119 <ignore></ignore> 119 <ignore></ignore>
120 </action> 120 </action>
121 </pluginExecution> 121 </pluginExecution>
122 </pluginExecutions> 122 </pluginExecutions>
123 </lifecycleMappingMetadata> 123 </lifecycleMappingMetadata>
124 </configuration> 124 </configuration>
125 </plugin> 125 </plugin>
126 </plugins> 126 </plugins>
127 </pluginManagement> 127 </pluginManagement>
128 </build> 128 </build>
129 129
130 <distributionManagement>
131 <repository>
132 <id>alfresco-internal</id>
133 <url>https://artifacts.alfresco.com/nexus/content/repositories/internal-releases</url>
134 </repository>
135 <snapshotRepository>
136 <id>alfresco-internal-snapshots</id>
137 <url>https://artifacts.alfresco.com/nexus/content/repositories/internal-snapshots</url>
138 </snapshotRepository>
139 </distributionManagement>
140
130 <profiles> 141 <profiles>
131 <profile> 142 <profile>
132 <!-- Wipe the database before starting tests --> 143 <!-- Wipe the database before starting tests -->
133 <id>wipe-db</id> 144 <id>wipe-db</id>
134 <activation> 145 <activation>
135 <property> 146 <property>
136 <name>wipeDB</name> 147 <name>wipeDB</name>
137 </property> 148 </property>
138 </activation> 149 </activation>
139 <build> 150 <build>
140 <plugins> 151 <plugins>
141 <plugin> 152 <plugin>
142 <groupId>org.codehaus.mojo</groupId> 153 <groupId>org.codehaus.mojo</groupId>
143 <artifactId>sql-maven-plugin</artifactId> 154 <artifactId>sql-maven-plugin</artifactId>
144 <dependencies> 155 <dependencies>
145 <dependency> 156 <dependency>
146 <groupId>org.postgresql</groupId> 157 <groupId>org.postgresql</groupId>
147 <artifactId>postgresql</artifactId> 158 <artifactId>postgresql</artifactId>
148 <version>${dependency.postgresql.version}</version> 159 <version>${dependency.postgresql.version}</version>
149 </dependency> 160 </dependency>
150 </dependencies> 161 </dependencies>
151 <configuration> 162 <configuration>
152 <skip>${db.skip}</skip> 163 <skip>${db.skip}</skip>
153 <autocommit>true</autocommit> 164 <autocommit>true</autocommit>
154 <driver>${db.driver}</driver> 165 <driver>${db.driver}</driver>
155 <url>${db.master.url}</url> 166 <url>${db.master.url}</url>
156 <username>${db.master.username}</username> 167 <username>${db.master.username}</username>
157 <password>${db.master.password}</password> 168 <password>${db.master.password}</password>
158 </configuration> 169 </configuration>
159 <executions> 170 <executions>
160 <execution> 171 <execution>
161 <id>drop-db</id> 172 <id>drop-db</id>
162 <phase>initialize</phase> 173 <phase>initialize</phase>
163 <goals> 174 <goals>
164 <goal>execute</goal> 175 <goal>execute</goal>
165 </goals> 176 </goals>
166 <configuration> 177 <configuration>
167 <skip>false</skip><!-- always run --> 178 <skip>false</skip><!-- always run -->
168 <sqlCommand>${db.drop.command}</sqlCommand> 179 <sqlCommand>${db.drop.command}</sqlCommand>
169 </configuration> 180 </configuration>
170 </execution> 181 </execution>
171 <execution> 182 <execution>
172 <id>create-db</id> 183 <id>create-db</id>
173 <phase>initialize</phase> 184 <phase>initialize</phase>
174 <goals> 185 <goals>
175 <goal>execute</goal> 186 <goal>execute</goal>
176 </goals> 187 </goals>
177 <configuration> 188 <configuration>
178 <skip>false</skip><!-- always run --> 189 <skip>false</skip><!-- always run -->
179 <sqlCommand>${db.create.command}</sqlCommand> 190 <sqlCommand>${db.create.command}</sqlCommand>
180 </configuration> 191 </configuration>
181 </execution> 192 </execution>
182 </executions> 193 </executions>
183 </plugin> 194 </plugin>
184 </plugins> 195 </plugins>
185 </build> 196 </build>
186 </profile> 197 </profile>
187 </profiles> 198 </profiles>
188 </project> 199 </project>
189 200