use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServicePopupMenuExtension method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface log, Object extension) throws KettleException {
Menu popupMenu = null;
Tree selectionTree = (Tree) extension;
TreeSelection[] objects = delegate.getSpoon().getTreeObjects(selectionTree);
TreeSelection object = objects[0];
Object selection = object.getSelection();
if (selection == DataServiceMeta.class) {
popupMenu = uiFactory.getMenu(selectionTree);
createRootPopupMenu(popupMenu);
} else if (selection instanceof DataServiceMeta) {
selectedDataService = (DataServiceMeta) selection;
popupMenu = uiFactory.getMenu(selectionTree);
createItemPopupMenu(popupMenu);
}
if (popupMenu != null) {
ConstUI.displayMenu(popupMenu, selectionTree);
} else {
selectionTree.setMenu(null);
}
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceStepMenuExtension method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface log, Object object) throws KettleException {
StepMenuExtension extension = (StepMenuExtension) object;
TransMeta transMeta = extension.getTransGraph().getTransMeta();
StepMeta stepMeta = extension.getTransGraph().getCurrentStep();
XulMenupopup menu = extension.getMenu();
DataServiceMeta dataService = metaStoreUtil.getDataServiceByStepName(transMeta, stepMeta.getName());
Boolean hasDataService = dataService != null && dataService.isUserDefined();
menu.getElementById("dataservices-new").setDisabled(hasDataService);
menu.getElementById("dataservices-edit").setDisabled(!hasDataService);
menu.getElementById("dataservices-delete").setDisabled(!hasDataService);
menu.getElementById("dataservices-test").setDisabled(!hasDataService);
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class StepValidationExtensionPointPlugin method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface log, Object o) throws KettleException {
if (!validInputs(o, log)) {
return;
}
CheckStepsExtension checkStepExtension = (CheckStepsExtension) o;
TransMeta transMeta = checkStepExtension.getTransMeta();
for (StepValidation stepValidation : getStepValidations()) {
StepMeta stepMeta = checkStepExtension.getStepMetas()[0];
if (stepValidation.supportsStep(stepMeta, log)) {
DataServiceMeta dataServiceMeta = metaStoreUtil.getDataServiceByStepName(transMeta, stepMeta.getName());
if (dataServiceMeta == null) {
// We won't validate Trans not associated with a DataService
return;
}
stepValidation.checkStep(checkStepExtension, dataServiceMeta, log);
}
}
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceRealTest method testServiceTransKeepsRunningWhenDataServiceIsNotUserDefined.
@Test
public void testServiceTransKeepsRunningWhenDataServiceIsNotUserDefined() throws Exception {
TransMeta transMeta = new TransMeta(getClass().getResource("/GenerateOneMillion.ktr").getPath());
DataServiceMeta dataServiceMeta = new DataServiceMeta(transMeta);
dataServiceMeta.setName("table");
dataServiceMeta.setStepname("Delay Row");
dataServiceMeta.setUserDefined(false);
PentahoCacheSystemConfiguration systemConfiguration = new PentahoCacheSystemConfiguration();
systemConfiguration.setData(new HashMap<>());
PentahoCacheManagerImpl pentahoCacheManager = new PentahoCacheManagerImpl(systemConfiguration, new HeapCacheProvidingService());
ServiceCacheFactory cacheFactory = new ServiceCacheFactory(pentahoCacheManager, Executors.newSingleThreadExecutor());
DataServiceContext dataServiceContext = new DataServiceContext(singletonList(cacheFactory), emptyList(), pentahoCacheManager, new UIFactory(), new LogChannel(""));
SQL countSql = new SQL("select count(*) from table");
DataServiceExecutor countExecutor = new DataServiceExecutor.Builder(countSql, dataServiceMeta, dataServiceContext).build();
countExecutor.executeQuery();
SQL limitSql = new SQL("select field1,field2 from table limit 5");
DataServiceExecutor limitExecutor = new DataServiceExecutor.Builder(limitSql, dataServiceMeta, dataServiceContext).build();
limitExecutor.executeQuery();
limitExecutor.waitUntilFinished();
assertTrue(countExecutor.getGenTrans().isRunning());
assertTrue(countExecutor.getServiceTrans().isRunning());
countExecutor.getServiceTrans().stopAll();
}
use of org.pentaho.di.trans.dataservice.DataServiceMeta in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceViewTreeExtension method refreshTree.
protected void refreshTree(SelectionTreeExtension selectionTreeExtension) {
TransMeta meta = (TransMeta) selectionTreeExtension.getMeta();
TreeItem tiRootName = selectionTreeExtension.getTiRootName();
GUIResource guiResource = selectionTreeExtension.getGuiResource();
TreeItem tiDSTitle = createTreeItem(tiRootName, STRING_DATA_SERVICES, guiResource.getImageFolder());
for (DataServiceMeta dataService : delegate.getDataServices(meta)) {
createTreeItem(tiDSTitle, dataService.getName(), getDataServiceImage(guiResource, dataService));
}
}
Aggregations