Search in sources :

Example 26 with DataServiceMeta

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);
    }
}
Also used : DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) TreeSelection(org.pentaho.di.ui.spoon.TreeSelection) Tree(org.eclipse.swt.widgets.Tree) Menu(org.eclipse.swt.widgets.Menu)

Example 27 with DataServiceMeta

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);
}
Also used : DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) TransMeta(org.pentaho.di.trans.TransMeta) StepMenuExtension(org.pentaho.di.ui.spoon.trans.StepMenuExtension) StepMeta(org.pentaho.di.trans.step.StepMeta) XulMenupopup(org.pentaho.ui.xul.containers.XulMenupopup)

Example 28 with DataServiceMeta

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);
        }
    }
}
Also used : DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) CheckStepsExtension(org.pentaho.di.trans.CheckStepsExtension) TransMeta(org.pentaho.di.trans.TransMeta) StepMeta(org.pentaho.di.trans.step.StepMeta)

Example 29 with DataServiceMeta

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();
}
Also used : HeapCacheProvidingService(org.pentaho.caching.ri.HeapCacheProvidingService) UIFactory(org.pentaho.di.trans.dataservice.ui.UIFactory) DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) DataServiceExecutor(org.pentaho.di.trans.dataservice.DataServiceExecutor) TransMeta(org.pentaho.di.trans.TransMeta) LogChannel(org.pentaho.di.core.logging.LogChannel) ServiceCacheFactory(org.pentaho.di.trans.dataservice.optimization.cache.ServiceCacheFactory) SQL(org.pentaho.di.core.sql.SQL) DataServiceContext(org.pentaho.di.trans.dataservice.DataServiceContext) PentahoCacheManagerImpl(org.pentaho.caching.impl.PentahoCacheManagerImpl) PentahoCacheSystemConfiguration(org.pentaho.caching.api.PentahoCacheSystemConfiguration) Test(org.junit.Test)

Example 30 with DataServiceMeta

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));
    }
}
Also used : GUIResource(org.pentaho.di.ui.core.gui.GUIResource) TreeItem(org.eclipse.swt.widgets.TreeItem) DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) TransMeta(org.pentaho.di.trans.TransMeta)

Aggregations

DataServiceMeta (org.pentaho.di.trans.dataservice.DataServiceMeta)52 Test (org.junit.Test)29 TransMeta (org.pentaho.di.trans.TransMeta)16 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)9 KettleException (org.pentaho.di.core.exception.KettleException)8 DataServiceContext (org.pentaho.di.trans.dataservice.DataServiceContext)6 DataServiceDelegate (org.pentaho.di.trans.dataservice.ui.DataServiceDelegate)6 StepMeta (org.pentaho.di.trans.step.StepMeta)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 Before (org.junit.Before)4 RowMeta (org.pentaho.di.core.row.RowMeta)4 DataServiceResolver (org.pentaho.di.trans.dataservice.resolvers.DataServiceResolver)4 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)4 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)4 MetastoreLocator (org.pentaho.osgi.metastore.locator.api.MetastoreLocator)4 ModelAnnotationGroup (org.pentaho.agilebi.modeler.models.annotations.ModelAnnotationGroup)3 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)3 File (java.io.File)2 IOException (java.io.IOException)2 URL (java.net.URL)2