Package com.google.appengine.spi (2.0.0)

Support for alternate implementations of Google App Engine services. This package is not intended for use by application code.

If, for example, vendor X wanted to provide an alternate implementation of the DatastoreService, they would have to provide an implementation of com.google.appengine.api.datastore.IDatastoreServiceFactory that returns their implementation for com.google.appengine.api.datastore.DatastoreService.

Factory implementations are acquired using a FactoryProvider registered with ServiceFactoryFactory. These providers are typically discovered using java.util.ServiceLoader; see com.google.appengine.spi.ServiceFactoryFactory for details.

This package includes the utility (ServiceProvider for inserting the appropriate "service" entries into a jar file.

Classes

FactoryProvider<I>

A base class for service factory creation that can be registered with the ProviderRegistry.

ServiceFactoryFactory

This class is not intended for end users.

Provide factory instances for AppEngine APIs. Each API will have an associated FactoryProvider registered with this class. N.B. Once <xref uid="com.google.appengine.spi.ServiceFactoryFactory.

To construct the runtime mapping, this class first uses java.util.ServiceLoader to find all registered FactoryProvider entities using the ClassLoader of ServiceFactoryFactory. Finally, the explicitly registered providers <xref uid="com.google.appengine.spi.ServiceFactoryFactory.register(com.google.appengine.spi.FactoryProvider<I>)" data-throw-if-not-resolved="false">#register(FactoryProvider) are merged in.

If ServiceLoader locates multiple providers for a given factory interface, the ambiguity can be resolved by using the ServiceProvider#precedence annotation property (higher precedence wins; the google implementations all have precedence Integer.MIN_VALUE). An exception is raised if the ambiguity cannot be resolved. Note that explicit registration (<xref uid="com.google.appengine.spi.ServiceFactoryFactory.register(com.google.appengine.spi.FactoryProvider<I>)" data-throw-if-not-resolved="false">#register(FactoryProvider)) always takes precedence (it does not honor the ServiceProvider#precedence annotation property).

ServicesFile

A helper class for reading and writing Services files. See Also: java.util.ServiceLoader

Annotation Types

ServiceProvider

Specifies the precedence that ServiceFactoryFactory gives to the annotated FactoryProvider.