WEB开发网
开发学院软件开发Java 在 Geronimo 中管理 Apache Pluto 阅读

在 Geronimo 中管理 Apache Pluto

 2010-03-30 00:00:00 来源:WEB开发网   
核心提示: Pluto 门户环境的配置信息将被 org.apache.pluto.portalImpl.services.ServiceManager 类中存储的对象引用并被使用 ServiceManager 类的 getService 方法检索,必须将对 org.apache.pluto.portalIm

Pluto 门户环境的配置信息将被 org.apache.pluto.portalImpl.services.ServiceManager 类中存储的对象引用并被使用 ServiceManager 类的 getService 方法检索。必须将对 org.apache.pluto.portalImpl.services.config.ConfigService 类的引用作为参数传递给 ServiceManager 类的 getService 方法才能检索 ConfigService 组件的实例。

ConfigService 组件的实例可用后,您可以将此组件打包成一个标准的 Geronimo GBean 并使其可用于 Pluto 管理环境。清单 2 演示了如何由 Geronimo GBean 表示 ConfigService 信息。

清单 2. 作为 Geronimo GBean 的 ConfigService

public class ConfigServiceGBean 
 implements GBeanLifecycle 
{ 
 public static final GBeanInfo GBEAN_INFO; 
  
 static 
 { 
  GBeanInfoBuilder infoBuilder = 
   new GBeanInfoBuilder("ConfigServiceGBean", ConfigServiceGBean.class); 
  
  infoBuilder.addAttribute("parameters", 
            org.apache.pluto.portalImpl.util.Parameters.class, 
            true); 
 
  infoBuilder.addOperation("getParameters"); 
  infoBuilder.addOperation("setString", new Class[] { String.class, 
                            String.class }); 
  infoBuilder.addOperation("getString", new Class[] { String.class }); 
  infoBuilder.addOperation("getInteger", new Class[] { String.class }); 
  infoBuilder.addOperation("getBoolean", new Class[] { String.class }); 
  infoBuilder.addOperation("paramKeys"); 
 
  GBEAN_INFO = infoBuilder.getBeanInfo(); 
 } 
  
 public static GBeanInfo getGBeanInfo() 
 { 
  return GBEAN_INFO; 
 } 
  
 private org.apache.pluto.portalImpl.services.config.ConfigServiceImpl 
      configServiceImpl = null; 
  
 public ConfigServiceGBean() 
 { 
  try 
  { 
   Class configServiceCls = 
   Class.forName("org.apache.pluto.portalImpl.services.config.ConfigService"); 
   org.apache.pluto.portalImpl.services.Service configService = 
org.apache.pluto.portalImpl.services.ServiceManager.getService(configServiceCls); 
   if (configService != null) 
   { 
    configServiceImpl = 
     (org.apache.pluto.portalImpl.services.config.ConfigServiceImpl) 
      configService; 
   } 
  } 
  catch(Exception e) 
  { 
   System.err.println("Exception in ConfigServiceGBean: " + e); 
  } 
 } 
  
 public org.apache.pluto.portalImpl.util.Parameters getParameters() 
 { 
  return configServiceImpl.getParameters(); 
 } 
 
 public java.util.Iterator paramKeys() 
 { 
  return configServiceImpl.getParameters().keys(); 
 } 
 
 public String getString(String name) 
 { 
  return configServiceImpl.getString(name); 
 } 
 
 public void setString(String name, String value) 
 { 
  configServiceImpl.getParameters().setString(name, value); 
 } 
 
 public Integer getInteger(String name) 
 { 
  return configServiceImpl.getInteger(name); 
 } 
 
 public Boolean getBoolean(String name) 
 { 
  return configServiceImpl.getBoolean(name); 
 } 
 
 public void doFail() 
 { 
  System.err.println(getClass().getName() + " failed"); 
 } 
  
 public void doStart() 
  throws Exception 
 { 
  System.out.println("Starting " + getClass().getName()); 
 } 
  
 public void doStop() 
  throws Exception 
 { 
  System.out.println("Stopping " + getClass().getName()); 
 } 
} 

上一页  1 2 3 4 5 6 7 8 9 10  下一页

Tags:Geronimo 管理 Apache

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接