org.glassfish.jersey.server.wadl.internal
Class WadlGeneratorImpl

java.lang.Object
  extended by org.glassfish.jersey.server.wadl.internal.WadlGeneratorImpl
All Implemented Interfaces:
WadlGenerator

public class WadlGeneratorImpl
extends Object
implements WadlGenerator

This WadlGenerator creates the basic wadl artifacts.
Created on: Jun 16, 2008

Author:
Martin Grotzke (martin.grotzke at freiheit.com), Miroslav Fuksa (miroslav.fuksa at oracle.com)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.glassfish.jersey.server.wadl.WadlGenerator
WadlGenerator.ExternalGrammarDefinition, WadlGenerator.Resolver
 
Constructor Summary
WadlGeneratorImpl()
           
 
Method Summary
 void attachTypes(ApplicationDescription egd)
          Process the elements in the WADL definition to attach schema types as required.
 Application createApplication()
           
 WadlGenerator.ExternalGrammarDefinition createExternalGrammar()
          Perform any post create functions such as generating grammars.
 Method createMethod(Resource r, ResourceMethod m)
           
 Param createParam(Resource r, ResourceMethod m, Parameter p)
           
 Request createRequest(Resource r, ResourceMethod m)
           
 Representation createRequestRepresentation(Resource r, ResourceMethod m, MediaType mediaType)
           
 Resource createResource(Resource r, String path)
           
 Resources createResources()
           
 Representation createResponseRepresentation(Resource r, ResourceMethod m, MediaType mediaType)
           
 List<Response> createResponses(Resource r, ResourceMethod m)
           
 String getRequiredJaxbContextPath()
          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 #getRequiredJaxbContextPath() together with your required context path (separated by a colon):
 void init()
          Invoked before all methods related to wadl-building are invoked.
 void setWadlGeneratorDelegate(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

WadlGeneratorImpl

public WadlGeneratorImpl()
Method Detail

getRequiredJaxbContextPath

public 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 #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 #getRequiredJaxbContextPath() + ":" + ${yourContextPath}.

init

public void init()
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

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

createResources

public Resources createResources()
Specified by:
createResources in interface WadlGenerator

createApplication

public Application createApplication()
Specified by:
createApplication in interface WadlGenerator

createMethod

public Method createMethod(Resource r,
                           ResourceMethod m)
Specified by:
createMethod in interface WadlGenerator

createRequestRepresentation

public Representation createRequestRepresentation(Resource r,
                                                  ResourceMethod m,
                                                  MediaType mediaType)
Specified by:
createRequestRepresentation in interface WadlGenerator

createRequest

public Request createRequest(Resource r,
                             ResourceMethod m)
Specified by:
createRequest in interface WadlGenerator

createParam

public Param createParam(Resource r,
                         ResourceMethod m,
                         Parameter p)
Specified by:
createParam in interface WadlGenerator

createResource

public Resource createResource(Resource r,
                               String path)
Specified by:
createResource in interface WadlGenerator

createResponses

public List<Response> createResponses(Resource r,
                                      ResourceMethod m)
Specified by:
createResponses in interface WadlGenerator

createResponseRepresentation

public Representation createResponseRepresentation(Resource r,
                                                   ResourceMethod m,
                                                   MediaType mediaType)

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 © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.