use of org.pentaho.di.trans.steps.mapping.MappingMeta in project pentaho-kettle by pentaho.
the class RepositoryExporter method convertFromFileRepository.
private void convertFromFileRepository(TransMeta transMeta) {
Object[] metaInjectObjectArray = new Object[4];
metaInjectObjectArray[0] = transMeta;
metaInjectObjectArray[1] = PKG;
if (repository instanceof KettleFileRepository) {
KettleFileRepository fileRep = (KettleFileRepository) repository;
metaInjectObjectArray[2] = fileRep;
// The id of the transformation is the relative filename.
// Setting the filename also sets internal variables needed to load the trans/job referenced.
//
String transMetaFilename = fileRep.calcFilename(transMeta.getObjectId());
transMeta.setFilename(transMetaFilename);
for (StepMeta stepMeta : transMeta.getSteps()) {
if (stepMeta.isMapping()) {
MappingMeta mappingMeta = (MappingMeta) stepMeta.getStepMetaInterface();
//
if (mappingMeta.getSpecificationMethod() == ObjectLocationSpecificationMethod.FILENAME) {
try {
TransMeta meta = MappingMeta.loadMappingMeta(mappingMeta, fileRep, fileRep.metaStore, transMeta);
FileObject fileObject = KettleVFS.getFileObject(meta.getFilename());
mappingMeta.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
mappingMeta.setFileName(null);
mappingMeta.setTransName(meta.getName());
mappingMeta.setDirectoryPath(Const.NVL(calcRepositoryDirectory(fileRep, fileObject), "/"));
} catch (Exception e) {
log.logError(BaseMessages.getString(PKG, "Repository.Exporter.Log.UnableToLoadTransInMap", mappingMeta.getName()), e);
}
}
}
metaInjectObjectArray[3] = stepMeta;
try {
ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.RepositoryExporterPatchTransStep.id, metaInjectObjectArray);
} catch (KettleException ke) {
log.logError(ke.getMessage(), ke);
}
}
}
}
use of org.pentaho.di.trans.steps.mapping.MappingMeta in project pentaho-kettle by pentaho.
the class TransMeta method setRepositoryOnMappingSteps.
/**
* Set the Repository object on the Mapping step That way the mapping step can determine the output fields for
* repository hosted mappings... This is the exception to the rule so we don't pass this through the getFields()
* method. TODO: figure out a way to make this more generic.
*/
private void setRepositoryOnMappingSteps() {
for (StepMeta step : steps) {
if (step.getStepMetaInterface() instanceof MappingMeta) {
((MappingMeta) step.getStepMetaInterface()).setRepository(repository);
((MappingMeta) step.getStepMetaInterface()).setMetaStore(metaStore);
}
if (step.getStepMetaInterface() instanceof SingleThreaderMeta) {
((SingleThreaderMeta) step.getStepMetaInterface()).setRepository(repository);
((SingleThreaderMeta) step.getStepMetaInterface()).setMetaStore(metaStore);
}
if (step.getStepMetaInterface() instanceof JobExecutorMeta) {
((JobExecutorMeta) step.getStepMetaInterface()).setRepository(repository);
((JobExecutorMeta) step.getStepMetaInterface()).setMetaStore(metaStore);
}
if (step.getStepMetaInterface() instanceof TransExecutorMeta) {
((TransExecutorMeta) step.getStepMetaInterface()).setRepository(repository);
((TransExecutorMeta) step.getStepMetaInterface()).setMetaStore(metaStore);
}
}
}
Aggregations