1 22 package org.jboss.system.microcontainer; 23 24 import java.util.List ; 25 26 import javax.management.MBeanServer ; 27 import javax.management.ObjectName ; 28 29 import org.jboss.system.ServiceBinding; 30 import org.jboss.system.ServiceConfigurator; 31 import org.jboss.system.ServiceContext; 32 import org.jboss.system.ServiceController; 33 import org.jboss.system.metadata.ServiceAttributeMetaData; 34 import org.jboss.system.metadata.ServiceMetaData; 35 36 42 public class ConfigureAction extends ServiceControllerContextAction 43 { 44 public void installAction(ServiceControllerContext context) throws Throwable 45 { 46 ServiceController controller = context.getServiceController(); 47 MBeanServer server = controller.getMBeanServer(); 48 ObjectName objectName = context.getObjectName(); 49 50 ServiceMetaData metaData = context.getServiceMetaData(); 52 if (metaData != null) 53 { 54 List <ServiceAttributeMetaData> attrs = metaData.getAttributes(); 55 if (attrs.size() > 0) 56 { 57 ObjectName classLoaderName = metaData.getClassLoaderName(); 58 ServiceConfigurator.configure(null, controller, objectName, classLoaderName, attrs); 59 } 60 } 61 62 ServiceBinding serviceBinding = context.getServiceController().getServiceBinding(); 64 if (serviceBinding != null) 65 ServiceConfigurator.applyServiceConfig(server, objectName, serviceBinding); 66 67 context.getServiceContext().state = ServiceContext.CONFIGURED; 68 } 69 70 public void uninstallAction(ServiceControllerContext context) 71 { 72 } 73 } 74 | Popular Tags |