Examples of ManagedObject


Examples of org.jboss.managed.api.ManagedObject

    MetaType metaType = pValue.getMetaType();
    if (metaType.isCollection()) {
      for (MetaValue value : ((CollectionValueSupport) pValue)
          .getElements()) {
        GenericValueSupport genValue = ((GenericValueSupport) value);
        ManagedObject mo = (ManagedObject) genValue.getValue();
        String sourceName = mo.getName();
        String jndi = ((SimpleValue) mo.getProperty(
            "connectionJndiName").getValue()).getValue().toString();
        String translatorName = ((SimpleValue) mo.getProperty(
            "translatorName").getValue()).getValue().toString();
        map.put("name", sourceName);
        map.put("jndiName", jndi);
        map.put("translatorName", translatorName);
      }
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

    * TODO Process the Bootstrap server.
    */
   protected void processServer()
   {
      ComponentType type = new ComponentType("MCBean", "MCServer");
      ManagedObject serverMO = managedObjectFactory.initManagedObject(server, "JBossServer", null);
      if (serverMO.getOperations() != null && serverMO.getOperations().size() == 0)
      {
         ManagedOperationImpl shutdown = new ManagedOperationImpl("Shutdown the server", "shutdown");
         if (serverMO instanceof MutableManagedObject)
         {
            HashSet<ManagedOperation> ops = new HashSet<ManagedOperation>();
            ops.add(shutdown);
            MutableManagedObject mmo = MutableManagedObject.class.cast(serverMO);
            mmo.setOperations(ops);
         }
      }
      ManagedComponentImpl serverComp = new ManagedComponentImpl(type, null, serverMO);

      // ServerConfig
      type = new ComponentType("MCBean", "ServerConfig");
      ManagedObject mo = managedObjectFactory.initManagedObject(server.getConfiguration(), null);
      ManagedComponentImpl configComp = new ManagedComponentImpl(type, null, mo);

      view.addManagedComponent(serverComp);
      view.addManagedComponent(configComp);
     
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

               {
                  String name = bmd.getName();
                  ControllerContext context = getKernelController().getContext(bmd.getName(), null);
                  MetaData metaData = getMetaDataRepository().getMetaData(context);
                  // Create the managed object
                  ManagedObject mo = managedObjectFactory.initManagedObject(bmd, null, metaData, name, null);
                  if(mo != null)
                  {
                     managedObjects.put(name, mo);
                  }
               }
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

                  for(MBeanComponent comp : components)
                  {
                     log.trace("Saw MBeanComponent: "+comp);
                     try
                     {
                        ManagedObject mo = createManagedObject(comp.getName(), mdf.getDefaultViewUse(), mdf.getPropertyMetaMappings());

                        String name = comp.getName().getCanonicalName();
                        ManagementObject moAnn = createMOAnnotation(name, comp.getType(), comp.getSubtype());

                        // Both the ManagementObject and ManagementComponent annotation need to be in the MO annotations
                        mo.getAnnotations().put(ManagementObject.class.getName(), moAnn);
                        ManagementComponent mcAnn = moAnn.componentType();
                        mo.getAnnotations().put(ManagementComponent.class.getName(), mcAnn);
                        unitMOs.put(name, mo);
                     }
                     catch(Exception e)
                     {
                        log.warn("Failed to create ManagedObject for: "+comp, e);
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

   {
      MBeanInfo info = mbeanServer.getMBeanInfo(mbean);
      ClassLoader mbeanLoader = mbeanServer.getClassLoaderFor(mbean);
      MetaData metaData = null;
      ViewUse[] viewUse = defaultViewUse == null ? null : new ViewUse[] { ViewUse.valueOf(defaultViewUse) };
      ManagedObject mo = mbeanMOFactory.getManagedObject(mbean, info, mbeanLoader, metaData, viewUse, propertyMetaMappings);
      return mo;
   }
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

         cfType = dsTypeSV.getValue().toString();
      }

      ManagedConnectionFactoryDeploymentMetaData mcf;
      ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
      ManagedObject cfMO;

      String rootElementName = "datasources";
      if("local-tx-datasource".equals(cfType))
      {
         mcf = new LocalDataSourceDeploymentMetaData();
         mof.setInstanceClassFactory(LocalDataSourceDeploymentMetaData.class, new LocalDSInstanceClassFactory(mof));
         cfMO = mof.initManagedObject(mcf,
            KnownComponentTypes.DataSourceTypes.LocalTx.getType().getType(),
            KnownComponentTypes.DataSourceTypes.LocalTx.getType().getSubtype());
      }
      else if("xa-datasource".equals(cfType))
      {
         mcf = new XADataSourceDeploymentMetaData();
         mof.setInstanceClassFactory(XADataSourceDeploymentMetaData.class, new XADSInstanceClassFactory(mof));
         cfMO = mof.initManagedObject(mcf,
            KnownComponentTypes.DataSourceTypes.XA.getType().getType(),
            KnownComponentTypes.DataSourceTypes.XA.getType().getSubtype());
      }
      else if("tx-connection-factory".equals(cfType))
      {
         rootElementName = "connection-factories";
         mcf = new TxConnectionFactoryDeploymentMetaData();
         mof.setInstanceClassFactory(TxConnectionFactoryDeploymentMetaData.class, new TxInstanceClassFactory(mof));
         cfMO = mof.initManagedObject(mcf,
            KnownComponentTypes.ConnectionFactoryTypes.XA.getType().getType(),
            KnownComponentTypes.ConnectionFactoryTypes.XA.getType().getSubtype());
      }
      else if("no-tx-connection-factory".equals(cfType))
      {
         rootElementName = "connection-factories";
         mcf = new NoTxConnectionFactoryDeploymentMetaData();
         mof.setInstanceClassFactory(NoTxConnectionFactoryDeploymentMetaData.class, new NoTxCFInstanceClassFactory(mof));
         cfMO = mof.initManagedObject(mcf,
            KnownComponentTypes.ConnectionFactoryTypes.NoTx.getType().getType(),
            KnownComponentTypes.ConnectionFactoryTypes.NoTx.getType().getSubtype());
      }
      else if("no-tx-datasource".equals(cfType))
      {
         mcf = new NoTxDataSourceDeploymentMetaData();
         mof.setInstanceClassFactory(NoTxDataSourceDeploymentMetaData.class, new NoTxInstanceClassFactory(mof));
         cfMO = mof.initManagedObject(mcf,
            KnownComponentTypes.DataSourceTypes.NoTx.getType().getType(),
            KnownComponentTypes.DataSourceTypes.NoTx.getType().getSubtype());
      }
      else
         throw new IllegalStateException("Unexpected value connection factory type: " + cfType);

      ManagedConnectionFactoryDeploymentGroup group = new ManagedConnectionFactoryDeploymentGroup();
      group.addManagedConnectionFactoryDeployment(mcf);
      boolean logTrace = log.isTraceEnabled();
      for(ManagedProperty tempProp : values.getProperties().values())
      {
         ManagedProperty dsProp = cfMO.getProperty(tempProp.getName());
         if(dsProp != null)
         {
            if(logTrace)
               log.trace("setting " + tempProp.getName() + "=" + tempProp.getValue());
            if(tempProp.getValue() != null)
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

      ManagedCommon parent = component;
      while(parent.getParent() != null)
         parent = parent.getParent();

      // Get the managed object, as a component can also be a child of a managedObject
      ManagedObject managedObject = component.getDeployment().getManagedObject(parent.getName());
      if(managedObject == null && parent instanceof ManagedObject)
         managedObject = (ManagedObject) parent;
     
      if(managedObject == null)
         return false;
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

      ManagedCommon parent = component;
      while(parent.getParent() != null)
         parent = parent.getParent();

      // Get the managed object, as a component can also be a child of a managedObject
      ManagedObject managedObject = component.getDeployment().getManagedObject(parent.getName());
      if(managedObject == null && parent instanceof ManagedObject)
         managedObject = (ManagedObject) parent;

      // Get the current attachment
      String attachmentName = managedObject.getAttachmentName();
      List<AttachmentMetaData> attachments = repositoryMetaData.getAttachments();
      if(attachments == null)
      {
         attachments = new ArrayList<AttachmentMetaData>();
         repositoryMetaData.setAttachments(attachments);
      }
      // Extract the attachment
      AttachmentMetaData attachment = null;
      for(AttachmentMetaData a : attachments)
      {
         if(attachmentName.equals(a.getName()))
            attachment = a;
      }

      // Create a new one
      if(attachment == null)
      {
         // Create attachment meta data
         attachment = new AttachmentMetaData();
         // Add attachment meta data
         attachments.add(attachment);
      }

      // Is attachmentName the same as the className ?
      attachment.setName(attachmentName);
      attachment.setClassName(managedObject.getAttachment().getClass().getName());

      // Save the attachment
      String attachmentPath = deploymentPath + attachment.getName();
      // Create the persistence information
      PersistenceRoot persistenceRoot = getSerializer().loadAttachment(attachmentPath, PersistenceRoot.class);
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

   public void testNoTxDataSourceDeploymentMetaData()
   {
      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      mof.addInstanceClassFactory(new NoTxCFInstanceClassFactory());
      ManagedObject mo = mof.createManagedObject(NoTxDataSourceDeploymentMetaData.class);
      log.info(mo.getProperties());
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(DataSourceDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(NonXADataSourceDeploymentMetaData_NAMES));
      Set<String> propertyNames = mo.getPropertyNames();
      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
      if(expectedPropertyNames.equals(sortedPropertyNames) == false)
      {
         Set<String> missingNames = new TreeSet<String>();
         Set<String> extraNames = new TreeSet<String>();
View Full Code Here

Examples of org.jboss.managed.api.ManagedObject

      enableTrace("org.jboss.managed.plugins.factory");
      ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
      TxInstanceClassFactory icf = new TxInstanceClassFactory();
      mof.setInstanceClassFactory(TxConnectionFactoryDeploymentMetaData.class, icf);
      TxConnectionFactoryDeploymentMetaData txcf = new TxConnectionFactoryDeploymentMetaData();
      ManagedObject mo = mof.initManagedObject(txcf, "TxConnectionFactoryDeploymentMetaData", null);
      // Validate the expected property names
      Set<String> expectedPropertyNames = new TreeSet<String>();
      expectedPropertyNames.addAll(Arrays.asList(ManagedConnectionFactoryDeploymentMetaData_NAMES));
      expectedPropertyNames.addAll(Arrays.asList(TxConnectionFactoryDeploymentMetaData_NAMES));
      Set<String> propertyNames = mo.getPropertyNames();
      TreeSet<String> sortedPropertyNames = new TreeSet<String>(propertyNames);
      if(expectedPropertyNames.equals(sortedPropertyNames) == false)
      {
         Set<String> missingNames = new TreeSet<String>();
         Set<String> extraNames = new TreeSet<String>();
         analyzeDiffs(expectedPropertyNames, sortedPropertyNames,
               missingNames, extraNames);
         fail("Extra properties: "+extraNames+", missing properties: "+missingNames);
      }
      ManagedProperty connectionProperties = mo.getProperty("config-property");
      MetaType cpType = connectionProperties.getMetaType();
      assertTrue("connection-properties.type="+cpType, cpType instanceof CompositeMetaType);
      Object cpValue = connectionProperties.getValue();
      assertTrue("connection-properties.value="+cpValue, cpValue instanceof CompositeValue);
      CompositeValue cvalue = (CompositeValue) cpValue;
      // Now update the values
      MapCompositeValueSupport map = (MapCompositeValueSupport) cvalue;

      // Test simple property types
      ManagedProperty xatx = mo.getProperty("xa-transaction");
      xatx.setValue(SimpleValueSupport.wrap(true));
      assertEquals(Boolean.TRUE, txcf.getXATransaction());
      ManagedProperty xart = mo.getProperty("xa-resource-timeout");
      xart.setValue(SimpleValueSupport.wrap(12345));
      assertEquals(12345, txcf.getXaResourceTimeout());
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.