The Avalon ServiceManager
The ServiceManager is part of the Avalon Framework. It replaces the deprecated ComponentManager used in ECM. The basic interface is as follows:
package org.apache.avalon.framework.service;
public interface ServiceManager
{
Object lookup( String key ) throws ServiceException;
boolean hasService( String key );
void release( Object object );
}see javadocs for more detailed information.
Supported Lookup Conventions
Given:
Service Interface = org.my.project.MyService MyService.ROLE = "org.my.project.MyService" Service Implementation #1 = org.my.project.impl.ServiceImplOne Service Implementation #1 Alias = "serviceOne" Service Implementation #2 = org.my.project.impl.ServiceImplTwo Service Implementation #2 Alias = "serviceTwo"
lookup(x) |
Returns |
ECM |
Fortress |
Phoenix |
Merlin |
Comments |
org.my.project.MyService |
|
|
|
|
|
|
org.my.project.MyService |
either 'serviceOne' or 'serviceTwo' |
|
|
|
|
|
org.my.project.MyServiceSelector |
|
|
|
|
|
|
org.my.project.MyService/serviceOne |
serviceOne |
|
|
|
|
|
org.my.project.MyService/serviceTwo |
serviceTwo |
|
|
|
|
|
serviceOne |
serviceOne |
|
|
|
|
|
serviceTwo |
serviceTwo |
|
|
|
|
|
org.my.project.MyService[] |
java.util.List(?) |
|
|
|
|
A list of all the implementations |
org.my.project.MyService{} |
java.util.Map |
|
|
|
|
A Map of all implemenations with their aliases as keys |