本文整理汇总了Java中org.pentaho.metastore.api.IMetaStore类的典型用法代码示例。如果您正苦于以下问题:Java IMetaStore类的具体用法?Java IMetaStore怎么用?Java IMetaStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMetaStore类属于org.pentaho.metastore.api包,在下文中一共展示了IMetaStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadXML
import org.pentaho.metastore.api.IMetaStore; //导入依赖的package包/类
@Override public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore)
throws KettleXMLException {
super.loadXML(stepnode, databases, metaStore);
String truncateStr = XMLHandler.getTagValue(stepnode, "truncate");
if (truncateStr.equals("true")) {
setTruncate(true);
} else {
setTruncate(false);
}
int nrStreamFields = XMLHandler.countNodes(stepnode, "stream_fields");
streamFields = new ArrayList<String>(nrStreamFields);
for (int i = 0; i < nrStreamFields; i++) {
Node fieldNode = XMLHandler.getSubNodeByNr(stepnode, "stream_fields", i);
streamFields.add(XMLHandler.getTagValue(fieldNode, "name"));
}
}
示例2: readRep
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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"));
}
}
示例3: loadXML
import org.pentaho.metastore.api.IMetaStore; //导入依赖的package包/类
@Override public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore)
throws KettleXMLException {
setEndpoint(XMLHandler.getTagValue(stepnode, "endpoint"));
setTunnelEndpoint(XMLHandler.getTagValue(stepnode, "tunnelEndpoint"));
setAccessId(XMLHandler.getTagValue(stepnode, "accessId"));
setAccessKey(XMLHandler.getTagValue(stepnode, "accessKey"));
setProjectName(XMLHandler.getTagValue(stepnode, "projectName"));
setTableName(XMLHandler.getTagValue(stepnode, "tableName"));
setPartition(XMLHandler.getTagValue(stepnode, "partition"));
int nrFields = XMLHandler.countNodes(stepnode, "fields");
odpsFields = new ArrayList<OdpsField>(nrFields);
for (int i = 0; i < nrFields; i++) {
Node fieldNode = XMLHandler.getSubNodeByNr(stepnode, "fields", i);
OdpsField field = new OdpsField();
field.setName(XMLHandler.getTagValue(fieldNode, "name"));
field.setType(XMLHandler.getTagValue(fieldNode, "type"));
field.setComment(XMLHandler.getTagValue(fieldNode, "comment"));
odpsFields.add(field);
}
}
示例4: readRep
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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);
}
}
示例5: saveRep
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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());
}
}
示例6: startTransformation
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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 );
}
}
示例7: removeService
import org.pentaho.metastore.api.IMetaStore; //导入依赖的package包/类
protected boolean removeService( Shell shell, IMetaStore metaStore, String elementName ) {
MessageDialog dialog = new MessageDialog( shell, "Confirm removal", shell.getDisplay().getSystemImage( SWT.ICON_QUESTION ),
"Are you sure you want to remove streaming service '" + elementName + "'?", SWT.NONE, new String[] { "Yes", "No" }, 1 );
int answerIndex = dialog.open();
if ( answerIndex == 0 ) {
try {
MetaStoreFactory<StreamingService> rtFactory = new MetaStoreFactory<StreamingService>( StreamingService.class, metaStore, PentahoDefaults.NAMESPACE );
rtFactory.deleteElement( elementName );
return true;
} catch ( MetaStoreException e ) {
new ErrorDialog( shell, "Error", "Error deleting streaming service with name '" + elementName + "'", e );
return false;
}
}
return false;
}
示例8: createNewService
import org.pentaho.metastore.api.IMetaStore; //导入依赖的package包/类
protected String createNewService( Shell shell, IMetaStore metaStore ) {
EnterStringDialog dialog = new EnterStringDialog( shell, "table1", "Enter service name", "Enter the name of the new streaming service" );
String name = dialog.open();
if ( name != null ) {
try {
MetaStoreFactory<StreamingService> rtFactory = new MetaStoreFactory<StreamingService>( StreamingService.class, metaStore, PentahoDefaults.NAMESPACE );
if ( rtFactory.loadElement( name ) != null ) {
throw new MetaStoreException( "The streaming service with name '" + name + "' already exists" );
}
} catch ( MetaStoreException e ) {
new ErrorDialog( shell, "Error", "Error creating new streaming service", e );
return null;
}
return name;
} else {
return null;
}
}
示例9: getAMetaStore
import org.pentaho.metastore.api.IMetaStore; //导入依赖的package包/类
private IMetaStore getAMetaStore() throws MetaStoreException {
IMetaStore store = metaStore;
// during exec of data service, metaStore is not passed down
//
if (store==null) {
store = getTrans().getMetaStore();
}
if (store==null) {
store = getTransMeta().getMetaStore();
}
if (store==null && getTrans().getParentTrans()!=null) {
store = getTrans().getParentTrans().getMetaStore();
}
if (store==null) {
log.logError("Unable to find the metastore, locating it ourselves...");
if (repository!=null) {
store = repository.getMetaStore();
} else {
store = MetaStoreConst.openLocalPentahoMetaStore();
}
}
return store;
}
示例10: saveRep
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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);
}
}
示例11: getFields
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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 );
}
}
}
示例12: readRep
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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);
}
示例13: getFields
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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);
}
}
示例14: readRep
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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, "HCPPutMeta.Error.HCPConnectionNotFound", connectionName));
connection = null;
}
}
targetFileField = rep.getStepAttributeString(id_step, TAG_TARGET_FILE_FIELD);
responseCodeField = rep.getStepAttributeString(id_step, TAG_RESPONSE_CODE_FIELD);
responseTimeField = rep.getStepAttributeString(id_step, TAG_RESPONSE_TIME_FIELD);
}
示例15: readRep
import org.pentaho.metastore.api.IMetaStore; //导入依赖的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, "HCPPutMeta.Error.HCPConnectionNotFound", connectionName));
connection = null;
}
}
sourceFileField = rep.getStepAttributeString(id_step, TAG_SOURCE_FILE_FIELD);
targetFileField = rep.getStepAttributeString(id_step, TAG_TARGET_FILE_FIELD);
updating = rep.getStepAttributeBoolean(id_step, TAG_UPDATING);
responseCodeField = rep.getStepAttributeString(id_step, TAG_RESPONSE_CODE_FIELD);
responseTimeField = rep.getStepAttributeString(id_step, TAG_RESPONSE_TIME_FIELD);
}