コード例 #1
0
ファイル: LogSenderClient.cpp プロジェクト: ACS-Community/ACS
int main(int argc, char *argv[])
{
    // Creates and initializes the SimpleClient object
    SimpleClient client;
    if (client.init(argc,argv) == 0)
	{

	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}

    int nlogs = atoi(argv[1]);
    int i;
    for ( i=0;i<nlogs;i++)
        ACS_SHORT_LOG((LM_INFO,"Sending log number %d", i));
    
    client.logout();
    
    ACE_OS::sleep(3);
    return 0;
}
コード例 #2
0
ファイル: stressManager.cpp プロジェクト: ACS-Community/ACS
int main(int argc, char *argv[]) 
{
    ACS_SHORT_LOG((LM_INFO, "Welcome to %s!", argv[0]));

    long numLogins = std::atol(argv[1]);
    long sleepTime = std::atol(argv[2]);

    //Creates and initializes the SimpleClient object
    SimpleClient client;
    if (client.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}

    for (long i=0; i< numLogins; i++)
	{
	client.login();

	ACE_OS::sleep(sleepTime);
	client.logout();
	}

    ACS_SHORT_LOG ((LM_INFO, "The end!"));
    return 0;
}
コード例 #3
0
int main (int argc, char **argv)
{
  ACS_SHORT_LOG ((LM_INFO, "Init maciLogConfigTestClient..."));
  SimpleClient client;
  MACI_TEST::LogConfigTestClass_ptr comp;
    if (client.init(argc,argv) == 0)
	{
	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}
  try
    {
	comp = client.getComponent<MACI_TEST::LogConfigTestClass>("MACI_LOG_CONFIG",0,true);

	comp->log_all();


        client.releaseComponent ("MACI_LOG_CONFIG");
    	client.logout();

    }
  catch ( CORBA::Exception &ex )
    {
      ACE_PRINT_EXCEPTION(ex, "main");
    }

  ACS_SHORT_LOG ((LM_INFO, "Exiting maciLogConfigTestClient..."));
  return 0;

} /* end main() */
コード例 #4
0
int main(int argc, char *argv[]) {

	SimpleClient client;
	if( client.init(argc, argv) == 0 ) {
		cerr << "Cannot initialize client, not continuing" << endl;
		return 1;
	}
	client.login();

	try {

		ACS_SHORT_LOG((LM_INFO,"Obtaining reference to NEWCONFIG_RECEIVER"));
		bulkdata::BulkDataReceiver_var receiver = client.getComponent<bulkdata::BulkDataReceiver>("NEWCONFIG_RECEIVER", 0, true);
	
		// This stream is not configuredon the CDB, will use a default configuration
		ACS_SHORT_LOG((LM_INFO,"Opening stream 'no_existing_stream' (not in CDB)"));
		receiver->openReceiverStream("no_existing_stream");
	
		// This is configured on the CDB, cool
		ACS_SHORT_LOG((LM_INFO,"Opening stream 'Name1' (in CDB)"));
		receiver->openReceiverStream("Name1");
		sleep(2);

		// Open the rest of the receivers
		ACS_SHORT_LOG((LM_INFO,"Opening all remaining streams (namely, Name7)"));
		receiver->openReceiver();
	
		// now sleep a little bit
		ACS_SHORT_LOG((LM_INFO,"Sleeping 10 seconds"));
		ACE_OS::sleep(10);
	
		// and close the receivers
	
		// woops, this doesn't exist
		ACS_SHORT_LOG((LM_INFO,"Closing stream 'name12'"));
		receiver->closeReceiverStream("name12");
	
		// This was the one we wanted to close before
		ACS_SHORT_LOG((LM_INFO,"Closing stream 'Name1'"));
		receiver->closeReceiverStream("Name1");
		ACS_SHORT_LOG((LM_INFO,"Closing stream 'no_existing_stream' (but now it does exist)"));
		receiver->closeReceiverStream("no_existing_stream");
	
		// close the rest
		ACS_SHORT_LOG((LM_INFO,"Closing remaining streams"));
		receiver->closeReceiver();

		// Close receiver
		client.releaseComponent("NEWCONFIG_RECEIVER");

	} catch(maciErrType::CannotGetComponentExImpl &ex) {
		cerr << "Cannot get component '" << ex.getCURL() << "'. Reason: " << ex.getReason() << endl;
	} catch(...) {
		cerr << "Unexpected exception while running test code" << endl;
		client.logout();
	}
}
コード例 #5
0
/** @cond
*/    
int main(int argc, char *argv[])
{
    SimpleClient client;
    int ret;

// Creates and initializes the SimpleClient object

    std::cout << "Initializing client..." << std::endl;
    std::cout.flush();
    if (client.init(argc,argv) == 0) return -1;

    //Must log into manager before we can really do anything
    client.login();

    try
	{
	ComponentSmartPtr<acsexmplHelloWorld::HelloWorld> foo;
	//Get the specific component we have requested on the command-line
	foo = client.getComponentSmartPtr<acsexmplHelloWorld::HelloWorld>(argv[1], 0, true);

	//Call the displayMessage() method existing in the interface for HelloWorld
	foo->displayMessage();
    
	try
	    {
	    foo->badMethod();
	    }
	catch(ACSErrTypeCommon::UnknownEx &ex)
	    {
	    ACSErrTypeCommon::UnknownExImpl badMethodEx(ex);
	    badMethodEx.log();
	    ACS::Time timeStamp = badMethodEx.getTimeStamp();
	    ACE_CString tString = getStringifiedUTC(timeStamp);
	    ACS_DEBUG_PARAM(argv[0], "Time of the exception: %s\n", tString.c_str());
	    }

	ret = 0;
	}
    catch(maciErrType::CannotGetComponentExImpl &_ex)
	{
	_ex.log();
	ret = -1;
	}

    client.logout();
    
    //Sleep for 3 sec to allow everytihng to cleanup and stablize
    ACE_OS::sleep(3);

    return 0;
}
コード例 #6
0
int main(int argc, char *argv[])
{
    if (argc < 2)
	return -1;
    
    SimpleClient client;
    
    if (client.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}
    client.login();
    
    
    try
	{
	ACS_SHORT_LOG((LM_INFO, "Getting COB: %s", argv[1]));
	acsexmplBuilding::Building_var tower = client.get_object<acsexmplBuilding::Building>(argv[1], 0, true);
	
	
	if (!CORBA::is_nil(tower.in()))
	    {	  
	    ACS_SHORT_LOG((LM_INFO, "Got COB: %s", argv[1]));
	    }
	else
	    {
	    ACS_SHORT_LOG((LM_INFO, "Unable to access COB: %s", argv[1]));
	    }
	}
    catch( CORBA::Exception &ex )
	{
	ACE_PRINT_EXCEPTION (ex, "main");
	}
    
    try
	{
	ACS_SHORT_LOG((LM_INFO,"Releasing..."));
	client.manager()->release_component(client.handle(), argv[1]);
	client.logout();
	}
    catch( CORBA::Exception &_ex )
	{
	ACE_PRINT_EXCEPTION (_ex, "main");
	}
    
    ACE_OS::sleep(3);
    return 0;
}
コード例 #7
0
ファイル: stressLogging.cpp プロジェクト: ACS-Community/ACS
int main(int argc, char *argv[])
{
    SimpleClient client;
    if (client.init(argc,argv) == 0)
	{
	return -1;
	}
    else
	{
	client.login();
	}

    CORBA::ULong invocations = static_cast<CORBA::ULong>(std::atol(argv[1]));
 
    for (unsigned int i=0; i < invocations; i++)
	{
	ACS_SHORT_LOG((LM_INFO, "A message"));
	}

    
    client.logout();
    return 0;
}
コード例 #8
0
ファイル: testProp.cpp プロジェクト: franciscobeltran/ACS
int main(int argc,char* argv[])
{
    // create instance of SimpleClient and init() it.
    SimpleClient ci;
    if(ci.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}
    ci.login();

    
    try
	{
	// get reference to Clock device
	CORBA::Object_var obj = ci.get_object("CLOCK1",0,true);
	if(CORBA::is_nil(obj.in())) 
	    {
	    return -1;
	    }

	// narrow object to obtain Clock reference
	acstime::Clock_var dev = acstime::Clock::_narrow(obj.in());
	
	if (CORBA::is_nil(dev.in())) 
	    {
	    std::cerr << "Nil Clock reference" << std::endl;
	    return -1;
	    }
	
	//---------------------------------------------------------------
	ACSErr::Completion_var completion;
	ACSErr::Completion* c;
	int rtnVal;
	
	// get pointer to array2TAI Property
	ACS::RWlong_ptr p_a2t = dev->array2TAI();
	

	for (int i = 0; i < 200; i = (i + 1) * 2)
	    {
	    // set array2TAI value
	    c = p_a2t->set_sync(i);
	    
	    if (c->code == 0)
		cout << "Set array2TAI=" << i << endl;
	    else
		cout << "ERROR array2TAI=" << c->code << endl;
	    
	    // get array2TAI value
	    rtnVal = p_a2t->get_sync(completion.out());
	    
	    if (completion->code != 0)
		cout << "ERROR array2TAI get=" << completion->code << endl;
	    else
		{
		cout << "Got array2TAI=" << rtnVal << endl;
		if (i != rtnVal)
		    cout << "ERROR array2TAI get != set" << endl;
		}
	    }
	
	// get pointer to TAI2UTC Property
	ACS::RWlong_ptr p_t2u = dev->TAI2UTC();
	
	
	for (int i = 0; i < 200; i = (i + 1) * 2)
	    {
	    // set TAI2UTC value
	    c = p_t2u->set_sync(i);
	    
	    if (c->code == 0)
		cout << "Set TAI2UTC=" << i << endl;
	    else
		cout << "ERROR TAI2UTC=" << c->code << endl;

	    // get TAI2UTC value
	    rtnVal = p_t2u->get_sync(completion.out());
	    
	    if (completion->code != 0)
		cout << "ERROR TAI2UTC get=" << completion->code << endl;
	    else
		{
		cout << "Got TAI2UTC=" << rtnVal << endl;
		if (i != rtnVal)
		    cout << "ERROR TAI2UTC get != set" << endl;
		}
	    }
	}
    catch( CORBA::Exception &ex )
	{
	ACE_PRINT_EXCEPTION(ex,"Error!");
        ci.logout();
	return -1;
	}

    ci.logout();
    return 0;
}
コード例 #9
0
/** @cond
*/    
int main(int argc, char *argv[]) 
{
    //Checks command-line arguments
    if (argc < 2)
	{
	ACS_SHORT_LOG((LM_INFO, "Usage: %s <component name> <options>", argv[0]));
	return -1;
	}
    else
	{
	ACS_SHORT_LOG((LM_INFO, "Welcome to %s!", argv[0]));
	}
    
    //Creates and initialyses the SimpleClient object
    SimpleClient client;
    if (client.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}
    
    try
	{
	//Gets from manager the reference to the requested component.
	//Pay special attention that this reference is just a generic
	//CORBA object at this point.
	ACS_SHORT_LOG((LM_INFO, "Looking for Object '%s' ", argv[1]));
        CORBA::Object_var obj =  client.getComponent(argv[1], 0 , true);
	
	//Get the stringified IOR of the component.  The IOR of CORBA objects
	//can be considered to be a unique "phone number" used to access CORBA
	//servants.
	ACS_SHORT_LOG((LM_INFO, "Getting stringified IOR"));
	CORBA::String_var mior = client.getORB()->object_to_string(obj.in());    
	
	//Print the IOR to standard out
	u_int result;         
	ACS_SHORT_LOG ((LM_INFO, "IOR for %s is: %s", argv[1], mior.in()));
	result = ACE_OS::printf ("%s", mior.in());
	}
    catch(maciErrType::CannotGetComponentExImpl &_ex)
	{
	_ex.log();
	return -1;
	}
    catch(...)
	{
	ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__, 
							"main");
	
	uex.log();
	return -1;
	}

    //Normally you would not want to have separate try sections for releasing
    //the components and logging out from manager.  This is a very special case 
    //since we do not know ahead of time what will be released.  In other words,
    //argv[1] could technically be "manager" which would end up raising a 
    //no-permission exception.  To get around this just use separate try/catch 
    //sections and ignore no-permission exceptions.
    try
	{
	//All clients must cleanly release objects they activate!
	client.releaseComponent(argv[1]);
	}
    catch(maciErrType::CannotReleaseComponentExImpl &_ex)
	{
	_ex.log();
	return -1;
	}
    catch(...)
	{
	ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__, 
							"main");
	uex.log();
	return -1;
	}
    
    try
	{
	if (client.logout() == 0)
	    {
	    ACS_SHORT_LOG ((LM_INFO, "Cannot logout"));
	    return -1;
	    }
	}
    catch(...)
	{
	ACS_SHORT_LOG((LM_ERROR, "Exception caught"));
	return -1;
	}    
    
    ACS_SHORT_LOG((LM_INFO,"The end!"));
    return 0;
}
コード例 #10
0
int main(int argc, char *argv[])
{
    SimpleClient client;

    if (client.init(argc,argv) == 0)
    {
        return -1;
    }
    else
    {
        client.login();
    }

    try
    {
        bulkdata::BulkDataSender_var sender = client.get_object<bulkdata::BulkDataSender>("BulkDataNotifSender", 0, true);
        if (CORBA::is_nil(sender.in()))
        {
            ACS_SHORT_LOG((LM_ERROR,"Could not retrieve BulkDataNotifSender component"));
            return -1;
        }

        bulkdata::BulkDataDistributer_var distributer = client.get_object<bulkdata::BulkDataDistributer>("BulkDataNotifDistributer", 0, true);
        if (CORBA::is_nil(distributer.in()))
        {
            ACS_SHORT_LOG((LM_ERROR,"Could not retrieve BulkDataNotifDistributer component"));
            return -1;
        }

        bulkdata::BulkDataReceiver_var receiver = client.get_object<bulkdata::BulkDataReceiver>("BulkDataNotifReceiver", 0, true);
        if (CORBA::is_nil(receiver.in()))
        {
            ACS_SHORT_LOG((LM_ERROR,"Could not retrieve BulkDataNotifReceiver component"));
            return -1;
        }

        bulkdata::BulkDataReceiver_var receiver1 = client.get_object<bulkdata::BulkDataReceiver>("BulkDataNotifReceiver1", 0, true);
        if (CORBA::is_nil(receiver1.in()))
        {
            ACS_SHORT_LOG((LM_ERROR,"Could not retrieve BulkDataNotifReceiver1 component"));
            return -1;
        }


// Receiver connected to the Distributor

        sender->connect(distributer.in());

        distributer->multiConnect(receiver.in());

        // instantiate and activate user callbacks for the notification
        BulkDataTestNotificationCb *notifCb = new BulkDataTestNotificationCb();
        ACS::CBvoid_var cb = notifCb->_this();

        // subscribe to the notification mechanism
        distributer->subscribeNotification(cb);


        sender->startSend();

        sender->paceData();

        sender->stopSend();


        sender->disconnect();

        distributer->closeReceiver();

        distributer->multiDisconnect(receiver.in());

        notifCb->_remove_ref();



// Receiver 1 connected directly to the Sender

        sender->connect(receiver1.in());

        // instantiate and activate user callbacks for the notification
        BulkDataTestNotificationCb *notifCb1 = new BulkDataTestNotificationCb();
        ACS::CBvoid_var cb1 = notifCb1->_this();

        // subscribe to the notification mechanism
        receiver1->subscribeNotification(cb1);


        sender->startSend();

        sender->paceData();

        sender->stopSend();


        sender->disconnect();

        receiver1->closeReceiver();

        notifCb1->_remove_ref();
    }

    catch (AVConnectErrorEx & ex)
    {
        ACS_SHORT_LOG((LM_ERROR, "AVConnectErrorEx exception catched !"));
        AVConnectErrorExImpl ex1(ex);
        ex1.log();
    }
    catch (AVStartSendErrorEx & ex)
    {
        ACS_SHORT_LOG((LM_ERROR, "AVStartSendErrorEx exception catched !"));
        AVStartSendErrorExImpl ex1(ex);
        ex1.log();
    }
    catch (AVPaceDataErrorEx & ex)
    {
        ACS_SHORT_LOG((LM_ERROR, "AVPaceDataErrorEx exception catched !"));
        AVPaceDataErrorExImpl ex1(ex);
        ex1.log();
    }
    catch (AVStopSendErrorEx & ex)
    {
        ACS_SHORT_LOG((LM_ERROR, "AVStopSendErrorEx exception catched !"));
        AVStopSendErrorExImpl ex1(ex);
        ex1.log();
    }
    catch (AVDisconnectErrorEx & ex)
    {
        ACS_SHORT_LOG((LM_ERROR, "AVDisconnectErrorEx exception catched !"));
        AVDisconnectErrorExImpl ex1(ex);
        ex1.log();
    }
    catch (AVCloseReceiverErrorEx & ex)
    {
        ACS_SHORT_LOG((LM_ERROR, "AVCloseReceiverErrorEx exception catched !"));
        AVCloseReceiverErrorExImpl ex1(ex);
        ex1.log();
    }
    catch (ACSErrTypeCommon::CORBAProblemEx & ex)
    {
        ACS_SHORT_LOG((LM_ERROR, "CORBAProblemEx exception catched !"));
        ACSErrTypeCommon::CORBAProblemExImpl ex1(ex);
        ex1.log();
    }
    catch (AVNotificationMechanismErrorEx & ex)
    {
        ACS_SHORT_LOG((LM_ERROR, "AVNotificationMechanismErrorEx exception catched !"));
        AVNotificationMechanismErrorExImpl ex1(ex);
        ex1.log();
    }
    catch(...)
    {
        ACS_SHORT_LOG((LM_ERROR,"UNKNOWN exception catched!"));
    }

    //We release our component and logout from manager
    client.manager()->release_component(client.handle(), "BulkDataNotifReceiver1");
    client.manager()->release_component(client.handle(), "BulkDataNotifReceiver");
    client.manager()->release_component(client.handle(), "BulkDataDistributer");
    client.manager()->release_component(client.handle(), "BulkDataNotifSender");

    client.logout();

    ACS_SHORT_LOG((LM_INFO,"Sleeping 3 sec to allow everything to cleanup and stabilize"));

    ACE_OS::sleep(3);

    return 0;
}
コード例 #11
0
/**
 * A client to send alarms: it expects to find the number of alarm to send
 * as a parameter in the command line.
 * As an option, it is also possible to set in the command line the
 * fault family and the fault member.
 * By default the fault family is "ALCLIENT" and the Fault Member is (ALARM).
 * The fault code is always set to 1.
 * For each alarm to send a triplet like <ALCLIENT, ALARM_1, 1> is created.
 * <P>
 * For each alarm, the process activates it and then terminates it.
 * First all the alarms are activated then terminated.
 * <P>
 * The purposes of this process are:
 * <UL>
 * 	<LI>Check if sending alarms from a client works
 * 	<LI>have a client that sends alarms from the command line
 *  <LI>allow to investigate problems in the sources without the complexity of the container
 * <UL>
 */
int main(int argc, char *argv[])
{
    // Checks command-line arguments.
    if (argc !=2 && argc!=4)
	{
	ACS_SHORT_LOG((LM_INFO, "Usage: %s <num. of alarms to send> [<FaultFamily Fault_Member>]", argv[0]));
	return -1;
	}
    
    //Creates and initializes the SimpleClient object
    SimpleClient client;
    if (client.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}

    // Get the number of alarms to send
    int alarmsToSend = (int)strtof(argv[1],NULL);
    if (alarmsToSend==0) {
    	// It can happen if the user set 0 as param or if the conversion made
    	// by strtof failed
    	ACS_SHORT_LOG((LM_ERROR, "%d alarms to send: nothing to do. Check val of first param (%s). Is it a number?", alarmsToSend,argv[1]));
    	return -1;
    }

    // Init the alarm system factory
    ACSAlarmSystemInterfaceFactory::init(client.manager());
    ACS_SHORT_LOG((LM_DEBUG, "ACSAlarmSystemInterfaceFactory initialized"));

    std::string FF="ALCLIENT";
    std::string FM="ALARM";
    const int FC=1;
    if (argc==4) {
    	FF=argv[2];
    	FM=argv[3];
    }
    ACS_SHORT_LOG((LM_INFO, "Generating %d alarms with triplets like <%s, %s_n, 1>", alarmsToSend,FF.c_str(), FM.c_str()));

    // create the AlarmSystemInterface
 	auto_ptr<acsalarm::AlarmSystemInterface> alarmSource(ACSAlarmSystemInterfaceFactory::createSource());
 	ACS_SHORT_LOG((LM_DEBUG, "Source created"));

 	ACS_SHORT_LOG((LM_INFO, "Sending ACTIVE alarms"));
 	for (int t=0; t<alarmsToSend; t++) {
 		char tempStr[8];
 		sprintf(tempStr,"%d",t);
 		std::string fmTosend=FM;
 		fmTosend+='_';
 		fmTosend+=tempStr;
 		sendAlarm(alarmSource.get(),FF,fmTosend,FC,true);
 	}

 	sleep(5);

 	ACS_SHORT_LOG((LM_INFO, "Sending TERMINATE alarms"));
 	for (int t=0; t<alarmsToSend; t++) {
 		char tempStr[8];
 		sprintf(tempStr,"%d",t);
		std::string fmTosend=FM;
		fmTosend+='_';
		fmTosend+=tempStr;
		sendAlarm(alarmSource.get(),FF,fmTosend,FC,false);
	}
 	auto_ptr<acsalarm::AlarmSystemInterface> tstSource(ACSAlarmSystemInterfaceFactory::createSource());

// 	ACSAlarmSystemInterfaceFactory::done();

 	client.logout();

 	ACS_SHORT_LOG((LM_INFO, "%s done.",argv[0]));
    return 0;
}
コード例 #12
0
int main(int argc, char *argv[])
{
    if(argc < 2)
    {
        printUsageAndExit();
    }
    int numAlarmsToSend = atoi(argv[1]);

    // Create and initialize the SimpleClient object
    SimpleClient client;
    if (client.init(argc,argv) == 0)
    {
        return -1;
    }
    else
    {
        // Must log into manager before we can really do anything
        client.login();
    }

    // Get the component which will be used to generate alarms
    testalarmsystem::AlarmTestMount_var alarmTestMount = client.get_object<testalarmsystem::AlarmTestMount>("ALARM_SOURCE_MOUNTCPP", 0, true);

    // set up a consumer to listen to the notification channel for alarms
    int receivedEvtCount = 0;
    nc::SimpleConsumer<com::cosylab::acs::jms::ACSJMSMessageEntity> *m_simpConsumer_p = 0;
    ACS_NEW_SIMPLE_CONSUMER(m_simpConsumer_p, com::cosylab::acs::jms::ACSJMSMessageEntity,
                            "CMW.ALARM_SYSTEM.ALARMS.SOURCES.ALARM_SYSTEM_SOURCES", myHandlerFunction, (void*) & receivedEvtCount);
    m_simpConsumer_p->consumerReady();

    ACE_Time_Value tv(30);
    client.run(tv);

    int sentEvtCount = 0;
    int MAX_TIME_TO_WAIT = 30;
    int timeWaited = 0;
    while(receivedEvtCount < numAlarmsToSend && (timeWaited < MAX_TIME_TO_WAIT))
    {
        // generate an alarm
        if(sentEvtCount < numAlarmsToSend)
        {
            alarmTestMount->faultMount();
            sentEvtCount++;
        }
        ACE_Time_Value tv(1);
        client.run(tv);
        timeWaited++;
    }

    if(receivedEvtCount >= numAlarmsToSend)
    {
        std::cout << "disconnecting consumer" << std::endl;
        std::cout << "received: " << receivedEvtCount << " events, and sent: " << sentEvtCount << " events" << std::endl;
    }
    else
    {
        std::cout << "ERROR: never detected all the events before the timeout elapsed" << std::endl;
    }
    m_simpConsumer_p->disconnect();
    m_simpConsumer_p = 0;

    // release the component and logout from manager
    client.manager()->release_component(client.handle(), "ALARM_SOURCE_MOUNTCPP");
    client.logout();

    // Sleep for 10 sec to allow everything to cleanup and stablize
    ACE_OS::sleep(10);
    return 0;
}
コード例 #13
0
int main(int argc, char *argv[])
{

    ACS::TimeInterval samplingFrequency;
    ACS::TimeInterval reportRate;

    if (argc == 3)
	{
	samplingFrequency=atoll(argv[1]);
	reportRate=atoll(argv[2]);
	}
    else if (argc == 1)
	{
	samplingFrequency=1000000;
	reportRate=10000000;
	}
    else
	{
	ACS_SHORT_LOG((LM_INFO, "usage: acssampOnlyNCServer <sampFrequency> <reportRate>"));
	cout << endl;
	return -1;
	}

    cout << "used value >> samplingFrequency: " << samplingFrequency 
	 << "; reportRate: " << reportRate << endl;

    signal(SIGINT,stopLoop);

    /// Creates and initializes the SimpleClient object
    SimpleClient client;
    if (!client.init(argc,argv))
	{
	return -1;
	}
    else
	{
	client.login();
	}
    
    
    ACS_SHORT_LOG((LM_INFO, "Getting Component"));

    try
	{
	
        // obtain the reference to the SAMP (factory) object
        acssamp::Samp_var foo = client.get_object<acssamp::Samp>("SAMP1", 0, true);

	if (!CORBA::is_nil(foo.in()))
	    {

	    ACS_SHORT_LOG((LM_DEBUG, "Got samp descriptor()."));

	    // calls the initSampObj to create dynamically a new sampling object
	    acssamp::SampObj_ptr fooNew = 
		foo->initSampObj("LAMP1","brightness",samplingFrequency,reportRate);

	    ACS_SHORT_LOG((LM_INFO,"*** Start to sample ***"));

	    ACS_SHORT_LOG((LM_INFO,"Not Channel: %s",fooNew->getChannelName()));
	  
	  
	    ACS_SHORT_LOG((LM_INFO,"Sleeping 15 seconds to allow NC Client connection ..."));
	    ACE_OS::sleep(15);
	    ACS_SHORT_LOG((LM_INFO," ... done"));


	    // starts the sampling
	    fooNew->start();

	    cout << "Infinite loop started; press Ctrl-C to stop it ..." << endl;
	    while(endme)
		ACE_OS::sleep(1);
	    cout << "... out of the loop!" << endl;

	    // stop and clen-up everything
	    fooNew->stop();
	    ACE_OS::sleep(2);
	    fooNew->destroy();

	    CORBA::release(fooNew);

	    }	
	} /* end main try */
    catch (OutOfBoundsEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "OutOfBoundsEx exception catched !"));
	OutOfBoundsExImpl err(ex);
	err.log();
	}
    catch (CouldntAccessComponentEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "CouldntAccessComponentEx exception catched !"));
	CouldntAccessComponentExImpl err(ex);
	err.log();
	}
    catch (CouldntAccessPropertyEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "CouldntAccessPropertyEx exception catched !"));
	CouldntAccessPropertyExImpl err(ex);
	err.log();
	}
   catch (CouldntCreateObjectEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "CouldntCreateObjectEx exception catched !"));
	CouldntCreateObjectExImpl err(ex);
	err.log();
	}
   catch (TypeNotSupportedEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "TypeNotSupportedEx exception catched !"));
	TypeNotSupportedExImpl err(ex);
	err.log();
	}
    catch (...)
	{
	ACS_SHORT_LOG((LM_INFO, "XXXXXXXX Exception ... catched !"));
//	ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "main");
	}


    /// We release our Ccomponent and logout from the Manager
    client.manager()->release_component(client.handle(), "SAMP1");
    client.logout();
    
    
    /// sleep for 3 sec to allow everytihng to cleanup and stableize
    ACE_OS::sleep(3);
    
    return 0;
}
コード例 #14
0
/** @cond
*/
int main(int argc, char* argv[])
{
    MOUNT_ACS::Mount_var mount;
    BACIThreadManager threadManager;   // The thread manager is used to manage the thread
    ThreadParamStruct param; // The parameter for the thread

    // Check the arguments in the command line
	if (argc<2) {
		std::cerr<<"Usage: "<<argv[0]<<" component azimuth elevation <options>\n";
		return -1;
	}

	double destAz, destEl;
	if (sscanf(argv[2],"%lf",&destAz)+sscanf(argv[3],"%lf",&destEl)!=2) {
		std::cerr<<"Format error in azimuth and/or elevation"<<std::endl;
		std::cerr<<"Usage: "<<argv[0]<<" component azimuth elevation <options>\n";
		return -1;
	}

	// Create the SimpleClient object
	SimpleClient mountClient;

	// Init the client
	if (mountClient.init(argc,argv)==0) {
		// Error initing
		ACS_SHORT_LOG((LM_ERROR,"Error initing the client"));
		return -1;
	} else {
		ACS_SHORT_LOG((LM_INFO,"SimpleClient built"));
	}

	// Login the client
	if (mountClient.login()==0) {
		//Error
		ACS_SHORT_LOG((LM_ERROR,"Error logging in the client"));
		return -1;
	} else {
		ACS_SHORT_LOG((LM_INFO,"Client logged in"));
	}

	try
	    {
	    // Get the component
	    ACS_SHORT_LOG((LM_INFO,"Getting component %s",argv[1]));
	    mount = mountClient.getComponent<MOUNT_ACS::Mount>(argv[1], 0, true);
	    }
	catch(maciErrType::CannotGetComponentExImpl &_ex)
	    {
	    _ex.log();
	    return -1;
	    }

	param.mount=mount.ptr();
	param.az=destAz;
	param.el=destEl;

	char logStr[128];
	sprintf(logStr,"Commanded position az=%lf, el=%lf",destAz,destEl);
	ACS_SHORT_LOG((LM_INFO,logStr));

	// Start the thread to read the position of the antenna
	ACS_SHORT_LOG((LM_INFO,"Starting the thread"));
	BACIThread* thread_p = threadManager.create("Position thread",    //Name of the new thread
		(void *)worker,    //Function to run inside the thread
		static_cast<void *>(&param));    //the single parameter

	if (thread_p==NULL)  {
		ACS_SHORT_LOG((LM_ERROR,"Error in spawning thread"));
	}
        thread_p->resume();

	// The thread will run for 30 secs so we wait until it finishes
	// There are better (and safer) solution to wait instead of a simple wait
	// but... this is the faster one!
	sleep(40);

	// End of computation: begin to clean up

	// Stop all the threads
	ACS_SHORT_LOG((LM_INFO,"Terminating the thread"));
	threadManager.terminateAll();

	// Release the component
	try
	    {
	    ACS_SHORT_LOG((LM_INFO,"Releasing %s",argv[1]));
	    mountClient.releaseComponent(argv[1]);
	    }
	catch(maciErrType::CannotReleaseComponentExImpl &_ex)
	    {
	    _ex.log();
	    return -1;
	    }

	// logout the client
	try
	    {
	    ACS_SHORT_LOG((LM_INFO,"Logging out"));
	    mountClient.logout();
	    }
	catch (...)
	    {
	    ACS_SHORT_LOG((LM_ERROR,"Error logging out the simple client object"));
	    ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
							    "main");
	    uex.log();
	    return -1;
	    }//try-catch

	ACS_SHORT_LOG((LM_INFO,"Done"));

	return 0;
}
コード例 #15
0
int main(int argc, char *argv[])
{
    // Creates and initializes the SimpleClient object
    SimpleClient client;
    if (client.init(argc,argv) == 0)
	{
    	ACS_SHORT_LOG((LM_ERROR, "acsexmplClientErrorComponent::main, Failed to initialize"));
	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}

    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main")); 
    /**************************************************************************
     * Here we instantiate the object used to show examples of error handling.
     * Each method call demonstrate one aspect of error hanlding.
     * See the class documentation for details.
     */
    try
	{
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, created instance of ClientErrorComponent"));
	ClientErrorComponent clientErrorComponent(client, argv[1]);
	
	//Call the displayMessage() method existing in the interface for ErrorComponent
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling TestOk()"));
	clientErrorComponent.TestOk();
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling TestReceiveRemoteException()"));
	clientErrorComponent.TestReceiveRemoteException();
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling TestReceiveRemoteCompletion()"));
	clientErrorComponent.TestReceiveRemoteCompletion();
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling TestReceiveCorbaSystemException()"));
	clientErrorComponent.TestReceiveCorbaSystemException();
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling testCompletionFromCompletion()"));
	clientErrorComponent.testCompletionFromCompletion();
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling testExceptionFromCompletion()"));
	clientErrorComponent.testExceptionFromCompletion();
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling testTypeException()"));
	clientErrorComponent.testTypeException();
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling testCompletionOnStack()"));
	clientErrorComponent.testCompletionOnStack();
    	ACS_SHORT_LOG((LM_TRACE, "acsexmplClientErrorComponent::main, calling testOutCompletion()"));
	clientErrorComponent.testOutCompletion();
	}
    catch(ACSErr::ACSbaseExImpl ex)
	{
	/*
	 * We should never get here, because the methods in the example
	 * should be all self contained and none of them should throw
	 * any exception.
	 */
	ACSErrTypeCommon::GenericErrorExImpl badMethodEx(ex, __FILE__, __LINE__,
							 "main");
	badMethodEx.setErrorDesc("Examples of error handling have thrown an ACS exception");
	badMethodEx.log();
	}
    catch(...)
	{
	/*
	 * We should never get here, because the methods in the example
	 * should be all self contained and none of them should throw
	 * any exception.
	 */
	ACSErrTypeCommon::GenericErrorExImpl badMethodEx(__FILE__, __LINE__,
							 "main");
	badMethodEx.setErrorDesc("Examples of error handling have thrown an UNEXPECTED exception");
	badMethodEx.log();
	}

    /****************************************************
     * We logout from manager
     */
    client.logout();
    
    //Sleep for 3 sec to allow everything to cleanup and stablize
    ACE_OS::sleep(3);
    return 0;
}
コード例 #16
0
/** @cond
*/    
int main(int argc, char *argv[])
{   
    //Checks command-line arguments.
    if (argc < 2)
	{
	ACS_SHORT_LOG((LM_INFO, "Usage: %s <component name> <options>", argv[0]));
	return -1;
	}
    else
	{
	ACS_SHORT_LOG((LM_INFO, "Welcome to %s!", argv[0]));
	}

    //Creates and initializes the SimpleClient object
    SimpleClient client;
    if (client.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}

    try
	{
	//Get the specific component we have requested on the command-line
	FRIDGE::FridgeControl_var fridge = client.getComponent<FRIDGE::FridgeControl>(argv[1], 0, true);
	
	//Run whatever supported command the end-user has specified
	//from the command-line
	if(strcmp(argv[2],"ON") == 0)    // Command ON
	    {
	    ACS_SHORT_LOG((LM_INFO, "ON"));
	    fridge->on();
	    }
	else if(strcmp(argv[2],"OFF") == 0)    // Command OFF
	    {
	    ACS_SHORT_LOG((LM_INFO, "OFF"));
	    fridge->off();
	    }
	else if(strcmp(argv[2],"OPEN") == 0)    // Command OPEN
	    {
	    ACS_SHORT_LOG((LM_INFO, "OPEN"));
	    fridge->open();
	    }
	else if(strcmp(argv[2],"CLOSE") == 0)    // Command CLOSE
	    {
	    ACS_SHORT_LOG((LM_INFO, "CLOSE"));
	    fridge->close();
	    }
	else
	    {
	    // User specified some non-existant command
	    ACS_SHORT_LOG((LM_INFO, "Unknown command"));
	    }
	}
    catch(maciErrType::CannotGetComponentExImpl &_ex)
	{
	_ex.log();
	return -1;
	}
    catch(...)
	{
	ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__, 
							"main");
	uex.log();
	return -1;
	}
    
    try
	{
	//Release the component and log out from manager.
	ACS_SHORT_LOG((LM_INFO,"Releasing..."));
	client.releaseComponent(argv[1]);
	client.logout();
	}
    catch(maciErrType::CannotReleaseComponentExImpl &_ex)
	{
	_ex.log();
	return -1;
	}
    catch(...)
	{
	ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__, 
							"main");
	uex.log();
	}//try-catch
       
    // sleep for 3 sec.
    ACE_OS::sleep(3);
    return 0;
}
コード例 #17
0
ファイル: acsexmplClient.cpp プロジェクト: ACS-Community/ACS
int main(int argc, char *argv[])
{
    // Checks command-line arguments.
    if (argc < 2)
	{
	ACS_SHORT_LOG((LM_INFO, "Usage: %s <component name> <options>", argv[0]));
	return -1;
	}
    else
	{
	ACS_SHORT_LOG((LM_INFO, "Welcome to %s!", argv[0]));
	}
    
    //Creates and initializes the SimpleClient object
    SimpleClient client;
    if (client.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}

    try
	{
	//List all components of type "*Mount*" the Manager knows of. 
	ACS_SHORT_LOG((LM_INFO, "Listing all components of type *Mount*"));
	maci::HandleSeq seq;
	//See the doxygen documentation for maci.idl to understand what these parameters
	//are.
	maci::ComponentInfoSeq_var components = client.manager()->get_component_info(client.handle(), 
										     seq, 
										     "*", 
										     "*Mount*", 
										     false);
	
	for (CORBA::ULong i = static_cast<CORBA::ULong>(0); i < components->length(); i++)
	    {
	    //just print out all known mount components
	    ACS_SHORT_LOG((LM_INFO,"%s (%s)", components[i].name.in(), components[i].type.in()));
	    }
	
	// Now get the specific component we have requested from the command-line
	ACS_SHORT_LOG((LM_INFO, "Getting component: %s", argv[1]));

	//getComponent can throw an exception if it fails
	MOUNT_ACS::Mount_var mount = client.getComponent<MOUNT_ACS::Mount>(argv[1], 0, true);
	
	
	//Prints the descriptor of the requested component
	ACS_SHORT_LOG((LM_DEBUG, "Requesting descriptor()... "));
	ACS::CharacteristicComponentDesc_var descriptor = mount->descriptor();
	ACS_SHORT_LOG((LM_DEBUG, "Got descriptor()."));
	ACS_SHORT_LOG((LM_INFO,"Descriptor:"));
	ACS_SHORT_LOG((LM_INFO,"\tname: %s", descriptor->name.in()));
	
	//Get the reference to the  actAz double property
	ACS_SHORT_LOG((LM_INFO, "Getting component property: %s:actAz", argv[1]));
	ACS::ROdouble_var actAz = mount->actAz();
	    
	if (actAz.ptr() != ACS::ROdouble::_nil())
	    {
	    //Get the current value of the property synchronously
	    ACSErr::Completion_var completion;
	    CORBA::Double val = actAz->get_sync(completion.out());
	    ACS_SHORT_LOG((LM_INFO,"Value: %f", val));
	    
	    
	    //Create the CBdouble property
	    ACS_SHORT_LOG((LM_INFO, "Trying to narrow CB for actAz... "));
	    MyCBdouble myCallback("actAz");
	    //Activate it as a CORBA object
	    ACS::CBdouble_var cb = myCallback._this(); 
	    ACS_SHORT_LOG((LM_INFO, "OK"));
	    
	    //Invoke the asynchronous method.
	    ACS_SHORT_LOG((LM_INFO, "Call get_async for actAz..."));
	    ACS::CBDescIn desc;
	    actAz->get_async(cb.in(), desc);    //returns control immediately
	    
	    //Here some other useful things should be done
	    //while the asyncrhonous reply comes
	    //...
	    //...
	    //...
	    
	    //Enter main loop and stays there for a fixed amount of time (1s)
	    //This is done to give the asynchronous method a chance to finish.
	    ACE_Time_Value tv(1);
	    client.run(tv);
	    }//if
	}
    catch(maciErrType::CannotGetComponentExImpl &_ex) // can be thrown by getComponent<..>(...)
	{
	_ex.log();
	return -1;
	}
    catch( CORBA::SystemException &_ex ) // can be thrown by get_component_info
	{
	ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
							    "main");
	corbaProblemEx.setMinor(_ex.minor());
	corbaProblemEx.setCompletionStatus(_ex.completed());
	corbaProblemEx.setInfo(_ex._info().c_str());
	corbaProblemEx.log();
	return -1;
	}
    catch(...)
	{
	ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__, 
							"main");
	uex.log();
	return -1;
	}//try-catch
  
    //Another try section where we release our component and logout from the Manager
    try
	{
	ACS_SHORT_LOG((LM_INFO,"Releasing..."));
	client.releaseComponent( argv[1]);	
	client.logout();
	}
    catch(maciErrType::CannotReleaseComponentExImpl &_ex)
	{
	_ex.log();
	return -1;
	}
    catch(...)
	{
	ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__, 
							"main");
	uex.log();
	return -1;
	}//try-catch
    
    
    //sleep for 3 sec to allow everytihng to cleanup and stabilize
    //so that the tests can be determinitstic.
    ACE_OS::sleep(3);   
    return 0;
}
コード例 #18
0
ファイル: bulkDataPerf.cpp プロジェクト: ACS-Community/ACS
int main(int argc, char *argv[])
{
    // Creates and initializes the SimpleClient object
    SimpleClient client;

    if (client.init(argc,argv) == 0)
	{
	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}
	
    try
	{
	// Get the specific component we have requested on the command-line
	bulkdata::BulkDataReceiver1Perf_var receiver1 = client.get_object<bulkdata::BulkDataReceiver1Perf>("BulkDataReceiver1Perf", 0, true);
	if (CORBA::is_nil (receiver1.in ()))
	    {
	    ACS_SHORT_LOG((LM_INFO,"Could not retrieve BulkDataReceiver1Perf Component."));
	    return -1;
	    }

	bulkdata::BulkDataSenderPerf_var sender = client.get_object<bulkdata::BulkDataSenderPerf>("BulkDataSenderPerf", 0, true);
	if (CORBA::is_nil (sender.in ()))
	    {
	    ACS_SHORT_LOG((LM_INFO,"Could not retrieve BulkDataSenderPerf Component."));
	    return -1;
	    }

	sender->connect(receiver1.in());

	sender->startSend();

	sender->paceData();

	sender->stopSend();

	sender->disconnect();

	receiver1->closeReceiver();
	}

    catch (AVConnectErrorEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "AVConnectErrorEx exception catched !"));
	AVConnectErrorExImpl ex1(ex);
	ex1.log();
	}
    catch (AVStartSendErrorEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "AVStartSendErrorEx exception catched !"));
	AVStartSendErrorExImpl ex1(ex);
	ex1.log();
	}
    catch (AVPaceDataErrorEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "AVPaceDataErrorEx exception catched !"));
	AVPaceDataErrorExImpl ex1(ex);
	ex1.log();
	}
    catch (AVStopSendErrorEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "AVStopSendErrorEx exception catched !"));
	AVStopSendErrorExImpl ex1(ex);
	ex1.log();
	}
    catch (AVDisconnectErrorEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "AVDisconnectErrorEx exception catched !"));
	AVDisconnectErrorExImpl ex1(ex);
	ex1.log();
	}
    catch (AVCloseReceiverErrorEx & ex)
	{   
	ACS_SHORT_LOG((LM_INFO, "AVCloseReceiverErrorEx exception catched !"));
	AVCloseReceiverErrorExImpl ex1(ex);
	ex1.log();
	}


    catch(...)
	{
	ACS_SHORT_LOG((LM_INFO,"UNKNOWN exception catched!"));
	}
    
    //We release our component and logout from manager
    client.manager()->release_component(client.handle(), "BulkDataSenderPerf");

    ACS_SHORT_LOG((LM_INFO,"Sleeping 3 sec to allow everything to cleanup and stabilize"));    
    ACE_OS::sleep(3);

    client.manager()->release_component(client.handle(), "BulkDataReceiver1Perf");
    
    client.logout();

    //   ACS_SHORT_LOG((LM_INFO,"Sleeping 3 sec to allow everything to cleanup and stabilize"));
    //   ACE_OS::sleep(3);
    
    return 0;
}
コード例 #19
0
/*
 * Main procedure
 */
int main(int argc, char *argv[])
{
    //Checks command-line arguments.
    if (argc < 2)
	{
	ACS_SHORT_LOG((LM_INFO, "Usage: %s <component name> <options>", argv[0]));
	return -1;
	}
    else
	{
	ACS_SHORT_LOG((LM_INFO, "Welcome to %s!", argv[0]));
	}

    //Creates and initializes the SimpleClient object
    SimpleClient client;    
    if (client.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}
    else
	{
	//Must log into manager before we can really do anything
	client.login();
	}

    //Create an instance of our user-defined callback class
    MyCBdouble myCallback("refTemp");

    try
	{
	//Get the specific component we have requested on the command-line
	FRIDGE::FridgeControl_var fridge = client.getComponent<FRIDGE::FridgeControl>(argv[1], 0, true);
	    
	//Get one of the component's BACI properties
	ACS::RWdouble_var refTemperature = fridge->refTemperature();
	
	if (refTemperature.ptr() != ACS::RWdouble::_nil())
	    {
	    ACSErr::Completion_var completion;
	    
	    //Just synchronously reading the value of refTemp
	    CORBA::Double val = refTemperature->get_sync(completion.out());
	    ACS_SHORT_LOG((LM_INFO,"Value: %f", val));
	    
	    //Activate the callback as a CORBA object
	    ACS::CBdouble_var cb = myCallback._this();
	    ACS_SHORT_LOG((LM_INFO, "OK"));
	    
	    ACS::CBDescIn desc;
	    desc.id_tag = 2;
	    ACS_SHORT_LOG((LM_INFO, "Trying to create monitor for refTemperature..."));

	    //Create the actual monitor
	    ACS::Monitordouble_var md = refTemperature->create_monitor(cb.in(), desc);
	    if (md.ptr() != ACS::Monitordouble::_nil())
		{
		ACS_SHORT_LOG((LM_INFO, "OK"));
		//Set the timer trigger to one second.
		md->set_timer_trigger(10000000);
		}
	    else
		{
		ACS_SHORT_LOG((LM_INFO, "Failed"));
		}

	    //Give the callback some time to run.
	    ACE_Time_Value time(20);
	    client.run(time);
	    
	    //Must explicitly destroy the callback before exiting
	    md->destroy();
	    //Give the callback time to be really destroyed
	    ACE_OS::sleep(15);
	    }
	}
    catch(maciErrType::CannotGetComponentExImpl &_ex)
	{
	_ex.log();
	return -1;
	}
    catch(...)
	{
	ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__, 
							"main");
	uex.log();
	return -1;
	}//try-catch
        
    try
	{
	//Must release components and logout from manager	
	ACS_SHORT_LOG((LM_INFO,"Releasing..."));
	client.releaseComponent(argv[1]);
	client.logout();
	}
    catch(maciErrType::CannotReleaseComponentExImpl &_ex)
	{
	_ex.log();
	return -1;
	}
    catch(...)
	{
	ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__, 
							    "main");
	uex.log();
	return -1;
	}//try-catch
  
    // sleep for 3 sec.
    ACE_OS::sleep(3);
    return 0;
}