Examples of ManagedProperty


Examples of org.jboss.managed.api.ManagedProperty

                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

Examples of org.jboss.managed.api.ManagedProperty

      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

Examples of org.jboss.managed.api.ManagedProperty

   * @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

Examples of org.jboss.managed.api.ManagedProperty

   * @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

Examples of org.jboss.managed.api.ManagedProperty

    return null;
  }
 
  public static <T> T getSimpleValue(ManagedComponent mc, String prop,
      Class<T> expectedType) {
    ManagedProperty mp = mc.getProperty(prop);
    if (mp != null) {
      MetaType metaType = mp.getMetaType();
      if (metaType.isSimple()) {
        SimpleValue simpleValue = (SimpleValue) mp.getValue();
        return expectedType.cast((simpleValue != null) ? simpleValue
            .getValue() : null);
      } else if (metaType.isEnum()) {
        EnumValue enumValue = (EnumValue) mp.getValue();
        return expectedType.cast((enumValue != null) ? enumValue
            .getValue() : null);
      }
      throw new IllegalStateException(prop + " is not a simple type"); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty

    return null;
  }
 
  public static <T> T getSimpleValue(ManagedCommon mc, String prop,
      Class<T> expectedType) {
    ManagedProperty mp = mc.getProperty(prop);
    if (mp != null) {
      MetaType metaType = mp.getMetaType();
      if (metaType.isSimple()) {
        SimpleValue simpleValue = (SimpleValue) mp.getValue();
        return expectedType.cast((simpleValue != null) ? simpleValue
            .getValue() : null);
      } else if (metaType.isEnum()) {
        EnumValue enumValue = (EnumValue) mp.getValue();
        return expectedType.cast((enumValue != null) ? enumValue
            .getValue() : null);
      }
      throw new IllegalArgumentException(prop + " is not a simple type"); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty

    Map<String, PropertyDefinition> propDefs = configDef
        .getPropertyDefinitions();
    Set<String> propNames = managedProperties.keySet();
    for (String propName : propNames) {
      PropertyDefinition propertyDefinition = propDefs.get(propName);
      ManagedProperty managedProperty = managedProperties.get(propName);
      if (propertyDefinition == null) {
        if (!managedProperty.hasViewUse(ViewUse.STATISTIC))
          LOG
              .debug(resourceType
                  + " does not define a property corresponding to ManagedProperty '" //$NON-NLS-1$
                  + propName + "'."); //$NON-NLS-1$
        continue;
      }
      if (managedProperty == null) {
        // This should never happen, but don't let it blow us up.
        LOG.error("ManagedProperty '" + propName //$NON-NLS-1$
            + "' has a null value in the ManagedProperties Map."); //$NON-NLS-1$
        continue;
      }
      MetaValue metaValue = managedProperty.getValue();
      if (managedProperty.isRemoved() || metaValue == null) {
        // Don't even add a Property to the Configuration if the
        // ManagedProperty is flagged as removed or has a
        // null value.
        continue;
      }
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty

    ComponentType componentType = new ComponentType(
        PluginConstants.ComponentType.VDB.TYPE,
        PluginConstants.ComponentType.VDB.SUBTYPE);

    ManagedComponent managedComponent = null;
    ManagedProperty anyAuthenticatedMp = null;
    report.setStatus(ConfigurationUpdateStatus.SUCCESS);
    try {

      managementView = getConnection().getManagementView();
      managedComponent = managementView.getComponent(
          ((VDBComponent) this.resourceContext
              .getParentResourceComponent()).name, componentType);
      ManagedProperty mp = managedComponent.getProperty("dataPolicies");//$NON-NLS-1$
      CollectionValueSupport dataRolesListMp = (CollectionValueSupport) mp
          .getValue();
      String name = resourceConfiguration.getSimpleValue("name", null); //$NON-NLS-1$
      String anyAuthenticated = resourceConfiguration.getSimpleValue(
          "anyAuthenticated", null); //$NON-NLS-1$

      for (MetaValue val : dataRolesListMp.getElements()) {
        GenericValueSupport genValueSupport = (GenericValueSupport) val;
        ManagedObjectImpl managedObject = (ManagedObjectImpl) genValueSupport
            .getValue();

        for (String dataRolesProp : managedObject.getPropertyNames()) {
          ManagedProperty property = managedObject
              .getProperty(dataRolesProp);

          String pname = ProfileServiceUtil.stringValue(managedObject
              .getProperty("name").getValue()); //$NON-NLS-1$
          if (!pname.equals(name)) {
            continue;
          }

          anyAuthenticatedMp = managedObject
              .getProperty("anyAuthenticated"); //$NON-NLS-1$
          anyAuthenticatedMp.setValue(ProfileServiceUtil.wrap(
              SimpleMetaType.BOOLEAN, anyAuthenticated));
          List<Property> mappedRoleNamePropertyList = resourceConfiguration.getList("mappedRoleNameList").getList(); //$NON-NLS-1$
          List<String> mappedRoleNameList = new ArrayList<String>();
         
          for (Property mappedRoleNameProperty : mappedRoleNamePropertyList){
            String mappedRoleNameString = ((PropertyMap)mappedRoleNameProperty).getSimpleValue("name", null); //$NON-NLS-1$
            mappedRoleNameList.add(mappedRoleNameString);
          }
          ManagedProperty mappedRoleNameMp = managedObject.getProperty("mappedRoleNames"); //$NON-NLS-1$
          mappedRoleNameMp.setValue(convertListOfStringsToMetaValue(mappedRoleNameList));
        }

        try {
          managementView.updateComponent(managedComponent);
          managementView.load();
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty

      final String msg = "Exception in loadResourceConfiguration(): " + e.getMessage(); //$NON-NLS-1$
      LOG.error(msg, e);
    }

    // Get data roles from VDB
    ManagedProperty property = mcVdb.getProperty("dataPolicies"); //$NON-NLS-1$
    if (property != null) {
      CollectionValueSupport valueSupport = (CollectionValueSupport) property
          .getValue();
      MetaValue[] metaValues = valueSupport.getElements();

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

        String dataRoleName = ProfileServiceUtil.getSimpleValue(
            managedObject, "name", String.class); //$NON-NLS-1$
        Boolean anyAuthenticated = ProfileServiceUtil.getSimpleValue(
            managedObject, "anyAuthenticated", Boolean.class); //$NON-NLS-1$
        String description = ProfileServiceUtil.getSimpleValue(
            managedObject, "description", String.class); //$NON-NLS-1$

        configuration.put(new PropertySimple("name", dataRoleName)); //$NON-NLS-1$
        configuration.put(new PropertySimple("anyAuthenticated", //$NON-NLS-1$
            anyAuthenticated));
        configuration
            .put(new PropertySimple("description", description)); //$NON-NLS-1$

        PropertyList mappedRoleNameList = new PropertyList(
            "mappedRoleNameList"); //$NON-NLS-1$
        configuration.put(mappedRoleNameList);
        ManagedProperty mappedRoleNames = managedObject
            .getProperty("mappedRoleNames"); //$NON-NLS-1$
        if (mappedRoleNames != null) {
          CollectionValueSupport props = (CollectionValueSupport) mappedRoleNames
              .getValue();
          for (MetaValue mappedRoleName : props.getElements()) {
            PropertyMap mappedRoleNameMap = null;

            try {
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty

            PluginConstants.ComponentType.VDB.TYPE,
            PluginConstants.ComponentType.VDB.SUBTYPE),
        parenComponent.name);

    // Get data roles from VDB
    ManagedProperty property = mcVdb.getProperty("dataPolicies");
    if (property != null) {
      CollectionValueSupport valueSupport = (CollectionValueSupport) property
          .getValue();
      MetaValue[] metaValues = valueSupport.getElements();

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

        String dataRoleName = ProfileServiceUtil.getSimpleValue(
            managedObject, "name", String.class);
        Boolean anyAuthenticated = ProfileServiceUtil.getSimpleValue(
            managedObject, "anyAuthenticated", Boolean.class);
        String description = ProfileServiceUtil.getSimpleValue(
            managedObject, "description", String.class);

        /**
         *
         * A discovered resource must have a unique key, that must stay
         * the same when the resource is discovered the next time
         */
        DiscoveredResourceDetails detail = new DiscoveredResourceDetails(
            discoveryContext.getResourceType(), // ResourceType
            dataRoleName, // Resource Key
            dataRoleName, // Resource Name
            null, // Version
            PluginConstants.ComponentType.DATA_ROLE.DESCRIPTION, // Description
            discoveryContext.getDefaultPluginConfiguration(), // Plugin
            // Config
            null // Process info from a process scan
        );

        Configuration configuration = detail.getPluginConfiguration();

        configuration.put(new PropertySimple("name", dataRoleName));
        configuration.put(new PropertySimple("anyAuthenticated",
            anyAuthenticated));
        configuration
            .put(new PropertySimple("description", description));

        PropertyList mappedRoleNameList = new PropertyList(
            "mappedRoleNameList");
        configuration.put(mappedRoleNameList);
        ManagedProperty mappedRoleNames = managedObject
            .getProperty("mappedRoleNames");
        if (mappedRoleNames != null) {
          CollectionValueSupport props = (CollectionValueSupport)mappedRoleNames.getValue();
          for (MetaValue mappedRoleName : props.getElements()) {
            mappedRoleNameList.add(new PropertySimple("name", ProfileServiceUtil.stringValue(mappedRoleName)));
          }

        }
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.