use of org.pentaho.di.repository.pur.JobDelegate in project pentaho-kettle by pentaho.
the class StreamToJobNodeConverter method convert.
/**
* @param inputStream
* @param charset
* @param mimeType
* @return
*/
public IRepositoryFileData convert(final InputStream inputStream, final String charset, final String mimeType) {
try {
long size = inputStream.available();
JobMeta jobMeta = new JobMeta();
Repository repository = connectToRepository();
Document doc = PDIImportUtil.loadXMLFrom(inputStream);
if (doc != null) {
jobMeta.loadXML(doc.getDocumentElement(), repository, null);
JobDelegate delegate = new JobDelegate(repository, this.unifiedRepository);
delegate.saveSharedObjects(jobMeta, null);
return new NodeRepositoryFileData(delegate.elementToDataNode(jobMeta), size);
} else {
return null;
}
} catch (Exception e) {
return null;
}
}
Aggregations