本文整理汇总了Java中org.pentaho.di.core.xml.XMLInterface类的典型用法代码示例。如果您正苦于以下问题:Java XMLInterface类的具体用法?Java XMLInterface怎么用?Java XMLInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLInterface类属于org.pentaho.di.core.xml包,在下文中一共展示了XMLInterface类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.pentaho.di.core.xml.XMLInterface; //导入依赖的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);
}
}
示例2: save
import org.pentaho.di.core.xml.XMLInterface; //导入依赖的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);
}
}
示例3: save
import org.pentaho.di.core.xml.XMLInterface; //导入依赖的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 );
}
}