use of org.pentaho.metastore.api.exceptions.MetaStoreException in project pentaho-kettle by pentaho.
the class NamedClusterEmbedManager method addAllClusters.
private void addAllClusters() {
NamedClusterServiceOsgi ncso = meta.getNamedClusterServiceOsgi();
if (ncso != null && meta.getMetaStore() != null) {
try {
List<String> list = ncso.listNames(meta.getMetaStore());
for (String name : list) {
addClusterToMeta(name);
}
for (NamedClusterOsgi nc : namedClusterPool.values()) {
if (!list.contains(nc.getName())) {
addClusterToMeta(nc);
}
}
addedAllClusters = true;
} catch (MetaStoreException e) {
logMetaStoreException(e);
}
}
}
use of org.pentaho.metastore.api.exceptions.MetaStoreException in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method createElement.
@Override
public void createElement(String namespace, IMetaStoreElementType elementType, IMetaStoreElement element) throws MetaStoreException, MetaStoreElementExistException {
try {
IMetaStoreElement found = getElementByName(namespace, elementType, element.getName());
if (found != null) {
throw new MetaStoreElementExistException(Arrays.asList(found), "The element with name '" + element.getName() + "' already exists");
}
delegate.insertElement(elementType, element);
repository.commit();
} catch (MetaStoreElementExistException e) {
throw e;
} catch (Exception e) {
repository.rollback();
throw new MetaStoreException("Unable to create element with name '" + element.getName() + "' of type '" + elementType.getName() + "'", e);
}
}
use of org.pentaho.metastore.api.exceptions.MetaStoreException in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method deleteNamespace.
@Override
public void deleteNamespace(String namespace) throws MetaStoreException, MetaStoreDependenciesExistsException {
try {
ObjectId namespaceId = delegate.verifyNamespace(namespace);
List<IMetaStoreElementType> elementTypes = getElementTypes(namespace);
if (!elementTypes.isEmpty()) {
List<String> dependencies = new ArrayList<String>();
for (IMetaStoreElementType elementType : elementTypes) {
dependencies.add(elementType.getId());
}
throw new MetaStoreDependenciesExistsException(dependencies, "The namespace to delete, '" + namespace + "' is not empty");
}
// Now delete the namespace
//
delegate.deleteNamespace(namespaceId);
repository.commit();
} catch (MetaStoreDependenciesExistsException e) {
throw e;
} catch (MetaStoreException e) {
repository.rollback();
throw e;
} catch (Exception e) {
repository.rollback();
throw new MetaStoreException("Unable to delete namespace '" + namespace + "'", e);
}
}
use of org.pentaho.metastore.api.exceptions.MetaStoreException in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method updateElement.
@Override
public void updateElement(String namespace, IMetaStoreElementType elementType, String elementId, IMetaStoreElement element) throws MetaStoreException {
try {
// This is a delete/insert operation
//
deleteElement(namespace, elementType, elementId);
createElement(namespace, elementType, element);
repository.commit();
} catch (Exception e) {
repository.rollback();
throw new MetaStoreException("Unable to update element with id '" + elementId + "' called '" + element.getName() + "' in type '" + elementType.getName() + "'", e);
}
}
use of org.pentaho.metastore.api.exceptions.MetaStoreException in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method getElementTypeByName.
@Override
public IMetaStoreElementType getElementTypeByName(String namespace, String elementTypeName) throws MetaStoreException {
try {
LongObjectId namespaceId = delegate.getNamespaceId(namespace);
if (namespaceId == null) {
return null;
}
LongObjectId elementTypeId = delegate.getElementTypeId(namespaceId, elementTypeName);
if (elementTypeId == null) {
return null;
}
RowMetaAndData elementTypeRow = delegate.getElementType(elementTypeId);
return delegate.parseElementType(namespace, namespaceId, elementTypeRow);
} catch (Exception e) {
throw new MetaStoreException("Unable to get element type with name '" + elementTypeName + "' in namespace '" + namespace + "'", e);
}
}
Aggregations