Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedProperty


    return mc;
  }

  public static MetaValue getManagedProperty(ProfileServiceConnection connection, ManagedComponent mc, String property) throws Exception {

    ManagedProperty managedProperty = null;
    try {
      managedProperty = mc.getProperty(property);
    } catch (Exception e) {
      final String msg = "Exception getting the AdminApi in " + property; //$NON-NLS-1$
      LOG.error(msg, e);
    }

    if (managedProperty != null) {
      return managedProperty.getValue();
    }

    throw new Exception("No property found with given name =" + property); //$NON-NLS-1$
  }
View Full Code Here


      LOG.error(msg, e);
    }

    // Get models from VDB
    int count = 0;
    ManagedProperty property = mcVdb.getProperty("models"); //$NON-NLS-1$
    CollectionValueSupport valueSupport = (CollectionValueSupport) property.getValue();
    MetaValue[] metaValues = valueSupport.getElements();

    for (MetaValue value : metaValues) {
      GenericValueSupport genValueSupport = (GenericValueSupport) value;
      ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport.getValue();
View Full Code Here

  @Test public void testAnnotationProcessing() throws Exception {
    FakeExecutionFactory ef = new FakeExecutionFactory();
   
    Map<String, ManagedProperty> properties = TranslatorTemplateInfoFactory.getProperties(ef.getClass());
    ManagedProperty mp = properties.get("readonly");
    assertTrue(mp.isReadOnly());
    assertEquals(Integer.valueOf(1), MetaValueFactory.getInstance().unwrap(mp.getDefaultValue()));
   
    mp = properties.get("x");
    assertFalse(mp.isReadOnly());
    assertNull(mp.getDefaultValue());
   
    mp = properties.get("Enum");
    assertFalse(mp.isReadOnly());
    assertEquals(PropEnum.A.name(), MetaValueFactory.getInstance().unwrap(mp.getDefaultValue()));
  }
View Full Code Here

        }
        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)
            {
                MetaValue managedPropMetaValue = propertyAdapter.convertToMetaValue(mapMemberProp, mapMemberPropDef, metaType);
                managedProp.setValue(managedPropMetaValue);
            }
            else
            {
                MetaValue managedPropMetaValue = (MetaValue)managedProp.getValue();
                propertyAdapter.populateMetaValueFromProperty(mapMemberProp, managedPropMetaValue, mapMemberPropDef);
            }
        }
    }
View Full Code Here

    {
        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())
                {
                    SimpleValue simpleValue = (SimpleValue)managedProp.getValue();
                    value = simpleValue.getValue();
                }
                else if (metaType.isEnum())
                {
                    EnumValue enumValue = (EnumValue)managedProp.getValue();
                    value = enumValue.getValue();
                }
                else
                {
                    log.error("Nested ManagedProperty's value [" + managedProp.getValue()
                            + "] is not a SimpleValue or EnumValue - unsupported!");
                    continue;
                }
                propMap.put(new PropertySimple(propName, value));
            }
View Full Code Here

    PropertyList list = new PropertyList("translatorList");
    PropertyMap propMap = null;
    c.put(list);

    // First get translator specific properties
    ManagedProperty translatorProps = translator.getProperty("property");
    try {
      getTranslatorValues(translatorProps.getValue(), propMap, list);
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage());
    }

    // Now get common properties
View Full Code Here

                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));
                  break;
                }
View Full Code Here

      configuration.put(new PropertySimple("name", translatorName));//$NON-NLS-1$
      detail.setPluginConfiguration(configuration);
     
       // Add to return values
      // First get translator specific properties
      ManagedProperty translatorProps = translator.getProperty("property");//$NON-NLS-1$
      PropertyList list = new PropertyList("translatorList");//$NON-NLS-1$
      PropertyMap propMap = null;
      getTranslatorValues(translatorProps.getValue(), propMap, list);

      // Now get common properties
      configuration.put(new PropertySimple("name", translatorName));//$NON-NLS-1$
      configuration.put(new PropertySimple("type",ProfileServiceUtil.getSimpleValue(translator,"type", String.class)));//$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

   * @param configuration
   * @throws Exception
   */
  private void getModels(ManagedComponent mcVdb, Configuration configuration) {
    // Get models from VDB
    ManagedProperty property = mcVdb.getProperty("models");
    CollectionValueSupport valueSupport = (CollectionValueSupport) property
        .getValue();
    MetaValue[] metaValues = valueSupport.getElements();

    PropertyList sourceModelsList = new PropertyList("singleSourceModels");
    configuration.put(sourceModelsList);

    PropertyList multiSourceModelsList = new PropertyList(
        "multiSourceModels");
    configuration.put(multiSourceModelsList);

    PropertyList logicalModelsList = new PropertyList("logicalModels");
    configuration.put(logicalModelsList);

    PropertyList errorList = new PropertyList("errorList");
    configuration.put(errorList);

    for (MetaValue value : metaValues) {
      GenericValueSupport genValueSupport = (GenericValueSupport) value;
      ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
          .getValue();

      Boolean isSource = Boolean.TRUE;
      try {
        isSource = ProfileServiceUtil.booleanValue(managedObject
            .getProperty("source").getValue());
      } catch (Exception e) {
        LOG.error(e.getMessage());
      }

      Boolean supportMultiSource = Boolean.TRUE;
      try {
        supportMultiSource = ProfileServiceUtil
            .booleanValue(managedObject.getProperty(
                "supportsMultiSourceBindings").getValue());
      } catch (Exception e) {
        LOG.error(e.getMessage());
      }

      String modelName = managedObject.getName();
      ManagedProperty connectorBinding = managedObject
          .getProperty("sourceMappings");
      Collection<Map<String, String>> sourceList = new ArrayList<Map<String, String>>();

      getSourceMappingValue(connectorBinding.getValue(), sourceList);

      String visibility = ((SimpleValueSupport) managedObject
          .getProperty("visible").getValue()).getValue().toString();
      String type = ((EnumValueSupport) managedObject.getProperty(
          "modelType").getValue()).getValue().toString();
View Full Code Here

   * @throws Exception
   */
  private void getTranslators(ManagedComponent mcVdb,
      Configuration configuration) throws Exception {
    // Get models from VDB
    ManagedProperty property = mcVdb.getProperty("overrideTranslators");
    if (property == null) {
      return;
    }
    CollectionValueSupport valueSupport = (CollectionValueSupport) property
        .getValue();
    MetaValue[] metaValues = valueSupport.getElements();

    PropertyList translatorsList = new PropertyList("translators");
    configuration.put(translatorsList);

    for (MetaValue value : metaValues) {
      GenericValueSupport genValueSupport = (GenericValueSupport) value;
      ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
          .getValue();

      String translatorName = ProfileServiceUtil.getSimpleValue(
          managedObject, "name", String.class);
      String translatorType = ProfileServiceUtil.getSimpleValue(
          managedObject, "type", String.class);
      ManagedProperty properties = managedObject.getProperty("property");

      if (properties != null) {
        CollectionValueSupport props = (CollectionValueSupport) properties
            .getValue();
        for (MetaValue propertyMetaData : props) {
          String propertyName = ProfileServiceUtil
              .stringValue(((CompositeValueSupport) propertyMetaData)
                  .get("name"));
View Full Code Here

TOP

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

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.