Package org.jboss.marshalling

Examples of org.jboss.marshalling.Marshaller


    public void store(V obj) {
        File file = getFile(obj.getId());
        file.deleteOnExit();
        log.tracef("Storing state to %s", file);
        try {
            Marshaller marshaller = this.marshallerFactory.createMarshaller(this.configuration);
            FileOutputStream outputStream = null;
            try {
                outputStream = FOSAction.open(file);
                marshaller.start(Marshalling.createByteOutput(outputStream));
                try {
                    marshaller.writeObject(obj);
                    marshaller.finish();
                } finally {
                    marshaller.close();
                }
            } finally {
                safeClose(outputStream);
            }
        } catch (IOException e) {
View Full Code Here


                if (locator instanceof EJBHomeLocator) {
                    return (org.omg.CORBA.Object) ejbHome;
                } else if (locator instanceof StatelessEJBLocator) {
                    return beanReferenceFactory.createReference(beanRepositoryIds[0]);
                } else if (locator instanceof StatefulEJBLocator) {
                    final Marshaller marshaller = factory.createMarshaller(configuration);
                    final ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    marshaller.start(new OutputStreamByteOutput(stream));
                    marshaller.writeObject(((StatefulEJBLocator) locator).getSessionId());
                    marshaller.finish();
                    return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
                } else if (locator instanceof EntityEJBLocator) {
                    final Marshaller marshaller = factory.createMarshaller(configuration);
                    final ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    marshaller.start(new OutputStreamByteOutput(stream));
                    marshaller.writeObject(((EntityEJBLocator) locator).getPrimaryKey());
                    marshaller.finish();
                    return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
                }
                throw new RuntimeException("Unknown locator type " + locator);
            } else {
                throw new IllegalArgumentException("Provided locator " + locator + " was not for EJB " + ejbComponent);
View Full Code Here

        }

        FileOutputStream fileOutputStream = null;
        try {
            fileOutputStream = new FileOutputStream(file, false);
            final Marshaller marshaller = factory.createMarshaller(configuration);
            marshaller.start(new OutputStreamByteOutput(fileOutputStream));
            marshaller.writeObject(entity);
            marshaller.finish();
            fileOutputStream.flush();
            fileOutputStream.getFD().sync();
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
View Full Code Here

        protected void sendResponse(final OutputStream output) throws IOException {
            List<ModelUpdateResponse<?>> responses = new ArrayList<ModelUpdateResponse<?>>(updates.size());
            for(AbstractDomainModelUpdate<?> update : updates) {
                responses.add(processUpdate(update));
            }
            final Marshaller marshaller = getMarshaller();
            marshaller.start(createByteOutput(output));
            marshaller.writeByte(ServerManagerProtocol.PARAM_MODEL_UPDATE_RESPONSE_COUNT);
            marshaller.writeInt(responses.size());
            for(ModelUpdateResponse<?> response : responses) {
                marshaller.writeByte(ServerManagerProtocol.PARAM_MODEL_UPDATE_RESPONSE);
                marshaller.writeObject(response);
            }
            marshaller.finish();
        }
View Full Code Here

        }

        @Override
        protected void sendResponse(final OutputStream output) throws IOException {
            List<HostUpdateResult<?>> responses = serverManager.applyHostUpdates(updates);
            final Marshaller marshaller = getMarshaller();
            marshaller.start(createByteOutput(output));
            marshaller.writeByte(ServerManagerProtocol.PARAM_MODEL_UPDATE_RESPONSE_COUNT);
            marshaller.writeInt(responses.size());
            for(HostUpdateResult<?> response : responses) {
                marshaller.writeByte(ServerManagerProtocol.PARAM_MODEL_UPDATE_RESPONSE);
                marshaller.writeObject(response);
            }
            marshaller.finish();
        }
View Full Code Here


        processManagerClient.startProcess(serverProcessName);
        ServiceActivator serverManagerCommActivator = new ServerManagerCommServiceActivator(managementSocket);
        ServerStartTask startTask = new ServerStartTask(serverName, portOffset, Collections.<ServiceActivator>singletonList(serverManagerCommActivator), updateList);
        final Marshaller marshaller = MARSHALLER_FACTORY.createMarshaller(CONFIG);
        final OutputStream os = processManagerClient.sendStdin(serverProcessName);
        marshaller.start(Marshalling.createByteOutput(os));
        marshaller.writeObject(startTask);
        marshaller.finish();
        marshaller.close();
        os.close();

        setState(ServerState.STARTING);
    }
View Full Code Here

            return DomainServerProtocol.SERVER_MODEL_UPDATES_RESPONSE;
        }

        @Override
        protected void sendRequest(final int protocolVersion, final OutputStream output) throws IOException {
            final Marshaller marshaller = getMarshaller();
            marshaller.start(createByteOutput(output));
            marshaller.writeByte(DomainServerProtocol.PARAM_ALLOW_ROLLBACK);
            marshaller.writeBoolean(allowOverallRollback);
            marshaller.writeByte(DomainServerProtocol.PARAM_SERVER_MODEL_UPDATE_COUNT);
            marshaller.writeInt(updates.size());
            for (AbstractServerModelUpdate<?> update : updates) {
                marshaller.writeByte(DomainServerProtocol.PARAM_SERVER_MODEL_UPDATE);
                marshaller.writeObject(update);
            }
            marshaller.finish();
        }
View Full Code Here

        MarshallingConfiguration configuration = createMarshallingConfig();

        DecoderEmbedder<Object> decoder = new DecoderEmbedder<Object>(createDecoder(Integer.MAX_VALUE));

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
        marshaller.start(Marshalling.createByteOutput(bout));
        marshaller.writeObject(testObject);
        marshaller.finish();
        marshaller.close();

        byte[] testBytes = bout.toByteArray();

        decoder.offer(input(testBytes));
        assertTrue(decoder.finish());
View Full Code Here

        MarshallingConfiguration configuration = createMarshallingConfig();

        DecoderEmbedder<Object> decoder = new DecoderEmbedder<Object>(createDecoder(Integer.MAX_VALUE));

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
        marshaller.start(Marshalling.createByteOutput(bout));
        marshaller.writeObject(testObject);
        marshaller.finish();
        marshaller.close();

        byte[] testBytes = bout.toByteArray();

        ChannelBuffer buffer = input(testBytes);
        ChannelBuffer slice = buffer.readSlice(2);
View Full Code Here

        ChannelUpstreamHandler mDecoder = createDecoder(4);
        DecoderEmbedder<Object> decoder = new DecoderEmbedder<Object>(mDecoder);

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
        marshaller.start(Marshalling.createByteOutput(bout));
        marshaller.writeObject(testObject);
        marshaller.finish();
        marshaller.close();

        byte[] testBytes = bout.toByteArray();

        try {
            decoder.offer(input(testBytes));
View Full Code Here

TOP

Related Classes of org.jboss.marshalling.Marshaller

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.