View Javadoc

1   package org.apache.geronimo.system.properties;
2   
3   import org.apache.geronimo.gbean.GBeanInfo;
4   import org.apache.geronimo.gbean.GBeanInfoBuilder;
5   
6   /** java.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory
7   java.naming.factory.url.pkgs=org.apache.geronimo.naming
8   java.naming.provider.url=rmi://localhost:1099
9   
10   */
11  public class NamingProperties {
12  
13      static final String JAVA_NAMING_FACTORY_INITIAL = "java.naming.factory.initial";
14      static final String JAVA_NAMING_FACTORY_URL_PKGS = "java.naming.factory.url.pkgs";
15      static final String JAVA_NAMING_PROVIDER_URL = "java.naming.provider.url";
16  
17      public NamingProperties(String namingFactoryInitial, String namingFactoryUrlPkgs, String namingProviderUrl) {
18          setNamingFactoryInitial(namingFactoryInitial);
19          setNamingFactoryUrlPkgs(namingFactoryUrlPkgs);
20          setNamingProviderUrl(namingProviderUrl);
21      }
22  
23      public String getNamingFactoryInitial() {
24          return System.getProperty(JAVA_NAMING_FACTORY_INITIAL);
25      }
26  
27      public void setNamingFactoryInitial(String namingFactoryInitial) {
28          System.setProperty(JAVA_NAMING_FACTORY_INITIAL, namingFactoryInitial);
29      }
30  
31      public String getNamingFactoryUrlPkgs() {
32          return System.getProperty(JAVA_NAMING_FACTORY_URL_PKGS);
33      }
34  
35      public void setNamingFactoryUrlPkgs(String namingFactoryUrlPkgs) {
36          System.setProperty(JAVA_NAMING_FACTORY_URL_PKGS, namingFactoryUrlPkgs);
37      }
38  
39      public String getNamingProviderUrl() {
40          return System.getProperty(JAVA_NAMING_PROVIDER_URL);
41      }
42  
43      public void setNamingProviderUrl(String namingProviderUrl) {
44          System.setProperty(JAVA_NAMING_PROVIDER_URL, namingProviderUrl);
45      }
46  
47      public static final GBeanInfo gbeanInfo;
48  
49      static {
50          GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(NamingProperties.class);
51          infoFactory.addAttribute("namingFactoryInitial", String.class, true);
52          infoFactory.addAttribute("namingFactoryUrlPkgs", String.class, true);
53          infoFactory.addAttribute("namingProviderUrl", String.class, true, true);
54  
55          infoFactory.setConstructor(new String[] {"namingFactoryInitial", "namingFactoryUrlPkgs", "namingProviderUrl"});
56  
57          gbeanInfo = infoFactory.getBeanInfo();
58      }
59  
60      public static GBeanInfo getGBeanInfo() {
61          return gbeanInfo;
62      }
63  }