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

org.nakedobjects.nos.remote.command.pipe.PipedServer Maven / Gradle / Ivy

There is a newer version: 3.0.3
Show newest version
package org.nakedobjects.nos.remote.command.pipe;

import org.apache.log4j.Logger;
import org.nakedobjects.nof.reflect.remote.data.Distribution;
import org.nakedobjects.nos.remote.command.Request;
import org.nakedobjects.nos.remote.command.Response;


public class PipedServer {
    private static final Logger LOG = Logger.getLogger(PipedServer.class);
    private Distribution facade;
    private PipedConnection communication;

    public synchronized void run() {
        while (true) {
            Request request = communication.getRequest();
            LOG.debug("client request: " + request);
            try {
                request.execute(facade);
                Response response = new Response(request);
                LOG.debug("server response: " + response);
                communication.setResponse(response);
            } catch (RuntimeException e) {
                communication.setException(e);
            } catch (Exception e) {
                LOG.error("failure during request", e);
            }
        }
    }

    public void setConnection(final PipedConnection communication) {
        this.communication = communication;
    }

    public void setFacade(final Distribution facade) {
        this.facade = facade;
    }
}
// Copyright (c) Naked Objects Group Ltd.




© 2015 - 2025 Weber Informatics LLC | Privacy Policy