Package org.jibx.runtime

Examples of org.jibx.runtime.IBindingFactory


    private Map createServiceDefinitions(HttpServlet servlet) throws UnavailableException {

        // set up JiBX unmarshalling for service configuration files
        IUnmarshallingContext ctx = null;
        try {
            IBindingFactory factory = BindingDirectory.getFactory(ServiceDefinition.class);
            ctx = factory.createUnmarshallingContext();
        } catch (JiBXException e) {
            logger.error("Unable to initialize unmarshalling", e);
            throw new UnavailableException("Unable to initialize unmarshalling. \n" + getErrorDetails(e));
        }
View Full Code Here


     * @return binding factory
     * @throws WsBindingException if unable to find binding in the directory
     * @throws WsConfigurationException if either package or binding name are not set
     */
    public IBindingFactory getBindingFactory() throws WsBindingException, WsConfigurationException {
        IBindingFactory factory = null;

        if (m_bindingName == null || m_packageName == null) {
            throw new WsConfigurationException(
                "Binding definition lookup error: both binding and package name must be set.");
        }
View Full Code Here

     *
     * @param clazz the target class
     * @throws WsBindingException on any error in finding or accessing factory, or creating unmarshaller
     */
    public UnmarshallingPayloadReader(Class clazz) throws WsBindingException {
        IBindingFactory factory;
        try {
            factory = BindingDirectory.getFactory(clazz);
        } catch (JiBXException e) {
            throw new WsBindingException("Error accessing binding.", e);
        }
View Full Code Here

     * @param bindingName binding name
     * @param packageName target package for binding
     * @throws WsBindingException on any error in finding or accessing factory, or creating unmarshaller
     */
    public UnmarshallingPayloadReader(String bindingName, String packageName) throws WsBindingException {
        IBindingFactory factory;
        try {
            factory = BindingDirectory.getFactory(bindingName, packageName);
        } catch (JiBXException e) {
            throw new WsBindingException("Error accessing binding.", e);
        }
View Full Code Here

     *
     * @param clazz the target class
     * @throws WsBindingException on any error in finding or accessing factory, or creating marshaller
     */
    public MarshallingPayloadWriter(Class clazz) throws WsBindingException {
        IBindingFactory factory;
        try {
            factory = BindingDirectory.getFactory(clazz);
        } catch (JiBXException e) {
            throw new WsBindingException("Error accessing binding.", e);
        }
View Full Code Here

     * @param bindingName binding name
     * @param packageName target package for binding
     * @throws WsBindingException on any error in finding or accessing factory, or creating marshaller
     */
    public MarshallingPayloadWriter(String bindingName, String packageName) throws WsBindingException {
        IBindingFactory factory;
        try {
            factory = BindingDirectory.getFactory(bindingName, packageName);
        } catch (JiBXException e) {
            throw new WsBindingException("Error accessing binding.", e);
        }
View Full Code Here

     * @param inCtx inbound message context
     * @param outCtx outbound message context
     * @throws WsBindingException on error creating handlers
     */
    protected void createBodyHandlers(InContext inCtx, OutContext outCtx) throws WsBindingException {
        IBindingFactory outBodyBindingFactory = getOutBodyBindingFactory();
        if (outBodyBindingFactory != null) {
            outCtx.setBodyWriter(new MarshallingPayloadWriter(outBodyBindingFactory));
        }
   
        IBindingFactory inBodyBindingFactory = getInBodyBindingFactory();
        if (inBodyBindingFactory != null) {
            inCtx.setBodyReader(new UnmarshallingPayloadReader(inBodyBindingFactory));
        }
    }
View Full Code Here

   }

   public void testPageSetMapping() throws Exception
   {
      IBindingFactory bfact = BindingDirectory.getFactory(PageSet.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      Object obj =
         uctx.unmarshalDocument(new FileInputStream("src/test/resources/portal/portal/classic/pages.xml"), null);
      assertEquals(Page.PageSet.class, obj.getClass());
   }
View Full Code Here

      assertEquals(Page.PageSet.class, obj.getClass());
   }

   public void testPortalConfigMapping() throws Exception
   {
      IBindingFactory bfact = BindingDirectory.getFactory(PortalConfig.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      Object obj =
         uctx.unmarshalDocument(new FileInputStream("src/test/resources/portal/portal/classic/portal.xml"), null);
      assertEquals(PortalConfig.class, obj.getClass());
   }
View Full Code Here

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

   public void testNavigationMapping() throws Exception
   {
      IBindingFactory bfact = BindingDirectory.getFactory(PageNavigation.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      Object obj =
         uctx.unmarshalDocument(new FileInputStream("src/test/resources/portal/portal/classic/navigation.xml"), null);
      assertEquals(PageNavigation.class, obj.getClass());

      IMarshallingContext mctx = bfact.createMarshallingContext();
      mctx.setIndent(2);
      mctx.marshalDocument(obj, "UTF-8", null, new FileOutputStream("target/navigation.xml"));

      obj = uctx.unmarshalDocument(new FileInputStream("target/navigation.xml"), null);
      assertEquals(PageNavigation.class, obj.getClass());
View Full Code Here

TOP

Related Classes of org.jibx.runtime.IBindingFactory

Copyright © 2018 www.massapicom. 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.