001    package org.apache.geronimo.system.properties;
002    
003    import org.apache.geronimo.gbean.GBeanInfo;
004    import org.apache.geronimo.gbean.GBeanInfoBuilder;
005    
006    /** java.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory
007    java.naming.factory.url.pkgs=org.apache.geronimo.naming
008    java.naming.provider.url=rmi://localhost:1099
009    
010     */
011    public class NamingProperties {
012    
013        static final String JAVA_NAMING_FACTORY_INITIAL = "java.naming.factory.initial";
014        static final String JAVA_NAMING_FACTORY_URL_PKGS = "java.naming.factory.url.pkgs";
015        static final String JAVA_NAMING_PROVIDER_URL = "java.naming.provider.url";
016    
017        public NamingProperties(String namingFactoryInitial, String namingFactoryUrlPkgs, String namingProviderUrl) {
018            setNamingFactoryInitial(namingFactoryInitial);
019            setNamingFactoryUrlPkgs(namingFactoryUrlPkgs);
020            setNamingProviderUrl(namingProviderUrl);
021        }
022    
023        public String getNamingFactoryInitial() {
024            return System.getProperty(JAVA_NAMING_FACTORY_INITIAL);
025        }
026    
027        public void setNamingFactoryInitial(String namingFactoryInitial) {
028            System.setProperty(JAVA_NAMING_FACTORY_INITIAL, namingFactoryInitial);
029        }
030    
031        public String getNamingFactoryUrlPkgs() {
032            return System.getProperty(JAVA_NAMING_FACTORY_URL_PKGS);
033        }
034    
035        public void setNamingFactoryUrlPkgs(String namingFactoryUrlPkgs) {
036            System.setProperty(JAVA_NAMING_FACTORY_URL_PKGS, namingFactoryUrlPkgs);
037        }
038    
039        public String getNamingProviderUrl() {
040            return System.getProperty(JAVA_NAMING_PROVIDER_URL);
041        }
042    
043        public void setNamingProviderUrl(String namingProviderUrl) {
044            System.setProperty(JAVA_NAMING_PROVIDER_URL, namingProviderUrl);
045        }
046    
047        public static final GBeanInfo gbeanInfo;
048    
049        static {
050            GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(NamingProperties.class);
051            infoFactory.addAttribute("namingFactoryInitial", String.class, true);
052            infoFactory.addAttribute("namingFactoryUrlPkgs", String.class, true);
053            infoFactory.addAttribute("namingProviderUrl", String.class, true, true);
054    
055            infoFactory.setConstructor(new String[] {"namingFactoryInitial", "namingFactoryUrlPkgs", "namingProviderUrl"});
056    
057            gbeanInfo = infoFactory.getBeanInfo();
058        }
059    
060        public static GBeanInfo getGBeanInfo() {
061            return gbeanInfo;
062        }
063    }