You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2011/01/20 13:04:16 UTC
svn commit: r1061256 - in
/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs:
AbstractJAXRSFactoryBean.java JAXRSServerFactoryBean.java
JAXRSServiceFactoryBean.java JAXRSServiceImpl.java
Author: sergeyb
Date: Thu Jan 20 12:04:15 2011
New Revision: 1061256
URL: http://svn.apache.org/viewvc?rev=1061256&view=rev
Log:
JAX-RS: Starting to add the documentation to the org.apache.cxf.jaxrs package
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java?rev=1061256&r1=1061255&r2=1061256&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java Thu Jan 20 12:04:15 2011
@@ -88,6 +88,9 @@ public class AbstractJAXRSFactoryBean ex
setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID);
}
+ /**
+ * {@inheritDoc}
+ */
public Bus getBus() {
Bus b = super.getBus();
checkBindingFactory(bus);
@@ -105,6 +108,9 @@ public class AbstractJAXRSFactoryBean ex
}
}
+ /**
+ * {@inheritDoc}
+ */
public void setBus(Bus bus) {
super.setBus(bus);
checkBindingFactory(bus);
@@ -181,10 +187,19 @@ public class AbstractJAXRSFactoryBean ex
return null;
}
+ /**
+ * Returns the service factory
+ * @return the factory
+ */
public JAXRSServiceFactoryBean getServiceFactory() {
return serviceFactory;
}
+ /**
+ * Sets the custom service factory which processes
+ * the registered classes and providers
+ * @param serviceFactory the factory
+ */
public void setServiceFactory(JAXRSServiceFactoryBean serviceFactory) {
this.serviceFactory = serviceFactory;
}
@@ -225,28 +240,53 @@ public class AbstractJAXRSFactoryBean ex
return ep;
}
+ /**
+ * 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.
+ *
+ * @param schema the schema location
+ */
public void setSchemaLocation(String schema) {
setSchemaLocations(Collections.singletonList(schema));
}
+ /**
+ * 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.
+ *
+ * @param schema the schema locations
+ */
public void setSchemaLocations(List<String> schemas) {
this.schemaLocations = schemas;
}
/**
- * @return the entityProviders
+ * @return the list of custom JAX-RS providers
*/
public List<?> getProviders() {
return entityProviders;
}
/**
- * @param entityProviders the entityProviders to set
+ * Sets custom JAX-RS providers.
+ *
+ * @param entityProviders the entityProviders
*/
public void setProviders(List<? extends Object> providers) {
this.entityProviders = providers;
}
+ /**
+ * Sets a custom JAX-RS provider.
+ *
+ * @param provider the custom provider.
+ */
public void setProvider(Object provider) {
setProviders(Collections.singletonList(provider));
}
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java?rev=1061256&r1=1061255&r2=1061256&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java Thu Jan 20 12:04:15 2011
@@ -73,14 +73,31 @@ public class JAXRSServerFactoryBean exte
super(sf);
}
+ /**
+ * Resource comparator which may be used to customize the way
+ * a root resource or resource method is selected
+ * @param rcomp comparator
+ */
public void setResourceComparator(ResourceComparator rcomp) {
rc = rcomp;
}
+ /**
+ * By default the subresources are resolved dynamically, mainly due to
+ * the JAX-RS specification allowing Objects being returned from the subresource
+ * locators. Setting this property to true enables the runtime to do the
+ * earky resolution.
+ *
+ * @param enableStatic enabling the static resolution if set to true
+ */
public void setStaticSubresourceResolution(boolean enableStatic) {
serviceFactory.setEnableStaticResolution(enableStatic);
}
-
+
+ /**
+ * Creates the JAX-RS Server instance
+ * @return the server
+ */
public Server create() {
try {
serviceFactory.setBus(getBus());
@@ -147,10 +164,22 @@ public class JAXRSServerFactoryBean exte
return new JAXRSInvoker();
}
+ /**
+ * Sets the language mappings,
+ * example, 'en' is the key and 'en-gb' is the value.
+ *
+ * @param lMaps the language mappings
+ */
public void setLanguageMappings(Map<Object, Object> lMaps) {
languageMappings = lMaps;
}
+ /**
+ * Sets the extension mappings,
+ * example, 'xml' is the key and 'text/xml' is the value.
+ *
+ * @param lMaps the extension mappings
+ */
public void setExtensionMappings(Map<Object, Object> extMaps) {
extensionMappings = extMaps;
}
@@ -159,44 +188,92 @@ public class JAXRSServerFactoryBean exte
return serviceFactory.getResourceClasses();
}
+ /**
+ * This method is used primarily by Spring handler processing
+ * the jaxrs:server/@serviceClass attribute. It delegates to
+ * setResourceClasses method accepting the array of Class parameters.
+ * @param clazz the service/resource class
+ */
public void setServiceClass(Class clazz) {
serviceFactory.setResourceClasses(clazz);
}
+ /**
+ * Sets one or more root resource classes
+ * @param classes the list of resource classes
+ */
public void setResourceClasses(List<Class> classes) {
serviceFactory.setResourceClasses(classes);
}
+ /**
+ * Sets one or more root resource classes
+ * @param classes the array of resource classes
+ */
public void setResourceClasses(Class... classes) {
serviceFactory.setResourceClasses(classes);
}
/**
- * Set the backing service bean. If this is set, JAX-RS runtime will not be
- * responsible for the lifecycle of resource classes.
+ * Sets the resource beans. If this is set then the JAX-RS runtime
+ * will not be responsible for the life-cycle of resource classes.
*
- * @return
+ * @param beans the array of resource instances
*/
public void setServiceBeanObjects(Object... beans) {
setServiceBeans(Arrays.asList(beans));
}
+
+ /**
+ * Sets the single resource bean. If this is set then the JAX-RS runtime
+ * will not be responsible for the life-cycle of resource classes.
+ *
+ * @param bean resource instance
+ */
public void setServiceBean(Object bean) {
setServiceBeans(Arrays.asList(bean));
}
+ /**
+ * Sets the resource beans. If this is set then the JAX-RS runtime
+ * will not be responsible for the life-cycle of resource classes.
+ *
+ * @param beans the list of resource instances
+ */
public void setServiceBeans(List<Object> beans) {
serviceFactory.setResourceClassesFromBeans(beans);
}
+ /**
+ * Sets the provider managing the life-cycle of the given resource class
+ * <pre>
+ * Example:
+ * setResourceProvider(BookStoreInterface.class, new SingletonResourceProvider(new BookStore()));
+ * </pre>
+ * @param c resource class
+ * @param rp resource provider
+ */
public void setResourceProvider(Class c, ResourceProvider rp) {
resourceProviders.put(c, rp);
}
+ /**
+ * Sets the provider managing the life-cycle of the resource class
+ * <pre>
+ * Example:
+ * setResourceProvider(new SingletonResourceProvider(new BookStore()));
+ * </pre>
+ * @param rp resource provider
+ */
public void setResourceProvider(ResourceProvider rp) {
setResourceProviders(CastUtils.cast(Collections.singletonList(rp), ResourceProvider.class));
}
-
+ /**
+ * Sets the list of providers managing the life-cycle of the resource classes
+ *
+ * @param rps resource providers
+ */
public void setResourceProviders(List<ResourceProvider> rps) {
for (ResourceProvider rp : rps) {
Class<?> c = rp.getResourceClass();
@@ -205,10 +282,20 @@ public class JAXRSServerFactoryBean exte
}
}
+ /**
+ * Sets the custom Invoker which can be used to customize the way
+ * the default JAX-RS invoker calls on the service bean
+ * @param invoker
+ */
public void setInvoker(Invoker invoker) {
serviceFactory.setInvoker(invoker);
}
+ /**
+ * Can be used to postpone starting the Server instance during the create() call.
+ * @param start Server instance will not be started during the create() call if set to false
+ * default is true.
+ */
public void setStart(boolean start) {
this.start = start;
}
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java?rev=1061256&r1=1061255&r2=1061256&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java Thu Jan 20 12:04:15 2011
@@ -44,7 +44,7 @@ import org.apache.cxf.service.invoker.In
/**
- * Build a JAX-RS service model from resource classes.
+ * Builds a JAX-RS service model from resource classes.
*/
public class JAXRSServiceFactoryBean extends AbstractServiceFactoryBean {
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java?rev=1061256&r1=1061255&r2=1061256&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java Thu Jan 20 12:04:15 2011
@@ -51,6 +51,10 @@ import org.apache.cxf.service.model.Oper
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.workqueue.SynchronousExecutor;
+/**
+ * The CXF Service implementation which is used
+ * to register the JAX-RS endpoint with the runtime.
+ */
public class JAXRSServiceImpl extends AbstractAttributedInterceptorProvider implements Service, Configurable {
private List<ClassResourceInfo> classResourceInfos;
private DataBinding dataBinding;