[infinispan-commits] Infinispan SVN: r176 - in trunk: gui-demo and 7 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Mon Apr 27 13:12:41 EDT 2009
Author: manik.surtani at jboss.com
Date: 2009-04-27 13:12:41 -0400 (Mon, 27 Apr 2009)
New Revision: 176
Added:
trunk/gui-demo/
trunk/gui-demo/pom.xml
trunk/gui-demo/src/
trunk/gui-demo/src/main/
trunk/gui-demo/src/main/java/
trunk/gui-demo/src/main/java/org/
trunk/gui-demo/src/main/java/org/infinispan/
trunk/gui-demo/src/main/java/org/infinispan/demo/
trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.form
trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.java
trunk/gui-demo/src/main/resources/
trunk/gui-demo/src/main/resources/demo-cache-config.xml
Log:
Added GUI demo module
Added: trunk/gui-demo/pom.xml
===================================================================
--- trunk/gui-demo/pom.xml (rev 0)
+++ trunk/gui-demo/pom.xml 2009-04-27 17:12:41 UTC (rev 176)
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-gui-demo</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Infinispan GUI Demo</name>
+ <description>Infinispan - GUI Demo</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>jgoodies</groupId>
+ <artifactId>forms</artifactId>
+ <version>1.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>com.intellij</groupId>
+ <artifactId>forms_rt</artifactId>
+ <version>6.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.13</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-1</version>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <phase>install</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>assembly.xml</descriptor>
+ </descriptors>
+ <finalName>${artifactId}-${version}</finalName>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>ideauidesigner-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>javac2</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <fork>true</fork>
+ <debug>true</debug>
+ <failOnError>true</failOnError>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Property changes on: trunk/gui-demo/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.form
===================================================================
--- trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.form (rev 0)
+++ trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.form 2009-04-27 17:12:41 UTC (rev 176)
@@ -0,0 +1,464 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.infinispan.demo.InfinispanDemo">
+ <grid id="27dc6" binding="panel1" default-binding="true" layout-manager="FormLayout">
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:600px:grow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <colspec value="fill:800px:grow"/>
+ <colspec value="left:4dlu:noGrow"/>
+ <colspec value="fill:100px:grow"/>
+ <constraints>
+ <xy x="20" y="20" width="918" height="661"/>
+ </constraints>
+ <properties/>
+ <border type="line" title="Infinipan GUI Demo Application">
+ <font size="14" style="3"/>
+ <title-color color="-16750951"/>
+ <color color="-16750951"/>
+ </border>
+ <children>
+ <tabbedpane id="d853c" binding="mainPane">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
+ <preferred-size width="200" height="200"/>
+ </grid>
+ <forms defaultalign-vert="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <grid id="7aed3" binding="controlPanelTab" layout-manager="FormLayout">
+ <rowspec value="center:m:noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:d:grow"/>
+ <colspec value="fill:d:noGrow"/>
+ <colspec value="left:4dlu:noGrow"/>
+ <colspec value="fill:max(d;4px):noGrow"/>
+ <colspec value="left:4dlu:noGrow"/>
+ <colspec value="fill:d:grow"/>
+ <constraints>
+ <tabbedpane title="Control panel">
+ <tooltip value="This tab contains cache controls and general information about the cache configuration."/>
+ </tabbedpane>
+ </constraints>
+ <properties>
+ <toolTipText value=""/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <component id="953e7" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-vert="false"/>
+ </constraints>
+ <properties>
+ <text value="Command"/>
+ </properties>
+ </component>
+ <component id="82b76" class="javax.swing.JButton" binding="actionButton">
+ <constraints>
+ <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-vert="false"/>
+ </constraints>
+ <properties>
+ <text value="Button"/>
+ </properties>
+ </component>
+ <vspacer id="8cdf4">
+ <constraints>
+ <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-vert="false"/>
+ </constraints>
+ </vspacer>
+ <hspacer id="bfe90">
+ <constraints>
+ <grid row="0" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false"/>
+ </constraints>
+ </hspacer>
+ <component id="458fc" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-vert="false"/>
+ </constraints>
+ <properties>
+ <text value="Cache configuration file"/>
+ </properties>
+ </component>
+ <component id="1eef8" class="javax.swing.JLabel" binding="configFileName">
+ <constraints>
+ <grid row="2" column="2" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-vert="false"/>
+ </constraints>
+ <properties>
+ <font style="3"/>
+ <text value=" "/>
+ </properties>
+ </component>
+ <scrollpane id="4638">
+ <constraints>
+ <grid row="4" column="2" row-span="1" col-span="3" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false" defaultalign-vert="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="ded97" class="javax.swing.JTextArea" binding="configFileContents">
+ <constraints/>
+ <properties>
+ <background color="-3355444"/>
+ <font name="Courier New" size="10"/>
+ </properties>
+ </component>
+ </children>
+ </scrollpane>
+ </children>
+ </grid>
+ <grid id="73867" binding="dataViewTab" layout-manager="BorderLayout" hgap="0" vgap="0">
+ <constraints>
+ <tabbedpane title="Data view" enabled="false">
+ <tooltip value="This tab contains a view of all the data in the cache."/>
+ </tabbedpane>
+ </constraints>
+ <properties>
+ <enabled value="true"/>
+ <toolTipText value=""/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <scrollpane id="1b795">
+ <constraints border-constraint="Center"/>
+ <properties>
+ <background color="-16737895"/>
+ <horizontalScrollBarPolicy value="30"/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <component id="90e0f" class="javax.swing.JTable" binding="dataTable">
+ <constraints/>
+ <properties/>
+ </component>
+ </children>
+ </scrollpane>
+ </children>
+ </grid>
+ <grid id="b4b20" binding="clusterViewTab" layout-manager="FormLayout">
+ <rowspec value="center:d:grow"/>
+ <colspec value="fill:d:grow"/>
+ <constraints>
+ <tabbedpane title="Cluster view" enabled="false">
+ <tooltip value="This tab contains a view of the cluster topology"/>
+ </tabbedpane>
+ </constraints>
+ <properties>
+ <toolTipText value=""/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <scrollpane id="b9d5f">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false" defaultalign-vert="false"/>
+ </constraints>
+ <properties>
+ <background color="-16737895"/>
+ <horizontalScrollBarPolicy value="30"/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <component id="d96d2" class="javax.swing.JTable" binding="clusterTable">
+ <constraints/>
+ <properties>
+ <background color="-992313"/>
+ <gridColor color="-16777216"/>
+ <intercellSpacing width="3" height="3"/>
+ <showHorizontalLines value="true"/>
+ <showVerticalLines value="false"/>
+ </properties>
+ </component>
+ </children>
+ </scrollpane>
+ </children>
+ </grid>
+ <grid id="54b2f" binding="dataGeneratorTab" layout-manager="FormLayout">
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:d:grow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:d:grow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <rowspec value="top:3dlu:noGrow"/>
+ <rowspec value="center:max(d;4px):noGrow"/>
+ <colspec value="fill:d:noGrow"/>
+ <colspec value="left:4dlu:noGrow"/>
+ <colspec value="fill:200px:noGrow"/>
+ <colspec value="left:4dlu:noGrow"/>
+ <colspec value="fill:200px:grow"/>
+ <constraints>
+ <tabbedpane title="Manipulate data" enabled="false">
+ <tooltip value="This tab provides you with the ability to add or remove data from the cache."/>
+ </tabbedpane>
+ </constraints>
+ <properties>
+ <toolTipText value=""/>
+ </properties>
+ <border type="none"/>
+ <children>
+ <component id="7917a" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <labelFor value="4e02"/>
+ <text value="Key"/>
+ </properties>
+ </component>
+ <component id="b834" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <labelFor value="5eb9b"/>
+ <text value="Value"/>
+ </properties>
+ </component>
+ <component id="4e02" class="javax.swing.JTextField" binding="keyTextField" default-binding="true">
+ <constraints>
+ <grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="-1"/>
+ </grid>
+ <forms defaultalign-horz="false"/>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="ca2af" class="javax.swing.JRadioButton" binding="putEntryRadioButton">
+ <constraints>
+ <grid row="6" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <selected value="true"/>
+ <text value="&Put Entry"/>
+ </properties>
+ </component>
+ <component id="e9453" class="javax.swing.JRadioButton" binding="removeEntryRadioButton">
+ <constraints>
+ <grid row="8" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <text value="&Remove Entry"/>
+ </properties>
+ </component>
+ <component id="11f60" class="javax.swing.JButton" binding="goButton" default-binding="true">
+ <constraints>
+ <grid row="10" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false"/>
+ </constraints>
+ <properties>
+ <text value="&Go"/>
+ </properties>
+ </component>
+ <component id="5eb9b" class="javax.swing.JTextField" binding="valueTextField" default-binding="true">
+ <constraints>
+ <grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="-1"/>
+ </grid>
+ <forms defaultalign-horz="false"/>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="24ed" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <font style="3"/>
+ <text value="Single entry manipulator"/>
+ </properties>
+ </component>
+ <component id="aacea" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="14" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <font style="3"/>
+ <text value="Random data generator"/>
+ </properties>
+ </component>
+ <component id="bf689" class="javax.swing.JSeparator">
+ <constraints>
+ <grid row="12" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false" defaultalign-vert="false"/>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="c9835" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="16" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <labelFor value="513f3"/>
+ <text value="Max entries"/>
+ </properties>
+ </component>
+ <component id="32377" class="javax.swing.JButton" binding="randomGeneratorButton">
+ <constraints>
+ <grid row="18" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false"/>
+ </constraints>
+ <properties>
+ <text value="Ge&nerate"/>
+ </properties>
+ </component>
+ <component id="513f3" class="javax.swing.JTextField" binding="maxEntriesTextField">
+ <constraints>
+ <grid row="16" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="-1"/>
+ </grid>
+ <forms defaultalign-horz="false"/>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="f036" class="javax.swing.JSeparator">
+ <constraints>
+ <grid row="20" column="0" row-span="1" col-span="5" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false" defaultalign-vert="false"/>
+ </constraints>
+ <properties/>
+ </component>
+ <component id="43cf0" class="javax.swing.JButton" binding="cacheClearButton">
+ <constraints>
+ <grid row="24" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false"/>
+ </constraints>
+ <properties>
+ <text value="C&lear cache"/>
+ </properties>
+ </component>
+ <component id="dae1c" class="javax.swing.JLabel">
+ <constraints>
+ <grid row="22" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <font style="3"/>
+ <text value="Clear cache"/>
+ </properties>
+ </component>
+ <component id="f10d0" class="javax.swing.JRadioButton" binding="getEntryRadioButton" default-binding="true">
+ <constraints>
+ <grid row="6" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <text value="Get Entry"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ <grid id="ffd9b" binding="debugTab" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <tabbedpane title="Debug" enabled="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="cda62" class="javax.swing.JButton" binding="cacheDetailsButton">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Print cache details"/>
+ </properties>
+ </component>
+ <component id="3a0c2" class="javax.swing.JButton" binding="cacheLockInfoButton">
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Print cache locking info"/>
+ </properties>
+ </component>
+ <component id="7423b" class="javax.swing.JTextArea" binding="debugTextArea">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="50"/>
+ </grid>
+ </constraints>
+ <properties>
+ <background color="-3355444"/>
+ <font name="Courier New" size="10"/>
+ </properties>
+ </component>
+ <hspacer id="75f56">
+ <constraints>
+ <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </hspacer>
+ </children>
+ </grid>
+ </children>
+ </tabbedpane>
+ <component id="97005" class="javax.swing.JLabel" binding="cacheStatus">
+ <constraints>
+ <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms/>
+ </constraints>
+ <properties>
+ <font style="3"/>
+ <text value="Initializing"/>
+ <toolTipText value="Cache status"/>
+ <verticalAlignment value="3"/>
+ </properties>
+ </component>
+ <component id="4afab" class="javax.swing.JProgressBar" binding="cacheStatusProgressBar">
+ <constraints>
+ <grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <forms defaultalign-horz="false"/>
+ </constraints>
+ <properties>
+ <indeterminate value="true"/>
+ <orientation value="0"/>
+ </properties>
+ </component>
+ </children>
+ </grid>
+ <buttonGroups>
+ <group name="cacheFunction">
+ <member id="ca2af"/>
+ <member id="e9453"/>
+ <member id="f9bf"/>
+ <member id="f2b07"/>
+ <member id="41b43"/>
+ <member id="f10d0"/>
+ </group>
+ </buttonGroups>
+</form>
Added: trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.java
===================================================================
--- trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.java (rev 0)
+++ trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.java 2009-04-27 17:12:41 UTC (rev 176)
@@ -0,0 +1,436 @@
+package org.infinispan.demo;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.infinispan.Cache;
+import org.infinispan.lifecycle.ComponentStatus;
+import org.infinispan.manager.DefaultCacheManager;
+import org.infinispan.notifications.Listener;
+import org.infinispan.notifications.cachemanagerlistener.annotation.ViewChanged;
+import org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent;
+import org.jgroups.Address;
+
+import javax.swing.*;
+import javax.swing.table.AbstractTableModel;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * @author Manik Surtani
+ */
+public class InfinispanDemo {
+ private static Log log = LogFactory.getLog(InfinispanDemo.class);
+ private static JFrame frame;
+ private JTabbedPane mainPane;
+ private JPanel panel1;
+ private JLabel cacheStatus;
+ private JPanel dataGeneratorTab;
+ private JPanel statisticsTab;
+ private JPanel clusterViewTab;
+ private JPanel dataViewTab;
+ private JPanel controlPanelTab;
+ private JTable clusterTable;
+ private JButton actionButton;
+ private JLabel configFileName;
+ private JProgressBar cacheStatusProgressBar;
+ private JTextField keyTextField;
+ private JTextField valueTextField;
+ private JRadioButton putEntryRadioButton;
+ private JRadioButton removeEntryRadioButton;
+ private JRadioButton getEntryRadioButton;
+ private JButton goButton;
+ private JScrollPane nodeDataScrollPane;
+ private JButton randomGeneratorButton;
+ private JTextField maxEntriesTextField;
+ private JButton cacheClearButton;
+ private JTextArea configFileContents;
+ private JScrollPane treeScrollPane;
+ private JPanel debugTab;
+ private JButton cacheDetailsButton;
+ private JButton cacheLockInfoButton;
+ private JTextArea debugTextArea;
+ private String cacheConfigFile;
+ private Cache<String, String> cache;
+ private String startCacheButtonLabel = "Start Cache", stopCacheButtonLabel = "Stop Cache";
+ private String statusStarting = "Starting Cache ... ", statusStarted = "Cache Running.", statusStopping = "Stopping Cache ...", statusStopped = "Cache Stopped.";
+ private ExecutorService asyncExecutor;
+ private BlockingQueue<Runnable> asyncTaskQueue;
+ private JTable dataTable;
+ private Random r = new Random();
+
+ public static void main(String[] args) {
+ String cfgFileName = "demo-cache-config.xml";
+ if (args.length == 1 && args[0] != null && args[0].toLowerCase().endsWith(".xml")) {
+ // the first arg is the name of the config file.
+ cfgFileName = args[0];
+ }
+
+ frame = new JFrame("Infinispan GUI Demo (STOPPED)");
+ frame.setContentPane(new InfinispanDemo(cfgFileName).panel1);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+ frame.setResizable(true);
+ }
+
+ public InfinispanDemo(String cfgFileName) {
+ asyncExecutor = Executors.newFixedThreadPool(1);
+ asyncTaskQueue = ((ThreadPoolExecutor) asyncExecutor).getQueue();
+
+ cacheConfigFile = cfgFileName;
+ cacheStatusProgressBar.setVisible(false);
+ cacheStatusProgressBar.setEnabled(false);
+ configFileName.setText(cacheConfigFile);
+ // default state of the action button should be unstarted.
+ actionButton.setText(startCacheButtonLabel);
+ cacheStatus.setText(statusStopped);
+
+ // when we start up scan the classpath for a file named
+ actionButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (actionButton.getText().equals(startCacheButtonLabel)) {
+ // start cache
+ startCache();
+ } else if (actionButton.getText().equals(stopCacheButtonLabel)) {
+ // stop cache
+ stopCache();
+ }
+ }
+ });
+
+ goButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ processAction(goButton, true);
+
+ // do this in a separate thread
+ asyncExecutor.execute(new Runnable() {
+ public void run() {
+ // based on the value of the radio button:
+ if (putEntryRadioButton.isSelected()) {
+ cache.put(keyTextField.getText(), valueTextField.getText());
+ } else if (removeEntryRadioButton.isSelected()) {
+ cache.remove(keyTextField.getText());
+ } else if (getEntryRadioButton.isSelected()) {
+ cache.get(keyTextField.getText());
+ }
+ dataViewTab.repaint();
+ processAction(goButton, false);
+ // now switch to the data pane
+ mainPane.setSelectedIndex(1);
+ }
+ });
+ }
+ });
+ removeEntryRadioButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ keyTextField.setEnabled(true);
+ valueTextField.setEnabled(false);
+ }
+ });
+
+ putEntryRadioButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ keyTextField.setEnabled(true);
+ valueTextField.setEnabled(true);
+ }
+ });
+
+ getEntryRadioButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ keyTextField.setEnabled(true);
+ valueTextField.setEnabled(false);
+ }
+ });
+
+ randomGeneratorButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ processAction(randomGeneratorButton, true);
+
+ // process this asynchronously
+ asyncExecutor.execute(new Runnable() {
+ public void run() {
+ int entries = 1;
+ try {
+ entries = Integer.parseInt(maxEntriesTextField.getText());
+ }
+ catch (NumberFormatException nfe) {
+ log.warn("Entered a non-integer for depth. Using 1.", nfe);
+ }
+
+ for (int i = 0; i < entries; i++) cache.put(randomString(), randomString());
+
+ processAction(randomGeneratorButton, false);
+ // now switch to the data pane
+ mainPane.setSelectedIndex(1);
+ }
+ });
+ }
+
+ private String randomString() {
+ return Integer.toHexString(r.nextInt(Integer.MAX_VALUE)).toUpperCase();
+ }
+ });
+ cacheClearButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ processAction(cacheClearButton, true);
+ asyncExecutor.execute(new Runnable() {
+ public void run() {
+ cache.clear();
+ processAction(cacheClearButton, false);
+ // now switch to the data pane
+ mainPane.setSelectedIndex(1);
+ }
+ });
+ }
+ });
+
+ cacheDetailsButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (cache != null) debugTextArea.setText(cache.toString());
+ }
+ });
+ cacheLockInfoButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (cache != null) debugTextArea.setText(cache.toString());
+ }
+ });
+ }
+
+ private void moveCacheToState(ComponentStatus state) {
+ switch (state) {
+ case INITIALIZING:
+ cacheStatus.setText(statusStarting);
+ processAction(actionButton, true);
+ break;
+ case RUNNING:
+ setCacheTabsStatus(true);
+ actionButton.setText(stopCacheButtonLabel);
+ processAction(actionButton, false);
+ cacheStatus.setText(statusStarted);
+ updateTitleBar();
+ break;
+ case STOPPING:
+ cacheStatus.setText(statusStopping);
+ processAction(actionButton, true);
+ break;
+ case TERMINATED:
+ setCacheTabsStatus(false);
+ actionButton.setText(startCacheButtonLabel);
+ processAction(actionButton, false);
+ cacheStatus.setText(statusStopped);
+ updateTitleBar();
+ }
+ controlPanelTab.repaint();
+ }
+
+ private void processAction(JButton button, boolean start) {
+ button.setEnabled(!start);
+ cacheStatusProgressBar.setVisible(start);
+ cacheStatusProgressBar.setEnabled(start);
+ }
+
+ private String readContents(InputStream is) throws IOException {
+ BufferedReader r = new BufferedReader(new InputStreamReader(is));
+ String s;
+ StringBuilder sb = new StringBuilder();
+ while ((s = r.readLine()) != null) {
+ sb.append(s);
+ sb.append("\n");
+ }
+ return sb.toString();
+ }
+
+ private void startCache() {
+ moveCacheToState(ComponentStatus.INITIALIZING);
+
+ // actually start the cache asynchronously.
+ asyncExecutor.execute(new Runnable() {
+ public void run() {
+ try {
+ if (cache == null) {
+ URL resource = getClass().getClassLoader().getResource(cacheConfigFile);
+ String contents;
+ // update config file display
+ if (resource != null) {
+ configFileName.setText(resource.toString());
+ } else {
+ configFileName.setText(cacheConfigFile);
+ }
+ configFileName.repaint();
+
+ try {
+ configFileContents.setText(readContents(resource == null ? new FileInputStream(cacheConfigFile) : resource.openStream()));
+ configFileContents.setEditable(false);
+ }
+ catch (Exception e) {
+ log.warn("Unable to open config file for display", e);
+ }
+ configFileContents.repaint();
+
+ cache = new DefaultCacheManager(cacheConfigFile).getCache();
+ } else {
+ cache.start();
+ }
+
+// updateClusterTable(cache.getCacheManager().getMembers());
+// cache.addCacheListener(new CacheListener());
+ moveCacheToState(ComponentStatus.RUNNING);
+ } catch (Exception e) {
+ log.error("Unable to start cache!", e);
+ }
+ }
+ });
+ }
+
+ private void stopCache() {
+ moveCacheToState(ComponentStatus.STOPPING);
+ // actually stop the cache asynchronously
+ asyncExecutor.execute(new Runnable() {
+ public void run() {
+ if (cache != null) cache.stop();
+ moveCacheToState(ComponentStatus.TERMINATED);
+ }
+ });
+ }
+
+ private void setCacheTabsStatus(boolean enabled) {
+ int numTabs = mainPane.getTabCount();
+ for (int i = 1; i < numTabs; i++) mainPane.setEnabledAt(i, enabled);
+ panel1.repaint();
+ }
+
+ private void updateClusterTable(List<Address> members) {
+ log.debug("Updating cluster table with new member list " + members);
+// clusterDataModel.setMembers(members);
+ updateTitleBar();
+ }
+
+ private void updateTitleBar() {
+ String title = "Infinispan GUI Demo";
+ if (cache != null && cache.getStatus() == ComponentStatus.RUNNING) {
+ title += " (STARTED) " + cache.getCacheManager().getAddress() + " Cluster size: " + cache.getCacheManager().getMembers().size();
+ } else {
+ title += " (STOPPED)";
+ }
+ frame.setTitle(title);
+ }
+
+ @Listener
+ public class CacheListener {
+ @ViewChanged
+ public void viewChangeEvent(ViewChangedEvent e) {
+// updateClusterTable(e.getNewView().getMembers());
+ }
+
+// @NodeModified
+// public void nodeModified(NodeModifiedEvent e) {
+// if (!e.isPre()) {
+// // only if this is the current node selected in the tree do we bother refreshing it
+// if (nodeDataTableModel.getCurrentFqn() != null && nodeDataTableModel.getCurrentFqn().equals(e.getFqn())) {
+// nodeDataTableModel.updateCurrentNode();
+// }
+// }
+// }
+//
+// @NodeCreated
+// public void nodeCreated(NodeCreatedEvent e) {
+// if (!e.isPre()) {
+// final Fqn fqn = e.getFqn();
+// asyncExecutor.execute(new Runnable() {
+// public void run() {
+// treeRefresher.addNode(fqn);
+// // only refresh if there are no more tasks queued up
+// if (asyncTaskQueue.isEmpty()) treeRefresher.repaint();
+// }
+// });
+// }
+// }
+//
+//
+// @NodeRemoved
+// public void nodeRemoved(NodeRemovedEvent e) {
+// if (!e.isPre()) {
+// final Fqn fqn = e.getFqn();
+// asyncExecutor.execute(new Runnable() {
+// public void run() {
+// treeRefresher.removeNode(fqn);
+// // only refresh if there are no more tasks queued up
+// if (asyncTaskQueue.isEmpty()) treeRefresher.repaint();
+// }
+// });
+// }
+// }
+
+ // dont bother with node modified events since the tree GUI widget will refresh each node when it is selected.
+ }
+
+ public class ClusterTableModel extends AbstractTableModel {
+ List<Address> members = new ArrayList<Address>();
+ List<String> memberStates = new ArrayList<String>();
+
+ public void setMembers(List<Address> members) {
+ if (this.members != members) {
+ this.members.clear();
+ this.members.addAll(members);
+ }
+
+ List<Address> buddies = Collections.emptyList();
+
+ memberStates = new ArrayList<String>(members.size());
+ for (Address a : members) {
+ String extraInfo = "Member";
+ // if this is the first member then this is the coordinator
+ if (memberStates.isEmpty()) extraInfo += " (coord)";
+ if (a.equals(cache.getCacheManager().getAddress()))
+ extraInfo += " (me)";
+ else if (buddies.contains(a))
+ extraInfo += " (buddy)";
+ memberStates.add(extraInfo);
+ }
+
+ fireTableDataChanged();
+ }
+
+ public void setBuddies() {
+ setMembers(members);
+ }
+
+ public int getRowCount() {
+ return members.size();
+ }
+
+ public int getColumnCount() {
+ return 2;
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return members.get(rowIndex);
+ case 1:
+ return memberStates.get(rowIndex);
+ }
+ return "NULL!";
+ }
+
+ public String getColumnName(int c) {
+ if (c == 0) return "Member Address";
+ if (c == 1) return "Member Info";
+ return "NULL!";
+ }
+ }
+}
Property changes on: trunk/gui-demo/src/main/java/org/infinispan/demo/InfinispanDemo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/gui-demo/src/main/resources/demo-cache-config.xml
===================================================================
--- trunk/gui-demo/src/main/resources/demo-cache-config.xml (rev 0)
+++ trunk/gui-demo/src/main/resources/demo-cache-config.xml 2009-04-27 17:12:41 UTC (rev 176)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:4.0">
+ <default/>
+</infinispan>
Property changes on: trunk/gui-demo/src/main/resources/demo-cache-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the infinispan-commits
mailing list