PageBoxLib
Class TokenCallbackImpl

java.lang.Object
  extended byPageBoxLib.TokenCallbackImpl

public class TokenCallbackImpl
extends java.lang.Object

Token ring receiver implementation. Designed to be stored in a context attribute.

Changes:

alexis.grandemange@pagebox.net

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, 1, 1
Author:
Alexis Grandemange

Nested Class Summary
(package private)  class TokenCallbackImpl.CallbackSender
          Stores the callback Sender association.
(package private)  class TokenCallbackImpl.RepositoryReg
          TokenCallbackImpl.callbacks entry.
(package private)  class TokenCallbackImpl.Sender
          Synchronous sender to use in callbacks.
 
Field Summary
private  java.util.TreeMap archives
          Archives currently installed Key: archive name Value: Archive object
(package private)  java.util.HashMap callbacks
          Map of PageBoxAPI callbacks.
private  int corrid
          Message correlation ID
private  Log log
          Logging object
private  java.util.LinkedList msgList
          Messages queued before the frame reception
(package private)  long netTime
          Time spent in successful frameSend requests
(package private)  java.lang.String newRepUrl
          New Repository URL
(package private)  java.lang.String oldRepUrl
          Previous Repository URL
private  RuleHandler.Rule rule
          Memory representation of rules.xml
private  java.lang.String subUrl
          URL of the DeployIF web service of the subscribed PageBox
 
Constructor Summary
(package private) TokenCallbackImpl(RuleHandler.Rule rule, Log log)
          Constructor.
 
Method Summary
(package private)  Deployer getDeployer(TokenFrame tf)
          Return the DeployIF invocation class.
(package private)  Querier getQuerier(TokenFrame tf)
          Return the RepoQueryIF invocation class.
(package private)  java.lang.String getUrl()
          Returns the URL of this PageBox DeployIF Web service.
(package private)  void processFrame(TokenFrame tf)
          Called by TokenImpl to submit a frame to processing
(package private)  void registerCallback(java.lang.String archive, TokenCallbackIF tci)
          Register a PageBoxAPI callback.
(package private)  boolean removePending()
          Remove callbacks entries with toRemove is true.
(package private)  boolean removePending(TokenFrame tf)
          Remove RepositoryReg from callbacks when toRemove is true.
(package private)  void renameRepository(java.lang.String oldRepUrl, java.lang.String newRepUrl)
          Change the repository URL.
(package private)  void retry()
          Called periodically by DynDns.
 void setUrl(java.lang.String subUrl)
          Set PageBox URL.
 void setUrl(java.lang.String subUrl, java.util.TreeMap archives)
          Set archive map and PageBox URL.
(package private)  void unregisterCallback(java.lang.String archive)
          Unregister a PageBoxAPI callback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callbacks

java.util.HashMap callbacks
Map of PageBoxAPI callbacks.


subUrl

private java.lang.String subUrl
URL of the DeployIF web service of the subscribed PageBox


rule

private RuleHandler.Rule rule
Memory representation of rules.xml


log

private Log log
Logging object


archives

private java.util.TreeMap archives
Archives currently installed


corrid

private int corrid
Message correlation ID


msgList

private java.util.LinkedList msgList
Messages queued before the frame reception


oldRepUrl

java.lang.String oldRepUrl
Previous Repository URL


newRepUrl

java.lang.String newRepUrl
New Repository URL


netTime

long netTime
Time spent in successful frameSend requests

Constructor Detail

TokenCallbackImpl

TokenCallbackImpl(RuleHandler.Rule rule,
                  Log log)
Constructor. Called by DynDns.

Parameters:
rule - memory representation of rules.xml
Method Detail

setUrl

public void setUrl(java.lang.String subUrl,
                   java.util.TreeMap archives)
Set archive map and PageBox URL. Called by Reinstall.

Parameters:
subUrl - URL of the DeployIF web service of the subscribed PageBox
archives - archive map

setUrl

public void setUrl(java.lang.String subUrl)
Set PageBox URL. Called by Reinstall.

Parameters:
subUrl - URL of the DeployIF web service of the subscribed PageBox

registerCallback

void registerCallback(java.lang.String archive,
                      TokenCallbackIF tci)
Register a PageBoxAPI callback.

Parameters:
archive - archive name

unregisterCallback

void unregisterCallback(java.lang.String archive)
Unregister a PageBoxAPI callback.

Parameters:
archive - archive name

processFrame

void processFrame(TokenFrame tf)
Called by TokenImpl to submit a frame to processing

Parameters:
tf - frame to process

retry

void retry()
Called periodically by DynDns. Retries registrations and unregistrations.


getUrl

java.lang.String getUrl()
Returns the URL of this PageBox DeployIF Web service.

Returns:
PageBox URL

getDeployer

Deployer getDeployer(TokenFrame tf)
Return the DeployIF invocation class.

Parameters:
tf - frame
Returns:
deployer class

getQuerier

Querier getQuerier(TokenFrame tf)
Return the RepoQueryIF invocation class.

Parameters:
tf - frame
Returns:
querier class

removePending

boolean removePending(TokenFrame tf)
Remove RepositoryReg from callbacks when toRemove is true.

Parameters:
tf - frame
Returns:
true when RepositoryReg removed

removePending

boolean removePending()
Remove callbacks entries with toRemove is true. Called by TokenImpl.run when timeout.

Returns:
boolean true when callbacks is then empty

renameRepository

void renameRepository(java.lang.String oldRepUrl,
                      java.lang.String newRepUrl)
Change the repository URL.

Parameters:
oldRepUrl - previous Repository URL
newRepUrl - new Repository URL