All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nakedobjects.plugins.xstream.server.XStreamOverSocketsViewer Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package org.nakedobjects.plugins.xstream.server;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import org.nakedobjects.plugins.xstream.shared.XStreamMarshaller;
import org.nakedobjects.remoting.facade.ServerFacade;
import org.nakedobjects.remoting.protocol.encoding.internal.ObjectEncoderDecoder;
import org.nakedobjects.remoting.server.ServerConnection;
import org.nakedobjects.remoting.server.ServerConnectionDefault;
import org.nakedobjects.remoting.server.SocketsViewerAbstract;
import org.nakedobjects.remoting.transport.ConnectionException;
import org.nakedobjects.remoting.transport.simple.SimpleTransport;


public class XStreamOverSocketsViewer extends SocketsViewerAbstract {
	
    public XStreamOverSocketsViewer(ObjectEncoderDecoder objectEncoderDecoder) {
    	super(objectEncoderDecoder);
	}

	@Override
    protected ServerConnection createServerConnection(
            final InputStream input,
            final OutputStream output,
            final ServerFacade distribution) {
    	SimpleTransport transport = new SimpleTransport(getConfiguration(), input, output);
        XStreamMarshaller serverMarshaller = new XStreamMarshaller(getConfiguration(), transport);
        try {
			serverMarshaller.connect();
        } catch (IOException e) {
            throw new ConnectionException(e);
        }
        return new ServerConnectionDefault(distribution, serverMarshaller);
    }
}

// Copyright (c) Naked Objects Group Ltd.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy