Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedObject


    tm.setName("Oracle");
    tm.addProperty("ExtensionTranslationClassName", "org.teiid.translator.jdbc.oracle.OracleSQLTranslator");
   
    // convert to managed object and build the VDB out of MO
    ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
    ManagedObject mo = mof.initManagedObject(tm, null, null);
    tm = AdminObjectBuilder.buildAO(mo, TranslatorMetaData.class);
   
    assertEquals("Oracle", tm.getName());
    assertEquals(ExecutionFactory.class.getName(), tm.getPropertyValue(Translator.EXECUTION_FACTORY_CLASS));
    assertEquals("org.teiid.translator.jdbc.oracle.OracleSQLTranslator", tm.getPropertyValue("ExtensionTranslationClassName"));   
View Full Code Here


          String modelName = ((PropertySimple) model.get("name")) //$NON-NLS-1$
              .getStringValue();
          String dsName = ((PropertySimple) model.get("jndiName")) //$NON-NLS-1$
              .getStringValue();

          ManagedObject managedModel = null;
          if (models != null && models.length != 0) {
            for (GenericValue genValue : models) {
              ManagedObject mo = (ManagedObject) ((GenericValueSupport) genValue)
                  .getValue();
              String name = ProfileServiceUtil.getSimpleValue(mo,
                  "name", String.class); //$NON-NLS-1$
              if (modelName.equals(name)) {
                managedModel = mo;
                break;
              }
            }
          }

          ManagedProperty sourceMappings = null;
          if (managedModel != null) {

            sourceMappings = managedModel
                .getProperty("sourceMappings");//$NON-NLS-1$

            if (sourceMappings != null) {
              CollectionValueSupport mappings = (CollectionValueSupport) sourceMappings
                  .getValue();
              GenericValue[] mappingsArray = (GenericValue[]) mappings
                  .getElements();
              for (GenericValue sourceGenValue : mappingsArray) {
                ManagedObject sourceMo = (ManagedObject) ((GenericValueSupport) sourceGenValue)
                    .getValue();
                String sName = ProfileServiceUtil
                    .getSimpleValue(sourceMo,
                        "name", String.class);//$NON-NLS-1$
                if (sName.equals(sourceName)) {
                  // set the jndi name for the ds.
                  ManagedProperty jndiProperty = sourceMo
                      .getProperty("connectionJndiName"); //$NON-NLS-1$
                  jndiProperty
                      .setValue(ProfileServiceUtil.wrap(
                          SimpleMetaType.STRING,
                          dsName));
View Full Code Here

        MetaValue[] errorArray = errorValueSupport.getElements();

        for (MetaValue error : errorArray) {
          GenericValueSupport errorGenValueSupport = (GenericValueSupport) error;

          ManagedObject errorMo = (ManagedObject) errorGenValueSupport
              .getValue();
          String severity = ((SimpleValue) errorMo.getProperty(
              "severity").getValue()).getValue().toString();
          String message = ((SimpleValue) errorMo
              .getProperty("value").getValue()).getValue()
              .toString();

          PropertyMap errorMap = new PropertyMap("errorMap",
              new PropertySimple("severity", severity),
View Full Code Here

    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

    * 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

               {
                  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

                  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

   {
      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

         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

      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

TOP

Related Classes of org.jboss.managed.api.ManagedObject

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.