"] using binding [" + this.bindingName + "]"); this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetClass); logger.debug("Configured for target class [" + this.targetClass + "]"); this.bindingFactory = BindingDirectory.getFactory(this.targetClass); "] using binding [" + this.bindingName + "]"); this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetPackage);
public IBindingFactory run() throws Exception { return BindingDirectory.getFactory(NodeTypeValuesList.class); } };
public IBindingFactory run() throws Exception { return BindingDirectory.getFactory(RepositoryServiceConfiguration.class); } });
private IBindingFactory createBindingFactory(Class<?> clazz, String bindingName) throws JiBXException { if (bindingName == null) { return BindingDirectory.getFactory(clazz); } else { return BindingDirectory.getFactory(bindingName, clazz); } } }
public IBindingFactory run() throws Exception { return BindingDirectory.getFactory(RepositoryServiceConfiguration.class); } });
private IMarshallingContext getMarshallingContext(Object object) throws JiBXException { IBindingFactory factory = BindingDirectory.getFactory(object.getClass()); return factory.createMarshallingContext(); } }
private IMarshallingContext getMarshallingContext(Object object) throws JiBXException { IBindingFactory factory = BindingDirectory.getFactory(object.getClass()); return factory.createMarshallingContext(); } }
public SchemaMarshaller() throws JiBXException { IBindingFactory ifact = BindingDirectory.getFactory(SchemaUtils.XS_PREFIX_BINDING, SchemaElement.class); m_schemaContext = (MarshallingContext)ifact.createMarshallingContext(); }
protected Object decode0(ChannelHandlerContext arg0, ByteBuf body) throws Exception { factory = BindingDirectory.getFactory(clazz); String content = body.toString(UTF_8); if (isPrint) System.out.println("The body is : " + content); reader = new StringReader(content); IUnmarshallingContext uctx = factory.createUnmarshallingContext(); Object result = uctx.unmarshalDocument(reader); reader.close(); reader = null; return result; }
private String encode2Xml(Order order) throws JiBXException, IOException { factory = BindingDirectory.getFactory(Order.class); writer = new StringWriter(); IMarshallingContext mctx = factory.createMarshallingContext(); mctx.setIndent(2); mctx.marshalDocument(order, CHARSET_NAME, null, writer); String xmlStr = writer.toString(); writer.close(); System.out.println(xmlStr.toString()); return xmlStr; }
protected ByteBuf encode0(ChannelHandlerContext ctx, Object body) throws Exception { factory = BindingDirectory.getFactory(body.getClass()); writer = new StringWriter(); IMarshallingContext mctx = factory.createMarshallingContext(); mctx.setIndent(2); mctx.marshalDocument(body, CHARSET_NAME, null, writer); String xmlStr = writer.toString(); writer.close(); writer = null; ByteBuf encodeBuf = Unpooled.copiedBuffer(xmlStr, UTF_8); return encodeBuf; }
public static <T> T fromXML(byte[] bytes, Class<T> clazz) throws Exception { ByteArrayInputStream baos = new ByteArrayInputStream(bytes); IBindingFactory bfact = BindingDirectory.getFactory(clazz); UnmarshallingContext uctx = (UnmarshallingContext) bfact.createUnmarshallingContext(); Object obj = uctx.unmarshalDocument(baos, "UTF-8"); return clazz.cast(obj); }
public static byte[] toXML(Object obj) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); IBindingFactory bfact = BindingDirectory.getFactory(obj.getClass()); IMarshallingContext mctx = bfact.createMarshallingContext(); mctx.setIndent(2); mctx.marshalDocument(obj, "UTF-8", null, out); return out.toByteArray(); }
public void write(Object obj, XMLStreamWriter output) { try { IBindingFactory factory = BindingDirectory.getFactory(obj.getClass()); IMarshallingContext ctx = getMarshallingContext(obj); StAXWriter writer = new StAXWriter(factory.getNamespaces(), output); ctx.setXmlWriter(writer); ((IMarshallable)obj).marshal(ctx); } catch (Exception e) { throw new RuntimeException(e); } }
public void write(Object obj, XMLStreamWriter output) { try { IBindingFactory factory = BindingDirectory.getFactory(obj.getClass()); IMarshallingContext ctx = getMarshallingContext(obj); StAXWriter writer = new StAXWriter(factory.getNamespaces(), output); ctx.setXmlWriter(writer); ((IMarshallable)obj).marshal(ctx); } catch (Exception e) { throw new RuntimeException(e); } }
protected void loadCustomizations(String path, IClassLocator loc, ValidationContext vctx) throws JiBXException, IOException { // load or create customization information setLocator(loc); m_global = new GlobalCustom(loc); if (path != null) { IBindingFactory fact = BindingDirectory.getFactory("class_customs_binding", GlobalCustom.class); IUnmarshallingContext ictx = fact.createUnmarshallingContext(); FileInputStream is = new FileInputStream(path); ictx.setDocument(is, null); ictx.setUserContext(vctx); ((IUnmarshallable)m_global).unmarshal(ictx); } }
protected final void init(InputStream is) throws RepositoryConfigurationException { try { IBindingFactory factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class); IUnmarshallingContext uctx = factory.createUnmarshallingContext(); RepositoryServiceConfiguration conf = (RepositoryServiceConfiguration)uctx.unmarshalDocument(is, null); this.defaultRepositoryName = conf.getDefaultRepositoryName(); this.repositoryConfigurations = conf.getRepositoryConfigurations(); } catch (JiBXException e) { throw new RepositoryConfigurationException("Error in config initialization " + e, e); } }
private static UnmarshallingContext getUnmarshallingContext(XMLStreamReader reader, Class jtype) throws JiBXException { IBindingFactory factory; if (JibxSimpleTypes.isSimpleType(jtype)) { factory = JibxNullBindingFactory.getFactory(); } else { factory = BindingDirectory.getFactory(jtype); } UnmarshallingContext ctx = (UnmarshallingContext)factory.createUnmarshallingContext(); StAXReaderWrapper wrapper = new StAXReaderWrapper(reader, "Data-element", true); ctx.setDocument(wrapper); ctx.toTag(); return ctx; }
private static UnmarshallingContext getUnmarshallingContext(XMLStreamReader reader, Class<?> jtype) throws JiBXException { IBindingFactory factory; if (JibxSimpleTypes.isSimpleType(jtype)) { factory = JibxNullBindingFactory.getFactory(); } else { factory = BindingDirectory.getFactory(jtype); } UnmarshallingContext ctx = (UnmarshallingContext)factory.createUnmarshallingContext(); StAXReaderWrapper wrapper = new StAXReaderWrapper(reader, "Data-element", true); ctx.setDocument(wrapper); ctx.toTag(); return ctx; } }
private RawSld parseSldI(StyledLayerDescriptorInfo sld) throws JiBXException { RawSld res = new RawSld(); IBindingFactory bfact; bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class); IMarshallingContext mctx = bfact.createMarshallingContext(); StringWriter writer = new StringWriter(); mctx.setOutput(writer); mctx.getXmlWriter().setIndentSpaces(2, "\n", ' '); mctx.marshalDocument(sld); res.setXml(writer.toString()); res.setName(sld.getName()); res.setVersion(sld.getVersion()); res.setTitle(sld.getTitle() == null ? getTitle(sld, "?") : sld.getTitle()); return res; }