Package org.jboss.marshalling

Examples of org.jboss.marshalling.MarshallingConfiguration


    public void testMarshalling() throws IOException, ClassNotFoundException {
        @SuppressWarnings("RedundantStringConstructorCall")
        String testObject = new String("test");

        final MarshallerFactory marshallerFactory = createMarshallerFactory();
        final MarshallingConfiguration configuration = createMarshallingConfig();

        EncoderEmbedder<ChannelBuffer> encoder = new EncoderEmbedder<ChannelBuffer>(createEncoder());

        encoder.offer(testObject);
        assertTrue(encoder.finish());
View Full Code Here


      } catch (Exception e) {
         throw new CacheException("Unable to load JBoss Marshalling marshaller factory " + DEFAULT_MARSHALLER_FACTORY, e);
      }

      objectTable = createCustomObjectTable(cmdFactory, ispnMarshaller);
      configuration = new MarshallingConfiguration();
      configuration.setCreator(new SunReflectiveCreator());
      configuration.setObjectTable(objectTable);
      configuration.setExceptionListener(new DebuggingExceptionListener());
      // ContextClassResolver provides same functionality as MarshalledValueInputStream
      configuration.setClassResolver(new ContextClassResolver());
View Full Code Here

     *
     * @see org.jboss.web.tomcat.service.session.distributedcache.spi.SessionAttributeMarshallerFactory#createMarshaller(org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager)
     */
    @Override
    public SessionAttributeMarshaller createMarshaller(final LocalDistributableSessionManager manager) {
        MarshallingConfiguration configuration = new MarshallingConfiguration();
        AbstractClassResolver resolver = new AbstractClassResolver() {
            @Override
            protected ClassLoader getClassLoader() {
                return manager.getApplicationClassLoader();
            }
        };
        configuration.setClassResolver(resolver);
        return new SessionAttributeMarshallerImpl(new MarshallingContext(this.factory, configuration));
    }
View Full Code Here

     *
     * @see org.jboss.web.tomcat.service.session.distributedcache.spi.SessionAttributeMarshallerFactory#createMarshaller(org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager)
     */
    @Override
    public SessionAttributeMarshaller createMarshaller(LocalDistributableSessionManager manager) {
        MarshallingConfiguration configuration = new MarshallingConfiguration();
        ApplicationClassResolver resolver = new ApplicationClassResolver(manager);
        configuration.setClassResolver(resolver);
        return new SessionAttributeMarshallerImpl(new MarshallingContext(this.factory, configuration));
    }
View Full Code Here

                for (Map.Entry<String, StateTransferProvider> entry: stateProviders.entrySet()) {
                    String serviceName = entry.getKey();
                    out.writeUTF(serviceName);
                    StateTransferProvider provider = entry.getValue();

                    Marshaller marshaller = marshallerFactory.createMarshaller(new MarshallingConfiguration());
                    ByteArrayOutputStream output = new ByteArrayOutputStream();
                    marshaller.start(Marshalling.createByteOutput(output));
                    marshaller.writeObject(provider.getCurrentState());
                    marshaller.close();
                    byte[] bytes = output.toByteArray();
View Full Code Here

            };
        }

        @Override
        protected void setState(InputStream is) throws IOException, ClassNotFoundException {
            MarshallingConfiguration config = new MarshallingConfiguration();
            config.setClassResolver(new SimpleClassResolver(getStateTransferClassLoader()));
            Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(config);
            unmarshaller.start(Marshalling.createByteInput(is));
            this.state = unmarshaller.readObject(Serializable.class);
            unmarshaller.close();
        }
View Full Code Here

     *
     * @see org.jboss.web.tomcat.service.session.distributedcache.spi.SessionAttributeMarshallerFactory#createMarshaller(org.jboss.web.tomcat.service.session.distributedcache.spi.LocalDistributableSessionManager)
     */
    @Override
    public SessionAttributeMarshaller createMarshaller(LocalDistributableSessionManager manager) {
        MarshallingConfiguration configuration = new MarshallingConfiguration();
        configuration.setClassResolver(manager.getApplicationClassResolver());
        configuration.setSerializedCreator(new SunReflectiveCreator());
        configuration.setExternalizerCreator(new ReflectiveCreator());
        return new SessionAttributeMarshallerImpl(new MarshallingContext(this.factory, configuration));
    }
View Full Code Here

   private final ConcurrentMap<Class, Boolean> isMarshallableMap = new ConcurrentWeakKeyHashMap<Class, Boolean>();

   public GenericJBossMarshaller() {
      factory = Marshalling.getMarshallerFactory("river", Marshalling.class.getClassLoader());

      configuration = new MarshallingConfiguration();
      configuration.setCreator(new SunReflectiveCreator());
      configuration.setExceptionListener(new DebuggingExceptionListener());
      // ContextClassResolver provides same functionality as MarshalledValueInputStream
      configuration.setClassResolver(new DefaultContextClassResolver(defaultCl));
      configuration.setClassExternalizerFactory(new SerializeWithExtFactory());
View Full Code Here

              new MarshallerFactoryTestUnmarshallerProvider(new RiverMarshallerFactory(), 3),
              getOneTestMarshallingConfiguration());
    }

    private static MarshallingConfiguration getOneTestMarshallingConfiguration() {
        final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration();
        marshallingConfiguration.setVersion(3);
        return marshallingConfiguration;
    }
View Full Code Here

        }
        TestExternalizerFactory externalizerFactory = new TestExternalizerFactory();
        Object o = new TestExternalizableInt(7);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ByteOutput byteOutput = Marshalling.createByteOutput(baos);
        MarshallingConfiguration config = configuration.clone();
        config.setClassExternalizerFactory(externalizerFactory);
        Marshaller marshaller = testMarshallerProvider.create(config, byteOutput);
//        if (marshaller instanceof SerialMarshaller) {
//            throw new SkipException("TODO: Known issue - see JBMAR-50");
//        }
        marshaller.writeObject(o);
        marshaller.writeObject(o);
        marshaller.flush();
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ByteInput byteInput = Marshalling.createByteInput(bais);
        config = configuration.clone();
        config.setClassExternalizerFactory(externalizerFactory);
        Unmarshaller unmarshaller = testUnmarshallerProvider.create(config, byteInput);
        Object o2 = unmarshaller.readObject();
        assertEquals(o, o2);
        Object o3 = unmarshaller.readObject();
        assertSame(o2, o3);
View Full Code Here

TOP

Related Classes of org.jboss.marshalling.MarshallingConfiguration

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.