use of org.exolab.castor.xml.Marshaller in project ACS by ACS-Community.
the class ACSAlarmSystemDAOImpl method flushConfiguration.
public void flushConfiguration(AlarmSystemConfiguration asc) {
if (conf == null || !conf.isWriteable())
throw new IllegalStateException("no writable configuration accessor");
if (asc == null)
throw new IllegalArgumentException("Null Alarm System Configuration argument");
StringWriter FFWriter = new StringWriter();
Marshaller FF_marshaller;
try {
FF_marshaller = new Marshaller(FFWriter);
} catch (IOException e) {
e.printStackTrace();
return;
}
FF_marshaller.setValidation(false);
try {
FF_marshaller.marshal(asc);
} catch (MarshalException e) {
e.printStackTrace();
return;
} catch (ValidationException e) {
e.printStackTrace();
return;
}
try {
conf.deleteConfiguration(ALARM_SYSTEM_CONFIGURATION_PATH);
conf.addConfiguration(ALARM_SYSTEM_CONFIGURATION_PATH, FFWriter.toString().replaceFirst("xsi:type=\".*\"", ""));
} catch (CDBRecordDoesNotExistEx e) {
try {
conf.addConfiguration(ALARM_SYSTEM_CONFIGURATION_PATH, FFWriter.toString().replaceFirst("xsi:type=\".*\"", ""));
} catch (Exception e1) {
e1.printStackTrace();
}
} catch (org.omg.CORBA.UNKNOWN e) {
try {
conf.addConfiguration(ALARM_SYSTEM_CONFIGURATION_PATH, FFWriter.toString().replaceFirst("xsi:type=\".*\"", ""));
} catch (Exception e1) {
e1.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.exolab.castor.xml.Marshaller in project ACS by ACS-Community.
the class XmlInOut method marshalObsProjectToFile.
public String marshalObsProjectToFile(ObsProject proj, String originalXmlFilename) throws MarshalException, ValidationException, IOException {
String filename = getRemarshaledFilename(originalXmlFilename);
File xmlFile = new File(module_dir, pathToXmlSamples + filename);
Marshaller m = new Marshaller(new FileWriter(xmlFile));
// m.setNamespaceMapping("tprj", "AlmaTest/ObsProject");
m.marshal(proj);
return filename;
}
use of org.exolab.castor.xml.Marshaller in project camel by apache.
the class AbstractCastorDataFormat method createMarshaller.
public Marshaller createMarshaller(Exchange exchange) throws Exception {
// need to create new marshaller as we may have concurrent processing
Marshaller answer = xmlContext.createMarshaller();
answer.setValidation(isValidation());
return answer;
}
Aggregations