Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedObject


      }
   }
  
  public void build(DeploymentUnit unit, Set<String> outputs, Map<String, ManagedObject> managedObjects) throws DeploymentException {
    if (isBuildManagedObject()) {
      ManagedObject mo = managedObjects.get(TranslatorMetaDataGroup.class.getName());
      if (mo != null) {
        ManagedProperty translators = mo.getProperty("translators"); //$NON-NLS-1$
        MetaType propType = translators.getMetaType();
        if (propType.isCollection()) {
          CollectionValue value = (CollectionValue) translators.getValue();
          if (value != null) {
            for (MetaValue element:value.getElements()) {
              ManagedObject translator = (ManagedObject)((GenericValue)element).getValue();
              managedObjects.put(translator.getName(), translator);
            }
          }
        }
      }
    }
View Full Code Here


 
  @Override
  public void build(DeploymentUnit unit, Set<String> attachmentNames, Map<String, ManagedObject> managedObjects)
    throws DeploymentException {
           
    ManagedObject vdbMO = managedObjects.get(VDBMetaData.class.getName());
    if (vdbMO != null) {
      VDBMetaData vdb = (VDBMetaData) vdbMO.getAttachment();
      for (Model m : vdb.getModels()) {
        ManagedObject mo = this.mof.initManagedObject(m, ModelMetaData.class, m.getName(),m.getName());
        if (mo == null) {
          throw new DeploymentException("could not create managed object"); //$NON-NLS-1$
        }
        managedObjects.put(mo.getName(), mo);
      }
     
      for (Translator t: vdb.getOverrideTranslators()) {
        ManagedObject mo = this.mof.initManagedObject(t, VDBTranslatorMetaData.class, t.getName(), t.getName());
        if (mo == null) {
          throw new DeploymentException("could not create managed object"); //$NON-NLS-1$
        }
        managedObjects.put(mo.getName(), mo);       
      }
    }
  } 
View Full Code Here

    for (Object anObj : group) {
      if (anObj instanceof TranslatorMetaData) {
        TranslatorMetaData data = (TranslatorMetaData)anObj;
       
        ManagedObject mo = this.mof.initManagedObject(data, TranslatorMetaData.class, data.getName(),data.getName());
        if (mo == null) {
          throw new DeploymentException("could not create managed object"); //$NON-NLS-1$
        }
        managedObjects.put(mo.getName(), mo);
       
      }
    }
  }
View Full Code Here

   
    // The management framework, will update the attachment the managed property value changes.
    // that way the translator is configured.
    TranslatorMetaData translator = new TranslatorMetaData();
        this.mof.setInstanceClassFactory(TranslatorMetaData.class, new TranslatorMetadataICF(this.mof));
        ManagedObject mo = mof.initManagedObject(translator, "teiid", "translator"); //$NON-NLS-1$ //$NON-NLS-2$   

    for (ManagedProperty mp : values.getProperties().values()) {
      ManagedProperty dsProp = mo.getProperty(mp.getName());
      if (dsProp != null) {
        if (mp.getValue() != null) {
          dsProp.setValue(mp.getValue());
        }
       
View Full Code Here

 
  public <T> T buildAdminObject(ManagedCommon mc, Class<T> clazz) {
    try {
      Object t = clazz.newInstance();     
          ManagedObject mo = mof.initManagedObject(t, "teiid", "translator"); //$NON-NLS-1$ //$NON-NLS-2$   
      for (ManagedProperty mp : mc.getProperties().values()) {
        ManagedProperty dsProp = mo.getProperty(mp.getName());
        if (dsProp != null) {
          if (mp.getValue() != null) {
            dsProp.setValue(mp.getValue());
          }
        }
View Full Code Here

      throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
    ManagedProperty mp = mc.getProperty("models");//$NON-NLS-1$
    List<ManagedObject> models = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(mp.getValue());
    ManagedObject managedModel = null;
    if (models != null && !models.isEmpty()) {
      for(ManagedObject mo:models) {
        String name = ManagedUtil.getSimpleValue(mo, "name", String.class); //$NON-NLS-1$
        if (modelName.equals(name)) {
          managedModel = mo;
        }
      }   
    }
   
    if (managedModel == null) {
      throw new AdminProcessingException(IntegrationPlugin.Util.getString("model_not_found", modelName, vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
        ManagedProperty sourceMappings = managedModel.getProperty("sourceMappings");//$NON-NLS-1$
        if (sourceMappings != null){
            List<ManagedObject> mappings = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(sourceMappings.getValue());
            for (ManagedObject mo:mappings) {
                String sName = ManagedUtil.getSimpleValue(mo, "name", String.class);//$NON-NLS-1$
                if (sName.equals(sourceName)) {
View Full Code Here

      throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
    ManagedProperty mp = mc.getProperty("dataPolicies");//$NON-NLS-1$
    List<ManagedObject> policies = (List<ManagedObject>)MetaValueFactory.getInstance().unwrap(mp.getValue());
    ManagedObject managedPolicy = null;
    if (policies != null && !policies.isEmpty()) {
      for(ManagedObject mo:policies) {
        String name = ManagedUtil.getSimpleValue(mo, "name", String.class); //$NON-NLS-1$
        if (policyName.equals(name)) {
          managedPolicy = mo;
        }
      }   
    }
   
    if (managedPolicy == null) {
      throw new AdminProcessingException(IntegrationPlugin.Util.getString("policy_not_found", policyName, vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
    if (role != null) {
          ManagedProperty mappedRoleNames = managedPolicy.getProperty("mappedRoleNames");//$NON-NLS-1$
          CollectionValueSupport roleCollection = (CollectionValueSupport)mappedRoleNames.getValue();
          ArrayList<MetaValue> modifiedRoleNames = new ArrayList<MetaValue>();
          if (roleCollection != null) {
            MetaValue[] roleNames = roleCollection.getElements();
            for (MetaValue mv:roleNames) {
              String existing = (String)((SimpleValueSupport)mv).getValue();
              if (!existing.equals(role)) {
                modifiedRoleNames.add(mv);
              }
            }
          }
          else {
            roleCollection = new CollectionValueSupport(new CollectionMetaType("java.util.List", SimpleMetaType.STRING)); //$NON-NLS-1$
            mappedRoleNames.setValue(roleCollection);
          }
         
          if (add) {
            modifiedRoleNames.add(ManagedUtil.wrap(SimpleMetaType.STRING, role));
          }
         
          roleCollection.setElements(modifiedRoleNames.toArray(new MetaValue[modifiedRoleNames.size()]));
    } else {
      ManagedProperty anyAuthenticated = managedPolicy.getProperty("anyAuthenticated");//$NON-NLS-1$
      anyAuthenticated.setValue(SimpleValueSupport.wrap(add));
    }
   
    try {
      getView().updateComponent(mc);
View Full Code Here

        if (!(genericValue.getValue() instanceof ManagedObject))
        {
            log.error("GenericValue's value [" + genericValue.getValue() + "] is not a ManagedObject - not supported!");
            return;
        }
        ManagedObject managedObject = (ManagedObject)genericValue.getValue();
        for (String propName : propMap.getMap().keySet())
        {
            Property mapMemberProp = propMap.get(propName);
            ManagedProperty managedProp = managedObject.getProperty(propName);
            MetaType metaType = managedProp.getMetaType();
            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaType);
            PropertyDefinition mapMemberPropDef = propDefMap.get(propName);
            if (managedProp.getValue() == null)
            {
View Full Code Here

    }

    public void populatePropertyFromMetaValue(PropertyMap propMap, MetaValue metaValue, PropertyDefinitionMap propDefMap)
    {
        GenericValue genericValue = (GenericValue)metaValue;
        ManagedObject managedObject = (ManagedObject)genericValue.getValue();
        for (String propName : propDefMap.getPropertyDefinitions().keySet())
        {
            ManagedProperty managedProp = managedObject.getProperty(propName);
            if (managedProp != null)
            {
                MetaType metaType = managedProp.getMetaType();
                Object value;
                if (metaType.isSimple())
View Full Code Here

   
    vdb.addDataPolicy(roleOne);
   
    // convert to managed object and build the VDB out of MO
    ManagedObjectFactory mof = ManagedObjectFactoryBuilder.create();
    ManagedObject mo = mof.initManagedObject(vdb, null, null);
    vdb = AdminObjectBuilder.buildAO(mo, VDBMetaData.class);
   
    assertEquals("myVDB", vdb.getName());
    assertEquals("vdb description", vdb.getDescription());
    assertEquals(1, vdb.getVersion());
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.