Examples of GFacSchemaException


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

    public static URI createWorkflowQName(QName name) throws GFacSchemaException {
        try {
            return new URI("urn:qname:" + name.getNamespaceURI() + ":" + name.getLocalPart());
        } catch (URISyntaxException e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here

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

    public static QName findApplcationName(ServiceMapType serviceMap) throws GFacSchemaException{
        MethodType method = GfacUtils.findOperationWithApplication(serviceMap);

        if (method == null) {
            throw new GFacSchemaException("None of the methods has application defined");
        }

        String applicationName = method.getApplication().getApplicationName().getStringValue();
        String applicationNameNs = method.getApplication().getApplicationName()
                .getTargetNamespace();
View Full Code Here

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

     // FIXME: Although this is a basic validator, a more comprehensive validation is required
    public void validateHostDescription(HostDescriptionType hostDesc) throws GFacSchemaException
    {
        if(hostDesc.getHostName() == null)
        {
            throw new GFacSchemaException("Every host description document must have a host name");
        }

        if(hostDesc.getHostConfiguration() == null)
        {
            throw new GFacSchemaException("HostConfiguration is required in every host description document");
        }

        if(hostDesc.getHostConfiguration().getTmpDir() == null)
        {
            throw new GFacSchemaException("You must specify a tmp directory on this host");
        }
    }
View Full Code Here

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

    public void validateServiceMap(ServiceMapType serviceMap) throws GFacSchemaException
    {
        ServiceType service = serviceMap.getService();
        if(service == null)
        {
            throw new GFacSchemaException("Service cannot be null");
        }

        if(service.getServiceName() == null)
        {
            throw new GFacSchemaException("Service name cannot be null");
        }

        if(service.getServiceName().getTargetNamespace() == null)
        {
            throw new GFacSchemaException("Target namespace for service cannot be null");
        }

        PortTypeType[] portTypes = serviceMap.getPortTypeArray();

        if(portTypes == null)
        {
            throw new GFacSchemaException("Service must have at least one port type");
        }

        for (int i = 0; i < portTypes.length; ++i)
        {
            MethodType[] methods = portTypes[i].getMethodArray();
            if(methods == null || methods.length <= 0 )
            {
                throw new GFacSchemaException("Each port type must have at least one method a.k.a operation");
            }

            for(int j = 0; j < methods.length; ++j)
            {
                MethodType method = methods[i];
                if(method.getMethodName() == null)
                {
                    throw new GFacSchemaException("Every method must have a name");
                }

                if(method.getMethodName().equals(GFacConstants.PING) ||
                   method.getMethodName().equals(GFacConstants.SHUTDOWN) ||
                   method.getMethodName().equals(GFacConstants.KILL) ||
                   method.getMethodName().equals(GFacConstants.CREATE_SERVICE))
                {
                    if(method.getApplication() != null)
                    {
                        throw new GFacSchemaException("Ping, Shutdown, Kill and CreateService are system defined methods");
                    }
                }


                if(!(method.getMethodName().equals(GFacConstants.PING) ||
                         method.getMethodName().equals(GFacConstants.SHUTDOWN) ||
                         method.getMethodName().equals(GFacConstants.KILL) ||
                         method.getMethodName().equals(GFacConstants.CREATE_SERVICE)))
                {
                    if(method.getApplication() == null)
                    {
                        throw new GFacSchemaException("Every user defined method must have one application associated with it");
                    }


                    ApplicationType app = method.getApplication();

                    if(app.getApplicationName() == null)
                    {
                        throw new GFacSchemaException("Application must have a name");
                    }

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

                    InputParameterType[] inputs = method.getInputParameterArray();
                    if(inputs != null && inputs.length > 0)
                    {
                        InputParameterType input = inputs[i];
                        if(input.getParameterName() == null)
                        {
                            throw new GFacSchemaException("Every input parameter must have a parameter name");
                        }

                        if(input.getParameterType() == null)
                        {
                            throw new GFacSchemaException("Every input parameter must have a valid data type");
                        }

                        ParameterValueType[] values = input.getParameterValueArray();

                        if(values != null && values.length > 0)
                        {
                            for(int k = 0; k < values.length; ++k)
                            {
                                if(values[k].getValue() == null)
                                {
                                    throw new GFacSchemaException("Every parameter value must have a value");
                                }
                            }
                        }

                    }

                    OutputParameterType[] outputs = method.getOutputParameterArray();
                    if(outputs != null && outputs.length > 0)
                    {
                        OutputParameterType output = outputs[i];
                        if(output.getParameterName() == null)
                        {
                            throw new GFacSchemaException("Every output parameter must have a parameter name");
                        }

                        if(output.getParameterType() == null)
                        {
                            throw new GFacSchemaException("Every output parameter must have a data type");
                        }
                    }
                }
            }
        }
View Full Code Here

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

                InputParameterType paramMetadata = findInputParameter(ele.getName());

                if (paramMetadata != null) {
                    handleParamElement(ele, paramMetadata);
                } else {
                    throw new GFacSchemaException("Service Map does not define a parameter called  "
                            + ele.getName());
                }
            }
        }
        wsaHeaders = new WsaMessageInformationHeaders(envelope);
View Full Code Here

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

                        XmlElement valEle = (XmlElement) childs.next();
                        String value = valEle.requiredTextContent();
                        if (value != null) {
                            values.add(value);
                        } else {
                            throw new GFacSchemaException(
                                    "Illegal InputMessage, No value content found for the parameter "
                                            + ele.getName() + "/value");
                        }
                    }
                    addParameter(ele.getName(), values.toArray(new String[0]));
                }
            } else {
                throw new GFacSchemaException(
                        "Illegal InputMessage, No value content found for the parameter "
                                + ele.getName());
            }
        } else if (GFacConstants.Types.LEAD_CROSSCUT_PARAMETERS.equals(type)) {
            _addParameter(ele.getName(), ele);
View Full Code Here

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

    public void updateParameter(String paramName, Object value) throws GFacSchemaException {
        if (paramerters.containsKey(paramName)) {
            paramerters.remove(paramName);
            paramerters.put(paramName, value);
        } else {
            throw new GFacSchemaException("No parameter name " + paramName + " to update");
        }

    }
View Full Code Here

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

                                XmlElement arrayValue = builder.newFragment(VALUE);
                                parm.addChild(arrayValue);
                                id.fillData(arrayValue);
                            }
                        }else{
                            throw new GFacSchemaException("Parameter " + type.getParameterName()
                                    + "had a type " + (obj!=null?obj.getClass():null) + "instead of a DataIDType");
                        }
                    }else if (obj instanceof Object[]) {
                        Object[] values = (Object[]) obj;
//                        if (values.length == 0) {
//                            throw new GfacException(
//                                    "The application execution is complete, but Service can not find a value for Parameter "
//                                            + type.getParameterName()
//                                            + " Please look into standard out and standard error for further information");
//                        }
                        for (int j = 0; j < values.length; j++) {
                            XmlElement arrayValue = builder.newFragment(VALUE);
                            arrayValue.addChild(String.valueOf(values[j]));
                            parm.addChild(arrayValue);
                        }
                    } else {
                        throw new GFacSchemaException(
                                "The application execution is complete, but Service can not find a value for Parameter "
                                        + type.getParameterName()
                                        + " Please look into standard out and standard error for further information [Parameter Map = "+ this+"]");
                    }
                } else if (GFacConstants.Types.TYPE_DATAID.equals(typeStr)) {
                    Object obj = getParameterValue(type.getParameterName());
                    if (obj instanceof DataIDType) {
                        ((DataIDType) obj).fillData(parm);
                    } else {
                        throw new GFacSchemaException("Parameter " + type.getParameterName()
                                + "had a type " + obj.getClass() + "instead of a DataIDType");
                    }
                } else {
                    String value = getStringParameterValue(type.getParameterName());
                    if (value == null) {
                        throw new GFacSchemaException("parameter " + type.getParameterName()
                                + "Not found [Parameter Map = "+ this+"]");
                    }
                    parm.addChild(value);
                }
                bodyContent.addChild(parm);
View Full Code Here

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

        String wrapper = message.getName();
        int index = wrapper.indexOf("_InputParams");
        if (index >= 0) {
            return wrapper.substring(0, index);
        } else {
            throw new GFacSchemaException(
                    "Unsupported Message format, wrapper element must be <operation_name>_InputParams");
        }

    }
View Full Code Here

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

        try {
            String value = ele.requiredTextContent();
            if (value != null) {
                this.dataID = new URI(value);
            } else {
                throw new GFacSchemaException(
                        "Illegal InputMessage, No value content found for the parameter "
                                + ele.getName() + "/value");
            }
            String location = ele.getAttributeValue(null, DataIDType.LOCATION_ATTRIBUTE);
            if (location != null) {
                addDataLocation(new URI(location));
            }
        } catch (URISyntaxException e) {
            throw new GFacSchemaException(e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.