Package org.jboss.managed.api

Examples of org.jboss.managed.api.ManagedProperty


  }
 
  private void populate() {
    super.start();

    ManagedProperty mp = this.getProperties().get("connection-definition");//$NON-NLS-1$ 
    mp.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, "javax.sql.DataSource"));//$NON-NLS-1$ 

    mp = this.getProperties().get("dsType");//$NON-NLS-1$ 
    mp.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, "xa-datasource"));//$NON-NLS-1$ 
   
    ManagedPropertyImpl dsTypeMP = buildConfigProperty();
    addProperty(dsTypeMP);
   
    addProperty(ConnectorTemplateInfo.buildTemplateProperty(getName()));
View Full Code Here


    configProperties.put(ConnectorTemplateInfo.TEMPLATE_NAME, getInfo().getName());
    values.getProperties().get("config-property").setValue(ManagedUtil.compositeValueMap(configProperties));//$NON-NLS-1$ 
   
    Map<String, String> connectionProperties = new HashMap<String, String>();
   
    ManagedProperty mp = values.getProperties().remove(LocalJdbcConnectorTemplateInfo.ADDITIONAL_CONNECTION_PROPS);
    if (mp != null && mp.getValue() != null) {
      XaJdbcConnectorTemplateInfo.parseProperties(ManagedUtil.stringValue(mp.getValue()), connectionProperties);
    }
   
    values.getProperties().get("connection-properties").setValue(ManagedUtil.compositeValueMap(connectionProperties));//$NON-NLS-1$
   
    return super.applyTemplate(values);
View Full Code Here

      Map<String, ManagedProperty> propertyMap = targetInfo.getProperties();
     
      // walk through the supplied properties and assign properly to either template
      // or config-properties.
      for (String key:sourceInfo.getProperties().keySet()) {
        ManagedProperty mp = propertyMap.get(key);
               
        if (mp != null) {
          // property found in target, so just add as value
          MetaValue value = sourceInfo.getProperties().get(key).getValue();
          if (ManagedUtil.sameValue(mp.getDefaultValue(), value)) {
            continue;
          }   
         
          if (value != null) {
            mp.setValue(value);
          }
        }
        else {
          // property not found in the target; add as "config-property"
          mp = sourceInfo.getProperties().get(key);
          if (ManagedUtil.sameValue(mp.getDefaultValue(), mp.getValue())) {
            continue;
         
         
          if (mp.getValue() != null) {
            configProps.put(key, ManagedUtil.stringValue(mp.getValue()));
            configProps.put(key+".type", mp.getValue().getMetaType().getClassName());//$NON-NLS-1$ 
          }
        }
      }
     
      if (configProps.size() > 0) {
View Full Code Here

    Map<String, String> props = new HashMap<String, String>();
   
    Map<String, ManagedProperty> sourceProperties = values.getProperties();
   
    for (String name:names) {
      ManagedProperty mp = sourceProperties.remove(name);
      if (mp != null) {
        if (mp.getValue() != null) {
          props.put(name, ManagedUtil.stringValue(mp.getValue()));
        }
        else {
          if (mp.isMandatory()) {
            if( mp.getDefaultValue() != null) {
              props.put(name, ManagedUtil.stringValue(mp.getDefaultValue()));
            }
            else {
              throw new AdminComponentException(IntegrationPlugin.Util.getString("property_required_not_found", mp.getName(), templateName));//$NON-NLS-1$ 
            }
          }
        }
      }
    }
View Full Code Here

      ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
    if (mc == null) {
      throw new AdminProcessingException(IntegrationPlugin.Util.getString("vdb_not_found", vdbName, vdbVersion)); //$NON-NLS-1$
    }
   
      ManagedProperty connectionTypeProperty = mc.getProperty("connectionType"); //$NON-NLS-1$
      if (connectionTypeProperty != null) {
        connectionTypeProperty.setValue(ManagedUtil.wrap(new EnumMetaType(ConnectionType.values()), type != null ?type.name():ConnectionType.BY_VERSION.name()));
      }
   
    try {
      getView().updateComponent(mc);
    } catch (Exception e) {
View Full Code Here

    ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
    if (mc == null) {
      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)) {
                 
                  ManagedProperty translatorProperty = mo.getProperty("translatorName"); //$NON-NLS-1$
                  if (translatorProperty == null) {
                    translatorProperty = new WritethroughManagedPropertyImpl(mo, new DefaultFieldsImpl("translatorName")); //$NON-NLS-1$
                  }
                  translatorProperty.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, translatorName));
                 
                  // set the jndi name for the ds.
                  ManagedProperty jndiProperty = mo.getProperty("connectionJndiName"); //$NON-NLS-1$
                  if (jndiProperty == null) {
                    jndiProperty = new WritethroughManagedPropertyImpl(mo, new DefaultFieldsImpl("connectionJndiName")); //$NON-NLS-1$
                  }
                  jndiProperty.setValue(ManagedUtil.wrap(SimpleMetaType.STRING, dsName));
                }
            }
        } else {
          //TODO: this can be in the default situation when no source mappings are specified
          throw new AdminProcessingException(IntegrationPlugin.Util.getString("sourcename_not_found", sourceName, vdbName, vdbVersion, modelName)); //$NON-NLS-1$
View Full Code Here

    ManagedComponent mc = getVDBManagedComponent(vdbName, vdbVersion);
    if (mc == null) {
      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);
    } catch (Exception e) {
View Full Code Here

      // template properties specific to the template
      Map<String, ManagedProperty> propertyMap = info.getProperties();
     
      // walk through the supplied properties and assign properly to template
      for (String key:properties.stringPropertyNames()) {
        ManagedProperty mp = propertyMap.get(key);
        if (mp != null) {
          String value = properties.getProperty(key);
          if (!ManagedUtil.sameValue(mp.getDefaultValue(), value)){
            mp.setValue(SimpleValueSupport.wrap(value));
          }
        }
      }
      info.getProperties().get("jndi-name").setValue(SimpleValueSupport.wrap(deploymentName)); //$NON-NLS-1$
      getView().applyTemplate(deploymentName, info);
View Full Code Here

    ConnectorTemplateInfo copy = new ConnectorTemplateInfo(getName(), getDescription(), getProperties());
    copy.setRarName(getRarName());
    super.copy(copy);
    copy.populate();
   
    ManagedProperty mp = copy.getProperties().get("connection-definition");//$NON-NLS-1$
    mp.setValue(SimpleValueSupport.wrap(ConnectionFactory.class.getName()));
   
    mp = copy.getProperties().get("rar-name");//$NON-NLS-1$ 
    mp.setValue(SimpleValueSupport.wrap(getRarName()));
    return copy;
  }
View Full Code Here

    values.getProperties().get("config-property").setValue(ManagedUtil.compositeValueMap(configProperties));//$NON-NLS-1$ 
   
    // Data source specific properties
    Map<String, String> dsProps = ConnectorDeploymentTemplate.propertiesAsMap(values, XaJdbcConnectorTemplateInfo.EXTENDED_DS_PROPERTIES, info.getName());
   
    ManagedProperty mp = values.getProperties().remove(XaJdbcConnectorTemplateInfo.ADDITIONAL_DS_PROPS);
    if (mp != null && mp.getValue() != null) {
      XaJdbcConnectorTemplateInfo.parseProperties(ManagedUtil.stringValue(mp.getValue()), dsProps);
    }
   
    values.getProperties().get("xa-datasource-properties").setValue(ManagedUtil.compositeValueMap(dsProps));//$NON-NLS-1$
       
    return super.applyTemplate(values);
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.