Package net.sf.antcontrib.antserver

Examples of net.sf.antcontrib.antserver.Response


                    command.getContentLength(),
                    os,
                    true);
        }

        Response response = null;

        try
        {
            // Read the response object
            response = (Response) ois.readObject();
            project.log("Received Response: " + response,
                    Project.MSG_DEBUG);
            if (response.getContentLength() != 0)
            {
                command.respond(project,
                        response.getContentLength(),
                        is);
            }
        }
        catch (ClassNotFoundException e)
        {
View Full Code Here


                client.connect();

                e = commands.elements();
                c = null;
                Response r = null;
                Document d = null;
                boolean keepGoing = true;
                while (e.hasMoreElements() && keepGoing)
                {
                    c = (Command)e.nextElement();
                    r = client.sendCommand(c);
                    if (! r.isSucceeded())
                    {
                        failCount++;
                        log("Command caused a build failure:" + c,
                                Project.MSG_ERR);
                        log(r.getErrorMessage(),
                                Project.MSG_ERR);
                        log(r.getErrorStackTrace(),
                                Project.MSG_DEBUG);
                        if (! persistant)
                            keepGoing = false;
                    }

                    try
                    {
                        ByteArrayInputStream bais =
                                new ByteArrayInputStream(r.getResultsXml().getBytes());
                        d = db.parse(bais);
                        NodeList nl = d.getElementsByTagName("target");
                        int len = nl.getLength();
                        Element element = null;
                        for (int i=0;i<len;i++)
View Full Code Here

                    command.getContentLength(),
                    os,
                    true);
        }

        Response response = null;

        try
        {
            // Read the response object
            response = (Response) ois.readObject();
            project.log("Received Response: " + response,
                    Project.MSG_DEBUG);
            if (response.getContentLength() != 0)
            {
                command.respond(project,
                        response.getContentLength(),
                        is);
            }
        }
        catch (ClassNotFoundException e)
        {
View Full Code Here

                client.connect();

                e = commands.elements();
                c = null;
                Response r = null;
                Document d = null;
                boolean keepGoing = true;
                while (e.hasMoreElements() && keepGoing)
                {
                    c = (Command)e.nextElement();
                    r = client.sendCommand(c);
                    if (! r.isSucceeded())
                    {
                        failCount++;
                        log("Command caused a build failure:" + c,
                                Project.MSG_ERR);
                        if (! persistant)
                            keepGoing = false;
                    }

                    try
                    {
                        ByteArrayInputStream bais =
                                new ByteArrayInputStream(r.getResultsXml().getBytes());
                        d = db.parse(bais);
                        NodeList nl = d.getElementsByTagName("target");
                        int len = nl.getLength();
                        Element element = null;
                        for (int i=0;i<len;i++)
View Full Code Here

            ObjectInputStream ois = new ObjectInputStream(is);
            ObjectOutputStream oos = new ObjectOutputStream(os);

            // Write the initial response object so that the
            // object stream is initialized
            oos.writeObject(new Response());

            boolean disconnect = false;
            Command inputCommand = null;
            Response response = null;

            while (! disconnect)
            {
                task.getProject().log("Reading command object.",
                        Project.MSG_DEBUG);

                inputCommand = (Command) ois.readObject();

                task.getProject().log("Executing command object: " + inputCommand,
                        Project.MSG_DEBUG);

                response = new Response();

                try
                {
                    cbl = new ConnectionBuildListener();
                    task.getProject().addBuildListener(cbl);

                    inputCommand.execute(task.getProject(),
                            inputCommand.getContentLength(),
                            is);

                    response.setSucceeded(true);
                }
                catch (Throwable t)
                {
                    response.setSucceeded(false);
                    response.setThrowable(t);
                }
                finally
                {
                    if (cbl != null)
                        task.getProject().removeBuildListener(cbl);
                }

                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                XMLSerializer serial = new XMLSerializer();
                OutputFormat fmt = new OutputFormat();
                fmt.setOmitDocumentType(true);
                fmt.setOmitXMLDeclaration(false);
                serial.setOutputFormat(fmt);
                serial.setOutputByteStream(baos);
                serial.serialize(cbl.getDocument());
                response.setResultsXml(baos.toString());

                task.getProject().log("Executed command object: " + inputCommand,
                        Project.MSG_DEBUG);

                task.getProject().log("Sending response: " + response,
                        Project.MSG_DEBUG);

                response.setContentLength(inputCommand.getContentLength());

                oos.writeObject(response);

                if (inputCommand.getResponseContentLength() != 0)
                {
View Full Code Here

TOP

Related Classes of net.sf.antcontrib.antserver.Response

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.