[jboss-cvs] JBoss Profiler SVN: r543 - in branches/JBossProfiler2: src/etc and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jun 1 17:36:13 EDT 2009
Author: jesper.pedersen
Date: 2009-06-01 17:36:13 -0400 (Mon, 01 Jun 2009)
New Revision: 543
Added:
branches/JBossProfiler2/src/etc/embedded-manifest.mf
branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/
branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/Profiler.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/package.html
Modified:
branches/JBossProfiler2/build.xml
Log:
[JBPROFILER-76] Define client API for embedded usage
Modified: branches/JBossProfiler2/build.xml
===================================================================
--- branches/JBossProfiler2/build.xml 2009-06-01 21:05:30 UTC (rev 542)
+++ branches/JBossProfiler2/build.xml 2009-06-01 21:36:13 UTC (rev 543)
@@ -23,6 +23,7 @@
<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-embedded.jar" value="jboss-profiler-embedded.jar"/>
<property name="jboss-profiler-plugins.jar" value="jboss-profiler-plugins.jar"/>
<property name="jboss-profiler-test.jar" value="jboss-profiler-test.jar"/>
<property name="jboss-profiler.war" value="jboss-profiler.war"/>
@@ -187,6 +188,37 @@
</target>
<!-- =================================================================== -->
+ <!-- Embedded -->
+ <!-- =================================================================== -->
+ <target name="embedded" 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>
+ <copy todir="${build.dir}">
+ <fileset dir="${etc.dir}">
+ <include name="**/jboss-profiler.properties"/>
+ <include name="**/log4j.xml"/>
+ </fileset>
+ </copy>
+
+ <jar destfile="${dist.dir}/${jboss-profiler-embedded.jar}"
+ basedir="${build.dir}"
+ manifest="${etc.dir}/embedded-manifest.mf"
+ includes="org/jboss/profiler/agent/**,org/jboss/profiler/client/embedded/**,org/jboss/profiler/shared/**,**/*.properties,**/*.xml"
+ excludes="**/*.java"/>
+ </target>
+
+ <!-- =================================================================== -->
<!-- Plugins -->
<!-- =================================================================== -->
<target name="plugins" depends="prepare">
@@ -374,7 +406,7 @@
<!-- =================================================================== -->
<!-- Dist -->
<!-- =================================================================== -->
- <target name="dist" depends="agent,connectors,ant,client,plugins,test,sar">
+ <target name="dist" depends="agent,connectors,ant,client,embedded,plugins,test,sar">
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
Added: branches/JBossProfiler2/src/etc/embedded-manifest.mf
===================================================================
--- branches/JBossProfiler2/src/etc/embedded-manifest.mf (rev 0)
+++ branches/JBossProfiler2/src/etc/embedded-manifest.mf 2009-06-01 21:36:13 UTC (rev 543)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Premain-Class: org.jboss.profiler.agent.Agent
+Agent-Class: org.jboss.profiler.agent.Agent
+Boot-Class-Path: jboss-profiler-embedded.jar jboss-profiler-plugins.jar javassist.jar ../lib/javassist.jar log4j.jar
+Can-Redefine-Classes: true
+Can-Retransform-Classes: false
+Can-Set-Native-Method-Prefix: false
Added: branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/Profiler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/Profiler.java (rev 0)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/Profiler.java 2009-06-01 21:36:13 UTC (rev 543)
@@ -0,0 +1,197 @@
+/*
+ * 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.client.embedded;
+
+import org.jboss.profiler.agent.Agent;
+import org.jboss.profiler.shared.Visibility;
+
+import org.jboss.logging.Logger;
+
+/**
+ * The client that will handle an embedded agent
+ * @author Jesper Pedersen <jesper.pedersen at jboss.org>
+ */
+public class Profiler {
+ /** The logger */
+ private static Logger log = Logger.getLogger(Profiler.class);
+
+ /**
+ * Constructor
+ */
+ private Profiler() {
+ }
+
+ /**
+ * Is the profiler enabled ?
+ * @return True if enabled; otherwise false
+ */
+ public static boolean isEnabled() {
+ return Agent.isEnabled();
+ }
+
+ /**
+ * Is the profiler running ?
+ * @return True if running; otherwise false
+ */
+ public static boolean isRunning() {
+ return org.jboss.profiler.agent.Profiler.isRunning();
+ }
+
+ /**
+ * Is the profiler using a memory store ?
+ * @return True if memory store; otherwise false
+ */
+ public static boolean isMemory() {
+ return Agent.isMemoryStore();
+ }
+
+ /**
+ * Is the profiler using a file store ?
+ * @return True if file store; otherwise false
+ */
+ public static boolean isFile() {
+ return !Agent.isMemoryStore();
+ }
+
+ /**
+ * Is EJB ?
+ * @return True if enabled; otherwise false
+ */
+ public static boolean isEJB() {
+ return Agent.isEJB();
+ }
+
+ /**
+ * Is Servlet ?
+ * @return True if enabled; otherwise false
+ */
+ public static boolean isServlet() {
+ return Agent.isServlet();
+ }
+
+ /**
+ * Is JSF ?
+ * @return True if enabled; otherwise false
+ */
+ public static boolean isJSF() {
+ return Agent.isJSF();
+ }
+
+ /**
+ * Is JMX ?
+ * @return True if enabled; otherwise false
+ */
+ public static boolean isJMX() {
+ return Agent.isJMX();
+ }
+
+ /**
+ * Is RMI ?
+ * @return True if enabled; otherwise false
+ */
+ public static boolean isRMI() {
+ return Agent.isRMI();
+ }
+
+ /**
+ * Is CORBA ?
+ * @return True if enabled; otherwise false
+ */
+ public static boolean isCORBA() {
+ return Agent.isCORBA();
+ }
+
+ /**
+ * Start the profiler
+ */
+ public static void startProfiler() {
+ org.jboss.profiler.agent.Profiler.startProfiler();
+ }
+
+ /**
+ * Stop the profiler
+ */
+ public static void stopProfiler() {
+ org.jboss.profiler.agent.Profiler.stopProfiler();
+ }
+
+ /**
+ * Enable the profiler
+ */
+ public static void enableProfiler() {
+ Agent.setEnabled(true);
+ }
+
+ /**
+ * Disable the profiler
+ */
+ public void disableProfiler() {
+ Agent.setEnabled(false);
+ }
+
+ /**
+ * Add classes
+ * @param classes The classes
+ * @param v The visibility
+ */
+ public void addClasses(String classes, String v) {
+ if (v == null || v.trim().equals("")) {
+ v = "public";
+ }
+
+ Visibility vi = null;
+ if (v.equalsIgnoreCase("private")) {
+ vi = Visibility.PRIVATE;
+ } else if (v.equalsIgnoreCase("protected")) {
+ vi = Visibility.PROTECTED;
+ } else if (v.equalsIgnoreCase("package")) {
+ vi = Visibility.PACKAGE;
+ } else {
+ vi = Visibility.PUBLIC;
+ }
+
+ Agent.addClasses(classes, vi);
+ }
+
+ /**
+ * Remove classes
+ * @param classes The classes
+ */
+ public void removeClasses(String classes) {
+ Agent.removeClasses(classes);
+ }
+
+ /**
+ * List classes
+ * @return The classes
+ */
+ public String[] listClasses() {
+ return Agent.listClasses();
+ }
+
+ /**
+ * Clear snapshots
+ */
+ public void clearSnapshots() {
+ org.jboss.profiler.agent.Profiler.clearSnapshots();
+ }
+}
Added: branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/package.html
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/package.html (rev 0)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/embedded/package.html 2009-06-01 21:36:13 UTC (rev 543)
@@ -0,0 +1,6 @@
+<body>
+This package contains the embedded client API.
+<p>
+This API can be used when the client is run in the same VM as the agent. Note the client should be deployed
+in the same classloader as the agent.
+</body>
More information about the jboss-cvs-commits
mailing list