use of org.pentaho.di.starmodeler.metastore.IdNameDescription in project pentaho-kettle by pentaho.
the class StarModelerPerspective method testMetaStore.
protected void testMetaStore() {
try {
// Force repository meta store
IMetaStore metaStore = Spoon.getInstance().getRepository().getMetaStore();
LogChannel.GENERAL.logBasic("Active metastore: " + metaStore.getName());
StarDomainMetaStoreUtil.verifyNamespaceCreated(metaStore, "pentaho");
IMetaStoreElementType elementType = StarDomainMetaStoreUtil.getStarDomainElementType(metaStore);
if (elementType == null) {
throw new KettleException("Unable to find star domain element type");
}
LogChannel.GENERAL.logBasic("Found star domain element type: " + elementType.getName() + " : " + elementType.getDescription());
elementType = metaStore.getElementTypeByName(PentahoDefaults.NAMESPACE, elementType.getName());
if (elementType == null) {
throw new KettleException("Unable to find star domain element type by name");
}
LogChannel.GENERAL.logBasic("Found element type by name");
List<IdNameDescription> list = new ArrayList<IdNameDescription>();
for (IMetaStoreElement element : metaStore.getElements(PentahoDefaults.NAMESPACE, elementType)) {
IdNameDescription nameDescription = new IdNameDescription(element.getId(), element.getName(), null);
list.add(nameDescription);
}
LogChannel.GENERAL.logBasic("Found " + list.size() + " star domain elements.");
StarDomainMetaStoreUtil.getStarDomainList(metaStore);
} catch (Exception e) {
new ErrorDialog(Spoon.getInstance().getShell(), "ERROR", "Error testing meta store: ", e);
}
}
use of org.pentaho.di.starmodeler.metastore.IdNameDescription in project pentaho-kettle by pentaho.
the class StarModelerPerspective method open.
public void open() {
// List all star domains in the metastore
//
Shell shell = Spoon.getInstance().getShell();
try {
List<IdNameDescription> starDomainList = StarDomainMetaStoreUtil.getStarDomainList(Spoon.getInstance().getMetaStore());
List<String> rows = new ArrayList<String>();
for (IdNameDescription ind : starDomainList) {
rows.add(ind.getName() + " : " + ind.getDescription());
}
EnterSelectionDialog selectionDialog = new EnterSelectionDialog(shell, rows.toArray(new String[rows.size()]), "Select star domain", "Select the star domain to open:");
selectionDialog.setMulti(false);
if (selectionDialog.open() != null) {
int index = selectionDialog.getSelectionNr();
StarDomain starDomain = StarDomainMetaStoreUtil.loadStarDomain(Spoon.getInstance().getMetaStore(), starDomainList.get(index).getId());
if (starDomain != null) {
createTabForDomain(starDomain);
}
}
} catch (Exception e) {
new ErrorDialog(shell, "Error", "Error getting list of star domains from the MetaStore:", e);
}
}
Aggregations