cancel
Showing results for 
Search instead for 
Did you mean: 

AMP modules JSF managed beans

jenglert
Champ in-the-making
Champ in-the-making
Hey all,
   I have to admit…. I cheated!  I edited the Module Management Tool (http://wiki.alfresco.com/wiki/Module_Management_Tool) to copy the /web/WEB-INF directory into the AMP'd war.  I did this in order to copy my faces-config-custom.xml into the new war. 

   Everything works great! except for a small issue I'm having trouble addressing.  I would like to be able apply two AMP modules to a war.  Both need to specify managed-JSF-beans (in faces-config-custom.xml).  When I use the MMT tool to AMP my war the second faces-config-custom.xml is used.  This presents an issue for me at least. I'm not a JSF expert by any means, I get by.  Is there a way to include a number of JSF confg files using wildcard specification such as adding WEB-INF/faces-*.xml to the web.xml.  Thus far, I have had no success figuring this out.

Thanks,
Jim
9 REPLIES 9

frederick
Champ in-the-making
Champ in-the-making
Yes you can add multiple faces-config files to your WAR file; but there are some restrictions:

If you only add new beans and don't override existing ones, you can place the file in the META-INF folder of a JAR file in your AMP file. JSF spec states that all "META-INF/faces-config.xml" files in the webapps' resource path get loaded.

Eg: ampfile>lib>jarfile>META-INF>faces-config.xml
will get picked up as the jarfile will be installed in the lib folder of the webapp.

However, because these file are loaded before Alfresco's own faces-config files, you cannot use this method to override Alfresco's beans.
(more info here: http://wiki.alfresco.com/wiki/Packaging_And_Deploying_Extensions)

If you do override beans, you must use the faces-config-custom.xml in the WEB-INF folder.

ribz33
Champ on-the-rise
Champ on-the-rise
And about navigation rules in face-config.xml, what are restrictions ?
How can we modify navigation rules ?
thx

gavinc
Champ in-the-making
Champ in-the-making
You should be able to override JSF navigation rules by using faces-config.xml in the location that Frederick mentions.

harshad
Champ in-the-making
Champ in-the-making
I need to override certain beans and hence need to use faces-config-custom.xml

While packaging the AMP file which is the folder in AMP structure which Maps on to WEB-INF? Basically where do I put my faces-config-custom.xml file?

From wiki…
/
  |
  |- /config - mapped into the /WEB-INF/classes
  |
  |- /lib - mapped into /WEB-INF/lib
  |
  |- /licenses
  |
  |- /web
    |
    |- /jsp
    |
    |- /css
    |
    |- /images
    |
    |- /scripts
  |
  |- module.properties
  |
  |- file-mapping.properties

file-mapping.properties does not work in 2.0 (as per wiki).

thanks,

frederick
Champ in-the-making
Champ in-the-making
There seems to be no direct mapping to WEB-INF currently. This is what the default-file-mapping.properties looks like in 2.0:

# The default AEP => WAR file mappings
/config=/WEB-INF/classes
/lib=/WEB-INF/lib
/licenses=/WEB-INF/licenses
/web/jsp=/jsp
/web/css=/css
/web/images=/images
/web/scripts=/scripts

So you'd either have to edit this file (located in org.alfresco.repo.module.tool), or wait for 2.1 (I think custom mappings will be available then).

gavinc
Champ in-the-making
Champ in-the-making
I've raised an issue in JIRA for this: http://issues.alfresco.com/browse/AR-1380

harshad
Champ in-the-making
Champ in-the-making
Ok. Thanks for the info. I have one more need. I have an application in which  I have create a couple of spaces and then have a couple of space rules configured on them by uploading scripts under datadictionary/scripts space.

How do I package this in an AMP?

Where should I copy the scripts so that they go under the datadictionary/scripts space. I guess If I take an 'acp' dump of the folder then the folders and the space rules will be exported but the scripts have to be copied separately.

Thanks,

derek
Star Contributor
Star Contributor
http://issues.alfresco.com/browse/AR-1349

The Module Management Tool on HEAD is a standalone component now.  So, any changes can be immediately picked up and used without having to wait for a release.  I'll try to add the custom mapping in as soon as possible.  But as a quick win, what other common mappings should go into the default?

Regards

nicolasraoul
Star Contributor
Star Contributor
Here is how to override JSF managed beans in an AMP:

1) At the root of the AMP, create a file-mapping.properties file containing /WEB-INF=/WEB-INF

2) At the root of the AMP, create a WEB-INF directory.

3) Put your faces config file in the WEB-INF directory with name faces-config-custom.xml

Hope this helps,
Nicolas Raoul