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

## org.opencyc.jxta
Class Peer

    java.lang.Object
      |
      +--org.opencyc.jxta.Peer

All Implemented Interfaces:
  net.jxta.resolver.QueryHandler

public class Peer
extends java.lang.Object
implements net.jxta.resolver.QueryHandler

Provides generic jxta peer capablilities for cyc agents.

See www.jxta.org for more information on the Juxtaposition peer to peer infrastructure. OpenCyc uses the JXTA Resolver Service to pass messages to discovered JXTA peers. Between OpenCyc peers, the message content is a FIPA-OS envelope and an enclosed FIPA-OS message represented in XML format.

Author:
  Stephen L. Reed

  Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

  the license

  www.opencyc.org

  OpenCyc at SourceForge

  THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Field Summary
`protected CycAccess` | `cycAccess` CycAccess connection to the local cyc server.
`static int` | `DEFAULT_VERBOSITY` The default verbosity of the solution output.
`static java.lang.String` | `ECHO_HANDLER_NAME` A name to use to register the example handler with the Resolver service.
`static java.lang.String` | `JXTA_CREDENTIALS` JXTA credentials
`int` | `msgSerialNumber` outbound message serial number
`protected net.jxta.peergroup.PeerGroup` | `peerGroup` jxta peer group
`int` | `queryId` jxta ResolverService query id
`protected net.jxta.resolver.ResolverService` | `resolverService` jxta ResolverService
`protected int` | `verbosity` Sets verbosity of the constraint solver output.

Constructor Summary
`Peer()` Constructs a new Peer object.

Method Summary
`void` | `close()` Closes the peer's local cyc connection and disconnects the peer from JXTA.
`void` | `doResolverEcho(java.lang.String echoMessageText, int waitSeconds)` Sends the echo message to peers via the ResolverService, and displays the echo responses.
`static void` | `main(java.lang.String[] args)` Provides a main method for testing this class.
`java.lang.String` | `nextMessageId()` Returns the next message serial number identifier.
`net.jxta.protocol.ResolverResponseMsg` | `processQuery(net.jxta.protocol.ResolverQueryMsg resolverQueryMsg)` Receives the echo query from a peer, and generates the echo response.
`void` | `processResponse(net.jxta.protocol.ResolverResponseMsg resolverResponseMsg)` Processes the echo response messages.
`protected void` | `registerEchoService()` Registers the echo service.
`protected void` | `sendQuery(java.lang.String receivingPeer, net.jxta.protocol.ResolverQueryMsg resolverQueryMsg)` Sends the query to the given peer.
`void` | `setVerbosity(int verbosity)` Sets verbosity of the output.
`protected void` | `startJxta()` Starts the JXTA system and obtains a reference to the netPeerGroup.
`protected void` | `test()` Tests the Peer.

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

Field Detail

### ECHO_HANDLER_NAME

    public static final java.lang.String ECHO_HANDLER_NAME

  A name to use to register the example handler with the Resolver service.

### JXTA_CREDENTIALS

    public static final java.lang.String JXTA_CREDENTIALS

  JXTA credentials

### msgSerialNumber

    public int msgSerialNumber

  outbound message serial number

### queryId

    public int queryId

  jxta ResolverService query id

### peerGroup

    protected net.jxta.peergroup.PeerGroup peerGroup

  jxta peer group

### resolverService

    protected net.jxta.resolver.ResolverService resolverService

  jxta ResolverService

### DEFAULT_VERBOSITY

    public static final int DEFAULT_VERBOSITY

  The default verbosity of the solution output. 0 --> quiet ... 9 -> maximum diagnostic input.

### verbosity

    protected int verbosity

  Sets verbosity of the constraint solver output. 0 --> quiet ... 9 -> maximum diagnostic input.

### cycAccess

    protected CycAccess cycAccess

  CycAccess connection to the local cyc server.

Constructor Detail

### Peer

    public Peer()

  Constructs a new Peer object.

Method Detail

### close

    public void close()

  Closes the peer's local cyc connection and disconnects the peer from JXTA.

### main

    public static void main(java.lang.String[] args)

  Provides a main method for testing this class.
  Parameters:
    `args` - not used

### test

    protected void test()

  Tests the Peer.

### doResolverEcho

    public void doResolverEcho(java.lang.String echoMessageText,
                               int waitSeconds)

  Sends the echo message to peers via the ResolverService, and displays the echo responses.
  Parameters:
    `echoMessageText` - the echo message
    `waitSeconds` - seconds to wait for peer responses

### startJxta

    protected void startJxta()

  Starts the JXTA system and obtains a reference to the netPeerGroup.

### registerEchoService

    protected void registerEchoService()

  Registers the echo service.

### sendQuery

    protected void sendQuery(java.lang.String receivingPeer,
                             net.jxta.protocol.ResolverQueryMsg resolverQueryMsg)

  Sends the query to the given peer. If the peer is null, then th query is propagated.
  Parameters:
    `resolverQueryMsg` - the query
    `receivingPeer` - the peer to which the query will be sent

### processQuery

    public net.jxta.protocol.ResolverResponseMsg processQuery(net.jxta.protocol.ResolverQueryMsg resolverQueryMsg)
                                                       throws java.io.IOException,
                                                              net.jxta.exception.NoResponseException,
                                                              net.jxta.exception.DiscardQueryException,
                                                              net.jxta.exception.ResendQueryException

  Receives the echo query from a peer, and generates the echo response.
  Specified by:
    `processQuery` in interface `net.jxta.resolver.QueryHandler`
  Parameters:
    `resolverQueryMsg` - the message which this handler processes
  Returns:
    the response to this message

### processResponse

    public void processResponse(net.jxta.protocol.ResolverResponseMsg resolverResponseMsg)

  Processes the echo response messages.
  Specified by:
    `processResponse` in interface `net.jxta.resolver.QueryHandler`
  Parameters:
    `resolverResponseMsg` - the response message to a previous query.

### nextMessageId

    public java.lang.String nextMessageId()

  Returns the next message serial number identifier.
  Returns:
    the next message serial number identifier

### setVerbosity

    public void setVerbosity(int verbosity)

  Sets verbosity of the output. 0 --> quiet ... 9 -> maximum diagnostic input.
  Parameters:
    `verbosity` - 0 --> quiet ... 9 -> maximum diagnostic input

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