com.sun.jersey.server.wadl.generators.resourcedoc
Class WadlGeneratorResourceDocSupport

java.lang.Object  extended by com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport
All Implemented Interfaces:
WadlGenerator

public class WadlGeneratorResourceDocSupport
extends java.lang.Object
implements WadlGenerator

A WadlGenerator implementation that enhances the generated wadl by information read from a resourcedoc (containing javadoc information about resource classes).

The resourcedoc information can either be provided via a File (setResourceDocFile(File)) reference or via an InputStream (setResourceDocStream(InputStream)).

The File should be used when using the maven-wadl-plugin for generating wadl offline, the InputStream should be used when the extended wadl is generated by jersey at runtime, e.g. using the WadlGeneratorConfig for configuration.

Version:
$Id: WadlGeneratorResourceDocSupport.java 5310 2011-08-29 08:19:06Z pavel_bucek $
Author:
Martin Grotzke


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.jersey.server.wadl.WadlGenerator
WadlGenerator.ExternalGrammarDefinition, WadlGenerator.Resolver
 
Constructor Summary
WadlGeneratorResourceDocSupport()
           
WadlGeneratorResourceDocSupport(WadlGenerator wadlGenerator, ResourceDocType resourceDoc)
           
 
Method Summary
 voidattachTypes(ApplicationDescription egd)
          Process the elements in the WADL definition to attach schema types as required.
 com.sun.research.ws.wadl.ApplicationcreateApplication()
           
 WadlGenerator.ExternalGrammarDefinitioncreateExternalGrammar()
          Perform any post create functions such as generating grammars.
 com.sun.research.ws.wadl.MethodcreateMethod(AbstractResource r, AbstractResourceMethod m)
           
 com.sun.research.ws.wadl.ParamcreateParam(AbstractResource r, AbstractMethod m, Parameter p)
           
 com.sun.research.ws.wadl.RequestcreateRequest(AbstractResource r, AbstractResourceMethod m)
           
 com.sun.research.ws.wadl.RepresentationcreateRequestRepresentation(AbstractResource r, AbstractResourceMethod m, MediaType mediaType)
           
 com.sun.research.ws.wadl.ResourcecreateResource(AbstractResource r, java.lang.String path)
           
 com.sun.research.ws.wadl.ResourcescreateResources()
           
 com.sun.research.ws.wadl.ResponsecreateResponse(AbstractResource r, AbstractResourceMethod m)
           
 java.lang.StringgetRequiredJaxbContextPath()
          The jaxb context path that is used when the generated wadl application is marshalled to a file.
This method is used in a decorator like manner.
The result return the path (or a colon-separated list of package names) containing jaxb-beans that are added to wadl elements by this WadlGenerator, additionally to the context path of the decorated WadlGenerator (set by WadlGenerator.setWadlGeneratorDelegate(WadlGenerator).
If you do not use custom jaxb beans, then simply return _delegate.getRequiredJaxbContextPath(), otherwise return the delegate's WadlGenerator.getRequiredJaxbContextPath() together with your required context path (separated by a colon):
 voidinit()
          Invoked before all methods related to wadl-building are invoked.
 voidsetResourceDocFile(java.io.File resourceDocFile)
          Set the resourceDocFile to the given file.
 voidsetResourceDocStream(java.io.InputStream resourceDocStream)
          Set the resourceDocStream to the given file.
 voidsetWadlGeneratorDelegate(WadlGenerator delegate)
          Sets the delegate that is decorated by this wadl generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WadlGeneratorResourceDocSupport

public WadlGeneratorResourceDocSupport()

WadlGeneratorResourceDocSupport

public WadlGeneratorResourceDocSupport(WadlGenerator wadlGenerator,                                       ResourceDocType resourceDoc)
Method Detail

setWadlGeneratorDelegate

public void setWadlGeneratorDelegate(WadlGenerator delegate)
Description copied from interface: WadlGenerator
Sets the delegate that is decorated by this wadl generator. Is invoked directly after this generator is instantiated before WadlGenerator.init() or any setter method is invoked.

Specified by:
setWadlGeneratorDelegate in interface WadlGenerator
Parameters:
delegate - the wadl generator to decorate

setResourceDocFile

public void setResourceDocFile(java.io.File resourceDocFile)
Set the resourceDocFile to the given file. Invoking this method is only allowed, as long as the resourceDocStream is not set, otherwise an IllegalStateException will be thrown.

Parameters:
resourceDocFile - the resourcedoc file to set.

setResourceDocStream

public void setResourceDocStream(java.io.InputStream resourceDocStream)
Set the resourceDocStream to the given file. Invoking this method is only allowed, as long as the resourceDocFile is not set, otherwise an IllegalStateException will be thrown.

The resourcedoc stream must be closed by the client providing the stream.

Parameters:
resourceDocStream - the resourcedoc stream to set.

init

public void init()          throws java.lang.Exception
Description copied from interface: WadlGenerator
Invoked before all methods related to wadl-building are invoked. This method is used in a decorator like manner, and therefore has to invoke this.delegate.init().

Specified by:
init in interface WadlGenerator
Throws:
java.lang.Exception

getRequiredJaxbContextPath

public java.lang.String getRequiredJaxbContextPath()
Description copied from interface: WadlGenerator
The jaxb context path that is used when the generated wadl application is marshalled to a file.
This method is used in a decorator like manner.
The result return the path (or a colon-separated list of package names) containing jaxb-beans that are added to wadl elements by this WadlGenerator, additionally to the context path of the decorated WadlGenerator (set by WadlGenerator.setWadlGeneratorDelegate(WadlGenerator).
If you do not use custom jaxb beans, then simply return _delegate.getRequiredJaxbContextPath(), otherwise return the delegate's WadlGenerator.getRequiredJaxbContextPath() together with your required context path (separated by a colon):
_delegate.getRequiredJaxbContextPath() == null            ? ${yourContextPath}            : _delegate.getRequiredJaxbContextPath() + ":" + ${yourContextPath};
If you add the path for your custom jaxb beans, don't forget to add an ObjectFactory (annotated with XmlRegistry) to this package.

Specified by:
getRequiredJaxbContextPath in interface WadlGenerator
Returns:
simply the WadlGenerator.getRequiredJaxbContextPath() of the delegate or the WadlGenerator.getRequiredJaxbContextPath() + ":" + ${yourContextPath}.

createApplication

public com.sun.research.ws.wadl.Application createApplication()
Specified by:
createApplication in interface WadlGenerator
Returns:
the Application created by the delegate
See Also:
WadlGenerator.createApplication()

createResource

public com.sun.research.ws.wadl.Resource createResource(AbstractResource r,                                                        java.lang.String path)
Specified by:
createResource in interface WadlGenerator
Parameters:
r -
path -
Returns:
the enhanced Resource
See Also:
WadlGenerator.createResource(com.sun.jersey.api.model.AbstractResource, java.lang.String)

createMethod

public com.sun.research.ws.wadl.Method createMethod(AbstractResource r,                                                    AbstractResourceMethod m)
Specified by:
createMethod in interface WadlGenerator
Parameters:
r -
m -
Returns:
the enhanced Method
See Also:
WadlGenerator.createMethod(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)

createRequestRepresentation

public com.sun.research.ws.wadl.Representation createRequestRepresentation(AbstractResource r,                                                                           AbstractResourceMethod m,                                                                           MediaType mediaType)
Specified by:
createRequestRepresentation in interface WadlGenerator
Parameters:
r -
m -
mediaType -
Returns:
the enhanced Representation
See Also:
WadlGenerator.createRequestRepresentation(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod, javax.ws.rs.core.MediaType)

createRequest

public com.sun.research.ws.wadl.Request createRequest(AbstractResource r,                                                      AbstractResourceMethod m)
Specified by:
createRequest in interface WadlGenerator
Parameters:
r -
m -
Returns:
the enhanced Request
See Also:
WadlGenerator.createRequest(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)

createResponse

public com.sun.research.ws.wadl.Response createResponse(AbstractResource r,                                                        AbstractResourceMethod m)
Specified by:
createResponse in interface WadlGenerator
Parameters:
r -
m -
Returns:
the enhanced Response
See Also:
WadlGenerator.createResponse(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)

createParam

public com.sun.research.ws.wadl.Param createParam(AbstractResource r,                                                  AbstractMethod m,                                                  Parameter p)
Specified by:
createParam in interface WadlGenerator
Parameters:
r -
m -
p -
Returns:
the enhanced Param
See Also:
WadlGenerator.createParam(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractMethod, com.sun.jersey.api.model.Parameter)

createResources

public com.sun.research.ws.wadl.Resources createResources()
Specified by:
createResources in interface WadlGenerator
Returns:
the Resources created by the delegate
See Also:
WadlGenerator.createResources()

createExternalGrammar

public WadlGenerator.ExternalGrammarDefinition createExternalGrammar()
Description copied from interface: WadlGenerator
Perform any post create functions such as generating grammars.

Specified by:
createExternalGrammar in interface WadlGenerator
Returns:
A map of extra files to the content of those file encoded in UTF-8

attachTypes

public void attachTypes(ApplicationDescription egd)
Description copied from interface: WadlGenerator
Process the elements in the WADL definition to attach schema types as required.

Specified by:
attachTypes in interface WadlGenerator
Parameters:
egd - The root description used to resolve these entries


Copyright © 2011
Oracle Corporation. All Rights Reserved.


NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14