本文整理汇总了Java中org.pentaho.di.core.changed.ChangedFlagInterface类的典型用法代码示例。如果您正苦于以下问题:Java ChangedFlagInterface类的具体用法?Java ChangedFlagInterface怎么用?Java ChangedFlagInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChangedFlagInterface类属于org.pentaho.di.core.changed包,在下文中一共展示了ChangedFlagInterface类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
public void update(ChangedFlagInterface o, Object arg) {
try {
Method m = getClass().getMethod(arg.toString());
if (m != null)
m.invoke(this);
} catch (Exception e) {
// ignore... let the other notifiers try to do something
System.out.println("Unable to update: " + e.getLocalizedMessage());
}
}
示例2: save
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的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);
}
}
示例3: update
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
public void update(ChangedFlagInterface o, Object arg) {
try {
Method m = getClass().getMethod(arg.toString());
if (m != null)
m.invoke(this);
} catch (Exception e) {
// ignore... let the other notifiers try to do something
System.out.println("Unable to update: " + e.getLocalizedMessage());
}
}
示例4: testAddDeleteModifyObserver
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
@Test
public void testAddDeleteModifyObserver() throws Exception {
meta.deleteObserver( null );
PDIObserver observer = mock( PDIObserver.class );
meta.addObserver( observer );
Object event = new Object();
meta.notifyObservers( event );
// Changed flag isn't set, so this won't be called
verify( observer, never() ).update( meta, event );
meta.setChanged( true );
meta.notifyObservers( event );
verify( observer, times( 1 ) ).update( any( ChangedFlagInterface.class ), anyObject() );
}
示例5: saveSharedObjectToRepository
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
protected <T extends SharedObjectInterface & RepositoryElementInterface & ChangedFlagInterface>
void saveSharedObjectToRepository( T sharedObject, String versionComment ) throws KettleException {
Repository rep = spoon.getRepository();
if ( rep != null ) {
if ( !rep.getSecurityProvider().isReadOnly() ) {
rep.save( sharedObject, versionComment, null );
sharedObject.clearChanged();
} else {
throw new KettleException( BaseMessages.getString(
PKG, "Spoon.Dialog.Exception.ReadOnlyRepositoryUser" ) );
}
}
}
示例6: update
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
@Override
public void update( ChangedFlagInterface o, Object arg ) {
try {
Method m = getClass().getMethod( arg.toString() );
if ( m != null ) {
m.invoke( this );
}
} catch ( Exception e ) {
// ignore... let the other notifiers try to do something
System.out.println( "Unable to update: " + e.getLocalizedMessage() );
}
}
示例7: saveRepositoryElement
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
protected void saveRepositoryElement( RepositoryElementInterface element, String versionComment,
ITransformer transformer, Serializable elementsFolderId )
throws KettleException {
boolean isUpdate = ( element.getObjectId() != null );
RepositoryFile file;
if ( isUpdate ) {
file = pur.getFileById( element.getObjectId().getId() );
// update title & description
file =
new RepositoryFile.Builder( file ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).description(
RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).build();
// first rename, it is safe as only a name is changed, but not a path
renameIfNecessary( element, file );
file =
pur.updateFile( file,
new NodeRepositoryFileData( transformer.elementToDataNode( element ) ), versionComment );
} else {
file =
new RepositoryFile.Builder(
checkAndSanitize( element.getName() + element.getRepositoryElementType().getExtension() ) )
.title( RepositoryFile.DEFAULT_LOCALE, element.getName() )
.description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).versioned(
VERSION_SHARED_OBJECTS ).build();
file =
pur
.createFile( elementsFolderId, file, new NodeRepositoryFileData( transformer.elementToDataNode( element ) ),
versionComment );
}
// side effects
ObjectId objectId = new StringObjectId( file.getId().toString() );
element.setObjectId( objectId );
element.setObjectRevision( getObjectRevision( objectId, null ) );
if ( element instanceof ChangedFlagInterface ) {
( (ChangedFlagInterface) element ).clearChanged();
}
updateSharedObjectCache( element );
}
示例8: setShellText
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
public void setShellText() {
if (shell.isDisposed())
return;
String fname = null;
String name = null;
ChangedFlagInterface changed = null;
TransMeta transMeta = getActiveTransformation();
if (transMeta != null) {
changed = transMeta;
fname = transMeta.getFilename();
name = transMeta.getName();
}
JobMeta jobMeta = getActiveJob();
if (jobMeta != null) {
changed = jobMeta;
fname = jobMeta.getFilename();
name = jobMeta.getName();
}
String text = "";
if (rep != null) {
text += APPL_TITLE + " - [" + getRepositoryName() + "] ";
} else {
text += APPL_TITLE + " - ";
}
if (Const.isEmpty(name)) {
if (!Const.isEmpty(fname)) {
text += fname;
} else {
String tab = getActiveTabText();
if (!Const.isEmpty(tab)) {
text += tab;
} else {
text += Messages.getString("Spoon.Various.NoName");// "[no name]"
}
}
} else {
text += name;
}
if (changed != null && changed.hasChanged()) {
text += " " + Messages.getString("Spoon.Various.Changed");
}
shell.setText(text);
enableMenus();
markTabsChanged();
}
示例9: setShellText
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
public void setShellText() {
if (shell.isDisposed())
return;
String fname = null;
String name = null;
String version = null;
ChangedFlagInterface changed = null;
TransMeta transMeta = getActiveTransformation();
if (transMeta != null) {
changed = transMeta;
fname = transMeta.getFilename();
name = transMeta.getName();
version = transMeta.getObjectRevision() == null ? null : transMeta.getObjectRevision().getName();
}
JobMeta jobMeta = getActiveJob();
if (jobMeta != null) {
changed = jobMeta;
fname = jobMeta.getFilename();
name = jobMeta.getName();
version = jobMeta.getObjectRevision() == null ? null : jobMeta.getObjectRevision().getName();
}
String text = "";
if (rep != null) {
text += APPL_TITLE + " - [" + getRepositoryName() + "] ";
} else {
text += APPL_TITLE + " - ";
}
if (Const.isEmpty(name)) {
if (!Const.isEmpty(fname)) {
text += fname;
} else {
String tab = getActiveTabText();
if (!Const.isEmpty(tab)) {
text += tab;
} else {
text += BaseMessages.getString(PKG, "Spoon.Various.NoName");// "[no name]"
}
}
} else {
text += name;
}
if (!Const.isEmpty(version)) {
text += " v" + version;
}
if (changed != null && changed.hasChanged()) {
text += " " + BaseMessages.getString(PKG, "Spoon.Various.Changed");
}
shell.setText(text);
markTabsChanged();
}
示例10: save
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的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("Save repository element : "+repositoryElement.toString()+" : "+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());
}
// See if this is a transformation & if the transformation has a defined data service.
// If so, we want to store a separate .das (DAta Service) file for performance reasons.
//
if (repositoryElement instanceof TransMeta) {
FileObject dasFile = KettleVFS.getFileObject(calcFilename(repositoryElement.getRepositoryDirectory(), repositoryElement.getName(), EXT_DATA_SERVICE));
// Remove possible old file
//
if (dasFile.exists()) {
dasFile.delete();
}
TransMeta transMeta = (TransMeta)repositoryElement;
if (transMeta.getDataService().isDefined()) {
// Write new data service file
//
xml = transMeta.getDataService().getXML();
os = KettleVFS.getOutputStream(dasFile, false);
os.write(XMLHandler.getXMLHeader().getBytes(Const.XML_ENCODING));
os.write(xml.getBytes(Const.XML_ENCODING));
os.close();
}
}
repositoryElement.setObjectId(objectId);
} catch(Exception e) {
throw new KettleException("Unable to save repository element ["+repositoryElement+"] to XML file : "+calcFilename(repositoryElement), e);
}
}
示例11: save
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的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 ( !Utils.isEmpty( versionComment ) ) {
insertLogEntry( "Save repository element : " + repositoryElement.toString() + " : " + 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 );
// Finally, see if there are external objects that need to be stored or updated in the MetaStore
//
if ( repositoryElement instanceof TransMeta ) {
( (TransMeta) repositoryElement ).saveMetaStoreObjects( this, metaStore );
}
if ( repositoryElement instanceof JobMeta ) {
( (JobMeta) repositoryElement ).saveMetaStoreObjects( this, metaStore );
}
} catch ( Exception e ) {
throw new KettleException( "Unable to save repository element ["
+ repositoryElement + "] to XML file : " + calcFilename( repositoryElement ), e );
}
}
示例12: setShellText
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
public void setShellText() {
if ( shell.isDisposed() ) {
return;
}
String filename = null;
String name = null;
String version = null;
ChangedFlagInterface changed = null;
boolean versioningEnabled = true;
AbstractMeta meta = getActiveJob() != null ? getActiveJob() : getActiveTransformation();
if ( meta != null ) {
changed = meta;
filename = meta.getFilename();
name = meta.getName();
version = meta.getObjectRevision() == null ? null : meta.getObjectRevision().getName();
try {
versioningEnabled = isVersionEnabled( rep, meta );
} catch ( KettleRepositoryLostException krle ) {
handleRepositoryLost( krle );
}
}
String text = "";
if ( rep != null ) {
text += APP_TITLE + " - [" + getRepositoryName() + "] ";
} else {
text += APP_TITLE + " - ";
}
if ( Utils.isEmpty( name ) ) {
if ( !Utils.isEmpty( filename ) ) {
text += filename;
} else {
String tab = getActiveTabText();
if ( !Utils.isEmpty( tab ) ) {
text += tab;
} else {
text += BaseMessages.getString( PKG, "Spoon.Various.NoName" ); // "[no name]"
}
}
} else {
text += name;
}
if ( versioningEnabled && !Utils.isEmpty( version ) ) {
text += " v" + version;
}
if ( changed != null && changed.hasChanged() ) {
text += " " + BaseMessages.getString( PKG, "Spoon.Various.Changed" );
}
shell.setText( text );
markTabsChanged( false );
}
示例13: saveDatabaseMeta
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
protected void saveDatabaseMeta( final RepositoryElementInterface element, final String versionComment,
Calendar versionDate ) throws KettleException {
try {
// Even if the object id is null, we still have to check if the element is not present in the PUR
// For example, if we import data from an XML file and there is a element with the same name in it.
//
if ( element.getObjectId() == null ) {
element.setObjectId( getDatabaseID( element.getName() ) );
}
boolean isUpdate = element.getObjectId() != null;
RepositoryFile file = null;
if ( isUpdate ) {
file = pur.getFileById( element.getObjectId().getId() );
// update title
final String title = ( (DatabaseMeta) element ).getDisplayName();
Date modifiedDate = null;
if ( versionDate != null && versionDate.getTime() != null ) {
modifiedDate = versionDate.getTime();
} else {
modifiedDate = new Date();
}
file = new RepositoryFile.Builder( file ).title( RepositoryFile.DEFAULT_LOCALE, title )
.lastModificationDate( modifiedDate ).build();
renameIfNecessary( element, file );
file =
pur.updateFile( file, new NodeRepositoryFileData( databaseMetaTransformer.elementToDataNode( element ) ),
versionComment );
} else {
Date createdDate = null;
if ( versionDate != null && versionDate.getTime() != null ) {
createdDate = versionDate.getTime();
} else {
createdDate = new Date();
}
file =
new RepositoryFile.Builder(
checkAndSanitize( RepositoryFilenameUtils.escape( element.getName(), pur.getReservedChars() )
+ RepositoryObjectType.DATABASE.getExtension() ) ).title( RepositoryFile.DEFAULT_LOCALE,
element.getName() ).createdDate( createdDate ).versioned( VERSION_SHARED_OBJECTS ).build();
file =
pur.createFile( getDatabaseMetaParentFolderId(), file,
new NodeRepositoryFileData( databaseMetaTransformer.elementToDataNode( element ) ), versionComment );
}
// side effects
ObjectId objectId = new StringObjectId( file.getId().toString() );
element.setObjectId( objectId );
element.setObjectRevision( getObjectRevision( objectId, null ) );
if ( element instanceof ChangedFlagInterface ) {
( (ChangedFlagInterface) element ).clearChanged();
}
updateSharedObjectCache( element );
} catch ( Exception e ) {
// determine if there is an "access denied" issue and throw a nicer error message.
if ( e.getMessage().indexOf( "access denied" ) >= 0 ) {
throw new KettleException(
BaseMessages.getString( PKG, "PurRepository.ERROR_0004_DATABASE_UPDATE_ACCESS_DENIED", element.getName() ),
e );
}
}
}
示例14: update
import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
public void update(ChangedFlagInterface o, Object arg);