Search in sources :

Example 1 with TransDelegate

use of org.pentaho.di.repository.pur.TransDelegate in project pentaho-kettle by pentaho.

the class StreamToTransNodeConverter method convert.

public IRepositoryFileData convert(final InputStream inputStream, final String charset, final String mimeType) {
    try {
        long size = inputStream.available();
        TransMeta transMeta = new TransMeta();
        Repository repository = connectToRepository();
        Document doc = PDIImportUtil.loadXMLFrom(inputStream);
        transMeta.loadXML(doc.getDocumentElement(), repository, false);
        TransDelegate delegate = new TransDelegate(repository, this.unifiedRepository);
        saveSharedObjects(repository, transMeta);
        return new NodeRepositoryFileData(delegate.elementToDataNode(transMeta), size);
    } catch (Exception e) {
        logger.error(e);
        return null;
    }
}
Also used : Repository(org.pentaho.di.repository.Repository) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) TransDelegate(org.pentaho.di.repository.pur.TransDelegate) NodeRepositoryFileData(org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData) TransMeta(org.pentaho.di.trans.TransMeta) Document(org.w3c.dom.Document) KettleException(org.pentaho.di.core.exception.KettleException)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)1 Repository (org.pentaho.di.repository.Repository)1 TransDelegate (org.pentaho.di.repository.pur.TransDelegate)1 TransMeta (org.pentaho.di.trans.TransMeta)1 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)1 NodeRepositoryFileData (org.pentaho.platform.api.repository2.unified.data.node.NodeRepositoryFileData)1 Document (org.w3c.dom.Document)1