[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Interacting with class properties rather than instances?

alesj do-not-reply at jboss.com
Thu Oct 12 15:34:01 EDT 2006


Not that I know of.

Even that static="true" is currently unsupported.

  |    <xsd:complexType name="beanType">      
  |       ...
  |       </xsd:sequence>
  |       <xsd:attribute name="name" type="xsd:string" use="optional"/>
  |       <xsd:attribute name="class" type="xsd:token" use="optional"/>
  |       <xsd:attribute name="mode" type="controllerModeType" use="optional"/>
  |    </xsd:complexType>
  | 

Maybe we could rewrite JarUtils to be used as singleton:


  | public class JarUtils
  | {
  |    /** The jar suffixes */
  |    private Set<String> jarSuffixes = new CopyOnWriteArraySet<String>();
  | 
  |    private static JarUtils instance = new JarUtils();
  | 
  |    public static JarUtils getInstance()
  |    {
  |       return instance;
  |    }
  | 
  |    /**
  |     * Sets the jar suffixes
  |     * 
  |     * @param suffix the suffix
  |     * @return true when added
  |     * @throws IllegalArgumentException for a null suffix
  |     */
  |    public void setJarSuffixes(Set<String> suffixes)
  |    {
  |       if (suffixes == null)
  |          throw new IllegalArgumentException("Null suffix");
  |       jarSuffixes = suffixes;
  |    }
  | 
  |    /**
  |     * Add a jar suffix
  |     * 
  |     * @param suffix the suffix
  |     * @return true when added
  |     * @throws IllegalArgumentException for a null suffix
  |     */
  |    public static boolean addJarSuffix(String suffix)
  |    {
  |       if (suffix == null)
  |          throw new IllegalArgumentException("Null suffix");
  |       return instance.jarSuffixes.add(suffix);
  |    }
  | 
  |    /**
  |     * Remove a jar suffix
  |     * 
  |     * @param suffix the suffix
  |     * @return true when removed
  |     * @throws IllegalArgumentException for a null suffix
  |     */
  |    public static boolean removeJarSuffix(String suffix)
  |    {
  |       if (suffix == null)
  |          throw new IllegalArgumentException("Null suffix");
  |       return instance.jarSuffixes.remove(suffix);
  |    }
  |    
  |    ...
  | 
  |    <bean name="jarUtils" class="org.jboss.virtual.plugins.context.jar.JarUtils">
  |       <constructor factoryClass="org.jboss.virtual.plugins.context.jar.JarUtils" factoryMethod="getInstance" />
  |       <property name="jarSuffixes">
  |                               <set elementClass="java.lang.String">
  |                         <value>.zip</value>
  |                         <value>.ear</value>
  |                         <value>.jar</value>
  |                         <value>.rar</value>
  |                         <value>.war</value>
  |                         <value>.sar</value>
  |                         <value>.har</value>
  |                         <value>.aop</value>
  |                         <value>.deployer</value>
  |                      </set>
  |       </property>
  |    </bean>
  | 

Or simply use it as a bean defined in some top level deployment - and simply injected into dependent beans.



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

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



More information about the jboss-dev-forums mailing list