当前位置: 首页>>代码示例>>Java>>正文


Java ChangedFlagInterface类代码示例

本文整理汇总了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());
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:12,代码来源:Spoon.java

示例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);
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:38,代码来源:KettleFileRepository.java

示例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());
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:12,代码来源:Spoon.java

示例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() );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:14,代码来源:AbstractMetaTest.java

示例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" ) );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:14,代码来源:SpoonSharedObjectDelegate.java

示例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() );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:14,代码来源:Spoon.java

示例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 );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:40,代码来源:PurRepository.java

示例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();
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:54,代码来源:Spoon.java

示例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();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:60,代码来源:Spoon.java

示例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);
	}
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:62,代码来源:KettleFileRepository.java

示例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 );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:53,代码来源:KettleFileRepository.java

示例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 );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:60,代码来源:Spoon.java

示例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 );
    }
  }

}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:64,代码来源:PurRepository.java

示例14: update

import org.pentaho.di.core.changed.ChangedFlagInterface; //导入依赖的package包/类
public void update(ChangedFlagInterface o, Object arg); 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:2,代码来源:PDIObserver.java


注:本文中的org.pentaho.di.core.changed.ChangedFlagInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。