org.aselect.system.sam.agent
Class SAMResource

java.lang.Object
  extended by org.aselect.system.sam.agent.SAMResource

public class SAMResource
extends java.lang.Object

A shield surrounding a configured resource in a resourcegroup.

Description:
SAM stands for Simple A-Select Management. SAM is designed to enable A-Select to work in a redundant envirnoment. A SAMResource resembles a server, connection or entry point for a specific resource (e.g. an A-Select Server or a database). At a given interval the SAMResource will check whether or not it's resource is still available.

Concurrency issues:
-

Author:
Alfa & Ariss

Constructor Summary
SAMResource()
          Default constructor.
 
Method Summary
 void destroy()
          Class destroyer.
 java.lang.Object getAttributes()
          Returns the configuration attributes of this resource as an Object .
 void init(java.lang.Object oConfigSection, ConfigManager oConfigManager, SystemLogger oSystemLogger)
          Initializes the configured resource.
 boolean live()
          Check if the resource is still available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAMResource

public SAMResource()
Default constructor.

Method Detail

init

public void init(java.lang.Object oConfigSection,
                 ConfigManager oConfigManager,
                 SystemLogger oSystemLogger)
          throws ASelectSAMException
Initializes the configured resource.

Description:
Checks if their is a polling methodconfigured for the resource and starts polling. If no polling method is found, no thread is started.

Concurrency issues:
-

Preconditions:
- oConfigSection may not be null
- oConfigManager may not be null
- oSystemLogger may not be null


Postconditions:
-

Parameters:
oConfigSection - - The section within the configuration file in which the parameters for the SAMAgent can be found.
oConfigManager - the config manager object that is used to retrieve the configuration
oSystemLogger - the logger used for system logging
Throws:
ASelectSAMException - if the resource could not initialize

live

public boolean live()
Check if the resource is still available.

Description:
Returns the _bLive variable that is set when the resource is alive.

Concurrency issues:
-

Preconditions:
-

Postconditions:
-

Returns:
TRUE if the resource is available, FALSE if the resource is unavailable.

getAttributes

public java.lang.Object getAttributes()
Returns the configuration attributes of this resource as an Object .

Description:
Along with the configuration of the SAMResource, additional parameters can be defined. These parameters can hold information about the resource. For example, a username and password. This functions returns these parameters to the application.

Concurrency issues:
-

Preconditions:
The init() method must be called before using this method.

Postconditions:
-

Returns:
A Object pointing to the section with the attributes within the configuration file.

destroy

public void destroy()
Class destroyer.

Description:
Destroy this class properly and stopped the polling thread.

Concurrency issues:
-

Preconditions:
-

Postconditions:
The polling thread is stopped.



Copyright © 2008 SURFnet BV. All Rights Reserved.