[jboss-cvs] JBoss Profiler SVN: r545 - in branches/JBossProfiler2: src/etc and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 2 16:14:41 EDT 2009


Author: jesper.pedersen
Date: 2009-06-02 16:14:40 -0400 (Tue, 02 Jun 2009)
New Revision: 545

Modified:
   branches/JBossProfiler2/doc/userguide/en/modules/client.xml
   branches/JBossProfiler2/doc/userguide/en/modules/configuration.xml
   branches/JBossProfiler2/src/etc/jboss-profiler-client.properties
   branches/JBossProfiler2/src/etc/jboss-profiler.properties
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java
Log:
[JBPROFILER-78] Add save location property

Modified: branches/JBossProfiler2/doc/userguide/en/modules/client.xml
===================================================================
--- branches/JBossProfiler2/doc/userguide/en/modules/client.xml	2009-06-02 12:29:35 UTC (rev 544)
+++ branches/JBossProfiler2/doc/userguide/en/modules/client.xml	2009-06-02 20:14:40 UTC (rev 545)
@@ -139,7 +139,7 @@
        </programlisting>
        <programlisting>
 java -Xmx512m -Djboss-profiler-client.properties=jboss-profiler-client.properties \
-  -jar jboss-profiler-client.jar save 1 mysnapshot.jps
+  -jar jboss-profiler-client.jar save 1 /path/to/mysnapshot.jps
        </programlisting>
      </section>
 
@@ -231,6 +231,14 @@
              </entry>
            </row>
            <row>
+             <entry>savelocation</entry>
+             <entry>
+               <para>Location where to save the snapshots.</para>
+               <para>Path</para>
+               <para>Default: current working directory.</para>
+             </entry>
+           </row>
+           <row>
              <entry>plugin.&lt;number&gt;</entry>
              <entry>
                <para>Plugin to load.</para>

Modified: branches/JBossProfiler2/doc/userguide/en/modules/configuration.xml
===================================================================
--- branches/JBossProfiler2/doc/userguide/en/modules/configuration.xml	2009-06-02 12:29:35 UTC (rev 544)
+++ branches/JBossProfiler2/doc/userguide/en/modules/configuration.xml	2009-06-02 20:14:40 UTC (rev 545)
@@ -74,6 +74,13 @@
              </entry>
            </row>
            <row>
+             <entry>savelocation</entry>
+             <entry>
+               <para>Location where to save the snapshots.</para>
+               <para>[Path] default: current working directory.</para>
+             </entry>
+           </row>
+           <row>
              <entry>startup</entry>
              <entry>
                <para>Start profiler during startup.</para>

Modified: branches/JBossProfiler2/src/etc/jboss-profiler-client.properties
===================================================================
--- branches/JBossProfiler2/src/etc/jboss-profiler-client.properties	2009-06-02 12:29:35 UTC (rev 544)
+++ branches/JBossProfiler2/src/etc/jboss-profiler-client.properties	2009-06-02 20:14:40 UTC (rev 545)
@@ -2,4 +2,6 @@
 host=localhost
 port=5400
 threshold=1.0
+savelocation=.
 plugin.1=org.jboss.profiler.plugins.Hibernate
+plugin.2=org.jboss.profiler.plugins.Seam

Modified: branches/JBossProfiler2/src/etc/jboss-profiler.properties
===================================================================
--- branches/JBossProfiler2/src/etc/jboss-profiler.properties	2009-06-02 12:29:35 UTC (rev 544)
+++ branches/JBossProfiler2/src/etc/jboss-profiler.properties	2009-06-02 20:14:40 UTC (rev 545)
@@ -5,6 +5,7 @@
 excludes=*
 visibility=private
 save=yes
+savelocation=.
 startup=yes
 repository=no
 remote=yes

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java	2009-06-02 12:29:35 UTC (rev 544)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Agent.java	2009-06-02 20:14:40 UTC (rev 545)
@@ -114,6 +114,9 @@
   /** Save */
   private static boolean save = true;
 
+  /** Save location */
+  private static String saveLocation;
+
   /** Startup */
   private static boolean startup = true;
 
@@ -207,6 +210,10 @@
     port = Integer.parseInt(properties.getProperty("port", "5400"));
 
     save = parseBoolean(properties.getProperty("save"), true);
+    saveLocation = properties.getProperty("savelocation", ".");
+    if (!saveLocation.endsWith(File.separator)) {
+      saveLocation += File.separator;
+    }
     startup = parseBoolean(properties.getProperty("startup"), true);
 
     store = parseStore(properties.getProperty("store"), true);
@@ -891,7 +898,7 @@
           if (save) {
             for (Snapshot snapshot : Profiler.getSnapshots()) {
               try {
-                SnapshotHelper.save(snapshot, new File(SnapshotHelper.getName(snapshot) + ".jps"));
+                SnapshotHelper.save(snapshot, new File(saveLocation + SnapshotHelper.getName(snapshot) + ".jps"));
               } catch (Exception e) {
                 System.err.println(e.getMessage());
                 e.printStackTrace(System.err);

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java	2009-06-02 12:29:35 UTC (rev 544)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/cmd/Client.java	2009-06-02 20:14:40 UTC (rev 545)
@@ -86,6 +86,7 @@
         String host = "localhost";
         int port = 5400;
         double threshold = 1.0;
+        String saveLocation = ".";
 
         Properties properties = new Properties();
         String propertiesFile = System.getProperty("jboss-profiler-client.properties");
@@ -134,6 +135,10 @@
           host = properties.getProperty("host", "localhost");
           port = Integer.valueOf(properties.getProperty("port", "5400"));
           threshold = Double.valueOf(properties.getProperty("threshold", "1.0"));
+          saveLocation = properties.getProperty("savelocation", ".");
+          if (!saveLocation.endsWith(File.separator)) {
+            saveLocation += File.separator;
+          }
           List<Plugin> plugins = PluginHelper.load(properties);
           if (plugins.size() > 0) {
             Util.setPlugins(plugins);
@@ -291,11 +296,13 @@
             Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
             
             if (snapshot != null) {
+              String name = null;
               if (cmd.getArguments()[1] == null) {
-                SnapshotHelper.save(snapshot);
+                name = saveLocation + SnapshotHelper.getName(snapshot);
               } else {
-                SnapshotHelper.save(snapshot, new File((String)cmd.getArguments()[1]));
+                name = (String)cmd.getArguments()[1];
               }
+              SnapshotHelper.save(snapshot, new File(name));
             }
           } else if (cmd.getCommand() == CommandType.DIFFERENCE) {
             File of = null;




More information about the jboss-cvs-commits mailing list