use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class WSDLTypes method mapToSequence.
public static CorbaType mapToSequence(QName name, QName schematypeName, QName arrayType, QName elName, int bound, boolean anonymous) {
CorbaType corbaTypeImpl = null;
// schematypeName = checkPrefix(schematypeName);
if (!anonymous) {
// Create a Sequence
Sequence corbaSeq = new Sequence();
corbaSeq.setName(name.getLocalPart());
corbaSeq.setQName(name);
corbaSeq.setType(schematypeName);
corbaSeq.setElemtype(arrayType);
corbaSeq.setElemname(elName);
corbaSeq.setBound(bound);
corbaSeq.setRepositoryID(WSDLToCorbaHelper.REPO_STRING + name.getLocalPart().replace('.', '/') + WSDLToCorbaHelper.IDL_VERSION);
corbaTypeImpl = corbaSeq;
} else {
// Create a Anonymous Sequence
Anonsequence corbaSeq = new Anonsequence();
corbaSeq.setName(name.getLocalPart());
corbaSeq.setQName(name);
corbaSeq.setType(schematypeName);
corbaSeq.setElemtype(arrayType);
corbaSeq.setElemname(elName);
corbaSeq.setBound(bound);
corbaTypeImpl = corbaSeq;
}
return corbaTypeImpl;
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class WSDLTypes method mapToArray.
public static CorbaType mapToArray(QName name, QName schematypeName, QName arrayType, QName elName, int bound, boolean anonymous) {
CorbaType corbatype = null;
if (!anonymous) {
// Create an Array
Array corbaArray = new Array();
corbaArray.setName(name.getLocalPart());
corbaArray.setType(schematypeName);
corbaArray.setElemtype(arrayType);
corbaArray.setElemname(elName);
corbaArray.setBound(bound);
corbaArray.setRepositoryID(WSDLToCorbaHelper.REPO_STRING + name.getLocalPart().replace('.', '/') + WSDLToCorbaHelper.IDL_VERSION);
corbaArray.setQName(name);
corbatype = corbaArray;
} else {
// Create an Anonymous Array
Anonarray corbaArray = new Anonarray();
corbaArray.setName(name.getLocalPart());
corbaArray.setType(schematypeName);
corbaArray.setElemtype(arrayType);
corbaArray.setElemname(elName);
corbaArray.setBound(bound);
corbaArray.setQName(name);
corbatype = corbaArray;
}
return corbatype;
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class WSDLToCorbaBindingTest method testFixedBindingGeneration.
@Test
public void testFixedBindingGeneration() throws Exception {
String fileName = getClass().getResource("/wsdl/fixed.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("Y");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertEquals(1, typemap.getElementsByTagName("corba:sequence").getLength());
assertEquals(5, typemap.getElementsByTagName("corba:fixed").getLength());
Element bindingElement = getElementNode(document, "binding");
assertEquals(5, bindingElement.getElementsByTagName("corba:operation").getLength());
QName bName = new QName("http://schemas.apache.org/idl/fixed.idl", "YCORBABinding", "tns");
Binding binding = model.getBinding(bName);
TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
Map<String, CorbaType> tmap = new HashMap<>();
for (CorbaType type : mapType.getStructOrExceptionOrUnion()) {
tmap.put(type.getName(), type);
}
Iterator<?> j = binding.getBindingOperations().iterator();
while (j.hasNext()) {
BindingOperation bindingOperation = (BindingOperation) j.next();
assertEquals("YCORBABinding", binding.getQName().getLocalPart());
assertEquals(1, bindingOperation.getExtensibilityElements().size());
checkFixedTypeOne(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkSequenceType(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeTwo(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeThree(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeFour(bindingOperation, tmap);
}
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class DeclaratorVisitor method visitNewTypes.
private void visitNewTypes(Scope newScope) {
CorbaType nextCorbaType = null;
XmlSchemaType nextSchemaType = null;
CorbaType oldCorbaType = getCorbaType();
QName newQname = new QName(getCorbaType().getQName().getNamespaceURI(), newScope.toString());
if (oldCorbaType instanceof Alias) {
// Alias
//
Alias oldAlias = (Alias) oldCorbaType;
Alias alias = new Alias();
alias.setQName(newQname);
alias.setBasetype(oldAlias.getBasetype());
alias.setType(oldAlias.getType());
alias.setRepositoryID(newScope.toIDLRepositoryID());
nextCorbaType = alias;
} else if (oldCorbaType instanceof Sequence) {
// Sequence
//
nextSchemaType = duplicateXmlSchemaComplexType(newScope);
Sequence oldSequence = (Sequence) oldCorbaType;
Sequence newSequence = new Sequence();
newSequence.setQName(newQname);
newSequence.setType(nextSchemaType.getQName());
newSequence.setElemtype(oldSequence.getElemtype());
newSequence.setElemname(oldSequence.getElemname());
newSequence.setBound(oldSequence.getBound());
newSequence.setRepositoryID(newScope.toIDLRepositoryID());
nextCorbaType = newSequence;
} else if (oldCorbaType instanceof Fixed) {
// Fixed
//
nextSchemaType = duplicateXmlSchemaSimpleType(newScope);
Fixed oldFixed = (Fixed) getCorbaType();
Fixed newFixed = new Fixed();
newFixed.setQName(newQname);
newFixed.setDigits(oldFixed.getDigits());
newFixed.setScale(oldFixed.getScale());
newFixed.setType(oldFixed.getType());
newFixed.setRepositoryID(newScope.toIDLRepositoryID());
nextCorbaType = newFixed;
} else {
System.err.println("[DeclaratorVisitor: Unexpected CORBA type error!]");
System.exit(1);
}
if (nextCorbaType != null) {
typeMap.getStructOrExceptionOrUnion().add(nextCorbaType);
}
}
use of org.apache.cxf.binding.corba.wsdl.CorbaType in project cxf by apache.
the class FixedPtConstVisitor method visit.
public void visit(AST fixedNode) {
// <fixed_pt_const_type> ::= "fixed"
XmlSchemaType stype = null;
CorbaType ctype = null;
QName corbaTypeQName = CorbaConstants.NE_CORBA_FIXED;
if (corbaTypeQName != null) {
QName schemaTypeQName = Constants.XSD_DECIMAL;
if (schemaTypeQName != null) {
stype = schemas.getTypeByQName(schemaTypeQName);
if (stype != null) {
ctype = new CorbaType();
ctype.setQName(corbaTypeQName);
ctype.setType(stype.getQName());
ctype.setName(stype.getQName().getLocalPart());
}
}
}
schemaType = stype;
corbaType = ctype;
}
Aggregations