8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)

Reviewed-by: joehw
This commit is contained in:
Aleksei Efimov 2015-04-10 14:54:20 +03:00
parent e80c4deeea
commit 1c82d4a0c7
72 changed files with 1357 additions and 1101 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,8 +30,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.logging.Level; import java.util.logging.Level;
@ -87,25 +85,19 @@ public final class ClassFactory {
if(consRef!=null) if(consRef!=null)
cons = consRef.get(); cons = consRef.get();
if(cons==null) { if(cons==null) {
cons = AccessController.doPrivileged(new PrivilegedAction<Constructor<T>>() { try {
@Override cons = clazz.getDeclaredConstructor(emptyClass);
public Constructor<T> run() { } catch (NoSuchMethodException e) {
try { logger.log(Level.INFO,"No default constructor found on "+clazz,e);
return clazz.getDeclaredConstructor(emptyClass); NoSuchMethodError exp;
} catch (NoSuchMethodException e) { if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
logger.log(Level.INFO,"No default constructor found on "+clazz,e); exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS.format(clazz.getName()));
NoSuchMethodError exp; } else {
if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) { exp = new NoSuchMethodError(e.getMessage());
exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS
.format(clazz.getName()));
} else {
exp = new NoSuchMethodError(e.getMessage());
}
exp.initCause(e);
throw exp;
}
} }
}); exp.initCause(e);
throw exp;
}
int classMod = clazz.getModifiers(); int classMod = clazz.getModifiers();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,12 +25,18 @@
package com.sun.xml.internal.org.jvnet.mimepull; package com.sun.xml.internal.org.jvnet.mimepull;
import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -40,19 +46,21 @@ import java.util.logging.Logger;
* *
* @author Jitendra Kotamraju * @author Jitendra Kotamraju
*/ */
public class MIMEMessage { public class MIMEMessage implements Closeable {
private static final Logger LOGGER = Logger.getLogger(MIMEMessage.class.getName()); private static final Logger LOGGER = Logger.getLogger(MIMEMessage.class.getName());
MIMEConfig config; MIMEConfig config;
private final InputStream in; private final InputStream in;
private final List<MIMEPart> partsList;
private final Map<String, MIMEPart> partsMap;
private final Iterator<MIMEEvent> it; private final Iterator<MIMEEvent> it;
private boolean parsed; // true when entire message is parsed private boolean parsed; // true when entire message is parsed
private MIMEPart currentPart; private MIMEPart currentPart;
private int currentIndex; private int currentIndex;
private final List<MIMEPart> partsList = new ArrayList<MIMEPart>();
private final Map<String, MIMEPart> partsMap = new HashMap<String, MIMEPart>();
/** /**
* @see MIMEMessage(InputStream, String, MIMEConfig) * @see MIMEMessage(InputStream, String, MIMEConfig)
*/ */
@ -64,9 +72,9 @@ public class MIMEMessage {
* Creates a MIME message from the content's stream. The content stream * Creates a MIME message from the content's stream. The content stream
* is closed when EOF is reached. * is closed when EOF is reached.
* *
* @param in MIME message stream * @param in MIME message stream
* @param boundary the separator for parts(pass it without --) * @param boundary the separator for parts(pass it without --)
* @param config various configuration parameters * @param config various configuration parameters
*/ */
public MIMEMessage(InputStream in, String boundary, MIMEConfig config) { public MIMEMessage(InputStream in, String boundary, MIMEConfig config) {
this.in = in; this.in = in;
@ -74,8 +82,6 @@ public class MIMEMessage {
MIMEParser parser = new MIMEParser(in, boundary, config); MIMEParser parser = new MIMEParser(in, boundary, config);
it = parser.iterator(); it = parser.iterator();
partsList = new ArrayList<MIMEPart>();
partsMap = new HashMap<String, MIMEPart>();
if (config.isParseEagerly()) { if (config.isParseEagerly()) {
parseAll(); parseAll();
} }
@ -108,14 +114,14 @@ public class MIMEMessage {
LOGGER.log(Level.FINE, "index={0}", index); LOGGER.log(Level.FINE, "index={0}", index);
MIMEPart part = (index < partsList.size()) ? partsList.get(index) : null; MIMEPart part = (index < partsList.size()) ? partsList.get(index) : null;
if (parsed && part == null) { if (parsed && part == null) {
throw new MIMEParsingException("There is no "+index+" attachment part "); throw new MIMEParsingException("There is no " + index + " attachment part ");
} }
if (part == null) { if (part == null) {
// Parsing will done lazily and will be driven by reading the part // Parsing will done lazily and will be driven by reading the part
part = new MIMEPart(this); part = new MIMEPart(this);
partsList.add(index, part); partsList.add(index, part);
} }
LOGGER.log(Level.FINE, "Got attachment at index={0} attachment={1}", new Object[]{index, part}); LOGGER.log(Level.FINE, "Got attachment at index={0} attachment={1}", new Object[] {index, part});
return part; return part;
} }
@ -132,14 +138,14 @@ public class MIMEMessage {
LOGGER.log(Level.FINE, "Content-ID={0}", contentId); LOGGER.log(Level.FINE, "Content-ID={0}", contentId);
MIMEPart part = getDecodedCidPart(contentId); MIMEPart part = getDecodedCidPart(contentId);
if (parsed && part == null) { if (parsed && part == null) {
throw new MIMEParsingException("There is no attachment part with Content-ID = "+contentId); throw new MIMEParsingException("There is no attachment part with Content-ID = " + contentId);
} }
if (part == null) { if (part == null) {
// Parsing is done lazily and is driven by reading the part // Parsing is done lazily and is driven by reading the part
part = new MIMEPart(this, contentId); part = new MIMEPart(this, contentId);
partsMap.put(contentId, part); partsMap.put(contentId, part);
} }
LOGGER.log(Level.FINE, "Got attachment for Content-ID={0} attachment={1}", new Object[]{contentId, part}); LOGGER.log(Level.FINE, "Got attachment for Content-ID={0} attachment={1}", new Object[] {contentId, part});
return part; return part;
} }
@ -151,7 +157,7 @@ public class MIMEMessage {
try { try {
String tempCid = URLDecoder.decode(cid, "utf-8"); String tempCid = URLDecoder.decode(cid, "utf-8");
part = partsMap.get(tempCid); part = partsMap.get(tempCid);
} catch(UnsupportedEncodingException ue) { } catch (UnsupportedEncodingException ue) {
// Ignore it // Ignore it
} }
} }
@ -159,22 +165,43 @@ public class MIMEMessage {
return part; return part;
} }
/** /**
* Parses the whole MIME message eagerly * Parses the whole MIME message eagerly
*/ */
public final void parseAll() { public final void parseAll() {
while(makeProgress()) { while (makeProgress()) {
// Nothing to do // Nothing to do
} }
} }
/**
* Closes all parsed {@link com.sun.xml.internal.org.jvnet.mimepull.MIMEPart parts}.
* This method is safe to call even if parsing of message failed.
* <p/>
* Does not throw {@link com.sun.xml.internal.org.jvnet.mimepull.MIMEParsingException} if an
* error occurred during closing a MIME part. The exception (if any) is
* still logged.
*/
@Override
public void close() {
close(partsList);
close(partsMap.values());
}
private void close(final Collection<MIMEPart> parts) {
for (final MIMEPart part : parts) {
try {
part.close();
} catch (final MIMEParsingException closeError) {
LOGGER.log(Level.FINE, "Exception during closing MIME part", closeError);
}
}
}
/** /**
* Parses the MIME message in a pull fashion. * Parses the MIME message in a pull fashion.
* *
* @return * @return false if the parsing is completed.
* false if the parsing is completed.
*/ */
public synchronized boolean makeProgress() { public synchronized boolean makeProgress() {
if (!it.hasNext()) { if (!it.hasNext()) {
@ -183,23 +210,23 @@ public class MIMEMessage {
MIMEEvent event = it.next(); MIMEEvent event = it.next();
switch(event.getEventType()) { switch (event.getEventType()) {
case START_MESSAGE : case START_MESSAGE:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_MESSAGE); LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_MESSAGE);
break; break;
case START_PART : case START_PART:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_PART); LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_PART);
break; break;
case HEADERS : case HEADERS:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.HEADERS); LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.HEADERS);
MIMEEvent.Headers headers = (MIMEEvent.Headers)event; MIMEEvent.Headers headers = (MIMEEvent.Headers) event;
InternetHeaders ih = headers.getHeaders(); InternetHeaders ih = headers.getHeaders();
List<String> cids = ih.getHeader("content-id"); List<String> cids = ih.getHeader("content-id");
String cid = (cids != null) ? cids.get(0) : currentIndex+""; String cid = (cids != null) ? cids.get(0) : currentIndex + "";
if (cid.length() > 2 && cid.charAt(0)=='<') { if (cid.length() > 2 && cid.charAt(0) == '<') {
cid = cid.substring(1,cid.length()-1); cid = cid.substring(1, cid.length() - 1);
} }
MIMEPart listPart = (currentIndex < partsList.size()) ? partsList.get(currentIndex) : null; MIMEPart listPart = (currentIndex < partsList.size()) ? partsList.get(currentIndex) : null;
MIMEPart mapPart = getDecodedCidPart(cid); MIMEPart mapPart = getDecodedCidPart(cid);
@ -219,31 +246,31 @@ public class MIMEMessage {
currentPart.setHeaders(ih); currentPart.setHeaders(ih);
break; break;
case CONTENT : case CONTENT:
LOGGER.log(Level.FINER, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.CONTENT); LOGGER.log(Level.FINER, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.CONTENT);
MIMEEvent.Content content = (MIMEEvent.Content)event; MIMEEvent.Content content = (MIMEEvent.Content) event;
ByteBuffer buf = content.getData(); ByteBuffer buf = content.getData();
currentPart.addBody(buf); currentPart.addBody(buf);
break; break;
case END_PART : case END_PART:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_PART); LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_PART);
currentPart.doneParsing(); currentPart.doneParsing();
++currentIndex; ++currentIndex;
break; break;
case END_MESSAGE : case END_MESSAGE:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_MESSAGE); LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_MESSAGE);
parsed = true; parsed = true;
try { try {
in.close(); in.close();
} catch(IOException ioe) { } catch (IOException ioe) {
throw new MIMEParsingException(ioe); throw new MIMEParsingException(ioe);
} }
break; break;
default : default:
throw new MIMEParsingException("Unknown Parser state = "+event.getEventType()); throw new MIMEParsingException("Unknown Parser state = " + event.getEventType());
} }
return true; return true;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
package com.sun.xml.internal.org.jvnet.mimepull; package com.sun.xml.internal.org.jvnet.mimepull;
import java.io.Closeable;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -42,10 +43,11 @@ import java.util.logging.Logger;
* *
* @author Jitendra Kotamraju, Martin Grebac * @author Jitendra Kotamraju, Martin Grebac
*/ */
public class MIMEPart { public class MIMEPart implements Closeable {
private static final Logger LOGGER = Logger.getLogger(MIMEPart.class.getName()); private static final Logger LOGGER = Logger.getLogger(MIMEPart.class.getName());
private volatile boolean closed;
private volatile InternetHeaders headers; private volatile InternetHeaders headers;
private volatile String contentId; private volatile String contentId;
private String contentType; private String contentType;
@ -55,6 +57,8 @@ public class MIMEPart {
final MIMEMessage msg; final MIMEMessage msg;
private final DataHead dataHead; private final DataHead dataHead;
private final Object lock = new Object();
MIMEPart(MIMEMessage msg) { MIMEPart(MIMEMessage msg) {
this.msg = msg; this.msg = msg;
this.dataHead = new DataHead(this); this.dataHead = new DataHead(this);
@ -91,8 +95,16 @@ public class MIMEPart {
* the temp file that is used to serve this part's content). After * the temp file that is used to serve this part's content). After
* calling this, one shouldn't call {@link #read()} or {@link #readOnce()} * calling this, one shouldn't call {@link #read()} or {@link #readOnce()}
*/ */
@Override
public void close() { public void close() {
dataHead.close(); if (!closed) {
synchronized (lock) {
if (!closed) {
dataHead.close();
closed = true;
}
}
}
} }
/** /**
@ -242,6 +254,15 @@ public class MIMEPart {
this.contentTransferEncoding = cte; this.contentTransferEncoding = cte;
} }
/**
* Return {@code true} if this part has already been closed, {@code false} otherwise.
*
* @return {@code true} if this part has already been closed, {@code false} otherwise.
*/
public boolean isClosed() {
return closed;
}
@Override @Override
public String toString() { public String toString() {
return "Part="+contentId+":"+contentTransferEncoding; return "Part="+contentId+":"+contentTransferEncoding;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -84,9 +84,6 @@ final class MemoryData implements Data {
if (LOGGER.isLoggable(Level.FINE)) { if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile); LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);
} }
// delete the temp file when VM exits as a last resort for file clean up
tempFile.deleteOnExit();
if (LOGGER.isLoggable(Level.FINE)) {LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);}
dataHead.dataFile = new DataFile(tempFile); dataHead.dataFile = new DataFile(tempFile);
} catch (IOException ioe) { } catch (IOException ioe) {
throw new MIMEParsingException(ioe); throw new MIMEParsingException(ioe);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,6 @@
package javax.xml.bind; package javax.xml.bind;
import java.util.Iterator;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -34,15 +33,13 @@ import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URL; import java.net.URL;
import java.security.AccessController;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.logging.ConsoleHandler; import java.util.logging.ConsoleHandler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.security.AccessController;
import static javax.xml.bind.JAXBContext.JAXB_CONTEXT_FACTORY;
/** /**
@ -55,7 +52,24 @@ import static javax.xml.bind.JAXBContext.JAXB_CONTEXT_FACTORY;
* @see JAXBContext * @see JAXBContext
*/ */
class ContextFinder { class ContextFinder {
/**
* When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
* However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext
* because if it has, it will take precedence over any file that applications have
* in their jar files.
*
* <p>
* When the user bundles his own JAXB implementation, we'd like to use it, and we
* want the platform default to be used only when there's no other JAXB provider.
*
* <p>
* For this reason, we have to hard-code the class name into the API.
*/
private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory";
private static final Logger logger; private static final Logger logger;
static { static {
logger = Logger.getLogger("javax.xml.bind"); logger = Logger.getLogger("javax.xml.bind");
try { try {
@ -72,7 +86,7 @@ class ContextFinder {
// to honor what other frameworks // to honor what other frameworks
// have done on configurations. // have done on configurations.
} }
} catch(Throwable t) { } catch (Throwable t) {
// just to be extra safe. in particular System.getProperty may throw // just to be extra safe. in particular System.getProperty may throw
// SecurityException. // SecurityException.
} }
@ -84,15 +98,15 @@ class ContextFinder {
*/ */
private static void handleInvocationTargetException(InvocationTargetException x) throws JAXBException { private static void handleInvocationTargetException(InvocationTargetException x) throws JAXBException {
Throwable t = x.getTargetException(); Throwable t = x.getTargetException();
if( t != null ) { if (t != null) {
if( t instanceof JAXBException ) if (t instanceof JAXBException)
// one of our exceptions, just re-throw // one of our exceptions, just re-throw
throw (JAXBException)t; throw (JAXBException) t;
if( t instanceof RuntimeException ) if (t instanceof RuntimeException)
// avoid wrapping exceptions unnecessarily // avoid wrapping exceptions unnecessarily
throw (RuntimeException)t; throw (RuntimeException) t;
if( t instanceof Error ) if (t instanceof Error)
throw (Error)t; throw (Error) t;
} }
} }
@ -121,18 +135,17 @@ class ContextFinder {
/** /**
* Create an instance of a class using the specified ClassLoader * Create an instance of a class using the specified ClassLoader
*/ */
static JAXBContext newInstance( String contextPath, static JAXBContext newInstance(String contextPath,
String className, String className,
ClassLoader classLoader, ClassLoader classLoader,
Map properties ) Map properties) throws JAXBException {
throws JAXBException {
try { try {
Class spFactory = safeLoadClass(className,classLoader); Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader);
return newInstance(contextPath, spFactory, classLoader, properties); return newInstance(contextPath, spFactory, classLoader, properties);
} catch (ClassNotFoundException x) { } catch (ClassNotFoundException x) {
throw new JAXBException( throw new JAXBException(Messages.format(Messages.PROVIDER_NOT_FOUND, className), x);
Messages.format( Messages.PROVIDER_NOT_FOUND, className ),
x);
} catch (RuntimeException x) { } catch (RuntimeException x) {
// avoid wrapping RuntimeException to JAXBException, // avoid wrapping RuntimeException to JAXBException,
// because it indicates a bug in this code. // because it indicates a bug in this code.
@ -142,18 +155,12 @@ class ContextFinder {
// reflection. Root element collisions detected in the call to // reflection. Root element collisions detected in the call to
// createContext() are reported as JAXBExceptions - just re-throw it // createContext() are reported as JAXBExceptions - just re-throw it
// some other type of exception - just wrap it // some other type of exception - just wrap it
throw new JAXBException( throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, className, x), x);
Messages.format( Messages.COULD_NOT_INSTANTIATE, className, x ),
x);
} }
} }
static JAXBContext newInstance( String contextPath, static JAXBContext newInstance(String contextPath, Class spFactory, ClassLoader classLoader, Map properties) throws JAXBException {
Class spFactory,
ClassLoader classLoader,
Map properties )
throws JAXBException
{
try { try {
/* /*
* javax.xml.bind.context.factory points to a class which has a * javax.xml.bind.context.factory points to a class which has a
@ -166,35 +173,35 @@ class ContextFinder {
// first check the method that takes Map as the third parameter. // first check the method that takes Map as the third parameter.
// this is added in 2.0. // this is added in 2.0.
try { try {
Method m = spFactory.getMethod("createContext",String.class,ClassLoader.class,Map.class); Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class, Map.class);
// any failure in invoking this method would be considered fatal // any failure in invoking this method would be considered fatal
context = m.invoke(null,contextPath,classLoader,properties); context = m.invoke(null, contextPath, classLoader, properties);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
// it's not an error for the provider not to have this method. // it's not an error for the provider not to have this method.
} }
if(context==null) { if (context == null) {
// try the old method that doesn't take properties. compatible with 1.0. // try the old method that doesn't take properties. compatible with 1.0.
// it is an error for an implementation not to have both forms of the createContext method. // it is an error for an implementation not to have both forms of the createContext method.
Method m = spFactory.getMethod("createContext",String.class,ClassLoader.class); Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class);
// any failure in invoking this method would be considered fatal // any failure in invoking this method would be considered fatal
context = m.invoke(null,contextPath,classLoader); context = m.invoke(null, contextPath, classLoader);
} }
if(!(context instanceof JAXBContext)) { if (!(context instanceof JAXBContext)) {
// the cast would fail, so generate an exception with a nice message // the cast would fail, so generate an exception with a nice message
throw handleClassCastException(context.getClass(), JAXBContext.class); throw handleClassCastException(context.getClass(), JAXBContext.class);
} }
return (JAXBContext)context; return (JAXBContext) context;
} catch (InvocationTargetException x) { } catch (InvocationTargetException x) {
handleInvocationTargetException(x); handleInvocationTargetException(x);
// for other exceptions, wrap the internal target exception // for other exceptions, wrap the internal target exception
// with a JAXBException // with a JAXBException
Throwable e = x; Throwable e = x;
if(x.getTargetException()!=null) if (x.getTargetException() != null)
e = x.getTargetException(); e = x.getTargetException();
throw new JAXBException( Messages.format( Messages.COULD_NOT_INSTANTIATE, spFactory, e ), e ); throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, spFactory, e), e);
} catch (RuntimeException x) { } catch (RuntimeException x) {
// avoid wrapping RuntimeException to JAXBException, // avoid wrapping RuntimeException to JAXBException,
// because it indicates a bug in this code. // because it indicates a bug in this code.
@ -204,29 +211,23 @@ class ContextFinder {
// reflection. Root element collisions detected in the call to // reflection. Root element collisions detected in the call to
// createContext() are reported as JAXBExceptions - just re-throw it // createContext() are reported as JAXBExceptions - just re-throw it
// some other type of exception - just wrap it // some other type of exception - just wrap it
throw new JAXBException( throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, spFactory, x), x);
Messages.format( Messages.COULD_NOT_INSTANTIATE, spFactory, x ),
x);
} }
} }
/** /**
* Create an instance of a class using the thread context ClassLoader * Create an instance of a class using the thread context ClassLoader
*/ */
static JAXBContext newInstance( static JAXBContext newInstance(Class[] classes, Map properties, String className) throws JAXBException {
Class[] classes,
Map properties,
String className) throws JAXBException {
ClassLoader cl = getContextClassLoader();
Class spi; Class spi;
try { try {
spi = safeLoadClass(className,cl); spi = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, getContextClassLoader());
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new JAXBException(e); throw new JAXBException(e);
} }
if(logger.isLoggable(Level.FINE)) { if (logger.isLoggable(Level.FINE)) {
// extra check to avoid costly which operation if not logged // extra check to avoid costly which operation if not logged
logger.log(Level.FINE, "loaded {0} from {1}", new Object[]{className, which(spi)}); logger.log(Level.FINE, "loaded {0} from {1}", new Object[]{className, which(spi)});
} }
@ -237,19 +238,16 @@ class ContextFinder {
static JAXBContext newInstance(Class[] classes, static JAXBContext newInstance(Class[] classes,
Map properties, Map properties,
Class spFactory) throws JAXBException { Class spFactory) throws JAXBException {
Method m;
try {
m = spFactory.getMethod("createContext", Class[].class, Map.class);
} catch (NoSuchMethodException e) {
throw new JAXBException(e);
}
try { try {
Method m = spFactory.getMethod("createContext", Class[].class, Map.class);
Object context = m.invoke(null, classes, properties); Object context = m.invoke(null, classes, properties);
if(!(context instanceof JAXBContext)) { if (!(context instanceof JAXBContext)) {
// the cast would fail, so generate an exception with a nice message // the cast would fail, so generate an exception with a nice message
throw handleClassCastException(context.getClass(), JAXBContext.class); throw handleClassCastException(context.getClass(), JAXBContext.class);
} }
return (JAXBContext)context; return (JAXBContext) context;
} catch (NoSuchMethodException e) {
throw new JAXBException(e);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
throw new JAXBException(e); throw new JAXBException(e);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
@ -263,241 +261,139 @@ class ContextFinder {
} }
} }
static JAXBContext find(String factoryId, String contextPath, ClassLoader classLoader, Map properties ) throws JAXBException { static JAXBContext find(String factoryId, String contextPath, ClassLoader classLoader, Map properties) throws JAXBException {
// TODO: do we want/need another layer of searching in $java.home/lib/jaxb.properties like JAXP? // TODO: do we want/need another layer of searching in $java.home/lib/jaxb.properties like JAXP?
final String jaxbContextFQCN = JAXBContext.class.getName(); StringTokenizer packages = new StringTokenizer(contextPath, ":");
if (!packages.hasMoreTokens()) {
// search context path for jaxb.properties first
StringBuilder propFileName;
StringTokenizer packages = new StringTokenizer( contextPath, ":" );
String factoryClassName;
if(!packages.hasMoreTokens())
// no context is specified // no context is specified
throw new JAXBException(Messages.format(Messages.NO_PACKAGE_IN_CONTEXTPATH)); throw new JAXBException(Messages.format(Messages.NO_PACKAGE_IN_CONTEXTPATH));
}
// search for jaxb.properties in the class loader of each class first
logger.fine("Searching jaxb.properties"); logger.fine("Searching jaxb.properties");
while (packages.hasMoreTokens()) {
while( packages.hasMoreTokens() ) {
String packageName = packages.nextToken(":").replace('.','/');
// com.acme.foo - > com/acme/foo/jaxb.properties // com.acme.foo - > com/acme/foo/jaxb.properties
propFileName = new StringBuilder().append(packageName).append("/jaxb.properties"); String className = classNameFromPackageProperties(factoryId, classLoader, packages.nextToken(":").replace('.', '/'));
if (className != null) return newInstance(contextPath, className, classLoader, properties);
Properties props = loadJAXBProperties( classLoader, propFileName.toString() );
if (props != null) {
if (props.containsKey(factoryId)) {
factoryClassName = props.getProperty(factoryId);
return newInstance( contextPath, factoryClassName, classLoader, properties );
} else {
throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryId));
}
}
} }
logger.fine("Searching the system property"); String factoryName = classNameFromSystemProperties();
if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
// search for a system property second (javax.xml.bind.JAXBContext) Class ctxFactory = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader("javax.xml.bind.JAXBContext", logger);
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY)); if (ctxFactory != null) {
if( factoryClassName != null ) { return newInstance(contextPath, ctxFactory, classLoader, properties);
return newInstance( contextPath, factoryClassName, classLoader, properties );
} else { // leave this here to assure compatibility
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(jaxbContextFQCN));
if( factoryClassName != null ) {
return newInstance( contextPath, factoryClassName, classLoader, properties );
}
} }
// OSGi search // TODO: SPEC change required! This is supposed to be!
Class jaxbContext = lookupJaxbContextUsingOsgiServiceLoader(); // JAXBContext obj = firstByServiceLoader(JAXBContext.class, EXCEPTION_HANDLER);
if (jaxbContext != null) { // if (obj != null) return obj;
logger.fine("OSGi environment detected");
return newInstance(contextPath, jaxbContext, classLoader, properties);
}
logger.fine("Searching META-INF/services"); // TODO: Deprecated - SPEC change required!
// search META-INF services next factoryName = firstByServiceLoaderDeprecated(JAXBContext.class, classLoader);
BufferedReader r = null; if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
try {
final StringBuilder resource = new StringBuilder().append("META-INF/services/").append(jaxbContextFQCN);
final InputStream resourceStream =
classLoader.getResourceAsStream(resource.toString());
if (resourceStream != null) {
r = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8"));
factoryClassName = r.readLine();
if (factoryClassName != null) {
factoryClassName = factoryClassName.trim();
}
r.close();
return newInstance(contextPath, factoryClassName, classLoader, properties);
} else {
logger.log(Level.FINE, "Unable to load:{0}", resource.toString());
}
} catch (UnsupportedEncodingException e) {
// should never happen
throw new JAXBException(e);
} catch (IOException e) {
throw new JAXBException(e);
} finally {
try {
if (r != null) {
r.close();
}
} catch (IOException ex) {
Logger.getLogger(ContextFinder.class.getName()).log(Level.SEVERE, null, ex);
}
}
// else no provider found // else no provider found
logger.fine("Trying to create the platform default provider"); logger.fine("Trying to create the platform default provider");
return newInstance(contextPath, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties); return newInstance(contextPath, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties);
} }
static JAXBContext find( Class[] classes, Map properties ) throws JAXBException { static JAXBContext find(Class[] classes, Map properties) throws JAXBException {
final String jaxbContextFQCN = JAXBContext.class.getName();
String factoryClassName;
// search for jaxb.properties in the class loader of each class first // search for jaxb.properties in the class loader of each class first
logger.fine("Searching jaxb.properties");
for (final Class c : classes) { for (final Class c : classes) {
// this classloader is used only to load jaxb.properties, so doing this should be safe. // this classloader is used only to load jaxb.properties, so doing this should be safe.
ClassLoader classLoader = getClassClassLoader(c); if (c.getPackage() == null) continue; // this is possible for primitives, arrays, and classes that are loaded by poorly implemented ClassLoaders
Package pkg = c.getPackage();
if(pkg==null)
continue; // this is possible for primitives, arrays, and classes that are loaded by poorly implemented ClassLoaders
String packageName = pkg.getName().replace('.', '/');
// TODO: do we want to optimize away searching the same package? org.Foo, org.Bar, com.Baz // TODO: do we want to optimize away searching the same package? org.Foo, org.Bar, com.Baz
// classes from the same package might come from different class loades, so it might be a bad idea // classes from the same package might come from different class loades, so it might be a bad idea
// TODO: it's easier to look things up from the class // TODO: it's easier to look things up from the class
// c.getResourceAsStream("jaxb.properties"); // c.getResourceAsStream("jaxb.properties");
// build the resource name and use the property loader code String className = classNameFromPackageProperties(JAXBContext.JAXB_CONTEXT_FACTORY, getClassClassLoader(c), c.getPackage().getName().replace('.', '/'));
String resourceName = packageName+"/jaxb.properties"; if (className != null) return newInstance(classes, properties, className);
logger.log(Level.FINE, "Trying to locate {0}", resourceName);
Properties props = loadJAXBProperties(classLoader, resourceName);
if (props == null) {
logger.fine(" not found");
} else {
logger.fine(" found");
if (props.containsKey(JAXB_CONTEXT_FACTORY)) {
// trim() seems redundant, but adding to satisfy customer complaint
factoryClassName = props.getProperty(JAXB_CONTEXT_FACTORY).trim();
return newInstance(classes, properties, factoryClassName);
} else {
throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, JAXB_CONTEXT_FACTORY));
}
}
} }
// search for a system property second (javax.xml.bind.JAXBContext) String factoryName = classNameFromSystemProperties();
logger.log(Level.FINE, "Checking system property {0}", JAXBContext.JAXB_CONTEXT_FACTORY); if (factoryName != null) return newInstance(classes, properties, factoryName);
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY));
if (factoryClassName != null) { Class ctxFactoryClass = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader("javax.xml.bind.JAXBContext", logger);
logger.log(Level.FINE, " found {0}", factoryClassName); if (ctxFactoryClass != null) {
return newInstance( classes, properties, factoryClassName ); return newInstance(classes, properties, ctxFactoryClass);
} else { // leave it here for compatibility reasons
logger.fine(" not found");
logger.log(Level.FINE, "Checking system property {0}", jaxbContextFQCN);
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(jaxbContextFQCN));
if (factoryClassName != null) {
logger.log(Level.FINE, " found {0}", factoryClassName);
return newInstance( classes, properties, factoryClassName );
} else {
logger.fine(" not found");
}
} }
// OSGi search // TODO: to be removed - deprecated!!! Requires SPEC change!!!
Class jaxbContext = lookupJaxbContextUsingOsgiServiceLoader(); String className = firstByServiceLoaderDeprecated(JAXBContext.class, getContextClassLoader());
if (jaxbContext != null) { if (className != null) return newInstance(classes, properties, className);
logger.fine("OSGi environment detected");
return newInstance(classes, properties, jaxbContext);
}
// search META-INF services next // // TODO: supposed to be:
logger.fine("Checking META-INF/services"); // obj = firstByServiceLoader(JAXBContext.class, EXCEPTION_HANDLER);
BufferedReader r = null; // if (obj != null) return obj;
try {
final String resource = new StringBuilder("META-INF/services/").append(jaxbContextFQCN).toString();
ClassLoader classLoader = getContextClassLoader();
URL resourceURL;
if(classLoader==null)
resourceURL = ClassLoader.getSystemResource(resource);
else
resourceURL = classLoader.getResource(resource);
if (resourceURL != null) {
logger.log(Level.FINE, "Reading {0}", resourceURL);
r = new BufferedReader(new InputStreamReader(resourceURL.openStream(), "UTF-8"));
factoryClassName = r.readLine();
if (factoryClassName != null) {
factoryClassName = factoryClassName.trim();
}
return newInstance(classes, properties, factoryClassName);
} else {
logger.log(Level.FINE, "Unable to find: {0}", resource);
}
} catch (UnsupportedEncodingException e) {
// should never happen
throw new JAXBException(e);
} catch (IOException e) {
throw new JAXBException(e);
} finally {
if (r != null) {
try {
r.close();
} catch (IOException ex) {
logger.log(Level.FINE, "Unable to close stream", ex);
}
}
}
// else no provider found // else no provider found
logger.fine("Trying to create the platform default provider"); logger.fine("Trying to create the platform default provider");
return newInstance(classes, properties, PLATFORM_DEFAULT_FACTORY_CLASS); return newInstance(classes, properties, PLATFORM_DEFAULT_FACTORY_CLASS);
} }
private static Class lookupJaxbContextUsingOsgiServiceLoader() {
try { private static String classNameFromPackageProperties(String factoryId, ClassLoader classLoader, String packageName) throws JAXBException {
// Use reflection to avoid having any dependency on ServiceLoader class String resourceName = packageName + "/jaxb.properties";
Class target = Class.forName("com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader"); logger.log(Level.FINE, "Trying to locate {0}", resourceName);
Method m = target.getMethod("lookupProviderClasses", Class.class); Properties props = loadJAXBProperties(classLoader, resourceName);
Iterator iter = ((Iterable) m.invoke(null, JAXBContext.class)).iterator(); if (props != null) {
return iter.hasNext() ? (Class)iter.next() : null; if (props.containsKey(factoryId)) {
} catch(Exception e) { return props.getProperty(factoryId);
logger.log(Level.FINE, "Unable to find from OSGi: javax.xml.bind.JAXBContext"); } else {
return null; throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryId));
}
} }
return null;
} }
private static Properties loadJAXBProperties( ClassLoader classLoader, private static String classNameFromSystemProperties() throws JAXBException {
String propFileName ) logger.log(Level.FINE, "Checking system property {0}", JAXBContext.JAXB_CONTEXT_FACTORY);
throws JAXBException { // search for a system property second (javax.xml.bind.JAXBContext)
String factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY));
if (factoryClassName != null) {
logger.log(Level.FINE, " found {0}", factoryClassName);
return factoryClassName;
} else { // leave this here to assure compatibility
logger.fine(" not found");
logger.log(Level.FINE, "Checking system property {0}", JAXBContext.class.getName());
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.class.getName()));
if (factoryClassName != null) {
logger.log(Level.FINE, " found {0}", factoryClassName);
return factoryClassName;
} else {
logger.fine(" not found");
}
}
return null;
}
private static Properties loadJAXBProperties(ClassLoader classLoader, String propFileName) throws JAXBException {
Properties props = null; Properties props = null;
try { try {
URL url; URL url;
if(classLoader==null) if (classLoader == null)
url = ClassLoader.getSystemResource(propFileName); url = ClassLoader.getSystemResource(propFileName);
else else
url = classLoader.getResource( propFileName ); url = classLoader.getResource(propFileName);
if( url != null ) { if (url != null) {
logger.log(Level.FINE, "loading props from {0}", url); logger.log(Level.FINE, "loading props from {0}", url);
props = new Properties(); props = new Properties();
InputStream is = url.openStream(); InputStream is = url.openStream();
props.load( is ); props.load(is);
is.close(); is.close();
} }
} catch( IOException ioe ) { } catch (IOException ioe) {
logger.log(Level.FINE,"Unable to load "+propFileName,ioe); logger.log(Level.FINE, "Unable to load " + propFileName, ioe);
throw new JAXBException( ioe.toString(), ioe ); throw new JAXBException(ioe.toString(), ioe);
} }
return props; return props;
@ -520,7 +416,7 @@ class ContextFinder {
String classnameAsResource = clazz.getName().replace('.', '/') + ".class"; String classnameAsResource = clazz.getName().replace('.', '/') + ".class";
if(loader == null) { if (loader == null) {
loader = getSystemClassLoader(); loader = getSystemClassLoader();
} }
@ -543,50 +439,7 @@ class ContextFinder {
return which(clazz, getClassClassLoader(clazz)); return which(clazz, getClassClassLoader(clazz));
} }
/** @SuppressWarnings("unchecked")
* When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
* However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext
* because if it has, it will take precedence over any file that applications have
* in their jar files.
*
* <p>
* When the user bundles his own JAXB implementation, we'd like to use it, and we
* want the platform default to be used only when there's no other JAXB provider.
*
* <p>
* For this reason, we have to hard-code the class name into the API.
*/
private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory";
/**
* Loads the class, provided that the calling thread has an access to the class being loaded.
*/
private static Class safeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
logger.log(Level.FINE, "Trying to load {0}", className);
try {
// make sure that the current thread has an access to the package of the given name.
SecurityManager s = System.getSecurityManager();
if (s != null) {
int i = className.lastIndexOf('.');
if (i != -1) {
s.checkPackageAccess(className.substring(0,i));
}
}
if (classLoader == null) {
return Class.forName(className);
} else {
return classLoader.loadClass(className);
}
} catch (SecurityException se) {
// anyone can access the platform default factory class without permission
if (PLATFORM_DEFAULT_FACTORY_CLASS.equals(className)) {
return Class.forName(className);
}
throw se;
}
}
private static ClassLoader getContextClassLoader() { private static ClassLoader getContextClassLoader() {
if (System.getSecurityManager() == null) { if (System.getSecurityManager() == null) {
return Thread.currentThread().getContextClassLoader(); return Thread.currentThread().getContextClassLoader();
@ -600,6 +453,7 @@ class ContextFinder {
} }
} }
@SuppressWarnings("unchecked")
private static ClassLoader getClassClassLoader(final Class c) { private static ClassLoader getClassClassLoader(final Class c) {
if (System.getSecurityManager() == null) { if (System.getSecurityManager() == null) {
return c.getClassLoader(); return c.getClassLoader();
@ -626,4 +480,50 @@ class ContextFinder {
} }
} }
// TODO: to be removed - SPEC change required
// ServiceLoaderUtil.firstByServiceLoaderDeprecated should be used instead.
@Deprecated
static String firstByServiceLoaderDeprecated(Class spiClass, ClassLoader classLoader) throws JAXBException {
final String jaxbContextFQCN = spiClass.getName();
logger.fine("Searching META-INF/services");
// search META-INF services next
BufferedReader r = null;
final String resource = new StringBuilder().append("META-INF/services/").append(jaxbContextFQCN).toString();
try {
final InputStream resourceStream =
(classLoader == null) ?
ClassLoader.getSystemResourceAsStream(resource) :
classLoader.getResourceAsStream(resource);
if (resourceStream != null) {
r = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8"));
String factoryClassName = r.readLine();
if (factoryClassName != null) {
factoryClassName = factoryClassName.trim();
}
r.close();
logger.log(Level.FINE, "Configured factorty class:{0}", factoryClassName);
return factoryClassName;
} else {
logger.log(Level.FINE, "Unable to load:{0}", resource);
return null;
}
} catch (UnsupportedEncodingException e) {
// should never happen
throw new JAXBException(e);
} catch (IOException e) {
throw new JAXBException(e);
} finally {
try {
if (r != null) {
r.close();
}
} catch (IOException ex) {
logger.log(Level.SEVERE, "Unable to close resource: " + resource, ex);
}
}
}
} }

View File

@ -63,10 +63,10 @@ import java.io.InputStream;
* <i><B>SPEC REQUIREMENT:</B> the provider must supply an implementation * <i><B>SPEC REQUIREMENT:</B> the provider must supply an implementation
* class containing the following method signatures:</i> * class containing the following method signatures:</i>
* *
* <pre> * <pre>{@code
* public static JAXBContext createContext( String contextPath, ClassLoader classLoader, Map&lt;String,Object&gt; properties ) throws JAXBException * public static JAXBContext createContext( String contextPath, ClassLoader classLoader, Map<String,Object> properties ) throws JAXBException
* public static JAXBContext createContext( Class[] classes, Map&lt;String,Object&gt; properties ) throws JAXBException * public static JAXBContext createContext( Class[] classes, Map<String,Object> properties ) throws JAXBException
* </pre> * }</pre>
* *
* <p><i> * <p><i>
* The following JAXB 1.0 requirement is only required for schema to * The following JAXB 1.0 requirement is only required for schema to
@ -352,7 +352,7 @@ public abstract class JAXBContext {
* <p> * <p>
* To maintain compatibility with JAXB 1.0 schema to java * To maintain compatibility with JAXB 1.0 schema to java
* interface/implementation binding, enabled by schema customization * interface/implementation binding, enabled by schema customization
* <tt>&lt;jaxb:globalBindings valueClass="false"&gt;</tt>, * <tt>{@literal <jaxb:globalBindings valueClass="false">}</tt>,
* the JAXB provider will ensure that each package on the context path * the JAXB provider will ensure that each package on the context path
* has a <tt>jaxb.properties</tt> file which contains a value for the * has a <tt>jaxb.properties</tt> file which contains a value for the
* <tt>javax.xml.bind.context.factory</tt> property and that all values * <tt>javax.xml.bind.context.factory</tt> property and that all values
@ -526,7 +526,7 @@ public abstract class JAXBContext {
* Not only the new context will recognize all the classes specified, * Not only the new context will recognize all the classes specified,
* but it will also recognize any classes that are directly/indirectly * but it will also recognize any classes that are directly/indirectly
* referenced statically from the specified classes. Subclasses of * referenced statically from the specified classes. Subclasses of
* referenced classes nor <tt>&#64;XmlTransient</tt> referenced classes * referenced classes nor <tt>@XmlTransient</tt> referenced classes
* are not registered with JAXBContext. * are not registered with JAXBContext.
* *
* For example, in the following Java code, if you do * For example, in the following Java code, if you do

View File

@ -74,7 +74,7 @@ public abstract class JAXBIntrospector {
* *
* <p>Convenience method to abstract whether working with either * <p>Convenience method to abstract whether working with either
* a javax.xml.bind.JAXBElement instance or an instance of * a javax.xml.bind.JAXBElement instance or an instance of
* <tt>&#64;XmlRootElement</tt> annotated Java class.</p> * <tt>@XmlRootElement</tt> annotated Java class.</p>
* *
* @param jaxbElement object that #isElement(Object) returns true. * @param jaxbElement object that #isElement(Object) returns true.
* *

View File

@ -70,11 +70,11 @@ public abstract class SchemaOutputResolver {
* *
* If the {@link Result} object has a system ID, it must be an * If the {@link Result} object has a system ID, it must be an
* absolute system ID. Those system IDs are relativized by the caller and used * absolute system ID. Those system IDs are relativized by the caller and used
* for &lt;xs:import&gt; statements. * for {@literal <xs:import>} statements.
* *
* If the {@link Result} object does not have a system ID, a schema * If the {@link Result} object does not have a system ID, a schema
* for the namespace URI is generated but it won't be explicitly * for the namespace URI is generated but it won't be explicitly
* &lt;xs:import&gt;ed from other schemas. * {@literal <xs:import>}ed from other schemas.
* *
* If {@code null} is returned, the schema generation for this * If {@code null} is returned, the schema generation for this
* namespace URI will be skipped. * namespace URI will be skipped.

View File

@ -0,0 +1,192 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.bind;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
import java.util.Properties;
import java.util.ServiceLoader;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Shared ServiceLoader/FactoryFinder Utils shared among SAAJ, JAXB and JAXWS
* - this class must be duplicated to all those projects, but it's
* basically generic code and we want to have it everywhere same.
*
* @author Miroslav.Kos@oracle.com
*/
class ServiceLoaderUtil {
private static final String OSGI_SERVICE_LOADER_CLASS_NAME = "com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader";
private static final String OSGI_SERVICE_LOADER_METHOD_NAME = "lookupProviderClasses";
static <P> P firstByServiceLoader(Class<P> spiClass, Logger logger) {
// service discovery
ServiceLoader<P> serviceLoader = ServiceLoader.load(spiClass);
for (P impl : serviceLoader) {
logger.fine("ServiceProvider loading Facility used; returning object [" + impl.getClass().getName() + "]");
return impl;
}
return null;
}
static boolean isOsgi(Logger logger) {
try {
Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME);
return true;
} catch (ClassNotFoundException ignored) {
logger.log(Level.FINE, "OSGi classes not found, OSGi not available.", ignored);
}
return false;
}
static Object lookupUsingOSGiServiceLoader(String factoryId, Logger logger) {
try {
// Use reflection to avoid having any dependendcy on ServiceLoader class
Class serviceClass = Class.forName(factoryId);
Class target = Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME);
Method m = target.getMethod(OSGI_SERVICE_LOADER_METHOD_NAME, Class.class);
Iterator iter = ((Iterable) m.invoke(null, serviceClass)).iterator();
if (iter.hasNext()) {
Object next = iter.next();
logger.fine("Found implementation using OSGi facility; returning object [" + next.getClass().getName() + "].");
return next;
} else {
return null;
}
} catch (Exception ignored) {
logger.log(Level.FINE, "Unable to find from OSGi: [" + factoryId + "]", ignored);
return null;
}
}
static String propertyFileLookup(final String configFullPath, final String factoryId) throws IOException {
File f = new File(configFullPath);
String factoryClassName = null;
if (f.exists()) {
Properties props = new Properties();
FileInputStream stream = null;
try {
stream = new FileInputStream(f);
props.load(stream);
factoryClassName = props.getProperty(factoryId);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException ignored) {
}
}
}
}
return factoryClassName;
}
static void checkPackageAccess(String className) {
// make sure that the current thread has an access to the package of the given name.
SecurityManager s = System.getSecurityManager();
if (s != null) {
int i = className.lastIndexOf('.');
if (i != -1) {
s.checkPackageAccess(className.substring(0, i));
}
}
}
static Class nullSafeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
if (classLoader == null) {
return Class.forName(className);
} else {
return classLoader.loadClass(className);
}
}
/**
* Returns instance of required class. It checks package access (security) unless it is defaultClassname. It means if you
* are trying to instantiate default implementation (fallback), pass the class name to both first and second parameter.
*
* @param className class to be instantiated
* @param isDefaultClassname says whether default implementation class
* @param handler exception handler - necessary for wrapping exceptions and logging
* @param <T> Type of exception being thrown (necessary to distinguish between Runtime and checked exceptions)
* @return instantiated object or throws Runtime/checked exception, depending on ExceptionHandler's type
* @throws T
*/
static <T extends Exception> Object newInstance(String className, String defaultImplClassName, final ExceptionHandler<T> handler) throws T {
try {
return safeLoadClass(className, defaultImplClassName, contextClassLoader(handler)).newInstance();
} catch (ClassNotFoundException x) {
throw handler.createException(x, "Provider " + className + " not found");
} catch (Exception x) {
throw handler.createException(x, "Provider " + className + " could not be instantiated: " + x);
}
}
static Class safeLoadClass(String className, String defaultImplClassName, ClassLoader classLoader) throws ClassNotFoundException {
try {
checkPackageAccess(className);
} catch (SecurityException se) {
// anyone can access the platform default factory class without permission
if (defaultImplClassName != null && defaultImplClassName.equals(className)) {
return Class.forName(className);
}
// not platform default implementation ...
throw se;
}
return nullSafeLoadClass(className, classLoader);
}
static String getJavaHomeLibConfigPath(String filename) {
String javah = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("java.home");
}
});
return javah + File.separator + "lib" + File.separator + filename;
}
static ClassLoader contextClassLoader(ExceptionHandler exceptionHandler) throws Exception {
try {
return Thread.currentThread().getContextClassLoader();
} catch (Exception x) {
throw exceptionHandler.createException(x, x.toString());
}
}
static abstract class ExceptionHandler<T extends Exception> {
public abstract T createException(Throwable throwable, String message);
}
}

View File

@ -73,12 +73,12 @@ import java.io.Reader;
* Unmarshalling from a StringBuffer using a * Unmarshalling from a StringBuffer using a
* <tt>javax.xml.transform.stream.StreamSource</tt>: * <tt>javax.xml.transform.stream.StreamSource</tt>:
* <blockquote> * <blockquote>
* <pre> * <pre>{@code
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" ); * JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller(); * Unmarshaller u = jc.createUnmarshaller();
* StringBuffer xmlStr = new StringBuffer( "&lt;?xml version=&quot;1.0&quot;?&gt;..." ); * StringBuffer xmlStr = new StringBuffer( "<?xml version="1.0"?>..." );
* Object o = u.unmarshal( new StreamSource( new StringReader( xmlStr.toString() ) ) ); * Object o = u.unmarshal( new StreamSource( new StringReader( xmlStr.toString() ) ) );
* </pre> * }</pre>
* </blockquote> * </blockquote>
* *
* <p> * <p>
@ -238,7 +238,7 @@ import java.io.Reader;
* to a JAXB mapped class by {@link JAXBContext}, that the root * to a JAXB mapped class by {@link JAXBContext}, that the root
* element's <tt>xsi:type</tt> attribute takes * element's <tt>xsi:type</tt> attribute takes
* precedence over the unmarshal methods <tt>declaredType</tt> parameter. * precedence over the unmarshal methods <tt>declaredType</tt> parameter.
* These methods always return a <tt>JAXBElement&lt;declaredType&gt;</tt> * These methods always return a <tt>{@literal JAXBElement<declaredType>}</tt>
* instance. The table below shows how the properties of the returned JAXBElement * instance. The table below shows how the properties of the returned JAXBElement
* instance are set. * instance are set.
* *
@ -281,21 +281,21 @@ import java.io.Reader;
* <p> * <p>
* Unmarshal by declaredType from a <tt>org.w3c.dom.Node</tt>: * Unmarshal by declaredType from a <tt>org.w3c.dom.Node</tt>:
* <blockquote> * <blockquote>
* <pre> * <pre>{@code
* Schema fragment for example * Schema fragment for example
* &lt;xs:schema&gt; * <xs:schema>
* &lt;xs:complexType name="FooType"&gt;...&lt;\xs:complexType&gt; * <xs:complexType name="FooType">...<\xs:complexType>
* &lt;!-- global element declaration "PurchaseOrder" --&gt; * <!-- global element declaration "PurchaseOrder" -->
* &lt;xs:element name="PurchaseOrder"&gt; * <xs:element name="PurchaseOrder">
* &lt;xs:complexType&gt; * <xs:complexType>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;!-- local element declaration "foo" --&gt; * <!-- local element declaration "foo" -->
* &lt;xs:element name="foo" type="FooType"/&gt; * <xs:element name="foo" type="FooType"/>
* ... * ...
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* &lt;/xs:element&gt; * </xs:element>
* &lt;/xs:schema&gt; * </xs:schema>
* *
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" ); * JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller(); * Unmarshaller u = jc.createUnmarshaller();
@ -308,8 +308,8 @@ import java.io.Reader;
* // local element declaration in schema. * // local element declaration in schema.
* *
* // FooType is the JAXB mapping of the type of local element declaration foo. * // FooType is the JAXB mapping of the type of local element declaration foo.
* JAXBElement&lt;FooType&gt; foo = u.unmarshal( fooSubtree, FooType.class); * JAXBElement<FooType> foo = u.unmarshal( fooSubtree, FooType.class);
* </pre> * }</pre>
* </blockquote> * </blockquote>
* *
* <p> * <p>

View File

@ -94,15 +94,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* <h2>Schema To Java example</h2> * <h2>Schema To Java example</h2>
* *
* The following schema would produce the following Java class: * The following schema would produce the following Java class:
* <pre> * <pre>{@code
* &lt;xs:complexType name="foo"&gt; * <xs:complexType name="foo">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="a" type="xs:int" /&gt; * <xs:element name="a" type="xs:int" />
* &lt;xs:element name="b" type="xs:int" /&gt; * <xs:element name="b" type="xs:int" />
* &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt; * <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <pre> * <pre>
* class Foo { * class Foo {
@ -115,30 +115,30 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* *
* It can unmarshal instances like * It can unmarshal instances like
* *
* <pre> * <pre>{@code
* &lt;foo xmlns:e="extra"&gt; * <foo xmlns:e="extra">
* &lt;a&gt;1&lt;/a&gt; * <a>1</a>
* &lt;e:other /&gt; // this will be bound to DOM, because unmarshalling is orderless * <e:other /> // this will be bound to DOM, because unmarshalling is orderless
* &lt;b&gt;3&lt;/b&gt; * <b>3</b>
* &lt;e:other /&gt; * <e:other />
* &lt;c&gt;5&lt;/c&gt; // this will be bound to DOM, because the annotation doesn't remember namespaces. * <c>5</c> // this will be bound to DOM, because the annotation doesn't remember namespaces.
* &lt;/foo&gt; * </foo>
* </pre> * }</pre>
* *
* *
* *
* The following schema would produce the following Java class: * The following schema would produce the following Java class:
* <pre> * <pre>{@code
* &lt;xs:complexType name="bar"&gt; * <xs:complexType name="bar">
* &lt;xs:complexContent&gt; * <xs:complexContent>
* &lt;xs:extension base="foo"&gt; * <xs:extension base="foo">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="c" type="xs:int" /&gt; * <xs:element name="c" type="xs:int" />
* &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt; * <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:extension&gt; * </xs:extension>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <pre> * <pre>
* class Bar extends Foo { * class Bar extends Foo {
@ -150,16 +150,16 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* *
* It can unmarshal instances like * It can unmarshal instances like
* *
* <pre> * <pre>{@code
* &lt;bar xmlns:e="extra"&gt; * <bar xmlns:e="extra">
* &lt;a&gt;1&lt;/a&gt; * <a>1</a>
* &lt;e:other /&gt; // this will be bound to DOM, because unmarshalling is orderless * <e:other /> // this will be bound to DOM, because unmarshalling is orderless
* &lt;b&gt;3&lt;/b&gt; * <b>3</b>
* &lt;e:other /&gt; * <e:other />
* &lt;c&gt;5&lt;/c&gt; // this now goes to Bar.c * <c>5</c> // this now goes to Bar.c
* &lt;e:other /&gt; // this will go to Foo.any * <e:other /> // this will go to Foo.any
* &lt;/bar&gt; * </bar>
* </pre> * }</pre>
* *
* *
* *
@ -171,15 +171,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* *
* <p> * <p>
* The following schema would produce the following Java class: * The following schema would produce the following Java class:
* <pre> * <pre>{@code
* &lt;xs:complexType name="foo"&gt; * <xs:complexType name="foo">
* &lt;xs:choice maxOccurs="unbounded" minOccurs="0"&gt; * <xs:choice maxOccurs="unbounded" minOccurs="0">
* &lt;xs:element name="a" type="xs:int" /&gt; * <xs:element name="a" type="xs:int" />
* &lt;xs:element name="b" type="xs:int" /&gt; * <xs:element name="b" type="xs:int" />
* &lt;xs:any namespace="##other" processContents="lax" /&gt; * <xs:any namespace="##other" processContents="lax" />
* &lt;/xs:choice&gt; * </xs:choice>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <pre> * <pre>
* class Foo { * class Foo {
@ -204,11 +204,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* It can unmarshal instances like * It can unmarshal instances like
* *
* <pre> * <pre>
* &lt;foo xmlns:e="extra"&gt; *{@code <foo xmlns:e="extra">}
* &lt;a&gt;1&lt;/a&gt; // this will unmarshal to a {@link JAXBElement} instance whose value is 1. *{@code <a>1</a>} // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
* &lt;e:other /&gt; // this will unmarshal to a DOM {@link Element}. *{@code <e:other />} // this will unmarshal to a DOM {@link Element}.
* &lt;b&gt;3&lt;/b&gt; // this will unmarshal to a {@link JAXBElement} instance whose value is 1. *{@code <b>3</b>} // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
* &lt;/foo&gt; *{@code </foo>}
* </pre> * </pre>
* *
* *
@ -225,11 +225,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* } * }
* </pre> * </pre>
* then the following document will unmarshal like this: * then the following document will unmarshal like this:
* <pre> * <pre>{@code
* &lt;foo&gt; * <foo>
* &lt;unknown /&gt; * <unknown />
* &lt;foo /&gt; * <foo />
* &lt;/foo&gt; * </foo>
* *
* Foo foo = unmarshal(); * Foo foo = unmarshal();
* // 1 for 'unknown', another for 'foo' * // 1 for 'unknown', another for 'foo'
@ -239,7 +239,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* // because of lax=true, the 'foo' element eagerly * // because of lax=true, the 'foo' element eagerly
* // unmarshals to a Foo object. * // unmarshals to a Foo object.
* assert foo.others[1] instanceof Foo; * assert foo.others[1] instanceof Foo;
* </pre> * }</pre>
* *
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
* @since 1.6, JAXB 2.0 * @since 1.6, JAXB 2.0

View File

@ -51,16 +51,16 @@ import java.lang.annotation.Target;
* } * }
* </pre> * </pre>
* The above code maps to the following XML: * The above code maps to the following XML:
* <pre> * <pre>{@code
* &lt;xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"&gt; * <xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd">
* &lt;xs:complexType&gt; * <xs:complexType>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="body" type="ref:swaRef" minOccurs="0" /&gt; * <xs:element name="body" type="ref:swaRef" minOccurs="0" />
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;xs:attribute name="data" type="ref:swaRef" use="optional" /&gt; * <xs:attribute name="data" type="ref:swaRef" use="optional" />
* &lt;/xs:complexType&gt; * </xs:complexType>
* &lt;/xs:element&gt; * </xs:element>
* </pre> * }</pre>
* *
* <p> * <p>
* The above binding supports WS-I AP 1.0 <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html#Referencing_Attachments_from_the_SOAP_Envelope">WS-I Attachments Profile Version 1.0.</a> * The above binding supports WS-I AP 1.0 <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html#Referencing_Attachments_from_the_SOAP_Envelope">WS-I Attachments Profile Version 1.0.</a>

View File

@ -89,14 +89,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* public java.math.BigDecimal getPrice() {...} ; * public java.math.BigDecimal getPrice() {...} ;
* public void setPrice(java.math.BigDecimal ) {...}; * public void setPrice(java.math.BigDecimal ) {...};
* } * }
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:complexType name="USPrice"&gt; * <xs:complexType name="USPrice">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;xs:attribute name="price" type="xs:decimal"/&gt; * <xs:attribute name="price" type="xs:decimal"/>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <p> <b>Example 2: </b>Map a JavaBean property to an XML attribute with anonymous type.</p> * <p> <b>Example 2: </b>Map a JavaBean property to an XML attribute with anonymous type.</p>
* See Example 7 in @{@link XmlType}. * See Example 7 in @{@link XmlType}.
@ -108,17 +109,18 @@ import static java.lang.annotation.RetentionPolicy.*;
* ... * ...
* &#64;XmlAttribute List&lt;Integer&gt; items; * &#64;XmlAttribute List&lt;Integer&gt; items;
* } * }
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:complexType name="foo"&gt; * <xs:complexType name="foo">
* ... * ...
* &lt;xs:attribute name="items"&gt; * <xs:attribute name="items">
* &lt;xs:simpleType&gt; * <xs:simpleType>
* &lt;xs:list itemType="xs:int"/&gt; * <xs:list itemType="xs:int"/>
* &lt;/xs:simpleType&gt; * </xs:simpleType>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* </pre> * }</pre>
* @author Sekhar Vajjhala, Sun Microsystems, Inc. * @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlType * @see XmlType
* @since 1.6, JAXB 2.0 * @since 1.6, JAXB 2.0

View File

@ -82,14 +82,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(name="itemprice") * &#64;XmlElement(name="itemprice")
* public java.math.BigDecimal price; * public java.math.BigDecimal price;
* } * }
* {@code
* *
* &lt;!-- Example: Local XML Schema element --&gt; * <!-- Example: Local XML Schema element -->
* &lt;xs:complexType name="USPrice"/&gt; * <xs:complexType name="USPrice"/>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="itemprice" type="xs:decimal" minOccurs="0"/&gt; * <xs:element name="itemprice" type="xs:decimal" minOccurs="0"/>
* &lt;/sequence&gt; * </sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* <p> * <p>
* *
* <b> Example 2: </b> Map a field to a nillable element. * <b> Example 2: </b> Map a field to a nillable element.
@ -100,14 +101,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(nillable=true) * &#64;XmlElement(nillable=true)
* public java.math.BigDecimal price; * public java.math.BigDecimal price;
* } * }
* {@code
* *
* &lt;!-- Example: Local XML Schema element --&gt; * <!-- Example: Local XML Schema element -->
* &lt;xs:complexType name="USPrice"&gt; * <xs:complexType name="USPrice">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="price" type="xs:decimal" nillable="true" minOccurs="0"/&gt; * <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="0"/>
* &lt;/sequence&gt; * </sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* <p> * <p>
* <b> Example 3: </b> Map a field to a nillable, required element. * <b> Example 3: </b> Map a field to a nillable, required element.
* <pre> * <pre>
@ -117,14 +119,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(nillable=true, required=true) * &#64;XmlElement(nillable=true, required=true)
* public java.math.BigDecimal price; * public java.math.BigDecimal price;
* } * }
* {@code
* *
* &lt;!-- Example: Local XML Schema element --&gt; * <!-- Example: Local XML Schema element -->
* &lt;xs:complexType name="USPrice"&gt; * <xs:complexType name="USPrice">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="price" type="xs:decimal" nillable="true" minOccurs="1"/&gt; * <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="1"/>
* &lt;/sequence&gt; * </sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <p> <b>Example 4: </b>Map a JavaBean property to an XML element * <p> <b>Example 4: </b>Map a JavaBean property to an XML element
* with anonymous type.</p> * with anonymous type.</p>
@ -179,7 +182,7 @@ public @interface XmlElement {
* the enclosing class. * the enclosing class.
* *
* <li> * <li>
* Otherwise &#39;&#39; (which produces unqualified element in the default * Otherwise {@literal ''} (which produces unqualified element in the default
* namespace. * namespace.
* </ol> * </ol>
*/ */

View File

@ -65,21 +65,22 @@ import static java.lang.annotation.ElementType.METHOD;
* JAXBElement&lt;String&gt; createFoo(String s) { ... } * JAXBElement&lt;String&gt; createFoo(String s) { ... }
* } * }
* </pre> * </pre>
* <pre> * <pre> {@code
* &lt;!-- XML input --&gt; *
* &lt;foo&gt;string&lt;/foo&gt; * <!-- XML input -->
* <foo>string</foo>
* *
* // Example: code fragment corresponding to XML input * // Example: code fragment corresponding to XML input
* JAXBElement&lt;String&gt; o = * JAXBElement<String> o =
* (JAXBElement&lt;String&gt;)unmarshaller.unmarshal(aboveDocument); * (JAXBElement<String>)unmarshaller.unmarshal(aboveDocument);
* // print JAXBElement instance to show values * // print JAXBElement instance to show values
* System.out.println(o.getName()); // prints "{}foo" * System.out.println(o.getName()); // prints "{}foo"
* System.out.println(o.getValue()); // prints "string" * System.out.println(o.getValue()); // prints "string"
* System.out.println(o.getValue().getClass()); // prints "java.lang.String" * System.out.println(o.getValue().getClass()); // prints "java.lang.String"
* *
* &lt;!-- Example: XML schema definition --&gt; * <!-- Example: XML schema definition -->
* &lt;xs:element name="foo" type="xs:string"/&gt; * <xs:element name="foo" type="xs:string"/>
* </pre> * }</pre>
* *
* <p><b>Example 2: </b> Element declaration with non local scope * <p><b>Example 2: </b> Element declaration with non local scope
* <p> * <p>
@ -90,18 +91,18 @@ import static java.lang.annotation.ElementType.METHOD;
* The following example may be replaced in a future revision of * The following example may be replaced in a future revision of
* this javadoc. * this javadoc.
* *
* <pre> * <pre>{@code
* &lt;!-- Example: XML schema definition --&gt; * <!-- Example: XML schema definition -->
* &lt;xs:schema&gt; * <xs:schema>
* &lt;xs:complexType name="pea"&gt; * <xs:complexType name="pea">
* &lt;xs:choice maxOccurs="unbounded"&gt; * <xs:choice maxOccurs="unbounded">
* &lt;xs:element name="foo" type="xs:string"/&gt; * <xs:element name="foo" type="xs:string"/>
* &lt;xs:element name="bar" type="xs:string"/&gt; * <xs:element name="bar" type="xs:string"/>
* &lt;/xs:choice&gt; * </xs:choice>
* &lt;/xs:complexType&gt; * </xs:complexType>
* &lt;xs:element name="foo" type="xs:int"/&gt; * <xs:element name="foo" type="xs:int"/>
* &lt;/xs:schema&gt; * </xs:schema>
* </pre> * }</pre>
* <pre> * <pre>
* // Example: expected default binding * // Example: expected default binding
* class Pea { * class Pea {

View File

@ -56,10 +56,10 @@ import static java.lang.annotation.ElementType.METHOD;
* support for substitution groups using an <i>element property</i>, * support for substitution groups using an <i>element property</i>,
* (section 5.5.5, "Element Property" of JAXB 2.0 specification). An * (section 5.5.5, "Element Property" of JAXB 2.0 specification). An
* element property method signature is of the form: * element property method signature is of the form:
* <pre> * <pre>{@code
* public void setTerm(JAXBElement&lt;? extends Operator&gt;); * public void setTerm(JAXBElement<? extends Operator>);
* public JAXBElement&lt;? extends Operator&gt; getTerm(); * public JAXBElement<? extends Operator> getTerm();
* </pre> * }</pre>
* <p> * <p>
* An element factory method annotated with {@link XmlElementDecl} is * An element factory method annotated with {@link XmlElementDecl} is
* used to create a <tt>JAXBElement</tt> instance, containing an XML * used to create a <tt>JAXBElement</tt> instance, containing an XML
@ -121,19 +121,20 @@ import static java.lang.annotation.ElementType.METHOD;
* class JavacTask extends Task { * class JavacTask extends Task {
* ... * ...
* } * }
* {@code
* *
* &lt;!-- XML Schema fragment --&gt; * <!-- XML Schema fragment -->
* &lt;xs:element name="target" type="Target"&gt; * <xs:element name="target" type="Target">
* &lt;xs:complexType name="Target"&gt; * <xs:complexType name="Target">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:choice maxOccurs="unbounded"&gt; * <xs:choice maxOccurs="unbounded">
* &lt;xs:element ref="jar"&gt; * <xs:element ref="jar">
* &lt;xs:element ref="javac"&gt; * <xs:element ref="javac">
* &lt;/xs:choice&gt; * </xs:choice>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* </pre> * }</pre>
* <p> * <p>
* Thus the following code fragment: * Thus the following code fragment:
* <pre> * <pre>
@ -143,16 +144,16 @@ import static java.lang.annotation.ElementType.METHOD;
* marshal(target); * marshal(target);
* </pre> * </pre>
* will produce the following XML output: * will produce the following XML output:
* <pre> * <pre>{@code
* &lt;target&gt; * <target>
* &lt;jar&gt; * <jar>
* .... * ....
* &lt;/jar&gt; * </jar>
* &lt;javac&gt; * <javac>
* .... * ....
* &lt;/javac&gt; * </javac>
* &lt;/target&gt; * </target>
* </pre> * }</pre>
* <p> * <p>
* It is not an error to have a class that extends <tt>Task</tt> * It is not an error to have a class that extends <tt>Task</tt>
* that doesn't have {@link XmlRootElement}. But they can't show up in an * that doesn't have {@link XmlRootElement}. But they can't show up in an
@ -207,11 +208,11 @@ import static java.lang.annotation.ElementType.METHOD;
* marshal(m); * marshal(m);
* </pre> * </pre>
* will produce the following XML output: * will produce the following XML output:
* <pre> * <pre>{@code
* &lt;math&gt; * <math>
* &lt;add&gt;...&lt;/add&gt; * <add>...</add>
* &lt;/math&gt; * </math>
* </pre> * }</pre>
* *
* *
* @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems,Inc. </li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul> * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems,Inc. </li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>

View File

@ -39,21 +39,21 @@ import java.lang.annotation.Target;
* XML element around collections. The annotation therefore supports * XML element around collections. The annotation therefore supports
* two forms of serialization shown below. * two forms of serialization shown below.
* *
* <pre> * <pre>{@code
* //Example: code fragment * //Example: code fragment
* int[] names; * int[] names;
* *
* // XML Serialization Form 1 (Unwrapped collection) * // XML Serialization Form 1 (Unwrapped collection)
* &lt;names&gt; ... &lt;/names&gt; * <names> ... </names>
* &lt;names&gt; ... &lt;/names&gt; * <names> ... </names>
* *
* // XML Serialization Form 2 ( Wrapped collection ) * // XML Serialization Form 2 ( Wrapped collection )
* &lt;wrapperElement&gt; * <wrapperElement>
* &lt;names&gt; value-of-item &lt;/names&gt; * <names> value-of-item </names>
* &lt;names&gt; value-of-item &lt;/names&gt; * <names> value-of-item </names>
* .... * ....
* &lt;/wrapperElement&gt; * </wrapperElement>
* </pre> * }</pre>
* *
* <p> The two serialized XML forms allow a null collection to be * <p> The two serialized XML forms allow a null collection to be
* represented either by absence or presence of an element with a * represented either by absence or presence of an element with a

View File

@ -44,7 +44,7 @@ import java.lang.annotation.Target;
* &#64;XmlElements({ @XmlElement(...),@XmlElement(...) }) * &#64;XmlElements({ @XmlElement(...),@XmlElement(...) })
* </pre> * </pre>
* *
* <p>The <tt>@XmlElements</tt> annnotation can be used with the * <p>The <tt>@XmlElements</tt> annotation can be used with the
* following program elements: </p> * following program elements: </p>
* <ul> * <ul>
* <li> a JavaBean property </li> * <li> a JavaBean property </li>
@ -78,28 +78,29 @@ import java.lang.annotation.Target;
* &#64;XmlElements( * &#64;XmlElements(
* &#64;XmlElement(name="A", type=Integer.class), * &#64;XmlElement(name="A", type=Integer.class),
* &#64;XmlElement(name="B", type=Float.class) * &#64;XmlElement(name="B", type=Float.class)
* } * )
* public List items; * public List items;
* } * }
* {@code
* *
* &lt;!-- XML Representation for a List of {1,2.5} * <!-- XML Representation for a List of {1,2.5}
* XML output is not wrapped using another element --&gt; * XML output is not wrapped using another element -->
* ... * ...
* &lt;A&gt; 1 &lt;/A&gt; * <A> 1 </A>
* &lt;B&gt; 2.5 &lt;/B&gt; * <B> 2.5 </B>
* ... * ...
* *
* &lt;!-- XML Schema fragment --&gt; * <!-- XML Schema fragment -->
* &lt;xs:complexType name="Foo"&gt; * <xs:complexType name="Foo">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt; * <xs:choice minOccurs="0" maxOccurs="unbounded">
* &lt;xs:element name="A" type="xs:int"/&gt; * <xs:element name="A" type="xs:int"/>
* &lt;xs:element name="B" type="xs:float"/&gt; * <xs:element name="B" type="xs:float"/>
* &lt;xs:choice&gt; * <xs:choice>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* </pre> * }</pre>
* *
* <p><b>Example 2:</b> Map to a list of elements wrapped with another element * <p><b>Example 2:</b> Map to a list of elements wrapped with another element
* </p> * </p>
@ -114,21 +115,22 @@ import java.lang.annotation.Target;
* } * }
* public List items; * public List items;
* } * }
* {@code
* *
* &lt;!-- XML Schema fragment --&gt; * <!-- XML Schema fragment -->
* &lt;xs:complexType name="Foo"&gt; * <xs:complexType name="Foo">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="bar"&gt; * <xs:element name="bar">
* &lt;xs:complexType&gt; * <xs:complexType>
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt; * <xs:choice minOccurs="0" maxOccurs="unbounded">
* &lt;xs:element name="A" type="xs:int"/&gt; * <xs:element name="A" type="xs:int"/>
* &lt;xs:element name="B" type="xs:float"/&gt; * <xs:element name="B" type="xs:float"/>
* &lt;/xs:choice&gt; * </xs:choice>
* &lt;/xs:complexType&gt; * </xs:complexType>
* &lt;/xs:element&gt; * </xs:element>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <p><b>Example 3:</b> Change element name based on type using an adapter. * <p><b>Example 3:</b> Change element name based on type using an adapter.
* </p> * </p>
@ -145,21 +147,22 @@ import java.lang.annotation.Target;
* &#64;XmlType abstract class P {...} * &#64;XmlType abstract class P {...}
* &#64;XmlType(name="PX") class PX extends P {...} * &#64;XmlType(name="PX") class PX extends P {...}
* &#64;XmlType(name="PY") class PY extends P {...} * &#64;XmlType(name="PY") class PY extends P {...}
* {@code
* *
* &lt;!-- XML Schema fragment --&gt; * <!-- XML Schema fragment -->
* &lt;xs:complexType name="Foo"&gt; * <xs:complexType name="Foo">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="bar"&gt; * <xs:element name="bar">
* &lt;xs:complexType&gt; * <xs:complexType>
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt; * <xs:choice minOccurs="0" maxOccurs="unbounded">
* &lt;xs:element name="A" type="PX"/&gt; * <xs:element name="A" type="PX"/>
* &lt;xs:element name="B" type="PY"/&gt; * <xs:element name="B" type="PY"/>
* &lt;/xs:choice&gt; * </xs:choice>
* &lt;/xs:complexType&gt; * </xs:complexType>
* &lt;/xs:element&gt; * </xs:element>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul> * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>
* @see XmlElement * @see XmlElement

View File

@ -56,23 +56,24 @@ import static java.lang.annotation.ElementType.FIELD;
* <p> In the absence of this annotation, {@link Enum#name()} is used * <p> In the absence of this annotation, {@link Enum#name()} is used
* as the XML representation. * as the XML representation.
* *
* <p> <b>Example 1: </b>Map enum constant name -&gt; enumeration facet</p> * <p> <b>Example 1: </b>Map enum constant name {@literal ->} enumeration facet</p>
* <pre> * <pre>
* //Example: Code fragment * //Example: Code fragment
* &#64;XmlEnum(String.class) * &#64;XmlEnum(String.class)
* public enum Card { CLUBS, DIAMONDS, HEARTS, SPADES } * public enum Card { CLUBS, DIAMONDS, HEARTS, SPADES }
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:simpleType name="Card"&gt; * <xs:simpleType name="Card">
* &lt;xs:restriction base="xs:string"/&gt; * <xs:restriction base="xs:string"/>
* &lt;xs:enumeration value="CLUBS"/&gt; * <xs:enumeration value="CLUBS"/>
* &lt;xs:enumeration value="DIAMONDS"/&gt; * <xs:enumeration value="DIAMONDS"/>
* &lt;xs:enumeration value="HEARTS"/&gt; * <xs:enumeration value="HEARTS"/>
* &lt;xs:enumeration value="SPADES"/&gt; * <xs:enumeration value="SPADES"/>
* &lt;/xs:simpleType&gt; * </xs:simpleType>
* </pre> * }</pre>
* *
* <p><b>Example 2: </b>Map enum constant name(value) -&gt; enumeration facet </p> * <p><b>Example 2: </b>Map enum constant name(value) {@literal ->} enumeration facet </p>
* <pre> * <pre>
* //Example: code fragment * //Example: code fragment
* &#64;XmlType * &#64;XmlType
@ -82,19 +83,20 @@ import static java.lang.annotation.ElementType.FIELD;
* &#64;XmlEnumValue("5") NICKEL(5), * &#64;XmlEnumValue("5") NICKEL(5),
* &#64;XmlEnumValue("10") DIME(10), * &#64;XmlEnumValue("10") DIME(10),
* &#64;XmlEnumValue("25") QUARTER(25) } * &#64;XmlEnumValue("25") QUARTER(25) }
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:simpleType name="Coin"&gt; * <xs:simpleType name="Coin">
* &lt;xs:restriction base="xs:int"&gt; * <xs:restriction base="xs:int">
* &lt;xs:enumeration value="1"/&gt; * <xs:enumeration value="1"/>
* &lt;xs:enumeration value="5"/&gt; * <xs:enumeration value="5"/>
* &lt;xs:enumeration value="10"/&gt; * <xs:enumeration value="10"/>
* &lt;xs:enumeration value="25"/&gt; * <xs:enumeration value="25"/>
* &lt;/xs:restriction&gt; * </xs:restriction>
* &lt;/xs:simpleType&gt; * </xs:simpleType>
* </pre> * }</pre>
* *
* <p><b>Example 3: </b>Map enum constant name -&gt; enumeration facet </p> * <p><b>Example 3: </b>Map enum constant name {@literal ->} enumeration facet </p>
* *
* <pre> * <pre>
* //Code fragment * //Code fragment
@ -104,15 +106,16 @@ import static java.lang.annotation.ElementType.FIELD;
* &#64;XmlEnumValue("1") ONE, * &#64;XmlEnumValue("1") ONE,
* &#64;XmlEnumValue("2") TWO; * &#64;XmlEnumValue("2") TWO;
* } * }
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:simpleType name="Code"&gt; * <xs:simpleType name="Code">
* &lt;xs:restriction base="xs:int"&gt; * <xs:restriction base="xs:int">
* &lt;xs:enumeration value="1"/&gt; * <xs:enumeration value="1"/>
* &lt;xs:enumeration value="2"/&gt; * <xs:enumeration value="2"/>
* &lt;/xs:restriction&gt; * </xs:restriction>
* &lt;/xs:simpleType&gt; * </xs:simpleType>
* </pre> * }</pre>
* *
* @since 1.6, JAXB 2.0 * @since 1.6, JAXB 2.0
*/ */

View File

@ -73,17 +73,18 @@ import static java.lang.annotation.RetentionPolicy.*;
* public void setCustomerID(String id); * public void setCustomerID(String id);
* .... other properties not shown * .... other properties not shown
* } * }
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:complexType name="Customer"&gt; * <xs:complexType name="Customer">
* &lt;xs:complexContent&gt; * <xs:complexContent>
* &lt;xs:sequence&gt; * <xs:sequence>
* .... * ....
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;xs:attribute name="customerID" type="xs:ID"/&gt; * <xs:attribute name="customerID" type="xs:ID"/>
* &lt;/xs:complexContent&gt; * </xs:complexContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* @author Sekhar Vajjhala, Sun Microsystems, Inc. * @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlIDREF * @see XmlIDREF

View File

@ -37,7 +37,7 @@ import static java.lang.annotation.RetentionPolicy.*;
* <p> * <p>
* To preserve referential integrity of an object graph across XML * To preserve referential integrity of an object graph across XML
* serialization followed by a XML deserialization, requires an object * serialization followed by a XML deserialization, requires an object
* reference to be marshalled by reference or containment * reference to be marshaled by reference or containment
* appropriately. Annotations <tt>&#64;XmlID</tt> and <tt>&#64;XmlIDREF</tt> * appropriately. Annotations <tt>&#64;XmlID</tt> and <tt>&#64;XmlIDREF</tt>
* together allow a customized mapping of a JavaBean property's * together allow a customized mapping of a JavaBean property's
* type by containment or reference. * type by containment or reference.
@ -82,18 +82,19 @@ import static java.lang.annotation.RetentionPolicy.*;
* public void setCustomer(Customer customer); * public void setCustomer(Customer customer);
* .... * ....
* } * }
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:complexType name="Shipping"&gt; * <xs:complexType name="Shipping">
* &lt;xs:complexContent&gt; * <xs:complexContent>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="customer" type="xs:IDREF"/&gt; * <xs:element name="customer" type="xs:IDREF"/>
* .... * ....
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexContent&gt; * </xs:complexContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* </pre> * }</pre>
* *
* *
* <p><b>Example 2: </b> The following is a complete example of * <p><b>Example 2: </b> The following is a complete example of
@ -142,64 +143,65 @@ import static java.lang.annotation.RetentionPolicy.*;
* // maps reference to Invoice by containment by default. * // maps reference to Invoice by containment by default.
* public Invoice getInvoice(); * public Invoice getInvoice();
* } * }
* {@code
* *
* &lt;!-- XML Schema mapping for above code frament --&gt; * <!-- XML Schema mapping for above code frament -->
* *
* &lt;xs:complexType name="Invoice"&gt; * <xs:complexType name="Invoice">
* &lt;xs:complexContent&gt; * <xs:complexContent>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="customer" type="xs:IDREF"/&gt; * <xs:element name="customer" type="xs:IDREF"/>
* .... * ....
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexContent&gt; * </xs:complexContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* &lt;xs:complexType name="Shipping"&gt; * <xs:complexType name="Shipping">
* &lt;xs:complexContent&gt; * <xs:complexContent>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="customer" type="xs:IDREF"/&gt; * <xs:element name="customer" type="xs:IDREF"/>
* .... * ....
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexContent&gt; * </xs:complexContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* &lt;xs:complexType name="Customer"&gt; * <xs:complexType name="Customer">
* &lt;xs:complexContent&gt; * <xs:complexContent>
* &lt;xs:sequence&gt; * <xs:sequence>
* .... * ....
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;xs:attribute name="CustomerID" type="xs:ID"/&gt; * <xs:attribute name="CustomerID" type="xs:ID"/>
* &lt;/xs:complexContent&gt; * </xs:complexContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* &lt;xs:complexType name="CustomerData"&gt; * <xs:complexType name="CustomerData">
* &lt;xs:complexContent&gt; * <xs:complexContent>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="customer" type="xs:Customer"/&gt; * <xs:element name="customer" type="xs:Customer"/>
* &lt;xs:element name="shipping" type="xs:Shipping"/&gt; * <xs:element name="shipping" type="xs:Shipping"/>
* &lt;xs:element name="invoice" type="xs:Invoice"/&gt; * <xs:element name="invoice" type="xs:Invoice"/>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexContent&gt; * </xs:complexContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* &lt;xs:element name"customerData" type="xs:CustomerData"/&gt; * <xs:element name"customerData" type="xs:CustomerData"/>
* *
* &lt;!-- Instance document conforming to the above XML Schema --&gt; * <!-- Instance document conforming to the above XML Schema -->
* &lt;customerData&gt; * <customerData>
* &lt;customer customerID="Alice"&gt; * <customer customerID="Alice">
* .... * ....
* &lt;/customer&gt; * </customer>
* *
* &lt;shipping customer="Alice"&gt; * <shipping customer="Alice">
* .... * ....
* &lt;/shipping&gt; * </shipping>
* *
* &lt;invoice customer="Alice"&gt; * <invoice customer="Alice">
* .... * ....
* &lt;/invoice&gt; * </invoice>
* &lt;/customerData&gt; * </customerData>
* *
* </pre> * }</pre>
* *
* <p><b>Example 3: </b> Mapping List to repeating element of type IDREF * <p><b>Example 3: </b> Mapping List to repeating element of type IDREF
* <pre> * <pre>
@ -209,16 +211,17 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(name="Alice") * &#64;XmlElement(name="Alice")
* public List customers; * public List customers;
* } * }
* {@code
* *
* &lt;!-- XML schema fragment --&gt; * <!-- XML schema fragment -->
* &lt;xs:complexType name="Shipping"&gt; * <xs:complexType name="Shipping">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt; * <xs:choice minOccurs="0" maxOccurs="unbounded">
* &lt;xs:element name="Alice" type="xs:IDREF"/&gt; * <xs:element name="Alice" type="xs:IDREF"/>
* &lt;/xs:choice&gt; * </xs:choice>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <p><b>Example 4: </b> Mapping a List to a list of elements of type IDREF. * <p><b>Example 4: </b> Mapping a List to a list of elements of type IDREF.
* <pre> * <pre>
@ -230,17 +233,18 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(name="John", type="InternationalCustomer.class") * &#64;XmlElement(name="John", type="InternationalCustomer.class")
* public List customers; * public List customers;
* } * }
* {@code
* *
* &lt;!-- XML Schema fragment --&gt; * <!-- XML Schema fragment -->
* &lt;xs:complexType name="Shipping"&gt; * <xs:complexType name="Shipping">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt; * <xs:choice minOccurs="0" maxOccurs="unbounded">
* &lt;xs:element name="Alice" type="xs:IDREF"/&gt; * <xs:element name="Alice" type="xs:IDREF"/>
* &lt;xs:element name="John" type="xs:IDREF"/&gt; * <xs:element name="John" type="xs:IDREF"/>
* &lt;/xs:choice&gt; * </xs:choice>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* @author Sekhar Vajjhala, Sun Microsystems, Inc. * @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlID * @see XmlID
* @since 1.6, JAXB 2.0 * @since 1.6, JAXB 2.0

View File

@ -59,12 +59,12 @@ import static java.lang.annotation.ElementType.PARAMETER;
* *
* would produce XML like this: * would produce XML like this:
* *
* <pre> * <pre>{@code
* &lt;foo&gt; * <foo>
* &lt;data&gt;abc&lt;/data&gt; * <data>abc</data>
* &lt;data&gt;def&lt;/data&gt; * <data>def</data>
* &lt;/foo&gt; * </foo>
* </pre> * }</pre>
* *
* &#64;XmlList annotation, on the other hand, allows multiple values to be * &#64;XmlList annotation, on the other hand, allows multiple values to be
* represented as whitespace-separated tokens in a single element. For example, * represented as whitespace-separated tokens in a single element. For example,
@ -80,11 +80,11 @@ import static java.lang.annotation.ElementType.PARAMETER;
* *
* the above code will produce XML like this: * the above code will produce XML like this:
* *
* <pre> * <pre>{@code
* &lt;foo&gt; * <foo>
* &lt;data&gt;abc def&lt;/data&gt; * <data>abc def</data>
* &lt;/foo&gt; * </foo>
* </pre> * }</pre>
* *
* <p>This annotation can be used with the following annotations: * <p>This annotation can be used with the following annotations:
* {@link XmlElement}, * {@link XmlElement},

View File

@ -56,32 +56,33 @@ import javax.xml.bind.JAXBElement;
* </ul> * </ul>
* *
* Below is an example of binding and creation of mixed content. * Below is an example of binding and creation of mixed content.
* <pre> * <pre>{@code
* &lt;!-- schema fragment having mixed content --&gt; *
* &lt;xs:complexType name="letterBody" mixed="true"&gt; * <!-- schema fragment having mixed content -->
* &lt;xs:sequence&gt; * <xs:complexType name="letterBody" mixed="true">
* &lt;xs:element name="name" type="xs:string"/&gt; * <xs:sequence>
* &lt;xs:element name="quantity" type="xs:positiveInteger"/&gt; * <xs:element name="name" type="xs:string"/>
* &lt;xs:element name="productName" type="xs:string"/&gt; * <xs:element name="quantity" type="xs:positiveInteger"/>
* &lt;!-- etc. --&gt; * <xs:element name="productName" type="xs:string"/>
* &lt;/xs:sequence&gt; * <!-- etc. -->
* &lt;/xs:complexType&gt; * </xs:sequence>
* &lt;xs:element name="letterBody" type="letterBody"/&gt; * </xs:complexType>
* <xs:element name="letterBody" type="letterBody"/>
* *
* // Schema-derived Java code: * // Schema-derived Java code:
* // (Only annotations relevant to mixed content are shown below, * // (Only annotations relevant to mixed content are shown below,
* // others are ommitted.) * // others are omitted.)
* import java.math.BigInteger; * import java.math.BigInteger;
* public class ObjectFactory { * public class ObjectFactory {
* // element instance factories * // element instance factories
* JAXBElement&lt;LetterBody&gt; createLetterBody(LetterBody value); * JAXBElement<LetterBody> createLetterBody(LetterBody value);
* JAXBElement&lt;String&gt; createLetterBodyName(String value); * JAXBElement<String> createLetterBodyName(String value);
* JAXBElement&lt;BigInteger&gt; createLetterBodyQuantity(BigInteger value); * JAXBElement<BigInteger> createLetterBodyQuantity(BigInteger value);
* JAXBElement&lt;String&gt; createLetterBodyProductName(String value); * JAXBElement<String> createLetterBodyProductName(String value);
* // type instance factory * // type instance factory
* LetterBody createLetterBody(); * LetterBody createLetterBody();
* } * }
* </pre> * }</pre>
* <pre> * <pre>
* public class LetterBody { * public class LetterBody {
* // Mixed content can contain instances of Element classes * // Mixed content can contain instances of Element classes
@ -96,17 +97,17 @@ import javax.xml.bind.JAXBElement;
* } * }
* </pre> * </pre>
* The following is an XML instance document with mixed content * The following is an XML instance document with mixed content
* <pre> * <pre>{@code
* &lt;letterBody&gt; * <letterBody>
* Dear Mr.&lt;name&gt;Robert Smith&lt;/name&gt; * Dear Mr.<name>Robert Smith</name>
* Your order of &lt;quantity&gt;1&lt;/quantity&gt; &lt;productName&gt;Baby * Your order of <quantity>1</quantity> <productName>Baby
* Monitor&lt;/productName&gt; shipped from our warehouse. .... * Monitor</productName> shipped from our warehouse. ....
* &lt;/letterBody&gt; * </letterBody>
* </pre> * }</pre>
* that can be constructed using following JAXB API calls. * that can be constructed using following JAXB API calls.
* <pre> * <pre>{@code
* LetterBody lb = ObjectFactory.createLetterBody(); * LetterBody lb = ObjectFactory.createLetterBody();
* JAXBElement&lt;LetterBody&gt; lbe = ObjectFactory.createLetterBody(lb); * JAXBElement<LetterBody> lbe = ObjectFactory.createLetterBody(lb);
* List gcl = lb.getContent(); //add mixed content to general content property. * List gcl = lb.getContent(); //add mixed content to general content property.
* gcl.add("Dear Mr."); // add text information item as a String. * gcl.add("Dear Mr."); // add text information item as a String.
* *
@ -119,7 +120,7 @@ import javax.xml.bind.JAXBElement;
* createLetterBodyQuantity(new BigInteger("1"))); * createLetterBodyQuantity(new BigInteger("1")));
* gcl.add(ObjectFactory.createLetterBodyProductName("Baby Monitor")); * gcl.add(ObjectFactory.createLetterBodyProductName("Baby Monitor"));
* gcl.add("shipped from our warehouse"); // add text information item * gcl.add("shipped from our warehouse"); // add text information item
* </pre> * }</pre>
* *
* <p>See "Package Specification" in javax.xml.bind.package javadoc for * <p>See "Package Specification" in javax.xml.bind.package javadoc for
* additional common information.</p> * additional common information.</p>

View File

@ -73,28 +73,30 @@ import static java.lang.annotation.ElementType.TYPE;
* marshal( new Point(3,5), System.out); * marshal( new Point(3,5), System.out);
* </pre> * </pre>
* *
* <pre> * <pre>{@code
* &lt;!-- Example: XML output --&gt; *
* &lt;point&gt; * <!-- Example: XML output -->
* &lt;x&gt; 3 &lt;/x&gt; * <point>
* &lt;y&gt; 5 &lt;/y&gt; * <x> 3 </x>
* &lt;/point&gt; * <y> 5 </y>
* </pre> * </point>
* }</pre>
* *
* The annotation causes an global element declaration to be produced * The annotation causes an global element declaration to be produced
* in the schema. The global element declaration is associated with * in the schema. The global element declaration is associated with
* the XML schema type to which the class is mapped. * the XML schema type to which the class is mapped.
* *
* <pre> * <pre>{@code
* &lt;!-- Example: XML schema definition --&gt; *
* &lt;xs:element name="point" type="point"/&gt; * <!-- Example: XML schema definition -->
* &lt;xs:complexType name="point"&gt; * <xs:element name="point" type="point"/>
* &lt;xs:sequence&gt; * <xs:complexType name="point">
* &lt;xs:element name="x" type="xs:int"/&gt; * <xs:sequence>
* &lt;xs:element name="y" type="xs:int"/&gt; * <xs:element name="x" type="xs:int"/>
* &lt;/xs:sequence&gt; * <xs:element name="y" type="xs:int"/>
* &lt;/xs:complexType&gt; * </xs:sequence>
* </pre> * </xs:complexType>
* }</pre>
* *
* <p> * <p>
* *
@ -113,27 +115,28 @@ import static java.lang.annotation.ElementType.TYPE;
* *
* //Example: Code fragment corresponding to XML output * * //Example: Code fragment corresponding to XML output *
* marshal( new Point3D(3,5,0), System.out ); * marshal( new Point3D(3,5,0), System.out );
* {@code
* *
* &lt;!-- Example: XML output --&gt; * <!-- Example: XML output -->
* &lt;!-- The element name is point3D not point --&gt; * <!-- The element name is point3D not point -->
* &lt;point3D&gt; * <point3D>
* &lt;x&gt;3&lt;/x&gt; * <x>3</x>
* &lt;y&gt;5&lt;/y&gt; * <y>5</y>
* &lt;z&gt;0&lt;/z&gt; * <z>0</z>
* &lt;/point3D&gt; * </point3D>
* *
* &lt;!-- Example: XML schema definition --&gt; * <!-- Example: XML schema definition -->
* &lt;xs:element name="point3D" type="point3D"/&gt; * <xs:element name="point3D" type="point3D"/>
* &lt;xs:complexType name="point3D"&gt; * <xs:complexType name="point3D">
* &lt;xs:complexContent&gt; * <xs:complexContent>
* &lt;xs:extension base="point"&gt; * <xs:extension base="point">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="z" type="xs:int"/&gt; * <xs:element name="z" type="xs:int"/>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:extension&gt; * </xs:extension>
* &lt;/xs:complexContent&gt; * </xs:complexContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <b>Example 3: </b> Associate a global element with XML Schema type * <b>Example 3: </b> Associate a global element with XML Schema type
* to which the class is mapped. * to which the class is mapped.
@ -144,15 +147,16 @@ import static java.lang.annotation.ElementType.TYPE;
* &#64;XmlElement * &#64;XmlElement
* public java.math.BigDecimal price; * public java.math.BigDecimal price;
* } * }
* {@code
* *
* &lt;!-- Example: XML schema definition --&gt; * <!-- Example: XML schema definition -->
* &lt;xs:element name="PriceElement" type="USPrice"/&gt; * <xs:element name="PriceElement" type="USPrice"/>
* &lt;xs:complexType name="USPrice"&gt; * <xs:complexType name="USPrice">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="price" type="xs:decimal"/&gt; * <xs:element name="price" type="xs:decimal"/>
* &lt;/sequence&gt; * </sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* @author Sekhar Vajjhala, Sun Microsystems, Inc. * @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @since 1.6, JAXB 2.0 * @since 1.6, JAXB 2.0

View File

@ -63,16 +63,17 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;javax.xml.bind.annotation.XmlSchema ( * &#64;javax.xml.bind.annotation.XmlSchema (
* namespace = "http://www.example.com/MYPO1" * namespace = "http://www.example.com/MYPO1"
* ) * )
* {@code
* *
* &lt;!-- XML Schema fragment --&gt; * <!-- XML Schema fragment -->
* &lt;schema * <schema
* xmlns=... * xmlns=...
* xmlns:po=.... * xmlns:po=....
* targetNamespace="http://www.example.com/MYPO1" * targetNamespace="http://www.example.com/MYPO1"
* &gt; * >
* &lt;!-- prefixes generated by default are implementation * <!-- prefixes generated by default are implementation
* depedenent --&gt; * depedenent -->
* </pre> * }</pre>
* *
* <p><b>Example 2:</b> Customize namespace prefix, namespace URI * <p><b>Example 2:</b> Customize namespace prefix, namespace URI
* mapping</p> * mapping</p>
@ -86,16 +87,17 @@ import static java.lang.annotation.RetentionPolicy.*;
* *
* &#64;javax.xml.bind.annotation.XmlNs(prefix="xs", * &#64;javax.xml.bind.annotation.XmlNs(prefix="xs",
* namespaceURI="http://www.w3.org/2001/XMLSchema") * namespaceURI="http://www.w3.org/2001/XMLSchema")
* ) * }
* ) * )
* {@code
* *
* &lt;!-- XML Schema fragment --&gt; * <!-- XML Schema fragment -->
* &lt;schema * <schema
* xmlns:xs="http://www.w3.org/2001/XMLSchema" * xmlns:xs="http://www.w3.org/2001/XMLSchema"
* xmlns:po="http://www.example.com/PO1" * xmlns:po="http://www.example.com/PO1"
* targetNamespace="http://www.example.com/PO1"&gt; * targetNamespace="http://www.example.com/PO1">
* *
* </pre> * }</pre>
* *
* <p><b>Example 3:</b> Customize elementFormDefault</p> * <p><b>Example 3:</b> Customize elementFormDefault</p>
* <pre> * <pre>
@ -103,14 +105,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* elementFormDefault=XmlNsForm.UNQUALIFIED * elementFormDefault=XmlNsForm.UNQUALIFIED
* ... * ...
* ) * )
* {@code
* *
* &lt;!-- XML Schema fragment --&gt; * <!-- XML Schema fragment -->
* &lt;schema * <schema
* xmlns="http://www.w3.org/2001/XMLSchema" * xmlns="http://www.w3.org/2001/XMLSchema"
* xmlns:po="http://www.example.com/PO1" * xmlns:po="http://www.example.com/PO1"
* elementFormDefault="unqualified"&gt; * elementFormDefault="unqualified">
* *
* </pre> * }</pre>
* @author Sekhar Vajjhala, Sun Microsystems, Inc. * @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @since 1.6, JAXB 2.0 * @since 1.6, JAXB 2.0

View File

@ -65,14 +65,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* &#64;XmlSchemaType(name="date") * &#64;XmlSchemaType(name="date")
* public XMLGregorianCalendar date; * public XMLGregorianCalendar date;
* } * }
* {@code
* *
* &lt;!-- Example: Local XML Schema element --&gt; * <!-- Example: Local XML Schema element -->
* &lt;xs:complexType name="USPrice"/&gt; * <xs:complexType name="USPrice"/>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="date" type="xs:date"/&gt; * <xs:element name="date" type="xs:date"/>
* &lt;/sequence&gt; * </sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <p> <b> Example 2: </b> Customize mapping of XMLGregorianCalendar at package * <p> <b> Example 2: </b> Customize mapping of XMLGregorianCalendar at package
* level </p> * level </p>

View File

@ -78,14 +78,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* String setName() {..}; * String setName() {..};
* } * }
* *
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:complexType name="USAddress"&gt; * <xs:complexType name="USAddress">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="name" type="xs:string"/&gt; * <xs:element name="name" type="xs:string"/>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* @author Sekhar Vajjhala, Sun Microsystems, Inc. * @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @since 1.6, JAXB 2.0 * @since 1.6, JAXB 2.0

View File

@ -112,7 +112,7 @@ import java.lang.annotation.Target;
* The following table shows the mapping of the class to a XML Schema * The following table shows the mapping of the class to a XML Schema
* complex type or simple type. The notational symbols used in the table are: * complex type or simple type. The notational symbols used in the table are:
* <ul> * <ul>
* <li> -&gt; : represents a mapping </li> * <li> {@literal ->} : represents a mapping </li>
* <li> [x]+ : one or more occurances of x </li> * <li> [x]+ : one or more occurances of x </li>
* <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with * <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with
* <tt>@XmlValue</tt></li> * <tt>@XmlValue</tt></li>
@ -132,7 +132,7 @@ import java.lang.annotation.Target;
* <tr valign="top"> * <tr valign="top">
* <td>Class</td> * <td>Class</td>
* <td>{}</td> * <td>{}</td>
* <td>[property]+ -&gt; elements</td> * <td>[property]+ {@literal ->} elements</td>
* <td>complexcontent<br>xs:all</td> * <td>complexcontent<br>xs:all</td>
* <td> </td> * <td> </td>
* </tr> * </tr>
@ -140,7 +140,7 @@ import java.lang.annotation.Target;
* <tr valign="top"> * <tr valign="top">
* <td>Class</td> * <td>Class</td>
* <td>non empty</td> * <td>non empty</td>
* <td>[property]+ -&gt; elements</td> * <td>[property]+ {@literal ->} elements</td>
* <td>complexcontent<br>xs:sequence</td> * <td>complexcontent<br>xs:sequence</td>
* <td> </td> * <td> </td>
* </tr> * </tr>
@ -148,7 +148,7 @@ import java.lang.annotation.Target;
* <tr valign="top"> * <tr valign="top">
* <td>Class</td> * <td>Class</td>
* <td>X</td> * <td>X</td>
* <td>no property -&gt; element</td> * <td>no property {@literal ->} element</td>
* <td>complexcontent<br>empty sequence</td> * <td>complexcontent<br>empty sequence</td>
* <td> </td> * <td> </td>
* </tr> * </tr>
@ -156,7 +156,7 @@ import java.lang.annotation.Target;
* <tr valign="top"> * <tr valign="top">
* <td>Class</td> * <td>Class</td>
* <td>X</td> * <td>X</td>
* <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ -&gt; attributes</td> * <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ {@literal ->} attributes</td>
* <td>simplecontent</td> * <td>simplecontent</td>
* <td> </td> * <td> </td>
* </tr> * </tr>
@ -164,7 +164,7 @@ import java.lang.annotation.Target;
* <tr valign="top"> * <tr valign="top">
* <td>Class</td> * <td>Class</td>
* <td>X</td> * <td>X</td>
* <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties -&gt; attribute</td> * <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties {@literal ->} attribute</td>
* <td> </td> * <td> </td>
* <td>simpletype</td> * <td>simpletype</td>
* </tr> * </tr>
@ -208,35 +208,37 @@ import java.lang.annotation.Target;
* java.math.BigDecimal getZip() {..}; * java.math.BigDecimal getZip() {..};
* void setZip(java.math.BigDecimal) {..}; * void setZip(java.math.BigDecimal) {..};
* } * }
* {@code
* *
* &lt;!-- XML Schema mapping for USAddress --&gt; * <!-- XML Schema mapping for USAddress -->
* &lt;xs:complexType name="USAddress"&gt; * <xs:complexType name="USAddress">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="street" type="xs:string"/&gt; * <xs:element name="street" type="xs:string"/>
* &lt;xs:element name="city" type="xs:string"/&gt; * <xs:element name="city" type="xs:string"/>
* &lt;xs:element name="state" type="xs:string"/&gt; * <xs:element name="state" type="xs:string"/>
* &lt;xs:element name="zip" type="xs:decimal"/&gt; * <xs:element name="zip" type="xs:decimal"/>
* &lt;xs:element name="name" type="xs:string"/&gt; * <xs:element name="name" type="xs:string"/>
* &lt;/xs:all&gt; * </xs:all>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* <p> <b> Example 2: </b> Map a class to a complex type with * <p> <b> Example 2: </b> Map a class to a complex type with
* xs:all </p> * xs:all </p>
* <pre> * <pre>
* &#64;XmlType(propOrder={}) * &#64;XmlType(propOrder={})
* public class USAddress { ...} * public class USAddress { ...}
* {@code
* *
* &lt;!-- XML Schema mapping for USAddress --&gt; * <!-- XML Schema mapping for USAddress -->
* &lt;xs:complexType name="USAddress"&gt; * <xs:complexType name="USAddress">
* &lt;xs:all&gt; * <xs:all>
* &lt;xs:element name="name" type="xs:string"/&gt; * <xs:element name="name" type="xs:string"/>
* &lt;xs:element name="street" type="xs:string"/&gt; * <xs:element name="street" type="xs:string"/>
* &lt;xs:element name="city" type="xs:string"/&gt; * <xs:element name="city" type="xs:string"/>
* &lt;xs:element name="state" type="xs:string"/&gt; * <xs:element name="state" type="xs:string"/>
* &lt;xs:element name="zip" type="xs:decimal"/&gt; * <xs:element name="zip" type="xs:decimal"/>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
*</pre> *}</pre>
* <p> <b> Example 3: </b> Map a class to a global element with an * <p> <b> Example 3: </b> Map a class to a global element with an
* anonymous type. * anonymous type.
* </p> * </p>
@ -244,20 +246,21 @@ import java.lang.annotation.Target;
* &#64;XmlRootElement * &#64;XmlRootElement
* &#64;XmlType(name="") * &#64;XmlType(name="")
* public class USAddress { ...} * public class USAddress { ...}
* {@code
* *
* &lt;!-- XML Schema mapping for USAddress --&gt; * <!-- XML Schema mapping for USAddress -->
* &lt;xs:element name="USAddress"&gt; * <xs:element name="USAddress">
* &lt;xs:complexType&gt; * <xs:complexType>
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="name" type="xs:string"/&gt; * <xs:element name="name" type="xs:string"/>
* &lt;xs:element name="street" type="xs:string"/&gt; * <xs:element name="street" type="xs:string"/>
* &lt;xs:element name="city" type="xs:string"/&gt; * <xs:element name="city" type="xs:string"/>
* &lt;xs:element name="state" type="xs:string"/&gt; * <xs:element name="state" type="xs:string"/>
* &lt;xs:element name="zip" type="xs:decimal"/&gt; * <xs:element name="zip" type="xs:decimal"/>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* &lt;/xs:element&gt; * </xs:element>
* </pre> * }</pre>
* *
* <p> <b> Example 4: </b> Map a property to a local element with * <p> <b> Example 4: </b> Map a property to a local element with
* anonymous type. * anonymous type.
@ -271,22 +274,23 @@ import java.lang.annotation.Target;
* &#64;XmlType(name="") * &#64;XmlType(name="")
* public class USAddress { ... } * public class USAddress { ... }
* } * }
* {@code
* *
* &lt;!-- XML Schema mapping for USAddress --&gt; * <!-- XML Schema mapping for USAddress -->
* &lt;xs:complexType name="Invoice"&gt; * <xs:complexType name="Invoice">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="addr"&gt; * <xs:element name="addr">
* &lt;xs:complexType&gt; * <xs:complexType>
* &lt;xs:element name="name", type="xs:string"/&gt; * <xs:element name="name", type="xs:string"/>
* &lt;xs:element name="city", type="xs:string"/&gt; * <xs:element name="city", type="xs:string"/>
* &lt;xs:element name="city" type="xs:string"/&gt; * <xs:element name="city" type="xs:string"/>
* &lt;xs:element name="state" type="xs:string"/&gt; * <xs:element name="state" type="xs:string"/>
* &lt;xs:element name="zip" type="xs:decimal"/&gt; * <xs:element name="zip" type="xs:decimal"/>
* &lt;/xs:complexType&gt; * </xs:complexType>
* ... * ...
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <p> <b> Example 5: </b> Map a property to an attribute with * <p> <b> Example 5: </b> Map a property to an attribute with
* anonymous type. * anonymous type.
@ -306,19 +310,20 @@ import java.lang.annotation.Target;
* &#64;XmlValue * &#64;XmlValue
* public java.math.BigDecimal price; * public java.math.BigDecimal price;
* } * }
* {@code
* *
* &lt;!-- Example: XML Schema fragment --&gt; * <!-- Example: XML Schema fragment -->
* &lt;xs:complexType name="Item"&gt; * <xs:complexType name="Item">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="name" type="xs:string"/&gt; * <xs:element name="name" type="xs:string"/>
* &lt;xs:attribute name="price"&gt; * <xs:attribute name="price">
* &lt;xs:simpleType&gt; * <xs:simpleType>
* &lt;xs:restriction base="xs:decimal"/&gt; * <xs:restriction base="xs:decimal"/>
* &lt;/xs:simpleType&gt; * </xs:simpleType>
* &lt;/xs:attribute&gt; * </xs:attribute>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* <p> <b> Example 6: </b> Define a factoryClass and factoryMethod * <p> <b> Example 6: </b> Define a factoryClass and factoryMethod
* *

View File

@ -87,13 +87,14 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlValue * &#64;XmlValue
* public java.math.BigDecimal price; * public java.math.BigDecimal price;
* } * }
* {@code
* *
* &lt;!-- Example 1: XML Schema fragment --&gt; * <!-- Example 1: XML Schema fragment -->
* &lt;xs:simpleType name="USPrice"&gt; * <xs:simpleType name="USPrice">
* &lt;xs:restriction base="xs:decimal"/&gt; * <xs:restriction base="xs:decimal"/>
* &lt;/xs:simpleType&gt; * </xs:simpleType>
* *
* </pre> * }</pre>
* *
* <p><b> Example 2: </b> Map a class to XML Schema complexType with * <p><b> Example 2: </b> Map a class to XML Schema complexType with
* with simpleContent.</p> * with simpleContent.</p>
@ -108,17 +109,18 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlAttribute * &#64;XmlAttribute
* public String currency; * public String currency;
* } * }
* {@code
* *
* &lt;!-- Example 2: XML Schema fragment --&gt; * <!-- Example 2: XML Schema fragment -->
* &lt;xs:complexType name="InternationalPrice"&gt; * <xs:complexType name="InternationalPrice">
* &lt;xs:simpleContent&gt; * <xs:simpleContent>
* &lt;xs:extension base="xs:decimal"&gt; * <xs:extension base="xs:decimal">
* &lt;xs:attribute name="currency" type="xs:string"/&gt; * <xs:attribute name="currency" type="xs:string"/>
* &lt;/xs:extension&gt; * </xs:extension>
* &lt;/xs:simpleContent&gt; * </xs:simpleContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* </pre> * }</pre>
* *
* @author Sekhar Vajjhala, Sun Microsystems, Inc. * @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlType * @see XmlType

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ package javax.xml.bind.annotation.adapters;
* *
* <p> * <p>
* This adapter removes leading and trailing whitespaces, then truncate any * This adapter removes leading and trailing whitespaces, then truncate any
* sequnce of tab, CR, LF, and SP by a single whitespace character ' '. * sequence of tab, CR, LF, and SP by a single whitespace character ' '.
* *
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
* @since 1.6, JAXB 2.0 * @since 1.6, JAXB 2.0
@ -41,7 +41,7 @@ public class CollapsedStringAdapter extends XmlAdapter<String,String> {
/** /**
* Removes leading and trailing whitespaces of the string * Removes leading and trailing whitespaces of the string
* given as the parameter, then truncate any * given as the parameter, then truncate any
* sequnce of tab, CR, LF, and SP by a single whitespace character ' '. * sequence of tab, CR, LF, and SP by a single whitespace character ' '.
*/ */
public String unmarshal(String text) { public String unmarshal(String text) {
if(text==null) return null; // be defensive if(text==null) return null; // be defensive

View File

@ -75,35 +75,35 @@ package javax.xml.bind.annotation.adapters;
* *
* <p> <b> Step 1: </b> Determine the desired XML representation for HashMap. * <p> <b> Step 1: </b> Determine the desired XML representation for HashMap.
* *
* <pre> * <pre>{@code
* &lt;hashmap&gt; * <hashmap>
* &lt;entry key="id123"&gt;this is a value&lt;/entry&gt; * <entry key="id123">this is a value</entry>
* &lt;entry key="id312"&gt;this is another value&lt;/entry&gt; * <entry key="id312">this is another value</entry>
* ... * ...
* &lt;/hashmap&gt; * </hashmap>
* </pre> * }</pre>
* *
* <p> <b> Step 2: </b> Determine the schema definition that the * <p> <b> Step 2: </b> Determine the schema definition that the
* desired XML representation shown above should follow. * desired XML representation shown above should follow.
* *
* <pre> * <pre>{@code
* *
* &lt;xs:complexType name="myHashMapType"&gt; * <xs:complexType name="myHashMapType">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="entry" type="myHashMapEntryType" * <xs:element name="entry" type="myHashMapEntryType"
* minOccurs = "0" maxOccurs="unbounded"/&gt; * minOccurs = "0" maxOccurs="unbounded"/>
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* &lt;xs:complexType name="myHashMapEntryType"&gt; * <xs:complexType name="myHashMapEntryType">
* &lt;xs:simpleContent&gt; * <xs:simpleContent>
* &lt;xs:extension base="xs:string"&gt; * <xs:extension base="xs:string">
* &lt;xs:attribute name="key" type="xs:int"/&gt; * <xs:attribute name="key" type="xs:int"/>
* &lt;/xs:extension&gt; * </xs:extension>
* &lt;/xs:simpleContent&gt; * </xs:simpleContent>
* &lt;/xs:complexType&gt; * </xs:complexType>
* *
* </pre> * }</pre>
* *
* <p> <b> Step 3: </b> Write value types that can generate the above * <p> <b> Step 3: </b> Write value types that can generate the above
* schema definition. * schema definition.
@ -125,11 +125,11 @@ package javax.xml.bind.annotation.adapters;
* <p> <b> Step 4: </b> Write the adapter that adapts the value type, * <p> <b> Step 4: </b> Write the adapter that adapts the value type,
* MyHashMapType to a bound type, HashMap, used by the application. * MyHashMapType to a bound type, HashMap, used by the application.
* *
* <pre> * <pre>{@code
* public final class MyHashMapAdapter extends * public final class MyHashMapAdapter extends
* XmlAdapter&lt;MyHashMapType,HashMap&gt; { ... } * XmlAdapter<MyHashMapType,HashMap> { ... }
* *
* </pre> * }</pre>
* *
* <p> <b> Step 5: </b> Use the adapter. * <p> <b> Step 5: </b> Use the adapter.
* *
@ -143,13 +143,13 @@ package javax.xml.bind.annotation.adapters;
* *
* The above code fragment will map to the following schema: * The above code fragment will map to the following schema:
* *
* <pre> * <pre>{@code
* &lt;xs:complexType name="Foo"&gt; * <xs:complexType name="Foo">
* &lt;xs:sequence&gt; * <xs:sequence>
* &lt;xs:element name="hashmap" type="myHashMapType"&gt; * <xs:element name="hashmap" type="myHashMapType">
* &lt;/xs:sequence&gt; * </xs:sequence>
* &lt;/xs:complexType&gt; * </xs:complexType>
* </pre> * }</pre>
* *
* @param <BoundType> * @param <BoundType>
* The type that JAXB doesn't know how to handle. An adapter is written * The type that JAXB doesn't know how to handle. An adapter is written

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -42,7 +42,7 @@ import java.lang.annotation.Target;
* &#64;XmlJavaTypeAdapters ({ @XmlJavaTypeAdapter(...),@XmlJavaTypeAdapter(...) }) * &#64;XmlJavaTypeAdapters ({ @XmlJavaTypeAdapter(...),@XmlJavaTypeAdapter(...) })
* </pre> * </pre>
* *
* <p>The <tt>@XmlJavaTypeAdapters</tt> annnotation is useful for * <p>The <tt>@XmlJavaTypeAdapters</tt> annotation is useful for
* defining {@link XmlJavaTypeAdapter} annotations for different types * defining {@link XmlJavaTypeAdapter} annotations for different types
* at the package level. * at the package level.
* *

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -119,7 +119,7 @@ final class EPRHeader extends AbstractHeaderImpl {
epr.writeTo(localName, w); epr.writeTo(localName, w);
w.flush(); w.flush();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory fac = XmlUtil.newDocumentBuilderFactory(false);
fac.setNamespaceAware(true); fac.setNamespaceAware(true);
Node eprNode = fac.newDocumentBuilder().parse(bais).getDocumentElement(); Node eprNode = fac.newDocumentBuilder().parse(bais).getDocumentElement();
Node eprNodeToAdd = header.getOwnerDocument().importNode(eprNode, true); Node eprNodeToAdd = header.getOwnerDocument().importNode(eprNode, true);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -194,7 +194,7 @@ public abstract class StreamHeader extends AbstractHeaderImpl {
// TODO what about in-scope namespaces // TODO what about in-scope namespaces
// Not very efficient consider implementing a stream buffer // Not very efficient consider implementing a stream buffer
// processor that produces a DOM node from the buffer. // processor that produces a DOM node from the buffer.
TransformerFactory tf = XmlUtil.newTransformerFactory(); TransformerFactory tf = XmlUtil.newTransformerFactory(true);
Transformer t = tf.newTransformer(); Transformer t = tf.newTransformer();
XMLStreamBufferSource source = new XMLStreamBufferSource(_mark); XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
DOMResult result = new DOMResult(); DOMResult result = new DOMResult();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,9 @@ import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
//TODO DOMHeader DOMMessage SAAJMessage StatefulInstanceResolver //TODO DOMHeader DOMMessage SAAJMessage StatefulInstanceResolver
import com.sun.xml.internal.bind.unmarshaller.DOMScanner; import com.sun.xml.internal.bind.unmarshaller.DOMScanner;
//TODO MtomCodec
import com.sun.xml.internal.bind.v2.runtime.output.Encoded;
//TODO ExceptionBean //TODO ExceptionBean
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper; import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -56,7 +56,7 @@ public class DOMUtil {
synchronized (DOMUtil.class) { synchronized (DOMUtil.class) {
if (db == null) { if (db == null) {
try { try {
DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(); DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(true);
dbf.setNamespaceAware(true); dbf.setNamespaceAware(true);
db = dbf.newDocumentBuilder(); db = dbf.newDocumentBuilder();
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -92,7 +92,7 @@ public abstract class AbstractSchemaValidationTube extends AbstractFilterTubeImp
super(next); super(next);
this.binding = binding; this.binding = binding;
feature = binding.getFeature(SchemaValidationFeature.class); feature = binding.getFeature(SchemaValidationFeature.class);
sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "file", false); sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "all", false);
} }
protected AbstractSchemaValidationTube(AbstractSchemaValidationTube that, TubeCloner cloner) { protected AbstractSchemaValidationTube(AbstractSchemaValidationTube that, TubeCloner cloner) {

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
# questions. # questions.
# #
build-id=2.2.11-b150127.1410 build-id=2.2.11-b150402.1412
build-version=JAX-WS RI 2.2.11-b150127.1410 build-version=JAX-WS RI 2.2.11-b150402.1412
major-version=2.2.11 major-version=2.2.11
svn-revision=28121d09ed8ac02b76788709ccb4cdb66e03bbfa svn-revision=f923291dedcf386c5f408263984a99d7cedf0012

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -187,14 +187,11 @@ public class XMLStreamReaderToXMLStreamWriter {
protected void handleStartElement() throws XMLStreamException { protected void handleStartElement() throws XMLStreamException {
String nsUri = in.getNamespaceURI(); String nsUri = in.getNamespaceURI();
if(nsUri==null) out.writeStartElement(
out.writeStartElement(in.getLocalName()); fixNull(in.getPrefix()),
else in.getLocalName(),
out.writeStartElement( fixNull(nsUri)
fixNull(in.getPrefix()), );
in.getLocalName(),
nsUri
);
// start namespace bindings // start namespace bindings
int nsCount = in.getNamespaceCount(); int nsCount = in.getNamespaceCount();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -231,7 +231,7 @@ public class XmlUtil {
static final ContextClassloaderLocal<SAXParserFactory> saxParserFactory = new ContextClassloaderLocal<SAXParserFactory>() { static final ContextClassloaderLocal<SAXParserFactory> saxParserFactory = new ContextClassloaderLocal<SAXParserFactory>() {
@Override @Override
protected SAXParserFactory initialValue() throws Exception { protected SAXParserFactory initialValue() throws Exception {
SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParserFactory factory = newSAXParserFactory(true);
factory.setNamespaceAware(true); factory.setNamespaceAware(true);
return factory; return factory;
} }
@ -371,57 +371,49 @@ public class XmlUtil {
} }
}; };
public static DocumentBuilderFactory newDocumentBuilderFactory() { public static DocumentBuilderFactory newDocumentBuilderFactory(boolean disableSecurity) {
return newDocumentBuilderFactory(true);
}
public static DocumentBuilderFactory newDocumentBuilderFactory(boolean secureXmlProcessing) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try { try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessing)); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } ); LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
} }
return factory; return factory;
} }
public static TransformerFactory newTransformerFactory(boolean secureXmlProcessingEnabled) { public static TransformerFactory newTransformerFactory(boolean disableSecurity) {
TransformerFactory factory = TransformerFactory.newInstance(); TransformerFactory factory = TransformerFactory.newInstance();
try { try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled)); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
} catch (TransformerConfigurationException e) { } catch (TransformerConfigurationException e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()}); LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
} }
return factory; return factory;
} }
public static TransformerFactory newTransformerFactory() { public static SAXParserFactory newSAXParserFactory(boolean disableSecurity) {
return newTransformerFactory(true);
}
public static SAXParserFactory newSAXParserFactory(boolean secureXmlProcessingEnabled) {
SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParserFactory factory = SAXParserFactory.newInstance();
try { try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled)); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
} catch (Exception e) { } catch (Exception e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()}); LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
} }
return factory; return factory;
} }
public static XPathFactory newXPathFactory(boolean secureXmlProcessingEnabled) { public static XPathFactory newXPathFactory(boolean disableSecurity) {
XPathFactory factory = XPathFactory.newInstance(); XPathFactory factory = XPathFactory.newInstance();
try { try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled)); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
} catch (XPathFactoryConfigurationException e) { } catch (XPathFactoryConfigurationException e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } ); LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
} }
return factory; return factory;
} }
public static XMLInputFactory newXMLInputFactory(boolean secureXmlProcessingEnabled) { public static XMLInputFactory newXMLInputFactory(boolean disableSecurity) {
XMLInputFactory factory = XMLInputFactory.newInstance(); XMLInputFactory factory = XMLInputFactory.newInstance();
if (isXMLSecurityDisabled(secureXmlProcessingEnabled)) { if (xmlSecurityDisabled(disableSecurity)) {
// TODO-Miran: are those apppropriate defaults? // TODO-Miran: are those apppropriate defaults?
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
@ -429,14 +421,14 @@ public class XmlUtil {
return factory; return factory;
} }
private static boolean isXMLSecurityDisabled(boolean runtimeDisabled) { private static boolean xmlSecurityDisabled(boolean runtimeDisabled) {
return XML_SECURITY_DISABLED || runtimeDisabled; return XML_SECURITY_DISABLED || runtimeDisabled;
} }
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecurity) {
// if xml security (feature secure processing) disabled, nothing to do, no restrictions applied // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
if (isXMLSecurityDisabled(disableSecureProcessing)) { if (xmlSecurityDisabled(disableSecurity)) {
if (LOGGER.isLoggable(Level.FINE)) { if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary."); LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary.");
} }

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -30,10 +30,10 @@ BASEDIR_DOESNT_EXIST = \
Non-existent directory: {0} Non-existent directory: {0}
VERSION = \ VERSION = \
schemagen 2.2.12-b150126.1924 schemagen 2.2.12-b150331.1824
FULLVERSION = \ FULLVERSION = \
schemagen full version "2.2.12-b150126.1924" schemagen full version "2.2.12-b150331.1824"
USAGE = \ USAGE = \
Usage: schemagen [-options ...] <java files> \n\ Usage: schemagen [-options ...] <java files> \n\

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Nicht erkanntes {0} in Zeile {1} Spalte {2}
BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0} BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
VERSION = schemagen 2.2.12-b150126.1924 VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b150126.1924" FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b150331.1824"
USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path> : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding> : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file> : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help : Zeigt diese Verwendungsmeldung an USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path> : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding> : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file> : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help : Zeigt diese Verwendungsmeldung an

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Aparece un {0} inesperado en la l\u00EDnea {1} y la colu
BASEDIR_DOESNT_EXIST = Directorio no existente: {0} BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
VERSION = schemagen 2.2.12-b150126.1924 VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b150126.1924" FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b150331.1824"
USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso> : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso> : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n> : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo> : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help : muestra este mensaje de sintaxis USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso> : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso> : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n> : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo> : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help : muestra este mensaje de sintaxis

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Un \u00E9l\u00E9ment {0} inattendu appara\u00EEt \u00E0
BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
VERSION = schemagen 2.2.12-b150126.1924 VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b150126.1924" FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b150331.1824"
USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} imprevisto visualizzato sulla riga {1} colonna {2}
BASEDIR_DOESNT_EXIST = Directory non esistente: {0} BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
VERSION = schemagen 2.2.12-b150126.1924 VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = versione completa schemagen "2.2.12-b150126.1924" FULLVERSION = versione completa schemagen "2.2.12-b150331.1824"
USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path> : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding> : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file> : genera il file di episodio per la compilazione separata\n\ \ \ \ -version : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion : visualizza le informazioni sulla versione completa\n\ \ \ \ -help : visualizza questo messaggio sull'uso USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path> : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding> : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file> : genera il file di episodio per la compilazione separata\n\ \ \ \ -version : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion : visualizza le informazioni sulla versione completa\n\ \ \ \ -help : visualizza questo messaggio sull'uso

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u4E88\u671F\u3057\u306A\u3044{0}\u304C\u884C{1}\u3001\u
BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0} BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
VERSION = schemagen 2.2.12-b150126.1924 VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150126.1924" FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150331.1824"
USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path> : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding> : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file> : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059 USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path> : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding> : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file> : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \uC608\uC0C1\uCE58 \uC54A\uC740 {0}\uC774(\uAC00) {1}\uD
BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0} BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
VERSION = schemagen 2.2.12-b150126.1924 VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b150126.1924" FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b150331.1824"
USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path> : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding> : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file> : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4. USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path> : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding> : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file> : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} inesperado aparece na linha {1} coluna {2}
BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0} BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b150126.1924 VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b150331.1824
FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b150126.1924" FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b150331.1824"
USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path> : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path> : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path> : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding> : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file> : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help : exibir esta mensagem de uso USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path> : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path> : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path> : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding> : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file> : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help : exibir esta mensagem de uso

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u5728\u7B2C {1} \u884C, \u7B2C {2} \u5217\u51FA\u73B0\u
BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0} BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
VERSION = schemagen 2.2.12-b150126.1924 VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924" FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path> : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding> : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file> : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path> : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding> : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file> : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u672A\u9810\u671F\u7684 {0} \u986F\u793A\u65BC\u884C {1
BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0} BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
VERSION = schemagen 2.2.12-b150126.1924 VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924" FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path> : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding> : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file> : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path> : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding> : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file> : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -158,7 +158,12 @@ public class SchemaGenerator {
while (cl != null) { while (cl != null) {
if (cl instanceof URLClassLoader) { if (cl instanceof URLClassLoader) {
for (URL url : ((URLClassLoader) cl).getURLs()) { for (URL url : ((URLClassLoader) cl).getURLs()) {
appendPath(cp, url.getPath()); try {
appendPath(cp,new File(url.toURI()).getPath());
} catch(URISyntaxException ex) {
/*If the URL is not properly formated - skip it*/
LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
}
} }
} }
cl = cl.getParent(); cl = cl.getParent();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,8 +23,6 @@
* questions. * questions.
*/ */
package com.sun.tools.internal.jxc.ap; package com.sun.tools.internal.jxc.ap;
import com.sun.tools.internal.jxc.api.JXC; import com.sun.tools.internal.jxc.api.JXC;
@ -89,12 +87,12 @@ public class SchemaGenerator extends AbstractProcessor {
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
final ErrorReceiverImpl errorListener = new ErrorReceiverImpl(processingEnv); final ErrorReceiverImpl errorListener = new ErrorReceiverImpl(processingEnv);
List<Reference> classes = new ArrayList<Reference>(); List<Reference> classesToBeBound = new ArrayList<Reference>();
// simply ignore all the interface definitions, // simply ignore all the interface definitions,
// so that users won't have to manually exclude interfaces, which is silly. // so that users won't have to manually exclude interfaces, which is silly.
filterClass(classes, roundEnv.getRootElements()); filterClass(classesToBeBound, roundEnv.getRootElements());
J2SJAXBModel model = JXC.createJavaCompiler().bind(classes, Collections.<QName, Reference>emptyMap(), null, processingEnv); J2SJAXBModel model = JXC.createJavaCompiler().bind(classesToBeBound, Collections.<QName, Reference>emptyMap(), null, processingEnv);
if (model == null) if (model == null)
return false; // error return false; // error
@ -133,11 +131,17 @@ public class SchemaGenerator extends AbstractProcessor {
return false; return false;
} }
private void filterClass(List<Reference> classes, Collection<? extends Element> elements) { /**
* Filter classes (note that enum is kind of class) from elements tree
* @param result list of found classes
* @param elements tree to be filtered
*/
private void filterClass(List<Reference> result, Collection<? extends Element> elements) {
for (Element element : elements) { for (Element element : elements) {
if (element.getKind().equals(ElementKind.CLASS) || element.getKind().equals(ElementKind.ENUM)) { final ElementKind kind = element.getKind();
classes.add(new Reference((TypeElement) element, processingEnv)); if (ElementKind.CLASS.equals(kind) || ElementKind.ENUM.equals(kind)) {
filterClass(classes, ElementFilter.typesIn(element.getEnclosedElements())); result.add(new Reference((TypeElement) element, processingEnv));
filterClass(result, ElementFilter.typesIn(element.getEnclosedElements()));
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,12 @@ import com.sun.source.util.TreePath;
import com.sun.source.util.Trees; import com.sun.source.util.Trees;
import com.sun.xml.internal.bind.v2.model.nav.Navigator; import com.sun.xml.internal.bind.v2.model.nav.Navigator;
import com.sun.xml.internal.bind.v2.runtime.Location; import com.sun.xml.internal.bind.v2.runtime.Location;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;
@ -52,12 +57,6 @@ import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.Elements; import javax.lang.model.util.Elements;
import javax.lang.model.util.SimpleTypeVisitor6; import javax.lang.model.util.SimpleTypeVisitor6;
import javax.lang.model.util.Types; import javax.lang.model.util.Types;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
/** /**
* {@link Navigator} implementation for annotation processing. * {@link Navigator} implementation for annotation processing.
@ -241,7 +240,7 @@ public final class ApNavigator implements Navigator<TypeMirror, TypeElement, Var
public VariableElement[] getEnumConstants(TypeElement clazz) { public VariableElement[] getEnumConstants(TypeElement clazz) {
List<? extends Element> elements = env.getElementUtils().getAllMembers(clazz); List<? extends Element> elements = env.getElementUtils().getAllMembers(clazz);
Collection<VariableElement> constants = new HashSet<VariableElement>(); Collection<VariableElement> constants = new ArrayList<VariableElement>();
for (Element element : elements) { for (Element element : elements) {
if (element.getKind().equals(ElementKind.ENUM_CONSTANT)) { if (element.getKind().equals(ElementKind.ENUM_CONSTANT)) {
constants.add((VariableElement) element); constants.add((VariableElement) element);

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -171,20 +171,20 @@ Driver.CompilingSchema = \
Driver.FailedToGenerateCode = \ Driver.FailedToGenerateCode = \
Failed to produce code. Failed to produce code.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \ Driver.FilePrologComment = \
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 \n\ This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 \n\
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\ See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\
Any modifications to this file will be lost upon recompilation of the source schema. \n\ Any modifications to this file will be lost upon recompilation of the source schema. \n\
Generated on: {0} \n Generated on: {0} \n
Driver.Version = \ Driver.Version = \
xjc 2.2.12-b150126.1924 xjc 2.2.12-b150331.1824
Driver.FullVersion = \ Driver.FullVersion = \
xjc full version "2.2.12-b150126.1924" xjc full version "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = Ein Schema wird kompiliert ...
Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden. Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924 Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b150126.1924" Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = Compilando un esquema...
Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo. Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b150126.1924 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b150331.1824 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924 Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b150126.1924" Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilation d'un sch\u00e9ma...
Driver.FailedToGenerateCode = Echec de la production du code. Driver.FailedToGenerateCode = Echec de la production du code.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b150126.1924 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b150331.1824 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
Driver.Version = xjc 2.2.12-b150126.1924 Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b150126.1924" Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilazione di uno schema in corso...
Driver.FailedToGenerateCode = Produzione del codice non riuscita. Driver.FailedToGenerateCode = Produzione del codice non riuscita.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b150126.1924 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b150331.1824 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924 Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = versione completa xjc "2.2.12-b150126.1924" Driver.FullVersion = versione completa xjc "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u30b9\u30ad\u30fc\u30de\u306e\u30b3\u30f3\u30d1\u30a4\
Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002 Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b150126.1924\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b150331.1824\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924 Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150126.1924" Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \uc2a4\ud0a4\ub9c8\ub97c \ucef4\ud30c\uc77c\ud558\ub294
Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4. Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b150126.1924 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b150331.1824 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
Driver.Version = XJC 2.2.12-b150126.1924 Driver.Version = XJC 2.2.12-b150331.1824
Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b150126.1924" Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilando um esquema...
Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo. Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b150126.1924 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b150331.1824 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924 Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b150126.1924" Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7f16\u8bd1\u6a21\u5f0f...
Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002 Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b150126.1924 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b150331.1824 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924 Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924" Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7de8\u8b6f\u7db1\u8981...
Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc. Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter> # DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924 Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924" Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924 Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip # for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@ jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,13 +25,15 @@
package com.sun.tools.internal.xjc.addon.code_injector; package com.sun.tools.internal.xjc.addon.code_injector;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.sun.istack.internal.NotNull;
import com.sun.tools.internal.xjc.Options; import com.sun.tools.internal.xjc.Options;
import com.sun.tools.internal.xjc.Plugin; import com.sun.tools.internal.xjc.Plugin;
import com.sun.tools.internal.xjc.model.CPluginCustomization; import com.sun.tools.internal.xjc.model.CPluginCustomization;
import com.sun.tools.internal.xjc.outline.ClassOutline; import com.sun.tools.internal.xjc.outline.CustomizableOutline;
import com.sun.tools.internal.xjc.outline.Outline; import com.sun.tools.internal.xjc.outline.Outline;
import com.sun.tools.internal.xjc.util.DOMUtils; import com.sun.tools.internal.xjc.util.DOMUtils;
@ -54,7 +56,7 @@ public class PluginImpl extends Plugin {
} }
public boolean isCustomizationTagName(String nsUri, String localName) { public boolean isCustomizationTagName(String nsUri, String localName) {
return nsUri.equals(Const.NS) && localName.equals("code"); return Const.NS.equals(nsUri) && "code".equals(localName);
} }
public String getUsage() { public String getUsage() {
@ -62,9 +64,15 @@ public class PluginImpl extends Plugin {
} }
// meat of the processing // meat of the processing
public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { public boolean run(@NotNull Outline model, Options opt, ErrorHandler errorHandler) {
for( ClassOutline co : model.getClasses() ) { checkAndInject(model.getClasses());
CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code"); checkAndInject(model.getEnums());
return true;
}
private static void checkAndInject(Collection<? extends CustomizableOutline> outlines) {
for (CustomizableOutline co : outlines) {
CPluginCustomization c = co.getTarget().getCustomizations().find(Const.NS, "code");
if(c==null) if(c==null)
continue; // no customization --- nothing to inject here continue; // no customization --- nothing to inject here
@ -74,9 +82,7 @@ public class PluginImpl extends Plugin {
String codeFragment = DOMUtils.getElementText(c.element); String codeFragment = DOMUtils.getElementText(c.element);
// inject the specified code fragment into the implementation class. // inject the specified code fragment into the implementation class.
co.implClass.direct(codeFragment); co.getImplClass().direct(codeFragment);
} }
return true;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,6 +33,7 @@ import java.util.List;
import com.sun.codemodel.internal.JClass; import com.sun.codemodel.internal.JClass;
import com.sun.codemodel.internal.JDefinedClass; import com.sun.codemodel.internal.JDefinedClass;
import com.sun.tools.internal.xjc.model.CClassInfo; import com.sun.tools.internal.xjc.model.CClassInfo;
import com.sun.tools.internal.xjc.model.CCustomizable;
import com.sun.tools.internal.xjc.model.CPropertyInfo; import com.sun.tools.internal.xjc.model.CPropertyInfo;
import com.sun.istack.internal.NotNull; import com.sun.istack.internal.NotNull;
@ -44,7 +45,7 @@ import com.sun.istack.internal.NotNull;
* *
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/ */
public abstract class ClassOutline { public abstract class ClassOutline implements CustomizableOutline {
/** /**
* A {@link Outline} that encloses all the class outlines. * A {@link Outline} that encloses all the class outlines.
@ -122,4 +123,14 @@ public abstract class ClassOutline {
if(s==null) return null; if(s==null) return null;
return parent().getClazz(s); return parent().getClazz(s);
} }
@Override
public JDefinedClass getImplClass() {
return implClass;
}
@Override
public CCustomizable getTarget() {
return target;
}
} }

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.tools.internal.xjc.outline;
import com.sun.codemodel.internal.JDefinedClass;
import com.sun.istack.internal.NotNull;
import com.sun.tools.internal.xjc.model.CCustomizable;
/**
* This interface describes that outline class could be customized.
* It provides the bound info from {@link CCustomizable} target. And
* customization output - implementation class.
*
* @author yaroska
* @since 2.2.12
*/
public interface CustomizableOutline {
/**
* Provides bound information about customizable target.
* @return customizable target
*/
@NotNull CCustomizable getTarget();
/**
* Provides customization output.
* @return Implementation class
*/
@NotNull JDefinedClass getImplClass();
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package com.sun.tools.internal.xjc.outline; package com.sun.tools.internal.xjc.outline;
import com.sun.codemodel.internal.JDefinedClass; import com.sun.codemodel.internal.JDefinedClass;
import com.sun.tools.internal.xjc.model.CCustomizable;
import com.sun.tools.internal.xjc.model.CElementInfo; import com.sun.tools.internal.xjc.model.CElementInfo;
/** /**
@ -39,7 +40,7 @@ import com.sun.tools.internal.xjc.model.CElementInfo;
* *
* @author Kohsuke Kawaguchi * @author Kohsuke Kawaguchi
*/ */
public abstract class ElementOutline { public abstract class ElementOutline implements CustomizableOutline {
/** /**
* A {@link Outline} that encloses all the class outlines. * A {@link Outline} that encloses all the class outlines.
@ -69,4 +70,14 @@ public abstract class ElementOutline {
this.target = target; this.target = target;
this.implClass = implClass; this.implClass = implClass;
} }
@Override
public CCustomizable getTarget() {
return target;
}
@Override
public JDefinedClass getImplClass() {
return implClass;
}
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.sun.codemodel.internal.JDefinedClass; import com.sun.codemodel.internal.JDefinedClass;
import com.sun.tools.internal.xjc.model.CCustomizable;
import com.sun.tools.internal.xjc.model.CEnumLeafInfo; import com.sun.tools.internal.xjc.model.CEnumLeafInfo;
import com.sun.istack.internal.NotNull; import com.sun.istack.internal.NotNull;
@ -40,7 +41,7 @@ import com.sun.istack.internal.NotNull;
* *
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/ */
public abstract class EnumOutline { public abstract class EnumOutline implements CustomizableOutline {
/** /**
* This {@link EnumOutline} holds information about this {@link CEnumLeafInfo}. * This {@link EnumOutline} holds information about this {@link CEnumLeafInfo}.
@ -74,4 +75,14 @@ public abstract class EnumOutline {
this.target = target; this.target = target;
this.clazz = clazz; this.clazz = clazz;
} }
@Override
public JDefinedClass getImplClass() {
return clazz;
}
@Override
public CCustomizable getTarget() {
return target;
}
} }

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
# questions. # questions.
# #
build-id=2.2.11-b150127.1410 build-id=2.2.11-b150402.1412
build-version=JAX-WS RI 2.2.11-b150127.1410 build-version=JAX-WS RI 2.2.11-b150402.1412
major-version=2.2.11 major-version=2.2.11
svn-revision=28121d09ed8ac02b76788709ccb4cdb66e03bbfa svn-revision=f923291dedcf386c5f408263984a99d7cedf0012

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
package com.sun.tools.internal.ws.wsdl.document.soap; package com.sun.tools.internal.ws.wsdl.document.soap;
import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
/** /**
@ -35,9 +37,7 @@ import javax.xml.namespace.QName;
public interface SOAPConstants { public interface SOAPConstants {
// namespace URIs // namespace URIs
public static final String URI_ENVELOPE = public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
"http://schemas.xmlsoap.org/soap/envelope/";
public static final String NS_WSDL_SOAP = public static final String NS_WSDL_SOAP =
"http://schemas.xmlsoap.org/wsdl/soap/"; "http://schemas.xmlsoap.org/wsdl/soap/";
public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/"; public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -78,7 +78,7 @@ public class Internalizer {
private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() { private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() {
@Override @Override
protected XPathFactory initialValue() throws Exception { protected XPathFactory initialValue() throws Exception {
return XPathFactory.newInstance(); return XmlUtil.newXPathFactory(true);
} }
}; };
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,10 @@
package com.sun.tools.internal.ws.wsdl.parser; package com.sun.tools.internal.ws.wsdl.parser;
import com.sun.tools.internal.ws.util.xml.XmlUtil;
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible; import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension; import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext; import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
import com.sun.tools.internal.ws.util.xml.XmlUtil;
import com.sun.tools.internal.ws.wsdl.document.*; import com.sun.tools.internal.ws.wsdl.document.*;
import com.sun.tools.internal.ws.wsdl.document.jaxws.CustomName; import com.sun.tools.internal.ws.wsdl.document.jaxws.CustomName;
import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding; import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding;
@ -57,7 +57,7 @@ public class JAXWSBindingExtensionHandler extends AbstractExtensionHandler {
private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() { private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() {
@Override @Override
protected XPathFactory initialValue() throws Exception { protected XPathFactory initialValue() throws Exception {
return XPathFactory.newInstance(); return XmlUtil.newXPathFactory(false);
} }
}; };