本文整理汇总了Java中org.pentaho.di.repository.RepositoryElementInterface类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryElementInterface类的具体用法?Java RepositoryElementInterface怎么用?Java RepositoryElementInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryElementInterface类属于org.pentaho.di.repository包,在下文中一共展示了RepositoryElementInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testTwoRevisions_DateAndCommentAreSaved
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
private void testTwoRevisions_DateAndCommentAreSaved( RepositoryElementInterface transOrJob ) throws Exception {
final String elementName = "twoRevisions_" + transOrJob.getRepositoryElementType();
final String comment1 = "first";
final Calendar date1 = Calendar.getInstance();
date1.setTimeInMillis( 0 );
final String comment2 = "second";
final Calendar date2 = Calendar.getInstance();
date2.setTimeInMillis( 100 );
transOrJob.setName( elementName );
transOrJob.setRepositoryDirectory( purRepository.getDefaultSaveDirectory( transOrJob ) );
purRepository.save( transOrJob, comment1, date1, null, false );
assertCommentAndDate( transOrJob.getObjectRevision(), date1, comment1 );
purRepository.save( transOrJob, comment2, date2, null, false );
assertCommentAndDate( transOrJob.getObjectRevision(), date2, comment2 );
List<VersionSummary> versions = assertExistsAndGetRevisions( transOrJob );
assertEquals( 2, versions.size() );
assertCommentAndDate( versions.get( 0 ), date1, comment1 );
assertCommentAndDate( versions.get( 1 ), date2, comment2 );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:PurRepository_Revisions_IT.java
示例2: loadAllShared
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
@Test
public void loadAllShared() throws Exception {
ClusterSchema cluster = cluster();
DatabaseMeta database = database();
SlaveServer slaveServer = slaveServer();
PartitionSchema partition = partition();
purRepository.save( cluster, null, null );
purRepository.save( database, null, null );
purRepository.save( slaveServer, null, null );
purRepository.save( partition, null, null );
Map<RepositoryObjectType, List<? extends SharedObjectInterface>> map = map();
purRepository.readSharedObjects( map, RepositoryObjectType.CLUSTER_SCHEMA, RepositoryObjectType.DATABASE,
RepositoryObjectType.SLAVE_SERVER, RepositoryObjectType.PARTITION_SCHEMA );
RepositoryElementInterface[] saved = new RepositoryElementInterface[] { cluster, database, slaveServer, partition };
assertEquals( saved.length, map.size() );
for ( RepositoryElementInterface sharedObject : saved ) {
List<? extends SharedObjectInterface> list = map.get( sharedObject.getRepositoryElementType() );
assertEquals( 1, list.size() );
assertEquals( sharedObject, list.get( 0 ) );
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:PurRepository_SharedObjects_IT.java
示例3: doesNotChangeFileWhenFailsToRename_partitions
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
@Test
public void doesNotChangeFileWhenFailsToRename_partitions() throws Exception {
final PartitionSchema schema1 = new PartitionSchema();
final PartitionSchema schema2 = new PartitionSchema();
try {
testDoesNotChangeFileWhenFailsToRename( schema1, schema2, new Callable<RepositoryElementInterface>() {
@Override
public RepositoryElementInterface call() throws Exception {
return repository.loadPartitionSchema( schema2.getObjectId(), null );
}
} );
} finally {
repository.deletePartitionSchema( schema1.getObjectId() );
repository.deletePartitionSchema( schema2.getObjectId() );
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:PurRepositoryIT.java
示例4: testOnlyRevision_DateAndCommentAreSaved
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
private void testOnlyRevision_DateAndCommentAreSaved( RepositoryElementInterface transOrJob ) throws Exception {
final String elementName = "onlyRevision_" + transOrJob.getRepositoryElementType();
final String comment = "onlyRevision";
final Calendar date = Calendar.getInstance();
date.setTimeInMillis( 0 );
transOrJob.setName( elementName );
transOrJob.setRepositoryDirectory( purRepository.getDefaultSaveDirectory( transOrJob ) );
purRepository.save( transOrJob, comment, date, null, false );
assertCommentAndDate( transOrJob.getObjectRevision(), date, comment );
List<VersionSummary> versions = assertExistsAndGetRevisions( transOrJob );
assertEquals( 1, versions.size() );
assertCommentAndDate( versions.get( 0 ), date, comment );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:PurRepository_Revisions_IT.java
示例5: testOnlyRevision_DateAndCommentAreNull
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
private void testOnlyRevision_DateAndCommentAreNull( RepositoryElementInterface transOrJob ) throws Exception {
final String elementName = "revisionWithOutComment_" + transOrJob.getRepositoryElementType();
transOrJob.setName( elementName );
transOrJob.setRepositoryDirectory( purRepository.getDefaultSaveDirectory( transOrJob ) );
final long before = System.currentTimeMillis();
purRepository.save( transOrJob, null, null, null, false );
final long after = System.currentTimeMillis();
assertNull( transOrJob.getObjectRevision().getComment() );
final long revisionDate = transOrJob.getObjectRevision().getCreationDate().getTime();
assertTrue( "Revision date should be inside 'before' and 'after' measurements", before <= revisionDate
&& revisionDate <= after );
List<VersionSummary> versions = assertExistsAndGetRevisions( transOrJob );
assertEquals( 1, versions.size() );
assertNull( versions.get( 0 ).getMessage() );
final long versionSummaryDate = versions.get( 0 ).getDate().getTime();
assertTrue( "Revision date should be inside 'before' and 'after' measurements", before <= versionSummaryDate
&& versionSummaryDate <= after );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:PurRepository_Revisions_IT.java
示例6: dataNodeToElement
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
public void dataNodeToElement( final DataNode rootNode, final RepositoryElementInterface element )
throws KettleException {
DatabaseMeta databaseMeta = (DatabaseMeta) element;
databaseMeta.setDatabaseType( getString( rootNode, PROP_TYPE ) );
databaseMeta.setAccessType( DatabaseMeta.getAccessType( getString( rootNode, PROP_CONTYPE ) ) );
databaseMeta.setHostname( getString( rootNode, PROP_HOST_NAME ) );
databaseMeta.setDBName( getString( rootNode, PROP_DATABASE_NAME ) );
databaseMeta.setDBPort( getString( rootNode, PROP_PORT ) );
databaseMeta.setUsername( getString( rootNode, PROP_USERNAME ) );
databaseMeta.setPassword( Encr.decryptPasswordOptionallyEncrypted( getString( rootNode, PROP_PASSWORD ) ) );
databaseMeta.setServername( getString( rootNode, PROP_SERVERNAME ) );
databaseMeta.setDataTablespace( getString( rootNode, PROP_DATA_TBS ) );
databaseMeta.setIndexTablespace( getString( rootNode, PROP_INDEX_TBS ) );
// Also, load all the properties we can find...
DataNode attrNode = rootNode.getNode( NODE_ATTRIBUTES );
for ( DataProperty property : attrNode.getProperties() ) {
String code = property.getName();
String attribute = property.getString();
// We need to unescape the code as it was escaped to handle characters that JCR does not handle
String unescapeCode = RepositoryFilenameUtils.unescape( code );
databaseMeta.getAttributes().put( unescapeCode, Const.NVL( attribute, "" ) ); //$NON-NLS-1$
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:DatabaseDelegate.java
示例7: dataNodeToElement
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的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() ) ) );
}
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:19,代码来源:ClusterDelegate.java
示例8: elementToDataNode
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
public DataNode elementToDataNode( RepositoryElementInterface element ) throws KettleException {
ClusterSchema clusterSchema = (ClusterSchema) element;
DataNode rootNode = new DataNode( NODE_ROOT );
// save the properties...
rootNode.setProperty( PROP_BASE_PORT, clusterSchema.getBasePort() );
rootNode.setProperty( PROP_SOCKETS_BUFFER_SIZE, clusterSchema.getSocketsBufferSize() );
rootNode.setProperty( PROP_SOCKETS_FLUSH_INTERVAL, clusterSchema.getSocketsFlushInterval() );
rootNode.setProperty( PROP_SOCKETS_COMPRESSED, clusterSchema.isSocketsCompressed() );
rootNode.setProperty( PROP_DYNAMIC, clusterSchema.isDynamic() );
DataNode attrNode = rootNode.addNode( NODE_ATTRIBUTES );
// Also save the used slave server references.
attrNode.setProperty( PROP_NB_SLAVE_SERVERS, clusterSchema.getSlaveServers().size() );
for ( int i = 0; i < clusterSchema.getSlaveServers().size(); i++ ) {
SlaveServer slaveServer = clusterSchema.getSlaveServers().get( i );
DataNodeRef slaveNodeRef = new DataNodeRef( slaveServer.getObjectId().getId() );
// Save the slave server by reference, this way it becomes impossible to delete the slave by accident when still
// in use.
attrNode.setProperty( String.valueOf( i ), slaveNodeRef );
}
return rootNode;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:ClusterDelegate.java
示例9: loadSharedObjects
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
public SharedObjects loadSharedObjects( final RepositoryElementInterface element,
final Map<RepositoryObjectType, List<? extends SharedObjectInterface>> sharedObjectsByType )
throws KettleException {
TransMeta transMeta = (TransMeta) element;
transMeta.setSharedObjects( transMeta.readSharedObjects() );
// Repository objects take priority so let's overwrite them...
//
readDatabases( transMeta, true, (List<DatabaseMeta>) sharedObjectsByType.get( RepositoryObjectType.DATABASE ) );
readPartitionSchemas( transMeta, true, (List<PartitionSchema>) sharedObjectsByType
.get( RepositoryObjectType.PARTITION_SCHEMA ) );
readSlaves( transMeta, true, (List<SlaveServer>) sharedObjectsByType.get( RepositoryObjectType.SLAVE_SERVER ) );
readClusters( transMeta, true, (List<ClusterSchema>) sharedObjectsByType.get( RepositoryObjectType.CLUSTER_SCHEMA ) );
return transMeta.getSharedObjects();
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:18,代码来源:TransDelegate.java
示例10: doesNotChangeFileWhenFailsToRename_slaves
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
@Test
public void doesNotChangeFileWhenFailsToRename_slaves() throws Exception {
final SlaveServer server1 = new SlaveServer();
final SlaveServer server2 = new SlaveServer();
try {
testDoesNotChangeFileWhenFailsToRename( server1, server2, new Callable<RepositoryElementInterface>() {
@Override
public RepositoryElementInterface call() throws Exception {
return repository.loadSlaveServer( server2.getObjectId(), null );
}
} );
} finally {
repository.deleteSlave( server1.getObjectId() );
repository.deleteSlave( server2.getObjectId() );
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:PurRepositoryIT.java
示例11: elementToDataNode
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
public DataNode elementToDataNode( RepositoryElementInterface element ) throws KettleException {
PartitionSchema partitionSchema = (PartitionSchema) element;
DataNode rootNode = new DataNode( NODE_ROOT );
// Check for naming collision
ObjectId partitionId = repo.getPartitionSchemaID( partitionSchema.getName() );
if ( partitionId != null && !partitionSchema.getObjectId().equals( partitionId ) ) {
// We have a naming collision, abort the save
throw new KettleException( "Failed to save object to repository. Object [" + partitionSchema.getName()
+ "] already exists." );
}
rootNode.setProperty( PROP_DYNAMIC_DEFINITION, partitionSchema.isDynamicallyDefined() );
rootNode.setProperty( PROP_PARTITIONS_PER_SLAVE, partitionSchema.getNumberOfPartitionsPerSlave() );
// Save the cluster-partition relationships
DataNode attrNode = rootNode.addNode( NODE_ATTRIBUTES );
attrNode.setProperty( PROP_NB_PARTITION_SCHEMA, partitionSchema.getPartitionIDs().size() );
for ( int i = 0; i < partitionSchema.getPartitionIDs().size(); i++ ) {
attrNode.setProperty( String.valueOf( i ), partitionSchema.getPartitionIDs().get( i ) );
}
return rootNode;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:PartitionDelegate.java
示例12: PurRepositoryRevisionBrowserDialog
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
public PurRepositoryRevisionBrowserDialog( Shell parent, int style, Repository repository,
RepositoryElementInterface element ) {
this.display = parent.getDisplay();
this.props = PropsUI.getInstance();
this.repository = repository;
this.element = element;
try {
if ( repository.hasService( IRevisionService.class ) ) {
revisionService = (IRevisionService) repository.getService( IRevisionService.class );
} else {
throw new IllegalStateException();
}
} catch ( KettleException e ) {
throw new IllegalStateException( e );
}
String name = element.getRepositoryElementType().toString() + " " + element.getRepositoryDirectory().getPath();
if ( !name.endsWith( "/" ) )
name += "/";
name += element.getName();
this.elementDescription = name;
shell = new Shell( display, style | SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN );
shell.setText( BaseMessages.getString( PKG, "PurRepositoryRevisionBrowserDialog.Dialog.Main.Title" ) ); //$NON-NLS-1$
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:27,代码来源:PurRepositoryRevisionBrowserDialog.java
示例13: calcObjectId
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
public String calcObjectId(RepositoryElementInterface element) {
RepositoryDirectoryInterface directory = element.getRepositoryDirectory();
String name = element.getName();
String extension = element.getRepositoryElementType().getExtension();
return calcObjectId(directory, name, extension);
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:8,代码来源:KettleFileRepository.java
示例14: save
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
public void save(RepositoryElementInterface repositoryElement, String versionComment, ProgressMonitorListener monitor, ObjectId parentId, boolean used) throws KettleException {
try {
if (!(repositoryElement instanceof XMLInterface) && !(repositoryElement instanceof SharedObjectInterface)) {
throw new KettleException("Class ["+repositoryElement.getClass().getName()+"] needs to implement the XML Interface in order to save it to disk");
}
if (!Const.isEmpty(versionComment)) {
insertLogEntry(versionComment);
}
ObjectId objectId = new StringObjectId(calcObjectId(repositoryElement));
FileObject fileObject = getFileObject(repositoryElement);
String xml = ((XMLInterface)repositoryElement).getXML();
OutputStream os = KettleVFS.getOutputStream(fileObject, false);
os.write(xml.getBytes(Const.XML_ENCODING));
os.close();
if (repositoryElement instanceof ChangedFlagInterface) {
((ChangedFlagInterface)repositoryElement).clearChanged();
}
// See if the element was already saved in the repository.
// If the object ID is different, then we created an extra copy.
// If so, we need to now remove the old file to prevent us from having multiple copies.
//
if (repositoryElement.getObjectId()!=null && !repositoryElement.getObjectId().equals(objectId)) {
delObject(repositoryElement.getObjectId());
}
repositoryElement.setObjectId(objectId);
} catch(Exception e) {
throw new KettleException("Unable to save repository element ["+repositoryElement+"] to XML file : "+calcFilename(repositoryElement), e);
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:38,代码来源:KettleFileRepository.java
示例15: getVersionBrowserDialog
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
public static final RepositoryRevisionBrowserDialogInterface getVersionBrowserDialog(Shell shell, Repository repository, final RepositoryElementInterface element) throws Exception {
String className = repository.getRepositoryMeta().getRevisionBrowserDialogClassName();
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface plugin = registry.getPlugin(RepositoryPluginType.class, repository.getRepositoryMeta().getId());
Class<? extends RepositoryRevisionBrowserDialogInterface> dialogClass = registry.getClass(plugin, className);
Constructor<?> constructor = dialogClass.getConstructor(Shell.class, Integer.TYPE, Repository.class, RepositoryElementInterface.class);
return (RepositoryRevisionBrowserDialogInterface) constructor.newInstance(new Object[] { shell, Integer.valueOf(SWT.NONE), repository, element, });
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:10,代码来源:RepositoryExplorerDialog.java
示例16: testElementIsRemovedFromCacheOnDelete
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
private void testElementIsRemovedFromCacheOnDelete( RepositoryElementInterface element, Remover remover )
throws Exception {
purRepository.save( element, null, null );
assertNotNull( element.getObjectId() );
List<? extends SharedObjectInterface> before =
purRepository.loadAndCacheSharedObjects().get( element.getRepositoryElementType() );
assertEquals( 1, before.size() );
remover.deleteFromRepository( element );
List<? extends SharedObjectInterface> after =
purRepository.loadAndCacheSharedObjects().get( element.getRepositoryElementType() );
assertTrue( after.isEmpty() );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:15,代码来源:PurRepository_SharedObjects_IT.java
示例17: saveSharedObjects
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
public void saveSharedObjects( final Repository repo, final RepositoryElementInterface element )
throws KettleException {
JobMeta jobMeta = (JobMeta) element;
// First store the databases and other depending objects in the transformation.
List<String> databaseNames = Arrays.asList( repo.getDatabaseNames( true ) );
int dbIndex = 0;
int indexToReplace = 0;
boolean updateMeta = Boolean.FALSE;
for ( DatabaseMeta databaseMeta : jobMeta.getDatabases() ) {
if ( !databaseNames.contains( databaseMeta.getName() ) ) {
if ( databaseMeta.getObjectId() == null || !StringUtils.isEmpty( databaseMeta.getHostname() ) ) {
repo.save( databaseMeta, null, null );
}
} else if ( databaseMeta.getObjectId() == null ) {
indexToReplace = dbIndex;
updateMeta = Boolean.TRUE;
}
dbIndex++;
}
// if db already exists in repo, get that object id and put it
// in the transMeta db collection
if ( updateMeta ) {
DatabaseMeta dbMetaToReplace = jobMeta.getDatabase( indexToReplace );
dbMetaToReplace.setObjectId( repo.getDatabaseID( dbMetaToReplace.getName() ) );
jobMeta.removeDatabase( indexToReplace );
jobMeta.addDatabase( dbMetaToReplace );
}
// Store the slave servers...
//
for ( SlaveServer slaveServer : jobMeta.getSlaveServers() ) {
if ( slaveServer.getObjectId() == null ) {
repo.save( slaveServer, null, null );
}
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:41,代码来源:StreamToJobNodeConverter.java
示例18: assertExistsAndGetRevisions
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
private List<VersionSummary> assertExistsAndGetRevisions( RepositoryElementInterface transOrJob ) {
ObjectId id = transOrJob.getObjectId();
assertNotNull( id );
RepositoryFile file = unifiedRepository.getFileById( id.toString() );
assertNotNull( file );
return unifiedRepository.getVersionSummaries( id.toString() );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:9,代码来源:PurRepository_Revisions_IT.java
示例19: partitionIsRemovedFromCacheOnDelete
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
@Test
public void partitionIsRemovedFromCacheOnDelete() throws Exception {
testElementIsRemovedFromCacheOnDelete( partition(), new Remover() {
@Override
public void deleteFromRepository( RepositoryElementInterface element ) throws KettleException {
purRepository.deletePartitionSchema( element.getObjectId() );
}
} );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:10,代码来源:PurRepository_SharedObjects_IT.java
示例20: testLoadSharedObjects
import org.pentaho.di.repository.RepositoryElementInterface; //导入依赖的package包/类
private void testLoadSharedObjects( RepositoryElementInterface sharedObject ) throws Exception {
purRepository.save( sharedObject, null, null );
Map<RepositoryObjectType, List<? extends SharedObjectInterface>> map = map();
purRepository.readSharedObjects( map, sharedObject.getRepositoryElementType() );
List<? extends SharedObjectInterface> objects = map.get( sharedObject.getRepositoryElementType() );
assertNotNull( objects );
assertEquals( 1, objects.size() );
SharedObjectInterface object = objects.get( 0 );
assertEquals( sharedObject, object );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:14,代码来源:PurRepository_SharedObjects_IT.java
注:本文中的org.pentaho.di.repository.RepositoryElementInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论