Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.PluginServiceDefinition


  protected void processWebservices( PlatformPlugin plugin, Document doc ) {
    List<?> nodes = doc.selectNodes( "//webservice" ); //$NON-NLS-1$
    for ( Object obj : nodes ) {
      Element node = (Element) obj;

      PluginServiceDefinition pws = new PluginServiceDefinition();

      pws.setId( getProperty( node, "id" ) ); //$NON-NLS-1$
      String type = getProperty( node, "type" ); //$NON-NLS-1$
      if ( !StringUtils.isEmpty( type ) ) {
        pws.setTypes( type.split( "," ) ); //$NON-NLS-1$
      }
      pws.setTitle( getProperty( node, "title" ) ); //$NON-NLS-1$
      pws.setDescription( getProperty( node, "description" ) ); //$NON-NLS-1$

      // TODO: add support for inline service class definition
      pws.setServiceBeanId( getProperty( node, "ref" ) ); //$NON-NLS-1$
      pws.setServiceClass( getProperty( node, "class" ) ); //$NON-NLS-1$

      Collection<String> extraClasses = new ArrayList<String>();
      List<?> extraNodes = node.selectNodes( "extra" ); //$NON-NLS-1$
      for ( Object extra : extraNodes ) {
        Element extraElement = (Element) extra;
        String extraClass = getProperty( extraElement, "class" ); //$NON-NLS-1$
        if ( extraClasses != null ) {
          extraClasses.add( extraClass );
        }
      }
      pws.setExtraClasses( extraClasses );

      if ( pws.getServiceBeanId() == null && pws.getServiceClass() == null ) {
        PluginMessageLogger.add( Messages.getInstance().getString( "PluginManager.NO_SERVICE_CLASS_FOUND" ) ); //$NON-NLS-1$
      } else {
        plugin.addWebservice( pws );
      }
    }
View Full Code Here


      cg2.setType( "ws-wsdl" ); // type is used as the key to verify that there is a cg that can handle a wsdl request
      cg2.setTitle( "Mock WSDL generator" );
      cg2.setClassname( "org.pentaho.test.platform.plugin.pluginmgr.ContentGenerator1" );
      p.addContentGenerator( cg2 );

      PluginServiceDefinition ws = new PluginServiceDefinition();
      ws.setId( "echoService" );
      ws.setServiceClass( EchoServiceBean.class.getName() );
      ws.setTypes( new String[] { "xml" } );
      ws.setTitle( "junit echo service" );
      p.addWebservice( ws );

      return Arrays.asList( (IPlatformPlugin) p );
    }
View Full Code Here

    Collection<PluginServiceDefinition> webservices = plugin.getServices();

    Object wsobj = CollectionUtils.find( webservices, new Predicate() {
      public boolean evaluate( Object object ) {
        PluginServiceDefinition ws = (PluginServiceDefinition) object;
        boolean ret = ws.getTitle().equals( "%TestWS1.TITLE%" );
        return ret;
      }
    } );

    assertNotNull( "Webservice \"%TestWS1.TITLE%\" should have been loaded", wsobj );

    PluginServiceDefinition wsDfn = (PluginServiceDefinition) wsobj;

    assertEquals( "org.pentaho.test.platform.engine.core.EchoServiceBean", wsDfn.getServiceClass() );
    assertEquals( "xml", wsDfn.getTypes()[0] );
    assertEquals( "gwt", wsDfn.getTypes()[1] );
    assertEquals( "A test webservice", wsDfn.getDescription() );
    assertEquals( 1, wsDfn.getExtraClasses().size() );
    assertEquals( "java.lang.String", wsDfn.getExtraClasses().iterator().next() );
  }
View Full Code Here

  public static class Tst11PluginProvider implements IPluginProvider {
    public List<IPlatformPlugin> getPlugins( IPentahoSession session ) throws PlatformPluginRegistrationException {
      PlatformPlugin p = new PlatformPlugin();
      p.setId( "test11Plugin" );
      PluginServiceDefinition pws = new PluginServiceDefinition();
      pws.setTitle( "ws11title" );
      pws.setDescription( "ws11description" );
      pws.setServiceBeanId( "org.pentaho.test.platform.engine.core.EchoServiceBean" );
      p.addWebservice( pws );

      // defining bean with null id, the classname will be used as the id
      p.addBean( new PluginBeanDefinition( null, "org.pentaho.test.platform.engine.core.EchoServiceBean" ) );
View Full Code Here

  public static class Tst14PluginProvider implements IPluginProvider {
    public List<IPlatformPlugin> getPlugins( IPentahoSession session ) throws PlatformPluginRegistrationException {
      PlatformPlugin p = new PlatformPlugin();
      p.setId( "test14Plugin" );
      PluginServiceDefinition pws = new PluginServiceDefinition();
      pws.setTypes( new String[] { "gwt" } );
      pws.setTitle( "ws14title" );
      pws.setDescription( "ws14description" );
      pws.setServiceClass( "org.pentaho.test.platform.engine.core.EchoServiceBean" );
      p.addWebservice( pws );

      return Arrays.asList( (IPlatformPlugin) p );
    }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.PluginServiceDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.