use of org.apache.cxf.binding.corba.wsdl.Object in project cxf by apache.
the class ObjectReferenceVisitor method visitDefaultTypeObjectReference.
private void visitDefaultTypeObjectReference(AST node) {
// Even though we don't need to add a schema definition for a default endpoint
// type, we still need to create a schema type so that the visitor knows what
// kind of parameter this is. For a default endpoint, we'll just provide a
// reference to a WS addressing EndpointReferenceType.
XmlSchema[] scs = schemas.getXmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE);
XmlSchema wsaSchema = null;
if (scs != null) {
for (XmlSchema sc : scs) {
if (ReferenceConstants.WSADDRESSING_NAMESPACE.equals(sc.getTargetNamespace())) {
wsaSchema = sc;
break;
}
}
}
if (wsaSchema == null) {
wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
}
XmlSchemaType objectType = new XmlSchemaSimpleType(wsaSchema, true);
objectType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
setSchemaType(objectType);
// Build and assign the corba:object to the visitor
Object corbaObject = new Object();
corbaObject.setQName(new QName(typeMap.getTargetNamespace(), "CORBA.Object"));
corbaObject.setRepositoryID("IDL:omg.org/CORBA/Object/1.0");
corbaObject.setType(objectType.getQName());
setCorbaType(corbaObject);
// type once.
if (!isReferenceCORBATypeDefined(corbaObject.getQName())) {
typeMap.getStructOrExceptionOrUnion().add(corbaObject);
}
}
use of org.apache.cxf.binding.corba.wsdl.Object in project cxf by apache.
the class ObjectReferenceVisitor method visitCustomTypeObjectReference.
private void visitCustomTypeObjectReference(AST node) {
QName bindingName = null;
QName referenceName = null;
String repositoryID = null;
Scope currentScope = getScope();
Scope customScope = null;
if ((node.getFirstChild() == null) || (node.getFirstChild() != null && node.getFirstChild().getType() != IDLTokenTypes.SCOPEOP)) {
while (bindingName == null && currentScope != currentScope.getParent()) {
if (ScopedNameVisitor.isFullyScopedName(node)) {
customScope = ScopedNameVisitor.getFullyScopedName(currentScope, node);
} else {
customScope = new Scope(currentScope, node);
}
if (mapper.isDefaultMapping()) {
referenceName = new QName(schema.getTargetNamespace(), customScope.toString() + "Ref");
} else {
String tns = mapper.map(customScope.getParent());
referenceName = new QName(tns, customScope.tail() + "Ref");
}
repositoryID = customScope.toIDLRepositoryID();
bindingName = getBindingQNameByID(definition, repositoryID, objRefWsdlVisitor);
currentScope = currentScope.getParent();
}
}
if (bindingName == null) {
// Global scope is our last chance to resolve the node
if (ScopedNameVisitor.isFullyScopedName(node)) {
customScope = ScopedNameVisitor.getFullyScopedName(new Scope(), node);
if (mapper.isDefaultMapping()) {
referenceName = new QName(schema.getTargetNamespace(), customScope.toString() + "Ref");
} else {
String tns = mapper.map(customScope.getParent());
referenceName = new QName(tns, customScope.tail() + "Ref");
}
} else {
// customScope = currentScope;
customScope = new Scope(new Scope(), node);
if (mapper.isDefaultMapping()) {
referenceName = new QName(schema.getTargetNamespace(), customScope.toString() + "Ref");
} else {
String tns = mapper.map(customScope.getParent());
referenceName = new QName(tns, customScope.tail() + "Ref");
}
}
repositoryID = customScope.toIDLRepositoryID();
bindingName = getBindingQNameByID(definition, repositoryID, objRefWsdlVisitor);
if (bindingName == null) {
// check bindingName with prefix
customScope.setPrefix(objRefWsdlVisitor.getPragmaPrefix());
repositoryID = customScope.toIDLRepositoryID();
bindingName = getBindingQNameByID(definition, repositoryID, objRefWsdlVisitor);
}
}
if (bindingName == null) {
// We need to have a binding for this kind of object reference to work
throw new RuntimeException("[ObjectReferenceVisitor: No binding available for endpoint]");
}
// Create a schema namespace for WS addressing and use it to create an endpoint
// reference type. This will be used as the type for our endpoint reference.
XmlSchema[] scs = schemas.getXmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE);
XmlSchema wsaSchema = null;
if (scs != null) {
for (XmlSchema sc : scs) {
if (ReferenceConstants.WSADDRESSING_NAMESPACE.equals(sc.getTargetNamespace())) {
wsaSchema = sc;
break;
}
}
}
if (wsaSchema == null) {
wsaSchema = new XmlSchema(ReferenceConstants.WSADDRESSING_NAMESPACE, schemas);
}
XmlSchemaType wsaType = new XmlSchemaSimpleType(wsaSchema, true);
wsaType.setName(ReferenceConstants.WSADDRESSING_LOCAL_NAME);
// Check to see if we have already defined an element for this reference type. If
// we have, then there is no need to add it to the schema again.
isDuplicateReference(referenceName, bindingName, customScope, wsaType, node);
setSchemaType(wsaType);
// Build and assign the corba:object to the visitor
Object corbaObject = new Object();
corbaObject.setBinding(bindingName);
corbaObject.setQName(new QName(typeMap.getTargetNamespace(), customScope.toString()));
corbaObject.setRepositoryID(repositoryID);
corbaObject.setType(wsaType.getQName());
setCorbaType(corbaObject);
// type once.
if (!isReferenceCORBATypeDefined(corbaObject.getQName())) {
typeMap.getStructOrExceptionOrUnion().add(corbaObject);
}
}
Aggregations