Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

alma::acs::container::AcsManagerProxy Class Reference

List of all members.

Public Member Functions

 AcsManagerProxy (String managerLoc, ORB orb, Logger logger)
synchronized Manager getManager () throws AcsJContainerEx
synchronized void loginToManager (Client managerClient, boolean keepTrying) throws AcsJContainerEx
boolean pingManager (long timeoutMillis)
synchronized void logoutFromManager ()
ComponentInfo[] get_component_info (int[] componentHandles, String name_wc, String type_wc, boolean active_only) throws AcsJNoPermissionEx
Object get_service (String service_url, boolean activate) throws AcsJComponentNotAlreadyActivatedEx, AcsJCannotGetComponentEx, AcsJComponentConfigurationNotFoundEx, AcsJNoPermissionEx
Object get_component (int clientHandle, String component_url, boolean activate) throws AcsJCannotGetComponentEx, AcsJComponentNotAlreadyActivatedEx, AcsJComponentConfigurationNotFoundEx, AcsJNoPermissionEx
Object get_component_non_sticky (int clientHandle, String component_url) throws AcsJCannotGetComponentEx, AcsJComponentNotAlreadyActivatedEx, AcsJNoPermissionEx
Object getComponentNonSticky (int clientHandle, String component_url) throws AcsJComponentNotAlreadyActivatedEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx
ComponentInfo get_default_component (int clientHandle, String componentIDLType) throws AcsJNoDefaultComponentEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx
ComponentInfo get_dynamic_component (int clientHandle, ComponentSpec c, boolean mark_as_default) throws AcsJIncompleteComponentSpecEx, AcsJInvalidComponentSpecEx, AcsJComponentSpecIncompatibleWithActiveComponentEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx
ComponentInfo get_collocated_component (int clientHandle, ComponentSpec c, boolean mark_as_default, String target_component_url) throws AcsJIncompleteComponentSpecEx, AcsJInvalidComponentSpecEx, AcsJComponentSpecIncompatibleWithActiveComponentEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx
int register_component (String component_url, String type, Object component) throws AcsJCannotRegisterComponentEx, AcsJNoPermissionEx
int release_component (int clientHandle, String component_url) throws AcsJNoPermissionEx
int force_release_component (int clientHandle, String curl) throws AcsJNoPermissionEx
int getManagerHandle ()
void shutdownNotify ()
AcsManagerProxy createInstance ()

Static Public Member Functions

String getLocalManagerCorbaloc ()

Protected Member Functions

void activateReloginToManagerIfDisconnected ()
void handleRuntimeException (RuntimeException exc)

Protected Attributes

java.lang.Object connectorLock = new java.lang.Object()
final Thread connectorThread

Package Functions

boolean isLoggedIn (boolean checkPing)

Private Member Functions

synchronized void findManager (String managerLoc, boolean keepTrying) throws AcsJContainerEx
synchronized void loginToManager (boolean keepTrying) throws AcsJContainerEx

Private Attributes

Manager m_manager
String m_managerLoc
int m_mgrHandle = 0
ORB m_orb
Logger m_logger
volatile boolean m_shuttingDown
Client m_managerClient

Detailed Description

Proxy class that encapsulates access to the ACS Manager. See maci.idl for the various types of client, which include container and admin client.

This class is stateful, so there must be one AcsManagerProxy used per client if a process has more than one client to the manager.

Warning: This class is not supposed to be instantiated by components and other non-framework classes. Components should only access this class through ContainerServices.

Author:
hsommer Feb 18, 2003 9:20:14 AM


Constructor & Destructor Documentation

alma::acs::container::AcsManagerProxy::AcsManagerProxy String  managerLoc,
ORB  orb,
Logger  logger
[inline]
 

Constructor stores parameters, but takes no further action.

Parameters:
managerLoc corbaloc string for the Manager
orb active ORB; provided explicitly rather than using alma.acs.container.corba.AcsCorba, so we can easily reuse this class for clients outside of the container.
logger 


Member Function Documentation

void alma::acs::container::AcsManagerProxy::activateReloginToManagerIfDisconnected  )  [inline, protected]
 

AcsManagerProxy alma::acs::container::AcsManagerProxy::createInstance  )  [inline]
 

Creates a new instance, using the same manager, orb and logger. The new instance can then be used to log in to the manager (again) independently of this instance.

There is no communication between this instance and the new instance. For example, a call to shutdownNotify() will not be forwarded.

synchronized void alma::acs::container::AcsManagerProxy::findManager String  managerLoc,
boolean  keepTrying
throws AcsJContainerEx [inline, private]
 

Finds the Manger using the supplied managerLoc. If the manager can't be found and keepTrying is true, this method enters a loop and tries again after every 5 seconds.

Parameters:
managerLoc the corbaloc string that uniquely identifies the manager as a CORBA service.
keepTrying if true, this method will only return when it has successfully contacted the manager service; if false, this method will simply throw a AcsJContainerServicesEx if it fails to resolve the manager.
Exceptions:
AcsJContainerEx if anything goes wrong.

int alma::acs::container::AcsManagerProxy::force_release_component int  clientHandle,
String  curl
throws AcsJNoPermissionEx [inline]
 

Calls ManagerOperations#force_release_component(int, String). This call must not be used by regular component code. It is only provided for setting up tests, writing specialized operator tools, and similar purposes.

Returns:
number of clients of the force-released components.
Since:
ACS 5.0.4

ComponentInfo alma::acs::container::AcsManagerProxy::get_collocated_component int  clientHandle,
ComponentSpec  c,
boolean  mark_as_default,
String  target_component_url
throws AcsJIncompleteComponentSpecEx, AcsJInvalidComponentSpecEx, AcsJComponentSpecIncompatibleWithActiveComponentEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx [inline]
 

Encapsulates si.ijs.maci.ManagerOperations#get_collocated_component(int, si.ijs.maci.ComponentSpec, boolean, java.lang.String).

Parameters:
clientHandle handle of requesting component or other kind of client
c dynamic version of deployment info, may be incomplete, see ACS documentation
mark_as_default if true, make the new component instance the default for its type
target_component_url 
Returns:
ComponentInfo struct
Exceptions:
IncompleteComponentSpec 
InvalidComponentSpec 
ComponentSpecIncompatibleWithActiveComponent 

Object alma::acs::container::AcsManagerProxy::get_component int  clientHandle,
String  component_url,
boolean  activate
throws AcsJCannotGetComponentEx, AcsJComponentNotAlreadyActivatedEx, AcsJComponentConfigurationNotFoundEx, AcsJNoPermissionEx [inline]
 

The more restricted version of get_service, only good for getting components.

Parameters:
clientHandle handle of requesting component or other kind of client
component_url to specify the requested component
activate 
status status out-parameter
Returns:
the component reference (must still be narrowed using the appropriate Corba helper)
See also:
ContainerServices::getComponent(String)

ComponentInfo [] alma::acs::container::AcsManagerProxy::get_component_info int[]  componentHandles,
String  name_wc,
String  type_wc,
boolean  active_only
throws AcsJNoPermissionEx [inline]
 

From maci IDL comments: "Gets all the information that the Manager has about components. To invoke this method, the caller must have INTROSPECT_MANAGER access rights, or it must have adequate privileges to access the component (the same as with the get_service method). Information about all components is returned, unless the active_only parameter is set to True, in which case only information about those components that are currently registered with the Manager and activated is returned. Calling this function does not affect the internal state of the Manager."

Parameters:
componentHandles Handles of the components whose information is requested. If this is an empty sequence, the name_wc and type_wc parameters are used.
name_wc Wildcard that the component's name must match in order for its information to be returned.
type_wc Wildcard that the component's type must match in order for its information to be returned.
active_only 
Returns:
si.ijs.maci.ComponentInfo[] A sequence of ComponentInfo structures containing the entire Manager's knowledge about the components. If access is denied to a subset of objects, the handles to those objects are set to 0.

Object alma::acs::container::AcsManagerProxy::get_component_non_sticky int  clientHandle,
String  component_url
throws AcsJCannotGetComponentEx, AcsJComponentNotAlreadyActivatedEx, AcsJNoPermissionEx [inline]
 

ComponentInfo alma::acs::container::AcsManagerProxy::get_default_component int  clientHandle,
String  componentIDLType
throws AcsJNoDefaultComponentEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx [inline]
 

Parameters:
clientHandle handle of requesting component or other kind of client
componentIDLType the IDL type
See also:
ContainerServices::getDefaultComponent(String)

ComponentInfo alma::acs::container::AcsManagerProxy::get_dynamic_component int  clientHandle,
ComponentSpec  c,
boolean  mark_as_default
throws AcsJIncompleteComponentSpecEx, AcsJInvalidComponentSpecEx, AcsJComponentSpecIncompatibleWithActiveComponentEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx [inline]
 

Parameters:
clientHandle handle of requesting component or other kind of client
c dynamic version of deployment info, may be incomplete, see ACS documentation
mark_as_default if true, make the new component instance the default for its type
Returns:
a struct which contains the corba reference, as well as name, type, etc.
Exceptions:
si.ijs.maci.IncompleteComponentSpec 
si.ijs.maci.InvalidComponentSpec Thrown if there is no valid dynamic component found for given resulting structure.
si.ijs.maci.ComponentSpecIncompatibleWithActiveComponent Thrown if the resulting structure is incompatible with a component of the same name already active.

Object alma::acs::container::AcsManagerProxy::get_service String  service_url,
boolean  activate
throws AcsJComponentNotAlreadyActivatedEx, AcsJCannotGetComponentEx, AcsJComponentConfigurationNotFoundEx, AcsJNoPermissionEx [inline]
 

From maci IDL comments: Gets a service, activating it if necessary (components). The client represented by id (the handle) must have adequate access rights to access the service. This is untrue of components: components always have unlimited access rights to other components."

Parameters:
service_url CURL of the service whose reference is to be retrieved.
activate True if the service is to be activated in case it does not exist. If set to False, and the service does not exist, a nil reference is returned and status is set to Manager.COMPONENT_NOT_ACTIVATED.
status Status of the request. One of Manager.COMPONENT_ACTIVATED, Manager.COMPONENT_NONEXISTENT and Manager.COMPONENT_NOT_ACTIVATED.
Returns:
org.omg.CORBA.Object Reference to the service. If the service could not be activated, a nil reference is returned, and the status contains an error code detailing the cause of failure (one of the component_* constants).

Object alma::acs::container::AcsManagerProxy::getComponentNonSticky int  clientHandle,
String  component_url
throws AcsJComponentNotAlreadyActivatedEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx [inline]
 

Gets a component as a "weak client" who does not prevent component unloading in case the other real clients release their references. Otherwise similar to get_component with activate==false.

Parameters:
clientHandle 
component_url 
Returns:
the component reference (must still be narrowed using the appropriate Corba helper)
Exceptions:
AcsJComponentNotAlreadyActivatedEx if the requested component has not already been activated by some other client
AcsJCannotGetComponentEx 
AcsJUnexpectedExceptionEx if the remote call failed with a (CORBA) runtime exception
Since:
ACS 6.0

String alma::acs::container::AcsManagerProxy::getLocalManagerCorbaloc  )  [inline, static]
 

synchronized Manager alma::acs::container::AcsManagerProxy::getManager  )  throws AcsJContainerEx [inline]
 

Gets the ACS Manager, either cached or freshly retrieved. Note that no login is done here, so call loginToManager(Client, boolean) after this.

Returns:
Manager
Exceptions:
AcsJContainerServicesEx 

int alma::acs::container::AcsManagerProxy::getManagerHandle  )  [inline]
 

Returns the handle that the ACS Manager has assigned to this client. This handle is kept inside the Manager proxy class, but applies to the whole container.

Returns:
handle, or 0 if not logged in

void alma::acs::container::AcsManagerProxy::handleRuntimeException RuntimeException  exc  )  [inline, protected]
 

Invoked by the manager methods on failure. The "handling" of the exception refers to changing the connection status, logging the exception, etc. This method will not throw the given exception, which means that the calling client has to do this herself.

boolean alma::acs::container::AcsManagerProxy::isLoggedIn boolean  checkPing  )  [inline, package]
 

synchronized void alma::acs::container::AcsManagerProxy::loginToManager boolean  keepTrying  )  throws AcsJContainerEx [inline, private]
 

Logs in to the Manager. Only to be called from within this class (see connectorThread), when the

Parameters:
keepTrying used for the call to findManager(String, boolean).
Exceptions:
AcsJContainerServicesEx 

synchronized void alma::acs::container::AcsManagerProxy::loginToManager Client  managerClient,
boolean  keepTrying
throws AcsJContainerEx [inline]
 

Logs in to the manager, using the provided manager client CORBA object. This method only returns when the login succeeded. Otherwise an exception is thrown.

Parameters:
managerClient the IDL-defined client of the manager (see maci.idl), of which the container is a subclass.
keepTrying refers to multiple attempts for both finding the manager and logging in to the manager. If true, a background thread is started to re-login if the connection breaks.
Exceptions:
AcsJContainerServicesEx 

synchronized void alma::acs::container::AcsManagerProxy::logoutFromManager  )  [inline]
 

Logs out from the manager. If this fails, a warning is logged, but no exception will be thrown by this method.

boolean alma::acs::container::AcsManagerProxy::pingManager long  timeoutMillis  )  [inline]
 

Pings the manager. Uses a separate thread so that life can go on if the manager does not respond, and the ORB timeout is too long for this purpose.

Currently calls get_client_info to see if the manager responds. Todo: should be replaced by a call to Manager.ping when this is available.

Parameters:
timeoutMillis timout in milliseconds that can restrict the general ORB timeout.
Returns:
true if the manager responded within the given time, false otherwise
See also:
isLoggedIn(boolean)

int alma::acs::container::AcsManagerProxy::register_component String  component_url,
String  type,
Object  component
throws AcsJCannotRegisterComponentEx, AcsJNoPermissionEx [inline]
 

From maci IDL comments: "Registers a CORBA object as a component, assigning it a CURL and making it accessible through the Manager. The component is treated as an immortal component."

Parameters:
component_url 
type 
component 
Returns:
int

int alma::acs::container::AcsManagerProxy::release_component int  clientHandle,
String  component_url
throws AcsJNoPermissionEx [inline]
 

From maci IDL comments: "Releases a component. In order for this operation to be possible, the caller represented by the id must have previously successfuly requested the component via a call to get_service(String, boolean, IntHolder). Releasing a component more times than requesting it should be avoided, but it produces no errors."

Parameters:
clientHandle handle of requesting component or other kind of client
component_url 
Returns:
int Number of clients that are still using the component after the operation completed. This is a useful debugging tool.

void alma::acs::container::AcsManagerProxy::shutdownNotify  )  [inline]
 

Notification that the container is in the process of shutting down.

With ACS 7.0.2 this method is no longer synchronized because it deadlocked the shutdown hook thread when the manager proxy was in a login loop. See COMP-2602.


Member Data Documentation

java.lang.Object alma::acs::container::AcsManagerProxy::connectorLock = new java.lang.Object() [protected]
 

The lock should only be held for short periods, the threads executing our API need to be able to retrieve it quickly.

TODO: replace with lock from concurrent lib

final Thread alma::acs::container::AcsManagerProxy::connectorThread [protected]
 

This thread keeps retrying to log in to the manager. Before each attempt, it checks whether some outside-world caller of loginToManager() has meanwhile accomplished to log in.

notify() on the lock will awake the thread, interrupt() will terminate the thread.

msc(2005-07)

Logger alma::acs::container::AcsManagerProxy::m_logger [private]
 

Manager alma::acs::container::AcsManagerProxy::m_manager [private]
 

Client alma::acs::container::AcsManagerProxy::m_managerClient [private]
 

msc(2005-07) client:managerproxy is always 1:1

String alma::acs::container::AcsManagerProxy::m_managerLoc [private]
 

int alma::acs::container::AcsManagerProxy::m_mgrHandle = 0 [private]
 

ORB alma::acs::container::AcsManagerProxy::m_orb [private]
 

volatile boolean alma::acs::container::AcsManagerProxy::m_shuttingDown [private]
 


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:52:25 2009 for ACS Java API by doxygen 1.3.8