Search in sources :

Example 1 with IServiceConfig

use of org.pentaho.platform.api.engine.IServiceConfig in project pentaho-platform by pentaho.

the class AbstractAxisConfigurator method unloadServices.

public void unloadServices() throws AxisFault {
    Set<String> keys = services.keySet();
    List<String> removed = new ArrayList<String>();
    // iterate through the list of web service wrappers
    for (String key : keys) {
        IServiceConfig wrapper = services.get(key);
        // use the service name to remove them from the Axis system
        String serviceName = wrapper.getServiceClass().getSimpleName();
        axisConfig.removeService(serviceName);
        // build a list of the ones removed
        removed.add(serviceName);
    }
    // now remove the wrappers from the services list
    for (String serviceName : removed) {
        services.remove(serviceName);
    }
    loaded = false;
}
Also used : ArrayList(java.util.ArrayList) IServiceConfig(org.pentaho.platform.api.engine.IServiceConfig)

Example 2 with IServiceConfig

use of org.pentaho.platform.api.engine.IServiceConfig in project pentaho-platform by pentaho.

the class HtmlAxisServiceLister method getTitleSection.

/**
 * Writes the title section for a service to the HTML page
 *
 * @param axisService
 *          the Axis service
 * @param axisConfiguration
 *          the Axis configuration
 * @param sb
 *          StringBuilder to write content to
 */
protected void getTitleSection(AxisService axisService, AxisConfiguration axisConfiguration, StringBuilder sb) {
    // get the wrapper for the web service so we can get the localized title and description
    IServiceConfig wsDef = AxisUtil.getSourceDefinition(axisService, (SystemSolutionAxisConfigurator) axisConfiguration.getConfigurator());
    sb.append("<table>\n<tr>\n<td colspan=\"2\"><h2>").append(wsDef.getTitle()).append(// $NON-NLS-1$ //$NON-NLS-2$
    "</h2></td></tr>\n<tr><td>");
    String serviceDescription = axisService.getDocumentation();
    if (serviceDescription == null || "".equals(serviceDescription)) {
        // $NON-NLS-1$
        // $NON-NLS-1$
        serviceDescription = Messages.getInstance().getString("WebServicePlugin.USER_NO_DESCRIPTION");
    }
    // write out the description
    // $NON-NLS-1$
    sb.append(Messages.getInstance().getString("WebServicePlugin.USER_SERVICE_DESCRIPTION")).append(// $NON-NLS-1$
    "</td><td>").append(serviceDescription).append(// $NON-NLS-1$
    "</td></tr>\n");
    // write out the enable/disable controls
    // $NON-NLS-1$ //$NON-NLS-2$
    sb.append("<tr><td>").append(Messages.getInstance().getString("WebServicePlugin.USER_SERVICE_STATUS")).append(// $NON-NLS-1$
    "</td><td>");
    if (axisService.isActive()) {
        // $NON-NLS-1$
        sb.append(Messages.getInstance().getString("WebServicePlugin.USER_ENABLED"));
    } else {
        // $NON-NLS-1$
        sb.append(Messages.getInstance().getString("WebServicePlugin.USER_DISABLED"));
    }
}
Also used : IServiceConfig(org.pentaho.platform.api.engine.IServiceConfig)

Example 3 with IServiceConfig

use of org.pentaho.platform.api.engine.IServiceConfig in project pentaho-platform by pentaho.

the class DefaultServiceManagerTest method testGetServiceConfig.

@Test
public void testGetServiceConfig() throws ServiceException {
    testServiceRegistration();
    IServiceConfig config = serviceManager.getServiceConfig("gwt", "testId");
    assertNotNull(config);
    assertEquals("testId", config.getId());
    assertEquals(EchoServiceBean.class, config.getServiceClass());
    assertEquals("gwt", config.getServiceType());
}
Also used : IServiceConfig(org.pentaho.platform.api.engine.IServiceConfig) Test(org.junit.Test)

Example 4 with IServiceConfig

use of org.pentaho.platform.api.engine.IServiceConfig in project pentaho-platform by pentaho.

the class AbstractAxisConfigurator method loadServices.

/**
 * Load the web services from the list of web service wrappers
 */
public void loadServices() {
    // JD - only setup the Axis services once
    if (loaded) {
        // we have done this already
        return;
    }
    List<IServiceConfig> wsDfns = getWebServiceDefinitions();
    for (IServiceConfig wsDef : wsDfns) {
        try {
            loadService(wsDef);
        } catch (Exception e) {
            // Axis cannot handle a typed exception from this method, we must just log the error and continue on
            Logger.error(getClass().getName(), Messages.getInstance().getErrorString("AbstractAxisConfigurator.ERROR_0001_COULD_NOT_LOAD_SERVICE", wsDef.getId()), // $NON-NLS-1$
            e);
        }
    }
    loaded = true;
}
Also used : IServiceConfig(org.pentaho.platform.api.engine.IServiceConfig)

Example 5 with IServiceConfig

use of org.pentaho.platform.api.engine.IServiceConfig in project pentaho-platform by pentaho.

the class DefaultPluginManagerIT method test14_webservice_registration.

@Test
public void test14_webservice_registration() throws PlatformInitializationException {
    microPlatform.define(IPluginProvider.class, Tst14PluginProvider.class);
    microPlatform.start();
    // register the gwt service handler
    IServiceTypeManager gwtHandler = new GwtRpcServiceManager();
    DefaultServiceManager sm = (DefaultServiceManager) PentahoSystem.get(IServiceManager.class);
    sm.setServiceTypeManagers(Arrays.asList(gwtHandler));
    PluginMessageLogger.clear();
    pluginManager.reload();
    // print messages before assert so we can see what went wrong if assert fails
    System.out.println(PluginMessageLogger.prettyPrint());
    assertEquals("Errors occurred during webservice registration (see log)", 0, PluginMessageLogger.count("PluginManager.ERR"));
    // at this point we know that no errors were logged, but we need to make sure the service was registered
    // with the service manager. We'll use a mock service manager to test this, since the default service manager
    // is a heavy Axis-backed impl, requiring an http server
    IServiceConfig config = gwtHandler.getServiceConfig("EchoServiceBean");
    assertNotNull("The GWT service manager should have a service registered by name 'EchoServiceBean'", config);
    assertEquals("gwt", config.getServiceType());
    assertEquals(EchoServiceBean.class, config.getServiceClass());
}
Also used : DefaultServiceManager(org.pentaho.platform.plugin.services.pluginmgr.servicemgr.DefaultServiceManager) IServiceTypeManager(org.pentaho.platform.plugin.services.pluginmgr.servicemgr.IServiceTypeManager) GwtRpcServiceManager(org.pentaho.platform.plugin.services.pluginmgr.servicemgr.GwtRpcServiceManager) IServiceManager(org.pentaho.platform.api.engine.IServiceManager) IServiceConfig(org.pentaho.platform.api.engine.IServiceConfig) Test(org.junit.Test)

Aggregations

IServiceConfig (org.pentaho.platform.api.engine.IServiceConfig)5 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 IServiceManager (org.pentaho.platform.api.engine.IServiceManager)1 DefaultServiceManager (org.pentaho.platform.plugin.services.pluginmgr.servicemgr.DefaultServiceManager)1 GwtRpcServiceManager (org.pentaho.platform.plugin.services.pluginmgr.servicemgr.GwtRpcServiceManager)1 IServiceTypeManager (org.pentaho.platform.plugin.services.pluginmgr.servicemgr.IServiceTypeManager)1