PageBoxLib
Class TokenImpl

java.lang.Object
  extended byPageBoxLib.TokenImpl
All Implemented Interfaces:
TokenIF
Direct Known Subclasses:
DeployImpl

public class TokenImpl
extends java.lang.Object
implements TokenIF

Token ring receiver implementation.

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

Nested Class Summary
(package private)  class TokenImpl.Context
          Token context stored as a ServletContext attribute.
(package private)  class TokenImpl.TokenThread
          Thread class sending frames to the next station on the ring.
 
Field Summary
(package private)  ServletContext ctx
          Unique to the Web application.
(package private)  Log log
          Logging object Setup by DeployImpl.
(package private)  long period
          Token timeout; default: 2 secs.
(package private)  TokenFrame pingFrame
          Frame used to to check the Repository state
(package private)  TokenCallbackImpl tcbi
          Class processing frame messages.
(package private)  TokenImpl.Context tctx
          Token context.
(package private)  TokenTest tt
          Used to test the Token implementation
(package private)  java.lang.String workDir
          Directory where XML and log files are defined.
 
Constructor Summary
TokenImpl()
           
 
Method Summary
(package private)  void end()
          Requires the thread termination.
 DeployIF.Status frameSend(TokenFrame frame)
          TokenIF method.
 DeployIF.Status frameSend2(TokenFrame frame)
          Called by HTTPDeploy.
 DeployIF.Status frameSend3(TokenFrame frame)
          Common implementation of frameSend.
private  java.lang.String ser(java.lang.Object o)
          Serializer for LinkedList entries.
(package private)  DeployIF.Status test()
          Use TokenTest to simulate errors.
(package private)  void tokenInit()
          Called by DeployImpl.init.
(package private)  void tokenRenameRepository(java.lang.String oldRepUrl, java.lang.String newRepUrl)
          Change the repository URL.
private  java.lang.Object unser(java.lang.String s)
          Unserializer for LinkedList entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

workDir

java.lang.String workDir
Directory where XML and log files are defined. Setup by DeployImpl.


ctx

ServletContext ctx
Unique to the Web application. Setup by DeployImpl.


log

Log log
Logging object Setup by DeployImpl.


tcbi

TokenCallbackImpl tcbi
Class processing frame messages. Setup by TokenInit.


period

long period
Token timeout; default: 2 secs. Setup by TokenInit.


tctx

TokenImpl.Context tctx
Token context. Setup by TokenInit.


tt

TokenTest tt
Used to test the Token implementation


pingFrame

TokenFrame pingFrame
Frame used to to check the Repository state

Constructor Detail

TokenImpl

public TokenImpl()
Method Detail

tokenInit

void tokenInit()
Called by DeployImpl.init.


tokenRenameRepository

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

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

frameSend

public DeployIF.Status frameSend(TokenFrame frame)
TokenIF method. Called by JWSDP Deploy. Send the frame to the next station on the adjacency list.

Specified by:
frameSend in interface TokenIF
Parameters:
frame - sent frame
Returns:
status object

test

DeployIF.Status test()
Use TokenTest to simulate errors. Called by JWSDP, Axis and HTTP frameSend.

Returns:
DeployIF.Status null return OK, NOTCONTACTED return NOTCONTACTED, OK continue

frameSend2

public DeployIF.Status frameSend2(TokenFrame frame)
Called by HTTPDeploy. Send the frame to the next station on the adjacency list.

Parameters:
frame - sent frame
Returns:
status object

frameSend3

public DeployIF.Status frameSend3(TokenFrame frame)
Common implementation of frameSend. Send the frame to the next station on the adjacency list.

Parameters:
frame - sent frame
Returns:
status object

ser

private java.lang.String ser(java.lang.Object o)
Serializer for LinkedList entries. Motivation: JWSDP 1.2 problem.

Returns:
serialized stream encoded in Base 64

unser

private java.lang.Object unser(java.lang.String s)
Unserializer for LinkedList entries. Motivation: JWSDP 1.2 problem.

Parameters:
s - serialized object
Returns:
unserialized object

end

void end()
Requires the thread termination. Called by DeployImpl.destroy.