Package org.rhq.core.domain.configuration

Examples of org.rhq.core.domain.configuration.Configuration


   *
   * @see ConfigurationFacet#updateResourceConfiguration(ConfigurationUpdateReport)
   */
  public void updateResourceConfiguration(ConfigurationUpdateReport report) {

    Configuration resourceConfig = report.getConfiguration();
    resourceConfiguration = resourceConfig.deepCopy();

    // First update simple properties
    super.updateResourceConfiguration(report);

    // Then update models
View Full Code Here


        "connectionType", String.class);
    String vdbURL = ProfileServiceUtil.getSimpleValue(mcVdb, "url",
        String.class);

    // Get plugin config map for models
    Configuration configuration = resourceContext.getPluginConfiguration();

    configuration.put(new PropertySimple("name", vdbName));
    configuration.put(new PropertySimple("version", vdbVersion));
    configuration.put(new PropertySimple("description", vdbDescription));
    configuration.put(new PropertySimple("status", vdbStatus));
    configuration.put(new PropertySimple("url", vdbURL));
    configuration.put(new PropertySimple("connectionType", connectionType));

    try {
      getTranslators(mcVdb, configuration);
    } catch (Exception e) {
      final String msg = "Exception in loadResourceConfiguration(): " + e.getMessage(); //$NON-NLS-1$
View Full Code Here

          // Config
          null // Process info from a process scan
      );

      // Get plugin config map for properties
      Configuration configuration = detail.getPluginConfiguration();

      configuration.put(new PropertySimple("name", vdbName));
      configuration.put(new PropertySimple("fullName", fullName));
      configuration.put(new PropertySimple("version", vdbVersion));
      configuration
          .put(new PropertySimple("description", vdbDescription));
      configuration.put(new PropertySimple("status", vdbStatus));
      configuration.put(new PropertySimple("url", vdbURL));

      detail.setPluginConfiguration(configuration);

      // Add to return values
      discoveredResources.add(detail);
View Full Code Here

  public static ComponentType getComponentType(
      @NotNull ResourceType resourceType) {
    String resourceTypeName = resourceType.getName();
    if (COMPONENT_TYPE_CACHE.containsKey(resourceTypeName))
      return COMPONENT_TYPE_CACHE.get(resourceTypeName);
    Configuration defaultPluginConfig = getDefaultPluginConfiguration(resourceType);
    String type = defaultPluginConfig.getSimpleValue(
        TranslatorComponent.Config.COMPONENT_TYPE, null);
    if (type == null || type.equals("")) //$NON-NLS-1$
      throw new IllegalStateException(
          "Required plugin configuration property '" //$NON-NLS-1$
              + TranslatorComponent.Config.COMPONENT_TYPE
              + "' is not defined in default template."); //$NON-NLS-1$
    String subtype = defaultPluginConfig.getSimpleValue(
        TranslatorComponent.Config.COMPONENT_SUBTYPE, null);
    if (subtype == null || subtype.equals("")) //$NON-NLS-1$
      throw new IllegalStateException(
          "Required plugin configuration property '" //$NON-NLS-1$
              + TranslatorComponent.Config.COMPONENT_SUBTYPE
View Full Code Here

      ResourceType resourceType) {
    ConfigurationTemplate pluginConfigDefaultTemplate = resourceType
        .getPluginConfigurationDefinition().getDefaultTemplate();
    return (pluginConfigDefaultTemplate != null) ? pluginConfigDefaultTemplate
        .createConfiguration()
        : new Configuration();
  }
View Full Code Here

  }

  public static Configuration convertManagedObjectToConfiguration(
      Map<String, ManagedProperty> managedProperties,
      Map<String, PropertySimple> customProps, ResourceType resourceType) {
    Configuration config = new Configuration();
    ConfigurationDefinition configDef = resourceType
        .getResourceConfigurationDefinition();
    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;
      }
      PropertySimple customProp = customProps.get(propName);
      PropertyAdapter<Property, PropertyDefinition> propertyAdapter = PropertyAdapterFactory
          .getCustomPropertyAdapter(customProp);
      if (propertyAdapter == null)
        propertyAdapter = PropertyAdapterFactory
            .getPropertyAdapter(metaValue);
      if (propertyAdapter == null) {
        LOG
            .error("Unable to find a PropertyAdapter for ManagedProperty '" //$NON-NLS-1$
                + propName
                + "' with MetaType [" //$NON-NLS-1$
                + metaValue.getMetaType()
                + "] for ResourceType '" //$NON-NLS-1$
                + resourceType.getName() + "'."); //$NON-NLS-1$
        continue;
      }
      Property property = propertyAdapter.convertToProperty(metaValue,
          propertyDefinition);
      config.put(property);
    }
    return config;
  }
View Full Code Here

   *
   * @see ConfigurationFacet#updateResourceConfiguration(ConfigurationUpdateReport)
   */
  public void updateResourceConfiguration(ConfigurationUpdateReport report) {

    Configuration resourceConfig = report.getConfiguration();
    resourceConfiguration = resourceConfig.deepCopy();

    // Get the vdb and update date role anyAuthenticated and MappedRoleNames
    ManagementView managementView = null;
    ComponentType componentType = new ComponentType(
        PluginConstants.ComponentType.VDB.TYPE,
View Full Code Here

  public Configuration loadResourceConfiguration() {

    VDBComponent parentComponent = (VDBComponent) this.resourceContext
        .getParentResourceComponent();
    ManagedComponent mcVdb = null;
    Configuration configuration = resourceContext.getPluginConfiguration();
    try {
      mcVdb = ProfileServiceUtil.getManagedComponent(getConnection(),
          new ComponentType(PluginConstants.ComponentType.VDB.TYPE,
              PluginConstants.ComponentType.VDB.SUBTYPE),
          parentComponent.name);
    } catch (NamingException e) {
      final String msg = "NamingException in loadResourceConfiguration(): " + e.getMessage(); //$NON-NLS-1$
      LOG.error(msg, e);
    } catch (Exception e) {
      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();
View Full Code Here

            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()) {
View Full Code Here

        return flavor;
    }

    @Override
    public Configuration loadResourceConfiguration() throws Exception {
        Configuration config = super.loadResourceConfiguration();
        String f = getCacheFlavorFromPath();
        PropertySimple flavor = new PropertySimple(FLAVOR, f);
        config.put(flavor);
        return config;
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.Configuration

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.