Search in sources :

Example 1 with AdvancedComponentClient

use of alma.acs.component.client.AdvancedComponentClient in project ACS by ACS-Community.

the class Frame method connectACSComponentClient.

/**
     * Connect to ACS as component client.
     * It connects the client and the logger.
     * 
     * @param className The name of the class of the panel to show in the frame
     * 
     * @throws Exception In case of failure connecting to ACS
     */
private void connectACSComponentClient(String className) throws PanelException {
    String[] tmp = className.split("\\.");
    String clientName = tmp[tmp.length - 1];
    String managerLoc = System.getProperty("ACS.manager");
    if (managerLoc != null) {
        managerLoc = managerLoc.trim();
    } else {
        throw new IllegalStateException("ACS.magager property not set!");
    }
    try {
        client = new AdvancedComponentClient(null, managerLoc, clientName);
        contSvc = client.getContainerServices();
        logger = contSvc.getLogger();
        logger.log(AcsLogLevel.DEBUG, "Connected to ACS");
        setTitle(clientName);
    } catch (Throwable t) {
        if (logger != null) {
            logger.log(AcsLogLevel.ERROR, "Error connecting the simple client: " + t.getMessage());
        } else {
            System.err.println("Error connecting the simple client: " + t.getMessage());
        }
        client = null;
        logger = null;
        contSvc = null;
        throw new PanelException("Error connetting ACS client", t);
    }
}
Also used : AdvancedComponentClient(alma.acs.component.client.AdvancedComponentClient)

Example 2 with AdvancedComponentClient

use of alma.acs.component.client.AdvancedComponentClient in project ACS by ACS-Community.

the class Firestarter method giveAdvancedComponentClient.

public AdvancedComponentClient giveAdvancedComponentClient() throws Exception {
    if (advancedComponentClient == null) {
        // may fail
        giveAcsCorba();
        advancedComponentClient = new AdvancedComponentClient(logger, managerLoc, clientName + ".ComponentClient", acsCorba);
    }
    return advancedComponentClient;
}
Also used : AdvancedComponentClient(alma.acs.component.client.AdvancedComponentClient)

Example 3 with AdvancedComponentClient

use of alma.acs.component.client.AdvancedComponentClient 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);
}
Also used : AdvancedComponentClient(alma.acs.component.client.AdvancedComponentClient) SourceClient(alma.alarmsystem.clients.SourceClient) Logger(java.util.logging.Logger)

Example 4 with AdvancedComponentClient

use of alma.acs.component.client.AdvancedComponentClient in project ACS by ACS-Community.

the class SenderPanel method initACS.

private void initACS() throws Exception {
    // Connect to ACS
    logger = ClientLogManager.getAcsLogManager().getLoggerForApplication("AlarmSenderPanel", 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, "AlarmSenderPanel");
}
Also used : AdvancedComponentClient(alma.acs.component.client.AdvancedComponentClient)

Example 5 with AdvancedComponentClient

use of alma.acs.component.client.AdvancedComponentClient in project ACS by ACS-Community.

the class FactoryTest method instantiateComponentClient.

/**
	 * Instantiating a component client trigger the initialization of the 
	 * {@link ACSAlarmSystemInterfaceFactory}.
	 * 
	 * @return The component client
	 */
private AdvancedComponentClient instantiateComponentClient() throws Exception {
    // Initialize the logger
    Logger logger = ClientLogManager.getAcsLogManager().getLoggerForApplication(clientName, true);
    assertNotNull(logger);
    client = new AdvancedComponentClient(logger, managerLoc, clientName);
    return client;
}
Also used : AdvancedComponentClient(alma.acs.component.client.AdvancedComponentClient) Logger(java.util.logging.Logger)

Aggregations

AdvancedComponentClient (alma.acs.component.client.AdvancedComponentClient)6 Logger (java.util.logging.Logger)2 SourceClient (alma.alarmsystem.clients.SourceClient)1