本文整理了Java中org.pentaho.di.repository.Repository.loadTransformation
方法的一些代码示例,展示了Repository.loadTransformation
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.loadTransformation
方法的具体详情如下:
包路径:org.pentaho.di.repository.Repository
类名称:Repository
方法名:loadTransformation
[英]Load a transformation with a name from a folder in the repository
[中]从存储库中的文件夹加载具有名称的转换
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public TransMeta loadTransformation( String s, RepositoryDirectoryInterface repositoryDirectoryInterface, ProgressMonitorListener progressMonitorListener, boolean b, String s1 ) throws KettleException {
return getDelegate().loadTransformation( s, repositoryDirectoryInterface, progressMonitorListener, b, s1 );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public TransMeta loadTransformation( ObjectId objectId, String s ) throws KettleException {
return getDelegate().loadTransformation( objectId, s );
}
代码示例来源:origin: pentaho/pentaho-kettle
private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface repdir ) throws KettleException {
// Read the transformation...
//
mappingTransMeta =
repository.loadTransformation( transMeta.environmentSubstitute( transName ), repdir, null, true, null );
mappingTransMeta.clearChanged();
}
代码示例来源:origin: pentaho/pentaho-kettle
private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface repdir ) throws KettleException {
// Read the transformation...
//
mappingTransMeta =
repository.loadTransformation( transMeta.environmentSubstitute( transName ), repdir, null, true, null );
mappingTransMeta.clearChanged();
}
代码示例来源:origin: pentaho/pentaho-kettle
private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface repdir ) throws KettleException {
// Read the transformation...
//
mappingTransMeta = repository.loadTransformation(
transMeta.environmentSubstitute( transName ), repdir, null, true, null );
mappingTransMeta.clearChanged();
}
代码示例来源:origin: pentaho/pentaho-kettle
private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface repdir ) throws KettleException {
// Read the transformation...
//
executorTransMeta =
repository.loadTransformation( transMeta.environmentSubstitute( transName ), repdir, null, false, null );
executorTransMeta.clearChanged();
}
代码示例来源:origin: pentaho/pentaho-kettle
private void loadRepositoryTrans( String transName, RepositoryDirectoryInterface repdir ) throws KettleException {
// Read the transformation...
//
injectTransMeta =
repository.loadTransformation( transMeta.environmentSubstitute( transName ), repdir, null, true, null );
injectTransMeta.clearChanged();
}
代码示例来源:origin: pentaho/pentaho-kettle
private TransMeta loadTrans( Repository repository, String transformationName ) throws KettleException {
if ( repository == null ) {
throw new KettleException( "Repository required." );
} else {
synchronized ( repository ) {
// With a repository we need to load it from /foo/bar/Transformation
// We need to extract the folder name from the path in front of the
// name...
//
String directoryPath;
String name;
int lastSlash = transformationName.lastIndexOf( RepositoryDirectory.DIRECTORY_SEPARATOR );
if ( lastSlash < 0 ) {
directoryPath = "/";
name = transformationName;
} else {
directoryPath = transformationName.substring( 0, lastSlash );
name = transformationName.substring( lastSlash + 1 );
}
RepositoryDirectoryInterface directory =
repository.loadRepositoryDirectoryTree().findDirectory( directoryPath );
ObjectId transformationId = repository.getTransformationID( name, directory );
TransMeta transMeta = repository.loadTransformation( transformationId, null );
return transMeta;
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public void convertPostRepoSave( RepositoryFile repositoryFile ) {
if ( repositoryFile != null ) {
try {
Repository repo = connectToRepository();
if ( repo != null ) {
TransMeta
transMeta =
repo.loadTransformation( new StringObjectId( repositoryFile.getId().toString() ), null );
ExtensionPointHandler.callExtensionPoint( new LogChannel( this ),
KettleExtensionPoint.TransImportAfterSaveToRepo.id, transMeta );
}
} catch ( Exception e ) {
logger.error( KettleExtensionPoint.TransImportAfterSaveToRepo.id, e );
}
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private TransMeta getTransMetaFromRepository( Repository rep, CurrentDirectoryResolver r, String transPath ) throws KettleException {
String realTransName = "";
String realDirectory = "/";
if ( StringUtils.isBlank( transPath ) ) {
throw new KettleException( BaseMessages.getString( PKG, "JobTrans.Exception.MissingTransFileName" ) );
}
int index = transPath.lastIndexOf( RepositoryFile.SEPARATOR );
if ( index != -1 ) {
realTransName = transPath.substring( index + 1 );
realDirectory = index == 0 ? RepositoryFile.SEPARATOR : transPath.substring( 0, index );
}
realDirectory = r.normalizeSlashes( realDirectory );
RepositoryDirectoryInterface repositoryDirectory = rep.loadRepositoryDirectoryTree().findDirectory( realDirectory );
if ( repositoryDirectory == null ) {
throw new KettleException( "Unable to find repository directory [" + Const.NVL( realDirectory, "" ) + "]" );
}
return rep.loadTransformation( realTransName, repositoryDirectory, null, true, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
throw new KettleException( "Unable to find transformation '" + name + "' in directory :" + directory );
TransMeta transMeta = repository.loadTransformation( transformationID, null );
return transMeta;
代码示例来源:origin: pentaho/pentaho-kettle
/**
* PDI-10762 - Trans and TransMeta leak
*/
@Test
public void testLoggingObjectIsNotLeakInTrans() throws KettleException {
Repository rep = Mockito.mock( Repository.class );
RepositoryDirectoryInterface repInt = Mockito.mock( RepositoryDirectoryInterface.class );
Mockito.when(
rep.loadTransformation( Mockito.anyString(), Mockito.any( RepositoryDirectoryInterface.class ), Mockito
.any( ProgressMonitorListener.class ), Mockito.anyBoolean(), Mockito.anyString() ) ).thenReturn( meta );
Mockito.when( rep.findDirectory( Mockito.anyString() ) ).thenReturn( repInt );
Trans trans = new Trans( meta, rep, "junit", "junitDir", "fileName" );
assertEquals( "Log channel General assigned", LogChannel.GENERAL.getLogChannelId(), trans.log
.getLogChannelId() );
}
代码示例来源:origin: pentaho/pentaho-kettle
private TransMeta loadTransformation( ReportSubjectLocation location ) throws KettleException {
TransMeta transMeta;
if ( !Utils.isEmpty( location.getFilename() ) ) {
transMeta = new TransMeta( location.getFilename() );
} else {
transMeta = repository.loadTransformation( location.getName(), location.getDirectory(), null, true, null );
}
return transMeta;
}
代码示例来源:origin: pentaho/pentaho-kettle
repository.findDirectory( path.getParent().toString().replace( File.separator, "/" ) );
return convert(
repository.loadTransformation( path.getFileName().toString(), directory, null, true, null ) );
代码示例来源:origin: pentaho/pentaho-kettle
private void prepareMappingParametesActions( boolean override ) throws KettleException {
MappingMeta meta = new MappingMeta();
meta.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE );
Repository rep = Mockito.mock( Repository.class );
Mockito.when( step.getTransMeta().getRepository() ).thenReturn( rep );
Mockito.when( rep.loadTransformation( Mockito.any( ObjectId.class ), Mockito.anyString() ) ).thenReturn( transMeta );
MappingParameters mapPar = new MappingParameters();
mapPar.setInheritingAllVariables( override );
meta.setMappingParameters( mapPar );
MappingData data = new MappingData();
step.init( meta, data );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
@PrepareForTest( StepWithMappingMeta.class )
public void testFileNameAsVariable() throws Exception {
String transName = "test.ktr";
String transDirectory = "/admin";
String transNameVar = "transName";
String transDirectoryVar = "transDirectory";
VariableSpace parent = new Variables();
parent.setVariable( transNameVar, transName );
parent.setVariable( transDirectoryVar, transDirectory );
StepMeta stepMeta = new StepMeta();
TransMeta parentTransMeta = new TransMeta();
stepMeta.setParentTransMeta( parentTransMeta );
StepWithMappingMeta mappingMetaMock = mock( StepWithMappingMeta.class );
Mockito.when( mappingMetaMock.getSpecificationMethod() ).thenReturn( ObjectLocationSpecificationMethod.FILENAME );
Mockito.when( mappingMetaMock.getFileName() ).thenReturn( "${" + transDirectoryVar + "}/${" + transNameVar + "}" );
Mockito.when( mappingMetaMock.getParentStepMeta() ).thenReturn( stepMeta );
Repository rep = mock( Repository.class );
RepositoryDirectoryInterface directoryInterface = Mockito.mock( RepositoryDirectoryInterface.class );
Mockito.doReturn( directoryInterface ).when( rep ).findDirectory( anyString() );
Mockito.doReturn( new TransMeta() ).when( rep )
.loadTransformation( anyString(), any(), any(), anyBoolean(), any() );
TransMeta transMeta = StepWithMappingMeta.loadMappingMeta( mappingMetaMock, rep, null, parent, true );
Assert.assertNotNull( transMeta );
Mockito.verify( rep, Mockito.times( 1 ) ).findDirectory( Mockito.eq( transDirectory ) );
Mockito.verify( rep, Mockito.times( 1 ) ).loadTransformation( Mockito.eq( transName ),
Mockito.eq( directoryInterface ), Mockito.eq( null ), Mockito.eq( true ), Mockito.eq( null ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testIncludesSubTransformationsFromRepository() throws Exception {
TransMeta parentTransMeta = new TransMeta( getClass().getResource( "trans-meta-converter-parent.ktr" ).getPath() );
Repository repository = mock( Repository.class );
TransMeta transMeta = new TransMeta( );
RepositoryDirectoryInterface repositoryDirectory = new RepositoryDirectory( null, "public");
String directory = getClass().getResource( "" ).toString().replace( File.separator, "/" );
when( repository.findDirectory( "public" ) ).thenReturn( repositoryDirectory );
when( repository.loadTransformation( "trans-meta-converter-sub.ktr", repositoryDirectory, null, true, null ) ).thenReturn( transMeta );
parentTransMeta.setRepository( repository );
parentTransMeta.setRepositoryDirectory( repositoryDirectory );
parentTransMeta.setVariable( "Internal.Entry.Current.Directory", "public" );
Transformation transformation = TransMetaConverter.convert( parentTransMeta );
@SuppressWarnings( { "unchecked", "ConstantConditions" } )
HashMap<String, Transformation> config =
(HashMap<String, Transformation>) transformation.getConfig( TransMetaConverter.SUB_TRANSFORMATIONS_KEY ).get();
assertEquals( 1, config.size() );
assertNotNull( config.get( "public/trans-meta-converter-sub.ktr" ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
Mockito.when( repository.loadTransformation( Mockito.any(), Mockito.any() ) ).thenReturn(
transMeta );
代码示例来源:origin: pentaho/pentaho-kettle
return mock( TransMeta.class );
} ).when( rep ).loadTransformation( anyString(), any( RepositoryDirectoryInterface.class ),
any( ProgressMonitorListener.class ), anyBoolean(), anyString() );
代码示例来源:origin: pentaho/pentaho-kettle
transInfo = rep.loadTransformation( objectId, versionLabel );
} else {
transInfo =
rep.loadTransformation(
transname, repdir, new ProgressMonitorAdapter( monitor ), true, versionLabel );
内容来源于网络,如有侵权,请联系作者删除!