Package org.glassfish.jersey.server.wadl
Interface WadlGenerator
-
- All Known Implementing Classes:
WadlGeneratorImpl
public interface WadlGenerator
A WadlGenerator creates artifacts related to wadl. This is designed as an interface, so that several implementations can decorate existing ones. One decorator could e.g. add references to definitions within some xsd for existing representations.
Created on: Jun 16, 2008- Author:
- Martin Grotzke (martin.grotzke at freiheit.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
WadlGenerator.ExternalGrammarDefinition
And internal storage object to store the grammar definitions and any type resolvers that are created along the way.static interface
WadlGenerator.Resolver
Call back interface that the created external grammar can use to allow other parts of the code to attach the correct grammar information.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
attachTypes(ApplicationDescription description)
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()
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.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.
-
-
-
Method Detail
-
setWadlGeneratorDelegate
void setWadlGeneratorDelegate(WadlGenerator delegate)
Sets the delegate that is decorated by this wadl generator. Is invoked directly after this generator is instantiated beforeinit()
or any setter method is invoked.- Parameters:
delegate
- the wadl generator to decorate
-
init
void init() throws Exception
Invoked before all methods related to wadl-building are invoked. This method is used in a decorator like manner, and therefore has to invokethis.delegate.init()
.- Throws:
IllegalStateException
jakarta.xml.bind.JAXBException
Exception
-
getRequiredJaxbContextPath
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 bysetWadlGeneratorDelegate(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 withXmlRegistry
) to this package.- Returns:
- simply the
getRequiredJaxbContextPath()
of the delegate or thegetRequiredJaxbContextPath() + ":" + ${yourContextPath}
.
-
createApplication
Application createApplication()
-
createResources
Resources createResources()
-
createMethod
Method createMethod(Resource r, ResourceMethod m)
-
createRequest
Request createRequest(Resource r, ResourceMethod m)
-
createRequestRepresentation
Representation createRequestRepresentation(Resource r, ResourceMethod m, MediaType mediaType)
-
createResponses
List<Response> createResponses(Resource r, ResourceMethod m)
-
createParam
Param createParam(Resource r, ResourceMethod m, Parameter p)
-
createExternalGrammar
WadlGenerator.ExternalGrammarDefinition createExternalGrammar()
Perform any post create functions such as generating grammars.- Returns:
- A map of extra files to the content of those file encoded in UTF-8
-
attachTypes
void attachTypes(ApplicationDescription description)
Process the elements in the WADL definition to attach schema types as required.- Parameters:
description
- The root description used to resolve these entries
-
-