Apache CXF API

org.apache.cxf.jaxrs
Class AbstractJAXRSFactoryBean

java.lang.Object
  extended by org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
      extended by org.apache.cxf.endpoint.AbstractEndpointFactory
          extended by org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean
All Implemented Interfaces:
InterceptorProvider
Direct Known Subclasses:
JAXRSClientFactoryBean, JAXRSServerFactoryBean

public class AbstractJAXRSFactoryBean
extends AbstractEndpointFactory

Abstract bean holding functionality common for creating JAX-RS Server and Client objects.


Field Summary
protected  List<?> entityProviders
           
protected  List<String> schemaLocations
           
protected  JAXRSServiceFactoryBean serviceFactory
           
 
Fields inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory
address, bindingConfig, bindingFactory, bindingId, bus, conduitSelector, dataBinding, destinationFactory, endpointName, endpointReference, features, properties, publishedEndpointUrl, serviceName, transportId
 
Constructor Summary
protected AbstractJAXRSFactoryBean()
           
protected AbstractJAXRSFactoryBean(JAXRSServiceFactoryBean serviceFactory)
           
 
Method Summary
protected  void checkResources(boolean server)
           
protected  BindingInfo createBindingInfo()
           
protected  Endpoint createEndpoint()
           
protected  EndpointInfo createEndpointInfo()
           
 Bus getBus()
          
 List<?> getProviders()
           
 JAXRSServiceFactoryBean getServiceFactory()
          Returns the service factory
 void setBus(Bus bus)
          
protected  void setDataBindingProvider(ProviderFactory factory, Service s)
           
 void setModelBeans(List<UserResource> resources)
          Sets the description of root resources.
 void setModelBeans(UserResource... resources)
          Sets the description of root resources.
 void setModelBeansWithServiceClass(List<UserResource> resources, Class<?>... sClasses)
          Sets the description of root resources with the list of concrete classes.
 void setModelRef(String modelRef)
          Sets a reference to the external user model, Example: "classpath:/model/resources.xml"
 void setModelRefWithServiceClass(String modelRef, Class<?>... sClasses)
          Sets a reference to the external user model, Example: "classpath:/model/resources.xml".
 void setProvider(Object provider)
          Sets a custom JAX-RS provider.
 void setProviders(List<? extends Object> providers)
          Sets custom JAX-RS providers.
 void setSchemaLocation(String schema)
          Sets the location of the schema which can be used to validate the incoming XML or JAXB-driven JSON.
 void setSchemaLocations(List<String> schemas)
          Sets the locations of the schemas which can be used to validate the incoming XML or JAXB-driven JSON.
 void setServiceFactory(JAXRSServiceFactoryBean serviceFactory)
          Sets the custom service factory which processes the registered classes and providers
 void setServiceName(QName name)
          
protected  ProviderFactory setupFactory(Endpoint ep)
           
 
Methods inherited from class org.apache.cxf.endpoint.AbstractEndpointFactory
checkPrivateEndpoint, getAddress, getBindingConfig, getBindingFactory, getBindingId, getConduitSelector, getDataBinding, getDestinationFactory, getEndpointName, getFeatures, getProperties, getProperties, getPublishedEndpointUrl, getServiceName, getTransportId, initializeAnnotationInterceptors, initializeAnnotationInterceptors, initializeAnnotationInterceptors, setAddress, setBindingConfig, setBindingFactory, setBindingId, setConduitSelector, setDataBinding, setDestinationFactory, setEndpointName, setEndpointReference, setFeatures, setProperties, setPublishedEndpointUrl, setTransportId
 
Methods inherited from class org.apache.cxf.interceptor.AbstractBasicInterceptorProvider
getInFaultInterceptors, getInInterceptors, getOutFaultInterceptors, getOutInterceptors, setInFaultInterceptors, setInInterceptors, setOutFaultInterceptors, setOutInterceptors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schemaLocations

protected List<String> schemaLocations

serviceFactory

protected JAXRSServiceFactoryBean serviceFactory

entityProviders

protected List<?> entityProviders
Constructor Detail

AbstractJAXRSFactoryBean

protected AbstractJAXRSFactoryBean()

AbstractJAXRSFactoryBean

protected AbstractJAXRSFactoryBean(JAXRSServiceFactoryBean serviceFactory)
Method Detail

getBus

public Bus getBus()

Overrides:
getBus in class AbstractEndpointFactory

setServiceName

public void setServiceName(QName name)

Overrides:
setServiceName in class AbstractEndpointFactory

setBus

public void setBus(Bus bus)

Overrides:
setBus in class AbstractEndpointFactory

createEndpointInfo

protected EndpointInfo createEndpointInfo()
                                   throws BusException
Specified by:
createEndpointInfo in class AbstractEndpointFactory
Throws:
BusException

createBindingInfo

protected BindingInfo createBindingInfo()
Specified by:
createBindingInfo in class AbstractEndpointFactory

getServiceFactory

public JAXRSServiceFactoryBean getServiceFactory()
Returns the service factory

Returns:
the factory

setServiceFactory

public void setServiceFactory(JAXRSServiceFactoryBean serviceFactory)
Sets the custom service factory which processes the registered classes and providers

Parameters:
serviceFactory - the factory

createEndpoint

protected Endpoint createEndpoint()
                           throws BusException,
                                  EndpointException
Specified by:
createEndpoint in class AbstractEndpointFactory
Throws:
BusException
EndpointException

setSchemaLocation

public void setSchemaLocation(String schema)
Sets the location of the schema which can be used to validate the incoming XML or JAXB-driven JSON. JAX-RS MessageBodyReader implementations which have the setSchemaLocations method accepting a list of schema locations will be injected with this value.

Parameters:
schema - the schema location

setSchemaLocations

public void setSchemaLocations(List<String> schemas)
Sets the locations of the schemas which can be used to validate the incoming XML or JAXB-driven JSON. JAX-RS MessageBodyReader implementations which have the setSchemaLocations method accepting a list of schema locations will be injected with this value. For example, if A.xsd imports B.xsd then both A.xsd and B.xsd need to be referenced.

Parameters:
schema - the schema locations

getProviders

public List<?> getProviders()
Returns:
the list of custom JAX-RS providers

setProviders

public void setProviders(List<? extends Object> providers)
Sets custom JAX-RS providers.

Parameters:
entityProviders - the entityProviders

setProvider

public void setProvider(Object provider)
Sets a custom JAX-RS provider.

Parameters:
provider - the custom provider.

checkResources

protected void checkResources(boolean server)

setupFactory

protected ProviderFactory setupFactory(Endpoint ep)

setDataBindingProvider

protected void setDataBindingProvider(ProviderFactory factory,
                                      Service s)

setModelBeans

public void setModelBeans(UserResource... resources)
Sets the description of root resources. Can be used to 'attach' the JAX-RS like description to the application classes without adding JAX-RS annotations.

Parameters:
resources - root resource descriptions

setModelBeans

public void setModelBeans(List<UserResource> resources)
Sets the description of root resources. Can be used to 'attach' the JAX-RS like description to the application classes without adding JAX-RS annotations.

Parameters:
resources - root resource descriptions

setModelBeansWithServiceClass

public void setModelBeansWithServiceClass(List<UserResource> resources,
                                          Class<?>... sClasses)
Sets the description of root resources with the list of concrete classes. Can be used to 'attach' the JAX-RS like description to the application classes without adding JAX-RS annotations. Some models may only reference interfaces, thus providing a list of concrete classes that will be instantiated is required in such cases.

Parameters:
resources - root resource descriptions.
sClasses - concrete root resource classes

setModelRef

public void setModelRef(String modelRef)
Sets a reference to the external user model, Example: "classpath:/model/resources.xml"

Parameters:
modelRef - the reference to the external model resource.

setModelRefWithServiceClass

public void setModelRefWithServiceClass(String modelRef,
                                        Class<?>... sClasses)
Sets a reference to the external user model, Example: "classpath:/model/resources.xml". Some models may only reference interfaces, thus providing a list of concrete classes that will be instantiated is required in such cases.

Parameters:
modelRef - the reference to the external model resource.
sClasses - concrete root resource classes

Apache CXF API

Apache CXF