[jboss-cvs] JBoss Profiler SVN: r442 - in branches/JBossProfiler2: doc and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun May 11 11:30:57 EDT 2008
Author: jesper.pedersen
Date: 2008-05-11 11:30:56 -0400 (Sun, 11 May 2008)
New Revision: 442
Added:
branches/JBossProfiler2/src/etc/ant-manifest.mf
branches/JBossProfiler2/src/main/org/jboss/profiler/ant/
branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AbstractTask.java
branches/JBossProfiler2/src/main/org/jboss/profiler/ant/DisableProfilerTask.java
branches/JBossProfiler2/src/main/org/jboss/profiler/ant/EnableProfilerTask.java
branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StartProfilerTask.java
branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StopProfilerTask.java
branches/JBossProfiler2/src/main/org/jboss/profiler/ant/package.html
Modified:
branches/JBossProfiler2/build.xml
branches/JBossProfiler2/doc/README.txt
Log:
Initial Ant tasks
Modified: branches/JBossProfiler2/build.xml
===================================================================
--- branches/JBossProfiler2/build.xml 2008-05-11 14:45:26 UTC (rev 441)
+++ branches/JBossProfiler2/build.xml 2008-05-11 15:30:56 UTC (rev 442)
@@ -17,6 +17,7 @@
<property name="type" value="CR9"/>
<property name="jboss-profiler.jar" value="jboss-profiler.jar"/>
+ <property name="jboss-profiler-ant.jar" value="jboss-profiler-ant.jar"/>
<property name="jboss-profiler-connectors.jar" value="jboss-profiler-connectors.jar"/>
<property name="jboss-profiler-client.jar" value="jboss-profiler-client.jar"/>
<property name="jboss-profiler-plugins.jar" value="jboss-profiler-plugins.jar"/>
@@ -86,6 +87,30 @@
</target>
<!-- =================================================================== -->
+ <!-- Ant -->
+ <!-- =================================================================== -->
+ <target name="ant" depends="prepare">
+ <delete dir="${build.dir}"/>
+ <mkdir dir="${build.dir}"/>
+ <javac
+ destdir="${build.dir}"
+ classpathref="class.path"
+ debug="on"
+ deprecation="on"
+ optimize="off"
+ source="1.5"
+ target="1.5"
+ >
+ <src path="${src.main.dir}"/>
+ </javac>
+ <jar destfile="${dist.dir}/${jboss-profiler-ant.jar}"
+ basedir="${build.dir}"
+ manifest="${etc.dir}/ant-manifest.mf"
+ includes="org/jboss/profiler/ant/**,org/jboss/profiler/shared/**"
+ excludes="**/*.java"/>
+ </target>
+
+ <!-- =================================================================== -->
<!-- Connectors -->
<!-- =================================================================== -->
<target name="connectors" depends="prepare">
@@ -253,7 +278,7 @@
<!-- =================================================================== -->
<!-- Dist -->
<!-- =================================================================== -->
- <target name="dist" depends="agent,connectors,client,plugins,test,sar">
+ <target name="dist" depends="agent,connectors,ant,client,plugins,test,sar">
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
Modified: branches/JBossProfiler2/doc/README.txt
===================================================================
--- branches/JBossProfiler2/doc/README.txt 2008-05-11 14:45:26 UTC (rev 441)
+++ branches/JBossProfiler2/doc/README.txt 2008-05-11 15:30:56 UTC (rev 442)
@@ -279,6 +279,28 @@
Warning: The jobs override the current settings used in agent.
+Ant tasks:
+----------
+The jboss-profiler-ant.jar file contains Ant tasks for the JBoss Profiler.
+
+The following tasks exists:
+
+ <taskdef name="enableprofiler" classname="org.jboss.profiler.ant.EnableProfilerTask"/>
+ <taskdef name="disableprofiler" classname="org.jboss.profiler.ant.DisableProfilerTask"/>
+ <taskdef name="startprofiler" classname="org.jboss.profiler.ant.StartProfilerTask"/>
+ <taskdef name="stopprofiler" classname="org.jboss.profiler.ant.StopProfilerTask"/>
+
+All tasks have the following attributes in common:
+
+ protocol - The protocol used for connection (socket, rmi, http) (default: socket)
+ host - The host name (default: localhost)
+ port - The port number (default: 5400)
+
+Example:
+ <startprofiler protocol="socket"
+ host="localhost"
+ port="5400"/>
+
Third party libraries:
----------------------
The following libraries are needed
Added: branches/JBossProfiler2/src/etc/ant-manifest.mf
===================================================================
--- branches/JBossProfiler2/src/etc/ant-manifest.mf (rev 0)
+++ branches/JBossProfiler2/src/etc/ant-manifest.mf 2008-05-11 15:30:56 UTC (rev 442)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Class-Path: jboss-profiler-ant.jar log4j.jar jboss-remoting.jar jboss-common.jar concurrent.jar
Added: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AbstractTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AbstractTask.java (rev 0)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/AbstractTask.java 2008-05-11 15:30:56 UTC (rev 442)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profiler.ant;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * The abstract Ant task
+ * @author Jesper Pedersen <jesper.pedersen at jboss.org>
+ */
+public abstract class AbstractTask extends Task {
+
+ /** Protocol */
+ private String protocol;
+
+ /** Host */
+ private String host;
+
+ /** Port */
+ private int port;
+
+ /**
+ * Constructor
+ */
+ public AbstractTask() {
+ protocol = "socket";
+ host = "localhost";
+ port = 5400;
+ }
+
+ /**
+ * Get the protocol
+ * @return The protocol
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ * Set the protocol
+ * @param p The protocol
+ */
+ public void setProtocol(String p) {
+ protocol = p;
+ }
+
+ /**
+ * Get the host
+ * @return The host
+ */
+ public String getHost() {
+ return host;
+ }
+
+ /**
+ * Set the host
+ * @param h The host
+ */
+ public void setHost(String h) {
+ host = h;
+ }
+
+ /**
+ * Get the port
+ * @return The port
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * Set the port
+ * @param p The port
+ */
+ public void setPort(int p) {
+ port = p;
+ }
+
+ /**
+ * Execute Ant task
+ * @exception BuildException If an error occurs
+ */
+ public abstract void execute() throws BuildException;
+}
Added: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/DisableProfilerTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/DisableProfilerTask.java (rev 0)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/DisableProfilerTask.java 2008-05-11 15:30:56 UTC (rev 442)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profiler.ant;
+
+import org.jboss.profiler.shared.Command;
+import org.jboss.profiler.shared.CommandType;
+
+import org.jboss.remoting.InvokerLocator;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * The disable profiler Ant task
+ * @author Jesper Pedersen <jesper.pedersen at jboss.org>
+ */
+public class DisableProfilerTask extends AbstractTask {
+
+ /**
+ * Constructor
+ */
+ public DisableProfilerTask() {
+ super();
+ }
+
+ /**
+ * Execute Ant task
+ * @exception BuildException If an error occurs
+ */
+ public void execute() throws BuildException {
+ try {
+ Command cmd = new Command(CommandType.DISABLE);
+
+ InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
+
+ org.jboss.remoting.Client remotingClient = new org.jboss.remoting.Client(locator);
+ remotingClient.connect();
+
+ String response = (String)remotingClient.invoke(cmd);
+
+ remotingClient.disconnect();
+ } catch (Throwable t) {
+ throw new BuildException(t.getMessage(), t);
+ }
+ }
+}
Added: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/EnableProfilerTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/EnableProfilerTask.java (rev 0)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/EnableProfilerTask.java 2008-05-11 15:30:56 UTC (rev 442)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profiler.ant;
+
+import org.jboss.profiler.shared.Command;
+import org.jboss.profiler.shared.CommandType;
+
+import org.jboss.remoting.InvokerLocator;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * The enable profiler Ant task
+ * @author Jesper Pedersen <jesper.pedersen at jboss.org>
+ */
+public class EnableProfilerTask extends AbstractTask {
+
+ /**
+ * Constructor
+ */
+ public EnableProfilerTask() {
+ super();
+ }
+
+ /**
+ * Execute Ant task
+ * @exception BuildException If an error occurs
+ */
+ public void execute() throws BuildException {
+ try {
+ Command cmd = new Command(CommandType.ENABLE);
+
+ InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
+
+ org.jboss.remoting.Client remotingClient = new org.jboss.remoting.Client(locator);
+ remotingClient.connect();
+
+ String response = (String)remotingClient.invoke(cmd);
+
+ remotingClient.disconnect();
+ } catch (Throwable t) {
+ throw new BuildException(t.getMessage(), t);
+ }
+ }
+}
Added: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StartProfilerTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StartProfilerTask.java (rev 0)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StartProfilerTask.java 2008-05-11 15:30:56 UTC (rev 442)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profiler.ant;
+
+import org.jboss.profiler.shared.Command;
+import org.jboss.profiler.shared.CommandType;
+
+import org.jboss.remoting.InvokerLocator;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * The start profiler Ant task
+ * @author Jesper Pedersen <jesper.pedersen at jboss.org>
+ */
+public class StartProfilerTask extends AbstractTask {
+
+ /**
+ * Constructor
+ */
+ public StartProfilerTask() {
+ super();
+ }
+
+ /**
+ * Execute Ant task
+ * @exception BuildException If an error occurs
+ */
+ public void execute() throws BuildException {
+ try {
+ Command cmd = new Command(CommandType.START_PROFILER);
+
+ InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
+
+ org.jboss.remoting.Client remotingClient = new org.jboss.remoting.Client(locator);
+ remotingClient.connect();
+
+ String response = (String)remotingClient.invoke(cmd);
+
+ remotingClient.disconnect();
+ } catch (Throwable t) {
+ throw new BuildException(t.getMessage(), t);
+ }
+ }
+}
Added: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StopProfilerTask.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StopProfilerTask.java (rev 0)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/StopProfilerTask.java 2008-05-11 15:30:56 UTC (rev 442)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007-2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profiler.ant;
+
+import org.jboss.profiler.shared.Command;
+import org.jboss.profiler.shared.CommandType;
+
+import org.jboss.remoting.InvokerLocator;
+
+import org.apache.tools.ant.BuildException;
+
+/**
+ * The stop profiler Ant task
+ * @author Jesper Pedersen <jesper.pedersen at jboss.org>
+ */
+public class StopProfilerTask extends AbstractTask {
+
+ /**
+ * Constructor
+ */
+ public StopProfilerTask() {
+ super();
+ }
+
+ /**
+ * Execute Ant task
+ * @exception BuildException If an error occurs
+ */
+ public void execute() throws BuildException {
+ try {
+ Command cmd = new Command(CommandType.STOP_PROFILER);
+
+ InvokerLocator locator = new InvokerLocator(getProtocol() + "://" + getHost() + ":" + getPort());
+
+ org.jboss.remoting.Client remotingClient = new org.jboss.remoting.Client(locator);
+ remotingClient.connect();
+
+ String response = (String)remotingClient.invoke(cmd);
+
+ remotingClient.disconnect();
+ } catch (Throwable t) {
+ throw new BuildException(t.getMessage(), t);
+ }
+ }
+}
Added: branches/JBossProfiler2/src/main/org/jboss/profiler/ant/package.html
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/ant/package.html (rev 0)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/ant/package.html 2008-05-11 15:30:56 UTC (rev 442)
@@ -0,0 +1,3 @@
+<body>
+This package contains the Ant task for JBoss Profiler
+</body>
More information about the jboss-cvs-commits
mailing list