Package org.ogce.schemas.gfac.beans.utils

Examples of org.ogce.schemas.gfac.beans.utils.GFacSchemaException


            {
                builder = domfactory.newDocumentBuilder();
            }
            catch (javax.xml.parsers.ParserConfigurationException e)
            {
                throw new GFacSchemaException("Parser configuration exception: " + e.getMessage());
            }

            DOMImplementation dImpl = builder.getDOMImplementation();

            String policyID = portName + "_Policy";
            String inputPolicyID = portName + "_operationPolicy";

            UnknownExtensibilityElement serviceLevelPolicRef = null;
            UnknownExtensibilityElement opLevelPolicRef = null;
           
            String namespace = GFacConstants.GFAC_NAMESPACE;
            Document doc = dImpl.createDocument(namespace, "factoryServices", null);

           
            //TODO this is boken fix it
            String description = serviceMap.getService().getServiceDescription();
            if(description != null){
               
                Element documentation = doc.createElementNS("http://schemas.xmlsoap.org/wsdl/","wsdl:documentation");
                documentation.appendChild(doc.createTextNode(description));
                def.setDocumentationElement(documentation);
            }
           

            if(GFacConstants.TRANSPORT_LEVEL.equals(security))
            {
                def.addExtensibilityElement(createTransportLevelPolicy(dImpl, policyID));
                serviceLevelPolicRef = createWSPolicyRef(dImpl, policyID);
            }
            else if (GFacConstants.MESSAGE_SIGNATURE.equals(security))
            {
                def.addExtensibilityElement(WSPolicyGenerator.createServiceLevelPolicy(dImpl, policyID));
                def.addExtensibilityElement(WSPolicyGenerator.createOperationLevelPolicy(dImpl, "inputPolicy", inputPolicyID));
                serviceLevelPolicRef = createWSPolicyRef(dImpl, policyID);
                opLevelPolicRef = createWSPolicyRef(dImpl, inputPolicyID);
            }

            // Create types
            Types types = TypesGenerator.addTypes(def, dImpl, serviceMap, typens, globalTypens, methods);
            def.setTypes(types);

//            if(!abstractWSDL)
//            {
//                table = createMessageTable(serviceMap, typens, methods);
//            }

            // Create port types (only first port type)
            PortTypeImpl portType = addPortTypes(def, dImpl, portTypes, serviceQName);
            Binding binding = addBinding(def, nameSpaceURI, portType, serviceLevelPolicRef,dImpl);

            Vector methodDesc = WSDLGenUtil.getMethodDescriptions(serviceMap);
            for(int i = 0; i < methods.length; ++i)
            {
                String methodName = methods[i].getMethodName();
                Vector outParams = WSDLGenUtil.getOutParams(serviceMap, methodName);
               
               
                OperationImpl operation = addOperation(def, dImpl, methodName, (String) methodDesc.get(i),typens,outParams);
                portType.addOperation(operation);
               
                if(!abstractWSDL)
                {
                    UnknownExtensibilityElement wsInPolicyRef = null;
                    UnknownExtensibilityElement wsOutPolicyRef = null;

                    BindingInputImpl bindingInput = addBindingInput(def, methodName, wsInPolicyRef);
                    BindingOutputImpl bindingOutput = addBindingOutput(def, methodName, outParams, wsOutPolicyRef);
                    BindingOperation bindingOperation = addBindingOperation(def, operation,dImpl);
                    bindingOperation.setBindingInput(bindingInput);
                    bindingOperation.setBindingOutput(bindingOutput);
                    binding.addBindingOperation(bindingOperation);

                    if(opLevelPolicRef != null)
                    {
                        binding.addExtensibilityElement(opLevelPolicRef);                    }

                }
            }
            def.addPortType(portType);

            // =========== end of wsdl binding ===========

// FIXME: This is done as factory information is not needed
//            if(abstractWSDL)
//            {
//
//
//                Element factoryServices = doc.createElement("n:factoryServices");
//                factoryServices.setAttribute("xmlns:n", namespace);
//                Element factoryService = doc.createElement("n:factoryService");
//                factoryService.setAttribute("location", "http://rainier.extreme.indiana.edu:12345");
//                factoryService.setAttribute("portType", "n:GenericFactory");
//                factoryService.setAttribute("operation", "n:CreateService");
//                factoryServices.appendChild(factoryService);
//                UnknownExtensibilityElement elem = new UnknownExtensibilityElement();
//                elem.setElement(factoryServices);
//                def.addExtensibilityElement(elem);
//            }

            if (!abstractWSDL)
            {
                def.addBinding(binding);
                ServiceImpl service = (ServiceImpl) def.createService();
                service.setQName(wsdlQName);
               
                PortImpl port = (PortImpl) def.createPort();
                port.setName(wsdlQName.getLocalPart() + WSDL_PORT_SUFFIX);
                port.setBinding(binding);
                service.addPort(port);

                SOAPAddressImpl soapAddress = new SOAPAddressImpl();
                soapAddress.setLocationURI(serviceLocation);
                port.addExtensibilityElement(soapAddress);
                def.addService(service);
            }

            if(!abstractWSDL)
            {
                table.put(WSDL_QNAME, wsdlQName);
            }

            table.put(SERVICE_QNAME, serviceQName);

            ByteArrayOutputStream bs = new ByteArrayOutputStream();
            wsWriter.writeWSDL(def, bs);
            wsdlString = bs.toString();
        }
        catch (WSDLException e)
        {
            throw new GFacSchemaException("Error generating WSDL: " + e.getMessage());
        }

        Reader reader = new StringReader(wsdlString);
        Writer writer = new StringWriter();
        try {
            RoundTrip.roundTrip(reader, writer, "  ");
        } catch (XmlPullParserException e) {
            throw new GFacSchemaException(e);
        } catch (IOException e) {
            throw new GFacSchemaException(e);
        }
        wsdlString = writer.toString();

        if (abstractWSDL)
        {
View Full Code Here


{
    public void validateApplicationDescription(ApplicationDescriptionType appDesc) throws GFacSchemaException
    {
        if(appDesc.getApplicationName() == null)
        {
            throw new GFacSchemaException("Every application must have a name");
        }

        if(appDesc.getApplicationName().getTargetNamespace() == null)
        {
            throw new GFacSchemaException("Every application must have a target namespace");
        }

        if(appDesc.getDeploymentDescription() == null)
        {
            throw new GFacSchemaException("Every application must have a deployment description");
        }

        DeploymentDescriptionType deployDesc = appDesc.getDeploymentDescription();

        if(deployDesc.getHostName() == null)
        {
            throw new GFacSchemaException("You must specify a host name in the application description document");
        }

        if(deployDesc.getExecutable() == null)
        {
            throw new GFacSchemaException("You must specify the path to the application/executable");
        }
    }
View Full Code Here

                    .getHostDescription();
            SchemaValidator validator = new SchemaValidator(hostDesc);
            validator.validate();
            return hostDesc;
        } catch (XmlException e) {
            throw new GFacSchemaException(e);
        } catch (Exception e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here

                    reader).getApplicationDescription();
            SchemaValidator validator = new SchemaValidator(appDesc);
            validator.validate();
            return appDesc;
        } catch (XmlException e) {
            throw new GFacSchemaException(e);
        } catch (IOException e) {
            throw new GFacSchemaException(e);
        } catch (Exception e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here

            MethodType method = portType.addNewMethod();
            method.setMethodName(operationName);
            return method;
        }

        throw new GFacSchemaException("Method name " + operationName + " not found");
    }
View Full Code Here

                return true;
            } else {
                return false;
            }
        } catch (UnknownHostException e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here

                    // add parameter name if needed
                }
            }
            return params;
        } catch (URISyntaxException e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here

        try {

            System.out.println(prettyPrint2String(ele));

        } catch (IllegalArgumentException e) {
            throw new GFacSchemaException(e);
        } catch (IllegalStateException e) {
            throw new GFacSchemaException(e);
        } catch (XmlBuilderException e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here

        try {
            StringBuffer buf = new StringBuffer();
            buf.append("gsiftp://").append(host).append("/").append(localPath);
            return new URI(buf.toString());
        } catch (URISyntaxException e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here

                        URI uri = new URI("gsiftp://" + localhost + "/" + file.getAbsolutePath());
                        files.add(uri);
                    }
                }
            } else {
                throw new GFacSchemaException("can not find the output data directory to list files");
            }
            return files;
        } catch (URISyntaxException e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.ogce.schemas.gfac.beans.utils.GFacSchemaException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.