Versions Compared

Key

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

Summary

OSID Providers are accessed through the OSID Runtime.

...

From Within OSID Providers

The OsidRuntimeManager passed to an OsidManager's initialize() method should be used to instantiate other OSID Providers.

 

Code Block
titleExample Load
public class MyCalendarManager
    implements org.osid.calendaring.CalendarManagerCalendaringManager {
 
    private org.osid.logging.LoggingManager logger;
 
    @OSID @Override
    public void initialize(org.osid.OsidRuntimeManager runtime)
        throws org.osid.ConfigurationErrorException,
               org.osid.OperationFailedException {
              
        try {
            this.logger = (org.osid.logging.LoggingManager) runtime.getOsidManager(OSID.LOGGING, "my.calendar.impl",
                                                                                   net.okapia.osid.kilimanjaro.Versions.LATEST.getVersion());
        } catch (org.osid.NotFoundException nfe) {
            throw new org.osid.ConfigurationErrorException("calendaring impl not found", nfe);
        }
 
        return;
    }
 
    ....
}

The Jamocha AbstractOsidManager simplifies this a bit using it's own OSID Version and wrapping NotFoundExceptions. However, there's nothing wrong with rolling your own to deal with specific compatibility issues.

 

Code Block
titleExample Load using AbstractOsidManager
public class MyCalendarManager
    extends net.okapia.osid.jamocha.calendaring.spi.AbstractCalendaringManager
    implements org.osid.calendaring.CalendarManagerCalendaringManager {
 
    private org.osid.logging.LoggingManager logger;
 
    @OSID @Override
    public void initialize(org.osid.OsidRuntimeManager runtime)
        throws org.osid.ConfigurationErrorException,
               org.osid.OperationFailedException {
             
        super.initialize(runtime); 
        this.logger = (org.osid.logging.LoggingManager) getOsidManager(OSID.LOGGING, "my.calendar.impl");
		return;
    }
 
    ....
}

Breaking the Chain

Use the OsidRuntimeManager passed through the OsidManager's initialize() method. Kilimanjaro is essentially a souped up ClassLoader. However, there might be special circumstances where loading OSID Providers through other OSID Runtime Providers is warranted.

  • accessing an implementation of OSID Runtime to access OSID Providers and their configurations remotely
  • accessing an implementation of OSID Runtime that changes the search path and/or configuration location

In both these cases, you probably want to preserve the "chain" by falling back to the current OSID Runtime.