use of org.omg.CosNotification.Property in project ACS by ACS-Community.
the class ChannelProperties method getCDBAdminProps.
// //////////////////////////////////////////////////////////////////////////
/**
* Given a channel name that exists in the ACS CDB
* ($ACS_CDB/CDB/MACI/Channels/channelName/channelName.xml), this function
* returns the channels administrative properties in their CORBA format.
*
* @param channelName
* name of the channel found in $ACS_CDB/CDB/MACI/Channels
* @return channel's admin properties
* @throws AcsJException
* if the channel's CDB entry is corrupted in any way
*/
public Property[] getCDBAdminProps(String channelName) throws AcsJException {
// use this object to get at channel information from the CDB
DAO tempDAO = null;
try {
tempDAO = m_services.getCDB().get_DAO_Servant("MACI/Channels/" + channelName);
} catch (alma.cdbErrType.CDBXMLErrorEx e) {
m_logger.log(Level.WARNING, "Bad CDB entry found for '" + channelName + "' channel");
throw new alma.ACSErrTypeCommon.wrappers.AcsJUnknownEx(e);
} catch (alma.cdbErrType.CDBRecordDoesNotExistEx e) {
m_logger.log(Level.WARNING, "No CDB entry found for '" + channelName + "' channel");
throw new alma.ACSErrTypeCommon.wrappers.AcsJFileNotFoundEx(e);
} catch (AcsJContainerServicesEx e) {
m_logger.log(Level.WARNING, "CDB unavailable");
throw new alma.ACSErrTypeCommon.wrappers.AcsJNoResourcesEx(e);
}
// MaxQueueLength - TAO 1.1 had a queque of ~5 events. TAO 1.3 allows an
// infinite amount of events to be stored. 20 seems like
// a reasonable default.
Any maxQLAny = m_services.getAdvancedContainerServices().getAny();
try {
maxQLAny.insert_long(tempDAO.get_long("MaxQueueLength"));
} catch (Exception e) {
m_logger.log(Level.SEVERE, "Bad CDB entry datatype found for '" + channelName + "' channel", e);
throw new alma.ACSErrTypeCommon.wrappers.AcsJTypeNotSupportedEx(e);
}
Property maxQL = new Property(MaxQueueLength.value, maxQLAny);
// MaxConsumers - ///////////////////////////////////////////////////////
Any maxConsumersAny = m_services.getAdvancedContainerServices().getAny();
try {
maxConsumersAny.insert_long(tempDAO.get_long("MaxConsumers"));
} catch (Exception e) {
m_logger.log(Level.SEVERE, "Bad CDB entry datatype found for '" + channelName + "' channel", e);
throw new alma.ACSErrTypeCommon.wrappers.AcsJTypeNotSupportedEx(e);
}
Property maxConsumers = new Property(MaxConsumers.value, maxConsumersAny);
// MaxSuppliers - ///////////////////////////////////////////////////////
Any maxSuppliersAny = m_services.getAdvancedContainerServices().getAny();
try {
maxSuppliersAny.insert_long(tempDAO.get_long("MaxSuppliers"));
} catch (Exception e) {
m_logger.log(Level.SEVERE, "Bad CDB entry datatype found for '" + channelName + "' channel", e);
throw new alma.ACSErrTypeCommon.wrappers.AcsJTypeNotSupportedEx(e);
}
Property maxSuppliers = new Property(MaxSuppliers.value, maxSuppliersAny);
// RejectNewEvents - if the queque is full, suppliers get exceptions when
// trying to push events onto the channel.
Any rejectNEAny = m_services.getAdvancedContainerServices().getAny();
boolean tBool = true;
try {
if (tempDAO.get_string("RejectNewEvents").equals("false")) {
tBool = false;
}
} catch (Exception e) {
m_logger.log(Level.SEVERE, "Bad CDB entry datatype found for '" + channelName + "' channel", e);
throw new alma.ACSErrTypeCommon.wrappers.AcsJTypeNotSupportedEx(e);
}
rejectNEAny.insert_boolean(tBool);
Property rejectNE = new Property(RejectNewEvents.value, rejectNEAny);
Property[] adminProps = { maxQL, maxConsumers, maxSuppliers, rejectNE };
return adminProps;
}
use of org.omg.CosNotification.Property in project ACS by ACS-Community.
the class StructuredEventCreator method createEvent.
public StructuredEvent createEvent(IDLEntity customStruct) throws AcsJException {
// The Java class name without package becomes the name of the "event type".
String typeName = customStruct.getClass().getName().substring(customStruct.getClass().getName().lastIndexOf('.') + 1);
// event to send
StructuredEvent event = getCORBAEvent(typeName, "");
// Store the info for Exec/I&T into the event.
// create the any
event.remainder_of_body = m_services.getAdvancedContainerServices().getAny();
// get the useful data which includes the component's name, timestamp, and event count (=1 here)
EventDescription descrip = new EventDescription(m_services.getName(), alma.acs.util.UTCUtility.utcJavaToOmg(System.currentTimeMillis()), 1);
// store the IDL struct into the structured event
EventDescriptionHelper.insert(event.remainder_of_body, descrip);
// preallocate one name/value pair
event.filterable_data = new Property[1];
event.filterable_data[0] = new Property(alma.acscommon.DEFAULTDATANAME.value, m_anyAide.complexObjectToCorbaAny(customStruct));
return event;
}
Aggregations