Search in sources :

Example 6 with ComponentClient

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

the class BCTClient method activateSBC.

/**
	 * TEST_1_3_1 & TEST_1_3_3
	 * @param loop
	 */
public boolean activateSBC(long count) {
    if (count > 16)
        return false;
    SimpleBACIComponent[] SBC = new SimpleBACIComponent[(int) count];
    ComponentClient cc = ComponentClientSingleton.getInstance();
    m_startTime = System.currentTimeMillis();
    try {
        for (int i = 0; i < count; i++) SBC[i] = alma.perftest.SimpleBACIComponentHelper.narrow(cc.getContainerServices().getComponent(SBCs[i]));
    } catch (Exception e) {
        return false;
    }
    m_midTime = System.currentTimeMillis();
    for (int i = 0; i < count; i++) {
        SBC[i] = null;
        cc.getContainerServices().releaseComponent(SBCs[i]);
    }
    m_endTime = System.currentTimeMillis();
    return true;
}
Also used : ComponentClient(alma.acs.component.client.ComponentClient) SimpleBACIComponent(alma.perftest.SimpleBACIComponent)

Example 7 with ComponentClient

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

the class ComponentsManagerTest method setUp.

protected void setUp() throws Exception {
    client = new ComponentClient(null, managerLoc, "ComponetsManagerTest");
    cManager = new ComponentsManager(client.getContainerServices());
}
Also used : ComponentClient(alma.acs.component.client.ComponentClient) ComponentsManager(cl.utfsm.samplingSystemUI.core.ComponentsManager)

Example 8 with ComponentClient

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

the class SimpleSupplierConsumerClient method createPublisherAndSubscriber.

public void createPublisherAndSubscriber() {
    try {
        m_client = new ComponentClient(m_logger, System.getProperty("ACS.manager"), "SimpleSupplierConsumerClient");
        //m_subscriber = m_client.getContainerServices().createNotificationChannelSubscriber(CHANNEL_NAME, EventDescription.class);
        //m_subscriber.addSubscription(this);
        m_publisher = m_client.getContainerServices().createNotificationChannelPublisher(CHANNEL_NAME, IDLEntity.class);
    } catch (AcsJContainerServicesEx e) {
    // Silently ignore the errors
    } catch (AcsJException e) {
    // Shouldn't happen
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ComponentClient(alma.acs.component.client.ComponentClient) AcsJException(alma.acs.exceptions.AcsJException) IDLEntity(org.omg.CORBA.portable.IDLEntity) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx) AcsJException(alma.acs.exceptions.AcsJException)

Example 9 with ComponentClient

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

the class MountConsumer method main.

////////////////////////////////////////////////////////////////////////////
/** Illustrates a simple example outside of the component/container model.
     * @param args Not used!
     */
public static void main(String[] args) {
    try {
        //Setup an ACS Java client. This has little to do with the NC API
        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);
        }
        String clientName = "MountConsumerClient";
        ComponentClient myClient = new ComponentClient(null, managerLoc, clientName);
        //Create the consumer using the ACS Java client's container services.
        MountConsumer joe = new MountConsumer(myClient.getContainerServices());
        //After consumerReady() is invoked, processEvent(...) is invoked
        //by the channel.  That is, we have no control over when
        //that method is called.
        System.out.println("Waiting for events...");
        //Wait a while for some events
        Thread.sleep(50000);
        //Disconnect from the channel
        joe.disconnect();
        //Must cleanly disconnect the client
        myClient.tearDown();
    } catch (Exception e) {
        e.printStackTrace(System.err);
    }
    System.out.println("Done...");
}
Also used : ComponentClient(alma.acs.component.client.ComponentClient)

Example 10 with ComponentClient

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

the class MountSupplier method main.

// //////////////////////////////////////////////////////////////////////////
/**
	 * In this example, the main function is all that is used.
	 * 
	 * @param args
	 *            Not used!
	 */
public static void main(String[] args) {
    try {
        // Setup an ACS Java client. This has little to do with the NC API
        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);
        }
        String clientName = "MountSupplierClient";
        ComponentClient myClient = new ComponentClient(null, managerLoc, clientName);
        ContainerServices cs = myClient.getContainerServices();
        // Create and initialize the supplier
        AcsEventPublisher<MountEventData> joe = cs.createNotificationChannelPublisher(// the channel's name
        MOUNT_CHANNEL.value, MountEventData.class);
        // Create the event that will be published
        MountEventData t_block = new MountEventData(3.14F, 43.0F);
        // Publish the event 50 times int 50 seconds
        System.out.println("Now sending events...");
        for (int i = 0; i < 50; i++) {
            joe.publishEvent(t_block);
            sleep(1000);
        }
        // Must cleanly disconnect the supplier
        joe.disconnect();
        // Must cleanly disconnect the client
        myClient.tearDown();
    } catch (Exception e) {
        e.printStackTrace(System.err);
    }
}
Also used : ComponentClient(alma.acs.component.client.ComponentClient) ContainerServices(alma.acs.container.ContainerServices)

Aggregations

ComponentClient (alma.acs.component.client.ComponentClient)10 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)2 AcsJException (alma.acs.exceptions.AcsJException)2 SimpleBACIComponent (alma.perftest.SimpleBACIComponent)2 IDLEntity (org.omg.CORBA.portable.IDLEntity)2 ContainerServices (alma.acs.container.ContainerServices)1 NCPublisher (alma.acs.nc.NCPublisher)1 ComplexBACIComponent (alma.perftest.ComplexBACIComponent)1 ComponentsManager (cl.utfsm.samplingSystemUI.core.ComponentsManager)1 SwingWorker (javax.swing.SwingWorker)1