Examples of ManagedProperty


Examples of org.jboss.managed.api.ManagedProperty

     }
     return null;
 
 
  public static Properties getPropertiesValue(ManagedCommon mc, String prop) {
     ManagedProperty mp = mc.getProperty(prop);
     if (mp != null) {
       MetaType metaType = mp.getMetaType();
       if (metaType.isProperties()) {
         return (PropertiesMetaValue)mp.getValue();
       }
       else if (metaType.isComposite()) {
        Properties props = new Properties();
        MapCompositeValueSupport map = (MapCompositeValueSupport) mp.getValue();
        MapCompositeMetaType type = map.getMetaType();
        for (String key : type.keySet()) {
          MetaValue value = map.get(key);
          props.setProperty(key, stringValue(value));
        }
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty

     }
     return null;
 
 
  public static <T> void getCollectionValue(ManagedCommon mc, String prop, Collection<T> list, Class<T> expectedType) {
     ManagedProperty mp = mc.getProperty(prop);
     if (mp != null) {
       MetaType metaType = mp.getMetaType();
       if (metaType.isCollection()) {
         CollectionValue collectionValue = (CollectionValue)mp.getValue();
         for(MetaValue value:collectionValue.getElements()) {
           if (value.getMetaType().isSimple()) {
             SimpleValue simpleValue = (SimpleValue)value;
             list.add(expectedType.cast(simpleValue.getValue()));
           }
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty

  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());
          }
        }
      } 
      return clazz.cast(t);
    } catch (InstantiationException e) {
View Full Code Here

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, "local-tx-datasource"));//$NON-NLS-1$ 
   
    ManagedPropertyImpl dsTypeMP = buildConfigProperty();
    addProperty(dsTypeMP);
   
    addProperty(ConnectorTemplateInfo.buildTemplateProperty(getName()));
View Full Code Here

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

Examples of org.jboss.managed.api.ManagedProperty

    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

Examples of org.jboss.managed.api.ManagedProperty

      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

Examples of org.jboss.managed.api.ManagedProperty

    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

Examples of org.jboss.managed.api.ManagedProperty

      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

Examples of org.jboss.managed.api.ManagedProperty

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