org.odata4j.producer.resources
Class DefaultODataProducerProvider

java.lang.Object
  extended by org.odata4j.producer.resources.DefaultODataProducerProvider
All Implemented Interfaces:
ContextResolver<ODataProducer>
Direct Known Subclasses:
ODataProducerProvider

@Provider
public class DefaultODataProducerProvider
extends Object
implements ContextResolver<ODataProducer>

Default OData producer provider.

OData producer instances can either be set statically (method setInstance) or created by a factory (ODataProducerFactory) specified by the corresponding system property (constant FACTORY_PROPNAME).

To introduce an additional container-specific setting, it is required to extend this class and override method createInstanceFromFactoryInContainerSpecificSetting. Furthermore a subclass of AbstractODataApplication has to be created to make the new provider available to the JAX-RS runtime.


Field Summary
static String FACTORY_PROPNAME
          Constant used as system property name.
 
Constructor Summary
DefaultODataProducerProvider()
           
 
Method Summary
protected  ODataProducer createInstanceFromFactoryInContainerSpecificSetting()
          Creates an OData producer instance using a factory specified in a container-specific setting.
 ODataProducer getContext(Class<?> type)
           
protected  void log(String msg)
          Helper method to log an INFO message.
protected  ODataProducer newProducerFromFactory(String factoryTypeName, Properties props)
          Helper method to create an OData producer instance from a given producer factory (ODataProducerFactory).
static void setInstance(ODataProducer producer)
          Sets the given OData producer as a static singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY_PROPNAME

public static final String FACTORY_PROPNAME
Constant used as system property name.

See Also:
Constant Field Values
Constructor Detail

DefaultODataProducerProvider

public DefaultODataProducerProvider()
Method Detail

createInstanceFromFactoryInContainerSpecificSetting

protected ODataProducer createInstanceFromFactoryInContainerSpecificSetting()
Creates an OData producer instance using a factory specified in a container-specific setting.

The default implementation returns null. Implementers can use the helper methods newProducerFromFactory and log.

Returns:
the OData producer or null if no container-specific setting exists

getContext

public final ODataProducer getContext(Class<?> type)
Specified by:
getContext in interface ContextResolver<ODataProducer>

log

protected final void log(String msg)
Helper method to log an INFO message.

Parameters:
msg - the log message

newProducerFromFactory

protected final ODataProducer newProducerFromFactory(String factoryTypeName,
                                                     Properties props)
Helper method to create an OData producer instance from a given producer factory (ODataProducerFactory).

Parameters:
factoryTypeName - the factory's type name (fully qualified)
props - the properties to use when constructing the producer
Returns:
the new producer

setInstance

public static void setInstance(ODataProducer producer)
Sets the given OData producer as a static singleton.

Parameters:
producer - the OData producer


http://odata4j.org