use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class BaseKettleMetaverseComponent method createNodeFromDescriptor.
protected IMetaverseNode createNodeFromDescriptor(IComponentDescriptor descriptor, ILogicalIdGenerator idGenerator) {
String uuid = UUID.randomUUID().toString();
IMetaverseNode node = null;
if (descriptor != null) {
node = metaverseObjectFactory.createNodeObject(uuid, descriptor.getName(), descriptor.getType());
if (idGenerator.getLogicalIdPropertyKeys().contains(DictionaryConst.PROPERTY_NAMESPACE) && descriptor.getParentNamespace() != null) {
node.setProperty(DictionaryConst.PROPERTY_NAMESPACE, descriptor.getNamespace().getNamespaceId());
}
node.setLogicalIdGenerator(idGenerator);
}
return node;
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class BaseKettleMetaverseComponent method createFileNode.
protected IMetaverseNode createFileNode(String fileName, IComponentDescriptor descriptor, String nodeType) throws MetaverseException {
String normalized;
IMetaverseNode fileNode = null;
if (fileName != null && descriptor != null) {
normalized = KettleAnalyzerUtil.normalizeFilePath(fileName);
INamespace ns = descriptor.getNamespace();
INamespace parentNs = ns.getParentNamespace();
fileNode = metaverseObjectFactory.createNodeObject(parentNs == null ? ns : parentNs, normalized, nodeType);
fileNode.setProperty(DictionaryConst.PROPERTY_PATH, normalized);
fileNode.setLogicalIdGenerator(DictionaryConst.LOGICAL_ID_GENERATOR_FILE);
}
return fileNode;
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class DatabaseConnectionAnalyzer method analyze.
/**
* Analyzes a database connection for metadata.
*
* @param dbMeta the object
* @see IAnalyzer#analyze(IComponentDescriptor, java.lang.Object)
*/
@Override
public IMetaverseNode analyze(IComponentDescriptor descriptor, DatabaseMeta dbMeta) throws MetaverseAnalyzerException {
if (dbMeta == null) {
throw new MetaverseAnalyzerException(Messages.getString("ERROR.DatabaseMeta.IsNull"));
}
if (metaverseObjectFactory == null) {
throw new MetaverseAnalyzerException(Messages.getString("ERROR.MetaverseObjectFactory.IsNull"));
}
if (metaverseBuilder == null) {
throw new MetaverseAnalyzerException(Messages.getString("ERROR.MetaverseBuilder.IsNull"));
}
IMetaverseNode node = createNodeFromDescriptor(descriptor);
node.setType(DictionaryConst.NODE_TYPE_DATASOURCE);
int accessType = dbMeta.getAccessType();
node.setProperty("accessType", accessType);
String accessTypeDesc = dbMeta.getAccessTypeDesc();
node.setProperty("accessTypeDesc", accessTypeDesc);
String databaseName = dbMeta.getDatabaseName();
node.setProperty("databaseName", databaseName);
node.setProperty("name", dbMeta.getName());
DatabaseInterface dbInterface = dbMeta.getDatabaseInterface();
node.setProperty("databaseType", dbInterface != null ? Const.NVL(dbInterface.getPluginName(), "Unknown") : "Unknown");
String port = dbMeta.getDatabasePortNumberString();
node.setProperty(DictionaryConst.PROPERTY_PORT, port);
String host = dbMeta.getHostname();
node.setProperty(DictionaryConst.PROPERTY_HOST_NAME, host);
String user = dbMeta.getUsername();
node.setProperty(DictionaryConst.PROPERTY_USER_NAME, user);
boolean shared = dbMeta.isShared();
node.setProperty("shared", shared);
if (accessTypeDesc != null && accessTypeDesc.equals("JNDI")) {
node.setLogicalIdGenerator(DictionaryConst.LOGICAL_ID_GENERATOR_DB_JNDI);
} else {
node.setLogicalIdGenerator(getLogicalIdGenerator());
}
metaverseBuilder.addNode(node);
return node;
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class JobEntryAnalyzer method createFieldNode.
protected IMetaverseNode createFieldNode(IComponentDescriptor fieldDescriptor, ValueMetaInterface fieldMeta, String targetStepName, boolean addTheNode) {
IMetaverseNode newFieldNode = createNodeFromDescriptor(fieldDescriptor);
newFieldNode.setProperty(DictionaryConst.PROPERTY_KETTLE_TYPE, fieldMeta.getTypeDesc());
// don't add it to the graph if it is a transient node
if (targetStepName != null) {
newFieldNode.setProperty(DictionaryConst.PROPERTY_TARGET_STEP, targetStepName);
newFieldNode.setLogicalIdGenerator(DictionaryConst.LOGICAL_ID_GENERATOR_TARGET_AWARE);
if (addTheNode) {
getMetaverseBuilder().addNode(newFieldNode);
}
}
return newFieldNode;
}
use of org.pentaho.metaverse.api.IMetaverseNode in project pentaho-metaverse by pentaho.
the class ConnectionExternalResourceStepAnalyzer method customAnalyze.
@Override
protected void customAnalyze(T meta, IMetaverseNode node) throws MetaverseAnalyzerException {
super.customAnalyze(meta, node);
IMetaverseNode connectionNode = getConnectionNode();
// add a node for the connection itself
getMetaverseBuilder().addNode(connectionNode);
// link the connection to the step
getMetaverseBuilder().addLink(connectionNode, DictionaryConst.LINK_DEPENDENCYOF, node);
}
Aggregations