Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Package Functions

alma.acs.container.AcsManagerProxy Class Reference

List of all members.

Classes

class  PingManagerThread

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
void release_component (int clientHandle, String component_url, CBlong callback) throws AcsJNoPermissionEx
int force_release_component (int clientHandle, String curl) throws AcsJNoPermissionEx
int getManagerHandle ()
void shutdownNotify ()
AcsManagerProxy createInstance ()

Static Public Member Functions

static 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)
int checkAndGetManagerHandle () throws AcsJNoPermissionEx

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 
)

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 

Referenced by alma.acs.container.AcsManagerProxy.createInstance().


Member Function Documentation

void alma.acs.container.AcsManagerProxy.activateReloginToManagerIfDisconnected (  )  [protected]
int alma.acs.container.AcsManagerProxy.checkAndGetManagerHandle (  )  throws AcsJNoPermissionEx [package]

Gets the current client handle assigned by the manager, or throws an exception if this client is not logged in.

Exceptions:
AcsJNoPermissionEx 
See also:
getManagerHandle()

Referenced by alma.acs.container.AcsManagerProxy.get_component_info(), alma.acs.container.AcsManagerProxy.get_service(), and alma.acs.container.AcsManagerProxy.register_component().

AcsManagerProxy alma.acs.container.AcsManagerProxy.createInstance (  ) 

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.

References alma.acs.container.AcsManagerProxy.AcsManagerProxy().

Referenced by alma.acs.container.AdvancedContainerServicesImpl.connectManagerAdmin(), and alma.acs.component.client.AdvancedComponentClient.createContainerServices().

int alma.acs.container.AcsManagerProxy.force_release_component ( int  clientHandle,
String  curl 
) throws AcsJNoPermissionEx

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

References alma.acs.container.AcsManagerProxy.handleRuntimeException().

Referenced by alma.acs.container.ContainerServicesImpl.releaseComponent().

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

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 (for non-container clients this will always be the login-handle)
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 

References alma.acs.container.AcsManagerProxy.handleRuntimeException().

Referenced by alma.acs.container.ContainerServicesImpl.getCollocatedComponent().

Object alma.acs.container.AcsManagerProxy.get_component ( int  clientHandle,
String  component_url,
boolean  activate 
) throws AcsJCannotGetComponentEx, AcsJComponentNotAlreadyActivatedEx, AcsJComponentConfigurationNotFoundEx, AcsJNoPermissionEx

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

Parameters:
clientHandle handle of requesting component or other kind of client (for non-container clients this will always be the login-handle)
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)

References alma.acs.container.AcsManagerProxy.handleRuntimeException().

Referenced by alma.acs.container.ContainerServicesImpl.getComponent().

ComponentInfo [] alma.acs.container.AcsManagerProxy.get_component_info ( int[]  componentHandles,
String  name_wc,
String  type_wc,
boolean  active_only 
) throws AcsJNoPermissionEx

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.

References alma.acs.container.AcsManagerProxy.checkAndGetManagerHandle(), and alma.acs.container.AcsManagerProxy.handleRuntimeException().

Referenced by alma.acs.container.ContainerServicesImpl.findComponents(), and alma.acs.container.ContainerServicesImpl.getComponentDescriptor().

Object alma.acs.container.AcsManagerProxy.get_component_non_sticky ( int  clientHandle,
String  component_url 
) throws AcsJCannotGetComponentEx, AcsJComponentNotAlreadyActivatedEx, AcsJNoPermissionEx
ComponentInfo alma.acs.container.AcsManagerProxy.get_default_component ( int  clientHandle,
String  componentIDLType 
) throws AcsJNoDefaultComponentEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx
Parameters:
clientHandle handle of requesting component or other kind of client (for non-container clients this will always be the login-handle)
componentIDLType the IDL type
See also:
ContainerServices.getDefaultComponent(String)

References alma.acs.container.AcsManagerProxy.handleRuntimeException().

Referenced by alma.acs.container.ContainerServicesImpl.getDefaultComponent().

ComponentInfo alma.acs.container.AcsManagerProxy.get_dynamic_component ( int  clientHandle,
ComponentSpec  c,
boolean  mark_as_default 
) throws AcsJIncompleteComponentSpecEx, AcsJInvalidComponentSpecEx, AcsJComponentSpecIncompatibleWithActiveComponentEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx
Parameters:
clientHandle handle of requesting component or other kind of client (for non-container clients this will always be the login-handle)
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.

References alma.acs.container.AcsManagerProxy.handleRuntimeException().

Referenced by alma.acs.container.ContainerServicesImpl.getDynamicComponent().

Object alma.acs.container.AcsManagerProxy.get_service ( String  service_url,
boolean  activate 
) throws AcsJComponentNotAlreadyActivatedEx, AcsJCannotGetComponentEx, AcsJComponentConfigurationNotFoundEx, AcsJNoPermissionEx

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).

References alma.acs.container.AcsManagerProxy.checkAndGetManagerHandle(), and alma.acs.container.AcsManagerProxy.handleRuntimeException().

Referenced by alma.acs.container.ContainerServicesImpl.getCDB(), and alma.acs.container.AcsContainer.getCDB().

Object alma.acs.container.AcsManagerProxy.getComponentNonSticky ( int  clientHandle,
String  component_url 
) throws AcsJComponentNotAlreadyActivatedEx, AcsJCannotGetComponentEx, AcsJNoPermissionEx

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

References alma.acs.container.AcsManagerProxy.handleRuntimeException().

static String alma.acs.container.AcsManagerProxy.getLocalManagerCorbaloc (  )  [static]
synchronized Manager alma.acs.container.AcsManagerProxy.getManager (  )  throws AcsJContainerEx
int alma.acs.container.AcsManagerProxy.getManagerHandle (  ) 

Returns the handle that the ACS Manager has assigned to the container/client during login. The handle should always be retrieved from here instead of storing its value outside of this class, so that a change in handle after a reconnect can be propagated.

Returns:
handle, or 0 if not logged in

Referenced by alma.acs.component.client.AdvancedComponentClient.createContainerServices(), alma.acs.container.ComponentAdapter.getComponentInfo(), alma.acs.container.AcsContainerRunner.initAcsLogging(), alma.acs.component.client.ComponentClientTestCase.initRemoteLogging(), alma.acs.component.client.ComponentClient.initRemoteLogging(), and alma.acs.component.client.ComponentClientTestCase.setUp().

void alma.acs.container.AcsManagerProxy.handleRuntimeException ( RuntimeException  exc  )  [protected]
boolean alma.acs.container.AcsManagerProxy.isLoggedIn ( boolean  checkPing  )  [package]
synchronized void alma.acs.container.AcsManagerProxy.loginToManager ( Client  managerClient,
boolean  keepTrying 
) throws AcsJContainerEx

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 

References alma.acs.container.AcsManagerProxy.activateReloginToManagerIfDisconnected().

Referenced by alma.acs.container.AdvancedContainerServicesImpl.connectManagerAdmin(), alma.acs.component.client.ComponentClientTestCase.connectToManager(), alma.acs.component.client.AdvancedComponentClient.createContainerServices(), and alma.acs.container.AcsContainer.loginToManager().

synchronized void alma.acs.container.AcsManagerProxy.logoutFromManager (  ) 
boolean alma.acs.container.AcsManagerProxy.pingManager ( long  timeoutMillis  ) 

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)

Referenced by alma.acs.container.AcsManagerProxy.isLoggedIn().

int alma.acs.container.AcsManagerProxy.register_component ( String  component_url,
String  type,
Object  component 
) throws AcsJCannotRegisterComponentEx, AcsJNoPermissionEx

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

References alma.acs.container.AcsManagerProxy.checkAndGetManagerHandle(), and alma.acs.container.AcsManagerProxy.handleRuntimeException().

void alma.acs.container.AcsManagerProxy.release_component ( int  clientHandle,
String  component_url,
CBlong  callback 
) throws AcsJNoPermissionEx

From maci IDL comments: "Asynchronously release a component. In order for this operation to be possible, the caller represented by the id must have previously successfully requested the component via a call to get_component. Releasing a component more times than requesting it should be avoided, but it produces no errors. This method will return before the manager/target container have deactivated the component. If the caller wants to synchronize with component deactivation, it must supply the optional CBlong callback."

Parameters:
clientHandle handle of requesting component or other kind of client (for non-container clients this will always be the login-handle)
component_url 
callback to synch on actual component release, receive possible exceptions, and returned number of remaining clients (which could be a useful debugging tool).
Exceptions:
AcsJNoPermissionEx If this client does not hold a valid reference to the target component.
RuntimeException such as BAD_PARAM, NO_PERMISSION, NO_RESOURCES, OBJECT_NOT_EXIST, TIMEOUT, TRANSIENT UNKNOWN

References alma.acs.container.AcsManagerProxy.handleRuntimeException().

Referenced by alma.acs.container.ContainerServicesImpl.releaseComponent().

void alma.acs.container.AcsManagerProxy.shutdownNotify (  ) 

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.

References alma.acs.container.AcsManagerProxy.connectorThread.

Referenced by alma.acs.component.client.AdvancedComponentClient.destroyContainerServices(), alma.acs.container.AcsContainer.shutdown(), alma.acs.component.client.ComponentClientTestCase.tearDown(), and alma.acs.component.client.ComponentClient.tearDown().


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

Referenced by alma.acs.container.AcsManagerProxy.handleRuntimeException().

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)

Referenced by alma.acs.container.AcsManagerProxy.activateReloginToManagerIfDisconnected(), and alma.acs.container.AcsManagerProxy.shutdownNotify().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties