Search in sources :

Example 1 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class WSDLGenerator method createOutputFile.

/**
 * Creates the {@link Result} object used by JAXB to generate a schema for the
 * namesapceUri namespace.
 * @param namespaceUri The namespace for the schema being generated
 * @param suggestedFileName the JAXB suggested file name for the schema file
 * @return the {@link Result} for JAXB to generate the schema into
 * @throws java.io.IOException thrown if on IO error occurs
 */
public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
    Result result;
    if (namespaceUri == null) {
        return null;
    }
    Holder<String> fileNameHolder = new Holder<>();
    fileNameHolder.value = schemaPrefix + suggestedFileName;
    result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
    // System.out.println("schema file: "+fileNameHolder.value);
    // System.out.println("result: "+result);
    String schemaLoc;
    if (result == null)
        schemaLoc = fileNameHolder.value;
    else
        schemaLoc = relativize(result.getSystemId(), wsdlLocation);
    boolean isEmptyNs = namespaceUri.trim().equals("");
    if (!isEmptyNs) {
        com.sun.xml.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
        _import.namespace(namespaceUri);
        _import.schemaLocation(schemaLoc);
    }
    return result;
}
Also used : Holder(jakarta.xml.ws.Holder) Result(javax.xml.transform.Result) SAXResult(javax.xml.transform.sax.SAXResult) TXWResult(com.sun.xml.txw2.output.TXWResult) DOMResult(javax.xml.transform.dom.DOMResult)

Example 2 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class WSDLGenerator method doGeneration.

/**
 * Performes the actual WSDL generation
 */
public void doGeneration() {
    XmlSerializer serviceWriter;
    XmlSerializer portWriter = null;
    String fileName = mangleName(model.getServiceQName().getLocalPart());
    Result result = wsdlResolver.getWSDL(fileName + DOT_WSDL);
    wsdlLocation = result.getSystemId();
    serviceWriter = new CommentFilter(ResultFactory.createSerializer(result));
    if (model.getServiceQName().getNamespaceURI().equals(model.getTargetNamespace())) {
        portWriter = serviceWriter;
        schemaPrefix = fileName + "_";
    } else {
        String wsdlName = mangleName(model.getPortTypeName().getLocalPart());
        if (wsdlName.equals(fileName))
            wsdlName += "PortType";
        Holder<String> absWSDLName = new Holder<>();
        absWSDLName.value = wsdlName + DOT_WSDL;
        result = wsdlResolver.getAbstractWSDL(absWSDLName);
        if (result != null) {
            portWSDLID = result.getSystemId();
            if (portWSDLID.equals(wsdlLocation)) {
                portWriter = serviceWriter;
            } else {
                portWriter = new CommentFilter(ResultFactory.createSerializer(result));
            }
        } else {
            portWSDLID = absWSDLName.value;
        }
        schemaPrefix = new java.io.File(portWSDLID).getName();
        int idx = schemaPrefix.lastIndexOf('.');
        if (idx > 0)
            schemaPrefix = schemaPrefix.substring(0, idx);
        schemaPrefix = mangleName(schemaPrefix) + "_";
    }
    generateDocument(serviceWriter, portWriter);
}
Also used : Holder(jakarta.xml.ws.Holder) XmlSerializer(com.sun.xml.txw2.output.XmlSerializer) Result(javax.xml.transform.Result) SAXResult(javax.xml.transform.sax.SAXResult) TXWResult(com.sun.xml.txw2.output.TXWResult) DOMResult(javax.xml.transform.dom.DOMResult)

Example 3 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class Fiber method _doRun.

private boolean _doRun(Tube next) {
    // isRequireUnlock will contain Boolean.FALSE when lock has already been released in suspend
    Holder<Boolean> isRequireUnlock = new Holder<>(Boolean.TRUE);
    lock.lock();
    try {
        List<FiberContextSwitchInterceptor> ints;
        ClassLoader old;
        synchronized (this) {
            ints = interceptors;
            // currentThread is protected by the monitor for this fiber so
            // that it is accessible to cancel() even when the lock is held
            currentThread = Thread.currentThread();
            if (isTraceEnabled()) {
                LOGGER.log(Level.FINE, "Thread entering _doRun(): {0}", currentThread);
            }
            old = currentThread.getContextClassLoader();
            currentThread.setContextClassLoader(contextClassLoader);
        }
        try {
            boolean needsToReenter;
            do {
                // if interceptors are set, go through the interceptors.
                if (ints == null) {
                    this.next = next;
                    if (__doRun(isRequireUnlock, null)) {
                        return true;
                    }
                } else {
                    next = new InterceptorHandler(isRequireUnlock, ints).invoke(next);
                    if (next == PLACEHOLDER) {
                        return true;
                    }
                }
                synchronized (this) {
                    needsToReenter = (ints != interceptors);
                    if (needsToReenter)
                        ints = interceptors;
                }
            } while (needsToReenter);
        } catch (OnExitRunnableException o) {
            // catching this exception indicates onExitRunnable in suspend() threw.
            // we must still avoid double unlock
            Throwable t = o.target;
            if (t instanceof WebServiceException)
                throw (WebServiceException) t;
            throw new WebServiceException(t);
        } finally {
            // don't reference currentThread here because fiber processing
            // may already be running on a different thread (Note: isAlreadyExited
            // tracks this state
            Thread thread = Thread.currentThread();
            thread.setContextClassLoader(old);
            if (isTraceEnabled()) {
                LOGGER.log(Level.FINE, "Thread leaving _doRun(): {0}", thread);
            }
        }
        return false;
    } finally {
        if (isRequireUnlock.value) {
            synchronized (this) {
                currentThread = null;
            }
            lock.unlock();
        }
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) Holder(jakarta.xml.ws.Holder)

Example 4 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class EchoClient method testGenerics.

public void testGenerics() throws Exception {
    Holder holder = new Holder<String>("fred");
    stub.echoGenericString(holder);
    assertTrue(holder.value.equals("fred&john"));
    holder = new Holder<Integer>(33);
    stub.echoGenericInteger(holder);
    assertTrue(holder.value.equals(Integer.valueOf(66)));
    assertTrue(stub.echoGenericObject(Integer.valueOf(66)).equals(Integer.valueOf(66)));
    assertTrue(stub.echoGenericObject("bill").equals("bill"));
}
Also used : Holder(jakarta.xml.ws.Holder)

Example 5 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class SoapMuHeaderTest method testMUHeaderInWSDL.

public void testMUHeaderInWSDL() {
    Hello_Service service = new Hello_Service();
    Hello port = service.getHelloPort();
    Holder<String> extra = new Holder<String>();
    port.hello("extra", extra);
}
Also used : Hello(client.soap_mu_header.client.Hello) Hello_Service(client.soap_mu_header.client.Hello_Service) Holder(jakarta.xml.ws.Holder)

Aggregations

Holder (jakarta.xml.ws.Holder)14 Packet (com.sun.xml.ws.api.message.Packet)3 DataHandler (jakarta.activation.DataHandler)3 Hello (client.soap_mu_header.client.Hello)2 Hello_Service (client.soap_mu_header.client.Hello_Service)2 NotNull (com.sun.istack.NotNull)2 TXWResult (com.sun.xml.txw2.output.TXWResult)2 SimpleCompletionCallback (com.sun.xml.ws.api.pipe.EngineTest.SimpleCompletionCallback)2 TestTube (com.sun.xml.ws.api.pipe.EngineTest.TestTube)2 TubeCall (com.sun.xml.ws.api.pipe.EngineTest.TubeCall)2 BindingProvider (jakarta.xml.ws.BindingProvider)2 WebServiceException (jakarta.xml.ws.WebServiceException)2 MTOMFeature (jakarta.xml.ws.soap.MTOMFeature)2 Result (javax.xml.transform.Result)2 DOMResult (javax.xml.transform.dom.DOMResult)2 SAXResult (javax.xml.transform.sax.SAXResult)2 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)1 XmlSerializer (com.sun.xml.txw2.output.XmlSerializer)1 BindingID (com.sun.xml.ws.api.BindingID)1 ComponentFeature (com.sun.xml.ws.api.ComponentFeature)1