Search in sources :

Example 51 with SimpleUrlFactory

use of org.pentaho.platform.util.web.SimpleUrlFactory in project data-access by pentaho.

the class DSWDatasourceServiceImpl method listDatasourceNames.

public List<String> listDatasourceNames() throws IOException {
    synchronized (CsvDatasourceServiceImpl.lock) {
        // $NON-NLS-1$
        IPentahoUrlFactory urlFactory = new SimpleUrlFactory("");
        PMDUIComponent component = new PMDUIComponent(urlFactory, new ArrayList());
        component.validate(PentahoSessionHolder.getSession(), null);
        component.setAction(PMDUIComponent.ACTION_LIST_MODELS);
        Document document = component.getXmlContent();
        // $NON-NLS-1$
        List<DefaultElement> modelElements = document.selectNodes("//model_name");
        ArrayList<String> datasourceNames = new ArrayList<String>();
        for (DefaultElement element : modelElements) {
            datasourceNames.add(element.getText());
        }
        return datasourceNames;
    }
}
Also used : IPentahoUrlFactory(org.pentaho.platform.api.engine.IPentahoUrlFactory) DefaultElement(org.dom4j.tree.DefaultElement) ArrayList(java.util.ArrayList) SimpleUrlFactory(org.pentaho.platform.util.web.SimpleUrlFactory) PMDUIComponent(org.pentaho.platform.uifoundation.component.xml.PMDUIComponent) Document(org.dom4j.Document)

Aggregations

SimpleUrlFactory (org.pentaho.platform.util.web.SimpleUrlFactory)51 ArrayList (java.util.ArrayList)39 HashMap (java.util.HashMap)31 ISolutionEngine (org.pentaho.platform.api.engine.ISolutionEngine)23 IRuntimeContext (org.pentaho.platform.api.engine.IRuntimeContext)20 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)20 IPentahoUrlFactory (org.pentaho.platform.api.engine.IPentahoUrlFactory)17 OutputStream (java.io.OutputStream)16 SimpleParameterProvider (org.pentaho.platform.engine.core.solution.SimpleParameterProvider)16 SimpleOutputHandler (org.pentaho.platform.engine.core.output.SimpleOutputHandler)15 IOException (java.io.IOException)13 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 IParameterProvider (org.pentaho.platform.api.engine.IParameterProvider)11 IPentahoRequestContext (org.pentaho.platform.api.engine.IPentahoRequestContext)11 IActionParameter (org.pentaho.platform.api.engine.IActionParameter)9 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)8 List (java.util.List)6 Document (org.dom4j.Document)6 IOutputHandler (org.pentaho.platform.api.engine.IOutputHandler)6 BaseRequestHandler (org.pentaho.platform.engine.services.BaseRequestHandler)5