ServiceFactory (Java Card API, Connected Edition)
Date: 2009-12-11

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javacardx.facilities
Interface ServiceFactory

    public interface ServiceFactory

Classes implementing the ServiceFactory interface are used by applications which want to expose SIO-based services to applications.

Service-providing (server) applications register `ServiceFactory` objects which when looked up by client applications are invoked by the registry to create instances of the requested services.

When a service factory object is looked up, the registry invokes its `create` method with three parameters:

- the canonicalized (resolved and normalized) service URI used for lookup.
- the additional optional lookup parameter passed by the client application.

The service factory may use any of these parameters to further qualify the service SIO to be returned to the client application.

A ServiceFactory object remains - while registered - bound to the context of the application which created it. Therefore service objects created by the factory are bound to that same context.

A service factory is not required to return a new service SIO instance at each call. Some services may be singletons - such as Global Card Holder Authenticators - and the same object or objects may be returned over several invocations.

The same service factory object may be registered under multiple service URI which may be concurrently looked up. In such as a case, the `create` method of the service factory must properly account for thread safety.

Since:
  Java Card 3.0
See Also:
  `ServiceRegistry`, `Shareable`

Method Summary
`Shareable` | `create(String serviceURI, Object parameter)` Invoked by the service registry to create this service Shareable Interface Object.

Method Detail

### create

    Shareable create(String serviceURI,
                     Object parameter)

  Invoked by the service registry to create this service Shareable Interface Object. The service factory may use any of the provided parameters to properly qualify the service object to be returned to the client application. Additionally, the service factory may perform any security check based on these parameters.

  Parameters:
    `serviceURI` - the canonicalized URI of the looked up service (which matched the URI of this registered service factory).
    `parameter` - the additional optional lookup parameter passed by the client application to the `ServiceRegistry.lookup(java.lang.String, java.lang.Object)` or `ServiceRegistry.lookup(java.lang.String, java.lang.String, java.lang.Object)` methods. The value of this parameter should typically be an SIO or a "implicitly transferable" object.
  Returns:
    the Shareable Interface Object of the service.
  Throws:
    `SecurityException` - if the service factory denies the permission to create the service objects or access to the parameter object is denied.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.