Package org.jboss.marshalling

Examples of org.jboss.marshalling.Marshaller


            // session id byte length
            PackedInteger.writePackedInteger(dataOutputStream, sessionIdBytes.length);
            // write out the session id bytes
            dataOutputStream.write(sessionIdBytes);
            // now marshal the hard affinity associated with this session
            final Marshaller marshaller = this.prepareForMarshalling(this.marshallerFactory, dataOutputStream);
            marshaller.writeObject(hardAffinity);

            // finish marshalling
            marshaller.finish();

        } finally {
            channelAssociation.releaseChannelMessageOutputStream(messageOutputStream);
            dataOutputStream.close();
        }
View Full Code Here


    byte[] getBytes() throws IOException {
        byte[] bytes = this.bytes;
        if (bytes != null) return bytes;
        if (this.object == null) return null;
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        Marshaller marshaller = this.context.createMarshaller();
        try {
            marshaller.start(Marshalling.createByteOutput(output));
            // Workaround for AS7-2496
            ClassLoader currentLoader = null;
            ClassLoader contextLoader = context.getContextClassLoader();
            if (contextLoader != null) {
                currentLoader = getCurrentThreadContextClassLoader();
                setCurrentThreadContextClassLoader(contextLoader);
            }
            try {
                marshaller.writeObject(this.object);
            } finally {
                if (contextLoader != null) {
                    setCurrentThreadContextClassLoader(currentLoader);
                }
            }
            marshaller.finish();
            return output.toByteArray();
        } finally {
            marshaller.close();
        }
    }
View Full Code Here

            final List<ModelNode> bootUpdates = bootConfiguration.getBootUpdates();
            final Map<String, String> launchProperties = parseLaunchProperties(bootConfiguration.getServerLaunchCommand());
            // Send std.in
            final ServiceActivator hostControllerCommActivator = HostCommunicationServices.createServerCommunicationActivator(managementSocket, serverName, serverProcessName, authKey, bootConfiguration.isManagementSubsystemEndpoint());
            final ServerStartTask startTask = new ServerStartTask(hostControllerName, serverName, 0, Collections.<ServiceActivator>singletonList(hostControllerCommActivator), bootUpdates, launchProperties);
            final Marshaller marshaller = MARSHALLER_FACTORY.createMarshaller(CONFIG);
            final OutputStream os = processControllerClient.sendStdin(serverProcessName);
            marshaller.start(Marshalling.createByteOutput(os));
            marshaller.writeObject(startTask);
            marshaller.finish();
            marshaller.close();
            os.close();
        }
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

                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();
                } finally {
                    marshaller.close();
                }
            } finally {
                safeClose(outputStream);
            }
        } catch (IOException e) {
View Full Code Here

        }

        @Override
        protected void sendResponse(final OutputStream output) throws IOException {
            List<UpdateResultHandlerResponse<?>> responses = processUpdates();
            final Marshaller marshaller = getMarshaller();
            marshaller.start(createByteOutput(output));
            marshaller.writeByte(DomainServerProtocol.PARAM_SERVER_MODEL_UPDATE_RESPONSE_COUNT);
            marshaller.writeInt(responses.size());
            for (UpdateResultHandlerResponse<?> response : responses) {
                marshaller.writeByte(DomainServerProtocol.PARAM_SERVER_MODEL_UPDATE_RESPONSE);
                marshaller.writeObject(response);
            }
            marshaller.finish();
        }
View Full Code Here

        @Override
        protected void sendResponse(final OutputStream output) throws IOException {
            ServerModel sm = serverController.getValue().getServerModel();

            final Marshaller marshaller = getMarshaller();
            marshaller.start(createByteOutput(output));
            marshaller.writeByte(DomainServerProtocol.RETURN_SERVER_MODEL);
            marshaller.writeObject(sm);
            marshaller.finish();
        }
View Full Code Here

    byte[] getBytes() throws IOException {
        byte[] bytes = this.bytes;
        if (bytes != null) return bytes;
        if (this.object == null) return null;
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        Marshaller marshaller = this.context.createMarshaller();
        try {
            marshaller.start(Marshalling.createByteOutput(output));
            marshaller.writeObject(this.object);
            marshaller.finish();
            return output.toByteArray();
        } finally {
            marshaller.close();
        }
    }
View Full Code Here

        final File file = fileName(entity.getTimedObjectId(), entity.getId());

        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

                if (locator instanceof EJBHomeLocator) {
                    return 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("Unkown locator type " + locator);
            } else {
                throw new IllegalArgumentException("Provided locator " + locator + " was not for EJB " + ejbComponent);
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.