本文整理汇总了Java中org.pentaho.di.repository.StringObjectId类的典型用法代码示例。如果您正苦于以下问题:Java StringObjectId类的具体用法?Java StringObjectId怎么用?Java StringObjectId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringObjectId类属于org.pentaho.di.repository包,在下文中一共展示了StringObjectId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRepositoryDirectory
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
public RepositoryDirectoryInterface createRepositoryDirectory(RepositoryDirectoryInterface parentDirectory, String directoryPath) throws KettleException {
String folder = calcDirectoryName(parentDirectory);
String newFolder = folder;
if (folder.endsWith("/")) newFolder+=directoryPath; else newFolder+="/"+directoryPath;
FileObject parent = KettleVFS.getFileObject(newFolder);
try {
parent.createFolder();
} catch (FileSystemException e) {
throw new KettleException("Unable to create folder "+newFolder, e);
}
// Incremental change of the directory structure...
//
RepositoryDirectory newDir = new RepositoryDirectory(parentDirectory, directoryPath);
parentDirectory.addSubdirectory(newDir);
newDir.setObjectId(new StringObjectId(newDir.toString()));
return newDir;
}
示例2: saveRepositoryDirectory
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
public void saveRepositoryDirectory(RepositoryDirectoryInterface dir) throws KettleException {
try
{
String filename = calcDirectoryName(dir);
ObjectId objectId = new StringObjectId(calcRelativeElementDirectory(dir));
FileObject fileObject = KettleVFS.getFileObject(filename);
fileObject.createFolder(); // also create parents
dir.setObjectId(objectId);
log.logDetailed("New id of directory = "+dir.getObjectId());
}
catch(Exception e)
{
throw new KettleException("Unable to save directory ["+dir+"] in the repository", e);
}
}
示例3: loadJob
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
public JobMeta loadJob(String jobname, RepositoryDirectoryInterface repdir, ProgressMonitorListener monitor, String versionName) throws KettleException {
// This is a standard load of a transformation serialized in XML...
//
String filename = calcDirectoryName(repdir)+jobname+EXT_JOB;
JobMeta jobMeta = new JobMeta(filename, this);
jobMeta.setFilename(null);
jobMeta.setName(jobname);
jobMeta.setObjectId(new StringObjectId(calcObjectId(repdir, jobname, EXT_JOB)));
readDatabases(jobMeta, true);
jobMeta.clearChanged();
return jobMeta;
}
示例4: loadRepositoryDirectoryTree
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
public RepositoryDirectoryInterface loadRepositoryDirectoryTree(RepositoryDirectoryInterface dir) throws KettleException {
try {
String folderName = calcDirectoryName(dir);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FOLDER)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
RepositoryDirectory subDir = new RepositoryDirectory(dir, child.getName().getBaseName());
subDir.setObjectId(new StringObjectId(calcObjectId(subDir)));
dir.addSubdirectory(subDir);
loadRepositoryDirectoryTree(subDir);
}
}
}
return dir;
}
catch(Exception e) {
throw new KettleException("Unable to load the directory tree from this file repository", e);
}
}
示例5: renameObject
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
private ObjectId renameObject(ObjectId id, RepositoryDirectoryInterface newDirectory, String newName, String extension) throws KettleException {
try {
// In case of a root object, the ID is the same as the relative filename...
//
FileObject fileObject = KettleVFS.getFileObject(calcDirectoryName(null)+id.getId());
// Same name, different folder?
if (Const.isEmpty(newName)) {
newName = calcObjectName(id);
}
// The new filename can be anywhere so we re-calculate a new ID...
//
String newFilename = calcDirectoryName(newDirectory)+newName+extension;
FileObject newObject = KettleVFS.getFileObject(newFilename);
fileObject.moveTo(newObject);
return new StringObjectId(calcObjectId(newDirectory, newName, extension));
}
catch (Exception e) {
throw new KettleException("Unable to rename object with ID ["+id+"] to ["+newName+"]", e);
}
}
示例6: createRepositoryDirectory
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
public RepositoryDirectoryInterface createRepositoryDirectory(RepositoryDirectoryInterface parentDirectory, String directoryPath) throws KettleException {
String folder = calcDirectoryName(parentDirectory);
String newFolder = folder;
if (folder.endsWith("/")) newFolder+=directoryPath; else newFolder+="/"+directoryPath;
FileObject parent = KettleVFS.getFileObject(newFolder);
try {
parent.createFolder();
} catch (FileSystemException e) {
throw new KettleException("Unable to create folder "+newFolder, e);
}
// Incremental change of the directory structure...
//
RepositoryDirectory newDir = new RepositoryDirectory(parentDirectory, directoryPath);
parentDirectory.addSubdirectory(newDir);
newDir.setObjectId(new StringObjectId(calcObjectId(newDir)));
return newDir;
}
示例7: dataNodeToElement
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
public void dataNodeToElement( DataNode rootNode, RepositoryElementInterface element ) throws KettleException {
ClusterSchema clusterSchema = (ClusterSchema) element;
// The metadata...
clusterSchema.setBasePort( getString( rootNode, PROP_BASE_PORT ) );
clusterSchema.setSocketsBufferSize( getString( rootNode, PROP_SOCKETS_BUFFER_SIZE ) );
clusterSchema.setSocketsFlushInterval( getString( rootNode, PROP_SOCKETS_FLUSH_INTERVAL ) );
clusterSchema.setSocketsCompressed( rootNode.getProperty( PROP_SOCKETS_COMPRESSED ).getBoolean() );
clusterSchema.setDynamic( rootNode.getProperty( PROP_DYNAMIC ).getBoolean() );
DataNode attrNode = rootNode.getNode( NODE_ATTRIBUTES );
// The slaves...
long nrSlaves = attrNode.getProperty( PROP_NB_SLAVE_SERVERS ).getLong();
for ( int i = 0; i < nrSlaves; i++ ) {
if ( attrNode.hasProperty( String.valueOf( i ) ) ) {
DataNodeRef slaveNodeRef = attrNode.getProperty( String.valueOf( i ) ).getRef();
clusterSchema.getSlaveServers().add( findSlaveServer( new StringObjectId( slaveNodeRef.toString() ) ) );
}
}
}
示例8: saveStarDomain
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
public static void saveStarDomain(IMetaStore metaStore, StarDomain starDomain) throws MetaStoreException {
IMetaStoreElementType elementType = getStarDomainElementType(metaStore);
IMetaStoreElement element = null;
if (starDomain.getObjectId()!=null) {
// verify the ID!
//
element = metaStore.getElement(namespace, elementType, starDomain.getObjectId().toString());
}
if (element==null) {
// Create a new element
//
element = metaStore.newElement();
populateElementWithStarDomain(metaStore, starDomain, element, elementType);
metaStore.createElement(namespace, elementType, element);
} else {
// Update an existing element
//
populateElementWithStarDomain(metaStore, starDomain, element, elementType);
metaStore.updateElement(namespace, elementType, starDomain.getObjectId().toString(), element);
}
starDomain.setObjectId(new StringObjectId(element.getId().toString()));
}
示例9: saveRepositoryDirectory
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
@Override public void saveRepositoryDirectory( final RepositoryDirectoryInterface dir ) throws KettleException {
try {
// id of root dir is null--check for it
if ( "/".equals( dir.getParent().getName() ) ) {
throw new KettleException( BaseMessages.getString( PKG, "PurRepository.FailedDirectoryCreation.Message" ) );
}
RepositoryFile
newFolder =
pur.createFolder( dir.getParent().getObjectId() != null ? dir.getParent().getObjectId().getId() : null,
new RepositoryFile.Builder( dir.getName() ).folder( true ).build(), null );
dir.setObjectId( new StringObjectId( newFolder.getId().toString() ) );
} catch ( Exception e ) {
throw new KettleException( "Unable to save repository directory with path [" + getPath( null, dir, null ) + "]",
e );
}
}
示例10: getData
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
@Parameterized.Parameters
public static List<Object[]> getData() throws Exception {
RepositoryFile repositoryFile = new RepositoryFile.Builder( "test file" ).build();
IUnifiedRepository pur = mock( IUnifiedRepository.class );
when( pur.getFileById( FILE_ID ) ).thenReturn( repositoryFile );
TransMeta transMeta = new TransMeta();
JobMeta jobMeta = new JobMeta();
Repository repository = mock( Repository.class );
when( repository.loadTransformation( any( StringObjectId.class ), anyString() ) ).thenReturn( transMeta );
when( repository.loadJob( any( StringObjectId.class ), anyString() ) ).thenReturn( jobMeta );
StreamToTransNodeConverter transNodeConverter = new StreamToTransNodeConverter( pur );
transNodeConverter = spy( transNodeConverter );
doReturn( repository ).when( transNodeConverter ).connectToRepository();
StreamToJobNodeConverter jobNodeConverter = new StreamToJobNodeConverter( pur );
jobNodeConverter = spy( jobNodeConverter );
doReturn( repository ).when( jobNodeConverter ).connectToRepository();
Object[] trans = { transNodeConverter, TransMeta.XML_TAG, transMeta };
Object[] job = { jobNodeConverter, JobMeta.XML_TAG, jobMeta };
return asList( trans, job );
}
示例11: createJobMetaJCR
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
private JobMeta createJobMetaJCR( Repository repository ) throws ActionExecutionException {
JobMeta jobMeta = new JobMeta();
try {
IUnifiedRepository unifiedRepository = PentahoSystem.get( IUnifiedRepository.class, null );
RepositoryFile jobFile = unifiedRepository.getFile( idTopath( job ) );
jobMeta = repository.loadJob( new StringObjectId( (String) jobFile.getId() ), null );
} catch ( Throwable e ) {
throw new ActionExecutionException( org.pentaho.platform.plugin.kettle.messages.Messages.getInstance()
.getErrorString( "PdiAction.ERROR_0006_FAILED_TRANSMETA_CREATION", directory, transformation ), e ); //$NON-NLS-1$
}
if ( arguments != null ) {
jobMeta.setArguments( arguments );
}
if ( logLevel != null ) {
jobMeta.setLogLevel( LogLevel.getLogLevelForCode( logLevel ) );
}
populateInputs( jobMeta, jobMeta );
return jobMeta;
}
示例12: getElementType
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
@Override
public IMetaStoreElementType getElementType( String namespace, String elementTypeId ) throws MetaStoreException {
try {
ObjectId namespaceId = delegate.getNamespaceId( namespace );
if ( namespaceId == null ) {
return null;
}
RowMetaAndData elementTypeRow =
delegate.getElementType( new LongObjectId( new StringObjectId( elementTypeId ) ) );
return delegate.parseElementType( namespace, namespaceId, elementTypeRow );
} catch ( Exception e ) {
throw new MetaStoreException( "Unable to get element type with id '"
+ elementTypeId + "' in namespace '" + namespace + "'", e );
}
}
示例13: getElements
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
@Override
public List<IMetaStoreElement> getElements( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException {
try {
IMetaStoreElementType type = getElementTypeByName( namespace, elementType.getName() );
if ( type == null ) {
return new ArrayList<IMetaStoreElement>();
}
Collection<RowMetaAndData> elementRows =
delegate.getElements( new LongObjectId( new StringObjectId( type.getId() ) ) );
List<IMetaStoreElement> elements = new ArrayList<IMetaStoreElement>();
for ( RowMetaAndData elementRow : elementRows ) {
IMetaStoreElement element = delegate.parseElement( elementType, elementRow );
elements.add( element );
}
return elements;
} catch ( Exception e ) {
throw new MetaStoreException( "Unable to get list of elements from namespace '"
+ namespace + "' and for element type '" + elementType.getName() + "'", e );
}
}
示例14: createRepositoryDirectory
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
@Override
public RepositoryDirectoryInterface createRepositoryDirectory( RepositoryDirectoryInterface parentDirectory,
String directoryPath ) throws KettleException {
String folder = calcDirectoryName( parentDirectory );
String newFolder = folder;
if ( folder.endsWith( "/" ) ) {
newFolder += directoryPath;
} else {
newFolder += "/" + directoryPath;
}
FileObject parent = KettleVFS.getFileObject( newFolder );
try {
parent.createFolder();
} catch ( FileSystemException e ) {
throw new KettleException( "Unable to create folder " + newFolder, e );
}
// Incremental change of the directory structure...
//
RepositoryDirectory newDir = new RepositoryDirectory( parentDirectory, directoryPath );
parentDirectory.addSubdirectory( newDir );
newDir.setObjectId( new StringObjectId( calcObjectId( newDir ) ) );
return newDir;
}
示例15: saveRepositoryDirectory
import org.pentaho.di.repository.StringObjectId; //导入依赖的package包/类
@Override
public void saveRepositoryDirectory( RepositoryDirectoryInterface dir ) throws KettleException {
try {
String filename = calcDirectoryName( dir );
ObjectId objectId = new StringObjectId( calcRelativeElementDirectory( dir ) );
FileObject fileObject = KettleVFS.getFileObject( filename );
fileObject.createFolder(); // also create parents
dir.setObjectId( objectId );
log.logDetailed( "New id of directory = " + dir.getObjectId() );
} catch ( Exception e ) {
throw new KettleException( "Unable to save directory [" + dir + "] in the repository", e );
}
}