PageBoxLib
Class APIImpl

java.lang.Object
  extended byPageBoxLib.APIImpl

public class APIImpl
extends java.lang.Object

Class of the PageBox API.

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

Nested Class Summary
(package private)  class APIImpl.ExtensionImpl
          Extension wrapper.
(package private)  class APIImpl.LogImpl
          Logging class provided to PageBoxAPI users.
 
Field Summary
(package private)  ActiveNaming activeNaming
          Active naming handle
(package private)  java.util.HashMap allowedExtensions
          Allowed extensions Key: extension name Value: True
(package private)  java.util.HashMap allowedResources
          Allowed resources Key: resource name Value: True
static java.util.Hashtable APIs
          Map of APIImpl instances Key: APIKey object Value: APIImpl object Hashtable used for synchronization.
(package private)  java.lang.String archDir
          Archive root directory
private  java.util.TreeMap archives
          Archives currently installed Key: archive name Value: Archive object
(package private)  java.lang.String archName
          Archive name
(package private)  java.lang.String dbName
          Database name
(package private)  Deployer deployer
          Deploy Web service invoker
(package private)  Log log
          Logging object
private  java.util.ArrayList pool
          Connection pool.
(package private)  Querier querier
          Deploy Web service invoker
(package private)  RuleHandler.Rule rule
          Memory representation of rules.xml
(package private)  java.lang.String subUrl
          URL of the DeployIF web service of the controlling PageBox
(package private)  TokenCallbackImpl tcbi
          Token implementation handle
(package private) static java.util.HashMap tcbis
          Map of TokenCallbackImpl objects Key: working directory of a PageBox Value: TokenCallbackImpl object
(package private)  UsageIF usageProbe
          Probe to collect resource usage data
private  java.lang.String workdir
          Directory where XML and log files are defined
 
Constructor Summary
private APIImpl(java.lang.String wd, java.lang.String archDir, java.lang.String archName)
          Constructor.
 
Method Summary
(package private) static APIImpl getAPI(java.lang.String archDir)
          APIImpl Factory.
(package private)  java.lang.String[] getClones()
          Retrieves the path of this archive clones.
(package private)  java.sql.Connection getConnection()
          Get a connection from the connection pool.
(package private)  ExtensionIF getExtension(java.lang.String name, java.lang.String parmClass, java.lang.Object parm)
          Get an extension provided by the PageBox.
(package private)  LogIF getLog()
          Returns a Logging object.
(package private)  ResourceInfo getResource(java.lang.String name)
          Get a resource.provided by the PageBox.
(package private)  ResourceUsage getResourceUsage()
          Returns resource (CPU, memory) on this PageBox instance.
(package private)  void init(java.lang.String wd, java.lang.String archDir, java.lang.String archName)
          Initialize environment..
 void initialize()
          rules.xml parsing.
(package private)  void relConnections()
          Front end to release connections.
(package private) static void relConnections(java.lang.String archDir)
          Static front end to release connections.
(package private)  void relConns()
          Releases the connection pool.
(package private) static void relInactiveConnections(java.lang.String wd)
          Static front end to release inactive connections.
(package private)  void relInactiveConns()
          Release inactive connections of an APIImpl instance.
private  void restorePbArchs()
          Restore the installed archive map from PbArchives.xml.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APIs

public static java.util.Hashtable APIs
Map of APIImpl instances Hashtable used for synchronization.


tcbis

static java.util.HashMap tcbis
Map of TokenCallbackImpl objects


workdir

private java.lang.String workdir
Directory where XML and log files are defined


log

Log log
Logging object


archives

private java.util.TreeMap archives
Archives currently installed


pool

private java.util.ArrayList pool
Connection pool. Contains PoolEntry objects.


dbName

java.lang.String dbName
Database name


archDir

java.lang.String archDir
Archive root directory


archName

java.lang.String archName
Archive name


allowedExtensions

java.util.HashMap allowedExtensions
Allowed extensions


allowedResources

java.util.HashMap allowedResources
Allowed resources


deployer

Deployer deployer
Deploy Web service invoker


querier

Querier querier
Deploy Web service invoker


rule

RuleHandler.Rule rule
Memory representation of rules.xml


tcbi

TokenCallbackImpl tcbi
Token implementation handle


activeNaming

ActiveNaming activeNaming
Active naming handle


subUrl

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


usageProbe

UsageIF usageProbe
Probe to collect resource usage data

Constructor Detail

APIImpl

private APIImpl(java.lang.String wd,
                java.lang.String archDir,
                java.lang.String archName)
Constructor. Declared private: shouldn't be called from outside.

Parameters:
wd - work directory of the controlling PageBox
archDir - archive directory
archName - archive name
Method Detail

getAPI

static APIImpl getAPI(java.lang.String archDir)
APIImpl Factory.

Parameters:
archDir - directory where the archive is defined

relConnections

static void relConnections(java.lang.String archDir)
Static front end to release connections.

Parameters:
archDir - directory where the archive is defined

init

final void init(java.lang.String wd,
                java.lang.String archDir,
                java.lang.String archName)
Initialize environment..

Parameters:
wd - work directory of the controlling PageBox
archDir - archive directory
archName - archive name

relConnections

void relConnections()
Front end to release connections.


getLog

LogIF getLog()
Returns a Logging object.

Returns:
LogIF (Log) object

initialize

public void initialize()
rules.xml parsing. Sets subName, subPassword and jdbcInfo.


restorePbArchs

private void restorePbArchs()
Restore the installed archive map from PbArchives.xml.


getConnection

java.sql.Connection getConnection()
Get a connection from the connection pool.

Returns:
a Connection (PoolEntry) object

relConns

void relConns()
Releases the connection pool.


getClones

java.lang.String[] getClones()
Retrieves the path of this archive clones. Invocation of the RepoQueryIF getSubscribers method: Retrieves the instances of this archive. Then calls the getArchPath of these PageBox web services.

Returns:
array of archive URLs

getResource

ResourceInfo getResource(java.lang.String name)
Get a resource.provided by the PageBox.

Returns:
ResourceInfo object (JNDI name, type and auth)

getExtension

ExtensionIF getExtension(java.lang.String name,
                         java.lang.String parmClass,
                         java.lang.Object parm)
Get an extension provided by the PageBox.

Parameters:
name - extension name
parmClass - class of the parm
parm - extension constructor parameter
Returns:
extension instance implementing the ExtensionIF interface

getResourceUsage

ResourceUsage getResourceUsage()
Returns resource (CPU, memory) on this PageBox instance.

Returns:
ResourceUsage object

relInactiveConns

void relInactiveConns()
Release inactive connections of an APIImpl instance. Calls PoolEntry.isInactive.


relInactiveConnections

static void relInactiveConnections(java.lang.String wd)
Static front end to release inactive connections. Calls relInactiveConns.