Search in sources :

Example 1 with IdlModule

use of org.apache.cxf.tools.corba.common.idltypes.IdlModule in project cxf by apache.

the class WSDLToIDLAction method generateIDL.

private void generateIDL(Definition definition, Binding binding) {
    List<?> ext = binding.getExtensibilityElements();
    if (!(ext.get(0) instanceof BindingType)) {
        // throw an error not a corba binding
        throw new RuntimeException(binding.getQName() + " is not a corba binding, " + "please pass a corba binding/porttype to use");
    }
    String[] nm = unscopeName(binding.getPortType().getQName().getLocalPart());
    int pos = nm[nm.length - 1].lastIndexOf("Binding");
    if (pos != -1) {
        nm[nm.length - 1] = nm[nm.length - 1].substring(0, pos);
    }
    IdlScopeBase parent = root;
    if (nm.length > 1) {
        for (int i = 0; i < nm.length - 1; ++i) {
            IdlModule mod = IdlModule.create(parent, nm[i]);
            parent.addToScope(mod);
            parent = mod;
        }
    }
    intf = IdlInterface.create(parent, nm[nm.length - 1]);
    parent.holdForScope(intf);
    try {
        getAllIdlTypes();
        collectIdlDefns(binding);
        root.flush();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    parent.promoteHeldToScope();
    root.write(printWriter);
}
Also used : BindingType(org.apache.cxf.binding.corba.wsdl.BindingType) IdlModule(org.apache.cxf.tools.corba.common.idltypes.IdlModule) IdlString(org.apache.cxf.tools.corba.common.idltypes.IdlString) IdlScopeBase(org.apache.cxf.tools.corba.common.idltypes.IdlScopeBase) IdlException(org.apache.cxf.tools.corba.common.idltypes.IdlException)

Aggregations

BindingType (org.apache.cxf.binding.corba.wsdl.BindingType)1 IdlException (org.apache.cxf.tools.corba.common.idltypes.IdlException)1 IdlModule (org.apache.cxf.tools.corba.common.idltypes.IdlModule)1 IdlScopeBase (org.apache.cxf.tools.corba.common.idltypes.IdlScopeBase)1 IdlString (org.apache.cxf.tools.corba.common.idltypes.IdlString)1