@ConfigurationDescription(properties={@Property(name="Components.GlobalRegistry",isRequired=true,description="a required sub-registry"),,,,},validator=ServiceRegistry.ConfigurationValidator.class) public abstract class ServiceRegistry extends LocalServiceRegistry implements GlobalInvocationResolver, GlobalRegistryServiceProvider
LocalServiceRegistry to support
export and publishing of local services as well as accessing remote services.
A local service is a service which runs in the same JVM and may be
accessed directly (aka. embedded) when needed. One distinguishes exported and
non-exported local services. While the LocalServiceRegistry
supports only non-exported local services, the service registry allows to
export a service, that is, a service is exported via one or more URIs
(representing different supported communication protocols) and may be
accessed via these from outside (or inside) the JVM. An exported service may
furthermore be published at a global registry. This global registry acts as a
naming service and resolves unique service names to the corresponding service
URIs. Such global URIs are resolved right before accessing the corresponding
service. The service registry chooses an appropriate URI (chosen by the
supported communication protocol) and will create a stub for the service if
required. In case the global URI refers to a local service, the service is
used directly and no stub will be created.
The counterpart of exported local services are remote services. Remote services are provided via stubs and therefore transparent for the user. The stubs are created based on a URI of the corresponding service. This may either be configured (called private remote service) or retrieved from the global registry via the service name (called public remote service). The global registry provides multiple URIs from which an appropriate one can be chosen by the supported communication protocol.
A CommunicationService needs to be provided for every
ServiceRegistry. It encapsulates a protocol stack (usually
identified by the simple instance name of a CommunicationService
) and stubs and skeletons using this protocol.
Services can be exported via ADEPT2ServiceExport-instances
provided by the CommunicationService configured for the
designated service. These service exports support the management of callbacks
which are used for asynchronous notifications of clients (in this case the
roles of client and server are inverse).
Services are managed like normal components except that they have a defined
lifecycle. Thus, their declaration resembles the declaration of components to
a large extent. They have component types (aka. service types or service
interfaces), service instances and implementation classes as well as usage
relations (c.f. InstanceToInstanceRegistry).
The instantiation mode for all services is singleton. If something else is
specified in the configuration this is logged and ignored. The implementation
class is only needed in case of a local service (c.f.
ServiceInformation). A local service instance may also have
configuration for export services and if so, an additional flag whether the
service should be published with all its URIs at the global registry. For
this, the configuration keys
and
ExportVia
are used. The values of the
PublishService
is a list of service instances of ExportViaADEPT2ServiceExport. These
instances are normal services themselves and need to be configured just like
other services.
Remote services are treated a bit differently. They just have a component
type declaration and in case of a private remote service an additional URI (
). No further configuration is needed and parsed. This disallows the (local)
exporting of remote services which does not make sense since the services are
already exported.
ServiceURI
Just like other registries, the service registry is lazy. All services are
instantiated, initialised and started as needed. This may include the
starting of other services which are required for a requested service. Of
course, only local services can be started, remote services are expected to
be running.
The laziness does not apply to exported services. All local services that are
exported as well as the required services are started at constructing time of
this registry.
There are a few system services that are expected to be present. This includes all the service instances for service exports that are used to export services with, at least one stub factory service and exactly one global registry which is either an (exported) local service or a private remote service.
The stub factory is used by this service registry to create stubs for remote
services. These have the same interface as the remote service and encapsulate
the communication. It is transparent for the client whether to use a local
(embedded) or remote service. Stubs differ from local services in not needing
to implement ADEPT2Service. This is reflected in the interface
of this service registry: local services are subtypes of
ADEPT2Service (<T extends ADEPT2Service>)
while stubs do not have a predefined type (<T>). Although
stubs will be subtypes of ADEPT2Service if the corresponding
service interface is a subtype of ADEPT2Service.
The instantiation mode does not apply to stubs. Services are singletons as
well as their corresponding skeletons (otherwise too many network resources,
for instance ports, will be used). Stubs in contrast are instantiated as
needed.
This class parses the following properties from its configuration (in
init(URI[], URI[])):
BaseConstants.COMPONENT_TYPE_COMMUNICATION_SERVICE
)ConfigurationConstants.SERVICE_EXPORT_VIA
)ConfigurationConstants.SERVICE_PUBLISH_SERVICE
)ConfigurationConstants.PROPERTY_REGISTRY_SERVICE_URI
)| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceRegistry.ConfigurationValidator
Checks the configuration of the
ServiceRegistry. |
LocalServiceRegistry.ServiceExportInformation, LocalServiceRegistry.ServiceNameResolution, LocalServiceRegistry.ServiceStarterPluginRegistry.URLClassloaderPrivilegedActionAbstractRegistry.DefaultNameResolution, AbstractRegistry.InstanceInformation, AbstractRegistry.InstantiationModeAbstractADEPT2Service.ActiveSessions| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
clusterName
The name of the cluster this registry belongs to.
|
protected GlobalRegistryCache |
globalRegCache
The cache for the global registry data, that is, service names, global and
local URIs.
|
protected java.lang.String |
hierInstName
The hierarchical instance name of this service registry.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
protocolPriority
All supported protocols (the instance names of all known communication
services) mapped to the priority of the protocol.
|
autoStartServices, failedServices, gsmAvailable, nodeName, release, serviceStarterPool, shuttingDown, startedServices, startingLock, startingRequiredServices, startingServiceusedInstancesdeclaredPluginTypes, defaultInstances, dynamicPlugins, pluginInstances, runtimePlugins, runtimePluginTypeCLs, singletonPluginscomponentInterfaces, configurationManager, declaredInstances, INIT_INSTANTIATED_OBJECT_METHOD, nameResolution, singletonInstancesCFG_EARLY_SERVICEAUTH_ORGPOSID, CFG_EARLY_SERVICEAUTH_ORGPOSNAME, CFG_EARLY_SERVICEAUTH_PASSWORD, CFG_EARLY_SERVICEAUTH_USERNAME, CFG_SERVICEAUTH_ORGPOSID, CFG_SERVICEAUTH_ORGPOSNAME, CFG_SERVICEAUTH_PASSWORD, CFG_SERVICEAUTH_USERNAMECONF_CSV_LOGGING, configuration, logger, registry, runtimeRequiredServices, startupRequiredServices| Modifier | Constructor and Description |
|---|---|
protected |
ServiceRegistry(UrlConfigurationManager confMgr,
Configuration configuration,
Registry registry)
Constructs a new service registry by calling the super constructor.
|
protected |
ServiceRegistry(UrlConfigurationManager confMgr,
Configuration configuration,
Registry registry,
SerialisablePair<java.lang.String,java.lang.String> release)
Constructs a new service registry by calling the super constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
autoStartServices()
Prepares the global security manager, authenticates this registry, provides
the data sources for the runtime configurations to the configuration
manager if appropriate, and starts all services to be automatically started
at startup of this registry.
|
protected void |
checkServiceURI(SessionToken session,
java.net.URI serviceURI)
Validates whether the designated URI is well-formed and may identify a
service instance.
|
protected java.net.URI |
chooseAppropriateURI(java.net.URI[] serviceURIs)
Chooses an appropriate URI for retrieving the service having the designated
URIs.
|
protected javax.management.ObjectName |
createMBeanName(java.lang.String serviceName)
Creates the name for the designated service to be available as MBean.
|
protected Registry |
createRegistryWrapper(java.lang.String serviceName,
boolean earlyService,
InstanceToInstanceRegistry mfRegistry,
ModelViewerProvider mvProvider)
Also provides the cluster name to the created registry wrapper.
|
protected void |
exportService(SessionToken session,
java.lang.String serviceName,
ADEPT2Service service,
LocalServiceRegistry.ServiceExportInformation serviceExportInformation)
Exports the designated service (in case of an exported service) using the
designated service export objects and the designated URIs.
|
protected CommunicationService<?,?,?,?> |
getCommunicationService(SessionToken session,
java.lang.String simpleInstanceName)
Returns the communication service with the designated instance name.
|
GlobalRegistry |
getGlobalRegistry(SessionToken session)
Returns a reference to (the default instance of) the global registry.
|
java.lang.String |
getInstanceNameFromServiceURI(java.net.URI serviceURI)
Returns the hierarchical instance name from the service URI.
|
Pair<InvocationTarget,java.net.URI> |
getInvocationTarget(java.net.URI uri)
Gets the invocation target for the designated URI.
|
protected <T extends ADEPT2Service> |
getLocallyExportedService(SessionToken session,
java.net.URI chosenUri,
java.net.URI[] serviceUris,
java.lang.Class<T> serviceType)
Gets the locally exported service identified by the designated URI.
|
protected <T extends ADEPT2Service> |
getLocalServiceObject(SessionToken session,
java.lang.String serviceName,
java.lang.Class<T> requestedType)
Returns an instance of the designated service if it is local, null
otherwise.
|
<T extends ADEPT2Service> |
getService(SessionToken session,
java.lang.String serviceName,
java.lang.Class<T> serviceType)
Returns the designated service which is either a started local service (see
LocalServiceRegistry.getService(SessionToken, String, Class))
or a service stub based on URIs
(see getService(SessionToken, URI[], Class)). |
<T extends ADEPT2Service> |
getService(SessionToken session,
java.net.URI[] serviceURIs,
java.lang.Class<T> serviceType)
Retrieves the service described by the URIs which is either a local service
(
getService(SessionToken, String, Class)) or a stub for a remote
service (getServiceStub(SessionToken, URI, Class)). |
protected ServiceInformation |
getServiceInformation(java.lang.String instanceName)
Unlike the overridden method, this method returns null instead of a
ConfigurationException since it is legal to ask for a
service that is not known locally but to the global registry. |
GlobalRegistry |
globalRegistryChanged(SessionToken session,
java.net.URI globRegUri)
Changes the URI of the (default instance of the) global registry to the
designated URI.
|
void |
init(java.net.URI[] localExportedUris,
java.net.URI[] globalExportedUris)
Checks all component interfaces to implement ADEPT2Service and reading the
own configuration.
|
protected void |
initExportServices(SessionToken session)
Starts and exports all local services that need be exported.
|
void |
invalidateGlobalRegistry()
Invalidates the global registry in case of communication problems.
|
protected LocalServiceRegistry.ServiceExportInformation |
prepareExport(SessionToken session,
java.lang.String serviceName,
ADEPT2Service service)
Prepares the export of the designated service by retrieving the
communication service for the export and the retrieving corresponding URIs
from its service export.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
prioritiseProtocols(java.util.List<java.lang.String> protocolNames)
Sets priorities for the designated names as well as the
local protocol.
|
protected void |
readMetaConfiguration(Configuration registryConfiguration,
java.lang.String componentType,
java.lang.String simpleInstanceName)
Reads the meta information from the registry for the designated service
instance, which is:
the implementing class or the implementing object for a local service
service
instances for exporting for a local service
publish service
flag for an exported local service
service URI for a
private remote service
The instantiation mode of a service is always
AbstractRegistry.InstantiationMode.SINGLETON
If something else is set in the configuration (please note that this
property may also - and in this case should - be omitted), a warning
message is logged and SINGLETON used instead. |
protected abstract Pair<java.lang.String,java.lang.String> |
resolveInstanceName(Configuration conf)
Gets the cluster and the instance name for this registry from the
designated configuration.
|
void |
start()
Allows threads waiting for the start to proceed and initialises, starts and
exports the services to be exported.
|
protected void |
unpublishService(SessionToken session,
java.lang.String serviceName,
ADEPT2Service service)
Removes the designated service from the global registry and from the
service exports.
|
checkServiceInterface, checkServiceUriSyntax, checkStartupRequiredService, createLocalServiceURI, determineNodeName, getAndCheckRequiredService, getConfiguredPlugin, getGlobalSequence, getInstantiationMode, getRegistry, getSecurityManager, getServiceForInstance, notifyDataSourceToConfMgr, prepareGlobalSecurityManager, registryActive, renewConfiguration, shutdown, startLocalService, syncExecute, terminate, terminateServicegetUsedComponentInstanceNameForInstance, getUsedObjectForInstancecreatePluginLoader, getConfiguredPlugin, getConfiguredPlugin, getConfiguredPlugins, prepareRuntimePlugin, readMetaConfigurationcheckAndStoreProvidedObject, checkConfiguration, checkImplementingClass, checkSupertype, createInstanceForInterface, getAppropriateMethod, getArbitrarilyNamedObject, getComponentType, getFormattedSignature, getHierarchicalInstanceName, getInstanceInformation, getInterfaceForComponentType, getObjectForInstanceName, getObjectForInstanceName, getObjectForInstanceName, getSimpleInstanceName, initialiseInstantiatedObject_sessionActive, authenticateService, awaitActiveSessions, createChildSession, createSession, getAgent, getSessionFactory, getStartupRequired, getTopLevelAgent, getUserCredentials, globalSecurityManagerAvailable, isEarlyService, sessionHasCapability_sessionFinished, activeOrInvalidServiceStateException, changeLogContext, changeLogContext, changeLogContext, consoleLog, csvLoggingEnabled, getClassSpecificJulLogger, getDependencyRegistry, getLocalUris, getLogger, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, isActive, isSessionActive, isShutdown, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, ping, preShutdown, privilegeSession, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionActive, sessionFinished, sessionFinished, signalShutdown, signalStart, unprivilegeThreadclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, ping, preShutdownprotected java.util.Map<java.lang.String,java.lang.Integer> protocolPriority
protected final GlobalRegistryCache globalRegCache
protected final java.lang.String clusterName
protected final java.lang.String hierInstName
protected ServiceRegistry(UrlConfigurationManager confMgr, Configuration configuration, Registry registry) throws ConfigurationException
configuration - The configuration of the created service registry instance.confMgr - The initial configuration manager that provides configurations for the loaded
component instances.registry - The parent registry of this registry.ConfigurationException - If the password cannot be parsed from the configuration, a
ConfigurationException will be thrown.protected ServiceRegistry(UrlConfigurationManager confMgr, Configuration configuration, Registry registry, SerialisablePair<java.lang.String,java.lang.String> release) throws ConfigurationException
configuration - The configuration of the created service registry instance.confMgr - The initial configuration manager that provides configurations for the loaded
component instances.registry - The parent registry of this registry. This can be null when
invoked by subclasses. But then a release has to be provided.release - If a registry is provided, the release will be taken from it. If no
registry is provided, the release has to be provided.ConfigurationException - If the password cannot be parsed from the configuration, a
ConfigurationException will be thrown.protected void readMetaConfiguration(Configuration registryConfiguration, java.lang.String componentType, java.lang.String simpleInstanceName) throws ConfigurationException
AbstractRegistry.InstantiationMode.SINGLETON
If something else is set in the configuration (please note that this
property may also - and in this case should - be omitted), a warning
message is logged and SINGLETON used instead.readMetaConfiguration in class LocalServiceRegistryregistryConfiguration - The configuration which contains the
(registry) information for the designated instance.componentType - The type of the component to retrieve the
meta-configuration.simpleInstanceName - The simple name of the component instance as
declared in the configuration.ConfigurationException - If
ADEPT2Service,getServiceURI(String, Configuration)) in case of a
private remote service,ConfigurationException will be thrown.protected void initExportServices(SessionToken session) throws AbortServiceException
session - The session which is used to check for access rights on this
method.AbortServiceException - If
AbortServiceException
while initialised or started, AbortServiceException will be thrown.protected LocalServiceRegistry.ServiceExportInformation prepareExport(SessionToken session, java.lang.String serviceName, ADEPT2Service service) throws AbortServiceException
prepareExport in class LocalServiceRegistrysession - The session which is used to check for access rights on this
method.serviceName - The name of the service to prepare the export of.service - The service object to prepare the export of.ServiceExportInformation-instance containing an
empty service export array and a local URI.ConfigurationException - If a communication service to be used for
exporting is not known, a ConfigurationException
will be thrown since the ExportVia-property is
wrong.AbortServiceException - If the preparation of the service export
fails, an AbortServiceException will be thrown.protected void exportService(SessionToken session, java.lang.String serviceName, ADEPT2Service service, LocalServiceRegistry.ServiceExportInformation serviceExportInformation) throws AbortServiceException
IMPORTANT!
exportService in class LocalServiceRegistrysession - The session which is used to check for access rights on this
method.serviceName - The hierarchical instance name of the service.service - The service object to export and publish.serviceExportInformation - The information on the export services and
the URIs to use.ConfigurationException - If the service type specified by the
hierarchical instance name is not registered, a
ConfigurationException will be thrown.AbortServiceException - If exporting the service fails, an
AbortServiceException will be thrown.InvalidServiceStateException - If
this registry failed to start or is shut down, an
InvalidServiceStateException will be thrown.protected void unpublishService(SessionToken session, java.lang.String serviceName, ADEPT2Service service)
This implementation does nothing and is only for extension in subclasses. This implementation actually removes the designated service from the global registry and from the service exports. This is needed when shutting down the service.
unpublishService in class LocalServiceRegistrysession - The session which is used to check for access rights on this
method.serviceName - The hierarchical instance name of the service to remove
from the global registry.service - The service object to remove from the global registry and
the service exports.protected void autoStartServices()
throws AbortServiceException
LocalServiceRegistryautoStartServices in class LocalServiceRegistryAbortServiceException - If there are problems preparing the security
manager or starting one of the services to be automatically
started, an AbortServiceException will be thrown.public <T extends ADEPT2Service> T getService(SessionToken session, java.lang.String serviceName, java.lang.Class<T> serviceType) throws ServiceNotKnownException
LocalServiceRegistry.getService(SessionToken, String, Class))
or a service stub based on URIs
(see getService(SessionToken, URI[], Class)). The URIs are either
the configured URI for a private remote service or the global or local ones
retrieved from the global registry. LocalServiceRegistry.checkStartupRequiredService(String)). getService in class LocalServiceRegistryT - The type which the requested service is expected to be of. This
is a subtype of ADEPT2Service and either the
registered service type or a super type hereof.session - The session which is used to check for access rights on this
method.serviceName - The hierarchical instance name of the service.serviceType - The type of which the requested service is expected to
be. This is a subtype of ADEPT2Service and either
the registered service type interface or a super type hereof.ServiceNotKnownException - If
ADEPT2Service-interface appropriately, ServiceNotKnownException will be thrown. This may
encapsulate a ConfigurationException or an
AbortServiceException.InvalidServiceStateException - If
this registry failed to start or is shut down, an
InvalidServiceStateException will be thrown.java.lang.IllegalArgumentException - If a local service is requested and the
designated service type interface is not the registered service
type interface or a super type hereof, an
IllegalArgumentException will be thrown.public <T extends ADEPT2Service> T getService(SessionToken session, java.net.URI[] serviceURIs, java.lang.Class<T> serviceType) throws ServiceNotKnownException
getService(SessionToken, String, Class)) or a stub for a remote
service (getServiceStub(SessionToken, URI, Class)). An appropriate
URI will be chosen, that is, a URI with a protocol supported by this
registry. LocalServiceRegistry.checkStartupRequiredService(String)). getService in class LocalServiceRegistryT - The type which the requested service is expected to be of. This
is a subtype of ADEPT2Service and either the
registered service type or a super type hereof.session - The session which is used to check for access rights on this
method.serviceURIs - The URIs of the service to be retrieved, the array has
to contain at least one valid service URI.serviceType - The type of which the requested service is expected to
be.ServiceNotKnownException - If
ADEPT2Service-interface appropriately, ServiceNotKnownException will be thrown. This may
encapsulate a ConfigurationException or an
AbortServiceException.InvalidServiceStateException - If
this registry failed to start or is shut down, an
InvalidServiceStateException will be thrown.NullArgumentException - If one of the parameters is null, a
NullArgumentException will be thrown.java.lang.IllegalArgumentException - If
IllegalArgumentException will be thrown.protected <T extends ADEPT2Service> T getLocallyExportedService(SessionToken session, java.net.URI chosenUri, java.net.URI[] serviceUris, java.lang.Class<T> serviceType) throws ServiceNotKnownException
null will be returned.T - The type which the requested service is expected to be of. This
is a subtype of ADEPT2Service and either the
registered service type or a super type hereof.session - The session which is used to check for access rights on this
method.chosenUri - The (local) URI that is preferred for retrieving the
service. Note that this may or may not be part of the
serviceUris.serviceUris - The URIs with which the service is requested. These are
just for logging purpose.serviceType - The type of which the requested service is expected to
be.null if the chosen URI does not refer to a service
that is locally known, that is, exported by this registry. never
null.ServiceNotKnownException - If
ADEPT2Service
-interface appropriately,ServiceNotKnownException will be thrown.public void init(java.net.URI[] localExportedUris,
java.net.URI[] globalExportedUris)
throws AbortServiceException
AbstractRegistry.init(URI[], URI[]))
before initialising and starting services. These services are allowed to
access the registry and expect it be started!init in interface ADEPT2Serviceinit in class LocalServiceRegistrylocalExportedUris - The URIs with which this service is exported
locally or a local URI or an empty array for internal services.globalExportedUris - The URIs with which this service is published
globally or null in case the service is not
published.PropertyNotSetException - If a mandatory property is not set, a
PropertyNotSetException will be thrown.ConfigurationException - If
ADEPT2Service (AbstractRegistry.checkSupertype(String, Class, Class)),
AbstractRegistry.checkConfiguration(Configuration, String, Class)),
ConfigurationException will be thrown.AbortServiceException - If
ADEPT2Service (
AbstractRegistry.checkSupertype(String, Class, Class)),AbstractRegistry.checkConfiguration(Configuration, String, Class)),ConfigurationException will be thrown.public void start()
throws AbortServiceException
start in interface ADEPT2Servicestart in class LocalServiceRegistryConfigurationException - If
ConfigurationException will be thrown.AbortServiceException - If
AbortServiceException
while initialised or started, AbortServiceException will be thrown.protected ServiceInformation getServiceInformation(java.lang.String instanceName)
ConfigurationException since it is legal to ask for a
service that is not known locally but to the global registry. declaredInstances. When iterating all of these entries there
may be some non-services!
Returns the information (component type, instantiation mode, implementation
class, service URI, export service instances and whether to publish the
service) for the designated service instance. This is the same as
AbstractRegistry.getInstanceInformation(String) but with the more specific return
type ServiceInformation.
getServiceInformation in class LocalServiceRegistryinstanceName - The hierarchical name of the service instance for which
to retrieve its information.protected Registry createRegistryWrapper(java.lang.String serviceName, boolean earlyService, InstanceToInstanceRegistry mfRegistry, ModelViewerProvider mvProvider)
Creates a Registry which is a wrapper for this registry including the service
name. It provides convenient access to a registry without the need for the service name and/or
session tokens. The created Registry is afterwards provided in the constructor of
a service which is currently created.
createRegistryWrapper in class LocalServiceRegistryserviceName - The hierarchical name of the service for which to create a registry wrapper.earlyService - Whether the service is an early service for which initially only the local
security manager is available.mfRegistry - The model factory registry to be used by the designated registry wrapper.mvProvider - The provider for model view, that are classes providing type-safe access to
plugin data. This is usually the model factory registry.Registry
-interface.protected javax.management.ObjectName createMBeanName(java.lang.String serviceName)
throws javax.management.MalformedObjectNameException
LocalServiceRegistrycreateMBeanName in class LocalServiceRegistryserviceName - The name of the service which to register as MBean.javax.management.MalformedObjectNameException - If the designated service name cannot be formatted as a
valid MBean name, a MalformedObjectNameException will be thrown.protected <T extends ADEPT2Service> T getLocalServiceObject(SessionToken session, java.lang.String serviceName, java.lang.Class<T> requestedType) throws ConfigurationException
Returns an instance of the designated service and of the requested type.
The service name has to be known to this registry, otherwise a
ConfigurationException will be thrown.
Resembles (and uses)
AbstractRegistry.getObjectForInstanceName(String, Class, Class[], Object[]).
getLocalServiceObject in class LocalServiceRegistryT - The type which the requested service is expected to be of which
is a subtype of ADEPT2Service and either the
registered service type or a super type hereof.session - The session which is used to check for access rights on this
method.serviceName - The hierarchical instance name of the service.requestedType - The type of which the requested object is expected to
be. This is a subtype of ADEPT2Service and either
the registered service type interface or a super type hereof.ConfigurationException - If
ConfigurationException will be thrown
(encapsulating an AbortServiceException in case the
registry could not be loaded).public GlobalRegistry getGlobalRegistry(SessionToken session) throws ServiceNotKnownException
adaptAndGetGlobalRegistry(SessionToken, URI) so in case
of an available global registry provider, the global registry may change.getGlobalRegistry in interface GlobalRegistryServiceProvidersession - The session which is used to check for access rights on this
method.InvalidServiceStateException - If
this registry failed to start or is shut down, an
InvalidServiceStateException will be thrown.ServiceNotKnownException - If the global registry cannot be
retrieved, an ServiceNotKnownException will be
thrown.public GlobalRegistry globalRegistryChanged(SessionToken session, java.net.URI globRegUri) throws ServiceNotKnownException
ServiceNotKnownException will be thrown. In case a global registry provider is available, this will be preferred to the designated URI.
session - The session which is used to check for access rights on this
method.globRegUri - The new URI of the global registry.ServiceNotKnownException - If the default instance of the global
registry cannot be retrieved with the new URI, a
ServiceNotKnownException will be thrown.public Pair<InvocationTarget,java.net.URI> getInvocationTarget(java.net.URI uri)
GlobalInvocationResolverServiceConnectionException will be thrown. getInvocationTarget in interface GlobalInvocationResolveruri - The URI for which to retrieve the concrete communication
service.public void invalidateGlobalRegistry()
GlobalInvocationResolverinvalidateGlobalRegistry in interface GlobalInvocationResolverprotected CommunicationService<?,?,?,?> getCommunicationService(SessionToken session, java.lang.String simpleInstanceName) throws ServiceNotKnownException
session - The session which is used to check for access rights on this
method.simpleInstanceName - The simple (non-hierarchical) instance name of
the communication service.InvalidServiceStateException - If
this registry failed to start or is shut down, an
InvalidServiceStateException will be thrown.ServiceNotKnownException - If the designated instance name does not
specify a known communication service, a
ServiceNotKnownException will be thrown.protected void checkServiceURI(SessionToken session, java.net.URI serviceURI) throws ServiceNotKnownException
checkServiceURI in class LocalServiceRegistrysession - A valid session token that authorise this method to access
the communication service designated by the given URI for check.serviceURI - The URI to check for validity.ServiceNotKnownException - If the schema of the designated URI does
not specify a known communication service, a
ServiceNotKnownException will be thrown. This
exception will never thrown by this implementation.java.lang.IllegalArgumentException - If the service URI is invalid, an
IllegalArgumentException will be thrown.protected java.util.Map<java.lang.String,java.lang.Integer> prioritiseProtocols(java.util.List<java.lang.String> protocolNames)
protocolNames - The names of the protocols (the instance names of all
known communication services) known by this registry.protected java.net.URI chooseAppropriateURI(java.net.URI[] serviceURIs)
chooseAppropriateURI in class LocalServiceRegistryserviceURIs - A list of service URIs with which a service is exported.null in case none of the protocols are
supported (none specifies a communication service known by this
registry.protected abstract Pair<java.lang.String,java.lang.String> resolveInstanceName(Configuration conf) throws ConfigurationException
Note that this method is called from the constructor and must not rely on instance fields!
conf - The configuration to retrieve the instance name from.null.ConfigurationException - If the instance name does not exist in the
configuration, a ConfigurationException will be
thrown. However, this should never happen if the configuration is
validated beforehand.public java.lang.String getInstanceNameFromServiceURI(java.net.URI serviceURI)
throws ServiceNotKnownException
Whenever the instance name needs to be derived from a services URI, this method should be called. This keeps the way, how the instance name is stored in the URI more exchangeable.
getInstanceNameFromServiceURI in class LocalServiceRegistryserviceURI - The service URI.ServiceNotKnownException - If the schema of the designated URI does
not specify a known communication service, a
ServiceNotKnownException will be thrown.java.lang.IllegalArgumentException - If the service URI is invalid for the
communication service designated by the given service URI, an
IllegalArgumentException will be thrown.