use of org.apache.cxf.binding.corba.wsdl.Sequence in project cxf by apache.
the class ScopedNameVisitor method findNonSchemaType.
protected static boolean findNonSchemaType(String name, WSDLASTVisitor wsdlVisitor, VisitorTypeHolder holder) {
boolean result = false;
TypeMappingType typeMap = wsdlVisitor.getTypeMap();
XmlSchemaCollection schemas = wsdlVisitor.getSchemas();
QName qname = new QName(typeMap.getTargetNamespace(), name);
CorbaType corbaType = findCorbaType(typeMap, qname);
if (corbaType != null) {
if (corbaType instanceof Alias) {
result = true;
if (holder != null) {
populateAliasSchemaType(corbaType, wsdlVisitor, holder);
}
} else if (((corbaType instanceof Sequence) || (corbaType instanceof Anonsequence)) && ((corbaType.getType().equals(Constants.XSD_BASE64)))) {
// special case of sequence of octets
result = true;
if (holder != null) {
holder.setCorbaType(corbaType);
holder.setSchemaType(schemas.getTypeByQName(corbaType.getType()));
}
}
}
return result;
}
use of org.apache.cxf.binding.corba.wsdl.Sequence in project cxf by apache.
the class WSDLToIDLAction method createType.
protected IdlType createType(QName idlType, String[] name, CorbaType corbaType) throws Exception {
if (idlType.getLocalPart().equals("CORBA.Object")) {
return IdlInterface.create(null, "Object");
}
CorbaType corbaTypeImpl = corbaType;
if (corbaTypeImpl == null) {
corbaTypeImpl = getCorbaType(idlType);
}
if (corbaTypeImpl == null) {
String msgStr = "Type " + idlType.getLocalPart() + " not found.";
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(msgStr, LOG);
throw new Exception(msg.toString());
}
IdlScopeBase scope = root;
StringBuilder dotScopedName = new StringBuilder("");
for (int i = 0; i < name.length - 1; ++i) {
dotScopedName.append(name[i]);
// name array.
if ("CORBA".equals(dotScopedName.toString()) && name.length == 2 && i == 0 && name[1].equals("Object")) {
break;
}
IdlDefn idlDef = scope.lookup(name[i]);
if (idlDef == null) {
// Before creating module, check to see if a Corba type
// represent this name aleady exists.
// For example if type is a.b.c and we are about to create
// module b, look to see if a.b
// is an interface that needs to be processed
QName qname = new QName(corbaTypeImpl.getType().getNamespaceURI(), dotScopedName.toString());
// Check to see if CORBAType exists. If so, create type for it
// otherwise
// create module for this scope
CorbaType possibleCorbaType = getCorbaType(qname);
if (possibleCorbaType != null) {
idlDef = findType(qname);
}
if (idlDef == null) {
idlDef = IdlModule.create(scope, name[i]);
scope.addToScope(idlDef);
}
}
dotScopedName.append(".");
scope = (IdlScopeBase) idlDef;
}
IdlType result = null;
String local = name[name.length - 1];
if (corbaTypeImpl instanceof Enum) {
result = createEnum((Enum) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Sequence) {
result = createSequence((Sequence) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Anonsequence) {
result = createAnonSequence((Anonsequence) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof org.apache.cxf.binding.corba.wsdl.Exception) {
result = createIdlException((org.apache.cxf.binding.corba.wsdl.Exception) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Struct) {
result = createStruct((Struct) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Union) {
result = createUnion((Union) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Alias) {
result = createTypedef((Alias) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Array) {
result = createArray((Array) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Anonarray) {
result = createAnonArray((Anonarray) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Fixed) {
result = createFixed((Fixed) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Anonfixed) {
result = createAnonFixed((Anonfixed) corbaTypeImpl, scope, local);
} else if (corbaTypeImpl instanceof Const) {
result = createConst((Const) corbaTypeImpl, scope, local);
} else {
result = checkAnon(corbaTypeImpl, scope, local);
}
if (result == null && corbaTypeImpl instanceof org.apache.cxf.binding.corba.wsdl.Object) {
result = createInterface((org.apache.cxf.binding.corba.wsdl.Object) corbaTypeImpl, scope, local);
}
return result;
}
use of org.apache.cxf.binding.corba.wsdl.Sequence in project cxf by apache.
the class WSDLTypes method getOctetCorbaType.
public static CorbaType getOctetCorbaType(QName name, QName stype, int bound) {
Sequence seq = new Sequence();
seq.setName(name.getLocalPart());
seq.setQName(name);
seq.setType(stype);
seq.setElemtype(CorbaConstants.NT_CORBA_OCTET);
seq.setBound(bound);
seq.setRepositoryID(WSDLToCorbaHelper.REPO_STRING + name.getLocalPart().replace('.', '/') + WSDLToCorbaHelper.IDL_VERSION);
return seq;
}
use of org.apache.cxf.binding.corba.wsdl.Sequence in project cxf by apache.
the class SequenceVisitor method generateCorbaSequence.
private CorbaType generateCorbaSequence(CorbaType ctype, XmlSchemaType schemaType, Scope scopedName, long bound, Scope fullyQualifiedName) {
// create the corba sequence
Sequence corbaSeq = new Sequence();
if (bound == -1) {
bound = 0;
}
corbaSeq.setBound(bound);
corbaSeq.setQName(new QName(typeMap.getTargetNamespace(), scopedName.toString()));
corbaSeq.setType(schemaType.getQName());
// REVISIT, if we add qualification then change the below.
corbaSeq.setElemname(new QName("", ELEMENT_NAME));
if (ctype != null) {
corbaSeq.setElemtype(ctype.getQName());
} else {
SequenceDeferredAction seqAction = new SequenceDeferredAction(corbaSeq);
wsdlVisitor.getDeferredActions().add(fullyQualifiedName, seqAction);
}
corbaSeq.setRepositoryID(scopedName.toIDLRepositoryID());
return corbaSeq;
}
use of org.apache.cxf.binding.corba.wsdl.Sequence in project cxf by apache.
the class CorbaHandlerUtils method isPrimitiveIDLTypeSequence.
public static boolean isPrimitiveIDLTypeSequence(CorbaObjectHandler handler) {
CorbaType seqType = handler.getType();
QName seqElementType;
if (seqType instanceof Anonsequence) {
Anonsequence anonSeqType = (Anonsequence) seqType;
seqElementType = anonSeqType.getElemtype();
} else {
Sequence type = (Sequence) seqType;
seqElementType = type.getElemtype();
}
return CorbaUtils.isPrimitiveIdlType(seqElementType);
}
Aggregations