• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Dynamic extension for alfresco
 

Dynamic extension for alfresco

on

  • 1,228 views

Dynamic extensions for Alfresco. Uses OSGI to dynamically deploy modules. Faster development time.

Dynamic extensions for Alfresco. Uses OSGI to dynamically deploy modules. Faster development time.

Statistics

Views

Total Views
1,228
Views on SlideShare
1,223
Embed Views
5

Actions

Likes
0
Downloads
0
Comments
1

1 Embed 5

https://twitter.com 5

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Dynamic extension for alfresco Dynamic extension for alfresco Presentation Transcript

    • DYNAMIC EXTENSIONSEnabled by /“Rapid development of Alfresco repositoryextensions in Java. Deploy your code inseconds, not minutes. Life is too short forendless server restarts.”dynamic-extensions-for-alfresco @LaurensFridael
    • CREATING ALFRESCO EXTENSIONS1. code + spring xml + descriptor xml2. compile & jar3. create amp4. stop alfresco5. apply amps6. start alfresco7. test your extension
    • WHY ?Why cant I copy my code to the server and hit refresh ?
    • CLASS RELOADING IN JAVAthe JVM cannot reload classesbut it can reload Classloaders
    • HOW DO I DO THATload dynamic code via a new classloaderdiscard classloader when updatingUrlClassloader good starthow can I reload modules ?
    • OSGIA Java module specification designed for continuesdeployment:reloading codeservice / class dependencies between modulesservice registry: whiteboard pattern
    • Combine Alfresco and OSGI: Dynamic Extensions
    • DEMO
    • WEBSCRIPTS@Component@WebScript(description = "Weather")@Authentication(AuthenticationType.GUEST)public class WeatherScript {@Autowired WeatherService weatherService;@Uri(value = "/weather", defaultFormat = "html")public Map<String, Object> index(final @RequestParam(required = false) String name) {return new HashMap<String,Object>() {{put("name", name);put("temperature", weatherService.getTemperature());}};}}
    • TEMPLATEWeatherScript.index.get.html.ftl<html><body>Hello ${name!"guest"}, the current temperature is ${temperature}.</body></html>
    • WITHOUT TEMPLATE@Component@WebScript(description = "Time")@Authentication(AuthenticationType.GUEST)public class TimeScript {@Autowired WeatherService weatherService;@Uri(value = "/time")public void index(WebscriptResponse response) {response.getWriter().write(new Date().toString());}}
    • BEHAVIOUR@Component@Behaviour("cm:content", event = Event.COMMIT)public class ChildCreation implementsNodeServicePolicies.OnCreateChildAssociationPolicy {@AssociationPolicy(association = "cm:contains")@Overridepublic void onCreateChildAssociation(ChildAssociationRef childAssociationRef, boolean newNode) {}}
    • ACTIONS@ActionMethod(value = "destroy", applicableTypes = {"cm:content"})public void destroy(final NodeRef nodeRef) {nodeService.addAspect(nodeRef, ContentModel.ASPECT_TEMPORARY, null);nodeService.deleteNode(nodeRef);}
    • NOW STOP RESTARTINGAND START CODINGLaurent Van der Linden / Xenit