cancel
Showing results for 
Search instead for 
Did you mean: 

AMP extension and resource bundles

dgenard
Champ on-the-rise
Champ on-the-rise
Hello,

I'm trying to build a new AMP to ease the deployement of an extension developped on Alfresco 1.4.
Previously, my localized messages were located in tomcat/shared/classes/alfresco/extension/webclient.properties, and it worked fine.

Now, when deploying and running my AMP, it seems that the webclient.properties is not found, wherever it is, and no messages or model labels are displayed correctly.
I tried to reference it from the module-context.xml file without success.
    <!–  Web client config custom and labels –>
    <bean id="rmConfigBootstrap" class="org.alfresco.web.config.WebClientConfigBootstrap" init-method="init">
       <property name="configs">
         <list>
            <value>classpath:alfresco/module/mymodule/ui/web-client-config.xml</value>
         </list>
       </property>
    </bean>
    <bean id="webclientResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
        <property name="resourceBundles">
            <list>
                  <value>alfresco/module/mymodule/messages/webclient</value>
            </list>
        </property>
    </bean>

    <!– Model bootstrap –>
    <bean id="rm.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/module/mymodule/model/myModel.xml</value>
            </list>
        </property>
        <property name="labels">
            <list>
                <value>alfresco/module/mymodule/messages/webclient</value>
            </list>
         </property>
    </bean>
Only the custom workflow messages are correctly found using a similar config :
        <!– Registration of workflows –>   
   <bean id="myworkflows.workflowBootstrap" parent="workflowDeployer">
      <property name="workflowDefinitions">
         <list>
            <props>
               <prop key="engineId">jbpm</prop>
               <prop key="location">alfresco/module/mymodule/workflow/notification-courrier.xml</prop>
               <prop key="mimetype">text/xml</prop>
                    <prop key="redeploy">true</prop>
            </props>
         </list>
      </property>
      <property name="labels">
         <list>
            <value>alfresco/module/mymodule/messages/webclient</value>
         </list>
      </property>
   </bean>

I'm using Alfresco 2.0.0 Enterprise.
Any idea ?

Denis
8 REPLIES 8

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

I'm not sure why the old mechanism would stop working, have you checked that once deployed your property file ends up in the correct location?

I also suggest splitting your file up into model, workflow, service and UI property files.  This may help to hightlight which methods of message inclusion are not working.

The module suport provided in 2.0 is still very basic and we hope to complete this in the 2.1 time frame.  If this problem persists I suggest loggin a Jira issue with as many details as you can.  This will help to ensure we resolve this issue.

Cheers,
Roy

dgenard
Champ on-the-rise
Champ on-the-rise
In fact, the old mechanism still works if I place the webclient.properties file in the folder /config/alfresco/extension in my AMP file.
But this will lead to conflicts if multiple AMP files are installed on a same alfresco.war.

That's why I wanted to place webclient.properties somewhere under the folder /config/alfresco/module/mymodule/.
This works fine for workflow, but fails with model and UI.

I'll raise a JIRA issue.

Regards, Denis

dgenard
Champ on-the-rise
Champ on-the-rise

lme
Champ in-the-making
Champ in-the-making
Hi Denis,

Have you been able to find a solution for this issue?

dgenard
Champ on-the-rise
Champ on-the-rise
No, I haven't found a solution yet.
As a workaround, I placed the webclient.properties file in the folder /config/alfresco/extension in the AMP.

frederick
Champ in-the-making
Champ in-the-making
I ran into the same issue, and did some searching through the code.

It seems that all message bundles that are registered through ResourceBundleBootstrapComponent beans or dictionaryModelBootstrap "labels" property tags get picked up correctly.
They get read by the U18NUtils.getMessage() method in packages such as org.alfresco.repo and org.alfresco.service.cmr.
I have a custom action executer packaged as a module, and its title gets read from the property file correctly.

However, most webclient-related messages (like wizard and dialog labels) are not accessed through this class, but use Application.getMessage() instead. This method only checks for the following paths:
- alfresco\messages\webclient
- alfresco\extension\webclient
And puts these two bundles in a bundlewrapper.

Since there is no way to register bundles against the Application (the ResourceBundleWrapper sits in the session, and has no method to add more bundles), the only way to define labels in webclient config is either by hardcoding labels or using the alfresco/extension path.

I suspect you mistook webclient labels for model labels (eg. type names and descriptions in the Advanced Create Space wizard), and that your model labels are actually working correctly.

gavinc
Champ in-the-making
Champ in-the-making
Frederick,

You are spot on with your analysis of how the webclient properties mechanism works.

It is indeed the cause of the issue in AMP files, I have added a comment to this effect in the bug on JIRA (http://issues.alfresco.com/browse/AWC-1149).

This should get resolved in the 2.1 release.

damonrand
Champ in-the-making
Champ in-the-making
Hi,

I have tried the workaround of placing webclient.properties in alfresco/extension but it doesn't seem to work in 2.0. I have to overwrite alfresco/messages/webclient.properties for my changes to have any affect. I am changing the company_home property..

Damon.