BridgeContextImpl(JAXBContextImpl context) { unmarshaller = context.createUnmarshaller(); marshaller = context.createMarshaller(); }
public <T> JaxBeanInfo<T> getBeanInfo(Class<T> clazz) throws JAXBException { return context.getBeanInfo(clazz,true); }
public FastInfosetStreamWriterOutput(StAXDocumentSerializer out, JAXBContextImpl context) { super(out, NoEscapeHandler.theInstance); this.fiout = out; this.localNames = context.getUTF8NameTable(); final VocabularyApplicationData vocabAppData = fiout.getVocabularyApplicationData(); AppData appData = null; if (vocabAppData == null || !(vocabAppData instanceof AppData)) { appData = new AppData(); fiout.setVocabularyApplicationData(appData); } else { appData = (AppData)vocabAppData; } final TablesPerJAXBContext tablesPerContext = appData.contexts.get(context); if (tablesPerContext != null) { tables = tablesPerContext; /** * Obtain the current local name index. Thus will be used to * calculate the maximum index value when serializing for this context */ tables.clearOrResetTables(out.getLocalNameIndex()); } else { tables = new TablesPerJAXBContext(context, out.getLocalNameIndex()); appData.contexts.put(context, tables); } }
/** * On top of {@link JAXBContextImpl#selectRootLoader(State, TagName)}, * this method also consults {@link ClassResolver}. * * @throws SAXException * if {@link ValidationEventHandler} reported a failure. */ public Loader selectRootLoader(State state, TagName tag) throws SAXException { try { Loader l = getJAXBContext().selectRootLoader(state, tag); if(l!=null) return l; if(classResolver!=null) { Class<?> clazz = classResolver.resolveElementName(tag.uri, tag.local); if(clazz!=null) { JAXBContextImpl enhanced = getJAXBContext().createAugmented(clazz); JaxBeanInfo<?> bi = enhanced.getBeanInfo(clazz); return bi.getLoader(enhanced,true); } } } catch (RuntimeException e) { throw e; } catch (Exception e) { handleError(e); } return null; }
if(e.isGlobalScope()) scope = null; QName n = e.getName(); ElementBeanInfoImpl bi = grammar.getElement(scope,n); if(bi==null) { tbi = grammar.getBeanInfo(e.getDeclaredType(),true); } catch (JAXBException x) {
RuntimeTypeInfoSet typeSet = getTypeInfoSet(); JaxBeanInfo<?> bi = getOrCreate(e); for (QName qn : bi.getTypeNames()) typeMap.put( qn, bi ); JaxBeanInfo<?> ai = getOrCreate(a); for (QName qn : ai.getTypeNames()) typeMap.put( qn, ai ); ClassBeanInfoImpl<?> bi = getOrCreate(e.getValue()); ElementBeanInfoImpl bi = getOrCreate(n); if(n.getScope()==null) rootMap.put(n.getElementName(),bi); getOrCreate(typeSet.getAnyTypeInfo()); bridge = new BridgeImpl(this, name,getBeanInfo(erasedType,true),tr); else bridge = new BridgeImpl(this, name,new ValueListBeanInfoImpl(this,erasedType),tr);
static public void marshalPMML(PMML pmml, OutputStream os) throws JAXBException { JAXBContextImpl context; try { context = (JAXBContextImpl)JAXBUtil.getContext(); } catch(ClassCastException cce){ throw new IllegalStateException("Not a GlassFish Metro runtime", cce); } MarshallerImpl marshaller = context.createMarshaller(); XmlOutput xmlOutput = new PrettyUTF8XmlOutput(os, context.getUTF8NameTable()); marshaller.marshal(pmml, xmlOutput); } }
public AnnotationParser create() { return new AnnotationParser() { private Unmarshaller u = BindInfo.getJAXBContext().createUnmarshaller();
@Override public void generateEpisode(Result output) { if(output==null) throw new IllegalArgumentException(); createSchemaGenerator().writeEpisodeFile(ResultFactory.createSerializer(output)); }
@Override public <T> Binder<T> createBinder(Class<T> domType) { if(domType==Node.class) return (Binder<T>)createBinder(); else return super.createBinder(domType); }
public Transformer getIdentityTransformer() { if (identityTransformer==null) identityTransformer = JAXBContextImpl.createTransformer(grammar.disableSecurityProcessing); return identityTransformer; }
public JAXBContextImpl build() throws JAXBException { // fool-proof if (this.defaultNsUri == null) { this.defaultNsUri = ""; } if (this.subclassReplacements == null) { this.subclassReplacements = Collections.emptyMap(); } if (this.annotationReader == null) { this.annotationReader = new RuntimeInlineAnnotationReader(); } if (this.typeRefs == null) { this.typeRefs = Collections.<TypeReference>emptyList(); } return new JAXBContextImpl(this); }
Document doc = JAXBContextImpl.createDom(getContext().disableSecurityProcessing); ((DOMResult) result).setNode(doc); return new SAXOutput(new SAX2DOMEx(doc));
/** * On top of {@link JAXBContextImpl#selectRootLoader(State, TagName)}, * this method also consults {@link ClassResolver}. * * @throws SAXException * if {@link ValidationEventHandler} reported a failure. */ public Loader selectRootLoader(State state, TagName tag) throws SAXException { try { Loader l = getJAXBContext().selectRootLoader(state, tag); if(l!=null) return l; if(classResolver!=null) { Class<?> clazz = classResolver.resolveElementName(tag.uri, tag.local); if(clazz!=null) { JAXBContextImpl enhanced = getJAXBContext().createAugmented(clazz); JaxBeanInfo<?> bi = enhanced.getBeanInfo(clazz); return bi.getLoader(enhanced,true); } } } catch (RuntimeException e) { throw e; } catch (Exception e) { handleError(e); } return null; }
RuntimeTypeInfoSet typeSet = getTypeInfoSet(); JaxBeanInfo<?> bi = getOrCreate(e); for (QName qn : bi.getTypeNames()) typeMap.put( qn, bi ); JaxBeanInfo<?> ai = getOrCreate(a); for (QName qn : ai.getTypeNames()) typeMap.put( qn, ai ); ClassBeanInfoImpl<?> bi = getOrCreate(e.getValue()); ElementBeanInfoImpl bi = getOrCreate(n); if(n.getScope()==null) rootMap.put(n.getElementName(),bi); getOrCreate(typeSet.getAnyTypeInfo()); bridge = new BridgeImpl(this, name,getBeanInfo(erasedType,true),tr); else bridge = new BridgeImpl(this, name,new ValueListBeanInfoImpl(this,erasedType),tr);
if(e.isGlobalScope()) scope = null; QName n = e.getName(); ElementBeanInfoImpl bi = grammar.getElement(scope,n); if(bi==null) { tbi = grammar.getBeanInfo(e.getDeclaredType(),true); } catch (JAXBException x) {
public AnnotationParser create() { return new AnnotationParser() { private Unmarshaller u = BindInfo.getJAXBContext().createUnmarshaller();
final SAXParseException[] w = new SAXParseException[1]; createSchemaGenerator().write(outputResolver, new ErrorListener() { public void error(SAXParseException exception) { e[0] = exception;
@Override public <T> Binder<T> createBinder(Class<T> domType) { if(domType==Node.class) return (Binder<T>)createBinder(); else return super.createBinder(domType); }
public Transformer getIdentityTransformer() { if (identityTransformer==null) identityTransformer = JAXBContextImpl.createTransformer(grammar.disableSecurityProcessing); return identityTransformer; }