org.restlet.util
Class Engine

java.lang.Object
  extended by org.restlet.util.Engine

public abstract class Engine
extends Object

Facade to the engine implementating the Restlet API. Note that this is an SPI class that is not intended for public usage.

Author:
Jerome Louvel (contact@noelios.com)

Field Summary
static String MAJOR_NUMBER
          Major version number.
static String MINOR_NUMBER
          Minor version number.
static String RELEASE_NUMBER
          Release number.
static String VERSION
          Complete version.
 
Constructor Summary
Engine()
           
 
Method Summary
abstract  Resource createDirectoryResource(Directory handler, Request request, Response response)
          Creates a directory resource.
abstract  Helper createHelper(Application application, Context parentContext)
          Creates a new helper for a given component.
abstract  Helper createHelper(Client client)
          Creates a new helper for a given client connector.
abstract  Helper createHelper(Component component)
          Creates a new helper for a given component.
abstract  Helper createHelper(Server server)
          Creates a new helper for a given server connector.
static ClassLoader getClassLoader()
          Returns a class loader to use when creating instantiating implementation classes.
static Engine getInstance()
          Returns the registered Restlet engine.
abstract  Variant getPreferredVariant(ClientInfo client, List<Variant> variants, Language defaultLanguage)
          Returns the best variant representation for a given resource according the the client preferences.
A default language is provided in case the variants don't match the client preferences.
static int hashCode(Object... objects)
          Computes the hash code of a set of objects.
abstract  void parse(Logger logger, Form form, Representation representation)
          Parses a representation into a form.
abstract  void parse(Logger logger, Form form, String queryString, CharacterSet characterSet)
          Parses an URL encoded query string into a given form.
static void setClassLoader(ClassLoader newClassloader)
          Sets a new class loader to use when creating instantiating implementation classes.
static void setInstance(Engine engine)
          Sets the registered Restlet engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAJOR_NUMBER

public static final String MAJOR_NUMBER
Major version number.

See Also:
Constant Field Values

MINOR_NUMBER

public static final String MINOR_NUMBER
Minor version number.

See Also:
Constant Field Values

RELEASE_NUMBER

public static final String RELEASE_NUMBER
Release number.

See Also:
Constant Field Values

VERSION

public static final String VERSION
Complete version.

See Also:
Constant Field Values
Constructor Detail

Engine

public Engine()
Method Detail

getClassLoader

public static ClassLoader getClassLoader()
Returns a class loader to use when creating instantiating implementation classes. By default, it reused the classloader of this Engine's class.


getInstance

public static Engine getInstance()
Returns the registered Restlet engine.

Returns:
The registered Restlet engine.

hashCode

public static int hashCode(Object... objects)
Computes the hash code of a set of objects. Follows the algorithm specified in List.hasCode().

Returns:
The hash code of a set of objects.

setClassLoader

public static void setClassLoader(ClassLoader newClassloader)
Sets a new class loader to use when creating instantiating implementation classes.

Parameters:
newClassloader - The new class loader to use.

setInstance

public static void setInstance(Engine engine)
Sets the registered Restlet engine.

Parameters:
engine - The registered Restlet engine.

createDirectoryResource

public abstract Resource createDirectoryResource(Directory handler,
                                                 Request request,
                                                 Response response)
                                          throws IOException
Creates a directory resource.

Parameters:
handler - The parent directory handler.
request - The request to handle.
response - The response to return.
Returns:
A new directory resource.
Throws:
IOException

createHelper

public abstract Helper createHelper(Application application,
                                    Context parentContext)
Creates a new helper for a given component.

Parameters:
application - The application to help.
parentContext - The parent context, typically the component's context.
Returns:
The new helper.

createHelper

public abstract Helper createHelper(Client client)
Creates a new helper for a given client connector.

Parameters:
client - The client to help.
Returns:
The new helper.

createHelper

public abstract Helper createHelper(Component component)
Creates a new helper for a given component.

Parameters:
component - The component to help.
Returns:
The new helper.

createHelper

public abstract Helper createHelper(Server server)
Creates a new helper for a given server connector.

Parameters:
server - The server to help.
Returns:
The new helper.

getPreferredVariant

public abstract Variant getPreferredVariant(ClientInfo client,
                                            List<Variant> variants,
                                            Language defaultLanguage)
Returns the best variant representation for a given resource according the the client preferences.
A default language is provided in case the variants don't match the client preferences.

Parameters:
client - The client preferences.
variants - The list of variants to compare.
defaultLanguage - The default language.
Returns:
The preferred variant.
See Also:
Apache content negotiation algorithm

parse

public abstract void parse(Logger logger,
                           Form form,
                           Representation representation)
Parses a representation into a form.

Parameters:
logger - The logger to use.
form - The target form.
representation - The representation to parse.

parse

public abstract void parse(Logger logger,
                           Form form,
                           String queryString,
                           CharacterSet characterSet)
Parses an URL encoded query string into a given form.

Parameters:
logger - The logger to use.
form - The target form.
queryString - Query string.
characterSet - The supported character encoding.


Copyright © 2005-2007 Noelios Consulting.