Repository
Class RepoTokenImpl

java.lang.Object
  extended byRepository.RepoTokenImpl
All Implemented Interfaces:
RepoTokenIF
Direct Known Subclasses:
RepoQueryImpl

public class RepoTokenImpl
extends java.lang.Object
implements RepoTokenIF

Token ring Repository implementation.

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 RepoTokenImpl.Context
          Token context stored as a ServletContext attribute.
(package private)  class RepoTokenImpl.RepoTokenThread
          Thread class sending frames to the first station on the ring.
 
Field Summary
(package private)  RepoTokenImpl.Context ctx
          Context members
(package private)  long period
          Token timeout; default: 2 secs
(package private)  ServletEndpointContext sec
          Allows retrieving ServletContext and UserPrincipal
(package private)  TokenTest tt
          Used to test the Token implementation
 
Constructor Summary
RepoTokenImpl()
           
 
Method Summary
(package private)  void end()
          Requires the thread termination.
 DeployIF.Status frameSend(TokenFrame frame)
          Send the frame to the next station in the adjacency list.
(package private)  DeployIF.Status frameSend(TokenFrame frame, java.lang.String querier)
          Send the frame to the next station in the adjacency list.
(package private)  DeployIF.Status frameSend2(TokenFrame frame)
          Send the frame to the next station in the adjacency list.
(package private)  DeployIF.Status frameSend2(TokenFrame frame, java.lang.String querier)
          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(ServletContext ctx)
          Initialize implementation.
 void tokenRegister(java.lang.String subscriber)
          Token management method.
 void tokenRegister(java.lang.String subscriber, java.lang.String querier)
          Token management method.
 void tokenUnregister(java.lang.String subscriber)
          Token management method.
 void tokenUnregister(java.lang.String subscriber, java.lang.String querier)
          Token management method.
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

period

long period
Token timeout; default: 2 secs


sec

ServletEndpointContext sec
Allows retrieving ServletContext and UserPrincipal


ctx

RepoTokenImpl.Context ctx
Context members


tt

TokenTest tt
Used to test the Token implementation

Constructor Detail

RepoTokenImpl

public RepoTokenImpl()
Method Detail

tokenInit

void tokenInit(ServletContext ctx)
Initialize implementation.

Parameters:
ctx - servlet context

tokenRegister

public void tokenRegister(java.lang.String subscriber)
                   throws java.rmi.RemoteException
Token management method. Inserts a PageBox on the ring.

Specified by:
tokenRegister in interface RepoTokenIF
Parameters:
subscriber - PageBox to insert on the ring
Throws:
java.rmi.RemoteException
See Also:
RepoTokenIF.tokenRegister(String)

tokenRegister

public void tokenRegister(java.lang.String subscriber,
                          java.lang.String querier)
                   throws java.rmi.RemoteException
Token management method. Inserts a PageBox on the ring.

Parameters:
subscriber - PageBox to insert on the ring
querier - user who made the request
Throws:
java.rmi.RemoteException

tokenUnregister

public void tokenUnregister(java.lang.String subscriber)
Token management method. Removes a PageBox from the ring.

Specified by:
tokenUnregister in interface RepoTokenIF
Parameters:
subscriber - PageBox to remove from the ring
See Also:
RepoTokenIF.tokenUnregister(String)

tokenUnregister

public void tokenUnregister(java.lang.String subscriber,
                            java.lang.String querier)
Token management method. Removes a PageBox from the ring.

Parameters:
subscriber - PageBox to remove from the ring
querier - user who made the request

frameSend

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

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

DeployIF.Status frameSend2(TokenFrame frame)
Send the frame to the next station in the adjacency list. TokenIF method. Called by AxisRepoQuery.

Parameters:
frame - sent frame
Returns:
status object

frameSend

DeployIF.Status frameSend(TokenFrame frame,
                          java.lang.String querier)
Send the frame to the next station in the adjacency list. Called by HTTPQuery.

Parameters:
frame - sent frame
querier - user who made the request
Returns:
status object

frameSend2

DeployIF.Status frameSend2(TokenFrame frame,
                           java.lang.String querier)
Common implementation of frameSend. Send the frame to the next station in the adjacency list.

Parameters:
frame - sent frame
querier - user who made the request
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 tokenUnregister and by RepoQueryImpl.destroy.