Hitachi Vantara Pentaho Community Wiki

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleIn OSGI Bundle
BundleContext cxt = ...
IContentInfo infoInstance = new ContentInfo();
HashTableHashtable props = new HashTableHashtable( { put("prop1", "value"); } );
cxt.registerService( IContentInfo.class, infoInstance, props );

...

Code Block
titlePrototypePentahoObjectReference
import static org.pentaho.platform.api.engine.IPentahoRegistrableObjectFactory.Types;
...

// Session-Based will call the IObjectCreator for each unique IPentahoSession it's called with. Subsequent calls with the same session will return the same Object
SessionBoundPentahoObjectReference sessionReference = new SessionBoundPentahoObjectReference.Builder<UUID>( UUID.class ).creator(
  new IObjectCreator<UUID>() {
    @Override public UUID create( IPentahoSession session ) {
      return UUID.randomUUID();
    }
  }).build();
PentahoSystem.registerReference( sessionReference, UUID.class );

IPentahoObjectRegistration

Both PentahoSystem.registerObject and PentahoSystem.registerReference return a IPentahoObjectRegistration handle. This can be used later to de-register the Object or Reference

Code Block
titleRegistration Handles

IPentahoObjectRegistration handle = PentahoSystem.registerObject( "Testing", Types.CLASSES );

// later when you want to remove this registration
handle.remove();
EEPluginManager

The new EEPluginManager uses these methods to store plugin objects in the PentahoSystem instead of keeping them hidden within, as was done in the DefaultPluginManager. The result is that you no longer have to make calls to the IPluginManager and can instead query the PentahoSystem:

...