Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openxri.server.impl
Class AbstractServer

    java.lang.Object
      org.openxri.config.impl.AbstractComponent
          org.openxri.server.impl.AbstractServer

All Implemented Interfaces:
  java.io.Serializable, Component, Server

Direct Known Subclasses:
  BasicServer

    public abstract class AbstractServer

extends AbstractComponent
implements Server

Provides a starting point for Server implementations. Subclasses are relieved from the task of looking up authorities and retrieving information from the store. They only have to adjust the individual XRDs as well as the final XRDS descriptor by implementing initXRDS(), initXRD(), finishXRD() and finishXRDS() Subclasses are expected to add 'non-static' descriptor features that are not in the store, such as Expires and Status elements.

Author:
  =peacekeeper
See Also:
  `BasicServer`, Serialized Form

Field Summary
`protected static org.apache.commons.logging.Log` | `log`
`protected Store` | `store`

Fields inherited from class org.openxri.config.impl.AbstractComponent
`properties`

Constructor Summary
`AbstractServer(java.util.Properties properties)`

Method Summary
`protected abstract void` | `finishXRD(XRD xrd, Authority parent, SubSegment subSegment, Authority authority, boolean signed)` Called before the server adds the XRD to the XRDS and moves on to the next authority.
`protected abstract void` | `finishXRDS(XRDS xrds, java.lang.String query, boolean signed)` Called before the XRDS is sent out by the server.
`void` | `init()` Initialize base-class attributes from configuration.
`protected abstract boolean` | `initXRD(XRD xrd, Authority parent, java.lang.String subSegmentName, boolean signed)` Called before anything is added to a fresh XRD.
`protected abstract boolean` | `initXRDS(XRDS xrds, java.lang.String query, boolean signed)` Called before the server starts processing the request.
`XRDS` | `lookupByNamespace(java.lang.String namespace, java.lang.String query, boolean signed)` Obtains an XRDS for an XRI segment.
`XRDS` | `lookupByPath(java.lang.String path, boolean signed)` Obtains an XRDS for a path.
`XRDS` | `lookupSelfDescribing(java.lang.String namespace, boolean signed)` Obtains a self-describing XRDS for a root namespace.
`static XRD` | `makeExceptionXrd(java.lang.String subSegmentName, java.lang.Exception ex)`
`static XRD` | `makeNotFoundXrd(java.lang.String subSegmentName)`

Methods inherited from class org.openxri.config.impl.AbstractComponent
`getProperties`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.openxri.config.Component
`getProperties`

Field Detail

### log

    protected static org.apache.commons.logging.Log log

### store

    protected Store store

Constructor Detail

### AbstractServer

    public AbstractServer(java.util.Properties properties)

Method Detail

### init

    public void init()

  Initialize base-class attributes from configuration.

  Specified by:
    `init` in interface `Component`
  Parameters:
    `oConfig` - The server configuration interface to initialize with

### lookupSelfDescribing

    public XRDS lookupSelfDescribing(java.lang.String namespace,
                                     boolean signed)
                              throws ServerException

  Description copied from interface: `Server`
  Obtains a self-describing XRDS for a root namespace. This is called if the URIMapper was able to only extract a namespace from the request, but no query.

  Specified by:
    `lookupSelfDescribing` in interface `Server`
  Parameters:
    `namespace` - The root namespace.
    `signed` - Whether or not a signed descriptor is requested.
  Returns:
    The completed XRDS ready to be sent to the client
  Throws:
    `ServerException`

### lookupByNamespace

    public XRDS lookupByNamespace(java.lang.String namespace,
                                  java.lang.String query,
                                  boolean signed)
                           throws ServerException

  Description copied from interface: `Server`
  Obtains an XRDS for an XRI segment. This is called if the URIMapper was able to extract a namespace and a query from the request.

  Specified by:
    `lookupByNamespace` in interface `Server`
  Parameters:
    `namespace` - The root namespace of the segment.
    `query` - The segment to resolve.
    `signed` - Whether or not a signed descriptor is requested.
  Returns:
    The completed XRDS ready to be sent to the client
  Throws:
    `ServerException`

### lookupByPath

    public XRDS lookupByPath(java.lang.String path,
                             boolean signed)
                      throws ServerException

  Description copied from interface: `Server`
  Obtains an XRDS for a path. This is called if the URIMapper was not even able to extract a namespace from the request.

  Specified by:
    `lookupByPath` in interface `Server`
  Parameters:
    `path` - The HTTP path of the request.
    `signed` - Whether or not a signed descriptor is requested.
  Returns:
    The completed XRDS ready to be sent to the client
  Throws:
    `ServerException`

### makeNotFoundXrd

    public static XRD makeNotFoundXrd(java.lang.String subSegmentName)

### makeExceptionXrd

    public static XRD makeExceptionXrd(java.lang.String subSegmentName,
                                       java.lang.Exception ex)

### initXRDS

    protected abstract boolean initXRDS(XRDS xrds,
                                        java.lang.String query,
                                        boolean signed)
                                 throws ServerInternalException

  Called before the server starts processing the request.

  Parameters:
    `xrds` - - A blank XRDS which we will complete.
    `query` - - The original XRI segment for which the request was made.
    `signed` - - Whether we are expected to return a signed descriptor.
  Returns:
    If true, the AbstractServer will not add anything to the XRDS and send it out immediately.
  Throws:
    `ServerInternalException`

### finishXRDS

    protected abstract void finishXRDS(XRDS xrds,
                                       java.lang.String query,
                                       boolean signed)
                                throws ServerInternalException

  Called before the XRDS is sent out by the server.

  Parameters:
    `xrds` - - The XRDS filled with all XRDs.
    `query` - - The original XRI segment for which the request was made.
    `signed` - - Whether we are expected to return a signed descriptor.
  Throws:
    `ServerInternalException`

### initXRD

    protected abstract boolean initXRD(XRD xrd,
                                       Authority parent,
                                       java.lang.String subSegmentName,
                                       boolean signed)
                                throws ServerInternalException

  Called before anything is added to a fresh XRD.

  Parameters:
    `xrd` - - A blank XRD which we will fill.
    `parent` - - The authority describing this XRD.
    `subSegmentName` - - The name of the subsegment to be resolved.
    `signed` - - Whether we are expected to return a signed descriptor.
  Returns:
    If true, the AbstractServer will append the XRD to the XRDS and return it without any further processing.
  Throws:
    `ServerInternalException`

### finishXRD

    protected abstract void finishXRD(XRD xrd,
                                      Authority parent,
                                      SubSegment subSegment,
                                      Authority authority,
                                      boolean signed)
                               throws ServerInternalException

  Called before the server adds the XRD to the XRDS and moves on to the next authority. This method should be prepared to handle a null XRD.

  Parameters:
    `xrd` - - A filled XRD ready to be appended to the XRDS.
    `parent` - - The authority describing this XRD.
    `subSegment` - - The subsegment leading to this XRD.
    `authority` - - The authority described by this XRD.
    `signed` - - Whether we are expected to return a signed descriptor.
  Throws:
    `ServerInternalException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005-2009. All Rights Reserved.