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 |
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
.
alma.acs.container.AcsManagerProxy.AcsManagerProxy | ( | String | managerLoc, | |
ORB | orb, | |||
Logger | logger | |||
) |
Constructor stores parameters, but takes no further action.
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().
void alma.acs.container.AcsManagerProxy.activateReloginToManagerIfDisconnected | ( | ) | [protected] |
References alma.acs.container.AcsManagerProxy.connectorThread.
Referenced by alma.acs.container.AcsManagerProxy.loginToManager().
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.
AcsJNoPermissionEx |
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.
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).
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 |
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.
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 |
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."
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 |
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 |
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 |
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 |
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 |
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."
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 . |
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
.
clientHandle | ||
component_url |
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 |
References alma.acs.container.AcsManagerProxy.handleRuntimeException().
static String alma.acs.container.AcsManagerProxy.getLocalManagerCorbaloc | ( | ) | [static] |
synchronized Manager alma.acs.container.AcsManagerProxy.getManager | ( | ) | throws AcsJContainerEx |
Gets the ACS Manager, either cached or freshly retrieved. Note that no login is done here, so call loginToManager(Client, boolean) after this.
AcsJContainerServicesEx |
Referenced by alma.acs.component.client.ComponentClientTestCase.getLogReceiver(), alma.acs.container.AcsContainerRunner.initAcsLogging(), alma.acs.container.AcsEmbeddedContainerRunner.initManagerProxy(), alma.acs.component.client.ComponentClientTestCase.initRemoteLogging(), and alma.acs.component.client.ComponentClient.initRemoteLogging().
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.
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] |
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.
References alma.acs.container.AcsManagerProxy.connectorLock.
Referenced by alma.acs.container.AcsManagerProxy.force_release_component(), alma.acs.container.AcsManagerProxy.get_collocated_component(), alma.acs.container.AcsManagerProxy.get_component(), alma.acs.container.AcsManagerProxy.get_component_info(), alma.acs.container.AcsManagerProxy.get_component_non_sticky(), alma.acs.container.AcsManagerProxy.get_default_component(), alma.acs.container.AcsManagerProxy.get_dynamic_component(), alma.acs.container.AcsManagerProxy.get_service(), alma.acs.container.AcsManagerProxy.getComponentNonSticky(), alma.acs.container.AcsManagerProxy.register_component(), and alma.acs.container.AcsManagerProxy.release_component().
boolean alma.acs.container.AcsManagerProxy.isLoggedIn | ( | boolean | checkPing | ) | [package] |
References alma.acs.container.AcsManagerProxy.pingManager().
Referenced by alma.acs.container.AcsManagerProxy.logoutFromManager().
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.
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. |
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 | ( | ) |
Logs out from the manager. If this fails, a warning is logged, but no exception will be thrown by this method.
References alma.acs.container.AcsManagerProxy.isLoggedIn().
Referenced by alma.acs.component.client.ComponentClientTestCase.connectToManager(), alma.acs.component.client.AdvancedComponentClient.destroyContainerServices(), alma.acs.container.AcsContainer.disconnect(), alma.acs.container.AdvancedContainerServicesImpl.disconnectManagerAdmin(), alma.acs.container.AcsContainer.shutdown(), alma.acs.component.client.ComponentClientTestCase.tearDown(), and alma.acs.component.client.ComponentClient.tearDown().
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.
timeoutMillis | timout in milliseconds that can restrict the general ORB timeout. |
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."
component_url | ||
type | ||
component |
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."
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). |
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().
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().
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)
Referenced by alma.acs.container.AcsManagerProxy.activateReloginToManagerIfDisconnected(), and alma.acs.container.AcsManagerProxy.shutdownNotify().