Belgiumxenit-eu/dynamic-extensions-for-alfresco
Rapid development of Alfresco repository extensions in Java. Deploy your code in seconds, not minutes. Life is too short for endless server restarts.
Featured achievements
The project's latest awards
#1 Repository of the month
#1 Repository of the month
#1 Repository of the month
A farewell to an era
After many wonderful years of service, we have decided to discontinue our support of Dynamic Extensions.
There was a time when Dynamic Extensions saved us days in development time.
However, nowadays with containerization and other techniques, startup time is so low that it makes it is no longer worth carying the load of maintenance for such a big product.
We thank you for joining us on this journey towards reducing friction and improving inertia in our development.
📌 Deprecation Notice
This repository is deprecated and no more work will be done on this by Xenit Solutions NV.
You can continue to use this and it should work as-is but any future issues will not be fixed by the Alfresco community.
Feel free to fork this repository and improve your fork.
Dynamic Extensions for Alfresco
Dynamic Extensions is a part of the Xenit Open Source Tooling around Alfresco. Xenit is company with a deep expertise and a strong team around Alfresco. If you'd like to learn more about our tools, services and products, please visit our website.
Add OSGi based hot-deploy functionality and Spring annotation based configuration to Alfresco.
Introduction
Rapid development of Alfresco repository extensions in Java. Deploy your code in seconds, not minutes. Life is too short for endless server restarts.
Dynamic Extensions adds an OSGi container to the Alfresco repository, enabling live deployment of Java code, with no need to restart the server. Alfresco itself is not "OSGi-fied" in any way; the OSGi container runs on top of the core Alfresco platform.
Standard Alfresco Platform Extensions use Spring XML based configuration. With Dynamic Extensions, developers have the ability to create Alfresco Platform Extensions using Spring's annotations based configuration.
Installing Dynamic Extensions in Alfresco
Dynamic Extensions (DE) is distributed as an Alfresco Module Package (AMP) extension that can be installed in Alfresco.
Installing the Dynamic Extensions AMP
To support multiple Alfresco versions, different AMPs for each minor Alfresco version update are
build and distributed.
E.g. if you are working with Alfresco 6.0.7-ga, you should
use the alfresco-dynamic-extensions-repo-60 artifact.
Maven Central Coordinates
All required artifacts, including the AMP to be installed in Alfresco, are available in Maven Central.
<dependency>
<groupId>eu.xenit</groupId>
<artifactId>alfresco-dynamic-extensions-repo-${alfresco-version}</artifactId>
<version>${latest-dynamic-extensions-version}</version>
<type>amp</type>
</dependency>
alfrescoAmp "eu.xenit:alfresco-dynamic-extensions-repo-${alfrescoVersion}:${dynamicExtensionsVersion}@amp"
These artifacts can be used to automatically install Dynamic Extensions in Alfresco using e.g. the Alfresco Maven SDK or the Alfresco Docker Gradle Plugins
Manual download and install
- Download the latest Dynamic Extensions AMP.
- Use the Module Management Tool to install the AMP in the Alfresco repository of your choosing.
- After restarting Alfresco, open the Control Panel: http://localhost:8080/alfresco/service/dynamic-extensions/.
- Accessing the Control Panel requires an admin account.
Supported Alfresco versions
Dynamic Extensions is systematically integration-tested against:
- Alfresco Enterprise & Community 7.4
- Alfresco Enterprise & Community 7.3
- Alfresco Enterprise & Community 7.2
- Alfresco Enterprise & Community 7.1
- Alfresco Enterprise & Community 7.0
- Alfresco Enterprise & Community 6.2 (Requires hotfix, see below)
- Alfresco Enterprise & Community 6.1 (Requires hotfix, see below)
Integration tests are currently only executed on our private Jenkins build server.
Known Alfresco issues that impact Dynamic Extensions
Alfresco 6.1 / 6.2 - wrong version of 'Commons annotations' used
When using DE on Alfresco 6.1 or 6.2, it is possible that it fails to startup due to following error:Caused by: java.lang.NoSuchMethodError: javax.annotation.Resource.lookup()Ljava/lang/String;
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.<init>(CommonAnnotationBeanPostProcessor.java:621)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.lambda$buildResourceMetadata$0(CommonAnnotationBeanPostProcessor.java:383)
at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:719)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.buildResourceMetadata(CommonAnnotationBeanPostProcessor.java:365)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:350)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:298)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1044)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:550)
The root cause is for this problem is that Alfresco has multiple implementations of the
JSR 250 specification, 'Common Annotations' in the WEB-INF/lib/ folder:
- javax.annotation:javax.annotation-api
- javax.annotation:jsr250-api
- org.apache.geronimo.specs:geronimo-annotation_1.0_spec
Only the first one is up to date and contains the correct implementation of the Resource class. The other two versions
contain an old implementation of the Resource class, causing the provided error to be thrown by Spring internally.
This is only an issue as of Java 11 (Alfresco 6.1) because earlier versions had an correct implementation
of the Resource class embedded in the distribution, and the
bootstrap classloader has the highest priority.
This issue has been reported to Alfresco: MNT-20557. Waiting for Alfresco to fix the issue, following workarounds can be used to make DE work on Alfresco 6.1 and 6.2:
- Remove the
jsr250-apiandgeronimo-annotation_1.0_specjars from theWEB-INF/libfolder of the Alfresco webapp. - Install this hotfix AMP in your Alfresco distribution,
which will overwrite the
jsr250-apiandgeronimo-annotation_1.0_specjars with empty jars.
Example Dynamic Extensions based Alfresco Platform extension
This example Web Script examines a node and passes information to a Freemarker template:
@Component
@WebScript
public ExampleWebScript {
@Autowired
private NodeService nodeService;
@Uri("/show-node")
// Example: http://localhost/alfresco/service/show-node?nodeRef=workspace://SpacesStore/12345
public Map<String, Object> displayNodeName(@RequestParam NodeRef nodeRef) {
Map<String, Object> model = new HashMap<String, Object>();
model.put("properties", nodeService.getProperties(nodeRef));
return model; // Model is passed to Freemarker template.
}
}
Note that this is an annotation Web Script. These types of Web Script are configured through Java annotations instead of *.desc.xml descriptors. Annotation Web Scripts are similar to Spring MVC's annotation-based controllers.
Here's the accompanying Freemarker template fragment:
<table>
<#list properties?keys as name>
<tr>
<th>${name}</th>
<td>${properties[name]!''}</td>
</tr>
</#list>
</table>
This is all the code that is required; there's no need for Spring XML config or Web Script XML descriptors. Hot-reloading and reducing configuration overhead are not particularly novel concepts in the Java development world at large. Essentially, Dynamic Extensions modernizes the development of Alfresco repository extensions.
The example above may be trivial, but the point is that, behind the scenes, services are still wired together through Spring and handled by the Web Script framework. Conceptually there is no real difference between a Dynamic Extension and a regular Alfresco extension. There's just less overhead and more convenience.
Documentation
Please checkout the documentation for further instructions.
License
This project is licensed under the Apache V2 License - see the LICENSE file for details.
Useful links
Similar Projects
Discover other similar projects and AI models.
The Alfresco In-Process SDK is based on Apache Maven, includes support for rapid and standard development, testing, packaging, versioning and release of your Alfresco integration and extension projects
Addon to provide a set of common content store implementations and easy-to-use configuration (no Spring config)
Open source Product Information Management (PIM) and Digital Asset Management (DAM) platform built on Laravel — manage, enrich, and scale product data and digital assets beyond 10 million products. Free forever.
UI motion agent, a library of 43+ crafted transitions, a skill that fits your workflow.
一键生成产品营销与泛内容短视频,AI批量自动剪辑,高颜值跨平台桌面端工具 One click generation of product marketing and general content short videos, AI batch automatic cliping, beautiful cross platform desktop tool
