• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XMLInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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


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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BoundTransportAddress类代码示例发布时间:2022-05-22
下一篇:
Java InputOperator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap