Package org.jboss.marshalling

Examples of org.jboss.marshalling.Marshaller


  static <T, E extends AdvancedExternalizer<T>> ExternalizerTestHelper<T, E> getInstance(E externalizer) {
    return new ExternalizerTestHelper<T, E>( externalizer );
  }

  byte[] marshall(T object) throws Exception {
    Marshaller marshaller = getMarshaller();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    try {
      marshaller.start( Marshalling.createByteOutput( baos ) );
      externalizer.writeObject( marshaller, object );
      marshaller.finish();
    }
    finally {
      try {
        baos.close();
      }
View Full Code Here


  private Marshaller getMarshaller() throws IOException {
    MarshallingConfiguration configuration = new MarshallingConfiguration();
    configuration.setVersion( 3 );

    Marshaller marshaller = marshallerFactory.createMarshaller( configuration );
    return marshaller;
  }
View Full Code Here

            return StandaloneClientProtocol.GET_SERVER_MODEL_RESPONSE;
        }

        @Override
        protected void sendResponse(final OutputStream outputStream) throws IOException {
            final Marshaller marshaller = getMarshaller();
            marshaller.start(createByteOutput(outputStream));
            marshaller.writeByte(StandaloneClientProtocol.PARAM_SERVER_MODEL);
            marshaller.writeObject(serverController.getServerModel());
            marshaller.finish();
        }
View Full Code Here

                latch.await();
            } catch(Exception e) {
                throw new ManagementException("failed to execute updates", e);
            }

            final Marshaller marshaller = getMarshaller();
            marshaller.start(createByteOutput(output));
            marshaller.writeByte(StandaloneClientProtocol.PARAM_APPLY_UPDATES_RESULT_COUNT);
            marshaller.writeInt(results.size());
            for(ResultHandler<?, Void> result : results) {
                marshaller.writeByte(StandaloneClientProtocol.PARAM_APPLY_UPDATE_RESULT);
                if(result.failure != null) {
                    marshaller.writeByte(StandaloneClientProtocol.PARAM_APPLY_UPDATE_RESULT_EXCEPTION);
                    marshaller.writeObject(result.failure);
                } else {
                    marshaller.writeByte(StandaloneClientProtocol.APPLY_UPDATE_RESULT_SERVER_MODEL_SUCCESS);
                    marshaller.writeObject(result.result);
                }
            }
            marshaller.finish();
            if(! preventShutdown && requiresRestart) {
                executor.execute(new Runnable() {
                     public void run() {
                         // TODO proper restart handling
                         serverController.shutdown();
View Full Code Here

        }

        @Override
        protected void sendResponse(final OutputStream output) throws IOException {
            final Future<ServerDeploymentPlanResult> result = deploymentManager.execute(deploymentPlan);
            final Marshaller marshaller = getMarshaller();
            marshaller.start(createByteOutput(output));
            marshaller.writeByte(StandaloneClientProtocol.PARAM_DEPLOYMENT_PLAN_RESULT);
            try {
                marshaller.writeObject(result.get());
            } catch (Exception e) {
                throw new ManagementException("Failed get deployment plan result.", e);
            }
            marshaller.finish();
        }
View Full Code Here

            final List<ModelNode> bootUpdates = bootConfiguration.getBootUpdates();

            processControllerClient.startProcess(serverProcessName);
            ServiceActivator hostControllerCommActivator = HostCommunicationServices.createServerCommuncationActivator(managementSocket, serverName, serverProcessName, authKey, bootConfiguration.isManagementSubsystemEndpoint());
            ServerStartTask startTask = new ServerStartTask(serverName, 0, Collections.<ServiceActivator>singletonList(hostControllerCommActivator), bootUpdates);
            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();

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

            // Get the standalone boot updates
            final List<ModelNode> bootUpdates = bootConfiguration.getBootUpdates();
            // Send std.in
            final ServiceActivator hostControllerCommActivator = HostCommunicationServices.createServerCommuncationActivator(managementSocket, serverName, serverProcessName, authKey, bootConfiguration.isManagementSubsystemEndpoint());
            final ServerStartTask startTask = new ServerStartTask(hostControllerName, serverName, 0, Collections.<ServiceActivator>singletonList(hostControllerCommActivator), bootUpdates);
            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

                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 MESSAGES.unknownEJBLocatorType(locator);
            } else {
                throw MESSAGES.incorrectEJBLocatorForBean(locator, ejbComponent.getComponentName());
View Full Code Here

            // write the header
            outputStream.write(HEADER_INVOCATION_EXCEPTION);
            // write the invocation id
            outputStream.writeShort(invocationId);
            // write out the exception
            final Marshaller marshaller = this.prepareForMarshalling(marshallerFactory, outputStream);
            marshaller.writeObject(t);
            // write the attachments
            this.writeAttachments(marshaller, attachments);
            // finish marshalling
            marshaller.finish();
        } finally {
            channelAssociation.releaseChannelMessageOutputStream(messageOutputStream);
            outputStream.close();
        }
    }
View Full Code Here

            // write invocation response header
            outputStream.write(HEADER_METHOD_INVOCATION_RESPONSE);
            // write the invocation id
            outputStream.writeShort(invocationId);
            // write out the result
            final Marshaller marshaller = this.prepareForMarshalling(this.marshallerFactory, outputStream);
            marshaller.writeObject(result);
            // write the attachments
            this.writeAttachments(marshaller, attachments);
            // finish marshalling
            marshaller.finish();
        } finally {
            channelAssociation.releaseChannelMessageOutputStream(messageOutputStream);
            outputStream.close();
        }
    }
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.