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;
}
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());
}
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();
}
}
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...");
}
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);
}
}
Aggregations