Package org.jboss.system.metadata

Examples of org.jboss.system.metadata.ServiceMetaData


      {
         createTopLevelServiceBeanWithMetaData(contextId, unit, metaData);
      }
      else
      {
         ServiceMetaData subjaccPolicy = getServiceMetaData();

         String deploymentName = unit.getSimpleName();

         try
         {
            subjaccPolicy.setObjectName(new ObjectName(getObjectName(unit)));
         }
         catch (Exception e)
         {
            throw new RuntimeException(e);
         }
         // Provide a constructor for the service bean
         ServiceConstructorMetaData serviceConstructor = new ServiceConstructorMetaData();
         serviceConstructor.setSignature(new String[]{String.class.getName(), getMetaDataClassType().getName()});
         serviceConstructor.setParameters(new Object[]{deploymentName, metaData});
         subjaccPolicy.setConstructor(serviceConstructor);

         ArrayList<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
         services.add(subjaccPolicy);
         unit.addAttachment(JACC_ATTACHMENT_NAME, subjaccPolicy, ServiceMetaData.class);

         // Add a dependence into the parent JaccPolicy
         ServiceMetaData parentServiceMetaData = this.getParentJaccPolicyBean(unit);
         if (parentServiceMetaData != null)
         {
            ServiceDependencyMetaData serviceDependencyMetaData = new ServiceDependencyMetaData();
            serviceDependencyMetaData.setIDependOnObjectName(subjaccPolicy.getObjectName());
            parentServiceMetaData.addDependency(serviceDependencyMetaData);

            // Add an attribute in the parent service
            ServiceAttributeMetaData serviceAttributeMetaData = new ServiceAttributeMetaData();
            serviceAttributeMetaData.setName("PolicyConfigurationFacadeMBean");
            ServiceDependencyValueMetaData dependencyValue = new ServiceDependencyValueMetaData();
            dependencyValue.setDependency(subjaccPolicy.getObjectName().toString());
            dependencyValue.setProxyType("attribute");
            serviceAttributeMetaData.setValue(dependencyValue);
            parentServiceMetaData.addAttribute(serviceAttributeMetaData);
         }
      }
     
      /** Register XACML/ACL policies if present in the deployment */
      if(this.policyRegistration != null)
View Full Code Here


   }

   private void createJaccPolicyBean(ServiceConstructorMetaData serviceConstructor, DeploymentUnit unit)
   {
      // Create a Service Bean for the JACC Policy
      ServiceMetaData jaccPolicy = new ServiceMetaData();
      jaccPolicy.setCode(getJaccPolicyName());
      try
      {
         jaccPolicy.setObjectName(new ObjectName(getObjectName(unit)));
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
      }
      // Provide a constructor for the service bean
      jaccPolicy.setConstructor(serviceConstructor);
      ArrayList<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
      services.add(jaccPolicy);

      unit.addAttachment(JACC_ATTACHMENT_NAME, jaccPolicy, ServiceMetaData.class);
   }
View Full Code Here

   {
      DeploymentUnit parentDU = childDU.getParent();

      while (parentDU != null)
      {
         ServiceMetaData parentJacc = (ServiceMetaData) parentDU.getAttachment(JACC_ATTACHMENT_NAME);
         if (parentJacc != null)
            return parentJacc;
         parentDU = parentDU.getParent();
      }
      return null;
View Full Code Here

  

   @Override
   protected ServiceMetaData getServiceMetaData()
   {
      ServiceMetaData serviceMetaData = new ServiceMetaData();
      serviceMetaData.setCode(EjbPolicyConfigurationFacade.class.getName());
      return serviceMetaData;
   }
View Full Code Here

         {
            throw new DeploymentException("Verification of Enterprise Beans failed, see above for error messages.");
         }
      }
     
      ServiceMetaData ejbModule = new ServiceMetaData();
      ejbModule.setCode(EjbModule.class.getName());


      // Build an escaped JMX name including deployment shortname
      ObjectName moduleObjectName = null;
      try
      {
         moduleObjectName = this.getObjectName(unit, deployment);
      }
      catch(MalformedObjectNameException e)
      {
         throw new DeploymentException("Failed to create EJB module " + unit.getName() +
            ": malformed EjbModule name", e);
      }

      ejbModule.setObjectName(moduleObjectName);

      ServiceConstructorMetaData ctor = new ServiceConstructorMetaData();
      ctor.setSignature(
         new String[]{VFSDeploymentUnit.class.getName(), ApplicationMetaData.class.getName()}
      );
      ctor.setParameters(new Object[]{unit, legacyMD});
      ejbModule.setConstructor(ctor);

      // set attributes
      List<ServiceAttributeMetaData> attrs = new ArrayList<ServiceAttributeMetaData>();
      // Transaction manager
      ServiceAttributeMetaData attr = new ServiceAttributeMetaData();
      attr.setName("TransactionManagerFactory");
      ServiceDependencyValueMetaData dependencyValue = new ServiceDependencyValueMetaData();
      dependencyValue.setDependency(getTransactionManagerServiceName());
      dependencyValue.setProxyType("attribute");
      attr.setValue(dependencyValue);
      attrs.add(attr);
      // Security management
      attr = new ServiceAttributeMetaData();
      attr.setName("SecurityManagement");
      ServiceInjectionValueMetaData injectionValue = new ServiceInjectionValueMetaData(securityManagementName);
      attr.setValue(injectionValue);
      attrs.add(attr);
      //Policy Registration
      attr = new ServiceAttributeMetaData();
      attr.setName("PolicyRegistration");
      ServiceInjectionValueMetaData prInjectionValue = new ServiceInjectionValueMetaData(policyRegistrationName);
      attr.setValue(prInjectionValue);
      attrs.add(attr);
      // Add injection of the WebServiceName
      String wsName = getWebServiceName();
      if (wsName != null)
      {
         ServiceAttributeMetaData ws = new ServiceAttributeMetaData();
         ws.setName("WebServiceName");
         ServiceDependencyValueMetaData wsDepends = new ServiceDependencyValueMetaData();
         wsDepends.setDependency(wsName);
         ws.setValue(wsDepends);
         attrs.add(ws);
      }
      // Injection of the TimerService
      ServiceAttributeMetaData tms = new ServiceAttributeMetaData();
      ServiceDependencyValueMetaData tmsDepends = new ServiceDependencyValueMetaData();
      tms.setName("TimerService");
      tmsDepends.setDependency(timerServiceName);
      tmsDepends.setProxyType("attribute");
      tms.setValue(tmsDepends);
      attrs.add(tms);

      ejbModule.setAttributes(attrs);
     
      List<ServiceDependencyMetaData> dependencies = new ArrayList<ServiceDependencyMetaData>();
      // CCM for CachedConnectionInterceptor dependency
      // TODO: this should be injected directly to the interceptor
      if( ccmServiceName != null && ccmServiceName.length() > 0 )
      {
         ServiceDependencyMetaData ccm = new ServiceDependencyMetaData();
         ccm.setIDependOn(ccmServiceName);
         dependencies.add(ccm);
      }
      // Add dependencies on the invoker services in use
      JBossEnterpriseBeansMetaData beans = deployment.getEnterpriseBeans();
      Iterator<JBossEnterpriseBeanMetaData> beansIter = beans.iterator();
      HashSet<String> invokerNames = new HashSet<String>();
      HashSet<String> beanDepends = new HashSet<String>();
      // Process ContainerDependencyMetaData
      VFSDeploymentUnit topUnit = unit.getTopLevel();
      Map<String, ContainerDependencyMetaData> endpoints = (Map<String, ContainerDependencyMetaData>) topUnit.getAttachment(MappedReferenceMetaDataResolverDeployer.ENDPOINT_MAP_KEY);
      if(endpoints == null)
         log.warn(unit+" has no ContainerDependencyMetaData attachment");
      String vfsPath = unit.getRelativePath();
      ArrayList<BeanMetaData> mcBeanMD = new ArrayList<BeanMetaData>();
      while( beansIter.hasNext() )
      {
         JBossEnterpriseBeanMetaData bmd = beansIter.next();
         Set<String> depends = bmd.getDepends();
         if (depends != null)
            beanDepends.addAll(depends);
         String configName = bmd.getConfigurationName();
         ContainerConfigurationMetaData cmd = bmd.determineContainerConfiguration();
         Set<String> invokers = cmd.getInvokerProxyBindingNames();
         if(invokers != null)
         for(String iname : invokers)
         {
            InvokerProxyBindingMetaData imd = deployment.getInvokerProxyBinding(iname);
            if (imd == null)
               throw new DeploymentException("Failed to locate invoker: "+iname);
            String invokerName = imd.getInvokerMBean();
            if( invokerName.equalsIgnoreCase("default") )
            {
               // TODO: JBAS-4306 hack to ingore the invalid default invoker-mbean
               continue;
            }
            if( invokerNames.contains(invokerName) == false )
            {
               invokerNames.add(invokerName);
               ServiceDependencyMetaData invoker = new ServiceDependencyMetaData();
               invoker.setIDependOn(invokerName);
               dependencies.add(invoker);
            }
         }

         // Create mc beans that declare the container ejb jndi name supplies
         if(endpoints != null)
         {
            String ejbKey = "ejb/" + vfsPath + "#" + bmd.getEjbName();
            ContainerDependencyMetaData cdmd = endpoints.get(ejbKey);
            if(cdmd != null)
            {
               // Create the metadata for the bean to install
               String mcname = ejbKey + ",uid"+System.identityHashCode(bmd);
               BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(mcname, Ejb2xMCContainer.class.getName());
               for(String jndiName : cdmd.getJndiNames())
               {
                  String supplyName = "jndi:" + jndiName;
                  builder.addSupply(supplyName);
               }

               BeanMetaData mcbmd = builder.getBeanMetaData();
               log.info("installing bean: " + mcname);
               log.info("  with dependencies:");
               log.info("  and supplies:");
               for(SupplyMetaData smd : mcbmd.getSupplies())
               {
                  log.info("\t" + smd.getSupply());
               }
               mcBeanMD.add(mcbmd);
            }
         }
      }

      // Add any declared dependencies
      /* TODO: this is too coarse as bean to bean depends are being pulled up to the module level
         and an ejb module cannot depend on the beans it creates. The ejb deployer needs to
         be refactored into a component based deployer.
      */
      try
      {
         for(String depend : beanDepends)
         {
            ObjectName n = new ObjectName(depend);
            ServiceDependencyMetaData sdmd = new ServiceDependencyMetaData();
            sdmd.setIDependOn(n.toString());
            dependencies.add(sdmd);        
         }
      }
      catch(MalformedObjectNameException e)
      {
         throw new DeploymentException(e);
      }
      ejbModule.setDependencies(dependencies);

      unit.addAttachment("EjbServiceMetaData", ejbModule, ServiceMetaData.class);
      // Create a kernel deployment for the module mc beans
      AbstractKernelDeployment akd = new AbstractKernelDeployment();
      akd.setName(ejbModule.getObjectName().getCanonicalName()+"Beans");
      akd.setBeans(mcBeanMD);
      unit.addAttachment(KernelDeployment.class, akd);

      // Pass the ejb callByValue setting
      if (callByValue)
View Full Code Here

     
      ServiceMetaDataParser parser = new ServiceMetaDataParser(mbeanElement);
      List<ServiceMetaData> metaDatas = parser.parse();
      if (metaDatas.isEmpty())
         throw new RuntimeException("No mbeans found in passed configuration for " + mbeanName);
      ServiceMetaData metaData = metaDatas.get(0);
      metaData.setClassLoaderName(loaderName);
      ServiceInstance instance = install(server, mbeanName, metaData, null);
      return instance.getObjectInstance();
   }
View Full Code Here

{
   public void installAction(ServiceControllerContext context) throws Throwable
   {
      MBeanServer server = context.getServiceController().getMBeanServer();
      ObjectName objectName = context.getObjectName();
      ServiceMetaData metaData = context.getServiceMetaData();
      Object mbean = context.getTarget();
      ServiceInstance instance = ServiceCreator.install(server, objectName, metaData, mbean);
      context.setTarget(instance.getResource());
   }
View Full Code Here

   public void uninstallAction(ServiceControllerContext context)
   {
      MBeanServer server = context.getServiceController().getMBeanServer();
      ObjectName objectName = context.getObjectName();
      ServiceCreator.uninstall(server, objectName);
      ServiceMetaData metaData = context.getServiceMetaData();
      if (metaData != null)
         context.setTarget(null);
   }
View Full Code Here

      ServiceController controller = context.getServiceController();
      MBeanServer server = controller.getMBeanServer();
      ObjectName objectName = context.getObjectName();

      // Configure any attributes
      ServiceMetaData metaData = context.getServiceMetaData();
      if (metaData != null)
      {
         List<ServiceAttributeMetaData> attrs = metaData.getAttributes();
         if (attrs.size() > 0)
         {
            ObjectName classLoaderName = metaData.getClassLoaderName();
            ServiceConfigurator.configure(null, controller, objectName, classLoaderName, attrs);
         }
      }
     
      context.getServiceContext().state = ServiceContext.CONFIGURED;
View Full Code Here

   }

   @Override
   protected void setComponentName(PersistedComponent component, ManagedObject mo)
   {
      ServiceMetaData md = (ServiceMetaData) mo.getAttachment();
      String name = md.getObjectName().getCanonicalName();
      component.setName(name);
   }
View Full Code Here

TOP

Related Classes of org.jboss.system.metadata.ServiceMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.