if (compositeType instanceof ValueType)
value = new ObjectByValue((ValueType) compositeType);
else if (compositeType instanceof Struct)
value = new StructValue((Struct) compositeType);
else
throw new CorbaInvocationException("Parameter type not supported");
value.setMemberValues(compositeValues);
return value;
} else if (dataType instanceof AnyType) {
OMElement anyElement = (OMElement) param;
DefaultNamespaceGenerator namespaceGenerator = new DefaultNamespaceGenerator();
String defaultNamespace = namespaceGenerator.schemaNamespaceFromPackageName("").toString();
OMElement typeElement = anyElement.getFirstChildWithName(new QName(defaultNamespace, "type"));
if (typeElement != null) {
OMElement definitionElement = typeElement.getFirstChildWithName(new QName(defaultNamespace, "definition"));
OMElement typenameElement = typeElement.getFirstChildWithName(new QName(defaultNamespace, "typename"));
OMElement anyValueElement = anyElement.getFirstChildWithName(new QName(defaultNamespace, "value"));
if (typenameElement != null && anyValueElement != null) {
String typeName = typenameElement.getText();
String definition = definitionElement != null ? definitionElement.getText() : Constants.URI_DEFAULT_SCHEMA_XSD;
Object anyContent;
DataType anyValueType;
if (definition.equals(Constants.URI_DEFAULT_SCHEMA_XSD)) {
String anyValueString = anyValueElement.getText();
if (typeName.equals("boolean")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("boolean");
anyContent = Boolean.parseBoolean(anyValueString);
} else if (typeName.equals("double")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("double");
anyContent = Double.parseDouble(anyValueString);
} else if (typeName.equals("float")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("float");
anyContent = Float.parseFloat(anyValueString);
} else if (typeName.equals("unsignedByte")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("octet");
anyContent = Byte.parseByte(anyValueString);
} else if (typeName.equals("int")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("long");
anyContent = Integer.parseInt(anyValueString);
} else if (typeName.equals("long")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("longlong");
anyContent = Long.parseLong(anyValueString);
} else if (typeName.equals("short")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("short");
anyContent = Short.parseShort(anyValueString);
} else if (typeName.equals("string")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("string");
anyContent = anyValueString;
} else if (typeName.equals("unsignedShort")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("ushort");
anyContent = Short.parseShort(anyValueString);
} else if (typeName.equals("unsignedInt")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("ulong");
anyContent = Integer.parseInt(anyValueString);
} else if (typeName.equals("unsignedLong")) {
anyValueType = PrimitiveDataType.getPrimitiveDataType("ulonglong");
anyContent = Long.parseLong(anyValueString);
} else {
throw new CorbaInvocationException("Unsupported data type: " + typeName);
}
} else {
anyValueType = mapping.getDataType(new QName(definition, typeName));
if (anyValueType != null) {
anyContent = CorbaUtil.extractValue(anyValueType, anyValueElement.getFirstElement(), mapping);
} else {
throw new CorbaInvocationException("Unsupported data schema: " + definition + " type:" + typeName);
}
}
AnyValue anyValue = new AnyValue();
anyValue.setContent(anyContent);
anyValue.setContentType(anyValueType);