[solved]read alfresco configuration file in a java class
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2010 04:39 AM
Hi 
I would like to know if there's a class in the alfresco API which could allow me to read one of the xml configuration files that exists or access one of the alfresco folder (like the install folder). My goal is to ask the user to set a parameter (an ip adress) in an xml configuration file and then I could refer to it in a java class.
I know I could force the user to install alfresco in a specified directory and hard code the path in my class but I don't like to do this way.
Thank you

I would like to know if there's a class in the alfresco API which could allow me to read one of the xml configuration files that exists or access one of the alfresco folder (like the install folder). My goal is to ask the user to set a parameter (an ip adress) in an xml configuration file and then I could refer to it in a java class.
I know I could force the user to install alfresco in a specified directory and hard code the path in my class but I don't like to do this way.
Thank you

Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2010 04:56 AM
Why not use spring to inject the value into your class. Its how the rest of Alfresco works.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2010 05:14 AM
Thank you for the advice. Actually, I'm trying to create a new action called download-action which will get the file from a distant server instead of retrieving its content from the cm:content property. I started writing the java class and I also wrote a download-action-context.xml file which is :
I added my ip addresses as properties. But now, I don't know how to access theses properties in my class :?:
Do get and set for each properties in my class are enought? Is this the right way to proceed ?
Thank you
ps: post edited
<beans> <!– Download Action Bean –> <bean id="download-action" class="com.alfresco.customUI.actions.DownloadActionExecuter" parent="action-executer"> <property name="nodeService"> <ref bean="NodeService" /> </property> <property name="exchangeServer"> <value>192.168.20.241</value> </property> <property name="fileServer"> <value>192.168.20.221</value> </property> </bean> <!– Action properties –> <bean id="extension.actionResourceBundles" parent="actionResourceBundles"> <property name="resourceBundles"> <list> <value>alfresco.extension.download-action-messages</value> </list> </property> </bean> </beans>
I added my ip addresses as properties. But now, I don't know how to access theses properties in my class :?:
Do get and set for each properties in my class are enought? Is this the right way to proceed ?
Thank you

ps: post edited
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2010 07:09 AM
Hi again
Could someone tell me if I did well please?

Could someone tell me if I did well please?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2010 08:47 AM
Yes that's O.K.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2010 04:01 AM
Thank you for your help

