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;
}
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);
}
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();
}
}
}
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"));
}
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);
}
Aggregations