Package org.jboss.marshalling

Examples of org.jboss.marshalling.MarshallingConfiguration


*
*/
public abstract class ReadWriteTest {
    public void run() throws Throwable {
        final MarshallerFactory factory = new RiverMarshallerFactory();
        final MarshallingConfiguration configuration = new MarshallingConfiguration();
        configure(configuration);
        final Marshaller marshaller = factory.createMarshaller(configuration);
        final ByteArrayOutputStream baos = new ByteArrayOutputStream(10240);
        marshaller.start(Marshalling.createByteOutput(baos));
        runWrite(marshaller);
View Full Code Here


                create(oosTestMarshallerProvider, serialTestUnmarshallerProvider),
                null
        );

        final Collection<Object[]> c = new ArrayList<Object[]>();
        final MarshallingConfiguration configuration = new MarshallingConfiguration();
        for (Pair<TestMarshallerProvider, TestUnmarshallerProvider> pair : marshallerProviderPairs) {
            if (pair == null) continue;
            // Add this combination
            c.add(new Object[] { pair.getA(), pair.getB(), configuration.clone() });
        }
        configuration.setClassResolver(new AbstractClassResolver() {
            protected ClassLoader getClassLoader() {
                return SimpleMarshallerTestFactory.class.getClassLoader();
            }

            public void annotateProxyClass(final Marshaller marshaller, final Class<?> proxyClass) throws IOException {
                marshaller.writeObject("Test One");
                marshaller.writeObject("Test Two");
            }

            public void annotateClass(final Marshaller marshaller, final Class<?> clazz) throws IOException {
                marshaller.writeObject("Test One");
                marshaller.writeObject("Test Two");
            }

            public Class<?> resolveProxyClass(final Unmarshaller unmarshaller, final String[] interfaces) throws IOException, ClassNotFoundException {
                assertEquals(unmarshaller.readObject(String.class), "Test One", "for proxy");
                assertEquals(unmarshaller.readObject(String.class), "Test Two", "for proxy");
                return super.resolveProxyClass(unmarshaller, interfaces);
            }

            public Class<?> resolveClass(final Unmarshaller unmarshaller, final String name, final long serialVersionUID) throws IOException, ClassNotFoundException {
                assertEquals(unmarshaller.readObject(String.class), "Test One", "for class " + name);
                assertEquals(unmarshaller.readObject(String.class), "Test Two", "for class " + name);
                return super.resolveClass(unmarshaller, name, serialVersionUID);
            }

            public String toString() {
                return "Test Class Resolver";
            }
        });
        for (Pair<TestMarshallerProvider, TestUnmarshallerProvider> pair : marshallerProviderPairs) {
            if (pair == null) continue;
            // Add this combination
            c.add(new Object[] { pair.getA(), pair.getB(), configuration.clone() });
        }

        return c.toArray(new Object[c.size()][]);
    }
View Full Code Here

        this.testUnmarshallerProvider = testUnmarshallerProvider;
        this.configuration = configuration;
    }

    public void runReadWriteTest(ReadWriteTest readWriteTest) throws Throwable {
        final MarshallingConfiguration readConfiguration = configuration.clone();
        readWriteTest.configureRead(readConfiguration);

        final ByteArrayOutputStream baos = new ByteArrayOutputStream(10240);
        final ByteOutput byteOutput = Marshalling.createByteOutput(baos);

        System.out.println("Read Configuration = " + readConfiguration);
        final Marshaller marshaller = testMarshallerProvider.create(readConfiguration, byteOutput);
        System.out.println("Marshaller = " + marshaller + " (version set to " + readConfiguration.getVersion() + ")");
        readWriteTest.runWrite(marshaller);
        marshaller.finish();
        final byte[] bytes = baos.toByteArray();

        final MarshallingConfiguration writeConfiguration = configuration.clone();
        readWriteTest.configureWrite(writeConfiguration);

        final ByteInput byteInput = Marshalling.createByteInput(new ByteArrayInputStream(bytes));
        System.out.println("Write Configuration = " + writeConfiguration);
        final Unmarshaller unmarshaller = testUnmarshallerProvider.create(writeConfiguration, byteInput);
        System.out.println("Unmarshaller = " + unmarshaller + " (version set to " + writeConfiguration.getVersion() + ")");
        readWriteTest.runRead(unmarshaller);
        unmarshaller.finish();
    }
View Full Code Here

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

   public AbstractJBossMarshaller() {
      // Class resolver now set when marshaller/unmarshaller will be created
      baseCfg = new MarshallingConfiguration();
      baseCfg.setCreator(new SunReflectiveCreator());
      baseCfg.setExceptionListener(new DebuggingExceptionListener());
      baseCfg.setClassExternalizerFactory(new SerializeWithExtFactory());
      baseCfg.setVersion(3);
   }
View Full Code Here

        final Unmarshaller unmarshaller;
        final ByteInput byteInput;
        final AsyncFuture<ServiceContainer> containerFuture;
        try {
            Module.registerURLStreamHandlerFactoryModule(Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("org.jboss.vfs")));
            final MarshallingConfiguration configuration = new MarshallingConfiguration();
            configuration.setVersion(2);
            configuration.setClassResolver(new SimpleClassResolver(DomainServerMain.class.getClassLoader()));
            unmarshaller = factory.createUnmarshaller(configuration);
            byteInput = Marshalling.createByteInput(initialInput);
            unmarshaller.start(byteInput);
            final ServerTask task = unmarshaller.readObject(ServerTask.class);
            unmarshaller.finish();
View Full Code Here

      }
   };

   public AbstractJBossMarshaller() {
      // Class resolver now set when marshaller/unmarshaller will be created
      baseCfg = new MarshallingConfiguration();
      baseCfg.setExternalizerCreator(new SunReflectiveCreator());
      baseCfg.setExceptionListener(new DebuggingExceptionListener());
      baseCfg.setClassExternalizerFactory(new SerializeWithExtFactory());
      baseCfg.setInstanceCount(DEF_INSTANCE_COUNT);
      baseCfg.setClassCount(DEF_CLASS_COUNT);
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);
     
      // ContextClassResolver provides same functionality as MarshalledValueInputStream
      configuration.setClassResolver(new ContextClassResolver());
View Full Code Here

    public synchronized void start(final StartContext startContext) throws StartException {

        try {
            final RiverMarshallerFactory factory = new RiverMarshallerFactory();
            final MarshallingConfiguration configuration = new MarshallingConfiguration();
            configuration.setClassResolver(ModularClassResolver.getInstance(serviceModuleLoaderInjectedValue.getValue()));
            this.configuration = configuration;
            this.factory = factory;


            // Should create a CORBA interface repository?
View Full Code Here

            FileInputStream inputStream = null;
            try {
                inputStream = FISAction.open(file);
                SimpleDataInput input = new SimpleDataInput(Marshalling.createByteInput(inputStream));
                int version = input.readInt();
                MarshallingConfiguration config = this.passivationManager.getMarshallingConfiguration(version);
                Unmarshaller unmarshaller = this.marshallerFactory.createUnmarshaller(config);
                unmarshaller.start(input);
                try {
                    V value = (V) unmarshaller.readObject();
                    unmarshaller.finish();
View Full Code Here

            try {
                outputStream = FOSAction.open(file);
                SimpleDataOutput output = new SimpleDataOutput(Marshalling.createByteOutput(outputStream));
                int version = this.passivationManager.getCurrentMarshallingVersion();
                output.writeInt(version);
                MarshallingConfiguration config = this.passivationManager.getMarshallingConfiguration(version);
                Marshaller marshaller = this.marshallerFactory.createMarshaller(config);
                marshaller.start(output);
                try {
                    marshaller.writeObject(obj);
                    marshaller.finish();
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.