Example usage for javax.xml.namespace QName getNamespaceURI

List of usage examples for javax.xml.namespace QName getNamespaceURI

Introduction

In this page you can find the example usage for javax.xml.namespace QName getNamespaceURI.

Prototype

public String getNamespaceURI() 

Source Link

Document

Get the Namespace URI of this QName.

Usage

From source file:org.apache.ode.bpel.elang.xpath20.compiler.JaxpFunctionResolver.java

public XPathFunction resolveFunction(QName functionName, int arity) {
    if (functionName.getNamespaceURI() == null) {
        throw new WrappedResolverException("Undeclared namespace for " + functionName);
    } else if (functionName.getNamespaceURI().equals(_bpelNS)) {
        String localName = functionName.getLocalPart();
        if (Constants.EXT_FUNCTION_GETVARIABLEPROPERTY.equals(localName)) {
            return new GetVariableProperty();
        } else if (Constants.EXT_FUNCTION_DOXSLTRANSFORM.equals(localName)) {
            return new DoXslTransform();
        } else {/*  w w  w  .ja va 2  s.  c o  m*/
            throw new WrappedResolverException(__msgs.errUnknownBpelFunction(localName));
        }
    } else if (functionName.getNamespaceURI().equals(Namespaces.ODE_EXTENSION_NS)) {
        String localName = functionName.getLocalPart();
        if (Constants.NON_STDRD_FUNCTION_SPLIT_TO_ELEMENTS.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_SPLIT_TO_ELEMENTS.equals(localName)) {
            return new SplitToElements();
        } else if (Constants.NON_STDRD_FUNCTION_COMBINE_URL.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_COMBINE_URL.equals(localName)) {
            return new CombineUrl();
        } else if (Constants.NON_STDRD_FUNCTION_COMPOSE_URL.equals(localName)
                || Constants.NON_STDRD_FUNCTION_EXPAND_TEMPLATE.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_COMPOSE_URL.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_EXPAND_TEMPLATE.equals(localName)) {
            return new ComposeUrl();
        } else if (Constants.NON_STDRD_FUNCTION_DOM_TO_STRING.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_DOM_TO_STRING.equals(localName)) {
            return new DomToString();
        } else if (Constants.NON_STDRD_FUNCTION_INSERT_AFTER.equals(localName)) {
            return new InsertAfter();
        } else if (Constants.NON_STDRD_FUNCTION_INSERT_AS_FIRST_INTO.equals(localName)) {
            return new InsertAsFirstInto();
        } else if (Constants.NON_STDRD_FUNCTION_INSERT_AS_LAST_INTO.equals(localName)) {
            return new InsertAsLastInto();
        } else if (Constants.NON_STDRD_FUNCTION_INSERT_BEFORE.equals(localName)) {
            return new InsertBefore();
        } else if (Constants.NON_STDRD_FUNCTION_DELETE.equals(localName)) {
            return new Delete();
        } else if (Constants.NON_STDRD_FUNCTION_RENAME.equals(localName)) {
            return new Rename();
        } else if (Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY.equals(localName)) {
            return new ProcessProperty();
        }
    } else if (functionName.getNamespaceURI().equals(Namespaces.DEPRECATED_XDT_NS)) {
        String localName = functionName.getLocalPart();
        if (Constants.NON_STDRD_FUNCTION_DAY_TIME_DURATION.equals(localName)) {
            return new DayTimeDuration();
        } else if (Constants.NON_STDRD_FUNCTION_YEAR_MONTH_DURATION.equals(localName)) {
            return new YearMonthDuration();
        }
    } else if (functionName.getNamespaceURI().startsWith(JAVA_PREFIX)) {
        return new JavaFunction(functionName);
    }

    return null;
}

From source file:org.apache.ode.bpel.elang.xpath20.runtime.JaxpFunctionResolver.java

public XPathFunction resolveFunction(QName functionName, int arity) {
    if (__log.isDebugEnabled()) {
        __log.debug("Resolving function " + functionName);
    }//from  w  w w .  ja v  a 2s.  c  o m
    if (functionName.getNamespaceURI() == null) {
        throw new NullPointerException("Undeclared namespace for " + functionName);
    } else if (functionName.getNamespaceURI().equals(Namespaces.WS_BPEL_20_NS)
            || functionName.getNamespaceURI().equals(Namespaces.WSBPEL2_0_FINAL_EXEC)) {
        String localName = functionName.getLocalPart();
        if (Constants.EXT_FUNCTION_GETVARIABLEDATA.equals(localName)) {
            return new GetVariableData();
        } else if (Constants.EXT_FUNCTION_GETVARIABLEPROPERTY.equals(localName)) {
            return new GetVariableProperty();
        } else if (Constants.EXT_FUNCTION_GETLINKSTATUS.equals(localName)) {
            return new GetLinkStatus();
        } else if (Constants.EXT_FUNCTION_DOXSLTRANSFORM.equals(localName)) {
            return new DoXslTransform();
        } else {
            throw new NullPointerException("Unknown BPEL function: " + functionName);
        }
    } else if (functionName.getNamespaceURI().equals(Namespaces.ODE_EXTENSION_NS)) {
        String localName = functionName.getLocalPart();
        if (Constants.NON_STDRD_FUNCTION_SPLIT_TO_ELEMENTS.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_SPLIT_TO_ELEMENTS.equals(localName)) {
            return new SplitToElements();
        } else if (Constants.NON_STDRD_FUNCTION_COMBINE_URL.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_COMBINE_URL.equals(localName)) {
            return new CombineUrl();
        } else if (Constants.NON_STDRD_FUNCTION_COMPOSE_URL.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_COMPOSE_URL.equals(localName)) {
            return new ComposeUrl();
        } else if (Constants.NON_STDRD_FUNCTION_EXPAND_TEMPLATE.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_EXPAND_TEMPLATE.equals(localName)) {
            return new ComposeUrl(true, "expandTemplateInvalidSource");
        } else if (Constants.NON_STDRD_FUNCTION_DOM_TO_STRING.equals(localName)
                || Constants.NON_STDRD_FUNCTION_DEPRECATED_DOM_TO_STRING.equals(localName)) {
            return new DomToString();
        } else if (Constants.NON_STDRD_FUNCTION_INSERT_AFTER.equals(localName)) {
            return new InsertAfter();
        } else if (Constants.NON_STDRD_FUNCTION_INSERT_AS_FIRST_INTO.equals(localName)) {
            return new InsertAsFirstInto();
        } else if (Constants.NON_STDRD_FUNCTION_INSERT_AS_LAST_INTO.equals(localName)) {
            return new InsertAsLastInto();
        } else if (Constants.NON_STDRD_FUNCTION_INSERT_BEFORE.equals(localName)) {
            return new InsertBefore();
        } else if (Constants.NON_STDRD_FUNCTION_DELETE.equals(localName)) {
            return new Delete();
        } else if (Constants.NON_STDRD_FUNCTION_RENAME.equals(localName)) {
            return new Rename();
        } else if (Constants.NON_STDRD_FUNCTION_PROCESS_PROPERTY.equals(localName)) {
            return new ProcessProperty();
        }
    } else if (functionName.getNamespaceURI().equals(Namespaces.DEPRECATED_XDT_NS)) {
        String localName = functionName.getLocalPart();
        if (Constants.NON_STDRD_FUNCTION_DAY_TIME_DURATION.equals(localName)) {
            return new DayTimeDuration();
        } else if (Constants.NON_STDRD_FUNCTION_YEAR_MONTH_DURATION.equals(localName)) {
            return new YearMonthDuration();
        }
    }

    return null;
}

From source file:org.apache.ode.bpel.elang.xpath20.runtime.JaxpVariableResolver.java

public Object resolveVariable(QName variableName) {
    if (__log.isDebugEnabled()) {
        __log.debug("Resolving variable " + variableName);
    }/*w  w  w. j  a  va2 s.c o  m*/

    if (!(_oxpath instanceof OXPath10ExpressionBPEL20)) {
        throw new IllegalStateException("XPath variables not supported for bpel 1.1");
    }

    // Custom variables
    if (variableName.getNamespaceURI().equals(Namespaces.ODE_EXTENSION_NS)) {
        if ("pid".equals(variableName.getLocalPart())) {
            return _ectx.getProcessId();
        } else if ("processQName".equals(variableName.getLocalPart())) {
            return _ectx.getProcessQName();
        }
        if ("currentEventDateTime".equals(variableName.getLocalPart())) {
            return _ectx.getCurrentEventDateTime();
        }
    }

    OXPath10ExpressionBPEL20 expr = _oxpath;
    if (expr.isJoinExpression) {
        OLink olink = _oxpath.links.get(variableName.getLocalPart());

        try {
            return _ectx.isLinkActive(olink) ? Boolean.TRUE : Boolean.FALSE;
        } catch (FaultException e) {
            throw new WrappedResolverException(e);
        }
    } else {
        String varName;
        String partName;
        int dotloc = variableName.getLocalPart().indexOf('.');
        if (dotloc == -1) {
            varName = variableName.getLocalPart();
            partName = null;
        } else {
            varName = variableName.getLocalPart().substring(0, dotloc);
            partName = variableName.getLocalPart().substring(dotloc + 1);
        }
        OScope.Variable variable = _oxpath.vars.get(varName);
        OMessageVarType.Part part = partName == null ? null
                : ((OMessageVarType) variable.type).parts.get(partName);

        try {
            final Node variableNode = _ectx.readVariable(variable, part);
            if (variableNode == null)
                throw new FaultException(variable.getOwner().constants.qnSelectionFailure,
                        "Unknown variable " + variableName.getLocalPart());
            if (_ectx.narrowTypes()) {
                if (variable.type instanceof OXsdTypeVarType && ((OXsdTypeVarType) variable.type).simple)
                    return getSimpleContent(variableNode, ((OXsdTypeVarType) variable.type).xsdType);
                if (part != null && part.type instanceof OXsdTypeVarType
                        && ((OXsdTypeVarType) part.type).simple)
                    return getSimpleContent(variableNode, ((OXsdTypeVarType) part.type).xsdType);
            }

            // Saxon used to expect a node list, but now a regular node will suffice.
            return variableNode;
        } catch (FaultException e) {
            throw new WrappedResolverException(e);
        }
    }
}

From source file:org.apache.ode.bpel.elang.xpath20.runtime.JaxpVariableResolver.java

public Value convertSimpleTypeToSaxon(QName type, String value) {
    int fp = _config.getNamePool().allocate("", type.getNamespaceURI(), type.getLocalPart());
    SchemaType type2 = _config.getSchemaType(fp);
    if (type2 == null || !type2.isAtomicType()) {
        __log.warn("Can't find simple type " + type + " value " + value + " result: " + null);
        return null;
    } else {/*from   w  ww .  j ava2 s.c o m*/
        try {
            AtomicValue value2 = StringValue.convertStringToAtomicType(value, (AtomicType) type2, null)
                    .asAtomic();
            if (__log.isDebugEnabled()) {
                __log.debug("converting " + type + " value " + value + " result: " + value2);
            }
            return value2;
        } catch (ValidationException e) {
            __log.debug("Can't convert " + value + " to " + type + " returning empty sequence");
            return EmptySequence.getInstance();
        }
    }
}

From source file:org.apache.ode.bpel.elang.xquery10.compiler.XQuery10ExpressionCompilerImpl.java

private void doJaxpCompile(OXQuery10ExpressionBPEL20 out, Expression source) throws CompilationException {
    String xqueryStr;//from  ww w  .j  a v  a2  s  . com
    Node node = source.getExpression();
    if (node == null) {
        throw new CompilationException(__msgs.errEmptyExpression(source.getURI(),
                new QName(source.getElement().getNamespaceURI(), source.getElement().getNodeName())));
    }
    if (node.getNodeType() != Node.TEXT_NODE && node.getNodeType() != Node.ELEMENT_NODE
            && node.getNodeType() != Node.CDATA_SECTION_NODE) {
        throw new CompilationException(__msgs.errUnexpectedNodeTypeForXPath(DOMUtils.domToString(node)));
    }
    xqueryStr = DOMUtils.domToString(node);
    xqueryStr = xqueryStr.trim();
    if (xqueryStr.length() == 0) {
        throw new CompilationException(__msgs.warnXPath20Syntax(DOMUtils.domToString(node), "empty string"));
    }

    try {
        XQDataSource xqds = new SaxonXQDataSource(new Configuration());
        XQConnection xqconn = xqds.getConnection();

        __log.debug("Compiling expression " + xqueryStr);
        Configuration configuration = ((SaxonXQConnection) xqconn).getConfiguration();
        configuration.setAllNodesUntyped(true);
        configuration.setHostLanguage(Configuration.XQUERY);

        XQStaticContext staticContext = xqconn.getStaticContext();
        JaxpFunctionResolver funcResolver = new JaxpFunctionResolver(_compilerContext, out,
                source.getNamespaceContext(), _bpelNS);
        JaxpVariableResolver variableResolver = new JaxpVariableResolver(_compilerContext, out);

        XQueryDeclarations declarations = new XQueryDeclarations();
        NSContext nsContext = source.getNamespaceContext();
        Set<String> prefixes = nsContext.getPrefixes();
        if (!nsContext.getUriSet().contains(Namespaces.ODE_EXTENSION_NS)) {
            nsContext.register("ode", Namespaces.ODE_EXTENSION_NS);
        }
        for (String prefix : prefixes) {
            String uri = nsContext.getNamespaceURI(prefix);
            staticContext.declareNamespace(prefix, uri);
            if ("".equals(prefix)) {
                declarations.declareDefaultElementNamespace(uri);
            } else if ("bpws".equals(prefix)) {
                declarations.declareNamespace("bpws", "java:" + Constants.XQUERY_FUNCTION_HANDLER_COMPILER);
            } else {
                declarations.declareNamespace(prefix, uri);
            }
        }
        declarations.declareVariable(getQName(nsContext, Namespaces.ODE_EXTENSION_NS, "pid"),
                getQName(nsContext, Namespaces.XML_SCHEMA, "integer"));
        //            Map<URI, Source> schemaDocuments = _compilerContext.getSchemaSources();
        //            for (URI schemaUri : schemaDocuments.keySet()) {
        //               Source schemaSource = schemaDocuments.get(schemaUri);
        //               // Don't add schema sources, since our Saxon library is not schema-aware.
        //               // configuration.addSchemaSource(schemaSource);
        //            }
        configuration.setSchemaValidationMode(Validation.SKIP);
        List<OScope.Variable> variables = _compilerContext.getAccessibleVariables();
        Map<QName, QName> variableTypes = new HashMap<QName, QName>();
        for (String variableName : getVariableNames(xqueryStr)) {
            OScope.Variable variable = getVariable(variables, variableName);
            if (variable == null) {
                continue;
            }
            OVarType type = variable.type;
            QName nameQName = getNameQName(variableName);
            QName typeQName = getTypeQName(variableName, type);
            variableTypes.put(nameQName, typeQName);
            String prefix = typeQName.getPrefix();
            if (prefix == null || "".equals(prefix.trim())) {
                prefix = getPrefixForUri(nsContext, typeQName.getNamespaceURI());
            }
            // don't declare typed variables, as our engine is not schema-aware
            // declarations.declareVariable(variable.name, typeQName);
            declarations.declareVariable(variableName);
        }

        // Add implicit declarations as prolog to the user-defined XQuery
        out.xquery = declarations.toString() + xqueryStr;

        // Check the XQuery for compilation errors
        xqconn.setStaticContext(staticContext);
        XQPreparedExpression exp = xqconn.prepareExpression(out.xquery);

        // Pre-evaluate variables and functions by executing query
        node.setUserData(XQuery10BpelFunctions.USER_DATA_KEY_FUNCTION_RESOLVER, funcResolver, null);
        exp.bindItem(XQConstants.CONTEXT_ITEM, xqconn.createItemFromNode(node, xqconn.createNodeType()));
        // Bind external variables to dummy runtime values
        for (QName variable : exp.getAllUnboundExternalVariables()) {
            QName typeQName = variableTypes.get(variable);
            Object value = variableResolver.resolveVariable(variable);
            if (typeQName != null) {
                if (value.getClass().getName().startsWith("java.lang")) {
                    exp.bindAtomicValue(variable, value.toString(),
                            xqconn.createAtomicType(XQItemType.XQBASETYPE_ANYATOMICTYPE));
                } else if (value instanceof Node) {
                    exp.bindNode(variable, (Node) value, xqconn.createNodeType());
                } else if (value instanceof NodeList) {
                    NodeList nodeList = (NodeList) value;
                    ArrayList nodeArray = new ArrayList();
                    for (int i = 0; i < nodeList.getLength(); i++) {
                        nodeArray.add(nodeList.item(i));
                    }
                    XQSequence sequence = xqconn.createSequence(nodeArray.iterator());
                    exp.bindSequence(variable, sequence);
                }
            }
        }
        // evaluate the expression so as to initialize the variables
        try {
            exp.executeQuery();
        } catch (XQException xpee) {
            // swallow errors caused by uninitialized variables
        } finally {
            // reset the expression's user data, in order to avoid
            // serializing the function resolver in the compiled bpel file.
            if (node != null) {
                node.setUserData(XQuery10BpelFunctions.USER_DATA_KEY_FUNCTION_RESOLVER, null, null);
            }
        }
    } catch (XQException xqe) {
        __log.debug(xqe);
        __log.info("Couldn't validate properly expression " + xqueryStr);
        throw new CompilationException(
                __msgs.errXQuery10Syntax(xqueryStr, "Couldn't validate XQuery expression"));
    } catch (WrappedResolverException wre) {
        if (wre._compilationMsg != null)
            throw new CompilationException(wre._compilationMsg, wre);
        if (wre.getCause() instanceof CompilationException)
            throw (CompilationException) wre.getCause();
        throw wre;
    }
}

From source file:org.apache.ode.bpel.engine.ProcessAndInstanceManagementImpl.java

/**
 * Query processes based on a {@link ProcessFilter} criteria. This is
 * implemented in memory rather than via database calls since the processes
 * are managed by the {@link ProcessStore} object and we don't want to make
 * this needlessly complicated.//from   ww w. ja  v a2s . c  om
 *
 * @param filter
 * @return
 */
@SuppressWarnings("unchecked")
Collection<ProcessConf> processQuery(ProcessFilter filter) {

    List<QName> pids = _store.getProcesses();

    // Name filter can be implemented using only the PIDs.
    if (filter != null && filter.getNameFilter() != null) {
        final Pattern pattern = Pattern.compile(filter.getNameFilter().replace("*", ".*") + "(-\\d*)?");
        CollectionsX.remove_if(pids, new MemberOfFunction<QName>() {
            @Override
            public boolean isMember(QName o) {
                return !pattern.matcher(o.getLocalPart()).matches();
            }
        });
    }

    if (filter != null && filter.getNamespaceFilter() != null) {
        final Pattern pattern = Pattern.compile(filter.getNamespaceFilter().replace("*", ".*"));
        CollectionsX.remove_if(pids, new MemberOfFunction<QName>() {
            @Override
            public boolean isMember(QName o) {
                String ns = o.getNamespaceURI() == null ? "" : o.getNamespaceURI();
                return !pattern.matcher(ns).matches();
            }

        });
    }

    // Now we need the process conf objects, we need to be
    // careful since someone could have deleted them by now
    List<ProcessConf> confs = new LinkedList<ProcessConf>();
    for (QName pid : pids) {
        ProcessConf pconf = _store.getProcessConfiguration(pid);
        confs.add(pconf);
    }

    if (filter != null) {
        // TODO Implement process status filtering when status will exist
        // Specific filter for deployment date.
        if (filter.getDeployedDateFilter() != null) {
            for (final String ddf : filter.getDeployedDateFilter()) {
                final Date dd;
                try {
                    dd = ISO8601DateParser.parse(Filter.getDateWithoutOp(ddf));
                } catch (ParseException e) {
                    // Should never happen.
                    __log.error("Exception while parsing date", e);
                    throw new RuntimeException(e.toString());
                }

                CollectionsX.remove_if(confs, new MemberOfFunction<ProcessConf>() {
                    @Override
                    public boolean isMember(ProcessConf o) {

                        if (ddf.startsWith("="))
                            return !o.getDeployDate().equals(dd);

                        if (ddf.startsWith("<="))
                            return o.getDeployDate().getTime() > dd.getTime();

                        if (ddf.startsWith(">="))
                            return o.getDeployDate().getTime() < dd.getTime();

                        if (ddf.startsWith("<"))
                            return o.getDeployDate().getTime() >= dd.getTime();

                        if (ddf.startsWith(">"))
                            return o.getDeployDate().getTime() <= dd.getTime();

                        return false;
                    }

                });

            }
        }

        // Ordering
        if (filter.getOrders() != null) {
            ComparatorChain cchain = new ComparatorChain();
            for (String key : filter.getOrders()) {
                boolean ascending = true;
                String orderKey = key;
                if (key.startsWith("+") || key.startsWith("-")) {
                    orderKey = key.substring(1, key.length());
                    if (key.startsWith("-"))
                        ascending = false;
                }

                Comparator c;
                if ("name".equals(orderKey))
                    c = new Comparator<ProcessConf>() {
                        public int compare(ProcessConf o1, ProcessConf o2) {
                            return o1.getProcessId().getLocalPart().compareTo(o2.getProcessId().getLocalPart());
                        }
                    };
                else if ("namespace".equals(orderKey))
                    c = new Comparator<ProcessConf>() {
                        public int compare(ProcessConf o1, ProcessConf o2) {
                            String ns1 = o1.getProcessId().getNamespaceURI() == null ? ""
                                    : o1.getProcessId().getNamespaceURI();
                            String ns2 = o2.getProcessId().getNamespaceURI() == null ? ""
                                    : o2.getProcessId().getNamespaceURI();
                            return ns1.compareTo(ns2);
                        }
                    };
                else if ("version".equals(orderKey))
                    c = new Comparator<ProcessConf>() {
                        public int compare(ProcessConf o1, ProcessConf o2) {
                            // TODO: implement version comparisons.
                            return 0;
                        }
                    };
                else if ("deployed".equals(orderKey))
                    c = new Comparator<ProcessConf>() {
                        public int compare(ProcessConf o1, ProcessConf o2) {
                            return o1.getDeployDate().compareTo(o2.getDeployDate());
                        }

                    };

                else {
                    // unrecognized
                    __log.debug("unrecognized order key" + orderKey);
                    continue;
                }

                cchain.addComparator(c, !ascending);
            }

            Collections.sort(confs, cchain);
        }

    }

    return confs;
}

From source file:org.apache.ode.bpel.epr.WSAEndpoint.java

public void fromMap(Map eprMap) {
    Document doc = DOMUtils.newDocument();
    Element serviceRef = doc.createElementNS(SERVICE_REF_QNAME.getNamespaceURI(),
            SERVICE_REF_QNAME.getLocalPart());
    doc.appendChild(serviceRef);/*from w w w. j  a v a 2 s  . c  o m*/
    _eprElmt = doc.createElementNS(Namespaces.WS_ADDRESSING_NS, "EndpointReference");
    serviceRef.appendChild(_eprElmt);
    Element addrElmt = doc.createElementNS(Namespaces.WS_ADDRESSING_NS, "Address");
    addrElmt.setTextContent((String) eprMap.get(ADDRESS));
    if (eprMap.get(SESSION) != null) {
        Element sessElmt = doc.createElementNS(Namespaces.ODE_SESSION_NS, "session");
        sessElmt.setTextContent((String) eprMap.get(SESSION));
        _eprElmt.appendChild(sessElmt);
        // and the same for the (deprecated) intalio namespace for backward compatibility
        sessElmt = doc.createElementNS(Namespaces.INTALIO_SESSION_NS, "session");
        sessElmt.setTextContent((String) eprMap.get(SESSION));
        _eprElmt.appendChild(sessElmt);
    }
    if (eprMap.get(SERVICE_QNAME) != null) {
        Element metadataElmt = doc.createElementNS(Namespaces.WS_ADDRESSING_NS, "Metadata");
        _eprElmt.appendChild(metadataElmt);
        Element serviceElmt = doc.createElementNS(Namespaces.WS_ADDRESSING_WSDL_NS, "ServiceName");
        metadataElmt.appendChild(serviceElmt);
        QName serviceQName = (QName) eprMap.get(SERVICE_QNAME);
        serviceElmt.setAttribute("xmlns:servicens", serviceQName.getNamespaceURI());
        serviceElmt.setTextContent("servicens:" + serviceQName.getLocalPart());
        serviceElmt.setAttribute("EndpointName", (String) eprMap.get(PORT_NAME));
    }
    _eprElmt.appendChild(addrElmt);
    if (__log.isDebugEnabled())
        __log.debug("Constructed a new WSAEndpoint: " + DOMUtils.domToString(_eprElmt));
}

From source file:org.apache.ode.bpel.extvar.jdbc.DbExternalVariable.java

<T extends RowSubset> Element renderXmlRow(Locator locator, QName varType, T value)
        throws ExternalVariableModuleException {
    Document doc = DOMUtils.newDocument();
    Element el = doc.createElementNS(varType.getNamespaceURI(), varType.getLocalPart());
    doc.appendChild(el);//from   w  ww. j  ava 2 s .c  o m
    if (value != null) {
        for (Column c : value._columns) {
            Object data = value.get(c.idx);
            addElement(el, varType, c, data);
        }
    } else {
        // initialize variable with default/generated values
        RowKey keys = keyFromLocator(locator);
        for (Column c : _columns) {
            Object data = c.getValue(c.name, keys, new RowVal(), locator.iid);
            addElement(el, varType, c, data);
        }
    }
    return el;
}

From source file:org.apache.ode.bpel.extvar.jdbc.DbExternalVariable.java

private void addElement(Element parent, QName varType, Column c, Object data) {
    Document doc = parent.getOwnerDocument();
    Element cel = doc.createElementNS(varType.getNamespaceURI(), c.name);
    String strdat = c.toText(data);
    if (strdat != null) {
        cel.appendChild(doc.createTextNode(strdat));
    } else if (c.nullok || c.isGenerated()) {
        cel.setAttributeNS(XSI_NS, "xsi:nil", "true");
    }/*from   w w  w .ja  v a2  s .co  m*/
    parent.appendChild(cel);
}

From source file:org.apache.ode.bpel.rtrep.v1.xpath10.jaxp.JaxpFunctionResolver.java

public XPathFunction resolveFunction(QName functionName, int arity) {
    __log.debug("JAXP runtime: Resolving function " + functionName);
    final String namespaceURI = functionName.getNamespaceURI();
    if (namespaceURI == null) {
        throw new NullPointerException("Undeclared namespace for " + functionName);
    }//from  www  .  j a  v  a 2  s  .c  om
    if (namespaceURI.equals(Namespaces.BPEL11_NS) || namespaceURI.equals(Namespaces.WS_BPEL_20_NS)
            || namespaceURI.equals(Namespaces.WSBPEL2_0_FINAL_EXEC)) {
        String localName = functionName.getLocalPart();
        if (Constants.EXT_FUNCTION_GETVARIABLEDATA.equals(localName)) {
            return new GetVariableData();
        }
        if (Constants.EXT_FUNCTION_GETVARIABLEPROPERTY.equals(localName)) {
            return new GetVariableProperty();
        }
        if (Constants.EXT_FUNCTION_GETLINKSTATUS.equals(localName)) {
            return new GetLinkStatus();
        }
        if (Constants.EXT_FUNCTION_DOXSLTRANSFORM.equals(localName)) {
            return new DoXslTransform();
        }
        throw new NullPointerException("Unknown BPEL function: " + functionName);
    }
    return null;
}