use of org.pentaho.metaverse.api.MetaverseComponentDescriptor in project pentaho-metaverse by pentaho.
the class TextFileOutputStepAnalyzerTest method setUp.
@Before
public void setUp() throws Exception {
when(mockNamespace.getParentNamespace()).thenReturn(mockNamespace);
descriptor = new MetaverseComponentDescriptor("test", DictionaryConst.NODE_TYPE_TRANS_STEP, mockNamespace);
analyzer = spy(new TextFileOutputStepAnalyzer());
analyzer.setDescriptor(descriptor);
analyzer.setObjectFactory(MetaverseTestUtils.getMetaverseObjectFactory());
inputs = new StepNodes();
inputs.addNode("previousStep", "first", node);
inputs.addNode("previousStep", "last", node);
inputs.addNode("previousStep", "age", node);
inputs.addNode("previousStep", "filename", node);
doReturn(inputs).when(analyzer).getInputs();
}
use of org.pentaho.metaverse.api.MetaverseComponentDescriptor in project pentaho-metaverse by pentaho.
the class StepAnalyzer method getStepFieldOriginDescriptor.
protected IComponentDescriptor getStepFieldOriginDescriptor(IComponentDescriptor descriptor, String fieldName) throws MetaverseAnalyzerException {
if (descriptor == null || stepFields == null) {
return null;
}
ValueMetaInterface vmi = stepFields.searchValueMeta(fieldName);
String origin = (vmi == null) ? fieldName : vmi.getOrigin();
// if we can't determine the origin, throw an exception
if (origin == null && !ArrayUtils.isEmpty(prevStepNames)) {
throw new MetaverseAnalyzerException(Messages.getString("ERROR.NoOriginForField", fieldName));
}
IMetaverseNode tmpOriginNode = metaverseObjectFactory.createNodeObject(UUID.randomUUID().toString(), origin, DictionaryConst.NODE_TYPE_TRANS_STEP);
tmpOriginNode.setProperty(DictionaryConst.PROPERTY_NAMESPACE, rootNode.getProperty(DictionaryConst.PROPERTY_NAMESPACE));
INamespace stepFieldNamespace = new Namespace(tmpOriginNode.getLogicalId());
MetaverseComponentDescriptor d = new MetaverseComponentDescriptor(fieldName, DictionaryConst.NODE_TYPE_TRANS_FIELD, tmpOriginNode, descriptor.getContext());
return d;
}
use of org.pentaho.metaverse.api.MetaverseComponentDescriptor in project pentaho-metaverse by pentaho.
the class HTTPPostStepAnalyzer method createResourceNode.
@Override
public IMetaverseNode createResourceNode(IExternalResourceInfo resource) throws MetaverseException {
MetaverseComponentDescriptor componentDescriptor = new MetaverseComponentDescriptor(resource.getName(), getResourceInputNodeType(), descriptor.getNamespace(), descriptor.getContext());
IMetaverseNode node = createNodeFromDescriptor(componentDescriptor);
return node;
}
use of org.pentaho.metaverse.api.MetaverseComponentDescriptor in project pentaho-metaverse by pentaho.
the class RestClientStepAnalyzer method createResourceNode.
@Override
public IMetaverseNode createResourceNode(IExternalResourceInfo resource) throws MetaverseException {
MetaverseComponentDescriptor componentDescriptor = new MetaverseComponentDescriptor(resource.getName(), getResourceInputNodeType(), descriptor.getNamespace(), descriptor.getContext());
IMetaverseNode node = createNodeFromDescriptor(componentDescriptor);
return node;
}
use of org.pentaho.metaverse.api.MetaverseComponentDescriptor in project pentaho-metaverse by pentaho.
the class TableInputStepAnalyzer method createTableNode.
@Override
protected IMetaverseNode createTableNode(IExternalResourceInfo resource) throws MetaverseAnalyzerException {
BaseDatabaseResourceInfo resourceInfo = (BaseDatabaseResourceInfo) resource;
Object obj = resourceInfo.getAttributes().get(DictionaryConst.PROPERTY_QUERY);
String query = obj == null ? null : obj.toString();
// create a node for the table
MetaverseComponentDescriptor componentDescriptor = new MetaverseComponentDescriptor("SQL", DictionaryConst.NODE_TYPE_SQL_QUERY, getConnectionNode(), getDescriptor().getContext());
// set the namespace to be the id of the connection node.
IMetaverseNode tableNode = createNodeFromDescriptor(componentDescriptor);
tableNode.setProperty(DictionaryConst.PROPERTY_NAMESPACE, componentDescriptor.getNamespace().getNamespaceId());
tableNode.setProperty(DictionaryConst.PROPERTY_QUERY, query);
tableNode.setLogicalIdGenerator(DictionaryConst.LOGICAL_ID_GENERATOR_DB_QUERY);
return tableNode;
}
Aggregations