Getting the OsidRuntime

Summary

Use the BootLoader to bootstrap the OsidRuntimeManager to get the ball rolling.

Instantiating OSID Runtime

BootLoader bootstraps the runtime.

Getting an OSID Runtime
net.okapia.osid.kilimanjaro.BootLoader loader = new net.okapia.osid.kilimanjaro.BootLoader();
org.osid.OsidRuntimeManager runtime = loader.getRuntimeManager("myApp");

The BootLoader handles the startup of the OSID Runtime. The OSID Runtime is instantiated once. Once the OSID Runtime has been acquired, it is kept for the life of the application. The OSID Runtime is responsible for both the location and operation of other OSID Providers. Shutting down the OSID Runtime shuts down all services accessible through the OSID Runtime. 

OSID Providers using other OSID Providers

The Bootloader is only used once in any application environment. OSID Providers access the OSID Runtime through their initialize() methods.

org.osid.OsidManager
public interface org.osidOsidManager
    implements org.osid.OsidProfile {
 
    public void initialize(org.osid.OsidRuntimeManager runtime)
        throws org.osid.ConfigurationErrorException,
               org.osid.OperationFailedException;
 
    ....
}

Unless overidden, the default initialize() method for classes extending net.okapia.osid.jamocha.spi.AbstractOsidManager in the Jamocha package provides access to the OSID Runtime.

public abstract class net.okapia.osid.jamocha.spi.AbstractOsidManager
    implements org.osid.OsidManager,
               org.osid.OsidProxyManager {
 
    /**
     * 	Initializes this manager. A manager is initialized once at the time of
     *  creation.
     *
     *  @param  runtime the runtime environment
     *  @throws org.osid.ConfigurationErrorException an error with
     *          implementation configuration
     *  @throws org.osid.IllegalStateException this manager has already been
     *          initialized by the <code> OsidLoader </code>
     *  @throws org.osid.NullArgumentException <code> runtime </code> is
     *          <code> null </code>
     *  @throws org.osid.OperationFailedException unable to complete request
     */

    @OSID @Override
    public void initialize(org.osid.OsidRuntimeManager runtime)
        throws org.osid.ConfigurationErrorException,
               org.osid.OperationFailedException {

        this.runtime = runtime;
        return;
    }


    /**
     *  Gets the runtime environment.
     *
     *  @return the runtime
     */

    protected org.osid.OsidRuntimeManager getRuntime() {
	    return (this.runtime);
    }
 
    ....
}
Copyright © 2014 Okapia.