Examples of IBindingFactory


Examples of org.jibx.runtime.IBindingFactory

      assertEquals(PageNavigation.class, obj.getClass());
   }

   public void testPortletPreferencesMapping() throws Exception
   {
      IBindingFactory bfact = BindingDirectory.getFactory(PortalConfig.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      Object obj =
         uctx.unmarshalDocument(
            new FileInputStream("src/test/resources/portal/portal/classic/portlet-preferences.xml"), null);
      assertEquals(PortletPreferencesSet.class, obj.getClass());

      IMarshallingContext mctx = bfact.createMarshallingContext();
      mctx.setIndent(2);
      mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream("target/portlet-preferences.xml"));
      assertEquals(PortletPreferencesSet.class, obj.getClass());
   }
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

      assertEquals(PortletPreferencesSet.class, obj.getClass());
   }

   public void testPortletApplicationMapping() throws Exception
   {
      IBindingFactory bfact = BindingDirectory.getFactory(PortalConfig.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      Application<Portlet> app =
         (Application<Portlet>)uctx.unmarshalDocument(new FileInputStream(
            "src/test/resources/jibx/portlet-application.xml"), null);
      TransientApplicationState portletState = (TransientApplicationState)app.getState();
      assertNotNull(portletState);
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

        return SoapProtocol.SOAP1_1.getName();
    }
   
    protected Object configure(String path, String protocol, String reqtype, String[] rsptypes) {
        try {
            IBindingFactory fact = BindingDirectory.getFactory(Query.class);
            System.out.println("Connecting to service at " + path + " using protocol " + protocol);
            Protocol p = ProtocolDirectory.getProtocol(protocol);
            MessageOptions options = new MessageOptions();
            options.setOutMediaTypeCode(reqtype);
            options.setInMediaTypeCodes(rsptypes);
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

   }

   private Container toContainer(String xml) throws Exception
   {
      ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes());
      IBindingFactory bfact = BindingDirectory.getFactory(Container.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      return (Container)uctx.unmarshalDocument(is, null);
   }
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

    public static BindingElement readBinding(InputStream is, String fname,
        BindingElement contain, boolean precomp, ValidationContext vctx) throws JiBXException {
       
        // look up the binding factory
        String bindname = precomp ? "precomp" : "normal";
        IBindingFactory bfact =
            BindingDirectory.getFactory(bindname, "org.jibx.binding.model");
       
        // unmarshal document to construct objects
        IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
        uctx.setDocument(is, fname, null);
        uctx.pushObject(new UnmarshalWrapper(vctx, contain));
        BindingElement binding = new BindingElement();
        binding.setPrecompiled(precomp);
        ((IUnmarshallable)binding).unmarshal(uctx);
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

            mclas = TestSimpleStAX.class.getClassLoader().loadClass(mname);
        } catch (ClassNotFoundException ex) {
            System.err.println("Class " + mname + " not found");
            return false;
        }
        IBindingFactory bfact = BindingDirectory.getFactory(mclas);
       
        // unmarshal document to construct objects
        IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
        Object obj = uctx.unmarshalDocument(new FileInputStream(fin), null);
        if (!mclas.isInstance(obj)) {
            System.err.println("Unmarshalled result not expected type");
            return false;
        }
       
        // determine encoding of input document
        String enc = ((UnmarshallingContext)uctx).getInputEncoding();
        if (enc == null) {
            enc = "UTF-8";
        }
       
        // marshal root object back out to document in memory
        IMarshallingContext mctx = bfact.createMarshallingContext();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            XMLOutputFactory ofact = XMLOutputFactory.newInstance();
            XMLStreamWriter wrtr = ofact.createXMLStreamWriter(bos, enc);
            mctx.setXmlWriter(new StAXWriter(bfact.getNamespaces(), wrtr));
            mctx.marshalDocument(obj);
        } catch (XMLStreamException e) {
            throw new JiBXException("Error creating writer", e);
        }
       
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

                    new BindingGenerator(verbose, mixed, uri);
                BindingElement binding = generate.generate(names, abstracts,
                    customs, beans, enums, ignores);
               
                // marshal binding out to file
                IBindingFactory bfact =
                    BindingDirectory.getFactory("normal", BindingElement.class);
                IMarshallingContext mctx = bfact.createMarshallingContext();
                mctx.setIndent(2);
                mctx.marshalDocument(binding, "UTF-8", null,
                    new FileOutputStream(fname));
               
            } catch (JiBXException ex) {
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

     * @throws JiBXException on error creating marshaller
     */
    public WsdlWriter() throws JiBXException {
       
        // set the marshalling contexts
        IBindingFactory ifact = BindingDirectory.getFactory(Definitions.class);
        m_marshalContext = (MarshallingContext)ifact.createMarshallingContext();
       
        // initialize namespace URI to index map
        String[] nss = ifact.getNamespaces();
        s_namespaceMap = new StringIntSizedMap(nss.length);
        for (int i = 0; i < nss.length; i++) {
            s_namespaceMap.add(nss[i], i);
        }
       
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

    {
        /** Marshalling context for schema. */
        private final MarshallingContext m_schemaContext;
       
        public SchemaMarshaller() throws JiBXException {
            IBindingFactory ifact = BindingDirectory.getFactory(SchemaUtils.XS_PREFIX_BINDING, SchemaElement.class);
            m_schemaContext = (MarshallingContext)ifact.createMarshallingContext();
        }
View Full Code Here

Examples of org.jibx.runtime.IBindingFactory

        if (path == null) {
            m_global.setAddConstructors(true);
            m_global.setForceClasses(true);
            m_global.setMapAbstract(Boolean.TRUE);
        } else {
            IBindingFactory fact = BindingDirectory.getFactory(WsdlCustom.class);
            IUnmarshallingContext ictx = fact.createUnmarshallingContext();
            FileInputStream is = new FileInputStream(path);
            ictx.setDocument(is, null);
            ictx.setUserContext(vctx);
            ((IUnmarshallable)m_global).unmarshal(ictx);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.