added = addJaxbObjectFactory(e1);
}
}
if (ctx == null) {
throw new ServiceConstructionException(e1);
} else {
synchronized (JAXBCONTEXT_CACHE) {
JAXBCONTEXT_CACHE.put(contextClasses, cachedContextAndSchemas);
}
}
}
ctx = cachedContextAndSchemas.getContext();
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "CREATED_JAXB_CONTEXT", new Object[] {ctx, contextClasses});
}
setContext(ctx);
for (ServiceInfo serviceInfo : service.getServiceInfos()) {
SchemaCollection col = serviceInfo.getXmlSchemaCollection();
if (col.getXmlSchemas().length > 1) {
// someone has already filled in the types
continue;
}
boolean schemasFromCache = false;
Collection<DOMSource> schemas = getSchemas();
if (schemas == null) {
schemas = cachedContextAndSchemas.getSchemas();
if (schemas != null) {
schemasFromCache = true;
}
} else {
schemasFromCache = true;
}
if (schemas == null) {
schemas = new HashSet<DOMSource>();
try {
for (DOMResult r : generateJaxbSchemas()) {
schemas.add(new DOMSource(r.getNode()));
}
} catch (IOException e) {
throw new ServiceConstructionException(new Message("SCHEMA_GEN_EXC", LOG), e);
}
}
for (DOMSource r : schemas) {
addSchemaDocument(serviceInfo,
col,
(Document)r.getNode(),
r.getSystemId());
}
JAXBContextImpl riContext;
if (context instanceof JAXBContextImpl) {
riContext = (JAXBContextImpl)context;
} else {
// fall back if we're using another jaxb implementation
try {
riContext = (JAXBContextImpl)ContextFactory.createContext(contextClasses
.toArray(new Class[contextClasses.size()]), null);
} catch (JAXBException e) {
throw new ServiceConstructionException(e);
}
}
JAXBSchemaInitializer schemaInit = new JAXBSchemaInitializer(serviceInfo, col, riContext,
this.qualifiedSchemas);