Package net.sf.antcontrib.antserver

Examples of net.sf.antcontrib.antserver.Command



    public void execute()
    {
        Enumeration e = commands.elements();
        Command c = null;
        while (e.hasMoreElements())
        {
            c = (Command)e.nextElement();
            c.validate(getProject());
        }

        Client client = new Client(getProject(), machine, port);

        try
View Full Code Here



    public void execute()
    {
        Enumeration e = commands.elements();
        Command c = null;
        while (e.hasMoreElements())
        {
            c = (Command)e.nextElement();
            c.validate(getProject());
        }

        Client client = new Client(getProject(), machine, port);

        try
View Full Code Here

            // 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)
                {
                    Util.transferBytes(inputCommand.getReponseContentStream(),
                            inputCommand.getResponseContentLength(),
                            os,
                            true);
                }

                if (inputCommand instanceof DisconnectCommand)
View Full Code Here

TOP

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

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.