PageBoxLib
Class ActiveNaming

java.lang.Object
  extended byPageBoxLib.ActiveNaming
All Implemented Interfaces:
TokenCallbackIF

class ActiveNaming
extends java.lang.Object
implements TokenCallbackIF

Active Naming implementation. One ActiveNaming object per archive.

alexis.grandemange@pagebox.net

Changes:

Copyright (c) 2002-2004 Alexis Grandemange

This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public License
 as published by the Free Software Foundation; version 2.1 of the
 License.
 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU Lesser General Public License for more details.
 A copy of the GNU Lesser General Public License lesser.txt should be
 included in the distribution.

Version:
0, 0, 13
Author:
Alexis Grandemange

Field Summary
(package private)  java.util.HashMap foreignEntries
          Entry map. Key: PageBox URL Value: ActiveMessage
(package private)  APIImpl impl
          Handle on the API implementation
(package private)  boolean isRegistered
          True if registered on the ring because of a login
(package private)  java.util.HashMap localEntries
          Entry map. Key: Entry name Value: ActiveEntry object
(package private)  TokenCallbackImpl.Sender sender
          Token sender
 
Constructor Summary
(package private) ActiveNaming(APIImpl impl)
          Constructor.
 
Method Summary
(package private)  void addEntry(java.lang.String name, java.io.Serializable must, ActiveComparable niceif, java.lang.String url)
          Adds or replace an entry.
 java.io.Serializable call(java.lang.String from, java.lang.String type, int corrid, java.io.Serializable data)
          TokenCallbackIF method.
(package private)  void clearEntries()
          Removes all the archive entries.
(package private)  java.lang.String getCandidate(java.lang.String name, java.io.Serializable must, ActiveComparable niceif)
          Returns a candidate.
(package private)  java.lang.String[] getEntries()
          Active Naming method.
(package private)  void logoff()
          Active Naming method.
(package private)  void logon()
          Active Naming method.
 void poll()
          TokenCallbackIF method.
(package private)  void removeEntry(java.lang.String name)
          Removes an entry.
 void response(java.lang.String type, int corrid, java.util.Map codes)
          TokenCallbackIF method.
 void setSender(TokenSendIF tsi)
          TokenCallbackIF method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

impl

APIImpl impl
Handle on the API implementation


localEntries

java.util.HashMap localEntries
Entry map.


foreignEntries

java.util.HashMap foreignEntries
Entry map.


sender

TokenCallbackImpl.Sender sender
Token sender


isRegistered

boolean isRegistered
True if registered on the ring because of a login

Constructor Detail

ActiveNaming

ActiveNaming(APIImpl impl)
Constructor.

Parameters:
impl - handle on the API implementation
Method Detail

logon

void logon()
Active Naming method. Client method. Register to the ring to get ActiveNaming data.


logoff

void logoff()
Active Naming method. Client method. Unregister to the ring to stop getting ActiveNaming data.


getEntries

java.lang.String[] getEntries()
Active Naming method. Client method. List entry points.

Returns:
array of entry logical names

getCandidate

java.lang.String getCandidate(java.lang.String name,
                              java.io.Serializable must,
                              ActiveComparable niceif)
Returns a candidate. Client method.

Parameters:
name - entry name
must - imperative criteria
niceif - optional criteria
Returns:
URL of the Web service or page

addEntry

void addEntry(java.lang.String name,
              java.io.Serializable must,
              ActiveComparable niceif,
              java.lang.String url)
Adds or replace an entry. Server method.

Parameters:
name - entry name
must - imperative criteria
niceif - optional criteria
url - entry url

removeEntry

void removeEntry(java.lang.String name)
Removes an entry. Server method.

Parameters:
name - entry name

clearEntries

void clearEntries()
Removes all the archive entries. Server method.


setSender

public void setSender(TokenSendIF tsi)
TokenCallbackIF method. Server method. Called when a callback is registered.

Specified by:
setSender in interface TokenCallbackIF
Parameters:
tsi - object to use to send messages

call

public java.io.Serializable call(java.lang.String from,
                                 java.lang.String type,
                                 int corrid,
                                 java.io.Serializable data)
TokenCallbackIF method. Called when a message that targets this (target instance, archive) is received.

Specified by:
call in interface TokenCallbackIF
Parameters:
from - issuer URL
type - request type
corrid - correlation ID
data - TokenMsg data
Returns:
response message or null

poll

public void poll()
TokenCallbackIF method. Called when a frame is received by the PageBox.

Specified by:
poll in interface TokenCallbackIF

response

public void response(java.lang.String type,
                     int corrid,
                     java.util.Map codes)
TokenCallbackIF method. Called when a message comes back to its sender.

Specified by:
response in interface TokenCallbackIF
Parameters:
type - request type
corrid - correlation ID
codes - map whose key is the issuer URL and value is a Serializable object (response returned by the call method of the issuer TokenCallbackIF)