org.jboss.cache.demo
Class JBossCacheView

java.lang.Object
  extended by org.jboss.cache.demo.JBossCacheView
Direct Known Subclasses:
PojoCacheView

public class JBossCacheView
extends java.lang.Object

Graphical view of a JBoss Cache instance. Think of it as a view in an MVC model. An instance of this view needs to be given a reference to the model (CacheModelDelegate) and needs to registers as a org.jboss.cache.CacheListener. Changes to the cache structure are propagated from the model to the view (via the CacheListener interface), changes from the GUI (e.g. by a user) are executed on the cache model which will delegate on the actual Cache instance (which, if clustered, will broadcast the changes to all replicas).

The view itself maintains references to the nodes, but doesn't cache any of the data associated with the nodes. When data needs to be displayed, the underlying cache will be accessed directly.

Version:
$Revision: 1.2 $
Author:
Manik Surtani, Galder Zamarreno

Constructor Summary
JBossCacheView()
           
 
Method Summary
protected  CacheModelDelegate createCacheDelegate()
          Factory method that creates the cache model delegate instance for this demo
protected  JBossCacheGUI createCacheGUI(CacheModelDelegate cacheDelegate, boolean useConsole)
          Factory method that creates a cache GUI instance
 void doMain(java.lang.String[] args)
          Main code for the view
 java.lang.String getConfigurationFile()
          Gets the configuration file
static void main(java.lang.String[] args)
          Starts the view
protected  void parseParameters(java.lang.String[] args)
          Parses the parameters
 void setCacheModelDelegate(CacheModelDelegate cacheModelDelegate)
          Sets a reference to the cache model
 void start()
          Starts the view
 void stop()
          Stops the view
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossCacheView

public JBossCacheView()
Method Detail

getConfigurationFile

public java.lang.String getConfigurationFile()
Gets the configuration file

Returns:
String containing the path to the configuration file

setCacheModelDelegate

public void setCacheModelDelegate(CacheModelDelegate cacheModelDelegate)
Sets a reference to the cache model

Parameters:
cacheModelDelegate - cache model instance to associate with this view

doMain

public void doMain(java.lang.String[] args)
            throws java.lang.Exception
Main code for the view

Parameters:
args - arguments passed via command line
Throws:
java.lang.Exception - if there's any issues starting the cache demo

start

public void start()
           throws java.lang.Exception
Starts the view

Throws:
java.lang.Exception

stop

public void stop()
Stops the view


main

public static void main(java.lang.String[] args)
Starts the view

Parameters:
args - valid arguments are: -console to enable using the embedded beanShell console, -config [path/to/config/file] to specify a config file.

parseParameters

protected void parseParameters(java.lang.String[] args)
Parses the parameters

Parameters:
args - arguments passed via command line

createCacheDelegate

protected CacheModelDelegate createCacheDelegate()
                                          throws java.lang.Exception
Factory method that creates the cache model delegate instance for this demo

Returns:
instance of CacheModelDelegate
Throws:
java.lang.Exception

createCacheGUI

protected JBossCacheGUI createCacheGUI(CacheModelDelegate cacheDelegate,
                                       boolean useConsole)
                                throws java.lang.Exception
Factory method that creates a cache GUI instance

Parameters:
cacheDelegate - cache model instance
useConsole - whether to enable the embedded beanshell console
Returns:
instance of cache GUI
Throws:
java.lang.Exception