com.sun.jersey.server.wadl.generators
Class WadlGeneratorGrammarsSupport

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

public class WadlGeneratorGrammarsSupport
extends java.lang.Object
implements WadlGenerator

This WadlGenerator adds the provided Grammars element to the generated wadl-file.

The Grammars content can either be provided via a File (setGrammarsFile(File)) reference or via an InputStream (setGrammarsStream(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.

Created on: Jun 24, 2008

Version:
$Id: WadlGeneratorGrammarsSupport.java 2356 2009-05-12 21:08:04Z magrokosmos $
Author:
Martin Grotzke

Constructor Summary
WadlGeneratorGrammarsSupport()
           
WadlGeneratorGrammarsSupport(WadlGenerator delegate, com.sun.research.ws.wadl.Grammars grammars)
           
 
Method Summary
 com.sun.research.ws.wadl.Application createApplication()
           
 com.sun.research.ws.wadl.Method createMethod(AbstractResource arg0, AbstractResourceMethod arg1)
           
 com.sun.research.ws.wadl.Param createParam(AbstractResource arg0, AbstractMethod arg1, Parameter arg2)
           
 com.sun.research.ws.wadl.Request createRequest(AbstractResource arg0, AbstractResourceMethod arg1)
           
 com.sun.research.ws.wadl.RepresentationType createRequestRepresentation(AbstractResource arg0, AbstractResourceMethod arg1, javax.ws.rs.core.MediaType arg2)
           
 com.sun.research.ws.wadl.Resource createResource(AbstractResource arg0, java.lang.String arg1)
           
 com.sun.research.ws.wadl.Resources createResources()
           
 com.sun.research.ws.wadl.Response createResponse(AbstractResource arg0, AbstractResourceMethod arg1)
           
 java.lang.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 WadlGenerator.getRequiredJaxbContextPath() together with your required context path (separated by a colon):
 void init()
          Invoked before all methods related to wadl-building are invoked.
 void setGrammarsFile(java.io.File grammarsFile)
           
 void setGrammarsStream(java.io.InputStream grammarsStream)
           
 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

WadlGeneratorGrammarsSupport

public WadlGeneratorGrammarsSupport()

WadlGeneratorGrammarsSupport

public WadlGeneratorGrammarsSupport(WadlGenerator delegate,
                                    com.sun.research.ws.wadl.Grammars grammars)
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

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}.

setGrammarsFile

public void setGrammarsFile(java.io.File grammarsFile)

setGrammarsStream

public void setGrammarsStream(java.io.InputStream grammarsStream)

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

createApplication

public com.sun.research.ws.wadl.Application createApplication()
Specified by:
createApplication in interface WadlGenerator
Returns:
See Also:
com.sun.jersey.server.impl.wadl.WadlGenerator#createApplication()

createMethod

public com.sun.research.ws.wadl.Method createMethod(AbstractResource arg0,
                                                    AbstractResourceMethod arg1)
Specified by:
createMethod in interface WadlGenerator
Parameters:
arg0 -
arg1 -
Returns:
See Also:
com.sun.jersey.server.impl.wadl.WadlGenerator#createMethod(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)

createRequest

public com.sun.research.ws.wadl.Request createRequest(AbstractResource arg0,
                                                      AbstractResourceMethod arg1)
Specified by:
createRequest in interface WadlGenerator
Parameters:
arg0 -
arg1 -
Returns:
See Also:
com.sun.jersey.server.impl.wadl.WadlGenerator#createRequest(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)

createParam

public com.sun.research.ws.wadl.Param createParam(AbstractResource arg0,
                                                  AbstractMethod arg1,
                                                  Parameter arg2)
Specified by:
createParam in interface WadlGenerator
Parameters:
arg0 -
arg1 -
arg2 -
Returns:
See Also:
com.sun.jersey.server.impl.wadl.WadlGenerator#createParam(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractMethod, com.sun.jersey.api.model.Parameter)

createRequestRepresentation

public com.sun.research.ws.wadl.RepresentationType createRequestRepresentation(AbstractResource arg0,
                                                                               AbstractResourceMethod arg1,
                                                                               javax.ws.rs.core.MediaType arg2)
Specified by:
createRequestRepresentation in interface WadlGenerator
Parameters:
arg0 -
arg1 -
arg2 -
Returns:
See Also:
com.sun.jersey.server.impl.wadl.WadlGenerator#createRequestRepresentation(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod, javax.ws.rs.core.MediaType)

createResource

public com.sun.research.ws.wadl.Resource createResource(AbstractResource arg0,
                                                        java.lang.String arg1)
Specified by:
createResource in interface WadlGenerator
Parameters:
arg0 -
arg1 -
Returns:
See Also:
com.sun.jersey.server.impl.wadl.WadlGenerator#createResource(com.sun.jersey.api.model.AbstractResource, java.lang.String)

createResources

public com.sun.research.ws.wadl.Resources createResources()
Specified by:
createResources in interface WadlGenerator
Returns:
See Also:
com.sun.jersey.server.impl.wadl.WadlGenerator#createResources()

createResponse

public com.sun.research.ws.wadl.Response createResponse(AbstractResource arg0,
                                                        AbstractResourceMethod arg1)
Specified by:
createResponse in interface WadlGenerator
Parameters:
arg0 -
arg1 -
Returns:
See Also:
com.sun.jersey.server.impl.wadl.WadlGenerator#createResponse(com.sun.jersey.api.model.AbstractResource, com.sun.jersey.api.model.AbstractResourceMethod)


Copyright © 2009 Sun Microsystems, Inc. All Rights Reserved.