use of alma.alarmsystem.clients.SourceClient in project ACS by ACS-Community.
the class XmlFileStoreAlarmImpl method initialize.
/**
* Life cycle
* @see alma.acs.component.ComponentLifecycle#initialize()
*/
@Override
public void initialize(ContainerServices containerServices) throws ComponentLifecycleException {
super.initialize(containerServices);
cs = containerServices;
m_logger = cs.getLogger();
// Prepare the queue
String folderPath = System.getProperty(XmlFileStoreAlarmImpl.LOGDIR_PROPNAME, XmlFileStoreAlarmImpl.DEFAULLOGDIR);
File f = new File(folderPath);
if (!f.exists()) {
f.mkdirs();
}
int fileMax = Integer.getInteger(XmlFileStoreAlarmImpl.MAXNUMBEROFFILES_PROPNAME, XmlFileStoreAlarmImpl.DEFAULTMAXNUMBEROFFILES);
int fileSizeLimit = Integer.getInteger(XmlFileStoreAlarmImpl.MAXFILESIZE_PROPNAME, XmlFileStoreAlarmImpl.DEFAULTMAXFILESIZE);
if (fileMax < 1 || fileSizeLimit < 100000) {
StringBuilder str = new StringBuilder(XmlFileStoreAlarmImpl.MAXNUMBEROFFILES_PROPNAME);
str.append(" must be greater then 1 and ");
str.append(XmlFileStoreAlarmImpl.MAXFILESIZE_PROPNAME);
str.append(" must be greater then 100000");
throw new ComponentLifecycleException(str.toString());
}
StringBuilder str = new StringBuilder("Will save alarms files in : ");
str.append(folderPath);
str.append(" (max log file size: ");
str.append(fileSizeLimit);
str.append(", max # log files: ");
str.append(fileMax);
str.append(')');
m_logger.info(str.toString());
QueueFileHandler qFileHandler;
try {
qFileHandler = new QueueFileHandler(cs, folderPath, fileMax, fileSizeLimit, "alarmSources", "AlarmsLogger");
} catch (Throwable t) {
throw new ComponentLifecycleException("Could not create the queue file handler", t);
}
queue = new TimestampedStringQueue(qFileHandler, "<source-timestamp>");
queue.start();
// Connects to the alarm source NC
try {
alarmSourceClient = new SourceClient(cs);
alarmSourceClient.connect();
} catch (Throwable t) {
throw new ComponentLifecycleException("Could not connect to alarm source NC", t);
}
alarmSourceClient.addAlarmListener(this);
}
use of alma.alarmsystem.clients.SourceClient in project ACS by ACS-Community.
the class SourcePanel method initializeACS.
/**
* Connect to ACS and to the source NC
*/
private void initializeACS() throws Exception {
// Connect to ACS
Logger logger = ClientLogManager.getAcsLogManager().getLoggerForApplication("SourcePanel", true);
String managerLoc = System.getProperty("ACS.manager");
if (managerLoc == null) {
System.out.println("Java property 'ACS.manager' must be set to the corbaloc of the ACS manager!");
System.exit(-1);
}
acsClient = new AdvancedComponentClient(logger, managerLoc, "SourcePanel");
contSvcs = acsClient.getContainerServices();
// Connect to the source channel
sourceClient = new SourceClient(contSvcs);
}
use of alma.alarmsystem.clients.SourceClient in project ACS by ACS-Community.
the class UserPropsTest method setUp.
/**
* @see extends ComponentClientTestCase
*/
protected void setUp() throws Exception {
super.setUp();
categoryClient = new CategoryClient(getContainerServices());
assertNotNull(categoryClient);
categoryClient.connect(this);
// Instantiate and connect the source client
sourceClient = new SourceClient(getContainerServices());
assertNotNull(sourceClient);
sourceClient.addAlarmListener(this);
sourceClient.connect();
alarmsReceived = new Vector<Alarm>();
}
use of alma.alarmsystem.clients.SourceClient in project ACS by ACS-Community.
the class BACITest method setUp.
/**
* @see alma.acs.component.client.ComponentClientTestCase#setUp()
*/
@Override
protected void setUp() throws Exception {
super.setUp();
// Check the container services... just in case ;-)
assertNotNull(getContainerServices());
// Instantiate and connect the source client
sourceClient = new SourceClient(getContainerServices());
assertNotNull(sourceClient);
sourceClient.addAlarmListener(this);
sourceClient.connect();
// Instantiate and connect the category client
categoryClient = new CategoryClient(getContainerServices());
assertNotNull(categoryClient);
categoryClient.connect(this);
// Get the component
getTestComponent();
}
Aggregations