use of org.omg.CORBA.TypeCodePackage.BadKind in project ACS by ACS-Community.
the class DynAnyParser method parseEventAny.
private void parseEventAny(DynAny dynAny2, String path) {
if (monitor != null && monitor.isCanceled()) {
cancelFlag = true;
// Check for cancellation each time through
return;
}
DynAny da = dynAny2;
int tcKind = da.type().kind().value();
ParsedAnyData entry = new ParsedAnyData(path, "", "");
try {
switch(tcKind) {
case TCKind._tk_short:
entry.setType("short");
entry.setValue(String.valueOf(da.get_short()));
pdlist.add(entry);
break;
case TCKind._tk_long:
entry.setType("long");
entry.setValue(String.valueOf(da.get_long()));
pdlist.add(entry);
break;
case TCKind._tk_longlong:
entry.setType("longlong");
if (path.contains("timestamp")) {
entry.setValue(String.valueOf(UTCUtility.getUTCDate(UTCUtility.utcOmgToJava(da.get_longlong()))));
} else
entry.setValue(String.valueOf(da.get_longlong()));
pdlist.add(entry);
break;
case TCKind._tk_ulonglong:
entry.setType("ulonglong");
entry.setValue(String.valueOf(da.get_ulonglong()));
pdlist.add(entry);
break;
case TCKind._tk_string:
entry.setType("string");
entry.setValue(da.get_string());
pdlist.add(entry);
break;
case TCKind._tk_boolean:
entry.setType("boolean");
entry.setValue("" + da.get_boolean());
pdlist.add(entry);
break;
case TCKind._tk_float:
entry.setType("float");
entry.setValue("" + da.get_float());
pdlist.add(entry);
break;
case TCKind._tk_double:
entry.setType("double");
entry.setValue("" + da.get_double());
pdlist.add(entry);
break;
case TCKind._tk_enum:
entry.setType("enum");
entry.setValue(((DynEnum) da).get_as_string());
pdlist.add(entry);
break;
case TCKind._tk_array:
entry.setType("array");
entry.setValue("size: " + da.component_count());
pdlist.add(entry);
int numDisplayElements = Math.min(da.component_count(), 5);
int elementType = da.type().content_type().kind().value();
switch(elementType) {
case TCKind._tk_double:
for (int j = 0; j < numDisplayElements; j++) {
String dname = path + "[" + j + "]";
double value = da.current_component().get_double();
pdlist.add(new ParsedAnyData(dname, "double", ("" + value)));
da.next();
}
break;
default:
pdlist.add(new ParsedAnyData(path, "Unimplemented type for array: " + elementType, "Unknown"));
}
break;
case TCKind._tk_struct:
case TCKind._tk_except:
DynStruct ds = (DynStruct) da;
String structName = ds.type().name();
if (DEBUG)
System.out.println("Struct name: " + structName);
entry.setType("struct");
if (path.equals("")) {
entry.setName(structName);
} else
// TODO: still not
entry.setName(path + " / " + structName);
// working --
// this doesn't
// display
// Actuator
// Space at all!
StringBuilder members = new StringBuilder("Members: ");
for (int i = 0; i < ds.component_count(); i++) {
members.append(ds.current_member_name() + ((i == ds.component_count() - 1) ? " " : ", "));
ds.next();
}
entry.setValue(members.toString());
pdlist.add(entry);
ds.rewind();
for (int i = 0; i < ds.component_count(); i++) {
String dname = ds.current_member_name();
if (DEBUG)
System.out.println("\tMember name: " + dname + " type: " + ds.current_component().type().kind().value());
parseEventAny(ds.current_component(), dname);
ds.next();
}
if (DEBUG) {
NameValuePair[] nvp = ds.get_members();
for (int i = 0; i < nvp.length; i++) {
System.out.println(nvp[i].id + " " + nvp[i].value);
}
}
break;
case TCKind._tk_sequence:
DynSequence dsq = (DynSequence) da;
String seqName = path + dsq.type().name();
// TODO: Straighten this
entry.setType("sequence" + seqName);
// out
entry.setValue("IDL sequences not implemented yet");
default:
entry.setType(da.type().kind().toString());
entry.setValue("Unimplemented type");
pdlist.add(entry);
break;
}
} catch (TypeMismatch e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvalidValue e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (BadKind e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return;
}
use of org.omg.CORBA.TypeCodePackage.BadKind in project ACS by ACS-Community.
the class AnyAide method corbaAnyToObject.
/**
* Method which attempts to (and under normal circumstances should succeed)
* convert a CORBA any object to the corresponding Java object. For simple
* CORBA types such as long, this method will extract the long and embed it
* within a java.lang.Long object. In the event of failure, a null object is
* returned.
* <p>
* Sequences / arrays are only supported for string, float, double, long and boolean
* when using the typedefs from acscommon.idl such as "typedef sequence <float> floatSeq"
*
* @param any
* A CORBA any containing some sort of CORBA object
* @return the CORBA any converted into the corresponding Java type, or <code>null</code> if it failed.
*/
public Object corbaAnyToObject(Any any) {
// @TODO check any==null
// initialize the return value
Object returnValue = null;
// get the CORBA typecode enum.
// we need this to deal with the simple types
org.omg.CORBA.TCKind anyKind = any.type().kind();
// $ACSROOT/include/baciValue.h (the "Type" enum).
switch(anyKind.value()) {
case org.omg.CORBA.TCKind._tk_null:
// this case is quite simple. A null CORBA reference is null in Java as well
returnValue = null;
break;
case org.omg.CORBA.TCKind._tk_string:
// simple type in which we have an extract method
returnValue = any.extract_string();
break;
case org.omg.CORBA.TCKind._tk_double:
// simple type in which we have an extract method
returnValue = new Double(any.extract_double());
break;
case org.omg.CORBA.TCKind._tk_long:
// simple type in which we have an extract method
returnValue = new Integer(any.extract_long());
break;
case org.omg.CORBA.TCKind._tk_alias:
String id = null;
try {
id = any.type().id();
} catch (BadKind ex) {
// should never happen for a tk_alias
}
switch(id) {
case "IDL:alma/ACS/longSeq:1.0":
returnValue = longSeqHelper.extract(any);
break;
case "IDL:alma/ACS/uLongSeq:1.0":
returnValue = uLongSeqHelper.extract(any);
break;
case "IDL:alma/ACS/uLongLongSeq:1.0":
returnValue = uLongLongSeqHelper.extract(any);
break;
case "IDL:alma/ACS/floatSeq:1.0":
returnValue = floatSeqHelper.extract(any);
break;
case "IDL:alma/ACS/doubleSeq:1.0":
returnValue = doubleSeqHelper.extract(any);
break;
case "IDL:alma/ACS/stringSeq:1.0":
returnValue = stringSeqHelper.extract(any);
break;
case "IDL:alma/ACS/booleanSeq:1.0":
returnValue = booleanSeqHelper.extract(any);
break;
default:
// who knows if there could be "IDL:alma/ACS/patternSeq:1.0" etc
m_logger.severe("Got an unexpected tk_alias with id=" + id);
}
break;
case org.omg.CORBA.TCKind._tk_ulong:
// simple type in which we have an extract method
returnValue = new Integer(any.extract_ulong());
break;
case org.omg.CORBA.TCKind._tk_longlong:
// simple type in which we have an extract method
returnValue = new Long(any.extract_longlong());
break;
case org.omg.CORBA.TCKind._tk_ulonglong:
// simple type in which we have an extract method
returnValue = new Long(any.extract_ulonglong());
break;
case org.omg.CORBA.TCKind._tk_float:
// simple type in which we have an extract method
returnValue = new Float(any.extract_float());
break;
// pretty bad if we get this far!
default:
m_logger.severe("Could not extract an any of type " + any.type().toString());
break;
}
return returnValue;
}
use of org.omg.CORBA.TypeCodePackage.BadKind in project wildfly by wildfly.
the class ValueDefImpl method allDone.
public void allDone() throws IRConstructionException {
getReference();
delegate.allDone();
if (baseValueTypeCode != null && baseValueTypeCode.kind() != TCKind.tk_null) {
try {
baseValue = baseValueTypeCode.id();
} catch (BadKind ex) {
throw IIOPLogger.ROOT_LOGGER.badKindForSuperValueType(id());
}
Contained c = repository.lookup_id(baseValue);
base_value_ref = ValueDefHelper.narrow(c);
} else
// TODO: is this right?
baseValue = "IDL:omg.org/CORBA/ValueBase:1.0";
// Resolve supported interfaces
supported_interfaces_ref = new InterfaceDef[supported_interfaces.length];
for (int i = 0; i < supported_interfaces.length; ++i) {
InterfaceDef iDef = InterfaceDefHelper.narrow(repository.lookup_id(supported_interfaces[i]));
if (iDef == null)
throw IIOPLogger.ROOT_LOGGER.errorResolvingRefToImplementedInterface(id(), supported_interfaces[i]);
supported_interfaces_ref[i] = iDef;
}
// Resolve abstract base valuetypes
abstract_base_valuetypes_ref = new ValueDef[abstract_base_valuetypes.length];
for (int i = 0; i < abstract_base_valuetypes.length; ++i) {
ValueDef vDef = ValueDefHelper.narrow(repository.lookup_id(abstract_base_valuetypes[i]));
if (vDef == null)
throw IIOPLogger.ROOT_LOGGER.errorResolvingRefToAbstractValuetype(id(), abstract_base_valuetypes[i]);
abstract_base_valuetypes_ref[i] = vDef;
}
}
use of org.omg.CORBA.TypeCodePackage.BadKind in project ACS by ACS-Community.
the class AnyExtractor method extractData.
/**
* The main method of this class.
* It checks <code>inSequence</code> for the recognized data types
* and extracts them using the respective Corba Helper classes.
* We keep NaN floating point types, so that they will have to be supressed later in the
* data processing if needed.
* <p>
* Currently this method also rearranges the sequence data based on information
* obtained from monitorPointExpert. This should be done separately in the future.
*
* @param inSequence
* The sequence of data from one property (monitor point) from one collector interval.
* @param propertyName Used along with {@link #monitorPointExpert} for MP-specific data restructuring.
* @return List of one or many MonitorPointTimeSeries objects extracted from inSequence.
* The list position is in line with the "derived index" in case a monitor point was expanded into many.
* @throws AcsJNoResourcesEx
*/
List<MonitorPointTimeSeries> extractData(Any inSequence, String propertyName) throws AcsJNoResourcesEx {
List<MonitorPointTimeSeries> outList = new ArrayList<MonitorPointTimeSeries>();
try {
// For this case, the index, i.e., the position inside the sequence is 0
if (inSequence.type().equal(doubleBlobDataSeqHelper.type())) {
doubleBlobData[] blobDataArray = doubleBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, doubleBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (doubleBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// Double
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // This is time series data coming from a multi-valued property.
if (inSequence.type().equal(doubleSeqBlobDataSeqHelper.type())) {
doubleSeqBlobData[] blobDataMatrix = doubleSeqBlobDataSeqHelper.extract(inSequence);
if (blobDataMatrix != null && blobDataMatrix.length > 0) {
if (monitorPointExpert.isMultivaluedMonitorPoint(propertyName)) {
// We interpret this as a time series of a single multi-valued monitor point
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, doubleSeqBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (doubleSeqBlobData blobDataArray : blobDataMatrix) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
for (double value : blobDataArray.value) {
// Double
mpv.addValue(value);
}
mpTs.addMonitorPointValue(mpv);
}
} else {
// We interpret this as a time series of multiple single-valued monitor points
populateList(outList, blobDataMatrix[0].value.length, doubleBlobDataSeqHelper.type().id());
for (doubleSeqBlobData blobDataArray : blobDataMatrix) {
int index = 0;
for (double value : blobDataArray.value) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// Double
mpv.addValue(value);
MonitorPointTimeSeries mpTs = outList.get(index);
mpTs.addMonitorPointValue(mpv);
index++;
}
}
}
}
} else // This is time series data coming from a simple property.
if (inSequence.type().equal(floatBlobDataSeqHelper.type())) {
floatBlobData[] blobDataArray = floatBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, floatBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (floatBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// Float
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // This is time series data coming from a multi-valued property.
if (inSequence.type().equal(floatSeqBlobDataSeqHelper.type())) {
floatSeqBlobData[] blobDataMatrix = floatSeqBlobDataSeqHelper.extract(inSequence);
if (blobDataMatrix != null && blobDataMatrix.length > 0) {
if (monitorPointExpert.isMultivaluedMonitorPoint(propertyName)) {
// We interpret this as a time series of a single multi-valued monitor point
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, floatSeqBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (floatSeqBlobData blobDataArray : blobDataMatrix) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
for (float value : blobDataArray.value) {
// Float
mpv.addValue(value);
}
mpTs.addMonitorPointValue(mpv);
}
} else {
// We interpret this as a time series of multiple single-valued monitor points
populateList(outList, blobDataMatrix[0].value.length, floatBlobDataSeqHelper.type().id());
for (floatSeqBlobData blobDataArray : blobDataMatrix) {
int index = 0;
for (float value : blobDataArray.value) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// Float
mpv.addValue(value);
MonitorPointTimeSeries mpTs = outList.get(index);
mpTs.addMonitorPointValue(mpv);
index++;
}
}
}
}
} else // This is time series data coming from a simple property.
if (inSequence.type().equal(longBlobDataSeqHelper.type())) {
longBlobData[] blobDataArray = longBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, longBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (longBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// Long
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // This is time series data coming from a multi-valued property.
if (inSequence.type().equal(longSeqBlobDataSeqHelper.type())) {
longSeqBlobData[] blobDataMatrix = longSeqBlobDataSeqHelper.extract(inSequence);
if (blobDataMatrix != null && blobDataMatrix.length > 0) {
if (monitorPointExpert.isMultivaluedMonitorPoint(propertyName)) {
// We interpret this as a time series of a single multi-valued monitor point
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, longSeqBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (longSeqBlobData blobDataArray : blobDataMatrix) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
for (long value : blobDataArray.value) {
// Long
mpv.addValue(value);
}
mpTs.addMonitorPointValue(mpv);
}
} else {
// We interpret this as a time series of multiple single-valued monitor points
populateList(outList, blobDataMatrix[0].value.length, longBlobDataSeqHelper.type().id());
for (longSeqBlobData blobDataArray : blobDataMatrix) {
int index = 0;
for (long value : blobDataArray.value) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// Long
mpv.addValue(value);
MonitorPointTimeSeries mpTs = outList.get(index);
mpTs.addMonitorPointValue(mpv);
index++;
}
}
}
}
} else // This is time series data coming from a simple property.
if (inSequence.type().equal(uLongBlobDataSeqHelper.type())) {
uLongBlobData[] blobDataArray = uLongBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, uLongBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (uLongBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// TODO: use Long and fix mismatch if blobData.value < 0
// Integer
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // This is time series data coming from a multi-valued property.
if (inSequence.type().equal(uLongSeqBlobDataSeqHelper.type())) {
uLongSeqBlobData[] blobDataMatrix = uLongSeqBlobDataSeqHelper.extract(inSequence);
if (blobDataMatrix != null && blobDataMatrix.length > 0) {
if (monitorPointExpert.isMultivaluedMonitorPoint(propertyName)) {
// We interpret this as a time series of a single multi-valued monitor point
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, uLongSeqBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (uLongSeqBlobData blobDataArray : blobDataMatrix) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
for (int value : blobDataArray.value) {
// TODO: use Long and fix mismatch if value < 0
// Integer
mpv.addValue(value);
}
mpTs.addMonitorPointValue(mpv);
}
} else {
// We interpret this as a time series of multiple single-valued monitor points
populateList(outList, blobDataMatrix[0].value.length, uLongBlobDataSeqHelper.type().id());
for (uLongSeqBlobData blobDataArray : blobDataMatrix) {
int index = 0;
for (int value : blobDataArray.value) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// TODO: use Long and fix mismatch if value < 0
// Integer
mpv.addValue(value);
MonitorPointTimeSeries mpTs = outList.get(index);
mpTs.addMonitorPointValue(mpv);
index++;
}
}
}
}
} else // This is time series data coming from a simple property.
if (inSequence.type().equal(longLongBlobDataSeqHelper.type())) {
longLongBlobData[] blobDataArray = longLongBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, longLongBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (longLongBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// Long
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // This is time series data coming from a multi-valued property.
if (inSequence.type().equal(longLongSeqBlobDataSeqHelper.type())) {
longLongSeqBlobData[] blobDataMatrix = longLongSeqBlobDataSeqHelper.extract(inSequence);
if (blobDataMatrix != null && blobDataMatrix.length > 0) {
if (monitorPointExpert.isMultivaluedMonitorPoint(propertyName)) {
// We interpret this as a time series of a single multi-valued monitor point
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, longLongSeqBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (longLongSeqBlobData blobDataArray : blobDataMatrix) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
for (long value : blobDataArray.value) {
// Long
mpv.addValue(value);
}
mpTs.addMonitorPointValue(mpv);
}
} else {
// We interpret this as a time series of multiple single-valued monitor points
populateList(outList, blobDataMatrix[0].value.length, longLongBlobDataSeqHelper.type().id());
for (longLongSeqBlobData blobDataArray : blobDataMatrix) {
int index = 0;
for (long value : blobDataArray.value) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// Long
mpv.addValue(value);
MonitorPointTimeSeries mpTs = outList.get(index);
mpTs.addMonitorPointValue(mpv);
index++;
}
}
}
}
} else // This is time series data coming from a simple property.
if (inSequence.type().equal(uLongLongBlobDataSeqHelper.type())) {
uLongLongBlobData[] blobDataArray = uLongLongBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, uLongLongBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (uLongLongBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// TODO: Use BigInteger and fix mismatch for negative values, something like
// if (blobData.value < 0) {BigInteger.valueOf(blobData.value).add(new BigInteger("10000000000000000", 16)));
// This will not resolve overflow problems with computing the statistics though.
// Or better get rid of "unsigned long long" in our IDL, or replace it with something like
// "typedef fixed<31,0> BigInt"
// Long
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // This is time series data coming from a multi-valued property.
if (inSequence.type().equal(uLongLongSeqBlobDataSeqHelper.type())) {
uLongLongSeqBlobData[] blobDataMatrix = uLongLongSeqBlobDataSeqHelper.extract(inSequence);
if (blobDataMatrix != null && blobDataMatrix.length > 0) {
if (monitorPointExpert.isMultivaluedMonitorPoint(propertyName)) {
// We interpret this as a time series of a single multi-valued monitor point
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, uLongLongSeqBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (uLongLongSeqBlobData blobDataArray : blobDataMatrix) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// TODO: See type mismatch comment above for uLongLongBlobDataSeq
for (long value : blobDataArray.value) {
// Long
mpv.addValue(value);
}
mpTs.addMonitorPointValue(mpv);
}
} else {
// We interpret this as a time series of multiple single-valued monitor points
populateList(outList, blobDataMatrix[0].value.length, uLongLongBlobDataSeqHelper.type().id());
for (uLongLongSeqBlobData blobDataArray : blobDataMatrix) {
int index = 0;
// TODO: See type mismatch comment above for uLongLongBlobDataSeq
for (long value : blobDataArray.value) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// Long
mpv.addValue(value);
MonitorPointTimeSeries mpTs = outList.get(index);
mpTs.addMonitorPointValue(mpv);
index++;
}
}
}
}
} else // This is time series data coming from a simple property.
if (inSequence.type().equal(booleanBlobDataSeqHelper.type())) {
booleanBlobData[] blobDataArray = booleanBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, booleanBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (booleanBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// Boolean
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // This is time series data coming from a multi-valued property.
if (inSequence.type().equal(booleanSeqBlobDataSeqHelper.type())) {
booleanSeqBlobData[] blobDataMatrix = booleanSeqBlobDataSeqHelper.extract(inSequence);
if (blobDataMatrix != null && blobDataMatrix.length > 0) {
if (monitorPointExpert.isMultivaluedMonitorPoint(propertyName)) {
// We interpret this as a time series of a single multi-valued monitor point
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, booleanSeqBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (booleanSeqBlobData blobDataArray : blobDataMatrix) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
for (boolean value : blobDataArray.value) {
// Boolean
mpv.addValue(value);
}
mpTs.addMonitorPointValue(mpv);
}
} else {
// We interpret this as a time series of multiple single-valued monitor points
populateList(outList, blobDataMatrix[0].value.length, booleanBlobDataSeqHelper.type().id());
for (booleanSeqBlobData blobDataArray : blobDataMatrix) {
int index = 0;
for (boolean value : blobDataArray.value) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// Boolean
mpv.addValue(value);
MonitorPointTimeSeries mpTs = outList.get(index);
mpTs.addMonitorPointValue(mpv);
index++;
}
}
}
}
} else // patternBlobDataSeq
if (inSequence.type().equal(patternBlobDataSeqHelper.type())) {
patternBlobData[] blobDataArray = patternBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, patternBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (patternBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// Long
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // stringBlobDataSeq
if (inSequence.type().equal(stringBlobDataSeqHelper.type())) {
stringBlobData[] blobDataArray = stringBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, stringBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (stringBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// String
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else // stringSeqBlobDataSeq
if (inSequence.type().equal(stringSeqBlobDataSeqHelper.type())) {
stringSeqBlobData[] blobDataMatrix = stringSeqBlobDataSeqHelper.extract(inSequence);
if (blobDataMatrix != null && blobDataMatrix.length > 0) {
if (monitorPointExpert.isMultivaluedMonitorPoint(propertyName)) {
// We interpret this as a time series of a single multi-valued monitor point
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, stringSeqBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (stringSeqBlobData blobDataArray : blobDataMatrix) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
for (String value : blobDataArray.value) {
// String
mpv.addValue(value);
}
mpTs.addMonitorPointValue(mpv);
}
} else {
// We interpret this as a time series of multiple single-valued monitor points
populateList(outList, blobDataMatrix[0].value.length, stringBlobDataSeqHelper.type().id());
for (stringSeqBlobData blobDataArray : blobDataMatrix) {
int index = 0;
for (String value : blobDataArray.value) {
MonitorPointValue mpv = new MonitorPointValue(blobDataArray.time);
// String
mpv.addValue(value);
MonitorPointTimeSeries mpTs = outList.get(index);
mpTs.addMonitorPointValue(mpv);
index++;
}
}
}
}
} else // enumBlobDataSeq
if (inSequence.type().equal(enumBlobDataSeqHelper.type())) {
enumBlobData[] blobDataArray = enumBlobDataSeqHelper.extract(inSequence);
MonitorPointTimeSeries mpTs = new MonitorPointTimeSeries(0, enumBlobDataSeqHelper.type().id());
outList.add(mpTs);
for (enumBlobData blobData : blobDataArray) {
MonitorPointValue mpv = new MonitorPointValue(blobData.time);
// Integer
mpv.addValue(blobData.value);
mpTs.addMonitorPointValue(mpv);
}
} else {
logger.warning("Unknown CORBA data type received by blobber");
throw new IllegalStateException("Unknown CORBA data type received, " + inSequence.type());
}
} catch (BadKind ex) {
// This should never happen because we call TypeCode.id() only on TypeCodes
// that do have an ID.
logger.log(Level.WARNING, "Unexpected exception related to reading Any TypeCode IDs.", ex);
}
return outList;
}
Aggregations