use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryTransDelegate method insertDependency.
private synchronized ObjectId insertDependency(ObjectId id_transformation, ObjectId id_database, String tablename, String fieldname) throws KettleException {
ObjectId id = repository.connectionDelegate.getNextDepencencyID();
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DEPENDENCY_ID_DEPENDENCY), id);
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DEPENDENCY_ID_TRANSFORMATION), id_transformation);
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DEPENDENCY_ID_DATABASE), id_database);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DEPENDENCY_TABLE_NAME), tablename);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DEPENDENCY_FIELD_NAME), fieldname);
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), KettleDatabaseRepository.TABLE_R_DEPENDENCY);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method updateElementType.
@Override
public void updateElementType(String namespace, IMetaStoreElementType elementType) throws MetaStoreException {
try {
ObjectId namespaceId = delegate.verifyNamespace(namespace);
String elementTypeId = elementType.getId();
if (elementTypeId == null) {
IMetaStoreElementType type = getElementTypeByName(namespace, elementType.getName());
if (type != null) {
elementTypeId = type.getId();
}
}
if (elementTypeId != null) {
delegate.updateElementType(namespaceId, new LongObjectId(new StringObjectId(elementType.getId())), elementType);
repository.commit();
} else {
throw new MetaStoreException("Unable to update element type: no id was provided and the name '" + elementType.getName() + "' didn't match");
}
} catch (MetaStoreException e) {
throw e;
} catch (Exception e) {
repository.rollback();
throw new MetaStoreException("Unable to update element type", e);
}
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method createNamespace.
@Override
public void createNamespace(String namespace) throws MetaStoreException, MetaStoreNamespaceExistsException {
try {
ObjectId namespaceId = delegate.getNamespaceId(namespace);
if (namespaceId != null) {
throw new MetaStoreNamespaceExistsException("Namespace with name '" + namespace + "' already exists");
}
// insert namespace into R_NAMESPACE
//
delegate.insertNamespace(namespace);
repository.commit();
} catch (Exception e) {
repository.rollback();
throw new MetaStoreException(e);
}
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method getElementType.
@Override
public IMetaStoreElementType getElementType(String namespace, String elementTypeId) throws MetaStoreException {
try {
ObjectId namespaceId = delegate.getNamespaceId(namespace);
if (namespaceId == null) {
return null;
}
RowMetaAndData elementTypeRow = delegate.getElementType(new LongObjectId(new StringObjectId(elementTypeId)));
return delegate.parseElementType(namespace, namespaceId, elementTypeRow);
} catch (Exception e) {
throw new MetaStoreException("Unable to get element type with id '" + elementTypeId + "' in namespace '" + namespace + "'", e);
}
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryClusterSchemaDelegate method loadClusterSchema.
public ClusterSchema loadClusterSchema(ObjectId id_cluster_schema, List<SlaveServer> slaveServers) throws KettleException {
ClusterSchema clusterSchema = new ClusterSchema();
RowMetaAndData row = getClusterSchema(id_cluster_schema);
clusterSchema.setObjectId(id_cluster_schema);
clusterSchema.setName(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_NAME, null));
clusterSchema.setBasePort(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_BASE_PORT, null));
clusterSchema.setSocketsBufferSize(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_BUFFER_SIZE, null));
clusterSchema.setSocketsFlushInterval(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_FLUSH_INTERVAL, null));
clusterSchema.setSocketsCompressed(row.getBoolean(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_COMPRESSED, true));
clusterSchema.setDynamic(row.getBoolean(KettleDatabaseRepository.FIELD_CLUSTER_DYNAMIC, true));
ObjectId[] pids = repository.getClusterSlaveIDs(id_cluster_schema);
for (int i = 0; i < pids.length; i++) {
// Load last version
SlaveServer slaveServer = repository.loadSlaveServer(pids[i], null);
SlaveServer reference = SlaveServer.findSlaveServer(slaveServers, slaveServer.getName());
if (reference != null) {
clusterSchema.getSlaveServers().add(reference);
} else {
clusterSchema.getSlaveServers().add(slaveServer);
}
}
return clusterSchema;
}
Aggregations