org.restlet.ext.wadl
Class WadlComponent

java.lang.Object
  extended by org.restlet.Uniform
      extended by org.restlet.Restlet
          extended by org.restlet.Component
              extended by org.restlet.ext.wadl.WadlComponent

public class WadlComponent
extends Component

Component that can automatically configure itself given a list of WADL documents. First, it creates the server connectors and the virtual hosts if needed, trying to reuse existing ones if available.

Then it creates a Restlet Application with a router as root. For each resource found in the WADL document, it tries to attach a Restlet Resource class to the router using the WADL path. It looks up the qualified name of the Resource class using the WADL "id" attribute of the "resource" elements. This is the only Restlet specific constraint on the WADL document.

Finally, it attaches the Restlet Application to the virtual host using the "base" attribute of the WADL "resources" element. Concurrency note: instances of this class or its subclasses can be invoked by several threads at the same time and therefore must be thread-safe. You should be especially careful when storing state in member variables.

Author:
Jerome Louvel

Constructor Summary
WadlComponent()
          Default constructor.
WadlComponent(Reference wadlRef)
          Constructor loading a WADL description document at a given URI.

The necessary client connectors are automatically created.
WadlComponent(Representation wadl)
          Constructor based on a given WADL description document.
WadlComponent(java.lang.String wadlUri)
          Constructor loading a WADL description document at a given URI.

The necessary client connectors are automatically created.
 
Method Summary
 WadlApplication attach(Reference wadlRef)
          Attaches an application created from a WADL description document available at a given URI reference.
 WadlApplication attach(Representation wadl)
          Attaches an application created from a WADL description document to the component.
 WadlApplication attach(java.lang.String wadlUri)
          Attaches an application created from a WADL description document available at a given URI.
static void main(java.lang.String[] args)
          Main method capable of configuring and starting a whole Restlet Component based on a list of local WADL documents URIs, for example "file:///C:/YahooSearch.wadl".

The necessary client connectors are automatically created.
 
Methods inherited from class org.restlet.Component
getClients, getDefaultHost, getHosts, getInternalRouter, getLogService, getServers, getStatusService, handle, setClients, setDefaultHost, setHosts, setInternalRouter, setLogService, setServers, setStatusService, start, startClients, startHelper, startServers, startServices, stop, stopClients, stopHelper, stopServers, stopServices, updateHosts
 
Methods inherited from class org.restlet.Restlet
getApplication, getContext, getLogger, init, isStarted, isStopped, setContext
 
Methods inherited from class org.restlet.Uniform
delete, delete, get, get, handle, head, head, options, options, post, post, put, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WadlComponent

public WadlComponent()
Default constructor.


WadlComponent

public WadlComponent(Reference wadlRef)
Constructor loading a WADL description document at a given URI.

The necessary client connectors are automatically created.

Parameters:
wadlRef - The URI reference to the WADL description document.

WadlComponent

public WadlComponent(Representation wadl)
Constructor based on a given WADL description document.

Parameters:
wadl - The WADL description document.

WadlComponent

public WadlComponent(java.lang.String wadlUri)
Constructor loading a WADL description document at a given URI.

The necessary client connectors are automatically created.

Parameters:
wadlUri - The URI to the WADL description document.
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main method capable of configuring and starting a whole Restlet Component based on a list of local WADL documents URIs, for example "file:///C:/YahooSearch.wadl".

The necessary client connectors are automatically created.

Parameters:
args - List of local WADL document URIs.
Throws:
java.lang.Exception

attach

public WadlApplication attach(Reference wadlRef)
Attaches an application created from a WADL description document available at a given URI reference.

Parameters:
wadlRef - The URI reference to the WADL description document.
Returns:
The created WADL application.

attach

public WadlApplication attach(Representation wadl)
Attaches an application created from a WADL description document to the component.

Parameters:
wadl - The WADL description document.
Returns:
The created WADL application.

attach

public WadlApplication attach(java.lang.String wadlUri)
Attaches an application created from a WADL description document available at a given URI.

Parameters:
wadlUri - The URI to the WADL description document.
Returns:
The created WADL application.


Copyright © 2005-2008 Noelios Technologies.