Reputation: 81
So I've been looking into how one creates an extention/module for alfresco and I got a bit confused as to whether I need to use Alfresco SDK, Ant, Maven, etc.
I'll state my motivations, here's what I'm trying to achieve with the extension:
With that done another program then can query alfresco share for a document of a particular AttachmentType and ItemID trough CMIS.
What should I use to achieve this? Is putting some files in an amp file I make enough to do this? Should I use Maven for this? What about SDK & Ant?
Hope somebody can push me in the right direction. For example the things this link describes, do I put those edited files in those directories within the amp so they overwrite the real files? Where do I add the html select & jquery code so it'll be added on alfresco pages with those properties visible?
Thank you for taking the time to read this and thank you so much if you'll answer ofc!
Upvotes: 1
Views: 253
Reputation: 243
My best advice is to get started with a maven setup. With the provided archetypes you'll be up and running quickly with the built-in jetty server and H2 database, so you won't have to sweat too much about getting things started.
I wont give you all the answers, but I can point you in the right direction and get you started.
First of all, get up and running with Maven, read about the Maven SDK here
Make sure you have Java and Maven 3 installed. Then fire up the AMP Archetype, instructions here. To clear it a bit up run this command:
mvn archetype:generate -DarchetypeCatalog=https://artifacts.alfresco.com/nexus/content/groups/public/archetype-catalog.xml -Dfilter=org.alfresco.maven.archetype: Select number 1 (org.alfresco.maven.archetype:alfresco-amp-archetype)
Select the latest version of the SDK (option 3, 1.0.2)
Enter group id, f.x "org.your.company"
Enter artifact name, f.x "alfresco"
Verify the settings (press enter)
Now this will have created a complete project for you, ready to use.
Now you're good to go, fire it up (see this page for more info):
export MAVEN_OPTS="-Xms256m -Xmx1G -XX:PermSize=300m"
mvn integration-test -Pamp-to-war
This might take a while, it will download all your dependencies.
Now you're ready to get into the action and start coding.
The best way to learn about making a custom model, aspects etc could be to follow the knowledge tutorial in the docs.
A better way would be to read Jeff Potts excellent tutorials over at http://ecmarchitect.com, he wrote an excellent article about content modelling.
To give you some hints: You'll need to define a bean for your custom model. This could go in the module-context.xml located in "src/main/amp/config/alfresco/module/alfresco/".
The bean definition will point to your model xml file, where you'll need to define a namespace and your custom types, aspects etc. After this, it's a matter of making these types and aspects available to either share or the alfresco explorer.
I won't go too much more into details, Jeff Potts already explained it, way better than I could ever do - specially in his article about content modelling.
After you get comfortable with your maven setup, you simply use Maven to build you up a nice AMP, or even a complete war with your own changes merged into it that you could drop into Tomcat, jboss etc, but worry about deployment later :)
Best of luck!
Upvotes: 4