de.bea.domingo.proxy
Class NotesProxyFactory

java.lang.Object
  extended by de.bea.domingo.DNotesFactory
      extended by de.bea.domingo.proxy.NotesProxyFactory
All Implemented Interfaces:
MonitorEnabled

public final class NotesProxyFactory
extends DNotesFactory
implements MonitorEnabled

Factory for sessions to Notes/Domino.

Author:
Kurt Riede

Nested Class Summary
 class NotesProxyFactory.DNotesShutdownThread
          Shutdown thread of Domingo, disposes all resources.
 
Field Summary
static int DEFAULT_CACHE_THRESHOLD
          Threshold size for weak cache.
static java.lang.String DEFAULT_IIOP_SESSION_KEY
          Key for map of default IIOP session.
static int MAX_DISPOSE_TRIES
          Retry count while waiting for disposal.
static int TIME_WAIT_FOR_GC
          Time to wait for garbage collector [milliseconds].
 
Constructor Summary
NotesProxyFactory()
          Default constructor.
NotesProxyFactory(int threshold)
          Package-private constructor to create a factory from within the Lotus Notes VM with restricted security.
 
Method Summary
 void disposeInstance()
          In this single threaded implementation, first the own reference to the session is nulled and then we wait for the weak cache to be finalized.
 void disposeInstance(boolean force)
          In this single threaded implementation, first the own reference to the session is nulled and then we wait for the weak cache to be finalized.
 void disposeInternal(boolean force)
          Deprecated. use disposeInternal(boolean) instead
 void gc()
          Deprecated. only use this method for testing
 Cache getBaseCache()
          Returns the central weak cache of all notes objects.
 DNotesMonitor getMonitor()
          Get the current monitor.
 DSession getSession()
          Creates a local session.
 DSession getSession(java.applet.Applet applet, java.lang.String user, java.lang.String passwd)
          Creates a remote (IIOP) session for an applet.
 DSession getSession(java.lang.Object notesSession)
          Creates a Domingo session for an existing Notes session.
 DSession getSession(java.lang.String serverUrl)
          Creates a DIIOP session.
 DSession getSession(java.lang.String host, java.lang.String[] args, java.lang.String user, java.lang.String passwd)
          Creates a remote (IIOP or Http) session with arguments using host name.
 DSession getSession(java.lang.String host, java.lang.String user, java.lang.String passwd)
          Creates a remote (IIOP or Http) session using host name.
 DSession getSessionSSL(java.lang.String host, java.lang.String user, java.lang.String passwd)
          Creates a remote (IIOP or Http) session with SSL using host name.
 DSession getSessionWithFullAccess()
          Creates a local session.
 DSession getSessionWithFullAccess(java.lang.String password)
          Creates a local session.
(package private)  void preprocessMethod()
          Preprocessing before each method invocation.
(package private)  void recycle(java.lang.Object object)
          Recycles resources associated with an object.
(package private)  void recycleLater(java.lang.Object object)
           
(package private)  void recycleQueue()
           
 void setMonitor(DNotesMonitor theMonitor)
          Set the monitor.
 void sinitThread()
          Enables Notes access for the current thread.
 void stermThread()
          Disables Notes access for the current thread.
 
Methods inherited from class de.bea.domingo.DNotesFactory
dispose, dispose, getBooleanProperty, getInstance, getInstance, getInstance, getInstance, getIntProperty, getProperty, newInstance, newInstance, newInstance, newInstance, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DISPOSE_TRIES

public static final int MAX_DISPOSE_TRIES
Retry count while waiting for disposal.

See Also:
Constant Field Values

TIME_WAIT_FOR_GC

public static final int TIME_WAIT_FOR_GC
Time to wait for garbage collector [milliseconds].

See Also:
Constant Field Values

DEFAULT_CACHE_THRESHOLD

public static final int DEFAULT_CACHE_THRESHOLD
Threshold size for weak cache.

See Also:
Constant Field Values

DEFAULT_IIOP_SESSION_KEY

public static final java.lang.String DEFAULT_IIOP_SESSION_KEY
Key for map of default IIOP session.

See Also:
Constant Field Values
Constructor Detail

NotesProxyFactory

public NotesProxyFactory()
Default constructor.

Must be public to allow abstract factory (the base class) to create an instance of this class.


NotesProxyFactory

public NotesProxyFactory(int threshold)
Package-private constructor to create a factory from within the Lotus Notes VM with restricted security.

Parameters:
threshold - Threshold size for weak cache
Method Detail

getBaseCache

public Cache getBaseCache()
Returns the central weak cache of all notes objects.

Returns:
central weak cache of all notes objects

gc

public void gc()
Deprecated. only use this method for testing

Description copied from class: DNotesFactory
Runs the garbage collector and tries to recycle all internal notes objects.

ATTENTION:

This method should not be used in productive code. It only exists for tests, e.g. to ensure clean memory before analyzing with JProbe.

Specified by:
gc in class DNotesFactory
See Also:
DNotesFactory.gc()

disposeInternal

public void disposeInternal(boolean force)
Deprecated. use disposeInternal(boolean) instead

In this single threaded implementation, first the own reference to the session is nulled and then we wait for the weak cache to be finalized.

Specified by:
disposeInternal in class DNotesFactory
Parameters:
force - indicates if disposal should happen even if still any strong or soft reference exists. if false, only weak references must remain.
See Also:
DNotesFactory.dispose(), DNotesFactory.dispose(boolean), WeakReference

disposeInstance

public void disposeInstance()

In this single threaded implementation, first the own reference to the session is nulled and then we wait for the weak cache to be finalized.

Specified by:
disposeInstance in class DNotesFactory
See Also:
DNotesFactory.dispose(), DNotesFactory.dispose(boolean), WeakReference

disposeInstance

public void disposeInstance(boolean force)

In this single threaded implementation, first the own reference to the session is nulled and then we wait for the weak cache to be finalized.

Equivalent to {link disposeInstance(false)

.

Specified by:
disposeInstance in class DNotesFactory
Parameters:
force - indicates if disposal should happen even if still any strong or soft reference exists. if false, only weak references must remain.
See Also:
DNotesFactory.dispose(), DNotesFactory.dispose(boolean), WeakReference

recycle

void recycle(java.lang.Object object)
Recycles resources associated with an object.

Static delegation method to associated recycle strategy.

Parameters:
object - the object to recycle
See Also:
NotesRecycler.recycle(java.lang.Object)

recycleLater

void recycleLater(java.lang.Object object)
See Also:
NotesRecycler.recycleLater(java.lang.Object)

recycleQueue

void recycleQueue()
See Also:
NotesRecycler.recycleQueue()

getSession

public DSession getSession()
                    throws DNotesRuntimeException
Creates a local session.

(Notes client must be installed)

Specified by:
getSession in class DNotesFactory
Returns:
a local session
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSession()

getSession

public DSession getSession(java.lang.String serverUrl)
                    throws DNotesRuntimeException
Creates a DIIOP session.

Specified by:
getSession in class DNotesFactory
Parameters:
serverUrl - URL of server (e.g. "https://plato.acme:8080")
Returns:
a local session
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSession(java.lang.String)

getSession

public DSession getSession(java.lang.String host,
                           java.lang.String user,
                           java.lang.String passwd)
                    throws DNotesRuntimeException
Creates a remote (IIOP or Http) session using host name.

Specified by:
getSession in class DNotesFactory
Parameters:
host - URL of server (e.g. "https://plato.acme:8080")
user - user name for authentication
passwd - password for for authentication
Returns:
a remote session
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSession(java.lang.String, java.lang.String, java.lang.String)

getSessionSSL

public DSession getSessionSSL(java.lang.String host,
                              java.lang.String user,
                              java.lang.String passwd)
                       throws DNotesRuntimeException
Creates a remote (IIOP or Http) session with SSL using host name.

Specified by:
getSessionSSL in class DNotesFactory
Parameters:
host - URL of server (e.g. "https://plato.acme:8080")
user - user name for authentication
passwd - password for for authentication
Returns:
a remote session
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSessionSSL(java.lang.String, java.lang.String, java.lang.String)

getSession

public DSession getSession(java.lang.String host,
                           java.lang.String[] args,
                           java.lang.String user,
                           java.lang.String passwd)
                    throws DNotesRuntimeException
Creates a remote (IIOP or Http) session with arguments using host name.

Specified by:
getSession in class DNotesFactory
Parameters:
host - URL of server (e.g. "https://plato.acme:8080")
args - array of additional arguments
user - user name for authentication
passwd - password for for authentication
Returns:
a remote session
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSession(java.lang.String, java.lang.String[], java.lang.String, java.lang.String)

getSession

public DSession getSession(java.applet.Applet applet,
                           java.lang.String user,
                           java.lang.String passwd)
                    throws DNotesRuntimeException
Creates a remote (IIOP) session for an applet.

Specified by:
getSession in class DNotesFactory
Parameters:
applet - applet instance
user - user name for authentication
passwd - password for for authentication
Returns:
a remote session for an applet
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSession(java.applet.Applet, java.lang.String, java.lang.String)

getSession

public DSession getSession(java.lang.Object notesSession)
                    throws DNotesRuntimeException
Creates a Domingo session for an existing Notes session.

This method is used only internally in Notes agents and Notes applets.

Specified by:
getSession in class DNotesFactory
Parameters:
notesSession - existing Notes session
Returns:
a Domingo session for the given Notes session
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSession(java.lang.Object)

getSessionWithFullAccess

public DSession getSessionWithFullAccess()
                                  throws DNotesRuntimeException
Creates a local session.

(Notes client must be installed)

Access restrictions according to readers items are bypassed.

Specified by:
getSessionWithFullAccess in class DNotesFactory
Returns:
a local session
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSessionWithFullAccess()

getSessionWithFullAccess

public DSession getSessionWithFullAccess(java.lang.String password)
                                  throws DNotesRuntimeException
Creates a local session.

(Notes client must be installed)

Access restrictions according to readers items are bypassed.

Specified by:
getSessionWithFullAccess in class DNotesFactory
Parameters:
password - password for for authentication
Returns:
a local session
Throws:
DNotesRuntimeException - if the session cannot be created
See Also:
DNotesFactory.getSessionWithFullAccess(java.lang.String)

sinitThread

public void sinitThread()
Description copied from class: DNotesFactory
Enables Notes access for the current thread.

Specified by:
sinitThread in class DNotesFactory
See Also:
DNotesFactory.sinitThread()

stermThread

public void stermThread()
Description copied from class: DNotesFactory
Disables Notes access for the current thread.

Specified by:
stermThread in class DNotesFactory
See Also:
DNotesFactory.stermThread()

preprocessMethod

void preprocessMethod()
Preprocessing before each method invocation.


getMonitor

public DNotesMonitor getMonitor()
Get the current monitor.

Specified by:
getMonitor in interface MonitorEnabled
Specified by:
getMonitor in class DNotesFactory
Returns:
current monitor
See Also:
DNotesFactory.getMonitor()

setMonitor

public void setMonitor(DNotesMonitor theMonitor)
Set the monitor.

Specified by:
setMonitor in interface MonitorEnabled
Specified by:
setMonitor in class DNotesFactory
Parameters:
theMonitor - the monitor
See Also:
DNotesFactory.setMonitor(de.bea.domingo.DNotesMonitor)


Domingo Java-API