cancel
Showing results for 
Search instead for 
Did you mean: 

How integrate a jar with a custom action in Alfresco

cristi
Champ in-the-making
Champ in-the-making
Hello!

I've created a custom action with as a eclipse project. I packaged it in a jar and I put it in: alfresco-3.4.d/tomcat/webapps/alfresco/WEB-INF/lib

I started Alfresco and I created a rule with my custom action. When a file is created in this folder then the rule is triggered.

But when I create a file, the unique available type is "content", my custom content types don't show in select list. My problem is I need these custom types.

I have tested starting Alfresco without my jar and all types are availables.

My project structure is wrong?:

src.main.java
  -executer
     ·UrlActionExecuter.java
     ·UrlActionHandler.java
src.main.resources
  -alfresco.extension
     ·url-actions-context.xml
     ·web-client-config-custom.xml
     ·webclient.properties
src.main.webapp
   -jsp.actions
     ·url-action-executer.jsp

or build.xml?:

<?xml version="1.0"?>

<project name="Action Url" default="package" basedir=".">

    <property name="project.dir" value="."/>
    <property name="build.dir" value="${project.dir}/build"/>
    <property name="package.file" value="${build.dir}/Action-url.jar"/>

    <path id="class.path">
        <dirset dir="${build.dir}" />
        <fileset dir="../../lib/server" includes="**/*.jar"/>
    </path>

    <target name="compile">
        <mkdir dir="${build.dir}" />
        <javac classpathref="class.path" srcdir="${project.dir}/src" destdir="${build.dir}" />
    </target>

    <target name="package" >
        <jar destfile="${package.file}">
            <fileset dir="${build.dir}"/>
        </jar>
    </target>

</project>

Thanks everybody!
3 REPLIES 3

lotharmärkle
Champ in-the-making
Champ in-the-making
Still an open question?

I would suggest to check the "Content Wizards" section in your web-client-config-custom.xml file.
There you should list your custom type.

Example copied from the very good article at http://ecmarchitect.com/images/articles/alfresco-content/content-article.pdf:


<config evaluator="string-compare" condition="Content Wizards">
  <contenttypes>
    <type name="sc:doc" />
    <type name="sc:whitepaper" />
  </contenttypes>
</config>

btw - this file should be packaged in META-INF inside your jar.

hth, lothar

cristi
Champ in-the-making
Champ in-the-making
Hi Lothar, thanks for your reply.

The main idea of this action is that it should be the same one for many alfresco distributions, so in the moment I package the jar I can't know the custom types are avaiables in each Alfresco installation. In other words, the action must be agnostic component and the problem I have is that when I deploy the action the custom types enabled in the Alfresco disappears.

Thanks!

lotharmärkle
Champ in-the-making
Champ in-the-making
Alfresco supports what you described, because all available config sections are merged together to create an complete list.

However, there is an overwrite mechanism using replace="true" on the config section, which clears the list.

Maybe you have one replace="true" by accident in your file?

The recommended approach for AMP development is imo:
1. place a default config in your jar in META-INF/web-client-config-custom.xml. Do not use replace="true" anywhere here.
2. allow deployers/installers to tweak your config in shared/classes/alfresco/extension/web-client-config-custom.xml (or better the repository places web-client-config-custom.xml in the Data Dictionary) using replace="true"