use of org.apache.ws.commons.schema.XmlSchemaAnnotationItem in project cxf by apache.
the class WSDLToCorbaBinding method addCorbaElements.
private void addCorbaElements(CorbaType corbaTypeImpl, XmlSchema xmlSchemaTypes) throws Exception {
Map<QName, XmlSchemaElement> elements = xmlSchemaTypes.getElements();
for (XmlSchemaElement el : elements.values()) {
QName elName = el.getQName();
XmlSchemaType schemaType = el.getSchemaType();
if (elName == null) {
elName = el.getRef().getTargetQName();
schemaType = helper.getSchemaType(elName);
}
boolean anonymous = false;
if (schemaType == null) {
anonymous = true;
} else {
anonymous = WSDLTypes.isAnonymous(schemaType.getName());
}
if (schemaType != null) {
XmlSchemaAnnotation annotation = null;
if (el.getAnnotation() != null) {
annotation = el.getAnnotation();
}
// this situation won't be handled. REVISIT.
if (annotation != null) {
XmlSchemaAppInfo appInfo = null;
for (XmlSchemaAnnotationItem ann : annotation.getItems()) {
if (ann instanceof XmlSchemaAppInfo) {
appInfo = (XmlSchemaAppInfo) ann;
break;
}
}
if (appInfo != null) {
NodeList nlist = appInfo.getMarkup();
Node node = nlist.item(0);
String info = node.getNodeValue();
info = info.trim();
String annotationBindingName = "";
if ("corba:binding=".equals(info.substring(0, 14))) {
annotationBindingName = info.substring(14);
}
if (bindingName.equals(annotationBindingName)) {
annotation = null;
}
}
}
corbaTypeImpl = helper.convertSchemaToCorbaType(schemaType, elName, schemaType, annotation, anonymous);
if (el.isNillable()) {
QName uname = helper.createQNameCorbaNamespace(corbaTypeImpl.getQName().getLocalPart() + "_nil");
boolean isQualified = corbaTypeImpl.isSetQualified() && corbaTypeImpl.isQualified();
corbaTypeImpl = helper.createNillableUnion(uname, helper.checkPrefix(elName), helper.checkPrefix(corbaTypeImpl.getQName()), isQualified);
}
if (corbaTypeImpl != null && !helper.isDuplicate(corbaTypeImpl)) {
typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
}
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaAnnotationItem in project cxf by apache.
the class WSDLTypes method processObject.
public static CorbaType processObject(Definition definition, XmlSchemaComplexType complex, XmlSchemaAnnotation annotation, QName typeName, QName defaultName, String idlNamespace) throws Exception {
CorbaType corbaTypeImpl = null;
if (annotation != null) {
for (XmlSchemaAnnotationItem item : annotation.getItems()) {
XmlSchemaAppInfo appInfo = (XmlSchemaAppInfo) item;
if (appInfo != null) {
NodeList nlist = appInfo.getMarkup();
Node node = nlist.item(0);
String info = node.getNodeValue();
info = info.trim();
if ("corba:binding=".equals(info.substring(0, 14))) {
String bindingName = info.substring(14);
QName bqname = new QName(definition.getTargetNamespace(), bindingName);
// Check if the Binding with name already exists
Binding binding = null;
if (WSDLToCorbaHelper.queryBinding(definition, bqname)) {
binding = definition.getBinding(bqname);
}
if (binding != null) {
org.apache.cxf.binding.corba.wsdl.Object obj = new org.apache.cxf.binding.corba.wsdl.Object();
PortType portT = binding.getPortType();
QName name = new QName(idlNamespace, portT.getQName().getLocalPart(), definition.getPrefix(idlNamespace));
obj.setName(name.getLocalPart());
obj.setQName(name);
QName bName = binding.getQName();
obj.setBinding(bName);
// get the repository id of the binding.
String repId = null;
Iterator<?> bindIter = binding.getExtensibilityElements().iterator();
while (bindIter.hasNext()) {
BindingType type = (BindingType) bindIter.next();
repId = type.getRepositoryID();
}
obj.setRepositoryID(repId);
obj.setType(typeName);
corbaTypeImpl = obj;
} else {
// if (isVerboseOn()) {
System.out.println("Could not find binding for: " + bqname);
// }
}
}
}
}
}
if (corbaTypeImpl == null) {
org.apache.cxf.binding.corba.wsdl.Object obj = new org.apache.cxf.binding.corba.wsdl.Object();
QName name = new QName(idlNamespace, "CORBA.Object", definition.getPrefix(idlNamespace));
obj.setName(name.getLocalPart());
obj.setQName(name);
obj.setRepositoryID("IDL:omg.org/CORBA/Object/1.0");
obj.setType(typeName);
corbaTypeImpl = obj;
}
return corbaTypeImpl;
}
Aggregations