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();