Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
angelborroy-ks committed Jul 16, 2016
0 parents commit f778362
Show file tree
Hide file tree
Showing 16 changed files with 958 additions and 0 deletions.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Alfresco Version by Name
========================

When uploading files having the same to a folder in Alfresco, the platform renames that new uploaded file (including "-1" and so on counters) and creates a new file.

```
1: Folder > Test.pdf
2: Upload Test.pdf to Folder
3: Folder > Test.pdf, Test-1.pdf
4: Upload Test.pdf to Folder
5: Folder > Test.pdf, Test-1.pdf, Test-2.pdf
...
```

This addon provides a behaviour to auto-versioning the existing file with the content of the new one.

```
1: Folder > Test.pdf
2: Upload Test.pdf to Folder
3: Folder > Test.pdf [1.1]
4: Upload Test.pdf to Folder
5: Folder > Test.pdf [1.2]
...
```
[Video demo available](https://www.youtube.com/watch?v=27gjzEPOomo)

**License**
The plugin is licensed under the [LGPL v3.0](http://www.gnu.org/licenses/lgpl-3.0.html).

**State**
Current addon release is 1.0.0

**Compatibility**
The current version has been developed using Alfresco 5.1 and Alfresco SDK 2.2.0, although it should run in Alfresco 5.0.d and Alfresco 5.0.c

***No original Alfresco resources have been overwritten***

Downloading the ready-to-deploy-plugin
--------------------------------------
The binary distribution is made of one amp file to be deployed in Alfresco as a repo module:

* [repo AMP](https://github.com/keensoft/alfresco-version-by-name/releases/download/1.0.0/version-by-name-repo-1.0.0.amp)

You can install it by using standard [Alfresco deployment tools](http://docs.alfresco.com/community/tasks/dev-extensions-tutorials-simple-module-install-amp.html) in `alfresco.war`

Building the artifacts
----------------------
You can build the artifacts from source code using maven
```$ mvn clean package```

Notes
-----
This addon does not allow the use of the feature with WebDAV.
101 changes: 101 additions & 0 deletions version-by-name-repo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>es.keensoft</groupId>
<artifactId>version-by-name-repo</artifactId>
<version>1.0.0</version>
<name>version-by-name-repo Repository AMP project</name>
<packaging>amp</packaging>
<description>Manages the lifecycle of the version-by-name-repo Repository AMP (Alfresco Module Package)</description>

<parent>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-sdk-parent</artifactId>
<version>2.2.0</version>
</parent>

<!--
SDK properties have sensible defaults in the SDK parent,
but you can override the properties below to use another version.
For more available properties see the alfresco-sdk-parent POM.
-->
<properties>
<!-- The following are default values for data location and Alfresco Community version.
Uncomment if you need to change (Note. current default version for Enterprise edition is 5.1)
<alfresco.version>5.1.e</alfresco.version>
<alfresco.data.location>/absolute/path/to/alf_data_dev</alfresco.data.location> -->

<!-- This control the root logging level for all apps uncomment and change, defaults to WARN
<app.log.root.level>WARN</app.log.root.level>
-->

<!-- Set the enviroment to use, this controls which properties will be picked in src/test/properties
for embedded run, defaults to the 'local' environment. See SDK Parent POM for more info.
<env>local</env>
-->
</properties>

<!-- Here we realize the connection with the Alfresco selected platform
(e.g.version and edition) -->
<dependencyManagement>
<dependencies>
<!-- Setup what versions of the different Alfresco artifacts that will be used (depends on alfresco.version),
so we don't have to specify version in any of the dependency definitions in our POM.
For more info see:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies
-->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Following dependencies are needed for compiling Java code in src/main/java;
<scope>provided</scope> is inherited for each of the following;
for more info, please refer to alfresco-platform-distribution POM -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-repository</artifactId>
</dependency>

<!-- If we are running tests then make the H2 Scripts available
Note. tests are skipped when you are running -Pamp-to-war -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-repository</artifactId>
<version>${alfresco.version}</version>
<classifier>h2scripts</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<profiles>
<!--
Brings in the extra Enterprise specific repository classes,
if the 'enterprise' profile has been activated, needs to be activated manually.
-->
<profile>
<id>enterprise</id>
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-enterprise-repository</artifactId>
<version>${alfresco.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
8 changes: 8 additions & 0 deletions version-by-name-repo/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@ECHO OFF

IF "%MAVEN_OPTS%" == "" (
ECHO The environment variable 'MAVEN_OPTS' is not set, setting it for you
SET MAVEN_OPTS=-Xms256m -Xmx2G -XX:PermSize=300m
)
ECHO MAVEN_OPTS is set to '%MAVEN_OPTS%'
mvn clean install -Pamp-to-war
7 changes: 7 additions & 0 deletions version-by-name-repo/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
if [[ -z ${MAVEN_OPTS} ]]; then
echo "The environment variable 'MAVEN_OPTS' is not set, setting it for you";
MAVEN_OPTS="-Xms256m -Xmx1524m -XX:PermSize=300m"
fi
echo "MAVEN_OPTS is set to '$MAVEN_OPTS'";
mvn clean install -Pamp-to-war
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## This Alfresco Repo Configuration file should be used for custom properties that are introduced by this module.
## Define default values for all properties here.
## System Administrators can override these values in environment specific configurations in
## alfresco/tomcat/shared/classes/alfresco-global.properties.
##
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>

<bean id="autoVersionByNameBehaviour" class="es.keensoft.alfresco.behaviour.AutoVersionByNameBehaviour" init-method="init">
<property name="policyComponent" ref="policyComponent"/>
<property name="nodeService" ref="NodeService"/>
<property name="contentService" ref="ContentService"/>
<property name="transactionService" ref="TransactionService" />
<property name="threadPoolExecutor" ref="autoVersionByNumberThreadPoolExecutor" />
</bean>

<bean id="autoVersionByNumberThreadPoolExecutor" class="org.alfresco.util.ThreadPoolExecutorFactoryBean">
<property name="poolName" value="syncFoldersThreadPool" />
<property name="corePoolSize" value="1" />
<property name="maximumPoolSize" value="1" />
<property name="threadPriority" value="5" />
</bean>

</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-----------------------------------------------------------------------
# version-by-name-repo module log4j.properties
#
# NOTE
# ----
# Log4j uses the following logging levels:
# debug,info,warn,error,fatal
#
# To set the logging level of {fullClassName} to {loglevel},
# add a line to this file of the following form:
#
# log4j.logger.{fullClassName}={loglevel}
#
# For example, to make 'com.example.MyExample' produce 'debug'
# logs, add a line like this:
#
# log4j.logger.com.example.MyExample=debug
#
#
# WARNING
# -------
# Log properties in this log4j.properties file override/augment
# those in the webapp's main log4j.properties.
#
#-----------------------------------------------------------------------
log4j.logger.es.keensoft.demoamp.DemoComponent=debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
<!-- This is filtered by Maven at build time, so that module name is single sourced. -->
<!-- Note. The bootstrap-context.xml file has to be loaded first.
Otherwise your custom models are not yet loaded when your service beans are instantiated and you
cannot for example register policies on them. -->
<import resource="classpath:alfresco/module/${project.artifactId}/context/bootstrap-context.xml" />
<import resource="classpath:alfresco/module/${project.artifactId}/context/service-context.xml" />
<import resource="classpath:alfresco/module/${project.artifactId}/context/webscript-context.xml" />

</beans>
48 changes: 48 additions & 0 deletions version-by-name-repo/src/main/amp/module.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.



# SDK Sample module

# ==== Beginning of Alfresco required/optional properties ====== #
# NB: These properties are filtered at build time by Maven, single
# sourcing from POM properties
module.id=${project.artifactId}
#module.aliases=myModule-123, my-module
module.title=${project.name}
module.description=${project.description}
module.version=${project.version}

# The following optional properties can be used to prevent the module from being added
# to inappropriate versions of the WAR file.
# module.repo.version.min=2.0
# module.repo.version.max=2.1

# FIXME: This dependencies should come out of mvn dependencies on amp

# The following describe dependencies on other modules
# Depends on net.sf.myproject.module.SupportModuleA version ${version} or later
# module.depends.net.sf.myproject.module.SupportModuleA=${version}-*
# Depends on net.sf.myproject.module.SupportModuleA version ${version} to 2.0
# module.depends.net.sf.myproject.module.SupportModuleB=${version}-2.0
# Depends on net.sf.myproject.module.SupportModuleC - any version
# module.depends.net.sf.myproject.module.SupportModuleB=*


# ==== End of Alfresco required/optional properties ======= #


# ==== Beginning of module required properties/optional ====== #
Loading

0 comments on commit f778362

Please sign in to comment.