[jboss-user] [JBoss Seam] - configuration with property files - ideas?

matt.drees do-not-reply at jboss.com
Mon Aug 6 14:10:45 EDT 2007


I'm writing a Seam adapter for ja-sig's CAS client (http://www.ja-sig.org/products/cas/).  The client by default is configured by Spring, but I'm trying to configure it with Seam.  One thing it does is use a properties file, and a PropertyPlaceHolderConfigurer.  To mimic that, I'm doing this:


  | @Name("casProperties")
  | @Scope(ScopeType.APPLICATION)
  | @Install(precedence = Install.FRAMEWORK)
  | public class CasProperties {
  | 	
  | 	Properties casProperties;
  | 	
  | 	String fileName = "cas-client.properties";
  | 	
  | 	@Create
  | 	public void create() throws Exception {
  | 		casProperties = new Properties();
  | 		casProperties.load(Resources.getResourceAsStream("/WEB-INF/" + fileName, ServletLifecycle.getServletContext()));
  | 	}
  | 	
  | 	@Unwrap
  | 	public Properties getCasProperties() {
  | 		return casProperties;
  | 	}
  | 	
  | 	public String getFileName() {
  | 		return fileName;
  | 	}
  | 
  | 	public void setFileName(String fileName) {
  | 		this.fileName = fileName;
  | 	}
  | }
  | 

and in a components.xml file this:

  |     <factory name="serverUrl" value="#{casProperties['cas.server.url']}" scope="STATELESS" auto-create="true"/>
  |     <factory name="clientServerName" value="#{casProperties['cas.client.serverName']}" scope="STATELESS" auto-create="true"/>
  |     <factory name="clientProxyCallbackUrl" value="#{casProperties['cas.client.proxyCallbackUrl']}" scope="STATELESS" auto-create="true"/>
  |     
  | 

Is there an easier way to make the contents of a specific properties file (i.e., not using components.properties or seam.properties) available to components.xml, etc?

Thanks
-Matt

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071315#4071315

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071315



More information about the jboss-user mailing list