Package org.teiid.deployers

Examples of org.teiid.deployers.TranslatorMetaDataGroup


    return VFS.getRoot(dsXml.toURI());
  }
 
  private void writeTemplate(File dsXml, DeploymentTemplateInfo values) throws Exception {

    TranslatorMetaDataGroup group = new TranslatorMetaDataGroup();
   
    // The management framework, will update the attachment the managed property value changes.
    // that way the translator is configured.
    TranslatorMetaData translator = new TranslatorMetaData();
        this.mof.setInstanceClassFactory(TranslatorMetaData.class, new TranslatorMetadataICF(this.mof));
        ManagedObject mo = mof.initManagedObject(translator, "teiid", "translator"); //$NON-NLS-1$ //$NON-NLS-2$   

    for (ManagedProperty mp : values.getProperties().values()) {
      ManagedProperty dsProp = mo.getProperty(mp.getName());
      if (dsProp != null) {
        if (mp.getValue() != null) {
          dsProp.setValue(mp.getValue());
        }
       
        if(mp.isMandatory() && mp.getValue() == null && mp.getDefaultValue() == null) {
          throw new DeploymentException(RuntimePlugin.Util.getString("required_property_not_exists", mp.getName())); //$NON-NLS-1$
        }
      }
    } 
   
    group.addTranslator(translator);
       
    // Now use JAXB and write the file.
    Class[] classes = { TranslatorMetaDataGroup.class };
    JAXBContext context = JAXBContext.newInstance(classes);
    Marshaller marshaller = context.createMarshaller();
View Full Code Here


    super(persistenceFactory);
  }

  @Override
  protected ManagedObject getComponent(Object attachment, PersistedComponent component, boolean create) {
    TranslatorMetaDataGroup deployment = (TranslatorMetaDataGroup) attachment;
    TranslatorMetaData data = null;
    if (deployment.getTranslators() != null && !deployment.getTranslators().isEmpty()) {
      for (TranslatorMetaData md : deployment.getTranslators()) {
        if (md.getName().equals(component.getOriginalName())) {
          data = md;
          break;
        }
      }
View Full Code Here

    return getMOF().initManagedObject(data, null);
  }

  @Override
  protected void removeComponent(Object attachment,PersistedComponent component) {
    TranslatorMetaDataGroup deployment = (TranslatorMetaDataGroup) attachment;
    if (deployment.getTranslators() != null && !deployment.getTranslators().isEmpty()) {
      for (TranslatorMetaData data : deployment.getTranslators()) {
        if (!data.getName().equals(component.getOriginalName())) {
          deployment.addTranslator(data);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.teiid.deployers.TranslatorMetaDataGroup

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.