當前位置: 首頁>>代碼示例>>Java>>正文


Java Repository類代碼示例

本文整理匯總了Java中org.pentaho.di.repository.Repository的典型用法代碼示例。如果您正苦於以下問題:Java Repository類的具體用法?Java Repository怎麽用?Java Repository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Repository類屬於org.pentaho.di.repository包,在下文中一共展示了Repository類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loading

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
@SuppressWarnings("all")
@Override
public Object loading(T entity) throws KettleException {
	if (null == entity) {
		entity = (T) new KettleRepos();
	}
	entity.setStatus(Constant.STATUS_ENABLED);
	List<T> isList = (List<T>) mapper.iKettleReposMapper
			.selectByWhere(entity);
	if (null != isList && isList.size() > 0) {
		// 運行環境初始化(設置主目錄、注冊必須的插件等)
		KettleEnvironment.init();
		list = new ArrayList<Repository>();
		for (T repos : isList) {
			initRepository(repos, false);
		}
	}
	return list;
}
 
開發者ID:jiangzongyao,項目名稱:kettle_support_kettle8.0,代碼行數:20,代碼來源:KettleReposServiceImpl.java

示例2: readRep

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
@Override public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step,
    List<DatabaseMeta> databases) throws KettleException {
    super.readRep(rep, metaStore, id_step, databases);

    String truncateStr = rep.getStepAttributeString(id_step, "truncate");
    if (truncateStr.equals("true")) {
        setTruncate(true);
    } else {
        setTruncate(false);
    }

    int nrStreamFields = rep.countNrStepAttributes(id_step, "stream_field_name");
    streamFields = new ArrayList<String>(nrStreamFields);
    for (int i = 0; i < nrStreamFields; i++) {
        streamFields.add(rep.getStepAttributeString(id_step, i, "stream_field_name"));
    }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:18,代碼來源:OdpsOutputMeta.java

示例3: readRep

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
@Override public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step,
    List<DatabaseMeta> databases) throws KettleException {
    setEndpoint(rep.getStepAttributeString(id_step, "endpoint"));
    setTunnelEndpoint(rep.getStepAttributeString(id_step, "tunnelEndpoint"));
    setAccessId(rep.getStepAttributeString(id_step, "accessId"));
    setAccessKey(rep.getStepAttributeString(id_step, "accessKey"));
    setProjectName(rep.getStepAttributeString(id_step, "projectName"));
    setTableName(rep.getStepAttributeString(id_step, "tableName"));
    setPartition(rep.getStepAttributeString(id_step, "partition"));

    int nrFields = rep.countNrStepAttributes(id_step, "field_name");
    odpsFields = new ArrayList<OdpsField>(nrFields);
    for (int i = 0; i < nrFields; i++) {
        OdpsField field = new OdpsField();
        field.setName(rep.getStepAttributeString(id_step, i, "field_name"));
        field.setType(rep.getStepAttributeString(id_step, i, "field_type"));
        field.setComment(rep.getStepAttributeString(id_step, i, "field_comment"));
        odpsFields.add(field);
    }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:21,代碼來源:OdpsMeta.java

示例4: saveRep

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
@Override public void saveRep(Repository rep, IMetaStore metaStore, ObjectId id_transformation,
    ObjectId id_step) throws KettleException {
    rep.saveStepAttribute(id_transformation, id_step, "endpoint", getEndpoint());
    rep.saveStepAttribute(id_transformation, id_step, "tunnelEndpoint", getTunnelEndpoint());
    rep.saveStepAttribute(id_transformation, id_step, "accessId", getAccessId());
    rep.saveStepAttribute(id_transformation, id_step, "accessKey", getAccessKey());
    rep.saveStepAttribute(id_transformation, id_step, "projectName", getProjectName());
    rep.saveStepAttribute(id_transformation, id_step, "tableName", getTableName());
    rep.saveStepAttribute(id_transformation, id_step, "partition", getPartition());

    for (int i = 0; i < odpsFields.size(); i++) {
        OdpsField field = odpsFields.get(i);
        rep.saveStepAttribute(id_transformation, id_step, i, "field_name",
            field.getName().toLowerCase());
        rep.saveStepAttribute(id_transformation, id_step, i, "field_type", field.getType());
        rep.saveStepAttribute(id_transformation, id_step, i, "field_comment",
            field.getComment());
    }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:20,代碼來源:OdpsMeta.java

示例5: createDatabaseMeta

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
/**
* 創建數據連接元數據對象 <br/>
* @author jingma
 * @param name 數據庫連接名稱
 * @param url 數據庫連接
 * @param user 數據庫用戶名
 * @param pass 數據庫密碼
 * @param replace 是否替換已經存在的
 * @param repository 資源庫
* @return
 * @throws Exception 
*/
public static DatabaseMeta createDatabaseMeta(String name, String url,String user,String pass,
        boolean replace,Repository repository) throws Exception {
    JSONObject urlObj = JdbcUtil.parseJdbcUrl(url);
    if(UtilConst.DS_TYPE_ORACLE.equals(urlObj.getString(JdbcUtil.DB_TYPE))){
        return createDatabaseMeta(name, dbTypeToKettle(urlObj.getString(JdbcUtil.DB_TYPE)), 
                DatabaseMeta.dbAccessTypeCode[DatabaseMeta.TYPE_ACCESS_NATIVE], 
                urlObj.getString(JdbcUtil.HOSTNAME), urlObj.getString(JdbcUtil.DATABASE_NAME), 
                urlObj.getString(JdbcUtil.PORT), user, pass,null,replace,repository);
    }else if(UtilConst.DS_TYPE_MYSQL.equals(urlObj.getString(JdbcUtil.DB_TYPE))){
        return createDatabaseMeta(name, dbTypeToKettle(urlObj.getString(JdbcUtil.DB_TYPE)), 
                DatabaseMeta.dbAccessTypeCode[DatabaseMeta.TYPE_ACCESS_NATIVE], 
                urlObj.getString(JdbcUtil.HOSTNAME), urlObj.getString(JdbcUtil.DATABASE_NAME), 
                urlObj.getString(JdbcUtil.PORT), user, pass,urlObj.getJSONObject(JdbcUtil.PARAM_OBJ),
                replace,repository);
    }else{
        return null;
    }
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:31,代碼來源:KettleUtils.java

示例6: jobCopy

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
/**
* 將指定job複製到KettleUtils中的資源庫 <br/>
* @author jingma
* @param jobName job名稱
* @param jobPath job路徑
* @param fromRepository 來源資源庫
   * @param toRepository 目標資源庫
* @throws KettleException
*/
public static void jobCopy(String jobName,String jobPath,Repository fromRepository,
        Repository toRepository) throws KettleException {
	JobMeta jobMeta = KettleUtils.loadJob(jobName,jobPath,fromRepository);
	for(JobEntryCopy jec:jobMeta.getJobCopies()){
		if(jec.isTransformation()){
			JobEntryTrans jet = (JobEntryTrans)jec.getEntry();
			transCopy(jet.getObjectName(), jet.getDirectory(),fromRepository,toRepository);
		}else if(jec.isJob()){
			JobEntryJob jej = (JobEntryJob)jec.getEntry();
			jobCopy(jej.getObjectName(),jej.getDirectory(),fromRepository,toRepository);
		}
	}
	jobMeta.setRepository(toRepository);
	jobMeta.setMetaStore(toRepository.getMetaStore());
	if(!isDirectoryExist(toRepository,jobPath)){
		//所在目錄不存在則創建
	    toRepository.createRepositoryDirectory(toRepository.findDirectory("/"), jobPath);
	}
	KettleUtils.saveJob(toRepository,jobMeta);
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:30,代碼來源:KettleUtils.java

示例7: transCopy

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
/**
* 將指定轉換複製到KettleUtils中的資源庫 <br/>
* @author jingma
* @param jobName 轉換名稱
* @param jobPath 轉換路徑
   * @param fromRepository 來源資源庫
   * @param toRepository 目標資源庫
* @throws KettleException
*/
public static void transCopy(String transName,String transPath,Repository fromRepository,
           Repository toRepository) throws KettleException {
	TransMeta tm = KettleUtils.loadTrans(transName, transPath, fromRepository);
	for(StepMeta sm:tm.getSteps()){
		if(sm.isJobExecutor()){
			JobExecutorMeta jem = (JobExecutorMeta)sm.getStepMetaInterface();
			jobCopy(jem.getJobName(),jem.getDirectoryPath(),fromRepository,toRepository);
		}
		else if(sm.getStepMetaInterface() instanceof TransExecutorMeta){
			TransExecutorMeta te = (TransExecutorMeta)sm.getStepMetaInterface();
			transCopy(te.getTransName(), te.getDirectoryPath(),fromRepository,toRepository);
		}
	}
	if(!isDirectoryExist(toRepository,transPath)){
		//所在目錄不存在則創建
	    toRepository.createRepositoryDirectory(toRepository.findDirectory("/"), transPath);
	}
	tm.setRepository(toRepository);
	tm.setMetaStore(toRepository.getMetaStore());
	KettleUtils.saveTrans(toRepository,tm);
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:31,代碼來源:KettleUtils.java

示例8: startTransformation

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
protected void startTransformation( Repository repository, IMetaStore metaStore, final StreamingService service ) {
  try {

    TransMeta transMeta = StreamingConst.loadTransMeta( repository, metaStore, service );
    Trans trans = new Trans( transMeta );
    String carteObjectId = UUID.randomUUID().toString();
    trans.setContainerObjectId( carteObjectId );
    
    if (service.getLogLevel()!=null) {
      trans.setLogLevel(service.getLogLevel());
    }
    TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
    TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration );
    transformationMap.addTransformation( transMeta.getName(), carteObjectId, trans, transConfiguration );
    trans.prepareExecution( null );

    // Start the transformation

    trans.startThreads();
    
    // This transformation routinely never ends so we won't wait for it...
    
  } catch ( Exception e ) {
    throw new RuntimeException( "Unable to start transformation for streaming service '" + service.getName() + "'", e );
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-streaming,代碼行數:27,代碼來源:ListStreamingServicesServlet.java

示例9: lookupTransObjectId

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
/**
 * Try to look up the transObjectId for transformation which are referenced by path 
 * @param repository The repository to use.
 * @throws KettleException
 */
public void lookupTransObjectId( Repository repository ) throws KettleException {
  if ( repository == null )
    return;

  if ( Const.isEmpty( transFilename ) && transObjectId == null && !Const.isEmpty( transRepositoryPath ) ) {
    // see if there is a path specified to a repository name
    //
    String path = "/";
    String name = transRepositoryPath;
    int lastSlashIndex = name.lastIndexOf( '/' );
    if ( lastSlashIndex >= 0 ) {
      path = transRepositoryPath.substring( 0, lastSlashIndex + 1 );
      name = transRepositoryPath.substring( lastSlashIndex + 1 );
    }
    RepositoryDirectoryInterface tree = repository.loadRepositoryDirectoryTree();
    RepositoryDirectoryInterface rd = tree.findDirectory( path );
    if ( rd == null )
      rd = tree; // root

    ObjectId transformationID = repository.getTransformationID( name, rd );
    transObjectId = transformationID == null ? null : transformationID.getId();
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-streaming,代碼行數:29,代碼來源:StreamingService.java

示例10: saveRep

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
/**
 * This method is called by Spoon when a step needs to serialize its configuration to a repository.
 * The repository implementation provides the necessary methods to save the step attributes.
 *
 * @param rep					the repository to save to
 * @param metaStore				the metaStore to optionally write to
 * @param id_transformation		the id to use for the transformation when saving
 * @param id_step				the id to use for the step  when saving
 */
public void saveRep(Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step) throws KettleException
{
	try{
		rep.saveStepAttribute(id_transformation, id_step, "provider_id", provider == null ? "" : provider.getName() );
		rep.saveStepAttribute(id_transformation, id_step, "provider_desc", provider == null ? "" : provider.getDescription() );
		rep.saveStepAttribute( id_transformation, id_step, "flow_id", dataflow.getId() );
		rep.saveStepAttribute( id_transformation, id_step, "flow_desc", dataflow.getDescription() );
     rep.saveStepAttribute( id_transformation, id_step, "query_sdmx", getSdmxQuery() );

     saveDimensionsToRepository( rep, id_transformation, id_step );
     saveFieldsToRepository( rep, id_transformation, id_step );
	}
	catch(Exception e){
		throw new KettleException("Unable to save step into repository: "+id_step, e); 
	}
}
 
開發者ID:andtorg,項目名稱:sdmx-kettle,代碼行數:26,代碼來源:SdmxStepMeta.java

示例11: getFields

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
/**
 * This method is called to determine the changes the step is making to the row-stream.
 * To that end a RowMetaInterface object is passed in, containing the row-stream structure as it is when entering
 * the step. This method must apply any changes the step makes to the row stream. Usually a step adds fields to the
 * row-stream.
 * 
 * @param inputRowMeta		the row structure coming in to the step
 * @param name 				the name of the step making the changes
 * @param info				row structures of any info steps coming in
 * @param nextStep			the description of a step this step is passing rows to
 * @param space				the variable space for resolving variables
 * @param repository		the repository instance optionally read from
 * @param metaStore			the metaStore to optionally read from
 */
 @Override
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException{

   for ( int i = 0; i < fields.length; i++ ) {
     int type = fields[i].getType();
     if ( type == ValueMetaInterface.TYPE_NONE) type = ValueMetaInterface.TYPE_STRING;

     try {
       ValueMetaInterface v = ValueMetaFactory.createValueMeta( fields[i].getName(), type );
       v.setConversionMask( fields[i].getFormat() );
       v.setLength( fields[i].getLength() );
       v.setPrecision( fields[i].getPrecision() );
       v.setCurrencySymbol( fields[i].getCurrencySymbol() );
       v.setDecimalSymbol( fields[i].getDecimalSymbol() );
       v.setGroupingSymbol( fields[i].getGroupSymbol() );
       v.setTrimType( fields[i].getTrimType() );

       v.setOrigin( name );

       inputRowMeta.addValueMeta( v );
     } catch (KettlePluginException e) {
       throw new KettleStepException( e );
     }
   }
}
 
開發者ID:andtorg,項目名稱:sdmx-kettle,代碼行數:40,代碼來源:SdmxStepMeta.java

示例12: saveFieldsToRepository

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
private void saveFieldsToRepository( Repository rep, ObjectId id_transformation, ObjectId id_step ) throws KettleException {
  for ( int i = 0; i < fields.length; i++ ) {
    SdmxInputField field = fields[i];

    rep.saveStepAttribute( id_transformation, id_step, i, "name", field.getName() );
    rep.saveStepAttribute( id_transformation, id_step, i, "type", field.getTypeDesc() );
    rep.saveStepAttribute( id_transformation, id_step, i, "length", field.getLength() );
    rep.saveStepAttribute( id_transformation, id_step, i, "precision", field.getPrecision() );
    rep.saveStepAttribute( id_transformation, id_step, i, "trim_type", field.getTrimTypeCode() );
    rep.saveStepAttribute( id_transformation, id_step, i, "repeat", field.isRepeated() );
    rep.saveStepAttribute( id_transformation, id_step, i, "format", field.getFormat() );
    rep.saveStepAttribute( id_transformation, id_step, i, "currency", field.getCurrencySymbol() );
    rep.saveStepAttribute( id_transformation, id_step, i, "decimal", field.getDecimalSymbol() );
    rep.saveStepAttribute( id_transformation, id_step, i, "group", field.getGroupSymbol() );
  }
}
 
開發者ID:andtorg,項目名稱:sdmx-kettle,代碼行數:17,代碼來源:SdmxStepMeta.java

示例13: readFieldsFromRepository

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
private void readFieldsFromRepository( Repository rep, ObjectId id_step ) throws KettleException {
  int nrFields = rep.countNrStepAttributes( id_step, "trim_type" );
  allocateFields( nrFields );

  for ( int i = 0; i < nrFields; i++ ) {
    SdmxInputField field = new SdmxInputField();

    field.setName( rep.getStepAttributeString( id_step, i, "name" ) );
    field.setType( rep.getStepAttributeString( id_step, i, "type" ) );
    field.setLength( (int) rep.getStepAttributeInteger( id_step, i,  "length" ) );
    field.setPrecision( (int) rep.getStepAttributeInteger( id_step, i,  "precision" ) );
    field.setTrimType( ValueMetaBase.getTrimTypeByCode( rep.getStepAttributeString( id_step, i, "trim_type" ) ) );
    field.setFormat( rep.getStepAttributeString( id_step, i, "format" ) );
    field.setCurrencySymbol( rep.getStepAttributeString( id_step, i, "currency" ) );
    field.setDecimalSymbol( rep.getStepAttributeString( id_step, i, "decimal" ) );
    field.setGroupSymbol( rep.getStepAttributeString( id_step, i, "group" ) );

    String srepeat = rep.getStepAttributeString( id_step, i, "repeat" );
    if ( srepeat != null ) {
      field.setRepeated( YES.equalsIgnoreCase( srepeat ) );
    } else {
      field.setRepeated( false );
    }
    fields[i] = field;
  }
}
 
開發者ID:andtorg,項目名稱:sdmx-kettle,代碼行數:27,代碼來源:SdmxStepMeta.java

示例14: readRep

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
@Override
public void readRep(Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
    throws KettleException {

  String connectionName = rep.getStepAttributeString(id_step, TAG_CONNECTION);
  if (StringUtils.isNotEmpty(connectionName)) {
    try {
      connection = HCPConnectionUtils.getConnectionFactory(metaStore).loadElement(connectionName);
    } catch (MetaStoreException e) {
      // We just log the message but we don't abort the complete meta-data
      // loading.
      //
      log.logError(BaseMessages.getString(PKG, "HCPGetMeta.Error.HCPConnectionNotFound", connectionName));
      connection = null;
    }
  }
  sourceFileField = rep.getStepAttributeString(id_step, TAG_SOURCE_FILE);
  targetFileField = rep.getStepAttributeString(id_step, TAG_TARGET_FILE);
  responseCodeField = rep.getStepAttributeString(id_step, TAG_RESPONSE_CODE_FIELD);
  responseTimeField = rep.getStepAttributeString(id_step, TAG_RESPONSE_TIME_FIELD);
  responseSizeField = rep.getStepAttributeString(id_step, TAG_RESPONSE_SIZE_FIELD);
}
 
開發者ID:mattcasters,項目名稱:pdi-hcp-plugin,代碼行數:23,代碼來源:HCPGetMeta.java

示例15: getFields

import org.pentaho.di.repository.Repository; //導入依賴的package包/類
@Override
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
  
  // Optionally add a fields...
  //
  if (StringUtils.isNotEmpty(responseCodeField)) {
    ValueMetaInterface codeValue = new ValueMetaInteger(responseCodeField);
    codeValue.setLength(3);
    codeValue.setOrigin(name);
    inputRowMeta.addValueMeta(codeValue);
  }
  
  if (StringUtils.isNotEmpty(responseTimeField)) {
    ValueMetaInterface timeValue = new ValueMetaInteger(responseTimeField);
    timeValue.setLength(7);
    timeValue.setOrigin(name);
    inputRowMeta.addValueMeta(timeValue);
  }
}
 
開發者ID:mattcasters,項目名稱:pdi-hcp-plugin,代碼行數:21,代碼來源:HCPDeleteMeta.java


注:本文中的org.pentaho.di.repository.Repository類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。