Overlord SVN: r178 - cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-07-16 08:50:40 -0400 (Wed, 16 Jul 2008)
New Revision: 178
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBService.java
Log:
Resolved classloader issue, where project is not contained within the Eclipse workspace, and also reporting 'First conversation based action must specify valid session' against first conversation based action, instead of complete service descriptor.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBService.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBService.java 2008-07-16 10:54:13 UTC (rev 177)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/DefaultESBService.java 2008-07-16 12:50:40 UTC (rev 178)
@@ -129,7 +129,17 @@
// Check that the service specifies a session
if (isSessionBased() && getSessionClass() == null) {
- l.error(this, org.scribble.util.MessageUtil.format(
+
+ // Find first conversation based action to use as
+ // focus - if not found then use the service itself
+ ESBAction focus=getFirstSessionBasedAction();
+ ModelObject src=this;
+
+ if (focus instanceof ModelObject) {
+ src = (ModelObject)focus;
+ }
+
+ l.error(src, org.scribble.util.MessageUtil.format(
java.util.PropertyResourceBundle.getBundle(
"org.jboss.tools.overlord.jbossesb.model.Messages"),
"_NOT_SPECIFIED_SESSION_CLASS",
@@ -527,42 +537,53 @@
if (file != null) {
IJavaProject javaProject=JavaCore.create(file.getProject());
- IClasspathEntry[] entries = javaProject.getResolvedClasspath(true);
- String wsPath = javaProject.getProject().getLocation().toPortableString();
- String firstEntryLocation = javaProject.getPath().toPortableString();
- int idx = wsPath.indexOf(firstEntryLocation);
- wsPath = wsPath.substring(0,idx);
+ java.util.List<java.net.URL> urls=new java.util.Vector<java.net.URL>();
- String fullPath = null;
-
- java.net.URL[] urls = new java.net.URL[entries.length+1];
- int i = 0;
- urls[i++] = new java.io.File(wsPath +
- javaProject.getOutputLocation().toPortableString()).toURL();
+ scanProjectForClasspath(javaProject, urls);
+
+ java.net.URL[] urlarray=new java.net.URL[urls.size()];
+ urls.toArray(urlarray);
+
+ classLoader = new java.net.URLClassLoader(urlarray,
+ String.class.getClassLoader());
+ }
+
+ return(classLoader);
+ }
- for (IClasspathEntry entry : entries) {
- if(entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
- IResource project =
- ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath());
- String projectPath =
- JavaCore.create(project.getProject()).getOutputLocation().toPortableString();
- fullPath = wsPath + projectPath;
- } else {
- IResource res=ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath());
- if (res != null) {
- fullPath = res.getLocation().toPortableString();
- } else {
- logger.severe("Failed to locate resource for '"+entry.getPath()+"'");
+ protected void scanProjectForClasspath(IJavaProject javaProject,
+ java.util.List<java.net.URL> urls) throws Exception {
+ IClasspathEntry[] entries = javaProject.getResolvedClasspath(true);
+
+ IResource outres=ResourcesPlugin.getWorkspace().getRoot().findMember(javaProject.getOutputLocation());
+ if (outres != null) {
+ urls.add(new java.io.File(outres.getLocation().toPortableString()).toURL());
+ }
+
+ for (IClasspathEntry entry : entries) {
+ if(entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
+ IResource project =
+ ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath());
+
+ if (project instanceof IProject) {
+ IJavaProject jproj=JavaCore.create((IProject)project);
+
+ if (jproj != null) {
+ scanProjectForClasspath(jproj, urls);
}
}
-
- urls[i++] = new java.io.File(fullPath).toURL();
+
+ } else {
+
+ IResource res=ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath());
+ if (res != null) {
+ urls.add(new java.io.File(res.getLocation().
+ toPortableString()).toURL());
+ } else {
+ logger.finest("Skipping external resource '"+entry.getPath()+"'");
+ }
}
-
- classLoader = new java.net.URLClassLoader(urls,String.class.getClassLoader());
}
-
- return(classLoader);
}
public int hashCode() {
15 years, 9 months
Overlord SVN: r177 - in sam/trunk: modules/sim/src/test/java/org/jboss/test/sam/simulation and 1 other directory.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-16 06:54:13 -0400 (Wed, 16 Jul 2008)
New Revision: 177
Removed:
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
Modified:
sam/trunk/SAM.iws
sam/trunk/sam-trunk.iml
Log:
Remove legacy classes
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-16 10:50:30 UTC (rev 176)
+++ sam/trunk/SAM.iws 2008-07-16 10:54:13 UTC (rev 177)
@@ -17,137 +17,36 @@
</component>
<component name="ChangeListManager">
<list default="true" name="Default" comment="">
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/adapter" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/chart/LineChartRunner.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java" afterPath="" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/samples/pattern" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/JFreeChartViewer.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/samples/esper-default-cfg.xml" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/etc" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/Alert.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/internal/BufferView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/internal/BufferView.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/samples" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/etc/tst.policy" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServicesContextFactoryDefault.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServicesContextFactoryDefault.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMapping.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PluginLoader.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PluginLoader.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartBuilder.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/chart/BarChartRunner.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServerFactory.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/PropertyMapping.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/SimulationContext.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/database" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/simulation" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/adapter/invm" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMetadata.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/simulation/esper-cfg.xml" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/viz" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/InMemoryDatabase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/StatementContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/StatementContext.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/sam-trunk.iml" afterPath="$PROJECT_DIR$/sam-trunk.iml" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/resources" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServer.java" afterPath="" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/CorrelationView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/CorrelationView.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/chart/PieChartRunner.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/UnivariateStatisticsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/UnivariateStatisticsView.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/Configuration.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/Configuration.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/viz/esper-cfg.xml" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationInformation.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationInformation.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/Measurement.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/EventAdapterService.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/EventAdapterService.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PlugInEventRepresentationContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PlugInEventRepresentationContext.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInput.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/adapter/invm/esper-cfg.xml" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/SamTestSetup.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java" afterPath="" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/Query.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/MapEventMessage.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMStreamInput.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/falloff" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/database/esper-cfg.xml" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/ProcessingStatement.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessorFactory.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/Chart.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/filtering" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationPluginLoader.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationPluginLoader.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/client/TestConfigurationParser.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/client/TestConfigurationParser.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/chart" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/samples/pattern/esper-cfg.xml" afterPath="" />
</list>
</component>
<component name="ChangeListSynchronizer" />
@@ -665,34 +564,6 @@
<option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -711,72 +582,12 @@
<option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="SAM.ipr" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="sam-trunk" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -784,30 +595,6 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="sam-trunk" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="SAM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
<option name="myItemId" value="javasim" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleGroupNode" />
</PATH_ELEMENT>
@@ -872,11 +659,11 @@
<recent name="" />
</key>
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
+ <recent name="" />
<recent name="org.jboss.sam.sim" />
<recent name="org.jboss.test.sam" />
<recent name="org.jboss.sam.chart" />
<recent name="org.jboss.sam.chart.internal" />
- <recent name="org.jboss.sam.chart.internal.jfree" />
</key>
</component>
<component name="RestoreUpdateTree" />
@@ -1192,7 +979,7 @@
<component name="com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable" proportions="" version="1">
<option name="myLastEditedConfigurable" />
</component>
- <component name="com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectRootMasterDetailsConfigurable" proportions="0.26602086" version="1">
+ <component name="com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectRootMasterDetailsConfigurable" proportions="0.26602086,0.5" version="1">
<option name="myPlainMode" value="false" />
<option name="myLastEditedConfigurable" value="sam-trunk" />
</component>
@@ -1200,27 +987,6 @@
<option name="myLastEditedConfigurable" value="IDE Profiles" />
</component>
<component name="editorHistoryManager">
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/support/bean/SupportBean.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="4" column="13" selection-start="86" selection-end="86" vertical-scroll-proportion="0.08972845">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPStatementHandle.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="11" column="13" selection-start="342" selection-end="342" vertical-scroll-proportion="-0.1794569">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/InternalEventRouter.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="14" column="46" selection-start="434" selection-end="434" vertical-scroll-proportion="0.3140496">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/support/core/SupportInternalEventRouter.java">
<provider selected="true" editor-type-id="text-editor">
<state line="9" column="61" selection-start="306" selection-end="306" vertical-scroll-proportion="0.08972845">
@@ -1270,7 +1036,7 @@
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkEntity.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java">
<provider selected="true" editor-type-id="text-editor">
<state line="57" column="0" selection-start="2038" selection-end="2038" vertical-scroll-proportion="-0.5478158">
<folding>
@@ -1309,6 +1075,20 @@
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/modules/fx/src/main/java/org/jboss/sam/chart/Chart.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="32" column="17" selection-start="1283" selection-end="1283" vertical-scroll-proportion="0.26918536">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/modules/core/src/main/java/org/jboss/sam/EventProcessor.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="34" column="17" selection-start="1514" selection-end="1514" vertical-scroll-proportion="0.3140496">
+ <folding />
+ </state>
+ </provider>
+ </entry>
</component>
</project>
Deleted: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java 2008-07-16 10:50:30 UTC (rev 176)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java 2008-07-16 10:54:13 UTC (rev 177)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.test.sam.simulation;
-
-import org.jboss.sam.EventMessage;
-import org.jboss.sam.chart.Chart;
-import org.jboss.sam.chart.ChartMapping;
-import org.jboss.sam.chart.PropertyMapping;
-import org.jboss.sam.chart.internal.jfree.BarChartBuilder;
-import org.jboss.sam.simulation.EventSinkHandler;
-import org.jboss.sam.simulation.SimulationContext;
-import org.jfree.chart.JFreeChart;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class ChartGenerationHandler implements EventSinkHandler
-{
- public void handle(EventMessage[] events, SimulationContext context)
- {
- double numEvents = events.length;
- context.getMeasurement("numProcessed").increase(numEvents);
- for(EventMessage e : events)
- {
- System.out.println(e.getUnderlying());
- }
-
- Chart<JFreeChart> currentChart = buildChart(events);
- context.addAttachment(Chart.class, currentChart);
- }
-
- private Chart<JFreeChart> buildChart(EventMessage[] events)
- {
- ChartMapping mapping = valuePerSampleMapping();
-
- Chart chart = new BarChartBuilder(
- "Sensor simulation", "Sample", "Survey value")
- .buildChart(events, mapping);
-
- return chart;
- }
-
- private ChartMapping valuePerSampleMapping()
- {
- List<PropertyMapping> index = new ArrayList<PropertyMapping>();
- index.add(new PropertyMapping(BarChartBuilder.INDEX_1, null).constant("Sensor data"));
- index.add(new PropertyMapping(BarChartBuilder.INDEX_2, "simTime"));
-
- List<PropertyMapping> data = new ArrayList<PropertyMapping>();
- data.add(new PropertyMapping(BarChartBuilder.PROP_1, "surveyValue"));
-
- ChartMapping mapping = new ChartMapping("Sensor value per sample", index, data); // could be serialzed
- return mapping;
- }
-
- /*private ChartMapping sinkDistributionMapping()
- {
- List<PropertyMapping> index = new ArrayList<PropertyMapping>();
- index.add(new PropertyMapping(PieChartBuilder.INDEX_1, "source"));
-
- List<PropertyMapping> data = new ArrayList<PropertyMapping>();
- data.add(new PropertyMapping(PieChartBuilder.DATA_1, "numEvents"));
-
- ChartMapping mapping = new ChartMapping("Sensor event per EventSink", index, data);
- return mapping;
- } */
-}
Modified: sam/trunk/sam-trunk.iml
===================================================================
--- sam/trunk/sam-trunk.iml 2008-07-16 10:50:30 UTC (rev 176)
+++ sam/trunk/sam-trunk.iml 2008-07-16 10:54:13 UTC (rev 177)
@@ -14,9 +14,6 @@
<sourceFolder url="file://$MODULE_DIR$/modules/sim/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/modules/sim/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/modules/sim/src/test/resources" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
15 years, 9 months
Overlord SVN: r175 - in sam/trunk/modules/sim/src/main/java: org and 3 other directories.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-16 06:48:51 -0400 (Wed, 16 Jul 2008)
New Revision: 175
Added:
sam/trunk/modules/sim/src/main/java/org/
sam/trunk/modules/sim/src/main/java/org/jboss/
sam/trunk/modules/sim/src/main/java/org/jboss/sam/
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java
sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java
Removed:
sam/trunk/modules/sim/src/main/java/java/
Log:
Cleanup sim module
Added: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java 2008-07-16 10:48:51 UTC (rev 175)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ContextAwareEntity
+{
+ public void begin();
+
+ public void end();
+
+ void setContext(SimulationContext ctx);
+}
Property changes on: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java 2008-07-16 10:48:51 UTC (rev 175)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+/**
+ * Creates event messages for {@link org.jboss.sam.simulation.EventSourceEntity}'s
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventMessageFactory
+{
+ Object createEventMessage(SimulationContext context);
+
+}
Property changes on: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java 2008-07-16 10:48:51 UTC (rev 175)
@@ -0,0 +1,281 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.javasim.*;
+import com.espertech.esper.client.UnmatchedListener;
+import com.espertech.esper.event.EventBean;
+import org.jboss.sam.EventProcessor;
+import org.jboss.sam.EventProcessorFactory;
+import org.jboss.sam.StreamInput;
+import org.jboss.sam.internal.esper.EsperRuntimeImpl;
+import org.jboss.sam.internal.stream.InVMStreamInput;
+import org.jboss.sam.internal.stream.InVMDispatcher;
+import org.javasim.Scheduler;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.UUID;
+
+/**
+ * Simulations are created from global configuration,
+ * which will be available to any simulation entity and a URL to
+ * {@link #bootstrap(java.util.Properties, java.net.URL)} the {@link org.jboss.sam.EventProcessor}:
+ * <p>
+ *
+ * <b>Event sources</b><br>
+ * {@link org.jboss.sam.simulation.EventSourceEntity}'s drive the whole simulation by creating and dispatching
+ * typed event messages. They need to be added to a simulation ({@link #addSource(EventSourceEntity)})
+ * in order to emit events to the event processor.
+ * <p>
+ *
+ * <b>Event sinks</b><br>
+ * {@link org.jboss.sam.simulation.EventSinkEntity}'s processes event messages that have been forwarded
+ * from an event processor. They need to be added ({@link #addSink(EventSinkEntity)}) to a simualtion
+ * and bound to a processing statement ({@link #bindStatement(String, EventSinkEntity)})
+ * <p>
+ *
+ * <b>Shared context</b><br>
+ * The {@link org.jboss.sam.simulation.SimulationContext} is shared between all simulation
+ * entities and acts as a blackboard where any entity can read and write simulation data and configuration.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSimulation extends SimulationProcess
+{
+ // simulation properties
+ private List<EventSinkEntity> eventSinks = new ArrayList<EventSinkEntity>();
+ private List<EventSourceEntity> eventSources = new ArrayList<EventSourceEntity>();
+ private SimulationContext context;
+ private InVMDispatcher dispatcher;
+
+ // SAM properties
+ private EventProcessor eventProcessor;
+ private StreamInput streamInput;
+
+ // Constants
+ public final static String TOTAL_SIM_TIME = "sam.total-sim-time";
+ public final static String NUM_UNMATCHED_EVENTS = "sam.unmatched-events";
+
+ private EventSimulation(Properties config, URL bootstrap)
+ {
+ // thread setup
+ setName("EventSimulation {" + getName()+"}");
+ setPriority(1);
+
+ this.context = new SimulationContext(config);
+
+ // setup SAM processor
+ this.eventProcessor = EventProcessorFactory.newInstance().createRuntime( "EventSimulation", bootstrap );
+
+ // create input for the default in-vm channel
+ this.streamInput = new InVMStreamInput(InVMDispatcher.DEFAULT_CHANNEL_NAME);
+
+ // create a dispatcher used within event source
+ this.dispatcher = new InVMDispatcher(InVMDispatcher.DEFAULT_CHANNEL_NAME);
+
+ // register in/out with hub
+ this.eventProcessor.addInput(streamInput);
+
+ ((EsperRuntimeImpl) eventProcessor).getUnderlying().getEPRuntime()
+ .setUnmatchedListener(
+ new UnmatchedListener()
+ {
+
+ public void update(EventBean event)
+ {
+ System.out.println("! Unmatched event: " + event);
+ context.getMeasurement(NUM_UNMATCHED_EVENTS).increment();
+ }
+ }
+ );
+
+ }
+
+ public EventSinkEntity addSink(EventSinkEntity sink)
+ {
+ sink.setContext(this.context);
+
+ this.eventSinks.add(sink);
+ this.eventProcessor.addOutput(sink);
+ return sink;
+ }
+
+ public EventSourceEntity addSource(EventSourceEntity source)
+ {
+ source.setContext(this.context);
+ source.setDispatcher(this.dispatcher);
+
+ this.eventSources.add(source);
+ return source;
+ }
+
+ /**
+ * Create a aggregation/filtering statement
+ * @param stmt
+ */
+ public void createStatement(String stmt)
+ {
+ this.eventProcessor.registerStatement(
+ UUID.randomUUID().toString(), stmt
+ );
+ }
+
+ /**
+ * Bind a statment that forwards to an EventSink
+ * @param stmt
+ * @param sink
+ */
+ public void bindStatement(String stmt, EventSinkEntity sink)
+ {
+ this.eventProcessor.registerBoundStatement(
+ sink.getStreamName(), UUID.randomUUID().toString(), stmt
+ );
+ }
+
+ /**
+ * Execute a single run of this simulation.
+ * Suspends the main thread until the simulation is done.
+ */
+ public void singleRun()
+ {
+ // [HB] System.out.println("-----------");
+ // [HB] System.out.println("Start called: " + this);
+ this.resumeProcess();
+ // [HB] System.out.println("Trying mainSuspend on: " + this);
+ SimulationProcess.mainSuspend();
+ // [HB] System.out.println("Done with mainSuspend on: " + this);
+ }
+
+ public void done()
+ {
+ try
+ {
+ this.terminate();
+ Scheduler.reset();
+ }
+ catch(SimulationException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void begin()
+ {
+ for(EventSinkEntity sink : eventSinks)
+ {
+ sink.begin();
+ }
+
+ for(EventSourceEntity source : eventSources)
+ {
+ source.begin();
+ }
+ }
+
+ private void end()
+ {
+ for(EventSinkEntity sink : eventSinks)
+ {
+ sink.end();
+ }
+
+ for(EventSourceEntity source : eventSources)
+ {
+ source.end();
+ }
+ }
+
+ public SimulationContext getContext()
+ {
+ return context;
+ }
+
+ public Measurement measurement(String key)
+ {
+ return context.getMeasurement(key);
+ }
+
+ public void run()
+ {
+ try
+ {
+ // wait for main thread
+ waitForMainSuspended();
+
+ // [HB] System.out.println("Running " + this);
+
+ // begin
+ begin();
+ Scheduler.startSimulation();
+
+ Double totalSimTime = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
+ hold(totalSimTime);
+
+ // [HB] System.out.println("End simulation:" + this );
+ // [HB] System.out.println("-----------");
+
+ // cleanup
+ Scheduler.stopSimulation();
+ end();
+
+ returnControl();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+
+ }
+
+ /**
+ * Returns control to the test class thread
+ */
+ private void returnControl()
+ {
+ try
+ {
+ // [HB] System.out.println("Return control to main thread");
+ SimulationProcess.mainResume();
+ this.suspendProcess();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+ public static EventSimulation bootstrap(Properties config)
+ {
+ return new EventSimulation(config,
+ Thread.currentThread().getContextClassLoader().getResource("samples/esper-default-cfg.xml")
+ );
+ }
+
+ public static EventSimulation bootstrap(Properties config, URL bootstrap)
+ {
+ return new EventSimulation(config, bootstrap);
+ }
+}
Property changes on: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSimulation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java 2008-07-16 10:48:51 UTC (rev 175)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+
+/**
+ * Simulates an event sink.<br>
+ * Event sink's process messages that have been forwarded by an event processor.
+ * <p>
+ * <b>EventSinkHandler</b><br>
+ * The actual processing is done a {@link org.jboss.sam.simulation.EventSinkHandler}
+ * that needs to be associated with an event sink entity:
+ *
+ * <pre>
+ *
+ * EventSinkEntity sink = new EventSinkEntity("foo.bar-EventSink");
+ * sink.setEventHandler(
+ * new EventSinkHandler()
+ * {
+ *
+ * public void handle(EventMessage[] events, SimulationContext context)
+ * {
+ * // dome something here
+ * }
+ * }
+ * );
+ *
+ * </pre>
+ *
+ * <br>
+ * <b>EPL Statements and event forwarding</b><br>
+ * In order to invoke an event sink, you need to register a statement
+ * through {@link org.jboss.sam.simulation.EventSimulation#bindStatement(String, EventSinkEntity)}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSinkEntity implements StreamOutput, ContextAwareEntity
+{
+
+ private String streamName;
+ private SimulationContext context;
+ private EventSinkHandler handler = null;
+
+ public EventSinkEntity(String streamName)
+ {
+ this.streamName = streamName;
+ }
+
+ public void setEventHandler(EventSinkHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ public StreamOutput start()
+ {
+ return this;
+ }
+
+ public StreamOutput stop()
+ {
+ return this;
+ }
+
+ public boolean isStarted()
+ {
+ return true;
+ }
+
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
+
+ public void write(EventMessage[] events)
+ {
+ if(null==this.context)
+ throw new IllegalStateException("Simulation context not set");
+
+ if(handler!=null)
+ handler.handle(events, context);
+ }
+
+
+ public void begin()
+ {
+
+ }
+
+ public void end()
+ {
+
+ }
+
+ public void setContext(SimulationContext ctx)
+ {
+ this.context = ctx;
+ }
+
+}
Property changes on: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java 2008-07-16 10:48:51 UTC (rev 175)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Represents the actual business logic of an {@link org.jboss.sam.simulation.EventSinkEntity}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventSinkHandler
+{
+ void handle(EventMessage[] events, SimulationContext context);
+}
Property changes on: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java 2008-07-16 10:48:51 UTC (rev 175)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.javasim.RestartException;
+import org.javasim.SimulationException;
+import org.javasim.SimulationEntity;
+import org.jboss.sam.internal.stream.InVMDispatcher;
+
+/**
+ * Simulates an event source.<br>
+ * <p>
+ * <b>EventMessageFactories</b><br>
+ * An event source leverages an {@link org.jboss.sam.simulation.EventMessageFactory}
+ * to create event messages and dispatch them to the event processor:
+ *
+ * <pre>
+ * EventSourceEntity source = new EventSourceEntity("foo.bar-EventSource", 0.1);
+ * source.setEventMessageFactory(
+ * new EventMessageFactory()
+ * {
+ * public Object createEventMessage(SimulationContext context)
+ * {
+ * // Create an event message here
+ * return ...;
+ * }
+ * }
+ * );
+ * </pre>
+ *
+ * <br>
+ * <b>Event ratio</b><br>
+ * Specifies the ratio with regard to the total simulation time (between 0.01-1)
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSourceEntity extends SimulationEntity implements ContextAwareEntity
+{
+ private String name;
+ private Class eventMessageType;
+ private double eventRatio;
+ private InVMDispatcher dispatcher = null;
+ private SimulationContext context = null;
+ private EventMessageFactory factory = null;
+
+ /**
+ *
+ * @param name the event source name
+ * @param eventRatio event creation ratio wrt the total simulation time. Value between 0-1
+ */
+ public EventSourceEntity(String name, double eventRatio)
+ {
+ // thread setup
+ setPriority(5);
+ setName("EventSourceEntity {" + getName()+"}");
+
+
+ this.name = name;
+
+ if(eventRatio<=0 || eventRatio>1)
+ throw new IllegalArgumentException("Invalid event ratio: " + eventRatio);
+
+ this.eventMessageType = eventMessageType;
+ this.eventRatio = eventRatio;
+ }
+
+ public void setContext(SimulationContext controller)
+ {
+ this.context = controller;
+ }
+
+ void setDispatcher(InVMDispatcher dispatcher)
+ {
+ this.dispatcher = dispatcher;
+ }
+
+ public void setEventMessageFactory(EventMessageFactory factory)
+ {
+ this.factory = factory;
+ }
+
+ public void run()
+ {
+ while (!terminated())
+ {
+ try
+ {
+ double totalSim = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
+ double holdTime = (totalSim*eventRatio);
+ hold(holdTime);
+ }
+ catch (SimulationException e)
+ {
+ e.printStackTrace();
+ }
+ catch (RestartException e)
+ {
+ e.printStackTrace();
+ }
+
+
+ if(null==context)
+ throw new IllegalStateException("Simulation context not set");
+
+ if(null==factory)
+ throw new IllegalStateException("EventMessageFactory not set");
+
+ if(null==dispatcher)
+ throw new IllegalStateException("EventDispatcher not set");
+
+ // Create and dispatch event
+ Object event = factory.createEventMessage(this.context);
+ this.dispatcher.dispatch(event);
+
+ }
+
+ // [HB] System.out.println("EventSource " + name + " was terminated");
+ }
+
+ public void begin()
+ {
+ try
+ {
+ this.activate();
+ } catch (SimulationException e)
+ {
+ e.printStackTrace();
+
+ } catch (RestartException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void end()
+ {
+ this.terminate();
+ }
+
+
+}
Property changes on: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java 2008-07-16 10:48:51 UTC (rev 175)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+/**
+ * A simulation measurement helper
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class Measurement
+{
+ private Double current = 0.0;
+
+ public Double getCurrent()
+ {
+ return current;
+ }
+
+ public Double increase(Double d)
+ {
+ this.current += d;
+ return this.current;
+ }
+
+ public Double decrease(Double d)
+ {
+ this.current -= d;
+ return this.current;
+ }
+
+ public Double setCurrent(Double d)
+ {
+ this.current = d;
+ return this.current;
+ }
+
+ public Double increment()
+ {
+ this.current += 1;
+ return this.current;
+ }
+
+ public Double decrement()
+ {
+ this.current -= 1;
+ return this.current;
+ }
+
+
+ public String toString()
+ {
+ return String.valueOf(getCurrent());
+ }
+}
Property changes on: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/Measurement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java 2008-07-16 10:48:51 UTC (rev 175)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.javasim.Scheduler;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.io.PrintStream;
+
+/**
+ * Shared context between simulation entities and their implementation.
+ * The context is used collect simulation data and pass it along.<br>
+ * It propagates:
+ * <ul>
+ * <li>the event simulation configuration
+ * <li>measurements from event sinks, event sources and associated delegates
+ * <li>arbitrary attachments
+ * <ul>
+ *
+ * @see org.jboss.sam.simulation.Measurement
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SimulationContext
+{
+ private Properties config = null;
+ private Map<String, Measurement> measurements = new HashMap<String, Measurement>();
+ private Map<Class, Object> attachments = new HashMap<Class, Object>();
+
+ public SimulationContext(Properties config)
+ {
+ this.config = config;
+ }
+
+ public Object getConfig(String key)
+ {
+ if(null == config.get(key))
+ throw new IllegalArgumentException("No such config: " + key);
+ return config.get(key);
+ }
+
+ public Measurement getMeasurement(String key)
+ {
+ Measurement measurement = measurements.get(key);
+ if(null == measurement)
+ {
+ measurement = new Measurement();
+ measurements.put(key, measurement);
+ }
+ return measurement;
+ }
+
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return (T)attachments.get(clazz);
+ }
+
+ public <T> T addAttachment(Class<T> clazz, Object obj)
+ {
+ return (T)attachments.put(clazz, obj);
+ }
+
+ public double getCurrentSimulationTime()
+ {
+ return Scheduler.currentTime();
+ }
+
+ public void dump(PrintStream out)
+ {
+ for(String key : measurements.keySet())
+ {
+ out.println(key + ": " + measurements.get(key));
+ }
+ }
+}
Property changes on: sam/trunk/modules/sim/src/main/java/org/jboss/sam/simulation/SimulationContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 9 months
Overlord SVN: r174 - in sam/trunk/modules/fx/src/main/java: org and 5 other directories.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-16 06:47:43 -0400 (Wed, 16 Jul 2008)
New Revision: 174
Added:
sam/trunk/modules/fx/src/main/java/org/
sam/trunk/modules/fx/src/main/java/org/jboss/
sam/trunk/modules/fx/src/main/java/org/jboss/sam/
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/Chart.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartBuilder.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMapping.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMetadata.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServer.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServerFactory.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/PropertyMapping.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
Removed:
sam/trunk/modules/fx/src/main/java/java/
Log:
Cleanup fx module
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/Chart.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/Chart.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/Chart.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.io.OutputStream;
+
+/**
+ * A chart repesentation.<br>
+ * Can be an in-memory representation or a link to a physical
+ * artifact (caching).
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface Chart<T>
+{
+ String getName();
+
+ void writeTo(OutputStream out);
+
+ T getUnderlying();
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/Chart.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartBuilder.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartBuilder.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartBuilder.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Builds charts from payload and mapping information.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartBuilder
+{
+ ChartMetadata getMetadata();
+
+ Chart buildChart(EventMessage[] events, ChartMapping mapping);
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMapping.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMapping.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMapping.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.util.Collections;
+import java.util.List;
+import java.io.Serializable;
+
+/**
+ * An immutable mapping of index and data values,
+ * that can be passed to a {@link org.jboss.sam.chart.ChartBuilder} to construct
+ * {@link org.jboss.sam.chart.Chart}'s. Each instance is identifed by an alias name
+ * and will be maintained through a {@link ChartMappingRegistry}.
+ * <p>
+ * ChartMappings should be created once and reused.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class ChartMapping implements Serializable
+{
+ String aliasName;
+
+ List<PropertyMapping> indexMappings;
+
+ List<PropertyMapping> propertyMappings;
+
+ public ChartMapping(String aliasName, List<PropertyMapping> indexMappings, List<PropertyMapping> propertyMappings)
+ {
+ this.aliasName = aliasName;
+ this.indexMappings = Collections.unmodifiableList(indexMappings);
+ this.propertyMappings = Collections.unmodifiableList(propertyMappings);
+ }
+
+ String getAliasName()
+ {
+ return this.aliasName;
+ }
+
+ /**
+ * Returns an immutable index mapping for a key.
+ * The key is specified in {@link org.jboss.sam.chart.ChartMetadata}
+ * @return
+ */
+ public PropertyMapping getIndexMapping(String key)
+ {
+ PropertyMapping indexMapping = resolveKey(key, indexMappings);
+ if(null==indexMapping)
+ throw new IllegalArgumentException("Failed to resolved index mapping by key: "+ key);
+
+ return indexMapping;
+ }
+
+ /**
+ * Returns an immutable data mapping
+ * @return
+ */
+ public PropertyMapping getPropertyMapping(String key)
+ {
+ PropertyMapping dataMapping = resolveKey(key, propertyMappings);
+ if(null==dataMapping)
+ throw new IllegalArgumentException("Failed to resolved data mapping by key: "+ key);
+
+ return dataMapping;
+ }
+
+ private PropertyMapping resolveKey(String key, List<PropertyMapping> mappings)
+ {
+ PropertyMapping mapping = null;
+ for(PropertyMapping index : mappings)
+ {
+ if(index.getTargetKey().equals(key))
+ {
+ mapping = index;
+ break;
+ }
+ }
+
+ return mapping;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * Maintains {@link ChartMapping}'s.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartMappingRegistry
+{
+ void registerChartMapping(ChartMapping chartMaping);
+
+ ChartMapping getChartMapping(String aliasName);
+
+ void clearChartMapping(String aliasName);
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ChartMappingRegistryFactory
+{
+ abstract ChartMappingRegistry createChartMappingRegistry();
+
+ public static ChartMappingRegistryFactory newInstance()
+ {
+ return new DefaultChartMappingRegistryFactory();
+ }
+
+ static class DefaultChartMappingRegistryFactory extends ChartMappingRegistryFactory
+ {
+
+ ChartMappingRegistry createChartMappingRegistry()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMetadata.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMetadata.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMetadata.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.util.Iterator;
+
+/**
+ * Metadata for chart types associated with a {@link org.jboss.sam.chart.ChartBuilder}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartMetadata
+{
+ String getTypeName();
+
+ Iterator<String> getSupportedIndexNames();
+
+ Iterator<String> getSupportedPropertyNames();
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartMetadata.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServer.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServer.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServer.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Allows creation and retrieval of {@link org.jboss.sam.chart.Chart} repesentations.
+ * A chart server will be associated with a {@link org.jboss.sam.chart.ChartMappingRegistry} that stores
+ * the preconfigured mappings.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartServer
+{
+ /**
+ * Get chart by name
+ * @param chartName
+ * @return
+ */
+ Chart getChart(String chartName);
+
+ /**
+ * Create a new chart under a given name
+ * @param chartName
+ * @param payloads
+ * @return
+ */
+ Chart createChart(String chartName, String chartMappingAlias, EventMessage[] payloads);
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServerFactory.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServerFactory.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServerFactory.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ChartServerFactory
+{
+ abstract ChartServer createChartServer();
+
+ public static ChartServerFactory newInstance()
+ {
+ return new DefaultChartServerFactory();
+ }
+
+ static class DefaultChartServerFactory extends ChartServerFactory
+ {
+ ChartServer createChartServer()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/ChartServerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/PropertyMapping.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/PropertyMapping.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/PropertyMapping.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+import java.io.Serializable;
+
+/**
+ * Maps {@link org.jboss.sam.EventMessage} properties
+ * to chart attributes, like X-Axis and Y-Axis values.<br>
+ * Supports constants.
+ *
+ * @see org.jboss.sam.chart.ChartMapping
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class PropertyMapping implements Serializable
+{
+ /**
+ * The key to which a mapped property will be assigned
+ */
+ private String targetKey;
+
+ /**
+ * Name of the mapped {@link org.jboss.sam.EventMessage} property
+ */
+ private String sourcePropertyName;
+
+ private String constantValue = null;
+
+ public PropertyMapping(String targetKey, String sourcePropertyName)
+ {
+ this.targetKey = targetKey;
+ this.sourcePropertyName = sourcePropertyName;
+ }
+
+ public String getTargetKey()
+ {
+ return targetKey;
+ }
+
+ public PropertyMapping constant(String constant)
+ {
+ this.constantValue = constant.intern();
+ return this;
+ }
+
+ /**
+ * Retrieve an {@link org.jboss.sam.EventMessage} value
+ * by mapping to {@link #sourcePropertyName}
+ * @param payload
+ * @return
+ */
+ public Object map(EventMessage payload)
+ {
+ Object mapping;
+ if(null==constantValue)
+ mapping = payload.getProperty(sourcePropertyName);
+ else
+ mapping = constantValue;
+
+ return mapping;
+ }
+
+
+ public String toString()
+ {
+ String prop = sourcePropertyName != null ? sourcePropertyName : "CONSTANT";
+ return targetKey +"->"+prop;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/PropertyMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.category.DefaultCategoryDataset;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BarChartBuilder implements ChartBuilder
+{
+ private String chartTitle;
+ private String domainAxisLabel, rangeAxisLabel;
+
+ public final static String INDEX_1 = "series";
+ public final static String INDEX_2 = "x_value";
+ public final static String PROP_1 = "y_value";
+
+ public static List<String> INDEXES = new ArrayList<String>();
+ public static List<String> PROPS = new ArrayList<String>();
+
+ static
+ {
+ INDEXES.add(INDEX_1);
+ INDEXES.add(INDEX_2);
+
+ PROPS.add(PROP_1);
+ }
+
+ public BarChartBuilder(String chartTitle, String domainAxisLabel, String rangeAxisLabel)
+ {
+ this.chartTitle = chartTitle;
+ this.domainAxisLabel = domainAxisLabel;
+ this.rangeAxisLabel = rangeAxisLabel;
+ }
+
+ public ChartMetadata getMetadata()
+ {
+ return new ChartMetadata() {
+
+ public String getTypeName()
+ {
+ return "BarChart";
+ }
+
+ public Iterator<String> getSupportedIndexNames()
+ {
+ return INDEXES.iterator();
+ }
+
+ public Iterator<String> getSupportedPropertyNames()
+ {
+ return PROPS.iterator();
+ }
+ };
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ CategoryDataset dataset = createDataset(events, mapping);
+
+ JFreeChart chart = org.jfree.chart.ChartFactory.createBarChart(
+ chartTitle, // chart title
+ domainAxisLabel, // domain axis label
+ rangeAxisLabel, // range axis label
+ dataset, // data
+ PlotOrientation.VERTICAL,
+ true, // include legend
+ true, // tooltips?
+ false // URLs?
+ );
+
+ //customize(chart);
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private CategoryDataset createDataset(EventMessage[] payloads, ChartMapping mapping)
+ {
+ DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+
+ for(EventMessage event : payloads)
+ {
+ Number number = (Number) (mapping.getPropertyMapping(PROP_1)).map(event);
+ Comparable c1 = (Comparable) (mapping.getIndexMapping(INDEX_1)).map(event);
+ Comparable c2 = (Comparable) (mapping.getIndexMapping(INDEX_2)).map(event);
+ dataset.addValue(
+ number, // value
+ c1, // seriesName
+ c2 // category
+ );
+ }
+
+ return dataset;
+ }
+
+ /**
+ * Example customization
+ *
+ * @todo Create common look and feel
+ *
+ * @param chart
+ */
+ /*private void customize(JFreeChart chart)
+ {
+ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+ // set the background color for the chart...
+ chart.setBackgroundPaint(new Color(0xBBBBDD));
+ // get a reference to the plot for further customisation...
+ CategoryPlot plot = chart.getCategoryPlot();
+ // set the range axis to display integers only...
+ NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+ rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+ // disable bar outlines...
+ BarRenderer renderer = (BarRenderer) plot.getRenderer();
+ renderer.setCreateEntities(true);
+
+ // set up gradient paints for series...
+ GradientPaint gp0 = new GradientPaint(
+ 0.0f, 0.0f, Color.blue,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ GradientPaint gp1 = new GradientPaint(
+ 0.0f, 0.0f, Color.green,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ GradientPaint gp2 = new GradientPaint(
+ 0.0f, 0.0f, Color.red,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ renderer.setSeriesPaint(0, gp0);
+ renderer.setSeriesPaint(1, gp1);
+ renderer.setSeriesPaint(2, gp2);
+
+ // OPTIONAL CUSTOMISATION COMPLETED.
+ } */
+
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.JFreeChart;
+
+import java.io.OutputStream;
+import java.util.UUID;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JFreeChartImpl implements Chart<JFreeChart>
+{
+ private ChartMetadata metadata;
+
+ private JFreeChart delegate;
+
+ private String name;
+
+ public JFreeChartImpl(String name, JFreeChart delegate)
+ {
+ this.name = name;
+ this.delegate = delegate;
+ }
+
+ public JFreeChartImpl(JFreeChart delegate)
+ {
+ this(UUID.randomUUID().toString(), delegate);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void writeTo(OutputStream out)
+ {
+ throw new RuntimeException("Not implemented");
+ }
+
+ public JFreeChart getUnderlying()
+ {
+ return delegate;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+import java.util.Iterator;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LineChartBuilder implements ChartBuilder
+{
+ private String chartTitle;
+ private String xAxisLabel,yAxisLabel;
+
+ public final static String INDEX_1 = "series";
+ public final static String INDEX_2 = "x_value";
+ public final static String DATA_1 = "y_value";
+
+ public LineChartBuilder(String chartTitle, String xAxisLabel, String yAxisLabel)
+ {
+ this.chartTitle = chartTitle;
+ this.xAxisLabel = xAxisLabel;
+ this.yAxisLabel = yAxisLabel;
+ }
+
+ public ChartMetadata getMetadata()
+ {
+ return null;
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ XYSeriesCollection dataset = createDataset(events, mapping);
+
+ JFreeChart chart = ChartFactory.createXYLineChart(
+ chartTitle, // chart title
+ xAxisLabel, // x axis label
+ yAxisLabel, // y axis label
+ dataset, // data
+ PlotOrientation.VERTICAL,
+ true, // include legend
+ true, // tooltips
+ false // urls
+ );
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private XYSeriesCollection createDataset(EventMessage[] events, ChartMapping mapping)
+ {
+
+ XYSeriesCollection dataset = new XYSeriesCollection();
+
+ for(EventMessage event : events)
+ {
+ XYSeries series = getOrCreateSeries(
+ dataset,
+ (String)mapping.getIndexMapping(INDEX_1).map(event)
+ );
+ series.add(
+ (Double)mapping.getIndexMapping(INDEX_2).map(event),
+ (Double)mapping.getPropertyMapping(DATA_1).map(event)
+ );
+ }
+
+ return dataset;
+ }
+
+ private XYSeries getOrCreateSeries(XYSeriesCollection dataset, Comparable key)
+ {
+ XYSeries match = null;
+ Iterator it = dataset.getSeries().iterator();
+ while(it.hasNext())
+ {
+ XYSeries series = (XYSeries)it.next();
+ if(series.getKey().equals(key))
+ {
+ match = series;
+ break;
+ }
+ }
+
+ if(null==match)
+ {
+ match = new XYSeries(key);
+ dataset.addSeries(match);
+ }
+
+ return match;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java 2008-07-16 10:47:43 UTC (rev 174)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.data.general.DefaultPieDataset;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class PieChartBuilder implements ChartBuilder
+{
+ private String chartName;
+ //private DefaultPieDataset dataset;
+
+ public final static String INDEX_1 = "category";
+ public final static String DATA_1 = "percentage";
+
+ public PieChartBuilder(String chartName)
+ {
+ this.chartName = chartName;
+ }
+
+
+ public ChartMetadata getMetadata()
+ {
+ return null;
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ DefaultPieDataset dataset = createDataset(events, mapping);
+
+ JFreeChart chart = ChartFactory.createPieChart(
+ chartName,
+ dataset,
+ true, // legend?
+ true, // tooltips?
+ false // URLs?
+ );
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private DefaultPieDataset createDataset(EventMessage[] events, ChartMapping mapping)
+ {
+ DefaultPieDataset dataset = new DefaultPieDataset();
+
+ for(EventMessage event : events)
+ {
+ dataset.setValue(
+ (String)mapping.getIndexMapping(INDEX_1).map(event), // category
+ (Double)mapping.getPropertyMapping(DATA_1).map(event) // percentage
+ );
+ }
+
+ return dataset;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 9 months
Overlord SVN: r173 - in sam/trunk/modules/core/src/main/java: org and 8 other directories.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-16 06:46:26 -0400 (Wed, 16 Jul 2008)
New Revision: 173
Added:
sam/trunk/modules/core/src/main/java/org/
sam/trunk/modules/core/src/main/java/org/jboss/
sam/trunk/modules/core/src/main/java/org/jboss/sam/
sam/trunk/modules/core/src/main/java/org/jboss/sam/EventMessage.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessor.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessorFactory.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/ProcessingStatement.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInput.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInputCallback.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamOutput.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/Chart.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartBuilder.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMapping.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMetadata.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServer.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServerFactory.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/PropertyMapping.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamInput.java
sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java
Removed:
sam/trunk/modules/core/src/main/java/java/
Log:
Cleanup core module
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/EventMessage.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/EventMessage.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/EventMessage.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+import java.util.Iterator;
+
+/**
+ * An event message will be send when an Event occurs.<br>
+ * It consist of a timestamp and associated event properties.
+ * EventMessage's are written to {@link org.jboss.sam.StreamOutput}'s.
+ * <p>
+ * EventMessage's can be mapped to {@link org.jboss.sam.chart.Chart}'s.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventMessage<T>
+{
+ /**
+ * Creation timestamp.
+ * @return
+ */
+ long getTimestamp();
+
+ /**
+ * Get an event property by name
+ * @param name
+ * @return
+ */
+ Object getProperty(String name);
+
+ /**
+ * Iterate over event property names
+ * @return
+ */
+ Iterator<String> getPropertyNames();
+
+ /**
+ * Access the underlying implementation
+ * @return
+ */
+ T getUnderlying();
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/EventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessor.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessor.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessor.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+import java.util.Iterator;
+
+/**
+ * An event processor glues together {@link org.jboss.sam.StreamInput} and {@link org.jboss.sam.StreamOutput}
+ * and provides a way to register {@link org.jboss.sam.ProcessingStatement}'s,
+ * both bound (event forwarding) and unbound (event aggregation and filtering).
+ * <p>
+ * Instances are created through {@link org.jboss.sam.EventProcessorFactory}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventProcessor<T>
+{
+ /**
+ * Add input to the runtime
+ * @param streamInput
+ */
+ void addInput(StreamInput streamInput);
+
+ /**
+ * Remove input from the runtime
+ * @param streamName
+ */
+ void removeInput(String streamName);
+
+ /**
+ * Add output to the runtime
+ * @param streamOutput
+ */
+ void addOutput(StreamOutput streamOutput);
+
+ /**
+ * Remove output from the runtime
+ * @param streamName
+ */
+ void removeOutput(String streamName);
+
+ /**
+ * Iterate over input stream names
+ * @return
+ */
+ Iterator<String> getStreamInputNames();
+
+ /**
+ * Iterate over output stream names
+ * @return
+ */
+ Iterator<String> getStreamOutputNames();
+
+ /**
+ * Creates a statement
+ *
+ * @param statementName
+ * @param epl
+ * @return
+ */
+ ProcessingStatement registerStatement(String statementName, String epl);
+
+ /**
+ * Creates a statement and binds it to an output stream.
+ *
+ * @param streamOutputName
+ * @param statementName
+ * @param epl
+ * @return
+ */
+ ProcessingStatement registerBoundStatement(String streamOutputName, String statementName, String epl);
+
+ /**
+ * Cleanup a statement and remove it
+ * @param statementName
+ */
+ void clearStatement(String statementName);
+
+ /**
+ * Cleanup all statements and remove them
+ */
+ void clearAllStatements();
+
+ /**
+ * Iterate over statement names
+ * @return
+ */
+ Iterator<String> getStatementNames();
+
+ String getName();
+
+ T getUnderlying();
+
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessorFactory.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessorFactory.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessorFactory.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+import org.jboss.sam.internal.esper.EsperRuntimeImpl;
+
+import java.net.URL;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class EventProcessorFactory
+{
+ protected EventProcessorFactory()
+ {
+ }
+
+ public static EventProcessorFactory newInstance()
+ {
+ return new DefaultEventProcessorFactory();
+ }
+
+ public abstract EventProcessor createRuntime(String name, URL config);
+
+ static class DefaultEventProcessorFactory extends EventProcessorFactory
+ {
+
+ public EventProcessor createRuntime(String name, URL config)
+ {
+ return new EsperRuntimeImpl(name, config);
+ }
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/EventProcessorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/ProcessingStatement.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/ProcessingStatement.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/ProcessingStatement.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+/**
+ * Represents an EPL (event processing languge) statement.
+ * Statements are associated with a {@link org.jboss.sam.EventProcessor}
+ * and can be bound to a {@link org.jboss.sam.StreamOutput} to forward events,
+ * or used unbound to aggregate and filter events.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ProcessingStatement<T>
+{
+ /**
+ * Statements are managed by name
+ * @return
+ */
+ String getName();
+
+ /**
+ * Get the EPL expression this statement was created from
+ * @return
+ */
+ String getExpression();
+
+ /**
+ * Check wether the statement is bound to a {@link org.jboss.sam.StreamOutput}
+ * @return
+ */
+ boolean isBound();
+
+ /**
+ * Access the underlying implementation
+ * @return
+ */
+ T getUnderlying();
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/ProcessingStatement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInput.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInput.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInput.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+/**
+ * Stream inputs are registered with {@link org.jboss.sam.EventProcessor}'s
+ * and notify registered {@link org.jboss.sam.StreamInputCallback}'s when new events arrive.
+ * Typically the CEP runtime itself act's as such a listener in order to finished events.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface StreamInput<T>
+{
+ <T extends StreamInput> T start();
+
+ <T extends StreamInput> T stop();
+
+ boolean isStarted();
+
+ /**
+ * Register a callback
+ * @param streamInputCallback an event processing instance
+ */
+ void registerCallback(StreamInputCallback streamInputCallback);
+
+ /**
+ * Remove all registered callbacks
+ */
+ void clearCallbacks();
+
+ /**
+ * Stream input name
+ * @return
+ */
+ String getStreamName();
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInputCallback.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInputCallback.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInputCallback.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+/**
+ * Registered with a {@link StreamInput} and will be notified when new events arrive.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface StreamInputCallback
+{
+ void onEvent(Object args);
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamInputCallback.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamOutput.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamOutput.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamOutput.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+/**
+ * Stream outputs are used to forward events. Typically the last step
+ * of an event processing chain leads to an action which receive events through
+ * the <code>write(...)</code> method.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface StreamOutput<T>
+{
+ <T extends StreamOutput> T start();
+
+ <T extends StreamOutput> T stop();
+
+ boolean isStarted();
+
+ /**
+ * Receive forwarded events
+ * @param args an event stream
+ */
+ void write(EventMessage[] args);
+
+ /**
+ * Stream output name
+ * @return
+ */
+ String getStreamName();
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/StreamOutput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/Chart.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/Chart.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/Chart.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.io.OutputStream;
+
+/**
+ * A chart repesentation.<br>
+ * Can be an in-memory representation or a link to a physical
+ * artifact (caching).
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface Chart<T>
+{
+ String getName();
+
+ void writeTo(OutputStream out);
+
+ T getUnderlying();
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/Chart.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartBuilder.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartBuilder.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartBuilder.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Builds charts from payload and mapping information.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartBuilder
+{
+ ChartMetadata getMetadata();
+
+ Chart buildChart(EventMessage[] events, ChartMapping mapping);
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMapping.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMapping.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMapping.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.util.Collections;
+import java.util.List;
+import java.io.Serializable;
+
+/**
+ * An immutable mapping of index and data values,
+ * that can be passed to a {@link org.jboss.sam.chart.ChartBuilder} to construct
+ * {@link org.jboss.sam.chart.Chart}'s. Each instance is identifed by an alias name
+ * and will be maintained through a {@link ChartMappingRegistry}.
+ * <p>
+ * ChartMappings should be created once and reused.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class ChartMapping implements Serializable
+{
+ String aliasName;
+
+ List<PropertyMapping> indexMappings;
+
+ List<PropertyMapping> propertyMappings;
+
+ public ChartMapping(String aliasName, List<PropertyMapping> indexMappings, List<PropertyMapping> propertyMappings)
+ {
+ this.aliasName = aliasName;
+ this.indexMappings = Collections.unmodifiableList(indexMappings);
+ this.propertyMappings = Collections.unmodifiableList(propertyMappings);
+ }
+
+ String getAliasName()
+ {
+ return this.aliasName;
+ }
+
+ /**
+ * Returns an immutable index mapping for a key.
+ * The key is specified in {@link org.jboss.sam.chart.ChartMetadata}
+ * @return
+ */
+ public PropertyMapping getIndexMapping(String key)
+ {
+ PropertyMapping indexMapping = resolveKey(key, indexMappings);
+ if(null==indexMapping)
+ throw new IllegalArgumentException("Failed to resolved index mapping by key: "+ key);
+
+ return indexMapping;
+ }
+
+ /**
+ * Returns an immutable data mapping
+ * @return
+ */
+ public PropertyMapping getPropertyMapping(String key)
+ {
+ PropertyMapping dataMapping = resolveKey(key, propertyMappings);
+ if(null==dataMapping)
+ throw new IllegalArgumentException("Failed to resolved data mapping by key: "+ key);
+
+ return dataMapping;
+ }
+
+ private PropertyMapping resolveKey(String key, List<PropertyMapping> mappings)
+ {
+ PropertyMapping mapping = null;
+ for(PropertyMapping index : mappings)
+ {
+ if(index.getTargetKey().equals(key))
+ {
+ mapping = index;
+ break;
+ }
+ }
+
+ return mapping;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * Maintains {@link ChartMapping}'s.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartMappingRegistry
+{
+ void registerChartMapping(ChartMapping chartMaping);
+
+ ChartMapping getChartMapping(String aliasName);
+
+ void clearChartMapping(String aliasName);
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ChartMappingRegistryFactory
+{
+ abstract ChartMappingRegistry createChartMappingRegistry();
+
+ public static ChartMappingRegistryFactory newInstance()
+ {
+ return new DefaultChartMappingRegistryFactory();
+ }
+
+ static class DefaultChartMappingRegistryFactory extends ChartMappingRegistryFactory
+ {
+
+ ChartMappingRegistry createChartMappingRegistry()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMetadata.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMetadata.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMetadata.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.util.Iterator;
+
+/**
+ * Metadata for chart types associated with a {@link org.jboss.sam.chart.ChartBuilder}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartMetadata
+{
+ String getTypeName();
+
+ Iterator<String> getSupportedIndexNames();
+
+ Iterator<String> getSupportedPropertyNames();
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartMetadata.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServer.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServer.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServer.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Allows creation and retrieval of {@link org.jboss.sam.chart.Chart} repesentations.
+ * A chart server will be associated with a {@link org.jboss.sam.chart.ChartMappingRegistry} that stores
+ * the preconfigured mappings.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartServer
+{
+ /**
+ * Get chart by name
+ * @param chartName
+ * @return
+ */
+ Chart getChart(String chartName);
+
+ /**
+ * Create a new chart under a given name
+ * @param chartName
+ * @param payloads
+ * @return
+ */
+ Chart createChart(String chartName, String chartMappingAlias, EventMessage[] payloads);
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServerFactory.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServerFactory.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServerFactory.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ChartServerFactory
+{
+ abstract ChartServer createChartServer();
+
+ public static ChartServerFactory newInstance()
+ {
+ return new DefaultChartServerFactory();
+ }
+
+ static class DefaultChartServerFactory extends ChartServerFactory
+ {
+ ChartServer createChartServer()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/ChartServerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/PropertyMapping.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/PropertyMapping.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/PropertyMapping.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+import java.io.Serializable;
+
+/**
+ * Maps {@link org.jboss.sam.EventMessage} properties
+ * to chart attributes, like X-Axis and Y-Axis values.<br>
+ * Supports constants.
+ *
+ * @see org.jboss.sam.chart.ChartMapping
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class PropertyMapping implements Serializable
+{
+ /**
+ * The key to which a mapped property will be assigned
+ */
+ private String targetKey;
+
+ /**
+ * Name of the mapped {@link org.jboss.sam.EventMessage} property
+ */
+ private String sourcePropertyName;
+
+ private String constantValue = null;
+
+ public PropertyMapping(String targetKey, String sourcePropertyName)
+ {
+ this.targetKey = targetKey;
+ this.sourcePropertyName = sourcePropertyName;
+ }
+
+ public String getTargetKey()
+ {
+ return targetKey;
+ }
+
+ public PropertyMapping constant(String constant)
+ {
+ this.constantValue = constant.intern();
+ return this;
+ }
+
+ /**
+ * Retrieve an {@link org.jboss.sam.EventMessage} value
+ * by mapping to {@link #sourcePropertyName}
+ * @param payload
+ * @return
+ */
+ public Object map(EventMessage payload)
+ {
+ Object mapping;
+ if(null==constantValue)
+ mapping = payload.getProperty(sourcePropertyName);
+ else
+ mapping = constantValue;
+
+ return mapping;
+ }
+
+
+ public String toString()
+ {
+ String prop = sourcePropertyName != null ? sourcePropertyName : "CONSTANT";
+ return targetKey +"->"+prop;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/PropertyMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.category.DefaultCategoryDataset;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BarChartBuilder implements ChartBuilder
+{
+ private String chartTitle;
+ private String domainAxisLabel, rangeAxisLabel;
+
+ public final static String INDEX_1 = "series";
+ public final static String INDEX_2 = "x_value";
+ public final static String PROP_1 = "y_value";
+
+ public static List<String> INDEXES = new ArrayList<String>();
+ public static List<String> PROPS = new ArrayList<String>();
+
+ static
+ {
+ INDEXES.add(INDEX_1);
+ INDEXES.add(INDEX_2);
+
+ PROPS.add(PROP_1);
+ }
+
+ public BarChartBuilder(String chartTitle, String domainAxisLabel, String rangeAxisLabel)
+ {
+ this.chartTitle = chartTitle;
+ this.domainAxisLabel = domainAxisLabel;
+ this.rangeAxisLabel = rangeAxisLabel;
+ }
+
+ public ChartMetadata getMetadata()
+ {
+ return new ChartMetadata() {
+
+ public String getTypeName()
+ {
+ return "BarChart";
+ }
+
+ public Iterator<String> getSupportedIndexNames()
+ {
+ return INDEXES.iterator();
+ }
+
+ public Iterator<String> getSupportedPropertyNames()
+ {
+ return PROPS.iterator();
+ }
+ };
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ CategoryDataset dataset = createDataset(events, mapping);
+
+ JFreeChart chart = org.jfree.chart.ChartFactory.createBarChart(
+ chartTitle, // chart title
+ domainAxisLabel, // domain axis label
+ rangeAxisLabel, // range axis label
+ dataset, // data
+ PlotOrientation.VERTICAL,
+ true, // include legend
+ true, // tooltips?
+ false // URLs?
+ );
+
+ //customize(chart);
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private CategoryDataset createDataset(EventMessage[] payloads, ChartMapping mapping)
+ {
+ DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+
+ for(EventMessage event : payloads)
+ {
+ Number number = (Number) (mapping.getPropertyMapping(PROP_1)).map(event);
+ Comparable c1 = (Comparable) (mapping.getIndexMapping(INDEX_1)).map(event);
+ Comparable c2 = (Comparable) (mapping.getIndexMapping(INDEX_2)).map(event);
+ dataset.addValue(
+ number, // value
+ c1, // seriesName
+ c2 // category
+ );
+ }
+
+ return dataset;
+ }
+
+ /**
+ * Example customization
+ *
+ * @todo Create common look and feel
+ *
+ * @param chart
+ */
+ /*private void customize(JFreeChart chart)
+ {
+ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+ // set the background color for the chart...
+ chart.setBackgroundPaint(new Color(0xBBBBDD));
+ // get a reference to the plot for further customisation...
+ CategoryPlot plot = chart.getCategoryPlot();
+ // set the range axis to display integers only...
+ NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+ rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+ // disable bar outlines...
+ BarRenderer renderer = (BarRenderer) plot.getRenderer();
+ renderer.setCreateEntities(true);
+
+ // set up gradient paints for series...
+ GradientPaint gp0 = new GradientPaint(
+ 0.0f, 0.0f, Color.blue,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ GradientPaint gp1 = new GradientPaint(
+ 0.0f, 0.0f, Color.green,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ GradientPaint gp2 = new GradientPaint(
+ 0.0f, 0.0f, Color.red,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ renderer.setSeriesPaint(0, gp0);
+ renderer.setSeriesPaint(1, gp1);
+ renderer.setSeriesPaint(2, gp2);
+
+ // OPTIONAL CUSTOMISATION COMPLETED.
+ } */
+
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.JFreeChart;
+
+import java.io.OutputStream;
+import java.util.UUID;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JFreeChartImpl implements Chart<JFreeChart>
+{
+ private ChartMetadata metadata;
+
+ private JFreeChart delegate;
+
+ private String name;
+
+ public JFreeChartImpl(String name, JFreeChart delegate)
+ {
+ this.name = name;
+ this.delegate = delegate;
+ }
+
+ public JFreeChartImpl(JFreeChart delegate)
+ {
+ this(UUID.randomUUID().toString(), delegate);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void writeTo(OutputStream out)
+ {
+ throw new RuntimeException("Not implemented");
+ }
+
+ public JFreeChart getUnderlying()
+ {
+ return delegate;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+import java.util.Iterator;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LineChartBuilder implements ChartBuilder
+{
+ private String chartTitle;
+ private String xAxisLabel,yAxisLabel;
+
+ public final static String INDEX_1 = "series";
+ public final static String INDEX_2 = "x_value";
+ public final static String DATA_1 = "y_value";
+
+ public LineChartBuilder(String chartTitle, String xAxisLabel, String yAxisLabel)
+ {
+ this.chartTitle = chartTitle;
+ this.xAxisLabel = xAxisLabel;
+ this.yAxisLabel = yAxisLabel;
+ }
+
+ public ChartMetadata getMetadata()
+ {
+ return null;
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ XYSeriesCollection dataset = createDataset(events, mapping);
+
+ JFreeChart chart = ChartFactory.createXYLineChart(
+ chartTitle, // chart title
+ xAxisLabel, // x axis label
+ yAxisLabel, // y axis label
+ dataset, // data
+ PlotOrientation.VERTICAL,
+ true, // include legend
+ true, // tooltips
+ false // urls
+ );
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private XYSeriesCollection createDataset(EventMessage[] events, ChartMapping mapping)
+ {
+
+ XYSeriesCollection dataset = new XYSeriesCollection();
+
+ for(EventMessage event : events)
+ {
+ XYSeries series = getOrCreateSeries(
+ dataset,
+ (String)mapping.getIndexMapping(INDEX_1).map(event)
+ );
+ series.add(
+ (Double)mapping.getIndexMapping(INDEX_2).map(event),
+ (Double)mapping.getPropertyMapping(DATA_1).map(event)
+ );
+ }
+
+ return dataset;
+ }
+
+ private XYSeries getOrCreateSeries(XYSeriesCollection dataset, Comparable key)
+ {
+ XYSeries match = null;
+ Iterator it = dataset.getSeries().iterator();
+ while(it.hasNext())
+ {
+ XYSeries series = (XYSeries)it.next();
+ if(series.getKey().equals(key))
+ {
+ match = series;
+ break;
+ }
+ }
+
+ if(null==match)
+ {
+ match = new XYSeries(key);
+ dataset.addSeries(match);
+ }
+
+ return match;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.data.general.DefaultPieDataset;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class PieChartBuilder implements ChartBuilder
+{
+ private String chartName;
+ //private DefaultPieDataset dataset;
+
+ public final static String INDEX_1 = "category";
+ public final static String DATA_1 = "percentage";
+
+ public PieChartBuilder(String chartName)
+ {
+ this.chartName = chartName;
+ }
+
+
+ public ChartMetadata getMetadata()
+ {
+ return null;
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ DefaultPieDataset dataset = createDataset(events, mapping);
+
+ JFreeChart chart = ChartFactory.createPieChart(
+ chartName,
+ dataset,
+ true, // legend?
+ true, // tooltips?
+ false // URLs?
+ );
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private DefaultPieDataset createDataset(EventMessage[] events, ChartMapping mapping)
+ {
+ DefaultPieDataset dataset = new DefaultPieDataset();
+
+ for(EventMessage event : events)
+ {
+ dataset.setValue(
+ (String)mapping.getIndexMapping(INDEX_1).map(event), // category
+ (Double)mapping.getPropertyMapping(DATA_1).map(event) // percentage
+ );
+ }
+
+ return dataset;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.esper;
+
+import com.espertech.esper.client.EPStatement;
+import org.jboss.sam.ProcessingStatement;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EsperProcessingStatement implements ProcessingStatement<EPStatement>
+{
+ private EPStatement delegate;
+
+ protected String name;
+
+ private boolean bound;
+
+ public EsperProcessingStatement(EPStatement delegate)
+ {
+ this(delegate, false);
+ }
+
+ public EsperProcessingStatement(EPStatement delegate, boolean isBound)
+ {
+ this.bound = isBound;
+ this.delegate = delegate;
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public boolean isBound()
+ {
+ return this.bound;
+ }
+
+ public String getExpression()
+ {
+ return delegate.getText();
+ }
+
+ public EPStatement getUnderlying()
+ {
+ return delegate;
+ }
+
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.esper;
+
+import com.espertech.esper.client.*;
+import org.jboss.sam.*;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * A SAM runtime implementation that builds atop of Esper.
+ * It processes imput streams and passes event representations to the underlying Esper instance.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EsperRuntimeImpl implements StreamInputCallback, EventProcessor<EPServiceProvider>
+{
+ private String runtimeName;
+
+ private EPServiceProvider epService;
+
+ private Map<String, StreamInput> inputStreams = new ConcurrentHashMap<String, StreamInput>();
+ private Map<String, StreamOutput> outputStreams = new ConcurrentHashMap<String, StreamOutput>();
+
+ private Map<String, ProcessingStatement> statements = new ConcurrentHashMap<String, ProcessingStatement>();
+
+ public EsperRuntimeImpl(String name, URL config)
+ {
+ this.runtimeName = name;
+ Configuration configuration = new Configuration();
+ configuration.configure( config );
+ this.epService = EPServiceProviderManager.getProvider(name, configuration);
+
+ /*epService.getEPRuntime().setUnmatchedListener(
+ new UnmatchedListener()
+ {
+
+ public void update(EventBean event)
+ {
+ System.out.println("! Unmatched: " + event);
+ }
+ }
+ );*/
+ }
+
+ public void addInput(StreamInput streamInput)
+ {
+ streamInput.registerCallback(this);
+ this.inputStreams.put(streamInput.getStreamName(), streamInput);
+ }
+
+ public void removeInput(String streamName)
+ {
+ this.inputStreams.remove(streamName);
+ }
+
+ public Iterator<String> getStreamInputNames()
+ {
+ return this.inputStreams.keySet().iterator();
+ }
+
+ public void addOutput(StreamOutput streamOutput)
+ {
+ this.outputStreams.put(streamOutput.getStreamName(), streamOutput);
+ }
+
+ public void removeOutput(String streamName)
+ {
+ this.outputStreams.remove(streamName);
+ }
+
+ public Iterator<String> getStreamOutputNames()
+ {
+ return this.outputStreams.keySet().iterator();
+ }
+
+ /**
+ * Any event send to an stream goes to the EPRuntime
+ * @param args
+ */
+ public void onEvent(Object args)
+ {
+ epService.getEPRuntime().sendEvent(args);
+ }
+
+ public ProcessingStatement registerStatement(String statementName, String epl)
+ {
+ EPStatement epStatement = epService.getEPAdministrator().createEPL(epl, statementName);
+ return new EsperProcessingStatement(epStatement);
+ }
+
+ public ProcessingStatement registerBoundStatement(String outputStreamName, String statementName, String epl)
+ {
+ StreamOutput streamOutput = this.outputStreams.get(outputStreamName);
+ if(null == streamOutput)
+ throw new IllegalArgumentException("No such output stream: " + outputStreamName);
+
+ EPStatement epStatement = epService.getEPAdministrator().createEPL(epl, statementName);
+ EsperProcessingStatement statement = new EsperProcessingStatement(epStatement);
+ StreamOutputAdapter adapter = new StreamOutputAdapter(streamOutput);
+ statement.getUnderlying().addListener(adapter);
+ return statement;
+ }
+
+ public Iterator<String> getStatementNames()
+ {
+ return this.statements.keySet().iterator();
+ }
+
+
+ public void clearStatement(String statementName)
+ {
+ ProcessingStatement stmt = statements.get(statementName);
+ if(null==stmt)
+ throw new IllegalArgumentException("No such statement: " + statementName);
+
+ statements.remove(statementName);
+ }
+
+ public void clearAllStatements()
+ {
+ Iterator<String> stmtNames = getStatementNames();
+ while(stmtNames.hasNext())
+ {
+ clearStatement(stmtNames.next());
+ }
+ }
+
+ public String getName()
+ {
+ return this.runtimeName;
+ }
+
+ public EPServiceProvider getUnderlying()
+ {
+ return this.epService;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.esper;
+
+import com.espertech.esper.event.EventBean;
+import org.jboss.sam.EventMessage;
+
+import java.util.Iterator;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventAdapter implements EventMessage<EventBean>
+{
+ private final EventBean delegate;
+
+ private long timestamp;
+
+ /**
+ * Create with an implicit timestamp
+ *
+ * @param delegate
+ */
+ public EventAdapter(EventBean delegate)
+ {
+ this.delegate = delegate;
+ this.timestamp = System.currentTimeMillis();
+ }
+
+ /**
+ * Create with an external timestamp
+ * @param delegate
+ * @param timestamp
+ */
+ public EventAdapter(EventBean delegate, long timestamp)
+ {
+ this.delegate = delegate;
+ this.timestamp = timestamp;
+ }
+
+ public long getTimestamp()
+ {
+ return this.timestamp;
+ }
+
+ public Iterator<String> getPropertyNames()
+ {
+ Iterator<String> it = new Iterator<String>()
+ {
+
+ private String[] names = delegate.getEventType().getPropertyNames();
+ private int index=0;
+
+ public boolean hasNext()
+ {
+ return names.length>0 && index<names.length-1;
+ }
+
+ public String next()
+ {
+ String next = names[index];
+ index++;
+ return next;
+ }
+
+ public void remove()
+ {
+ throw new IllegalArgumentException("Not implemented");
+ }
+ };
+
+ return it;
+ }
+
+ public Object getProperty(String property)
+ {
+ return delegate.get(property);
+ }
+
+ public EventBean getUnderlying()
+ {
+ return delegate;
+ }
+
+
+ public String toString()
+ {
+ return "EventAdapter {"+delegate.toString()+"}";
+ }
+}
+
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.esper;
+
+import com.espertech.esper.client.UpdateListener;
+import com.espertech.esper.event.EventBean;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+
+/**
+ * Adopts an Esper {@link com.espertech.esper.client.UpdateListener}
+ * to to an FX {@link org.jboss.sam.StreamOutput}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class StreamOutputAdapter implements UpdateListener
+{
+ protected StreamOutput delegate;
+
+ public StreamOutputAdapter(StreamOutput eventListener)
+ {
+ this.delegate = eventListener;
+ }
+
+ public void update(EventBean[] newEvents, EventBean[] oldEvents)
+ {
+ EventMessage[] args1 = adoptPayload(newEvents);
+ EventMessage[] args2 = adoptPayload(oldEvents);
+
+ // TODO: review StreamOutput interface wrt oldEvents
+
+ delegate.write(args1);
+ }
+
+ private EventMessage[] adoptPayload(EventBean[] data)
+ {
+ int size = data !=null ? data.length : 0;
+ EventMessage[] payloads = new EventMessage[size];
+
+ for(int i=0; i<size; i++)
+ {
+ payloads[i] = new EventAdapter(data[i]);
+ }
+
+ return payloads;
+ }
+
+ StreamOutput getUnderlying()
+ {
+ return this.delegate;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.stream;
+
+import org.jboss.sam.StreamInputCallback;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InVMDispatcher
+{
+ public final static String DEFAULT_CHANNEL_NAME = "InVM-Channel";
+
+ private InVMStreamRegistry channelRegistry;
+
+ private String streamName;
+
+ public InVMDispatcher(String streamName)
+ {
+ this.streamName = streamName;
+ this.channelRegistry = InVMStreamRegistry.getInstance();
+ }
+
+ public void dispatch(Object event)
+ {
+ for(StreamInputCallback callback : channelRegistry.getChannelCallbacks(streamName))
+ {
+ callback.onEvent(event);
+ }
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamInput.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamInput.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamInput.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.stream;
+
+import org.jboss.sam.StreamInput;
+import org.jboss.sam.StreamInputCallback;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InVMStreamInput implements StreamInput
+{
+ private boolean started;
+
+ private String streamName;
+
+ InVMStreamRegistry channelRegistry;
+
+ public InVMStreamInput(String name)
+ {
+ this.streamName = name;
+ this.channelRegistry = InVMStreamRegistry.getInstance();
+ }
+
+ public StreamInput start()
+ {
+ this.started = true;
+ return this;
+ }
+
+ public StreamInput stop()
+ {
+ this.started = false;
+ return this;
+ }
+
+ public boolean isStarted()
+ {
+ return this.started;
+ }
+
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
+
+ public void registerCallback(StreamInputCallback listener)
+ {
+ channelRegistry.getChannelCallbacks(streamName).add(listener);
+ }
+
+ public void clearCallbacks()
+ {
+ channelRegistry.getChannelCallbacks(streamName).clear();
+ }
+
+ public void newEvent(Object args)
+ {
+ for(StreamInputCallback callback : channelRegistry.getChannelCallbacks(streamName))
+ {
+ callback.onEvent(args);
+ }
+
+ }
+
+ public String toString()
+ {
+ return "InVMInputAdapter{"+this.streamName +"}";
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamInput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java
===================================================================
--- sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java 2008-07-16 10:46:26 UTC (rev 173)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.stream;
+
+import org.jboss.sam.StreamInputCallback;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InVMStreamRegistry
+{
+ private Map<String, List<StreamInputCallback>> streams = new ConcurrentHashMap<String, List<StreamInputCallback>>();
+
+ private static InVMStreamRegistry INSTANCE;
+
+ private InVMStreamRegistry()
+ {
+ }
+
+ public static InVMStreamRegistry getInstance()
+ {
+ if(null == INSTANCE)
+ INSTANCE = new InVMStreamRegistry();
+ return INSTANCE;
+ }
+
+ public List<StreamInputCallback> getChannelCallbacks(String streamName)
+ {
+ if(null == streams.get(streamName))
+ streams.put(streamName, new CopyOnWriteArrayList<StreamInputCallback>());
+ return streams.get(streamName);
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 9 months
Overlord SVN: r172 - in sam/trunk: modules and 84 other directories.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-16 06:37:03 -0400 (Wed, 16 Jul 2008)
New Revision: 172
Added:
sam/trunk/modules/
sam/trunk/modules/core/
sam/trunk/modules/core/pom.xml
sam/trunk/modules/core/src/
sam/trunk/modules/core/src/main/
sam/trunk/modules/core/src/main/java/
sam/trunk/modules/core/src/main/java/java/
sam/trunk/modules/core/src/main/java/java/org/
sam/trunk/modules/core/src/main/java/java/org/jboss/
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventMessage.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessor.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessorFactory.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/ProcessingStatement.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInput.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInputCallback.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamOutput.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/Chart.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMapping.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServer.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EventAdapter.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMDispatcher.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamInput.java
sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java
sam/trunk/modules/core/src/main/resources/
sam/trunk/modules/core/src/main/resources/resources/
sam/trunk/modules/core/src/test/
sam/trunk/modules/core/src/test/etc/
sam/trunk/modules/core/src/test/etc/tst.policy
sam/trunk/modules/core/src/test/java/
sam/trunk/modules/core/src/test/java/org/
sam/trunk/modules/core/src/test/java/org/jboss/
sam/trunk/modules/core/src/test/java/org/jboss/test/
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/InMemoryDatabase.java
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/MapEventMessage.java
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/SamTestSetup.java
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/Query.java
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/Alert.java
sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java
sam/trunk/modules/core/src/test/resources/
sam/trunk/modules/core/src/test/resources/adapter/
sam/trunk/modules/core/src/test/resources/adapter/invm/
sam/trunk/modules/core/src/test/resources/adapter/invm/esper-cfg.xml
sam/trunk/modules/core/src/test/resources/database/
sam/trunk/modules/core/src/test/resources/database/esper-cfg.xml
sam/trunk/modules/core/src/test/resources/samples/
sam/trunk/modules/core/src/test/resources/samples/esper-default-cfg.xml
sam/trunk/modules/core/src/test/resources/samples/pattern/
sam/trunk/modules/core/src/test/resources/samples/pattern/esper-cfg.xml
sam/trunk/modules/core/src/test/resources/simulation/
sam/trunk/modules/core/src/test/resources/simulation/esper-cfg.xml
sam/trunk/modules/core/src/test/resources/viz/
sam/trunk/modules/core/src/test/resources/viz/esper-cfg.xml
sam/trunk/modules/fx/
sam/trunk/modules/fx/pom.xml
sam/trunk/modules/fx/src/
sam/trunk/modules/fx/src/main/
sam/trunk/modules/fx/src/main/java/
sam/trunk/modules/fx/src/main/java/java/
sam/trunk/modules/fx/src/main/java/java/org/
sam/trunk/modules/fx/src/main/java/java/org/jboss/
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/Chart.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMapping.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServer.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
sam/trunk/modules/fx/src/main/resources/
sam/trunk/modules/fx/src/main/resources/resources/
sam/trunk/modules/fx/src/test/
sam/trunk/modules/fx/src/test/etc/
sam/trunk/modules/fx/src/test/etc/tst.policy
sam/trunk/modules/fx/src/test/java/
sam/trunk/modules/fx/src/test/java/org/
sam/trunk/modules/fx/src/test/java/org/jboss/
sam/trunk/modules/fx/src/test/java/org/jboss/test/
sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/
sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/JFreeChartViewer.java
sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/MapEventMessage.java
sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/
sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/BarChartRunner.java
sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/LineChartRunner.java
sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/PieChartRunner.java
sam/trunk/modules/fx/src/test/resources/
sam/trunk/modules/sim/
sam/trunk/modules/sim/pom.xml
sam/trunk/modules/sim/src/
sam/trunk/modules/sim/src/main/
sam/trunk/modules/sim/src/main/java/
sam/trunk/modules/sim/src/main/java/java/
sam/trunk/modules/sim/src/main/java/java/org/
sam/trunk/modules/sim/src/main/java/java/org/jboss/
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/ContextAwareEntity.java
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventMessageFactory.java
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSimulation.java
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkEntity.java
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkHandler.java
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSourceEntity.java
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/Measurement.java
sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/SimulationContext.java
sam/trunk/modules/sim/src/main/resources/
sam/trunk/modules/sim/src/main/resources/resources/
sam/trunk/modules/sim/src/test/
sam/trunk/modules/sim/src/test/etc/
sam/trunk/modules/sim/src/test/etc/tst.policy
sam/trunk/modules/sim/src/test/java/
sam/trunk/modules/sim/src/test/java/org/
sam/trunk/modules/sim/src/test/java/org/jboss/
sam/trunk/modules/sim/src/test/java/org/jboss/test/
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java
sam/trunk/modules/sim/src/test/resources/
sam/trunk/modules/sim/src/test/resources/adapter/
sam/trunk/modules/sim/src/test/resources/adapter/invm/
sam/trunk/modules/sim/src/test/resources/adapter/invm/esper-cfg.xml
sam/trunk/modules/sim/src/test/resources/database/
sam/trunk/modules/sim/src/test/resources/database/esper-cfg.xml
sam/trunk/modules/sim/src/test/resources/samples/
sam/trunk/modules/sim/src/test/resources/samples/esper-default-cfg.xml
sam/trunk/modules/sim/src/test/resources/samples/pattern/
sam/trunk/modules/sim/src/test/resources/samples/pattern/esper-cfg.xml
sam/trunk/modules/sim/src/test/resources/simulation/
sam/trunk/modules/sim/src/test/resources/simulation/esper-cfg.xml
sam/trunk/modules/sim/src/test/resources/viz/
sam/trunk/modules/sim/src/test/resources/viz/esper-cfg.xml
Removed:
sam/trunk/src/
Modified:
sam/trunk/SAM.iws
sam/trunk/pom.xml
sam/trunk/sam-trunk.iml
Log:
Break up into modules
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-15 18:01:27 UTC (rev 171)
+++ sam/trunk/SAM.iws 2008-07-16 10:37:03 UTC (rev 172)
@@ -17,31 +17,137 @@
</component>
<component name="ChangeListManager">
<list default="true" name="Default" comment="">
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/adapter" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/chart/LineChartRunner.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/samples/pattern" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/JFreeChartViewer.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/samples/esper-default-cfg.xml" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/etc" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/Alert.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/internal/BufferView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/internal/BufferView.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/samples" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/etc/tst.policy" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServicesContextFactoryDefault.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServicesContextFactoryDefault.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMapping.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PluginLoader.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PluginLoader.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/StatementContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/StatementContext.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartBuilder.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/chart/BarChartRunner.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServerFactory.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/PropertyMapping.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/SimulationContext.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/database" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/simulation" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/adapter/invm" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMetadata.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/simulation/esper-cfg.xml" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/viz" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EventAdapter.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/InMemoryDatabase.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/StatementContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/StatementContext.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/sam-trunk.iml" afterPath="$PROJECT_DIR$/sam-trunk.iml" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/resources" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServer.java" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/CorrelationView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/CorrelationView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/chart/PieChartRunner.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/UnivariateStatisticsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/UnivariateStatisticsView.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/Configuration.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/Configuration.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/viz/esper-cfg.xml" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationInformation.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationInformation.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/Measurement.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/EventAdapterService.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/EventAdapterService.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PlugInEventRepresentationContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PlugInEventRepresentationContext.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" />
- <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/client/TestConfigurationParser.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/client/TestConfigurationParser.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInput.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/adapter/invm/esper-cfg.xml" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/SamTestSetup.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/Query.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/MapEventMessage.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMStreamInput.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/falloff" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/database/esper-cfg.xml" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/ProcessingStatement.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessorFactory.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/Chart.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/filtering" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationPluginLoader.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationPluginLoader.java" />
+ <change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/client/TestConfigurationParser.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/client/TestConfigurationParser.java" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/chart" afterPath="" />
+ <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/samples/pattern/esper-cfg.xml" afterPath="" />
</list>
</component>
<component name="ChangeListSynchronizer" />
@@ -112,47 +218,6 @@
<disable_hints />
</component>
<component name="DebuggerManager">
- <line_breakpoints>
- <breakpoint url="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java" line="102" class="Class at FalloffTestCase.java:102" package="org.jboss.test.sam.samples.falloff">
- <option name="ENABLED" value="true" />
- <option name="SUSPEND_POLICY" value="SuspendAll" />
- <option name="LOG_ENABLED" value="false" />
- <option name="LOG_EXPRESSION_ENABLED" value="false" />
- <option name="COUNT_FILTER_ENABLED" value="false" />
- <option name="COUNT_FILTER" value="0" />
- <option name="CONDITION_ENABLED" value="false" />
- <option name="CLASS_FILTERS_ENABLED" value="false" />
- <option name="INSTANCE_FILTERS_ENABLED" value="false" />
- <option name="CONDITION" value="" />
- <option name="LOG_MESSAGE" value="" />
- </breakpoint>
- <breakpoint url="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" line="101" class="org.jboss.test.sam.database.DatabaseTestCase" package="org.jboss.test.sam.database">
- <option name="ENABLED" value="true" />
- <option name="SUSPEND_POLICY" value="SuspendAll" />
- <option name="LOG_ENABLED" value="false" />
- <option name="LOG_EXPRESSION_ENABLED" value="false" />
- <option name="COUNT_FILTER_ENABLED" value="false" />
- <option name="COUNT_FILTER" value="0" />
- <option name="CONDITION_ENABLED" value="false" />
- <option name="CLASS_FILTERS_ENABLED" value="false" />
- <option name="INSTANCE_FILTERS_ENABLED" value="false" />
- <option name="CONDITION" value="" />
- <option name="LOG_MESSAGE" value="" />
- </breakpoint>
- <breakpoint url="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" line="126" class="org.jboss.test.sam.database.DatabaseTestCase" package="org.jboss.test.sam.database">
- <option name="ENABLED" value="true" />
- <option name="SUSPEND_POLICY" value="SuspendAll" />
- <option name="LOG_ENABLED" value="false" />
- <option name="LOG_EXPRESSION_ENABLED" value="false" />
- <option name="COUNT_FILTER_ENABLED" value="false" />
- <option name="COUNT_FILTER" value="0" />
- <option name="CONDITION_ENABLED" value="false" />
- <option name="CLASS_FILTERS_ENABLED" value="false" />
- <option name="INSTANCE_FILTERS_ENABLED" value="false" />
- <option name="CONDITION" value="" />
- <option name="LOG_MESSAGE" value="" />
- </breakpoint>
- </line_breakpoints>
<breakpoint_any>
<breakpoint>
<option name="NOTIFY_CAUGHT" value="true" />
@@ -223,53 +288,7 @@
</subPane>
</component>
<component name="FileEditorManager">
- <leaf>
- <file leaf-file-name="InVMStreamTestCase.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="29" column="24" selection-start="1235" selection-end="1235" vertical-scroll-proportion="0.012987013">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="DatabaseTestCase.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="135" column="8" selection-start="4971" selection-end="4971" vertical-scroll-proportion="0.95513576">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="pom.xml" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/pom.xml">
- <provider selected="true" editor-type-id="text-editor">
- <state line="242" column="46" selection-start="7479" selection-end="7511" vertical-scroll-proportion="0.29206732">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="EsperProcessingStatement.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="29" column="37" selection-start="1229" selection-end="1253" vertical-scroll-proportion="0.1794569">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="SamTestSetup.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/SamTestSetup.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="54" column="15" selection-start="2086" selection-end="2086" vertical-scroll-proportion="0.26564345">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- </leaf>
+ <leaf />
</component>
<component name="FindManager">
<FindUsagesManager>
@@ -281,10 +300,7 @@
<option name="SORT_ALPHABETICALLY" value="false" />
<option name="HIDE_CLASSES_WHERE_METHOD_NOT_IMPLEMENTED" value="false" />
</component>
- <component name="HighlightingSettingsPerFile">
- <setting file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java" root0="SKIP_INSPECTION" />
- <setting file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java" root0="SKIP_INSPECTION" />
- </component>
+ <component name="HighlightingSettingsPerFile" />
<component name="InspectionManager">
<option name="AUTOSCROLL_TO_SOURCE" value="false" />
<option name="SPLITTER_PROPORTION" value="0.5" />
@@ -482,11 +498,11 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -504,33 +520,21 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test/sam" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -546,37 +550,41 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test/sam" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -592,49 +600,43 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="SAM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="sam-trunk" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -652,33 +654,45 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -694,77 +708,73 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="SAM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="sam-trunk" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ </PATH>
+ <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ <option name="myItemId" value="SAM.ipr" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ <option name="myItemId" value="sam-trunk" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules/sim/src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -774,21 +784,15 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="esper-2.1.0-src" />
+ <option name="myItemId" value="sam-trunk" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
</PATH_ELEMENT>
- </PATH>
- <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="SAM.ipr" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="esper-2.1.0-src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -797,18 +801,6 @@
<option name="myItemId" value="SAM.ipr" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="esper-2.1.0-src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -1113,7 +1105,7 @@
<window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="File View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27590436" order="0" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.29000613" order="0" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.15757205" order="2" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.69020504" order="2" />
@@ -1208,107 +1200,111 @@
<option name="myLastEditedConfigurable" value="IDE Profiles" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMetadata.java">
+ <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/support/bean/SupportBean.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="29" column="101" selection-start="1235" selection-end="1235" vertical-scroll-proportion="0.20188902">
+ <state line="4" column="13" selection-start="86" selection-end="86" vertical-scroll-proportion="0.08972845">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java">
+ <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPStatementHandle.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="69" column="17" selection-start="2401" selection-end="2401" vertical-scroll-proportion="0.33293977">
+ <state line="11" column="13" selection-start="342" selection-end="342" vertical-scroll-proportion="-0.1794569">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.java">
+ <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/InternalEventRouter.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="32" column="68" selection-start="1408" selection-end="1408" vertical-scroll-proportion="0.26918536">
+ <state line="14" column="46" selection-start="434" selection-end="434" vertical-scroll-proportion="0.3140496">
<folding />
</state>
</provider>
</entry>
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/util/TestConstructorHelper.java">
+ <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/support/core/SupportInternalEventRouter.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="8" column="13" selection-start="326" selection-end="326" vertical-scroll-proportion="0.09134615">
+ <state line="9" column="61" selection-start="306" selection-end="306" vertical-scroll-proportion="0.08972845">
<folding />
</state>
</provider>
</entry>
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/util/TestURIUtil.java">
+ <entry file="file://$PROJECT_DIR$/modules/core/src/test/etc/tst.policy">
<provider selected="true" editor-type-id="text-editor">
- <state line="9" column="13" selection-start="181" selection-end="181" vertical-scroll-proportion="-0.31971154">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/support/bean/SupportBean.java">
+ <entry file="file://$PROJECT_DIR$/modules/fx/src/test/java/org/jboss/test/sam/MapEventMessage.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="4" column="13" selection-start="86" selection-end="86" vertical-scroll-proportion="0.08972845">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPStatementHandle.java">
+ <entry file="file://$PROJECT_DIR$/modules/fx/src/test/java/org/jboss/test/sam/JFreeChartViewer.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="11" column="13" selection-start="342" selection-end="342" vertical-scroll-proportion="-0.1794569">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="-0.20188902">
<folding />
</state>
</provider>
</entry>
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/InternalEventRouter.java">
+ <entry file="file://$PROJECT_DIR$/modules/fx/src/test/java/org/jboss/test/sam/chart/BarChartRunner.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="14" column="46" selection-start="434" selection-end="434" vertical-scroll-proportion="0.3140496">
+ <state line="48" column="48" selection-start="1743" selection-end="1743" vertical-scroll-proportion="0.40377805">
<folding />
</state>
</provider>
</entry>
- <entry file="file:///home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/support/core/SupportInternalEventRouter.java">
+ <entry file="file://$PROJECT_DIR$/modules/core/pom.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="9" column="61" selection-start="306" selection-end="306" vertical-scroll-proportion="0.08972845">
+ <state line="60" column="32" selection-start="1646" selection-end="1767" vertical-scroll-proportion="0.82211536">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java">
+ <entry file="file://$PROJECT_DIR$/pom.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="29" column="24" selection-start="1235" selection-end="1235" vertical-scroll-proportion="0.012987013">
+ <state line="9" column="28" selection-start="411" selection-end="411" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/SamTestSetup.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkEntity.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="54" column="15" selection-start="2086" selection-end="2086" vertical-scroll-proportion="0.26564345">
- <folding />
+ <state line="57" column="0" selection-start="2038" selection-end="2038" vertical-scroll-proportion="-0.5478158">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="29" column="37" selection-start="1229" selection-end="1253" vertical-scroll-proportion="0.1794569">
- <folding />
+ <state line="44" column="13" selection-start="1689" selection-end="1689" vertical-scroll-proportion="0.5383707">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/InMemoryDatabase.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/pom.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="113" column="22" selection-start="3497" selection-end="3497" vertical-scroll-proportion="0.25974026">
+ <state line="36" column="0" selection-start="1186" selection-end="1186" vertical-scroll-proportion="0.42908654">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java">
+ <entry file="file://$PROJECT_DIR$/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="135" column="8" selection-start="4971" selection-end="4971" vertical-scroll-proportion="0.95513576">
+ <state line="34" column="13" selection-start="1340" selection-end="1340" vertical-scroll-proportion="0.08972845">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/pom.xml">
+ <entry file="file://$PROJECT_DIR$/modules/fx/pom.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="242" column="46" selection-start="7479" selection-end="7511" vertical-scroll-proportion="0.29206732">
+ <state line="30" column="26" selection-start="917" selection-end="1069" vertical-scroll-proportion="0.5480769">
<folding />
</state>
</provider>
Added: sam/trunk/modules/core/pom.xml
===================================================================
--- sam/trunk/modules/core/pom.xml (rev 0)
+++ sam/trunk/modules/core/pom.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,105 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>SAM - Core</name>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>core</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>sam</artifactId>
+ <version>1.0.0.SNAPSHOT</version>
+ </parent>
+
+
+ <!-- Properties -->
+ <properties>
+ <surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/etc/tst.policy</surefire.security.args>
+ <surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</surefire.jdwp.args>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>esper</groupId>
+ <artifactId>esper</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr-runtime</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>jfree</groupId>
+ <artifactId>jfreechart</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javasim</groupId>
+ <artifactId>javasim</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <!-- Plugins -->
+ <build>
+ <resources>
+ <resource>
+ <targetPath>../etc</targetPath>
+ <directory>src/main/etc</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
+ </build>
+
+ <profiles>
+ <!-- Name: debug
+ Descr: Enable remote debuging for tests
+ -->
+ <profile>
+ <id>debug</id>
+ <activation>
+ <property>
+ <name>debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.security.args} ${surefire.jdwp.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <profile>
+ <id>no-debug</id>
+ <activation>
+ <property>
+ <name>!debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.security.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+
+ </profiles>
+
+</project>
Property changes on: sam/trunk/modules/core/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventMessage.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventMessage.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventMessage.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+import java.util.Iterator;
+
+/**
+ * An event message will be send when an Event occurs.<br>
+ * It consist of a timestamp and associated event properties.
+ * EventMessage's are written to {@link org.jboss.sam.StreamOutput}'s.
+ * <p>
+ * EventMessage's can be mapped to {@link org.jboss.sam.chart.Chart}'s.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventMessage<T>
+{
+ /**
+ * Creation timestamp.
+ * @return
+ */
+ long getTimestamp();
+
+ /**
+ * Get an event property by name
+ * @param name
+ * @return
+ */
+ Object getProperty(String name);
+
+ /**
+ * Iterate over event property names
+ * @return
+ */
+ Iterator<String> getPropertyNames();
+
+ /**
+ * Access the underlying implementation
+ * @return
+ */
+ T getUnderlying();
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessor.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessor.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessor.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+import java.util.Iterator;
+
+/**
+ * An event processor glues together {@link org.jboss.sam.StreamInput} and {@link org.jboss.sam.StreamOutput}
+ * and provides a way to register {@link org.jboss.sam.ProcessingStatement}'s,
+ * both bound (event forwarding) and unbound (event aggregation and filtering).
+ * <p>
+ * Instances are created through {@link org.jboss.sam.EventProcessorFactory}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventProcessor<T>
+{
+ /**
+ * Add input to the runtime
+ * @param streamInput
+ */
+ void addInput(StreamInput streamInput);
+
+ /**
+ * Remove input from the runtime
+ * @param streamName
+ */
+ void removeInput(String streamName);
+
+ /**
+ * Add output to the runtime
+ * @param streamOutput
+ */
+ void addOutput(StreamOutput streamOutput);
+
+ /**
+ * Remove output from the runtime
+ * @param streamName
+ */
+ void removeOutput(String streamName);
+
+ /**
+ * Iterate over input stream names
+ * @return
+ */
+ Iterator<String> getStreamInputNames();
+
+ /**
+ * Iterate over output stream names
+ * @return
+ */
+ Iterator<String> getStreamOutputNames();
+
+ /**
+ * Creates a statement
+ *
+ * @param statementName
+ * @param epl
+ * @return
+ */
+ ProcessingStatement registerStatement(String statementName, String epl);
+
+ /**
+ * Creates a statement and binds it to an output stream.
+ *
+ * @param streamOutputName
+ * @param statementName
+ * @param epl
+ * @return
+ */
+ ProcessingStatement registerBoundStatement(String streamOutputName, String statementName, String epl);
+
+ /**
+ * Cleanup a statement and remove it
+ * @param statementName
+ */
+ void clearStatement(String statementName);
+
+ /**
+ * Cleanup all statements and remove them
+ */
+ void clearAllStatements();
+
+ /**
+ * Iterate over statement names
+ * @return
+ */
+ Iterator<String> getStatementNames();
+
+ String getName();
+
+ T getUnderlying();
+
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessorFactory.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessorFactory.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessorFactory.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+import org.jboss.sam.internal.esper.EsperRuntimeImpl;
+
+import java.net.URL;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class EventProcessorFactory
+{
+ protected EventProcessorFactory()
+ {
+ }
+
+ public static EventProcessorFactory newInstance()
+ {
+ return new DefaultEventProcessorFactory();
+ }
+
+ public abstract EventProcessor createRuntime(String name, URL config);
+
+ static class DefaultEventProcessorFactory extends EventProcessorFactory
+ {
+
+ public EventProcessor createRuntime(String name, URL config)
+ {
+ return new EsperRuntimeImpl(name, config);
+ }
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/EventProcessorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/ProcessingStatement.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/ProcessingStatement.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/ProcessingStatement.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+/**
+ * Represents an EPL (event processing languge) statement.
+ * Statements are associated with a {@link org.jboss.sam.EventProcessor}
+ * and can be bound to a {@link org.jboss.sam.StreamOutput} to forward events,
+ * or used unbound to aggregate and filter events.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ProcessingStatement<T>
+{
+ /**
+ * Statements are managed by name
+ * @return
+ */
+ String getName();
+
+ /**
+ * Get the EPL expression this statement was created from
+ * @return
+ */
+ String getExpression();
+
+ /**
+ * Check wether the statement is bound to a {@link org.jboss.sam.StreamOutput}
+ * @return
+ */
+ boolean isBound();
+
+ /**
+ * Access the underlying implementation
+ * @return
+ */
+ T getUnderlying();
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/ProcessingStatement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInput.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInput.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInput.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+/**
+ * Stream inputs are registered with {@link org.jboss.sam.EventProcessor}'s
+ * and notify registered {@link org.jboss.sam.StreamInputCallback}'s when new events arrive.
+ * Typically the CEP runtime itself act's as such a listener in order to finished events.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface StreamInput<T>
+{
+ <T extends StreamInput> T start();
+
+ <T extends StreamInput> T stop();
+
+ boolean isStarted();
+
+ /**
+ * Register a callback
+ * @param streamInputCallback an event processing instance
+ */
+ void registerCallback(StreamInputCallback streamInputCallback);
+
+ /**
+ * Remove all registered callbacks
+ */
+ void clearCallbacks();
+
+ /**
+ * Stream input name
+ * @return
+ */
+ String getStreamName();
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInputCallback.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInputCallback.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInputCallback.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+/**
+ * Registered with a {@link StreamInput} and will be notified when new events arrive.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface StreamInputCallback
+{
+ void onEvent(Object args);
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamInputCallback.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamOutput.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamOutput.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamOutput.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam;
+
+/**
+ * Stream outputs are used to forward events. Typically the last step
+ * of an event processing chain leads to an action which receive events through
+ * the <code>write(...)</code> method.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface StreamOutput<T>
+{
+ <T extends StreamOutput> T start();
+
+ <T extends StreamOutput> T stop();
+
+ boolean isStarted();
+
+ /**
+ * Receive forwarded events
+ * @param args an event stream
+ */
+ void write(EventMessage[] args);
+
+ /**
+ * Stream output name
+ * @return
+ */
+ String getStreamName();
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/StreamOutput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/Chart.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/Chart.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/Chart.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.io.OutputStream;
+
+/**
+ * A chart repesentation.<br>
+ * Can be an in-memory representation or a link to a physical
+ * artifact (caching).
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface Chart<T>
+{
+ String getName();
+
+ void writeTo(OutputStream out);
+
+ T getUnderlying();
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/Chart.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Builds charts from payload and mapping information.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartBuilder
+{
+ ChartMetadata getMetadata();
+
+ Chart buildChart(EventMessage[] events, ChartMapping mapping);
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMapping.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMapping.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMapping.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.util.Collections;
+import java.util.List;
+import java.io.Serializable;
+
+/**
+ * An immutable mapping of index and data values,
+ * that can be passed to a {@link org.jboss.sam.chart.ChartBuilder} to construct
+ * {@link org.jboss.sam.chart.Chart}'s. Each instance is identifed by an alias name
+ * and will be maintained through a {@link ChartMappingRegistry}.
+ * <p>
+ * ChartMappings should be created once and reused.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class ChartMapping implements Serializable
+{
+ String aliasName;
+
+ List<PropertyMapping> indexMappings;
+
+ List<PropertyMapping> propertyMappings;
+
+ public ChartMapping(String aliasName, List<PropertyMapping> indexMappings, List<PropertyMapping> propertyMappings)
+ {
+ this.aliasName = aliasName;
+ this.indexMappings = Collections.unmodifiableList(indexMappings);
+ this.propertyMappings = Collections.unmodifiableList(propertyMappings);
+ }
+
+ String getAliasName()
+ {
+ return this.aliasName;
+ }
+
+ /**
+ * Returns an immutable index mapping for a key.
+ * The key is specified in {@link org.jboss.sam.chart.ChartMetadata}
+ * @return
+ */
+ public PropertyMapping getIndexMapping(String key)
+ {
+ PropertyMapping indexMapping = resolveKey(key, indexMappings);
+ if(null==indexMapping)
+ throw new IllegalArgumentException("Failed to resolved index mapping by key: "+ key);
+
+ return indexMapping;
+ }
+
+ /**
+ * Returns an immutable data mapping
+ * @return
+ */
+ public PropertyMapping getPropertyMapping(String key)
+ {
+ PropertyMapping dataMapping = resolveKey(key, propertyMappings);
+ if(null==dataMapping)
+ throw new IllegalArgumentException("Failed to resolved data mapping by key: "+ key);
+
+ return dataMapping;
+ }
+
+ private PropertyMapping resolveKey(String key, List<PropertyMapping> mappings)
+ {
+ PropertyMapping mapping = null;
+ for(PropertyMapping index : mappings)
+ {
+ if(index.getTargetKey().equals(key))
+ {
+ mapping = index;
+ break;
+ }
+ }
+
+ return mapping;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * Maintains {@link ChartMapping}'s.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartMappingRegistry
+{
+ void registerChartMapping(ChartMapping chartMaping);
+
+ ChartMapping getChartMapping(String aliasName);
+
+ void clearChartMapping(String aliasName);
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ChartMappingRegistryFactory
+{
+ abstract ChartMappingRegistry createChartMappingRegistry();
+
+ public static ChartMappingRegistryFactory newInstance()
+ {
+ return new DefaultChartMappingRegistryFactory();
+ }
+
+ static class DefaultChartMappingRegistryFactory extends ChartMappingRegistryFactory
+ {
+
+ ChartMappingRegistry createChartMappingRegistry()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.util.Iterator;
+
+/**
+ * Metadata for chart types associated with a {@link org.jboss.sam.chart.ChartBuilder}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartMetadata
+{
+ String getTypeName();
+
+ Iterator<String> getSupportedIndexNames();
+
+ Iterator<String> getSupportedPropertyNames();
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServer.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServer.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServer.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Allows creation and retrieval of {@link org.jboss.sam.chart.Chart} repesentations.
+ * A chart server will be associated with a {@link org.jboss.sam.chart.ChartMappingRegistry} that stores
+ * the preconfigured mappings.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartServer
+{
+ /**
+ * Get chart by name
+ * @param chartName
+ * @return
+ */
+ Chart getChart(String chartName);
+
+ /**
+ * Create a new chart under a given name
+ * @param chartName
+ * @param payloads
+ * @return
+ */
+ Chart createChart(String chartName, String chartMappingAlias, EventMessage[] payloads);
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ChartServerFactory
+{
+ abstract ChartServer createChartServer();
+
+ public static ChartServerFactory newInstance()
+ {
+ return new DefaultChartServerFactory();
+ }
+
+ static class DefaultChartServerFactory extends ChartServerFactory
+ {
+ ChartServer createChartServer()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+import java.io.Serializable;
+
+/**
+ * Maps {@link org.jboss.sam.EventMessage} properties
+ * to chart attributes, like X-Axis and Y-Axis values.<br>
+ * Supports constants.
+ *
+ * @see org.jboss.sam.chart.ChartMapping
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class PropertyMapping implements Serializable
+{
+ /**
+ * The key to which a mapped property will be assigned
+ */
+ private String targetKey;
+
+ /**
+ * Name of the mapped {@link org.jboss.sam.EventMessage} property
+ */
+ private String sourcePropertyName;
+
+ private String constantValue = null;
+
+ public PropertyMapping(String targetKey, String sourcePropertyName)
+ {
+ this.targetKey = targetKey;
+ this.sourcePropertyName = sourcePropertyName;
+ }
+
+ public String getTargetKey()
+ {
+ return targetKey;
+ }
+
+ public PropertyMapping constant(String constant)
+ {
+ this.constantValue = constant.intern();
+ return this;
+ }
+
+ /**
+ * Retrieve an {@link org.jboss.sam.EventMessage} value
+ * by mapping to {@link #sourcePropertyName}
+ * @param payload
+ * @return
+ */
+ public Object map(EventMessage payload)
+ {
+ Object mapping;
+ if(null==constantValue)
+ mapping = payload.getProperty(sourcePropertyName);
+ else
+ mapping = constantValue;
+
+ return mapping;
+ }
+
+
+ public String toString()
+ {
+ String prop = sourcePropertyName != null ? sourcePropertyName : "CONSTANT";
+ return targetKey +"->"+prop;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.category.DefaultCategoryDataset;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BarChartBuilder implements ChartBuilder
+{
+ private String chartTitle;
+ private String domainAxisLabel, rangeAxisLabel;
+
+ public final static String INDEX_1 = "series";
+ public final static String INDEX_2 = "x_value";
+ public final static String PROP_1 = "y_value";
+
+ public static List<String> INDEXES = new ArrayList<String>();
+ public static List<String> PROPS = new ArrayList<String>();
+
+ static
+ {
+ INDEXES.add(INDEX_1);
+ INDEXES.add(INDEX_2);
+
+ PROPS.add(PROP_1);
+ }
+
+ public BarChartBuilder(String chartTitle, String domainAxisLabel, String rangeAxisLabel)
+ {
+ this.chartTitle = chartTitle;
+ this.domainAxisLabel = domainAxisLabel;
+ this.rangeAxisLabel = rangeAxisLabel;
+ }
+
+ public ChartMetadata getMetadata()
+ {
+ return new ChartMetadata() {
+
+ public String getTypeName()
+ {
+ return "BarChart";
+ }
+
+ public Iterator<String> getSupportedIndexNames()
+ {
+ return INDEXES.iterator();
+ }
+
+ public Iterator<String> getSupportedPropertyNames()
+ {
+ return PROPS.iterator();
+ }
+ };
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ CategoryDataset dataset = createDataset(events, mapping);
+
+ JFreeChart chart = org.jfree.chart.ChartFactory.createBarChart(
+ chartTitle, // chart title
+ domainAxisLabel, // domain axis label
+ rangeAxisLabel, // range axis label
+ dataset, // data
+ PlotOrientation.VERTICAL,
+ true, // include legend
+ true, // tooltips?
+ false // URLs?
+ );
+
+ //customize(chart);
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private CategoryDataset createDataset(EventMessage[] payloads, ChartMapping mapping)
+ {
+ DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+
+ for(EventMessage event : payloads)
+ {
+ Number number = (Number) (mapping.getPropertyMapping(PROP_1)).map(event);
+ Comparable c1 = (Comparable) (mapping.getIndexMapping(INDEX_1)).map(event);
+ Comparable c2 = (Comparable) (mapping.getIndexMapping(INDEX_2)).map(event);
+ dataset.addValue(
+ number, // value
+ c1, // seriesName
+ c2 // category
+ );
+ }
+
+ return dataset;
+ }
+
+ /**
+ * Example customization
+ *
+ * @todo Create common look and feel
+ *
+ * @param chart
+ */
+ /*private void customize(JFreeChart chart)
+ {
+ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+ // set the background color for the chart...
+ chart.setBackgroundPaint(new Color(0xBBBBDD));
+ // get a reference to the plot for further customisation...
+ CategoryPlot plot = chart.getCategoryPlot();
+ // set the range axis to display integers only...
+ NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+ rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+ // disable bar outlines...
+ BarRenderer renderer = (BarRenderer) plot.getRenderer();
+ renderer.setCreateEntities(true);
+
+ // set up gradient paints for series...
+ GradientPaint gp0 = new GradientPaint(
+ 0.0f, 0.0f, Color.blue,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ GradientPaint gp1 = new GradientPaint(
+ 0.0f, 0.0f, Color.green,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ GradientPaint gp2 = new GradientPaint(
+ 0.0f, 0.0f, Color.red,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ renderer.setSeriesPaint(0, gp0);
+ renderer.setSeriesPaint(1, gp1);
+ renderer.setSeriesPaint(2, gp2);
+
+ // OPTIONAL CUSTOMISATION COMPLETED.
+ } */
+
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.JFreeChart;
+
+import java.io.OutputStream;
+import java.util.UUID;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JFreeChartImpl implements Chart<JFreeChart>
+{
+ private ChartMetadata metadata;
+
+ private JFreeChart delegate;
+
+ private String name;
+
+ public JFreeChartImpl(String name, JFreeChart delegate)
+ {
+ this.name = name;
+ this.delegate = delegate;
+ }
+
+ public JFreeChartImpl(JFreeChart delegate)
+ {
+ this(UUID.randomUUID().toString(), delegate);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void writeTo(OutputStream out)
+ {
+ throw new RuntimeException("Not implemented");
+ }
+
+ public JFreeChart getUnderlying()
+ {
+ return delegate;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+import java.util.Iterator;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LineChartBuilder implements ChartBuilder
+{
+ private String chartTitle;
+ private String xAxisLabel,yAxisLabel;
+
+ public final static String INDEX_1 = "series";
+ public final static String INDEX_2 = "x_value";
+ public final static String DATA_1 = "y_value";
+
+ public LineChartBuilder(String chartTitle, String xAxisLabel, String yAxisLabel)
+ {
+ this.chartTitle = chartTitle;
+ this.xAxisLabel = xAxisLabel;
+ this.yAxisLabel = yAxisLabel;
+ }
+
+ public ChartMetadata getMetadata()
+ {
+ return null;
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ XYSeriesCollection dataset = createDataset(events, mapping);
+
+ JFreeChart chart = ChartFactory.createXYLineChart(
+ chartTitle, // chart title
+ xAxisLabel, // x axis label
+ yAxisLabel, // y axis label
+ dataset, // data
+ PlotOrientation.VERTICAL,
+ true, // include legend
+ true, // tooltips
+ false // urls
+ );
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private XYSeriesCollection createDataset(EventMessage[] events, ChartMapping mapping)
+ {
+
+ XYSeriesCollection dataset = new XYSeriesCollection();
+
+ for(EventMessage event : events)
+ {
+ XYSeries series = getOrCreateSeries(
+ dataset,
+ (String)mapping.getIndexMapping(INDEX_1).map(event)
+ );
+ series.add(
+ (Double)mapping.getIndexMapping(INDEX_2).map(event),
+ (Double)mapping.getPropertyMapping(DATA_1).map(event)
+ );
+ }
+
+ return dataset;
+ }
+
+ private XYSeries getOrCreateSeries(XYSeriesCollection dataset, Comparable key)
+ {
+ XYSeries match = null;
+ Iterator it = dataset.getSeries().iterator();
+ while(it.hasNext())
+ {
+ XYSeries series = (XYSeries)it.next();
+ if(series.getKey().equals(key))
+ {
+ match = series;
+ break;
+ }
+ }
+
+ if(null==match)
+ {
+ match = new XYSeries(key);
+ dataset.addSeries(match);
+ }
+
+ return match;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.data.general.DefaultPieDataset;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class PieChartBuilder implements ChartBuilder
+{
+ private String chartName;
+ //private DefaultPieDataset dataset;
+
+ public final static String INDEX_1 = "category";
+ public final static String DATA_1 = "percentage";
+
+ public PieChartBuilder(String chartName)
+ {
+ this.chartName = chartName;
+ }
+
+
+ public ChartMetadata getMetadata()
+ {
+ return null;
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ DefaultPieDataset dataset = createDataset(events, mapping);
+
+ JFreeChart chart = ChartFactory.createPieChart(
+ chartName,
+ dataset,
+ true, // legend?
+ true, // tooltips?
+ false // URLs?
+ );
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private DefaultPieDataset createDataset(EventMessage[] events, ChartMapping mapping)
+ {
+ DefaultPieDataset dataset = new DefaultPieDataset();
+
+ for(EventMessage event : events)
+ {
+ dataset.setValue(
+ (String)mapping.getIndexMapping(INDEX_1).map(event), // category
+ (Double)mapping.getPropertyMapping(DATA_1).map(event) // percentage
+ );
+ }
+
+ return dataset;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.esper;
+
+import com.espertech.esper.client.EPStatement;
+import org.jboss.sam.ProcessingStatement;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EsperProcessingStatement implements ProcessingStatement<EPStatement>
+{
+ private EPStatement delegate;
+
+ protected String name;
+
+ private boolean bound;
+
+ public EsperProcessingStatement(EPStatement delegate)
+ {
+ this(delegate, false);
+ }
+
+ public EsperProcessingStatement(EPStatement delegate, boolean isBound)
+ {
+ this.bound = isBound;
+ this.delegate = delegate;
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public boolean isBound()
+ {
+ return this.bound;
+ }
+
+ public String getExpression()
+ {
+ return delegate.getText();
+ }
+
+ public EPStatement getUnderlying()
+ {
+ return delegate;
+ }
+
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.esper;
+
+import com.espertech.esper.client.*;
+import org.jboss.sam.*;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * A SAM runtime implementation that builds atop of Esper.
+ * It processes imput streams and passes event representations to the underlying Esper instance.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EsperRuntimeImpl implements StreamInputCallback, EventProcessor<EPServiceProvider>
+{
+ private String runtimeName;
+
+ private EPServiceProvider epService;
+
+ private Map<String, StreamInput> inputStreams = new ConcurrentHashMap<String, StreamInput>();
+ private Map<String, StreamOutput> outputStreams = new ConcurrentHashMap<String, StreamOutput>();
+
+ private Map<String, ProcessingStatement> statements = new ConcurrentHashMap<String, ProcessingStatement>();
+
+ public EsperRuntimeImpl(String name, URL config)
+ {
+ this.runtimeName = name;
+ Configuration configuration = new Configuration();
+ configuration.configure( config );
+ this.epService = EPServiceProviderManager.getProvider(name, configuration);
+
+ /*epService.getEPRuntime().setUnmatchedListener(
+ new UnmatchedListener()
+ {
+
+ public void update(EventBean event)
+ {
+ System.out.println("! Unmatched: " + event);
+ }
+ }
+ );*/
+ }
+
+ public void addInput(StreamInput streamInput)
+ {
+ streamInput.registerCallback(this);
+ this.inputStreams.put(streamInput.getStreamName(), streamInput);
+ }
+
+ public void removeInput(String streamName)
+ {
+ this.inputStreams.remove(streamName);
+ }
+
+ public Iterator<String> getStreamInputNames()
+ {
+ return this.inputStreams.keySet().iterator();
+ }
+
+ public void addOutput(StreamOutput streamOutput)
+ {
+ this.outputStreams.put(streamOutput.getStreamName(), streamOutput);
+ }
+
+ public void removeOutput(String streamName)
+ {
+ this.outputStreams.remove(streamName);
+ }
+
+ public Iterator<String> getStreamOutputNames()
+ {
+ return this.outputStreams.keySet().iterator();
+ }
+
+ /**
+ * Any event send to an stream goes to the EPRuntime
+ * @param args
+ */
+ public void onEvent(Object args)
+ {
+ epService.getEPRuntime().sendEvent(args);
+ }
+
+ public ProcessingStatement registerStatement(String statementName, String epl)
+ {
+ EPStatement epStatement = epService.getEPAdministrator().createEPL(epl, statementName);
+ return new EsperProcessingStatement(epStatement);
+ }
+
+ public ProcessingStatement registerBoundStatement(String outputStreamName, String statementName, String epl)
+ {
+ StreamOutput streamOutput = this.outputStreams.get(outputStreamName);
+ if(null == streamOutput)
+ throw new IllegalArgumentException("No such output stream: " + outputStreamName);
+
+ EPStatement epStatement = epService.getEPAdministrator().createEPL(epl, statementName);
+ EsperProcessingStatement statement = new EsperProcessingStatement(epStatement);
+ StreamOutputAdapter adapter = new StreamOutputAdapter(streamOutput);
+ statement.getUnderlying().addListener(adapter);
+ return statement;
+ }
+
+ public Iterator<String> getStatementNames()
+ {
+ return this.statements.keySet().iterator();
+ }
+
+
+ public void clearStatement(String statementName)
+ {
+ ProcessingStatement stmt = statements.get(statementName);
+ if(null==stmt)
+ throw new IllegalArgumentException("No such statement: " + statementName);
+
+ statements.remove(statementName);
+ }
+
+ public void clearAllStatements()
+ {
+ Iterator<String> stmtNames = getStatementNames();
+ while(stmtNames.hasNext())
+ {
+ clearStatement(stmtNames.next());
+ }
+ }
+
+ public String getName()
+ {
+ return this.runtimeName;
+ }
+
+ public EPServiceProvider getUnderlying()
+ {
+ return this.epService;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EventAdapter.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EventAdapter.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EventAdapter.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.esper;
+
+import com.espertech.esper.event.EventBean;
+import org.jboss.sam.EventMessage;
+
+import java.util.Iterator;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventAdapter implements EventMessage<EventBean>
+{
+ private final EventBean delegate;
+
+ private long timestamp;
+
+ /**
+ * Create with an implicit timestamp
+ *
+ * @param delegate
+ */
+ public EventAdapter(EventBean delegate)
+ {
+ this.delegate = delegate;
+ this.timestamp = System.currentTimeMillis();
+ }
+
+ /**
+ * Create with an external timestamp
+ * @param delegate
+ * @param timestamp
+ */
+ public EventAdapter(EventBean delegate, long timestamp)
+ {
+ this.delegate = delegate;
+ this.timestamp = timestamp;
+ }
+
+ public long getTimestamp()
+ {
+ return this.timestamp;
+ }
+
+ public Iterator<String> getPropertyNames()
+ {
+ Iterator<String> it = new Iterator<String>()
+ {
+
+ private String[] names = delegate.getEventType().getPropertyNames();
+ private int index=0;
+
+ public boolean hasNext()
+ {
+ return names.length>0 && index<names.length-1;
+ }
+
+ public String next()
+ {
+ String next = names[index];
+ index++;
+ return next;
+ }
+
+ public void remove()
+ {
+ throw new IllegalArgumentException("Not implemented");
+ }
+ };
+
+ return it;
+ }
+
+ public Object getProperty(String property)
+ {
+ return delegate.get(property);
+ }
+
+ public EventBean getUnderlying()
+ {
+ return delegate;
+ }
+
+
+ public String toString()
+ {
+ return "EventAdapter {"+delegate.toString()+"}";
+ }
+}
+
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/EventAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.esper;
+
+import com.espertech.esper.client.UpdateListener;
+import com.espertech.esper.event.EventBean;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+
+/**
+ * Adopts an Esper {@link com.espertech.esper.client.UpdateListener}
+ * to to an FX {@link org.jboss.sam.StreamOutput}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class StreamOutputAdapter implements UpdateListener
+{
+ protected StreamOutput delegate;
+
+ public StreamOutputAdapter(StreamOutput eventListener)
+ {
+ this.delegate = eventListener;
+ }
+
+ public void update(EventBean[] newEvents, EventBean[] oldEvents)
+ {
+ EventMessage[] args1 = adoptPayload(newEvents);
+ EventMessage[] args2 = adoptPayload(oldEvents);
+
+ // TODO: review StreamOutput interface wrt oldEvents
+
+ delegate.write(args1);
+ }
+
+ private EventMessage[] adoptPayload(EventBean[] data)
+ {
+ int size = data !=null ? data.length : 0;
+ EventMessage[] payloads = new EventMessage[size];
+
+ for(int i=0; i<size; i++)
+ {
+ payloads[i] = new EventAdapter(data[i]);
+ }
+
+ return payloads;
+ }
+
+ StreamOutput getUnderlying()
+ {
+ return this.delegate;
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMDispatcher.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMDispatcher.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMDispatcher.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.stream;
+
+import org.jboss.sam.StreamInputCallback;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InVMDispatcher
+{
+ public final static String DEFAULT_CHANNEL_NAME = "InVM-Channel";
+
+ private InVMStreamRegistry channelRegistry;
+
+ private String streamName;
+
+ public InVMDispatcher(String streamName)
+ {
+ this.streamName = streamName;
+ this.channelRegistry = InVMStreamRegistry.getInstance();
+ }
+
+ public void dispatch(Object event)
+ {
+ for(StreamInputCallback callback : channelRegistry.getChannelCallbacks(streamName))
+ {
+ callback.onEvent(event);
+ }
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMDispatcher.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamInput.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamInput.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamInput.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.stream;
+
+import org.jboss.sam.StreamInput;
+import org.jboss.sam.StreamInputCallback;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InVMStreamInput implements StreamInput
+{
+ private boolean started;
+
+ private String streamName;
+
+ InVMStreamRegistry channelRegistry;
+
+ public InVMStreamInput(String name)
+ {
+ this.streamName = name;
+ this.channelRegistry = InVMStreamRegistry.getInstance();
+ }
+
+ public StreamInput start()
+ {
+ this.started = true;
+ return this;
+ }
+
+ public StreamInput stop()
+ {
+ this.started = false;
+ return this;
+ }
+
+ public boolean isStarted()
+ {
+ return this.started;
+ }
+
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
+
+ public void registerCallback(StreamInputCallback listener)
+ {
+ channelRegistry.getChannelCallbacks(streamName).add(listener);
+ }
+
+ public void clearCallbacks()
+ {
+ channelRegistry.getChannelCallbacks(streamName).clear();
+ }
+
+ public void newEvent(Object args)
+ {
+ for(StreamInputCallback callback : channelRegistry.getChannelCallbacks(streamName))
+ {
+ callback.onEvent(args);
+ }
+
+ }
+
+ public String toString()
+ {
+ return "InVMInputAdapter{"+this.streamName +"}";
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamInput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java
===================================================================
--- sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java (rev 0)
+++ sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.internal.stream;
+
+import org.jboss.sam.StreamInputCallback;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InVMStreamRegistry
+{
+ private Map<String, List<StreamInputCallback>> streams = new ConcurrentHashMap<String, List<StreamInputCallback>>();
+
+ private static InVMStreamRegistry INSTANCE;
+
+ private InVMStreamRegistry()
+ {
+ }
+
+ public static InVMStreamRegistry getInstance()
+ {
+ if(null == INSTANCE)
+ INSTANCE = new InVMStreamRegistry();
+ return INSTANCE;
+ }
+
+ public List<StreamInputCallback> getChannelCallbacks(String streamName)
+ {
+ if(null == streams.get(streamName))
+ streams.put(streamName, new CopyOnWriteArrayList<StreamInputCallback>());
+ return streams.get(streamName);
+ }
+}
Property changes on: sam/trunk/modules/core/src/main/java/java/org/jboss/sam/internal/stream/InVMStreamRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/etc/tst.policy
===================================================================
--- sam/trunk/modules/core/src/test/etc/tst.policy (rev 0)
+++ sam/trunk/modules/core/src/test/etc/tst.policy 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,4 @@
+grant {
+ permission java.security.AllPermission;
+};
+
Added: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java
===================================================================
--- sam/trunk/modules/core/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java (rev 0)
+++ sam/trunk/modules/core/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,176 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam;
+
+import junit.framework.Assert;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Unit test helper borrowed from esper samples.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BufferedStreamOutput implements StreamOutput
+{
+ private List<EventMessage[]> newDataLists;
+ private List<EventMessage[]> oldDataLists;
+
+ private EventMessage[] lastNewDatas;
+ private EventMessage[] lastOldDatas;
+ private boolean isInvoked;
+
+ private String streamName;
+
+ private boolean started;
+
+ public static String NAME = "InVM";
+
+ public BufferedStreamOutput()
+ {
+ this(UUID.randomUUID().toString());
+ }
+
+ public BufferedStreamOutput(String name)
+ {
+ this.streamName = name;
+ newDataLists = new LinkedList<EventMessage[]>();
+ oldDataLists = new LinkedList<EventMessage[]>();
+ }
+
+
+ public BufferedStreamOutput start()
+ {
+ this.started = true;
+ return this;
+ }
+
+ public BufferedStreamOutput stop()
+ {
+ this.started = false;
+ return this;
+ }
+
+ public boolean isStarted()
+ {
+ return this.started;
+ }
+
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
+
+ public void write(EventMessage[] args)
+ {
+ update(args, new EventMessage[]{});
+ }
+
+ public void update(EventMessage[] newDatas, EventMessage[] oldDatas)
+ {
+ this.oldDataLists.add(oldDatas);
+ this.newDataLists.add(newDatas);
+
+ this.lastNewDatas = newDatas;
+ this.lastOldDatas = oldDatas;
+
+ isInvoked = true;
+ }
+
+ public void reset()
+ {
+ this.oldDataLists.clear();
+ this.newDataLists.clear();
+ this.lastNewDatas = null;
+ this.lastOldDatas = null;
+ isInvoked = false;
+ }
+
+ public EventMessage[] getLastNewData()
+ {
+ return lastNewDatas;
+ }
+
+ public EventMessage[] getAndResetLastNewData()
+ {
+ EventMessage[] lastNews = lastNewDatas;
+ lastNewDatas = null;
+ return lastNews;
+ }
+
+ public EventMessage[] getLastOldData()
+ {
+ return lastOldDatas;
+ }
+
+ public List<EventMessage[]> getNewDataList()
+ {
+ return newDataLists;
+ }
+
+ public List<EventMessage[]> getOldDataList()
+ {
+ return oldDataLists;
+ }
+
+ public boolean isInvoked()
+ {
+ return isInvoked;
+ }
+
+ public boolean getAndClearIsInvoked()
+ {
+ boolean invoked = isInvoked;
+ isInvoked = false;
+ return invoked;
+ }
+
+ public void setLastNewData(EventMessage[] lastNewDatas)
+ {
+ this.lastNewDatas = lastNewDatas;
+ }
+
+ public void setLastOldData(EventMessage[] lastOldDatas)
+ {
+ this.lastOldDatas = lastOldDatas;
+ }
+
+ public EventMessage assertOneGetNewAndReset()
+ {
+ Assert.assertTrue(isInvoked);
+
+ Assert.assertEquals(1, newDataLists.size());
+ Assert.assertEquals(1, oldDataLists.size());
+
+ Assert.assertEquals(1, lastNewDatas.length);
+ Assert.assertNull(lastOldDatas);
+
+ EventMessage lastNew = lastNewDatas[0];
+ reset();
+ return lastNew;
+ }
+
+}
\ No newline at end of file
Property changes on: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/InMemoryDatabase.java
===================================================================
--- sam/trunk/modules/core/src/test/java/org/jboss/test/sam/InMemoryDatabase.java (rev 0)
+++ sam/trunk/modules/core/src/test/java/org/jboss/test/sam/InMemoryDatabase.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam;
+
+import java.sql.*;
+
+/**
+ * A simple in memory database backed by HSQL.<p>
+ * Connection details:
+ *
+ * <ul>
+ * <li>Conn: {@link #CONNECTION_STING}
+ * <li>User: {@link #USER}
+ * <li>Pass: {@link #PASSWORD}
+ * <ul>
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InMemoryDatabase
+{
+ private Connection conn;
+
+ private final static String CONNECTION_STING = "jdbc:hsqldb:mem:SamTestSetup";
+ private static final String USER = "sa";
+ private static final String PASSWORD = "";
+
+ public InMemoryDatabase()
+ {
+ try
+ {
+ Class.forName("org.hsqldb.jdbcDriver");
+ conn = DriverManager.getConnection(CONNECTION_STING, USER, PASSWORD);
+ } catch (Exception e)
+ {
+ throw new RuntimeException("Failed to setup HSQL database", e);
+ }
+ }
+
+ public synchronized void query(String expression) throws SQLException
+ {
+
+ Statement st = null;
+ ResultSet rs = null;
+
+ st = conn.createStatement(); // statement objects can be reused with
+
+ // repeated calls to execute but we
+ // choose to make a new one each time
+ rs = st.executeQuery(expression); // run the query
+
+ // do something with the result set.
+ dump(rs);
+ st.close(); // NOTE!! if you close a statement the associated ResultSet is
+
+ // closed too
+ // so you should copy the contents to some other object.
+ // the result set is invalidated also if you recycle an Statement
+ // and try to execute some other query before the result set has been
+ // completely examined.
+ }
+
+ /**
+ * Use for SQL commands CREATE, DROP, INSERT and UPDATE
+ *
+ * @param expression
+ * @throws SQLException
+ */
+ public synchronized void update(String expression) throws SQLException {
+
+ Statement st = null;
+
+ st = conn.createStatement(); // statements
+
+ int i = st.executeUpdate(expression); // run the query
+
+ if (i == -1) {
+ System.out.println("db error : " + expression);
+ }
+
+ st.close();
+ } // void update()
+
+ public void shutdown() throws SQLException {
+
+ Statement st = conn.createStatement();
+
+ // db writes out to files and performs clean shuts down
+ // otherwise there will be an unclean shutdown
+ // when program ends
+ st.execute("SHUTDOWN");
+ conn.close(); // if there are no other open connection
+ }
+
+
+ public static void dump(ResultSet rs) throws SQLException {
+
+ // the order of the rows in a cursor
+ // are implementation dependent unless you use the SQL ORDER statement
+ ResultSetMetaData meta = rs.getMetaData();
+ int colmax = meta.getColumnCount();
+ int i;
+ Object o = null;
+
+ // the result set is a cursor into the data. You can only
+ // point to one row at a time
+ // assume we are pointing to BEFORE the first row
+ // rs.next() points to next row and returns true
+ // or false if there is no next row, which breaks the loop
+ for (; rs.next(); ) {
+ for (i = 0; i < colmax; ++i) {
+ String cname = rs.getMetaData().getColumnName(i+1);
+ o = rs.getObject(i + 1); // Is SQL the first column is indexed
+
+ // with 1 not 0
+ System.out.print(cname+":"+o.toString() + "\t ");
+ }
+
+ System.out.println(" ");
+ }
+ }
+
+
+ public String toString()
+ {
+ return "InMemoryDB {conn="+CONNECTION_STING+", user="+USER+", pass="+PASSWORD+"}";
+ }
+}
Property changes on: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/InMemoryDatabase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/MapEventMessage.java
===================================================================
--- sam/trunk/modules/core/src/test/java/org/jboss/test/sam/MapEventMessage.java (rev 0)
+++ sam/trunk/modules/core/src/test/java/org/jboss/test/sam/MapEventMessage.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam;
+
+import org.jboss.sam.EventMessage;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class MapEventMessage implements EventMessage<Map>
+{
+ private Map<String, Object> data = new HashMap<String, Object>();
+
+ private long timestamp;
+
+ public MapEventMessage()
+ {
+ this(System.currentTimeMillis());
+ }
+
+ public MapEventMessage(long timestamp)
+ {
+ this.timestamp = timestamp;
+ }
+
+ public MapEventMessage put(String key, Object value)
+ {
+ data.put(key, value);
+ return this;
+ }
+
+ public Object getProperty(String name)
+ {
+ return data.get(name);
+ }
+
+ public Map getUnderlying()
+ {
+ return data;
+ }
+
+ public long getTimestamp()
+ {
+ return this.timestamp;
+ }
+
+ public Iterator<String> getPropertyNames()
+ {
+ return this.data.keySet().iterator();
+ }
+}
Property changes on: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/MapEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/SamTestSetup.java
===================================================================
--- sam/trunk/modules/core/src/test/java/org/jboss/test/sam/SamTestSetup.java (rev 0)
+++ sam/trunk/modules/core/src/test/java/org/jboss/test/sam/SamTestSetup.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam;
+
+import junit.framework.TestCase;
+import org.jboss.sam.EventProcessor;
+import org.jboss.sam.EventProcessorFactory;
+import org.jboss.sam.StreamInput;
+import org.jboss.sam.internal.stream.InVMStreamInput;
+import org.jboss.sam.internal.stream.InVMDispatcher;
+
+import java.net.URL;
+
+/**
+ * Basic SAM test skeleton. Test cases should derive from this class.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class SamTestSetup extends TestCase
+{
+ protected EventProcessor eventProcessor;
+ protected StreamInput streamInput;
+ protected BufferedStreamOutput bufferedOutput;
+ private InVMDispatcher dispatcher;
+
+ /**
+ * Constructs a {@link org.jboss.sam.EventProcessor} for a given name
+ * and assigns default stream input's and output's.
+ *
+ * @see org.jboss.sam.internal.stream.InVMStreamInput
+ * @see org.jboss.test.sam.BufferedStreamOutput
+ *
+ * @param name the runtime name
+ * @param configFile name of the esper-config file relative to test execution
+ */
+ public void createInVMSetup(String name, String configFile)
+ {
+ // Main runtime
+ eventProcessor = EventProcessorFactory.newInstance().createRuntime(
+ name, loadTestConfiguration(configFile)
+ );
+
+ // Stream input and output
+ streamInput = new InVMStreamInput("InVM").start();
+ dispatcher = new InVMDispatcher(streamInput.getStreamName());
+
+ bufferedOutput = new BufferedStreamOutput("InVM").start();
+ eventProcessor.addInput(streamInput);
+ eventProcessor.addOutput(bufferedOutput);
+
+ System.out.println("Initialized SamRuntime: " + eventProcessor.getName());
+ }
+
+ /**
+ * Creates an in memory database. Make sure to shutdown the database in {@link #tearDown()}
+ * @return pointer to an in memory database
+ */
+ protected InMemoryDatabase createDatabase()
+ {
+ InMemoryDatabase inMemoryDB = new InMemoryDatabase();
+ System.out.println("Database has been setup: " + inMemoryDB);
+ return inMemoryDB;
+ }
+
+ protected void generateInVMEvent(Object obj)
+ {
+ dispatcher.dispatch(obj);
+ }
+
+ public URL loadTestConfiguration(String name)
+ {
+ return Thread.currentThread().getContextClassLoader().getResource(name);
+ }
+}
Property changes on: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/SamTestSetup.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java
===================================================================
--- sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java (rev 0)
+++ sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.database;
+
+import com.espertech.esper.client.EPServiceProvider;
+import com.espertech.esper.client.EPStatement;
+import com.espertech.esper.client.StatementAwareUpdateListener;
+import com.espertech.esper.event.EventBean;
+import org.jboss.sam.ProcessingStatement;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+import org.jboss.sam.internal.esper.EsperProcessingStatement;
+import org.jboss.test.sam.SamTestSetup;
+import org.jboss.test.sam.InMemoryDatabase;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Test esper database integration patterns
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class DatabaseTestCase extends SamTestSetup
+{
+ private InMemoryDatabase db;
+
+ public void setUp() throws Exception
+ {
+ // Runtime
+ createInVMSetup("DataBaseTestCase", "database/esper-cfg.xml");
+
+ // InMemory Database
+ db = createDatabase();
+
+ // test schema
+ db.update("CREATE TABLE quotes (" +
+ " symbol varchar(10) NOT NULL," +
+ " name varchar(50) NOT NULL," +
+ " price double NOT NULL," +
+ " PRIMARY KEY (symbol)" +
+ ")"
+ );
+
+ // test data
+ db.update("INSERT INTO quotes (symbol, name, price) VALUES ('IBM', 'IBM', 127.26)");
+ db.update("INSERT INTO quotes (symbol, name, price) VALUES ('MSFT', 'Microsoft', 27.36)");
+ db.update("INSERT INTO quotes (symbol, name, price) VALUES('AAPL', 'Apple', 184.96)" );
+ db.update("INSERT INTO quotes (symbol, name, price) VALUES('RHT', 'Red Hat', 22.82)");
+ db.update("INSERT INTO quotes (symbol, name, price) VALUES('ORCL', 'Oracle', 22.85)");
+ db.update("INSERT INTO quotes (symbol, name, price) VALUES('JAVA', 'Sun', 12.42)" );
+ db.update("INSERT INTO quotes (symbol, name, price) VALUES('GOOG', 'Goole', 572.51)");
+
+ // database dump
+ db.query("SELECT symbol, price FROM quotes");
+ }
+
+ protected void tearDown() throws Exception
+ {
+ db.shutdown();
+ }
+
+ /**
+ * Fire a event to trigger the SQL query
+ */
+ public void testTriggeredSQLQuery() throws Exception
+ {
+ // setup
+ String epl = "select symbol, price from Query.win:length(1) as query," +
+ " sql:SamTestDB ['SELECT symbol, price FROM quotes WHERE symbol like (${query.criteria})']";
+
+ eventProcessor.registerBoundStatement("InVM","TriggerSQL", epl);
+
+ // trigger
+ generateInVMEvent( new Query("%") );
+
+ // evaluate
+ assertTrue("Listener not invoked", bufferedOutput.isInvoked());
+ EventMessage[] eventMessages = bufferedOutput.getLastNewData();
+ assertTrue(eventMessages.length==7);
+
+ for(EventMessage event : eventMessages)
+ {
+ System.out.println("symbol/price -> " + event.getProperty("symbol") + "/" + event.getProperty("price"));
+ }
+ }
+
+ public void testEsperPullAPI() throws Exception
+ {
+ System.out.println("FIXME ESPER-254: testPullAPI on database queries");
+
+ /*See http://jira.codehaus.org/browse/ESPER-254
+
+ String aggregateStmt = "insert into NewQuotes " +
+ "select symbol, price from " +
+ "pattern [every timer:interval(1 sec)], "+
+ "sql:SamTestDB ['select symbol, price from quotes']";
+
+ String pullStmt = "select * from NewQuotes.win:keepall()";
+
+ // create two views
+ eventProcessor.registerStatement("PullAPI", aggregateStmt);
+ ProcessingStatement stmt = eventProcessor.registerStatement("QuotestPull", pullStmt);
+
+ boolean receivedData = false;
+ Iterator<EventBean> it = ((EsperProcessingStatement)stmt).getUnderlying().iterator();
+ while(it.hasNext())
+ {
+ EventBean event = it.next();
+ System.out.println("symbol/price -> " + event.get("symbol") + "/" + event.get("price"));
+ receivedData = true;
+ }
+
+ assertTrue("Pull API failed, no data received", receivedData);
+
+ */
+ }
+}
Property changes on: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/Query.java
===================================================================
--- sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/Query.java (rev 0)
+++ sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/Query.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.database;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class Query
+{
+ public String criteria;
+
+ public Query(String criteria)
+ {
+ this.criteria = criteria;
+ }
+
+
+ public String getCriteria()
+ {
+ return criteria;
+ }
+
+ public void setCriteria(String criteria)
+ {
+ this.criteria = criteria;
+ }
+}
Property changes on: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/database/Query.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/Alert.java
===================================================================
--- sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/Alert.java (rev 0)
+++ sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/Alert.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.stream.invm;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class Alert
+{
+ private final String source;
+ private final String value;
+
+ public Alert(String source, String value)
+ {
+ this.value = value;
+ this.source = source;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public String getSource()
+ {
+ return source;
+ }
+}
Property changes on: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/Alert.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java
===================================================================
--- sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java (rev 0)
+++ sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.stream.invm;
+
+import org.jboss.sam.ProcessingStatement;
+import org.jboss.test.sam.SamTestSetup;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class InVMStreamTestCase extends SamTestSetup
+{
+ public void setUp()
+ {
+ createInVMSetup("InVMAdapterTestCase", "adapter/invm/esper-cfg.xml");
+ }
+
+ public void testAdapter() throws Exception
+ {
+ // setup
+ String stmt = "select * from Alert.win:length(1)";
+ ProcessingStatement view = eventProcessor.registerBoundStatement("InVM","AlertTest", stmt);
+
+ // fire event
+ generateInVMEvent( new Alert("sensor1", "Threshold exceeded") );
+
+ // check result
+ assertTrue("Listener not invoked", bufferedOutput.isInvoked());
+ assertFalse( bufferedOutput.getLastNewData().length == 0);
+ assertEquals( "Threshold exceeded", bufferedOutput.getLastNewData()[0].getProperty("value"));
+ }
+
+ public void testUnknownAdapter() throws Exception
+ {
+ try
+ {
+ String stmt = "select * from Alert.win:length(1)";
+ eventProcessor.registerBoundStatement("NoSuchAdapter", "AlertTest", stmt);
+ fail("Expected exception not thrown");
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected behaviour
+ }
+
+ }
+}
+
Property changes on: sam/trunk/modules/core/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/resources/adapter/invm/esper-cfg.xml
===================================================================
--- sam/trunk/modules/core/src/test/resources/adapter/invm/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/core/src/test/resources/adapter/invm/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.stream.invm"/>
+
+ <!--
+ Sample configuration for database access using DriverManager;
+ retains connections associated with a statement, closing the connection when a statement is stopped
+ -->
+ <database-reference name="mysql1">
+ <drivermanager-connection class-name="com.mysql.jdbc.Driver"
+ url="jdbc:mysql://localhost/mysql1?user=root&password="
+ user="jbossfx" password="">
+ <connection-arg name="user" value ="root"/>
+ <connection-arg name="password" value =""/>
+ </drivermanager-connection>
+ <!--
+ Retains connection associated with a statement, closing a connection only when a statement is stopped
+ -->
+ <connection-lifecycle value="retain"/>
+ <!--
+ Configures an optional time-based cache with a maximum age in seconds and a purge interval,
+ and an optional reference strategy
+ -->
+ <expiry-time-cache max-age-seconds="60" purge-interval-seconds="120" ref-type="weak"/>
+ </database-reference>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/core/src/test/resources/adapter/invm/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/resources/database/esper-cfg.xml
===================================================================
--- sam/trunk/modules/core/src/test/resources/database/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/core/src/test/resources/database/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.database"/>
+
+ <!--
+ Sample configuration for database access using DriverManager;
+ retains connections associated with a statement, closing the connection when a statement is stopped
+ -->
+
+ <!--database-reference name="MySQLDB">
+ <drivermanager-connection class-name="com.mysql.jdbc.Driver"
+ url="jdbc:mysql://localhost/mysql1?user=root&password="
+ user="jbossfx" password="">
+ <connection-arg name="user" value ="root"/>
+ <connection-arg name="password" value =""/>
+ </drivermanager-connection>
+ <connection-lifecycle value="retain"/>
+ <expiry-time-cache max-age-seconds="60" purge-interval-seconds="120" ref-type="weak"/>
+ </database-reference-->
+
+ <database-reference name="SamTestDB">
+ <drivermanager-connection class-name="org.hsqldb.jdbcDriver"
+ url="jdbc:hsqldb:mem:SamTestSetup;get_column_name=true"
+ user="jbossfx" password="">
+ <connection-arg name="user" value ="sa"/>
+ <connection-arg name="password" value =""/>
+ </drivermanager-connection>
+
+ <connection-lifecycle value="retain"/>
+ <expiry-time-cache max-age-seconds="60" purge-interval-seconds="120" ref-type="weak"/>
+ <column-change-case value="lowercase"/> <!-- important -->
+ </database-reference>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/core/src/test/resources/database/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/resources/samples/esper-default-cfg.xml
===================================================================
--- sam/trunk/modules/core/src/test/resources/samples/esper-default-cfg.xml (rev 0)
+++ sam/trunk/modules/core/src/test/resources/samples/esper-default-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/core/src/test/resources/samples/esper-default-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/resources/samples/pattern/esper-cfg.xml
===================================================================
--- sam/trunk/modules/core/src/test/resources/samples/pattern/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/core/src/test/resources/samples/pattern/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.samples.pattern"/>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/core/src/test/resources/samples/pattern/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/resources/simulation/esper-cfg.xml
===================================================================
--- sam/trunk/modules/core/src/test/resources/simulation/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/core/src/test/resources/simulation/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.simulation"/>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/core/src/test/resources/simulation/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/core/src/test/resources/viz/esper-cfg.xml
===================================================================
--- sam/trunk/modules/core/src/test/resources/viz/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/core/src/test/resources/viz/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.stream.invm"/>
+
+ <!--
+ Sample configuration for database access using DriverManager;
+ retains connections associated with a statement, closing the connection when a statement is stopped
+ -->
+ <database-reference name="mysql1">
+ <drivermanager-connection class-name="com.mysql.jdbc.Driver"
+ url="jdbc:mysql://localhost/mysql1?user=root&password="
+ user="jbossfx" password="">
+ <connection-arg name="user" value ="root"/>
+ <connection-arg name="password" value =""/>
+ </drivermanager-connection>
+ <!--
+ Retains connection associated with a statement, closing a connection only when a statement is stopped
+ -->
+ <connection-lifecycle value="retain"/>
+ <!--
+ Configures an optional time-based cache with a maximum age in seconds and a purge interval,
+ and an optional reference strategy
+ -->
+ <expiry-time-cache max-age-seconds="60" purge-interval-seconds="120" ref-type="weak"/>
+ </database-reference>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/core/src/test/resources/viz/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/pom.xml
===================================================================
--- sam/trunk/modules/fx/pom.xml (rev 0)
+++ sam/trunk/modules/fx/pom.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,86 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>SAM - FX</name>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>fx</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>sam</artifactId>
+ <version>1.0.0.SNAPSHOT</version>
+ </parent>
+
+
+ <!-- Properties -->
+ <properties>
+ <surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/etc/tst.policy</surefire.security.args>
+ <surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</surefire.jdwp.args>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>core</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>jfree</groupId>
+ <artifactId>jfreechart</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <!-- Plugins -->
+ <build>
+ <resources>
+ <resource>
+ <targetPath>../etc</targetPath>
+ <directory>src/main/etc</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
+ </build>
+
+ <profiles>
+ <!-- Name: debug
+ Descr: Enable remote debuging for tests
+ -->
+ <profile>
+ <id>debug</id>
+ <activation>
+ <property>
+ <name>debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.security.args} ${surefire.jdwp.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <profile>
+ <id>no-debug</id>
+ <activation>
+ <property>
+ <name>!debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.security.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+
+ </profiles>
+
+</project>
Property changes on: sam/trunk/modules/fx/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/Chart.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/Chart.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/Chart.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.io.OutputStream;
+
+/**
+ * A chart repesentation.<br>
+ * Can be an in-memory representation or a link to a physical
+ * artifact (caching).
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface Chart<T>
+{
+ String getName();
+
+ void writeTo(OutputStream out);
+
+ T getUnderlying();
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/Chart.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Builds charts from payload and mapping information.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartBuilder
+{
+ ChartMetadata getMetadata();
+
+ Chart buildChart(EventMessage[] events, ChartMapping mapping);
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMapping.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMapping.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMapping.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.util.Collections;
+import java.util.List;
+import java.io.Serializable;
+
+/**
+ * An immutable mapping of index and data values,
+ * that can be passed to a {@link org.jboss.sam.chart.ChartBuilder} to construct
+ * {@link org.jboss.sam.chart.Chart}'s. Each instance is identifed by an alias name
+ * and will be maintained through a {@link ChartMappingRegistry}.
+ * <p>
+ * ChartMappings should be created once and reused.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class ChartMapping implements Serializable
+{
+ String aliasName;
+
+ List<PropertyMapping> indexMappings;
+
+ List<PropertyMapping> propertyMappings;
+
+ public ChartMapping(String aliasName, List<PropertyMapping> indexMappings, List<PropertyMapping> propertyMappings)
+ {
+ this.aliasName = aliasName;
+ this.indexMappings = Collections.unmodifiableList(indexMappings);
+ this.propertyMappings = Collections.unmodifiableList(propertyMappings);
+ }
+
+ String getAliasName()
+ {
+ return this.aliasName;
+ }
+
+ /**
+ * Returns an immutable index mapping for a key.
+ * The key is specified in {@link org.jboss.sam.chart.ChartMetadata}
+ * @return
+ */
+ public PropertyMapping getIndexMapping(String key)
+ {
+ PropertyMapping indexMapping = resolveKey(key, indexMappings);
+ if(null==indexMapping)
+ throw new IllegalArgumentException("Failed to resolved index mapping by key: "+ key);
+
+ return indexMapping;
+ }
+
+ /**
+ * Returns an immutable data mapping
+ * @return
+ */
+ public PropertyMapping getPropertyMapping(String key)
+ {
+ PropertyMapping dataMapping = resolveKey(key, propertyMappings);
+ if(null==dataMapping)
+ throw new IllegalArgumentException("Failed to resolved data mapping by key: "+ key);
+
+ return dataMapping;
+ }
+
+ private PropertyMapping resolveKey(String key, List<PropertyMapping> mappings)
+ {
+ PropertyMapping mapping = null;
+ for(PropertyMapping index : mappings)
+ {
+ if(index.getTargetKey().equals(key))
+ {
+ mapping = index;
+ break;
+ }
+ }
+
+ return mapping;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * Maintains {@link ChartMapping}'s.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartMappingRegistry
+{
+ void registerChartMapping(ChartMapping chartMaping);
+
+ ChartMapping getChartMapping(String aliasName);
+
+ void clearChartMapping(String aliasName);
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ChartMappingRegistryFactory
+{
+ abstract ChartMappingRegistry createChartMappingRegistry();
+
+ public static ChartMappingRegistryFactory newInstance()
+ {
+ return new DefaultChartMappingRegistryFactory();
+ }
+
+ static class DefaultChartMappingRegistryFactory extends ChartMappingRegistryFactory
+ {
+
+ ChartMappingRegistry createChartMappingRegistry()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMappingRegistryFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import java.util.Iterator;
+
+/**
+ * Metadata for chart types associated with a {@link org.jboss.sam.chart.ChartBuilder}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartMetadata
+{
+ String getTypeName();
+
+ Iterator<String> getSupportedIndexNames();
+
+ Iterator<String> getSupportedPropertyNames();
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartMetadata.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServer.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServer.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServer.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Allows creation and retrieval of {@link org.jboss.sam.chart.Chart} repesentations.
+ * A chart server will be associated with a {@link org.jboss.sam.chart.ChartMappingRegistry} that stores
+ * the preconfigured mappings.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ChartServer
+{
+ /**
+ * Get chart by name
+ * @param chartName
+ * @return
+ */
+ Chart getChart(String chartName);
+
+ /**
+ * Create a new chart under a given name
+ * @param chartName
+ * @param payloads
+ * @return
+ */
+ Chart createChart(String chartName, String chartMappingAlias, EventMessage[] payloads);
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class ChartServerFactory
+{
+ abstract ChartServer createChartServer();
+
+ public static ChartServerFactory newInstance()
+ {
+ return new DefaultChartServerFactory();
+ }
+
+ static class DefaultChartServerFactory extends ChartServerFactory
+ {
+ ChartServer createChartServer()
+ {
+ throw new RuntimeException("Not implemented");
+ }
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/ChartServerFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart;
+
+import org.jboss.sam.EventMessage;
+
+import java.io.Serializable;
+
+/**
+ * Maps {@link org.jboss.sam.EventMessage} properties
+ * to chart attributes, like X-Axis and Y-Axis values.<br>
+ * Supports constants.
+ *
+ * @see org.jboss.sam.chart.ChartMapping
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class PropertyMapping implements Serializable
+{
+ /**
+ * The key to which a mapped property will be assigned
+ */
+ private String targetKey;
+
+ /**
+ * Name of the mapped {@link org.jboss.sam.EventMessage} property
+ */
+ private String sourcePropertyName;
+
+ private String constantValue = null;
+
+ public PropertyMapping(String targetKey, String sourcePropertyName)
+ {
+ this.targetKey = targetKey;
+ this.sourcePropertyName = sourcePropertyName;
+ }
+
+ public String getTargetKey()
+ {
+ return targetKey;
+ }
+
+ public PropertyMapping constant(String constant)
+ {
+ this.constantValue = constant.intern();
+ return this;
+ }
+
+ /**
+ * Retrieve an {@link org.jboss.sam.EventMessage} value
+ * by mapping to {@link #sourcePropertyName}
+ * @param payload
+ * @return
+ */
+ public Object map(EventMessage payload)
+ {
+ Object mapping;
+ if(null==constantValue)
+ mapping = payload.getProperty(sourcePropertyName);
+ else
+ mapping = constantValue;
+
+ return mapping;
+ }
+
+
+ public String toString()
+ {
+ String prop = sourcePropertyName != null ? sourcePropertyName : "CONSTANT";
+ return targetKey +"->"+prop;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/PropertyMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.category.DefaultCategoryDataset;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BarChartBuilder implements ChartBuilder
+{
+ private String chartTitle;
+ private String domainAxisLabel, rangeAxisLabel;
+
+ public final static String INDEX_1 = "series";
+ public final static String INDEX_2 = "x_value";
+ public final static String PROP_1 = "y_value";
+
+ public static List<String> INDEXES = new ArrayList<String>();
+ public static List<String> PROPS = new ArrayList<String>();
+
+ static
+ {
+ INDEXES.add(INDEX_1);
+ INDEXES.add(INDEX_2);
+
+ PROPS.add(PROP_1);
+ }
+
+ public BarChartBuilder(String chartTitle, String domainAxisLabel, String rangeAxisLabel)
+ {
+ this.chartTitle = chartTitle;
+ this.domainAxisLabel = domainAxisLabel;
+ this.rangeAxisLabel = rangeAxisLabel;
+ }
+
+ public ChartMetadata getMetadata()
+ {
+ return new ChartMetadata() {
+
+ public String getTypeName()
+ {
+ return "BarChart";
+ }
+
+ public Iterator<String> getSupportedIndexNames()
+ {
+ return INDEXES.iterator();
+ }
+
+ public Iterator<String> getSupportedPropertyNames()
+ {
+ return PROPS.iterator();
+ }
+ };
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ CategoryDataset dataset = createDataset(events, mapping);
+
+ JFreeChart chart = org.jfree.chart.ChartFactory.createBarChart(
+ chartTitle, // chart title
+ domainAxisLabel, // domain axis label
+ rangeAxisLabel, // range axis label
+ dataset, // data
+ PlotOrientation.VERTICAL,
+ true, // include legend
+ true, // tooltips?
+ false // URLs?
+ );
+
+ //customize(chart);
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private CategoryDataset createDataset(EventMessage[] payloads, ChartMapping mapping)
+ {
+ DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+
+ for(EventMessage event : payloads)
+ {
+ Number number = (Number) (mapping.getPropertyMapping(PROP_1)).map(event);
+ Comparable c1 = (Comparable) (mapping.getIndexMapping(INDEX_1)).map(event);
+ Comparable c2 = (Comparable) (mapping.getIndexMapping(INDEX_2)).map(event);
+ dataset.addValue(
+ number, // value
+ c1, // seriesName
+ c2 // category
+ );
+ }
+
+ return dataset;
+ }
+
+ /**
+ * Example customization
+ *
+ * @todo Create common look and feel
+ *
+ * @param chart
+ */
+ /*private void customize(JFreeChart chart)
+ {
+ // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
+ // set the background color for the chart...
+ chart.setBackgroundPaint(new Color(0xBBBBDD));
+ // get a reference to the plot for further customisation...
+ CategoryPlot plot = chart.getCategoryPlot();
+ // set the range axis to display integers only...
+ NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+ rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
+ // disable bar outlines...
+ BarRenderer renderer = (BarRenderer) plot.getRenderer();
+ renderer.setCreateEntities(true);
+
+ // set up gradient paints for series...
+ GradientPaint gp0 = new GradientPaint(
+ 0.0f, 0.0f, Color.blue,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ GradientPaint gp1 = new GradientPaint(
+ 0.0f, 0.0f, Color.green,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ GradientPaint gp2 = new GradientPaint(
+ 0.0f, 0.0f, Color.red,
+ 0.0f, 0.0f, Color.lightGray
+ );
+ renderer.setSeriesPaint(0, gp0);
+ renderer.setSeriesPaint(1, gp1);
+ renderer.setSeriesPaint(2, gp2);
+
+ // OPTIONAL CUSTOMISATION COMPLETED.
+ } */
+
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/BarChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.JFreeChart;
+
+import java.io.OutputStream;
+import java.util.UUID;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JFreeChartImpl implements Chart<JFreeChart>
+{
+ private ChartMetadata metadata;
+
+ private JFreeChart delegate;
+
+ private String name;
+
+ public JFreeChartImpl(String name, JFreeChart delegate)
+ {
+ this.name = name;
+ this.delegate = delegate;
+ }
+
+ public JFreeChartImpl(JFreeChart delegate)
+ {
+ this(UUID.randomUUID().toString(), delegate);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void writeTo(OutputStream out)
+ {
+ throw new RuntimeException("Not implemented");
+ }
+
+ public JFreeChart getUnderlying()
+ {
+ return delegate;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/JFreeChartImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+import java.util.Iterator;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LineChartBuilder implements ChartBuilder
+{
+ private String chartTitle;
+ private String xAxisLabel,yAxisLabel;
+
+ public final static String INDEX_1 = "series";
+ public final static String INDEX_2 = "x_value";
+ public final static String DATA_1 = "y_value";
+
+ public LineChartBuilder(String chartTitle, String xAxisLabel, String yAxisLabel)
+ {
+ this.chartTitle = chartTitle;
+ this.xAxisLabel = xAxisLabel;
+ this.yAxisLabel = yAxisLabel;
+ }
+
+ public ChartMetadata getMetadata()
+ {
+ return null;
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ XYSeriesCollection dataset = createDataset(events, mapping);
+
+ JFreeChart chart = ChartFactory.createXYLineChart(
+ chartTitle, // chart title
+ xAxisLabel, // x axis label
+ yAxisLabel, // y axis label
+ dataset, // data
+ PlotOrientation.VERTICAL,
+ true, // include legend
+ true, // tooltips
+ false // urls
+ );
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private XYSeriesCollection createDataset(EventMessage[] events, ChartMapping mapping)
+ {
+
+ XYSeriesCollection dataset = new XYSeriesCollection();
+
+ for(EventMessage event : events)
+ {
+ XYSeries series = getOrCreateSeries(
+ dataset,
+ (String)mapping.getIndexMapping(INDEX_1).map(event)
+ );
+ series.add(
+ (Double)mapping.getIndexMapping(INDEX_2).map(event),
+ (Double)mapping.getPropertyMapping(DATA_1).map(event)
+ );
+ }
+
+ return dataset;
+ }
+
+ private XYSeries getOrCreateSeries(XYSeriesCollection dataset, Comparable key)
+ {
+ XYSeries match = null;
+ Iterator it = dataset.getSeries().iterator();
+ while(it.hasNext())
+ {
+ XYSeries series = (XYSeries)it.next();
+ if(series.getKey().equals(key))
+ {
+ match = series;
+ break;
+ }
+ }
+
+ if(null==match)
+ {
+ match = new XYSeries(key);
+ dataset.addSeries(match);
+ }
+
+ return match;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/LineChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
===================================================================
--- sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java (rev 0)
+++ sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.chart.internal.jfree;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartBuilder;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.ChartMetadata;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.data.general.DefaultPieDataset;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class PieChartBuilder implements ChartBuilder
+{
+ private String chartName;
+ //private DefaultPieDataset dataset;
+
+ public final static String INDEX_1 = "category";
+ public final static String DATA_1 = "percentage";
+
+ public PieChartBuilder(String chartName)
+ {
+ this.chartName = chartName;
+ }
+
+
+ public ChartMetadata getMetadata()
+ {
+ return null;
+ }
+
+ public Chart buildChart(EventMessage[] events, ChartMapping mapping)
+ {
+ DefaultPieDataset dataset = createDataset(events, mapping);
+
+ JFreeChart chart = ChartFactory.createPieChart(
+ chartName,
+ dataset,
+ true, // legend?
+ true, // tooltips?
+ false // URLs?
+ );
+
+ return new JFreeChartImpl(chart);
+ }
+
+ private DefaultPieDataset createDataset(EventMessage[] events, ChartMapping mapping)
+ {
+ DefaultPieDataset dataset = new DefaultPieDataset();
+
+ for(EventMessage event : events)
+ {
+ dataset.setValue(
+ (String)mapping.getIndexMapping(INDEX_1).map(event), // category
+ (Double)mapping.getPropertyMapping(DATA_1).map(event) // percentage
+ );
+ }
+
+ return dataset;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/main/java/java/org/jboss/sam/chart/internal/jfree/PieChartBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/test/etc/tst.policy
===================================================================
--- sam/trunk/modules/fx/src/test/etc/tst.policy (rev 0)
+++ sam/trunk/modules/fx/src/test/etc/tst.policy 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,4 @@
+grant {
+ permission java.security.AllPermission;
+};
+
Added: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/JFreeChartViewer.java
===================================================================
--- sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/JFreeChartViewer.java (rev 0)
+++ sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/JFreeChartViewer.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam;
+
+import org.jfree.chart.ChartPanel;
+import org.jfree.chart.JFreeChart;
+import org.jfree.ui.ApplicationFrame;
+import org.jfree.ui.RefineryUtilities;
+
+import java.awt.event.WindowEvent;
+
+/**
+ * Helper to display charts
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class JFreeChartViewer extends ApplicationFrame
+{
+ private JFreeChart chart;
+
+ public JFreeChartViewer()
+ {
+ super("ChartViewer");
+ }
+
+ public JFreeChartViewer setChart(JFreeChart chart)
+ {
+ this.chart = chart;
+ return this;
+ }
+
+ public void display()
+ {
+ // put the chart to a panel...
+ ChartPanel chartPanel = new ChartPanel(chart);
+ chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
+ setContentPane(chartPanel);
+
+ pack();
+ RefineryUtilities.centerFrameOnScreen(this);
+ setVisible(true);
+ }
+}
Property changes on: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/JFreeChartViewer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/MapEventMessage.java
===================================================================
--- sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/MapEventMessage.java (rev 0)
+++ sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/MapEventMessage.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam;
+
+import org.jboss.sam.EventMessage;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class MapEventMessage implements EventMessage<Map>
+{
+ private Map<String, Object> data = new HashMap<String, Object>();
+
+ private long timestamp;
+
+ public MapEventMessage()
+ {
+ this(System.currentTimeMillis());
+ }
+
+ public MapEventMessage(long timestamp)
+ {
+ this.timestamp = timestamp;
+ }
+
+ public MapEventMessage put(String key, Object value)
+ {
+ data.put(key, value);
+ return this;
+ }
+
+ public Object getProperty(String name)
+ {
+ return data.get(name);
+ }
+
+ public Map getUnderlying()
+ {
+ return data;
+ }
+
+ public long getTimestamp()
+ {
+ return this.timestamp;
+ }
+
+ public Iterator<String> getPropertyNames()
+ {
+ return this.data.keySet().iterator();
+ }
+}
Property changes on: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/MapEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/BarChartRunner.java
===================================================================
--- sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/BarChartRunner.java (rev 0)
+++ sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/BarChartRunner.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.chart;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.PropertyMapping;
+import org.jboss.sam.chart.internal.jfree.BarChartBuilder;
+import org.jboss.test.sam.JFreeChartViewer;
+import org.jboss.test.sam.MapEventMessage;
+import org.jfree.chart.JFreeChart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BarChartRunner
+{
+ public static void main(String[] args) throws Exception
+ {
+ BarChartRunner app = new BarChartRunner();
+ app.run();
+ }
+
+ public void run() throws Exception
+ {
+ // example data
+ EventMessage[] payloads = new EventMessage[] {
+ new MapEventMessage().put("node", "Prepare Order").put("average", 8.17),
+ new MapEventMessage().put("node", "Request verification").put("average", 44.17),
+ new MapEventMessage().put("node", "Billing").put("average", 22.17),
+ new MapEventMessage().put("node", "Prepare shipping").put("average", 12.10),
+ new MapEventMessage().put("node", "Notify customer").put("average", 6.80)
+ };
+
+ // create chart
+ Chart<JFreeChart> chart = buildChart(payloads);
+
+ // display it
+ new JFreeChartViewer().setChart(chart.getUnderlying()).display();
+ }
+
+ public Chart buildChart(EventMessage[] payloads)
+ {
+ List<PropertyMapping> index = new ArrayList<PropertyMapping>();
+ index.add(new PropertyMapping(BarChartBuilder.INDEX_1, null).constant("Exec time per node"));
+ index.add(new PropertyMapping(BarChartBuilder.INDEX_2, "node"));
+
+ List<PropertyMapping> data = new ArrayList<PropertyMapping>();
+ data.add(new PropertyMapping(BarChartBuilder.PROP_1, "average"));
+
+ ChartMapping mapping = new ChartMapping("Average exec time per node",index, data); // could be serialzed
+
+ Chart chart = new BarChartBuilder(
+ "Order process execution time layout", "Node", "Average exectime")
+ .buildChart(payloads, mapping);
+
+ return chart;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/BarChartRunner.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/LineChartRunner.java
===================================================================
--- sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/LineChartRunner.java (rev 0)
+++ sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/LineChartRunner.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.chart;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.PropertyMapping;
+import org.jboss.sam.chart.internal.jfree.LineChartBuilder;
+import org.jboss.test.sam.JFreeChartViewer;
+import org.jboss.test.sam.MapEventMessage;
+import org.jfree.chart.JFreeChart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LineChartRunner
+{
+ public static void main(String[] args) throws Exception
+ {
+ LineChartRunner app = new LineChartRunner();
+ app.run();
+ }
+
+ public void run() throws Exception
+ {
+ // example data
+ EventMessage[] payloads = new EventMessage[] {
+ new MapEventMessage().put("instance", "Proc1").put("sample", 1.0).put("average", 12.00),
+ new MapEventMessage().put("instance", "Proc1").put("sample", 2.0).put("average", 32.00),
+ new MapEventMessage().put("instance", "Proc1").put("sample", 3.0).put("average", 70.00),
+ new MapEventMessage().put("instance", "Proc1").put("sample", 4.0).put("average", 8.00),
+ new MapEventMessage().put("instance", "Proc1").put("sample", 5.0).put("average", 18.00),
+
+ new MapEventMessage().put("instance", "Proc2").put("sample", 1.0).put("average", 13.00),
+ new MapEventMessage().put("instance", "Proc2").put("sample", 2.0).put("average", 48.00),
+ new MapEventMessage().put("instance", "Proc2").put("sample", 3.0).put("average", 13.00),
+ new MapEventMessage().put("instance", "Proc2").put("sample", 4.0).put("average", 12.00),
+ new MapEventMessage().put("instance", "Proc2").put("sample", 5.0).put("average", 14.00),
+
+ new MapEventMessage().put("instance", "Proc3").put("sample", 1.0).put("average", 7.00),
+ new MapEventMessage().put("instance", "Proc3").put("sample", 2.0).put("average", 23.00),
+ new MapEventMessage().put("instance", "Proc3").put("sample", 3.0).put("average", 40.00),
+ new MapEventMessage().put("instance", "Proc3").put("sample", 4.0).put("average", 50.00),
+ new MapEventMessage().put("instance", "Proc3").put("sample", 5.0).put("average", 32.00)
+ };
+
+ // build chart
+ Chart<JFreeChart> chart = buildChart(payloads);
+
+ // display it
+ new JFreeChartViewer().setChart(chart.getUnderlying()).display();
+ }
+
+ public Chart buildChart(EventMessage[] payloads)
+ {
+ List<PropertyMapping> index = new ArrayList<PropertyMapping>();
+ index.add(new PropertyMapping(LineChartBuilder.INDEX_1, "instance"));
+ index.add(new PropertyMapping(LineChartBuilder.INDEX_2, "sample"));
+
+ List<PropertyMapping> data = new ArrayList<PropertyMapping>();
+ data.add(new PropertyMapping(LineChartBuilder.DATA_1, "average"));
+
+ ChartMapping mapping = new ChartMapping("Process exsecution per sample", index, data);
+
+ Chart chart = new LineChartBuilder(
+ "Process instance execution time",
+ "Sample", "Average Execution"
+ ).buildChart(payloads, mapping);
+
+ return chart;
+ }
+
+}
Property changes on: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/LineChartRunner.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/PieChartRunner.java
===================================================================
--- sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/PieChartRunner.java (rev 0)
+++ sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/PieChartRunner.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.chart;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.PropertyMapping;
+import org.jboss.sam.chart.internal.jfree.PieChartBuilder;
+import org.jboss.test.sam.JFreeChartViewer;
+import org.jboss.test.sam.MapEventMessage;
+import org.jfree.chart.JFreeChart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class PieChartRunner
+{
+ public static void main(String[] args) throws Exception
+ {
+ PieChartRunner app = new PieChartRunner();
+ app.run();
+ }
+
+ public void run() throws Exception
+ {
+ // example data
+ EventMessage[] payloads = new EventMessage[] {
+ new MapEventMessage().put("process", "OrderPreparation").put("average", 23.17),
+ new MapEventMessage().put("process", "Billing").put("average", 17.17),
+ new MapEventMessage().put("process", "Shipment").put("average", 22.17),
+ };
+
+ // create chart
+ Chart<JFreeChart> chart = buildChart(payloads);
+
+ // display it
+ new JFreeChartViewer().setChart(chart.getUnderlying()).display();
+ }
+
+ public Chart buildChart(EventMessage[] payloads)
+ {
+ List<PropertyMapping> index = new ArrayList<PropertyMapping>();
+ index.add(new PropertyMapping(PieChartBuilder.INDEX_1, "process"));
+
+ List<PropertyMapping> data = new ArrayList<PropertyMapping>();
+ data.add(new PropertyMapping(PieChartBuilder.DATA_1, "average"));
+
+ ChartMapping mapping = new ChartMapping("Most executed process definitions", index, data);
+
+ Chart chart = new PieChartBuilder(
+ "Average process execution time")
+ .buildChart(payloads, mapping);
+
+ return chart;
+ }
+}
Property changes on: sam/trunk/modules/fx/src/test/java/org/jboss/test/sam/chart/PieChartRunner.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/pom.xml
===================================================================
--- sam/trunk/modules/sim/pom.xml (rev 0)
+++ sam/trunk/modules/sim/pom.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,86 @@
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>SAM - Sim</name>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>sim</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>sam</artifactId>
+ <version>1.0.0.SNAPSHOT</version>
+ </parent>
+
+
+ <!-- Properties -->
+ <properties>
+ <surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/etc/tst.policy</surefire.security.args>
+ <surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</surefire.jdwp.args>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.sam</groupId>
+ <artifactId>core</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javasim</groupId>
+ <artifactId>javasim</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <!-- Plugins -->
+ <build>
+ <resources>
+ <resource>
+ <targetPath>../etc</targetPath>
+ <directory>src/main/etc</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
+ </build>
+
+ <profiles>
+ <!-- Name: debug
+ Descr: Enable remote debuging for tests
+ -->
+ <profile>
+ <id>debug</id>
+ <activation>
+ <property>
+ <name>debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.security.args} ${surefire.jdwp.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+ <profile>
+ <id>no-debug</id>
+ <activation>
+ <property>
+ <name>!debug</name>
+ </property>
+ </activation>
+ <properties>
+ <surefire.jvm.args>${surefire.security.args}</surefire.jvm.args>
+ </properties>
+ </profile>
+
+ </profiles>
+
+</project>
Property changes on: sam/trunk/modules/sim/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/ContextAwareEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/ContextAwareEntity.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/ContextAwareEntity.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface ContextAwareEntity
+{
+ public void begin();
+
+ public void end();
+
+ void setContext(SimulationContext ctx);
+}
Property changes on: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/ContextAwareEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventMessageFactory.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventMessageFactory.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventMessageFactory.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+/**
+ * Creates event messages for {@link org.jboss.sam.simulation.EventSourceEntity}'s
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventMessageFactory
+{
+ Object createEventMessage(SimulationContext context);
+
+}
Property changes on: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventMessageFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSimulation.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSimulation.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSimulation.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,281 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.javasim.*;
+import com.espertech.esper.client.UnmatchedListener;
+import com.espertech.esper.event.EventBean;
+import org.jboss.sam.EventProcessor;
+import org.jboss.sam.EventProcessorFactory;
+import org.jboss.sam.StreamInput;
+import org.jboss.sam.internal.esper.EsperRuntimeImpl;
+import org.jboss.sam.internal.stream.InVMStreamInput;
+import org.jboss.sam.internal.stream.InVMDispatcher;
+import org.javasim.Scheduler;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.UUID;
+
+/**
+ * Simulations are created from global configuration,
+ * which will be available to any simulation entity and a URL to
+ * {@link #bootstrap(java.util.Properties, java.net.URL)} the {@link org.jboss.sam.EventProcessor}:
+ * <p>
+ *
+ * <b>Event sources</b><br>
+ * {@link org.jboss.sam.simulation.EventSourceEntity}'s drive the whole simulation by creating and dispatching
+ * typed event messages. They need to be added to a simulation ({@link #addSource(EventSourceEntity)})
+ * in order to emit events to the event processor.
+ * <p>
+ *
+ * <b>Event sinks</b><br>
+ * {@link org.jboss.sam.simulation.EventSinkEntity}'s processes event messages that have been forwarded
+ * from an event processor. They need to be added ({@link #addSink(EventSinkEntity)}) to a simualtion
+ * and bound to a processing statement ({@link #bindStatement(String, EventSinkEntity)})
+ * <p>
+ *
+ * <b>Shared context</b><br>
+ * The {@link org.jboss.sam.simulation.SimulationContext} is shared between all simulation
+ * entities and acts as a blackboard where any entity can read and write simulation data and configuration.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSimulation extends SimulationProcess
+{
+ // simulation properties
+ private List<EventSinkEntity> eventSinks = new ArrayList<EventSinkEntity>();
+ private List<EventSourceEntity> eventSources = new ArrayList<EventSourceEntity>();
+ private SimulationContext context;
+ private InVMDispatcher dispatcher;
+
+ // SAM properties
+ private EventProcessor eventProcessor;
+ private StreamInput streamInput;
+
+ // Constants
+ public final static String TOTAL_SIM_TIME = "sam.total-sim-time";
+ public final static String NUM_UNMATCHED_EVENTS = "sam.unmatched-events";
+
+ private EventSimulation(Properties config, URL bootstrap)
+ {
+ // thread setup
+ setName("EventSimulation {" + getName()+"}");
+ setPriority(1);
+
+ this.context = new SimulationContext(config);
+
+ // setup SAM processor
+ this.eventProcessor = EventProcessorFactory.newInstance().createRuntime( "EventSimulation", bootstrap );
+
+ // create input for the default in-vm channel
+ this.streamInput = new InVMStreamInput(InVMDispatcher.DEFAULT_CHANNEL_NAME);
+
+ // create a dispatcher used within event source
+ this.dispatcher = new InVMDispatcher(InVMDispatcher.DEFAULT_CHANNEL_NAME);
+
+ // register in/out with hub
+ this.eventProcessor.addInput(streamInput);
+
+ ((EsperRuntimeImpl) eventProcessor).getUnderlying().getEPRuntime()
+ .setUnmatchedListener(
+ new UnmatchedListener()
+ {
+
+ public void update(EventBean event)
+ {
+ System.out.println("! Unmatched event: " + event);
+ context.getMeasurement(NUM_UNMATCHED_EVENTS).increment();
+ }
+ }
+ );
+
+ }
+
+ public EventSinkEntity addSink(EventSinkEntity sink)
+ {
+ sink.setContext(this.context);
+
+ this.eventSinks.add(sink);
+ this.eventProcessor.addOutput(sink);
+ return sink;
+ }
+
+ public EventSourceEntity addSource(EventSourceEntity source)
+ {
+ source.setContext(this.context);
+ source.setDispatcher(this.dispatcher);
+
+ this.eventSources.add(source);
+ return source;
+ }
+
+ /**
+ * Create a aggregation/filtering statement
+ * @param stmt
+ */
+ public void createStatement(String stmt)
+ {
+ this.eventProcessor.registerStatement(
+ UUID.randomUUID().toString(), stmt
+ );
+ }
+
+ /**
+ * Bind a statment that forwards to an EventSink
+ * @param stmt
+ * @param sink
+ */
+ public void bindStatement(String stmt, EventSinkEntity sink)
+ {
+ this.eventProcessor.registerBoundStatement(
+ sink.getStreamName(), UUID.randomUUID().toString(), stmt
+ );
+ }
+
+ /**
+ * Execute a single run of this simulation.
+ * Suspends the main thread until the simulation is done.
+ */
+ public void singleRun()
+ {
+ // [HB] System.out.println("-----------");
+ // [HB] System.out.println("Start called: " + this);
+ this.resumeProcess();
+ // [HB] System.out.println("Trying mainSuspend on: " + this);
+ SimulationProcess.mainSuspend();
+ // [HB] System.out.println("Done with mainSuspend on: " + this);
+ }
+
+ public void done()
+ {
+ try
+ {
+ this.terminate();
+ Scheduler.reset();
+ }
+ catch(SimulationException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void begin()
+ {
+ for(EventSinkEntity sink : eventSinks)
+ {
+ sink.begin();
+ }
+
+ for(EventSourceEntity source : eventSources)
+ {
+ source.begin();
+ }
+ }
+
+ private void end()
+ {
+ for(EventSinkEntity sink : eventSinks)
+ {
+ sink.end();
+ }
+
+ for(EventSourceEntity source : eventSources)
+ {
+ source.end();
+ }
+ }
+
+ public SimulationContext getContext()
+ {
+ return context;
+ }
+
+ public Measurement measurement(String key)
+ {
+ return context.getMeasurement(key);
+ }
+
+ public void run()
+ {
+ try
+ {
+ // wait for main thread
+ waitForMainSuspended();
+
+ // [HB] System.out.println("Running " + this);
+
+ // begin
+ begin();
+ Scheduler.startSimulation();
+
+ Double totalSimTime = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
+ hold(totalSimTime);
+
+ // [HB] System.out.println("End simulation:" + this );
+ // [HB] System.out.println("-----------");
+
+ // cleanup
+ Scheduler.stopSimulation();
+ end();
+
+ returnControl();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+
+ }
+
+ /**
+ * Returns control to the test class thread
+ */
+ private void returnControl()
+ {
+ try
+ {
+ // [HB] System.out.println("Return control to main thread");
+ SimulationProcess.mainResume();
+ this.suspendProcess();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+ public static EventSimulation bootstrap(Properties config)
+ {
+ return new EventSimulation(config,
+ Thread.currentThread().getContextClassLoader().getResource("samples/esper-default-cfg.xml")
+ );
+ }
+
+ public static EventSimulation bootstrap(Properties config, URL bootstrap)
+ {
+ return new EventSimulation(config, bootstrap);
+ }
+}
Property changes on: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSimulation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkEntity.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkEntity.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+
+/**
+ * Simulates an event sink.<br>
+ * Event sink's process messages that have been forwarded by an event processor.
+ * <p>
+ * <b>EventSinkHandler</b><br>
+ * The actual processing is done a {@link org.jboss.sam.simulation.EventSinkHandler}
+ * that needs to be associated with an event sink entity:
+ *
+ * <pre>
+ *
+ * EventSinkEntity sink = new EventSinkEntity("foo.bar-EventSink");
+ * sink.setEventHandler(
+ * new EventSinkHandler()
+ * {
+ *
+ * public void handle(EventMessage[] events, SimulationContext context)
+ * {
+ * // dome something here
+ * }
+ * }
+ * );
+ *
+ * </pre>
+ *
+ * <br>
+ * <b>EPL Statements and event forwarding</b><br>
+ * In order to invoke an event sink, you need to register a statement
+ * through {@link org.jboss.sam.simulation.EventSimulation#bindStatement(String, EventSinkEntity)}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSinkEntity implements StreamOutput, ContextAwareEntity
+{
+
+ private String streamName;
+ private SimulationContext context;
+ private EventSinkHandler handler = null;
+
+ public EventSinkEntity(String streamName)
+ {
+ this.streamName = streamName;
+ }
+
+ public void setEventHandler(EventSinkHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ public StreamOutput start()
+ {
+ return this;
+ }
+
+ public StreamOutput stop()
+ {
+ return this;
+ }
+
+ public boolean isStarted()
+ {
+ return true;
+ }
+
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
+
+ public void write(EventMessage[] events)
+ {
+ if(null==this.context)
+ throw new IllegalStateException("Simulation context not set");
+
+ if(handler!=null)
+ handler.handle(events, context);
+ }
+
+
+ public void begin()
+ {
+
+ }
+
+ public void end()
+ {
+
+ }
+
+ public void setContext(SimulationContext ctx)
+ {
+ this.context = ctx;
+ }
+
+}
Property changes on: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkHandler.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkHandler.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkHandler.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.jboss.sam.EventMessage;
+
+/**
+ * Represents the actual business logic of an {@link org.jboss.sam.simulation.EventSinkEntity}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface EventSinkHandler
+{
+ void handle(EventMessage[] events, SimulationContext context);
+}
Property changes on: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSinkHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSourceEntity.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSourceEntity.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSourceEntity.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,160 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.javasim.RestartException;
+import org.javasim.SimulationException;
+import org.javasim.SimulationEntity;
+import org.jboss.sam.internal.stream.InVMDispatcher;
+
+/**
+ * Simulates an event source.<br>
+ * <p>
+ * <b>EventMessageFactories</b><br>
+ * An event source leverages an {@link org.jboss.sam.simulation.EventMessageFactory}
+ * to create event messages and dispatch them to the event processor:
+ *
+ * <pre>
+ * EventSourceEntity source = new EventSourceEntity("foo.bar-EventSource", 0.1);
+ * source.setEventMessageFactory(
+ * new EventMessageFactory()
+ * {
+ * public Object createEventMessage(SimulationContext context)
+ * {
+ * // Create an event message here
+ * return ...;
+ * }
+ * }
+ * );
+ * </pre>
+ *
+ * <br>
+ * <b>Event ratio</b><br>
+ * Specifies the ratio with regard to the total simulation time (between 0.01-1)
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class EventSourceEntity extends SimulationEntity implements ContextAwareEntity
+{
+ private String name;
+ private Class eventMessageType;
+ private double eventRatio;
+ private InVMDispatcher dispatcher = null;
+ private SimulationContext context = null;
+ private EventMessageFactory factory = null;
+
+ /**
+ *
+ * @param name the event source name
+ * @param eventRatio event creation ratio wrt the total simulation time. Value between 0-1
+ */
+ public EventSourceEntity(String name, double eventRatio)
+ {
+ // thread setup
+ setPriority(5);
+ setName("EventSourceEntity {" + getName()+"}");
+
+
+ this.name = name;
+
+ if(eventRatio<=0 || eventRatio>1)
+ throw new IllegalArgumentException("Invalid event ratio: " + eventRatio);
+
+ this.eventMessageType = eventMessageType;
+ this.eventRatio = eventRatio;
+ }
+
+ public void setContext(SimulationContext controller)
+ {
+ this.context = controller;
+ }
+
+ void setDispatcher(InVMDispatcher dispatcher)
+ {
+ this.dispatcher = dispatcher;
+ }
+
+ public void setEventMessageFactory(EventMessageFactory factory)
+ {
+ this.factory = factory;
+ }
+
+ public void run()
+ {
+ while (!terminated())
+ {
+ try
+ {
+ double totalSim = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
+ double holdTime = (totalSim*eventRatio);
+ hold(holdTime);
+ }
+ catch (SimulationException e)
+ {
+ e.printStackTrace();
+ }
+ catch (RestartException e)
+ {
+ e.printStackTrace();
+ }
+
+
+ if(null==context)
+ throw new IllegalStateException("Simulation context not set");
+
+ if(null==factory)
+ throw new IllegalStateException("EventMessageFactory not set");
+
+ if(null==dispatcher)
+ throw new IllegalStateException("EventDispatcher not set");
+
+ // Create and dispatch event
+ Object event = factory.createEventMessage(this.context);
+ this.dispatcher.dispatch(event);
+
+ }
+
+ // [HB] System.out.println("EventSource " + name + " was terminated");
+ }
+
+ public void begin()
+ {
+ try
+ {
+ this.activate();
+ } catch (SimulationException e)
+ {
+ e.printStackTrace();
+
+ } catch (RestartException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void end()
+ {
+ this.terminate();
+ }
+
+
+}
Property changes on: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/EventSourceEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/Measurement.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/Measurement.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/Measurement.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+/**
+ * A simulation measurement helper
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class Measurement
+{
+ private Double current = 0.0;
+
+ public Double getCurrent()
+ {
+ return current;
+ }
+
+ public Double increase(Double d)
+ {
+ this.current += d;
+ return this.current;
+ }
+
+ public Double decrease(Double d)
+ {
+ this.current -= d;
+ return this.current;
+ }
+
+ public Double setCurrent(Double d)
+ {
+ this.current = d;
+ return this.current;
+ }
+
+ public Double increment()
+ {
+ this.current += 1;
+ return this.current;
+ }
+
+ public Double decrement()
+ {
+ this.current -= 1;
+ return this.current;
+ }
+
+
+ public String toString()
+ {
+ return String.valueOf(getCurrent());
+ }
+}
Property changes on: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/Measurement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/SimulationContext.java
===================================================================
--- sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/SimulationContext.java (rev 0)
+++ sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/SimulationContext.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.sam.simulation;
+
+import org.javasim.Scheduler;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.io.PrintStream;
+
+/**
+ * Shared context between simulation entities and their implementation.
+ * The context is used collect simulation data and pass it along.<br>
+ * It propagates:
+ * <ul>
+ * <li>the event simulation configuration
+ * <li>measurements from event sinks, event sources and associated delegates
+ * <li>arbitrary attachments
+ * <ul>
+ *
+ * @see org.jboss.sam.simulation.Measurement
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SimulationContext
+{
+ private Properties config = null;
+ private Map<String, Measurement> measurements = new HashMap<String, Measurement>();
+ private Map<Class, Object> attachments = new HashMap<Class, Object>();
+
+ public SimulationContext(Properties config)
+ {
+ this.config = config;
+ }
+
+ public Object getConfig(String key)
+ {
+ if(null == config.get(key))
+ throw new IllegalArgumentException("No such config: " + key);
+ return config.get(key);
+ }
+
+ public Measurement getMeasurement(String key)
+ {
+ Measurement measurement = measurements.get(key);
+ if(null == measurement)
+ {
+ measurement = new Measurement();
+ measurements.put(key, measurement);
+ }
+ return measurement;
+ }
+
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return (T)attachments.get(clazz);
+ }
+
+ public <T> T addAttachment(Class<T> clazz, Object obj)
+ {
+ return (T)attachments.put(clazz, obj);
+ }
+
+ public double getCurrentSimulationTime()
+ {
+ return Scheduler.currentTime();
+ }
+
+ public void dump(PrintStream out)
+ {
+ for(String key : measurements.keySet())
+ {
+ out.println(key + ": " + measurements.get(key));
+ }
+ }
+}
Property changes on: sam/trunk/modules/sim/src/main/java/java/org/jboss/sam/simulation/SimulationContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/etc/tst.policy
===================================================================
--- sam/trunk/modules/sim/src/test/etc/tst.policy (rev 0)
+++ sam/trunk/modules/sim/src/test/etc/tst.policy 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,4 @@
+grant {
+ permission java.security.AllPermission;
+};
+
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,176 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam;
+
+import junit.framework.Assert;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * Unit test helper borrowed from esper samples.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BufferedStreamOutput implements StreamOutput
+{
+ private List<EventMessage[]> newDataLists;
+ private List<EventMessage[]> oldDataLists;
+
+ private EventMessage[] lastNewDatas;
+ private EventMessage[] lastOldDatas;
+ private boolean isInvoked;
+
+ private String streamName;
+
+ private boolean started;
+
+ public static String NAME = "InVM";
+
+ public BufferedStreamOutput()
+ {
+ this(UUID.randomUUID().toString());
+ }
+
+ public BufferedStreamOutput(String name)
+ {
+ this.streamName = name;
+ newDataLists = new LinkedList<EventMessage[]>();
+ oldDataLists = new LinkedList<EventMessage[]>();
+ }
+
+
+ public BufferedStreamOutput start()
+ {
+ this.started = true;
+ return this;
+ }
+
+ public BufferedStreamOutput stop()
+ {
+ this.started = false;
+ return this;
+ }
+
+ public boolean isStarted()
+ {
+ return this.started;
+ }
+
+ public String getStreamName()
+ {
+ return this.streamName;
+ }
+
+ public void write(EventMessage[] args)
+ {
+ update(args, new EventMessage[]{});
+ }
+
+ public void update(EventMessage[] newDatas, EventMessage[] oldDatas)
+ {
+ this.oldDataLists.add(oldDatas);
+ this.newDataLists.add(newDatas);
+
+ this.lastNewDatas = newDatas;
+ this.lastOldDatas = oldDatas;
+
+ isInvoked = true;
+ }
+
+ public void reset()
+ {
+ this.oldDataLists.clear();
+ this.newDataLists.clear();
+ this.lastNewDatas = null;
+ this.lastOldDatas = null;
+ isInvoked = false;
+ }
+
+ public EventMessage[] getLastNewData()
+ {
+ return lastNewDatas;
+ }
+
+ public EventMessage[] getAndResetLastNewData()
+ {
+ EventMessage[] lastNews = lastNewDatas;
+ lastNewDatas = null;
+ return lastNews;
+ }
+
+ public EventMessage[] getLastOldData()
+ {
+ return lastOldDatas;
+ }
+
+ public List<EventMessage[]> getNewDataList()
+ {
+ return newDataLists;
+ }
+
+ public List<EventMessage[]> getOldDataList()
+ {
+ return oldDataLists;
+ }
+
+ public boolean isInvoked()
+ {
+ return isInvoked;
+ }
+
+ public boolean getAndClearIsInvoked()
+ {
+ boolean invoked = isInvoked;
+ isInvoked = false;
+ return invoked;
+ }
+
+ public void setLastNewData(EventMessage[] lastNewDatas)
+ {
+ this.lastNewDatas = lastNewDatas;
+ }
+
+ public void setLastOldData(EventMessage[] lastOldDatas)
+ {
+ this.lastOldDatas = lastOldDatas;
+ }
+
+ public EventMessage assertOneGetNewAndReset()
+ {
+ Assert.assertTrue(isInvoked);
+
+ Assert.assertEquals(1, newDataLists.size());
+ Assert.assertEquals(1, oldDataLists.size());
+
+ Assert.assertEquals(1, lastNewDatas.length);
+ Assert.assertNull(lastOldDatas);
+
+ EventMessage lastNew = lastNewDatas[0];
+ reset();
+ return lastNew;
+ }
+
+}
\ No newline at end of file
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/BufferedStreamOutput.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,167 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.samples.aggregation;
+
+import junit.framework.TestCase;
+import org.jboss.sam.simulation.*;
+import org.jboss.sam.EventMessage;
+import org.javasim.streams.UniformStream;
+
+import java.util.*;
+import java.io.IOException;
+
+/**
+ * An aggregation example.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class AggregationTestCase extends TestCase
+{
+ EventSimulation simulation;
+ SimulationContext context;
+
+ EventSourceEntity source;
+ EventSinkEntity sink;
+
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 100.00);
+
+ // init
+ simulation = EventSimulation.bootstrap(config);
+
+ // shared between all entities
+ context = simulation.getContext();
+
+ // create an event source and sink
+ source = new EventSourceEntity("RetailStoreEventSource", 0.05);
+ sink = new EventSinkEntity("SalesVolumeMonitor");
+
+ }
+
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testEventAggregation()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
+ new EventMessageFactory()
+ {
+ String[] stores = new String[] {"London", "Paris", "Mailand"};
+
+ UniformStream rndStore = new UniformStream(1,3);
+ UniformStream salesVolume = new UniformStream(1,100);
+
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("dispatched").increment();
+
+ // we need at least a single match for the test case
+ String store = randomStore();
+ SalesEventMessage salesEvent = new SalesEventMessage(
+ store,
+ getVolumen(),
+ System.currentTimeMillis()
+ );
+
+ return salesEvent;
+ }
+
+ public String randomStore()
+ {
+ try
+ {
+ double value = Math.round(rndStore.getNumber());
+ int l = new Double(value).intValue();
+ return stores[l-1];
+ }
+ catch (IOException e)
+ {
+ return stores[0];
+ }
+ }
+
+ public double getVolumen()
+ {
+ try
+ {
+ return salesVolume.getNumber();
+ } catch (IOException e)
+ {
+ return 10.00;
+ }
+ }
+
+ }
+ );
+
+ // associate a sink handler
+ sink.setEventHandler(
+ new EventSinkHandler()
+ {
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ if(null==context.getAttachment(List.class))
+ context.addAttachment(List.class, new ArrayList<EventMessage>());
+
+ context.getAttachment(List.class).addAll(Arrays.asList(events));
+ context.getMeasurement("processed").increment();
+ }
+ }
+ );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // Filters high value orders with amount>5
+ simulation.createStatement("insert into AverageSalesVolume " +
+ "select s.store as location, sum(s.salesVolume) as avg " +
+ "from org.jboss.test.sam.samples.aggregation.SalesEventMessage.win:length_batch(10) as s " +
+ "group by s.store");
+
+ // Forward any highvalue order to the HighValueMonitor
+ simulation.bindStatement("select * from AverageSalesVolume", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // display status
+ context.dump(System.out);
+
+ // evaluate results
+ List<EventMessage> eventMessages = context.getAttachment(List.class);
+ assertNotNull(eventMessages);
+ assertTrue(eventMessages.size()>=1);
+
+ for(EventMessage e : eventMessages)
+ {
+ System.out.println(e.getProperty("location")+", " + e.getProperty("avg"));
+ }
+ }
+
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/AggregationTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.samples.aggregation;
+
+import java.util.Date;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class SalesEventMessage
+{
+ private String store;
+ private double salesVolume;
+ private long timestamp;
+
+ public SalesEventMessage(String store, double salesVolume, long timestamp)
+ {
+ this.store = store;
+ this.salesVolume = salesVolume;
+ this.timestamp = timestamp;
+ }
+
+ public String getStore()
+ {
+ return store;
+ }
+
+ public double getSalesVolume()
+ {
+ return salesVolume;
+ }
+
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/aggregation/SalesEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.samples.falloff;
+
+import junit.framework.TestCase;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.simulation.*;
+
+import java.util.*;
+
+/**
+ * A sample that demonstrates falloff detection.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class FalloffTestCase extends TestCase
+{
+ EventSimulation simulation;
+ SimulationContext context;
+
+ EventSourceEntity source;
+ EventSinkEntity sink;
+
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 100.00);
+
+ // init
+ simulation = EventSimulation.bootstrap(config);
+
+ // shared between all entities
+ context = simulation.getContext();
+
+ // create an event source and sink
+ source = new EventSourceEntity("FactoryLine", 0.03);
+ sink = new EventSinkEntity("ProductionRateMonitor");
+
+ }
+
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testEventFiltering()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
+ new EventMessageFactory()
+ {
+ Calendar c = new GregorianCalendar();
+ int numMessages = 0;
+
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("dispatched").increment();
+
+ // simulate a falloff after 20 messages. Production goes down 50%...
+ if(numMessages<20)
+ c.add(Calendar.SECOND, 3);
+ else
+ c.add(Calendar.SECOND, 6);
+
+ long ts = c.getTimeInMillis();
+
+ ProductionEventMessage productionRate = new ProductionEventMessage("Assembly Line-A", ts);
+ numMessages++;
+ return productionRate;
+ }
+ }
+ );
+
+ // associate a sink handler
+ sink.setEventHandler(
+ new EventSinkHandler()
+ {
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ if(null==context.getAttachment(List.class))
+ context.addAttachment(List.class, new ArrayList<EventMessage>());
+
+ context.getAttachment(List.class).addAll(Arrays.asList(events));
+ context.getMeasurement("processed").increment();
+ }
+ }
+ );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // Filters high value orders with amount>5
+ simulation.createStatement("insert into RatePerTenSeconds " +
+ "select line, count(*) as cnt " +
+ "from org.jboss.test.sam.samples.falloff.ProductionEventMessage" +
+ ".win:ext_timed(timestamp, 10 seconds)");
+
+ // Forward any highvalue order to the monitor
+ simulation.bindStatement("select line, avg(cnt) as avgCnt " +
+ "from RatePerTenSeconds.win:length(6) " +
+ "group by line " +
+ "having cnt < avg(cnt) * 0.75", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // display status
+ context.dump(System.out);
+
+ // evaluate results
+ List<EventMessage> eventMessages = context.getAttachment(List.class);
+ assertNotNull(eventMessages);
+ assertTrue(eventMessages.size()>=1);
+
+ for(EventMessage e : eventMessages)
+ {
+ System.out.println(e.getProperty("line")+": " + e.getProperty("avgCnt"));
+ }
+ }
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/FalloffTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.samples.falloff;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class ProductionEventMessage
+{
+ String line;
+ long timestamp;
+
+ public ProductionEventMessage(String line, long timestamp)
+ {
+ this.line = line;
+ this.timestamp = timestamp;
+ }
+
+ public String getLine()
+ {
+ return line;
+ }
+
+ public long getTimestamp()
+ {
+ return timestamp;
+ }
+
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/falloff/ProductionEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,157 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.samples.aggregation;
+
+import junit.framework.TestCase;
+import org.javasim.streams.UniformStream;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.simulation.*;
+import org.jboss.test.sam.samples.filtering.OrderEventMessage;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * A simple filter sample that uses two statements:
+ * <ul>
+ * <li>One statement to filter high value orders (unbound)
+ * <li>Anotherone that forwards the results to a monitor (bound)
+ * </ul>
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class FilteringTestCase extends TestCase
+{
+ EventSimulation simulation;
+ SimulationContext context;
+
+ EventSourceEntity source;
+ EventSinkEntity sink;
+
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 75.00);
+
+ // init
+ simulation = EventSimulation.bootstrap(config);
+
+ // shared between all entities
+ context = simulation.getContext();
+
+ // create an event source and sink
+ source = new EventSourceEntity("OrderEventSource", 0.10);
+ sink = new EventSinkEntity("HighValueMonitor");
+
+ }
+
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public void testEventFiltering()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
+ new EventMessageFactory()
+ {
+ boolean singleMatchEnforced;
+ UniformStream unitStream = new UniformStream(1,10);
+
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("dispatched").increment();
+
+ // we need at least a single match for the test case
+ long amount = singleMatchEnforced ? calcAmount() : 10;
+ if(!singleMatchEnforced) singleMatchEnforced = true;
+
+ OrderEventMessage order = new OrderEventMessage("Stereo", amount);
+ return order;
+ }
+
+ public long calcAmount()
+ {
+ try
+ {
+ double value = Math.floor(unitStream.getNumber());
+ return new Double(value).longValue();
+ }
+ catch (IOException e)
+ {
+ return 1;
+ }
+ }
+
+ }
+ );
+
+ // associate a sink handler
+ sink.setEventHandler(
+ new EventSinkHandler()
+ {
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ if(null==context.getAttachment(List.class))
+ context.addAttachment(List.class, new ArrayList<EventMessage>());
+
+ context.getAttachment(List.class).addAll(Arrays.asList(events));
+ context.getMeasurement("processed").increment();
+ }
+ }
+ );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // Filters high value orders with amount>5
+ simulation.createStatement("insert into HighValueOrders " +
+ "select * from org.jboss.test.sam.samples.filtering.OrderEventMessage as o " +
+ "where o.amount>5");
+
+ // Forward any highvalue order to the HighValueMonitor
+ simulation.bindStatement("select * from HighValueOrders", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // display status
+ printStatus();
+
+ // evaluate results
+ List<EventMessage> eventMessages = context.getAttachment(List.class);
+ assertNotNull(eventMessages);
+ assertTrue(eventMessages.size()>=1);
+ }
+
+ private void printStatus()
+ {
+ System.out.println("Dispatched: "+context.getMeasurement("dispatched"));
+ System.out.println("Processed: "+context.getMeasurement("processed"));
+ }
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/FilteringTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.samples.filtering;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class OrderEventMessage
+{
+ private String product;
+ private long amount;
+
+ public OrderEventMessage(String product, long amount)
+ {
+ this.product = product;
+ this.amount = amount;
+ }
+
+ public String getProduct()
+ {
+ return product;
+ }
+
+ public void setProduct(String product)
+ {
+ this.product = product;
+ }
+
+ public long getAmount()
+ {
+ return amount;
+ }
+
+ public void setAmount(long amount)
+ {
+ this.amount = amount;
+ }
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/filtering/OrderEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.samples.pattern;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class LightSwitchEventMessage
+{
+ boolean enabled;
+
+ public LightSwitchEventMessage(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ public boolean getEnabled()
+ {
+ return enabled;
+ }
+
+
+ public String toString()
+ {
+ return "LightSwitch{enabled="+this.enabled+"}";
+ }
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/LightSwitchEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,187 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.samples.pattern;
+
+import junit.framework.TestCase;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.simulation.*;
+
+import java.util.Properties;
+
+/**
+ * A simple pattern example.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class PatternTestCase extends TestCase
+{
+
+ EventSimulation simulation;
+ SimulationContext context;
+
+ EventSourceEntity source;
+ EventSinkEntity sink;
+
+ protected void setUp() throws Exception
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
+
+ // init
+ simulation = EventSimulation.bootstrap(
+ config,
+ Thread.currentThread().getContextClassLoader().getResource("samples/pattern/esper-cfg.xml")
+ );
+
+ // shared between all entities
+ context = simulation.getContext();
+
+ // create an event source and sink
+ source = new EventSourceEntity("LightSwitch", 0.10);
+ sink = new EventSinkEntity("LightMonitor");
+
+ }
+
+ protected void tearDown() throws Exception
+ {
+ simulation.done();
+ }
+
+ public void testRegularLightSwitch()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
+ new EventMessageFactory()
+ {
+ private boolean lastState;
+
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("dispatched").increment();
+ LightSwitchEventMessage message = new LightSwitchEventMessage(lastState);
+ lastState = !lastState;
+ return message;
+ }
+ }
+ );
+
+ // associate a sink handler
+ sink.setEventHandler(
+ new EventSinkHandler()
+ {
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ context.getMeasurement("processed").increment();
+ context.addAttachment(EventMessage.class, events[0]);
+ }
+ }
+ );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // forward single event messages
+ simulation.bindStatement("select B.* from pattern [every (A=LightSwitchEventMessage(enabled=true) -> B=LightSwitchEventMessage(enabled=false))]", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // display status
+ printStatus();
+
+ // evaluate results
+ EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
+ assertNotNull(lastEventMessage);
+ assertEquals(false, lastEventMessage.getProperty("enabled"));
+ }
+
+ private void printStatus()
+ {
+ System.out.println("Dispatched: "+context.getMeasurement("dispatched"));
+ System.out.println("Processed: "+context.getMeasurement("processed"));
+ }
+
+ public void testDetectLightSwitchFailure()
+ {
+ // associate a source factory
+ source.setEventMessageFactory(
+ new EventMessageFactory()
+ {
+ private boolean lastState;
+
+ public Object createEventMessage(SimulationContext context)
+ {
+ LightSwitchEventMessage message = null;
+
+ double d = context.getMeasurement("dispatched").getCurrent();
+ if(d!=3)
+ {
+ // create a regular light switch condition
+ message = new LightSwitchEventMessage(lastState);
+ }
+ else
+ {
+ // create an error condition: two times same enabled value
+ message = new LightSwitchEventMessage(!lastState);
+ }
+
+ lastState = !lastState;
+ context.getMeasurement("dispatched").increment();
+ return message;
+ }
+ }
+ );
+
+ // associate a sink handler
+ sink.setEventHandler(
+ new EventSinkHandler()
+ {
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ context.getMeasurement("processed").increment();
+ context.addAttachment(EventMessage.class, events[0]);
+ }
+ }
+ );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // forward single event messages
+ simulation.bindStatement("select A.enabled as firstEnabled, B.enabled as secondEnabled "+
+ "from pattern [every (A=LightSwitchEventMessage(enabled=false) -> B=LightSwitchEventMessage(enabled=false))]", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // display status
+ printStatus();
+
+ // evaluate results
+ EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
+ assertNotNull(lastEventMessage);
+ assertEquals(false, lastEventMessage.getProperty("firstEnabled"));
+ assertEquals(false, lastEventMessage.getProperty("secondEnabled"));
+
+ }
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/samples/pattern/PatternTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.simulation;
+
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.chart.ChartMapping;
+import org.jboss.sam.chart.PropertyMapping;
+import org.jboss.sam.chart.internal.jfree.BarChartBuilder;
+import org.jboss.sam.simulation.EventSinkHandler;
+import org.jboss.sam.simulation.SimulationContext;
+import org.jfree.chart.JFreeChart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ChartGenerationHandler implements EventSinkHandler
+{
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ double numEvents = events.length;
+ context.getMeasurement("numProcessed").increase(numEvents);
+ for(EventMessage e : events)
+ {
+ System.out.println(e.getUnderlying());
+ }
+
+ Chart<JFreeChart> currentChart = buildChart(events);
+ context.addAttachment(Chart.class, currentChart);
+ }
+
+ private Chart<JFreeChart> buildChart(EventMessage[] events)
+ {
+ ChartMapping mapping = valuePerSampleMapping();
+
+ Chart chart = new BarChartBuilder(
+ "Sensor simulation", "Sample", "Survey value")
+ .buildChart(events, mapping);
+
+ return chart;
+ }
+
+ private ChartMapping valuePerSampleMapping()
+ {
+ List<PropertyMapping> index = new ArrayList<PropertyMapping>();
+ index.add(new PropertyMapping(BarChartBuilder.INDEX_1, null).constant("Sensor data"));
+ index.add(new PropertyMapping(BarChartBuilder.INDEX_2, "simTime"));
+
+ List<PropertyMapping> data = new ArrayList<PropertyMapping>();
+ data.add(new PropertyMapping(BarChartBuilder.PROP_1, "surveyValue"));
+
+ ChartMapping mapping = new ChartMapping("Sensor value per sample", index, data); // could be serialzed
+ return mapping;
+ }
+
+ /*private ChartMapping sinkDistributionMapping()
+ {
+ List<PropertyMapping> index = new ArrayList<PropertyMapping>();
+ index.add(new PropertyMapping(PieChartBuilder.INDEX_1, "source"));
+
+ List<PropertyMapping> data = new ArrayList<PropertyMapping>();
+ data.add(new PropertyMapping(PieChartBuilder.DATA_1, "numEvents"));
+
+ ChartMapping mapping = new ChartMapping("Sensor event per EventSink", index, data);
+ return mapping;
+ } */
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.simulation;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SensorEventMessage
+{
+ private String source;
+ private double surveyValue;
+ private double simTime;
+
+ public SensorEventMessage(String source, double surveyValue, double simTime)
+ {
+ this.source = source;
+ this.surveyValue = surveyValue;
+ this.simTime = simTime;
+ }
+
+ public String getSource()
+ {
+ return source;
+ }
+
+ public double getSurveyValue()
+ {
+ return surveyValue;
+ }
+
+ public double getSimTime()
+ {
+ return simTime;
+ }
+
+ public String toString()
+ {
+ return "[@"+simTime+": "+source+"->"+surveyValue+"]";
+ }
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.simulation;
+
+import org.jboss.sam.simulation.EventMessageFactory;
+import org.jboss.sam.simulation.SimulationContext;
+import org.javasim.streams.ExponentialStream;
+
+import java.io.IOException;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SensorMessageFactory implements EventMessageFactory
+{
+ private ExponentialStream STime = new ExponentialStream(1,5);
+
+ public Object createEventMessage(SimulationContext context)
+ {
+ context.getMeasurement("numDispatched").increment();
+ return new SensorEventMessage("source-A", getSurveyValue(), context.getCurrentSimulationTime() );
+ }
+
+ public double getSurveyValue()
+ {
+ try
+ {
+ return STime.getNumber();
+ }
+ catch (IOException e)
+ {
+ return 0.0;
+ }
+ }
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java
===================================================================
--- sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java (rev 0)
+++ sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.test.sam.simulation;
+
+import junit.framework.TestCase;
+import org.jboss.sam.EventMessage;
+import org.jboss.sam.simulation.*;
+
+import java.util.Properties;
+
+/**
+ * A simple test case that shows how to use the simulation API
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SimulationTestCase extends TestCase
+{
+ public void testSimulationAPI()
+ {
+ // config
+ Properties config = new Properties();
+ config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
+
+ // init
+ EventSimulation simulation = EventSimulation.bootstrap(
+ config,
+ Thread.currentThread().getContextClassLoader().getResource("simulation/esper-cfg.xml")
+ );
+
+ // shared between all entities
+ SimulationContext context = simulation.getContext();
+
+ // create an event source and associate a message factory
+ EventSourceEntity source = new EventSourceEntity("source-A", 0.10);
+ source.setEventMessageFactory(
+ new EventMessageFactory()
+ {
+ public Object createEventMessage(SimulationContext context)
+ {
+ return new SensorEventMessage("source-A", 12.00, context.getCurrentSimulationTime() );
+ }
+ }
+ );
+
+ // create an event sink and associate handler
+ EventSinkEntity sink = new EventSinkEntity("sink-B");
+ sink.setEventHandler(
+ new EventSinkHandler()
+ {
+ public void handle(EventMessage[] events, SimulationContext context)
+ {
+ context.addAttachment(EventMessage.class, events[0]);
+ }
+ }
+ );
+
+ simulation.addSource(source);
+ simulation.addSink(sink);
+
+ // forward single event messages
+ simulation.bindStatement("select * from org.jboss.test.sam.simulation.SensorEventMessage", sink);
+
+ // start simulation
+ simulation.singleRun();
+
+ // evaluate results
+ EventMessage lastEventMessage = context.getAttachment(EventMessage.class);
+ assertNotNull(lastEventMessage);
+ assertEquals(12.00, lastEventMessage.getProperty("surveyValue"));
+ }
+}
Property changes on: sam/trunk/modules/sim/src/test/java/org/jboss/test/sam/simulation/SimulationTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/resources/adapter/invm/esper-cfg.xml
===================================================================
--- sam/trunk/modules/sim/src/test/resources/adapter/invm/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/sim/src/test/resources/adapter/invm/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.stream.invm"/>
+
+ <!--
+ Sample configuration for database access using DriverManager;
+ retains connections associated with a statement, closing the connection when a statement is stopped
+ -->
+ <database-reference name="mysql1">
+ <drivermanager-connection class-name="com.mysql.jdbc.Driver"
+ url="jdbc:mysql://localhost/mysql1?user=root&password="
+ user="jbossfx" password="">
+ <connection-arg name="user" value ="root"/>
+ <connection-arg name="password" value =""/>
+ </drivermanager-connection>
+ <!--
+ Retains connection associated with a statement, closing a connection only when a statement is stopped
+ -->
+ <connection-lifecycle value="retain"/>
+ <!--
+ Configures an optional time-based cache with a maximum age in seconds and a purge interval,
+ and an optional reference strategy
+ -->
+ <expiry-time-cache max-age-seconds="60" purge-interval-seconds="120" ref-type="weak"/>
+ </database-reference>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/sim/src/test/resources/adapter/invm/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/resources/database/esper-cfg.xml
===================================================================
--- sam/trunk/modules/sim/src/test/resources/database/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/sim/src/test/resources/database/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.database"/>
+
+ <!--
+ Sample configuration for database access using DriverManager;
+ retains connections associated with a statement, closing the connection when a statement is stopped
+ -->
+
+ <!--database-reference name="MySQLDB">
+ <drivermanager-connection class-name="com.mysql.jdbc.Driver"
+ url="jdbc:mysql://localhost/mysql1?user=root&password="
+ user="jbossfx" password="">
+ <connection-arg name="user" value ="root"/>
+ <connection-arg name="password" value =""/>
+ </drivermanager-connection>
+ <connection-lifecycle value="retain"/>
+ <expiry-time-cache max-age-seconds="60" purge-interval-seconds="120" ref-type="weak"/>
+ </database-reference-->
+
+ <database-reference name="SamTestDB">
+ <drivermanager-connection class-name="org.hsqldb.jdbcDriver"
+ url="jdbc:hsqldb:mem:SamTestSetup;get_column_name=true"
+ user="jbossfx" password="">
+ <connection-arg name="user" value ="sa"/>
+ <connection-arg name="password" value =""/>
+ </drivermanager-connection>
+
+ <connection-lifecycle value="retain"/>
+ <expiry-time-cache max-age-seconds="60" purge-interval-seconds="120" ref-type="weak"/>
+ <column-change-case value="lowercase"/> <!-- important -->
+ </database-reference>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/sim/src/test/resources/database/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/resources/samples/esper-default-cfg.xml
===================================================================
--- sam/trunk/modules/sim/src/test/resources/samples/esper-default-cfg.xml (rev 0)
+++ sam/trunk/modules/sim/src/test/resources/samples/esper-default-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/sim/src/test/resources/samples/esper-default-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/resources/samples/pattern/esper-cfg.xml
===================================================================
--- sam/trunk/modules/sim/src/test/resources/samples/pattern/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/sim/src/test/resources/samples/pattern/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.samples.pattern"/>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/sim/src/test/resources/samples/pattern/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/resources/simulation/esper-cfg.xml
===================================================================
--- sam/trunk/modules/sim/src/test/resources/simulation/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/sim/src/test/resources/simulation/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.simulation"/>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/sim/src/test/resources/simulation/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: sam/trunk/modules/sim/src/test/resources/viz/esper-cfg.xml
===================================================================
--- sam/trunk/modules/sim/src/test/resources/viz/esper-cfg.xml (rev 0)
+++ sam/trunk/modules/sim/src/test/resources/viz/esper-cfg.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Sample configuration file.
+-->
+<esper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.espertech.com/schema/esper"
+ xsi:noNamespaceSchemaLocation="esper-configuration-2-0.xsd">
+
+ <!--
+ Adds a Java package name of a package that Java event classes reside in.
+ This setting allows an application to place all it's events into one or more Java packages
+ and then declare these packages.
+ The engine attempts to resolve an event type alias to a Java class residing in each declared package.
+ -->
+ <event-type-auto-alias package-name="org.jboss.test.sam.stream.invm"/>
+
+ <!--
+ Sample configuration for database access using DriverManager;
+ retains connections associated with a statement, closing the connection when a statement is stopped
+ -->
+ <database-reference name="mysql1">
+ <drivermanager-connection class-name="com.mysql.jdbc.Driver"
+ url="jdbc:mysql://localhost/mysql1?user=root&password="
+ user="jbossfx" password="">
+ <connection-arg name="user" value ="root"/>
+ <connection-arg name="password" value =""/>
+ </drivermanager-connection>
+ <!--
+ Retains connection associated with a statement, closing a connection only when a statement is stopped
+ -->
+ <connection-lifecycle value="retain"/>
+ <!--
+ Configures an optional time-based cache with a maximum age in seconds and a purge interval,
+ and an optional reference strategy
+ -->
+ <expiry-time-cache max-age-seconds="60" purge-interval-seconds="120" ref-type="weak"/>
+ </database-reference>
+
+ <!--
+ Sample engine settings
+ -->
+ <engine-settings>
+ <defaults>
+ <threading>
+ <!--
+ In multithreaded environments, this setting controls whether dispatches to listeners
+ preserve the ordering in which the statement processes events
+ -->
+ <listener-dispatch preserve-order="true" timeout-msec="1000" locking="spin"/>
+ <!--
+ In multithreaded environments, this setting controls whether insert-into streams
+ preserve the order of events inserted into them by one or more statements,
+ allowing statements that consume other statement's events to behave deterministic.
+ -->
+ <insert-into-dispatch preserve-order="true" timeout-msec="100" locking="spin"/>
+ <!-- These settings define the resolution of the internal timer thread,
+ and can disable the timer to indicate that the application supplies the timer events
+ -->
+ <internal-timer enabled="true" msec-resolution="100"/>
+ </threading>
+ <event-meta>
+ <!--
+ Lets configure the engine to use case-insensitive resolution for event properties
+ -->
+ <class-property-resolution style="distinct_case_insensitive"/>
+ </event-meta>
+ <view-resources>
+ <!--
+ Lets configure the engine to reuse views, which is the default but can introduce additional locking
+ -->
+ <share-views enabled="true"/>
+ </view-resources>
+ <logging>
+ <!--
+ By default the engine does not generate logging through Log4j of the event processing execution path.
+ To get debug output, set this flag to true. This setting translates into a static boolean flag
+ and thus may apply to multiple engine instances within a given VM.
+ -->
+ <execution-path enabled="false" />
+ </logging>
+ <stream-selection>
+ <!--
+ By default the engine generates output for the insert stream only, and not for the remove stream.
+ To obtain output for remove stream only, or for insert stream and remove stream,
+ there are keywords "rstream" and "irstream" for use in the select clause.
+ This setting controls the default behavior, if no keyword is specified in the select-clause by statements.
+ -->
+ <stream-selector value="irstream" />
+ </stream-selection>
+ <time-source>
+ <!--
+ By default the time source is System.currentTimeMillis.
+ This sample configures the nano-second time call System.nanoTime() as the time source,
+ which Esper adjusts for wall clock time.
+ -->
+ <time-source-type value="nano" />
+ </time-source>
+ </defaults>
+ </engine-settings>
+
+</esper-configuration>
Property changes on: sam/trunk/modules/sim/src/test/resources/viz/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: sam/trunk/pom.xml
===================================================================
--- sam/trunk/pom.xml 2008-07-15 18:01:27 UTC (rev 171)
+++ sam/trunk/pom.xml 2008-07-16 10:37:03 UTC (rev 172)
@@ -4,11 +4,17 @@
<name>SAM (Esper impl.)</name>
<groupId>org.jboss.sam</groupId>
- <artifactId>sam-esper</artifactId>
- <packaging>jar</packaging>
+ <artifactId>sam</artifactId>
+ <packaging>pom</packaging>
<version>1.0.0.SNAPSHOT</version>
+ <modules>
+ <module>modules/core</module>
+ <module>modules/fx</module>
+ <module>modules/sim</module>
+ </modules>
+
<!-- Properties -->
<properties>
@@ -23,53 +29,55 @@
<hsqldb.version>1.8.0.7</hsqldb.version>
<javasim.version>2.0-hbraun</javasim.version>
</properties>
-
+
<!-- Dependencies -->
- <dependencies>
+ <dependencyManagement>
+ <dependencies>
- <dependency>
- <groupId>esper</groupId>
- <artifactId>esper</artifactId>
- <version>${esper.version}</version>
- </dependency>
+ <dependency>
+ <groupId>esper</groupId>
+ <artifactId>esper</artifactId>
+ <version>${esper.version}</version>
+ </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging-api</artifactId>
- <version>${commons-logging.version}</version>
- </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ <version>${commons-logging.version}</version>
+ </dependency>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr-runtime</artifactId>
- <version>${antlr.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr-runtime</artifactId>
+ <version>${antlr.version}</version>
+ </dependency>
- <dependency>
- <groupId>jfree</groupId>
- <artifactId>jfreechart</artifactId>
- <version>${jfree.version}</version>
- </dependency>
+ <dependency>
+ <groupId>jfree</groupId>
+ <artifactId>jfreechart</artifactId>
+ <version>${jfree.version}</version>
+ </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>${hsqldb.version}</version>
- </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>${hsqldb.version}</version>
+ </dependency>
- <dependency>
- <groupId>javasim</groupId>
- <artifactId>javasim</artifactId>
- <version>${javasim.version}</version>
- </dependency>
+ <dependency>
+ <groupId>javasim</groupId>
+ <artifactId>javasim</artifactId>
+ <version>${javasim.version}</version>
+ </dependency>
- </dependencies>
+ </dependencies>
+ </dependencyManagement>
<!-- Plugins -->
<build>
@@ -79,27 +87,7 @@
<directory>src/main/etc</directory>
<filtering>true</filtering>
</resource>
- </resources>
- <!--plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>install</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="version.id" value="${project.version}"/>
- <property name="jboss.local.repository" value="${jboss.local.repository}"/>
- <ant antfile="src/main/ant/build-install.xml" target="install"/>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins-->
+ </resources>
<plugins>
<plugin>
Modified: sam/trunk/sam-trunk.iml
===================================================================
--- sam/trunk/sam-trunk.iml 2008-07-15 18:01:27 UTC (rev 171)
+++ sam/trunk/sam-trunk.iml 2008-07-16 10:37:03 UTC (rev 172)
@@ -5,6 +5,15 @@
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/modules/core/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/modules/core/src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/modules/core/src/test/resources" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/modules/fx/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/modules/fx/src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/modules/fx/src/test/resources" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/modules/sim/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/modules/sim/src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/modules/sim/src/test/resources" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true" />
@@ -21,36 +30,36 @@
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: junit:junit:jar:3.8.2:compile">
+ <library name="M2 Dep: esper:esper:jar:2.2.0-JBoss-Nightly:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/esper/esper/2.2.0-JBoss-Nightly/esper-2.2.0-JBoss-Nightly.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: org.antlr:antlr-runtime:jar:3.0.1:compile">
+ <library name="M2 Dep: hsqldb:hsqldb:jar:1.8.0.7:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: commons-logging:commons-logging-api:jar:1.1:compile">
+ <library name="M2 Dep: cglib:cglib-nodep:jar:2.1_3:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: jfree:jcommon:jar:1.0.0:compile">
+ <library name="M2 Dep: log4j:log4j:jar:1.2.14:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/jfree/jcommon/1.0.0/jcommon-1.0.0.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -66,65 +75,76 @@
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: hsqldb:hsqldb:jar:1.8.0.7:compile">
+ <library name="M2 Dep: javasim:javasim:jar:2.0-hbraun:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/javasim/javasim/2.0-hbraun/javasim-2.0-hbraun.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: javasim:javasim:jar:2.0-hbraun:compile">
+ <library name="M2 Dep: commons-logging:commons-logging:jar:1.1.1:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/javasim/javasim/2.0-hbraun/javasim-2.0-hbraun.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: cglib:cglib-nodep:jar:2.1_3:compile">
+ <library name="M2 Dep: mysql:mysql-connector-java:jar:3.1.14:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/mysql/mysql-connector-java/3.1.14/mysql-connector-java-3.1.14.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: log4j:log4j:jar:1.2.14:compile">
+ <library name="M2 Dep: junit:junit:jar:3.8.2:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: commons-logging:commons-logging:jar:1.1.1:compile">
+ <library name="M2 Dep: org.antlr:antlr-runtime:jar:3.0.1:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: mysql:mysql-connector-java:jar:3.1.14:compile">
+ <library name="M2 Dep: commons-logging:commons-logging-api:jar:1.1:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/mysql/mysql-connector-java/3.1.14/mysql-connector-java-3.1.14.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: esper:esper:jar:2.2.0-JBoss-Nightly:compile">
+ <library name="M2 Dep: org.jboss.sam:core:jar:1.0.0.SNAPSHOT:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/esper/esper/2.2.0-JBoss-Nightly/esper-2.2.0-JBoss-Nightly.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/org/jboss/sam/core/1.0.0.SNAPSHOT/core-1.0.0.SNAPSHOT.jar!/" />
</CLASSES>
<JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/org/jboss/sam/core/1.0.0.SNAPSHOT/core-1.0.0.SNAPSHOT-sources.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="M2 Dep: jfree:jcommon:jar:1.0.0:compile">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/jfree/jcommon/1.0.0/jcommon-1.0.0.jar!/" />
+ </CLASSES>
+ <JAVADOC />
<SOURCES />
</library>
</orderEntry>
15 years, 9 months
Overlord SVN: r171 - in cdl/trunk: samples/jbossesb and 3 other directories.
by overlord-commits@lists.jboss.org
Author: jeff.yuchang
Date: 2008-07-15 14:01:27 -0400 (Tue, 15 Jul 2008)
New Revision: 171
Added:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetStateAction.java
Removed:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetVariableAction.java
Modified:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ConversationAction.java
cdl/trunk/samples/jbossesb/README.txt
cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/deployment.xml
cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml
cdl/trunk/samples/jbossesb/broker/src/main/resources/jbmq-queue-service.xml
cdl/trunk/samples/jbossesb/client/src/com/acme/services/buyer/BrokerClient.java
Log:
* Separating the 'ScheduleStateAction' from 'PerformAction' in same service.
* Rename the 'SetVariableAction' to 'SetStateAction'.
* Add one more service for 'ScheduleStateAction'.
* Update the README file.
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ConversationAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ConversationAction.java 2008-07-15 14:39:41 UTC (rev 170)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ConversationAction.java 2008-07-15 18:01:27 UTC (rev 171)
@@ -289,6 +289,12 @@
protected void addScheduleItemToDeliver(String category, String name) {
+ for (ScheduleItem si : scheduleItems) {
+ if (category.equals(si.getCategory()) && name.equals(si.getName())) {
+ logger.error("Add duplicated schedule item of " + category + "/" + name);
+ return;
+ }
+ }
ScheduleItem si = new ScheduleItem(category, name);
scheduleItems.add(si);
}
Added: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetStateAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetStateAction.java (rev 0)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetStateAction.java 2008-07-15 18:01:27 UTC (rev 171)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ */
+package org.jboss.soa.overlord.jbossesb.actions;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.conversation.ClassLoaderUtil;
+import org.jboss.soa.overlord.conversation.Session;
+import org.jboss.soa.overlord.conversation.SessionManager;
+import org.jboss.soa.overlord.jbossesb.util.XMLUtils;
+import org.mvel.MVEL;
+import org.w3c.dom.Element;
+
+/**
+ * @author jeffyu
+ *
+ */
+public class SetStateAction extends ConversationAction {
+
+ private Logger logger = Logger.getLogger(SetStateAction.class);
+
+ public SetStateAction(ConfigTree config) {
+ super(config);
+ }
+
+
+ @Override
+ public Message handle(Message message) throws Exception {
+ String variable = getConfig().getAttribute("variable");
+ String stateExpression = getConfig().getAttribute("stateExpression");
+ String messageExpression = getConfig().getAttribute("messageExpression");
+
+ Session session = getSession(message);
+ Object bstate = session.getBusinessObject();
+ logger.info("Set value to the variable of " + variable);
+
+ while (variable.startsWith("parent.")) {
+ variable = variable.substring(7);
+ session = session.getParent();
+ if (session.getPojoID() != 0) {
+ Class<?> pojoClass = ClassLoaderUtil.loadClass(session.getPojoClass());
+ Object pojo = SessionManager.getObject(session.getPojoID(), pojoClass);
+ session.setBusinessObject(pojo);
+ }
+ }
+
+ if (stateExpression != null) {
+ Object result = MVEL.eval(stateExpression, bstate);
+ MVEL.setProperty(session.getBusinessObject(), variable, result);
+ logger.info("The Variable is: " + variable + "; stateExpression is: " + stateExpression);
+ } else if (messageExpression != null) {
+ String xmlBody = (String) message.getBody().get();
+ Element element = (Element) XMLUtils.getNode(xmlBody);
+ String result = XMLUtils.executeXpath(element, messageExpression);
+ MVEL.setProperty(session.getBusinessObject(), variable, result);
+ logger.info("The Variable is: " + variable + "; messageExpression is: " + messageExpression);
+ }
+
+ SessionManager.updateObject(bstate);
+
+ return message;
+ }
+
+
+}
Deleted: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetVariableAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetVariableAction.java 2008-07-15 14:39:41 UTC (rev 170)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetVariableAction.java 2008-07-15 18:01:27 UTC (rev 171)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2008,
- */
-package org.jboss.soa.overlord.jbossesb.actions;
-
-import org.apache.log4j.Logger;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.overlord.conversation.ClassLoaderUtil;
-import org.jboss.soa.overlord.conversation.Session;
-import org.jboss.soa.overlord.conversation.SessionManager;
-import org.jboss.soa.overlord.jbossesb.util.XMLUtils;
-import org.mvel.MVEL;
-import org.w3c.dom.Element;
-
-/**
- * @author jeffyu
- *
- */
-public class SetVariableAction extends ConversationAction {
-
- private Logger logger = Logger.getLogger(SetVariableAction.class);
-
- public SetVariableAction(ConfigTree config) {
- super(config);
- }
-
-
- @Override
- public Message handle(Message message) throws Exception {
- String variable = getConfig().getAttribute("variable");
- String stateExpression = getConfig().getAttribute("stateExpression");
- String messageExpression = getConfig().getAttribute("messageExpression");
-
- Session session = getSession(message);
- Object bstate = session.getBusinessObject();
- logger.info("Set value to the variable of " + variable);
-
- while (variable.startsWith("parent.")) {
- variable = variable.substring(7);
- session = session.getParent();
- if (session.getPojoID() != 0) {
- Class<?> pojoClass = ClassLoaderUtil.loadClass(session.getPojoClass());
- Object pojo = SessionManager.getObject(session.getPojoID(), pojoClass);
- session.setBusinessObject(pojo);
- }
- }
-
- if (stateExpression != null) {
- Object result = MVEL.eval(stateExpression, bstate);
- MVEL.setProperty(session.getBusinessObject(), variable, result);
- logger.info("The Variable is: " + variable + "; stateExpression is: " + stateExpression);
- } else if (messageExpression != null) {
- String xmlBody = (String) message.getBody().get();
- Element element = (Element) XMLUtils.getNode(xmlBody);
- String result = XMLUtils.executeXpath(element, messageExpression);
- MVEL.setProperty(session.getBusinessObject(), variable, result);
- logger.info("The Variable is: " + variable + "; messageExpression is: " + messageExpression);
- }
-
- SessionManager.updateObject(bstate);
-
- return message;
- }
-
-
-}
Modified: cdl/trunk/samples/jbossesb/README.txt
===================================================================
--- cdl/trunk/samples/jbossesb/README.txt 2008-07-15 14:39:41 UTC (rev 170)
+++ cdl/trunk/samples/jbossesb/README.txt 2008-07-15 18:01:27 UTC (rev 171)
@@ -1,38 +1,83 @@
-The Purchasing example.
+Instructions for examples running:
+=================================
Required to run the Purchasing example:
-- ANT
-- Maven
-- JBoss AS 4.2.2 or higher with the JBoss ESB SAR deployment (jbossesb.sar).
+---------------------------------------
+- ANT 1.6.5 or higher
+- Maven 2.0.8 or higher
+- JBoss AS 4.2.2.GA or higher with the JBoss ESB SAR deployment (jbossesb.sar).
+- JBossESB 4.3.GA
+Folder directories:
+-------------------
+- client
+- broker
+- purchasing
+
Settings required to edit before running:
+========================================
-File: purchasing/pom.xml
+File: purchasing/pom.xml, broker/pom.xml for purchasing example and broker's respectively.
- Update the "deploy.dir" variable to your JBossAS server directory.
--- Notice Before jbossesb-rosetta.jar and jbossesb-config-model.jar get published in jboss maven repository, you need to install these two artifacts into
+- Before jbossesb-rosetta.jar and jbossesb-config-model.jar get published in jboss maven repository, you need to install these two artifacts into
your local repository by using following commands:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
-Here we are using jbossesb-rosetta 4.2.1 version, jbossesb-config-model 1.0.1 version.
+Notice: Here we are using jbossesb-rosetta 4.3 version, jbossesb-config-model 1.0.1 version.
-Running instructions for purchasing example:
-------------------------------------------------
+Instructions for purchasing example:
+===========================================
To run the purchasing, follow these steps:
-1 - run your JBoss AS - you will need to have the 4.2.1 or higher (with JBossESB installed)
+1 - run your JBoss AS - you will need to have the 4.2.2 or higher (with JBossESB installed)
2 - from the $JBossAS, execute the command to start the ESB: "bin/run.sh", or "bin/run.bat" for windows.
3 - from the $purchasing: execute the command to start the Hsql database: "ant startdb".
4 - Open up another shell, from the $Purchasing, execute the command to deploy the "Purchasing": "mvn install"
-* this should deploy the ESB archive to your JBoss AS server/default.
+ * this should deploy the ESB archive to your JBoss AS server/default.
5 - from the $client, execute the command to run the client: "ant runClient"
- You will see the "<BuyResponse id="5"></BuyResponse>" in the client console.
+ You will see following in the console.
-6 - you can from the $purchasing to run "ant dbmanager" to open up the database browser to check the data.
+ [java] =========================================
+ [java] Request: <BuyRequest id="5" ></BuyRequest>
+ [java] Reply: <BuyResponse id="5"></BuyResponse>
+ [java] =========================================
+
+
+6 - you can be from the $purchasing to run "ant dbmanager" to open up the database browser to check the data.
+
+
+Instructions for broker example:
+=======================================
+To run the broker, follow these steps:
+
+Currently, if you want to run the 'broker' example, please open up the 'jbossesb-properties.xml' in the $JBossAS/server/default/deploy/jbossesb.sar, update the 'org.jboss.soa.esb.jms.connectionPool' property value to '30', instead of '20'. It won't be needed to update this if we separate the Supplier & Credit Agency as another two esb artifacts.
+
+1 - run your JBoss AS - you will need to have the 4.2.2 or higher (with JBossESB installed)
+
+2 - from the $JBossAS, execute the command to start the ESB: "bin/run.sh", or "bin/run.bat" for windows.
+
+3 - from the $broker: execute the command to start the Hsql database: "ant startdb".
+
+4 - Open up another shell, from the $broker, execute the command to deploy the "broker": "mvn install"
+ * this should deploy the ESB archive to your JBoss AS server/default.
+
+5 - from the $client, execute the command to run the client: "ant runBrokerClient"
+ You will see following in the console.
+ [java] =========================================
+ [java] Request: <enquiry id="20" ></enquiry>
+ [java] Reply: <quoteList id="20"><quote supplierDesc="{http://www.jboss.org/overlord/loanBroker}Supplier1">10</quote></quoteList>
+ [java] Sending Buy request to Broker...
+ [java] Request: <buy id="20" supplierDesc="{http://www.jboss.org/overlord/loanBroker}Supplier1" quoteValue="10"></buy>
+ [java] Reply: <orderConfirmResponse id="20" supplierDesc = "{http://www.jboss.org/overlord/loanBroker}Supplier1">The quote of 10 has been confirmed.</orderConfirmResponse>
+ [java] =========================================
+
+6 - you can be from the $broker to run "ant dbmanager" to open up the database browser to check the data.
+
Modified: cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/deployment.xml
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/deployment.xml 2008-07-15 14:39:41 UTC (rev 170)
+++ cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/deployment.xml 2008-07-15 18:01:27 UTC (rev 171)
@@ -17,6 +17,7 @@
<depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker14</depends>
<depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker15</depends>
<depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker16</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker17</depends>
<depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency</depends>
<depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency1</depends>
<depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency2</depends>
Modified: cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml 2008-07-15 14:39:41 UTC (rev 170)
+++ cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml 2008-07-15 18:01:27 UTC (rev 171)
@@ -57,6 +57,9 @@
<jms-bus busid="BrokerService16">
<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker16"/>
</jms-bus>
+ <jms-bus busid="BrokerService17">
+ <jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker17"/>
+ </jms-bus>
<jms-bus busid="SupplierService1">
<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-supplier1" />
</jms-bus>
@@ -181,22 +184,12 @@
<property name="serviceCategory" value="ESBBroker.BrokerParticipant" />
<property name="serviceName" value="RequestForQuote.main" />
<property name="responseServiceCategory" value="ESBBroker.BrokerParticipant" />
- <property name="responseServiceName" value="ESBBrokerProcess.main.3" />
+ <property name="responseServiceName" value="ESBBrokerProcess.main.9" />
<property name="bindDetails" >
<bind from-expression="getCurrentSupplier()"
to-variable="supplier" />
</property>
</action>
- <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction" name="s3-2">
- <property name="variable" value="supplierIndex" />
- <property name="stateExpression" value="nextSupplier()" />
- </action>
- <!--action class="org.jboss.soa.overlord.jbossesb.actions.ScheduleStateAction"
- process="process" name="s3-3">
- <property name="serviceCategory" value="ESBBroker.BrokerParticipant" />
- <property name="serviceName" value="ESBBrokerProcess.main.1" />
- <property name="immediate" value="true" />
- </action-->
</actions>
</service>
@@ -289,6 +282,7 @@
<actions mep="OneWay">
<action class="org.jboss.soa.overlord.jbossesb.actions.ReceiveMessageAction"
process="process" name="s6-1">
+ <property name="session" value="org.jboss.soa.overlord.samples.jbossesb.loan.broker.BrokerMain" />
<property name="operation" value="cancel" />
<property name="messageType" value="cancel" />
<property name="identities" >
@@ -307,12 +301,12 @@
maxThreads="1"/>
</listeners>
<actions mep="OneWay">
- <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction" name="s7-1">
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetStateAction" name="s7-1">
<property name="session" value="org.jboss.soa.overlord.samples.jbossesb.loan.broker.BrokerMain" />
<property name="variable" value="selectedSupplierDesc" />
<property name="messageExpression" value="//@supplierDesc" />
</action>
- <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction" name="s7-2">
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetStateAction" name="s7-2">
<property name="variable" value="selectedQuoteValue" />
<property name="messageExpression" value="//@quoteValue" />
</action>
@@ -353,6 +347,37 @@
</actions>
</service>
+ <service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess.main.9" description="">
+ <listeners>
+ <jms-listener name="BrokerServiceListener17"
+ busidref="BrokerService17"
+ maxThreads="1"/>
+ </listeners>
+ <actions mep="OneWay">
+ <action class="org.jboss.soa.overlord.jbossesb.actions.ReceiveMessageAction"
+ process="process" name="s17-1">
+ <property name="session" value="org.jboss.soa.overlord.samples.jbossesb.loan.broker.BrokerMain" />
+ <property name="messageType" value="quote" />
+ <property name="serviceDescriptionName" value="{http://www.jboss.org/overlord/loanBroker}Broker"/>
+ <property name="identities" >
+ <identity type="primary" >
+ <token name="id" locator="//@id" />
+ </identity>
+ </property>
+ </action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetStateAction" name="s17-2">
+ <property name="variable" value="supplierIndex" />
+ <property name="stateExpression" value="nextSupplier()" />
+ </action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.ScheduleStateAction"
+ process="process" name="s17-3">
+ <property name="serviceCategory" value="ESBBroker.BrokerParticipant" />
+ <property name="serviceName" value="ESBBrokerProcess.main.1" />
+ <property name="immediate" value="true" />
+ </action>
+ </actions>
+ </service>
+
<service category="ESBBroker.BrokerParticipant" name="RequestForQuote.main" description="">
<listeners>
<jms-listener name="BrokerServiceListener10"
@@ -411,18 +436,18 @@
</identity>
</property>
</action>
- <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction"
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetStateAction"
process="process" name="s9-2">
<property name="variable" value="quote.serviceDescription" />
<property name="messageExpression" value="//@supplierDesc" />
</action>
- <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction"
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetStateAction"
process="process" name="s9-3">
<property name="variable" value="quote.value" />
<property name="messageExpression" value="/quote" />
</action>
- <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction"
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetStateAction"
process="process" name="s9-4">
<property name="variable" value="parent.quote" />
<property name="stateExpression" value="quote" />
@@ -579,7 +604,7 @@
</property>
</action>
- <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction"
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetStateAction"
process="process" name="s13-2">
<property name="variable" value="confirmation.detail" />
<property name="messageExpression" value="/orderConfirmResponse" />
Modified: cdl/trunk/samples/jbossesb/broker/src/main/resources/jbmq-queue-service.xml
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/resources/jbmq-queue-service.xml 2008-07-15 14:39:41 UTC (rev 170)
+++ cdl/trunk/samples/jbossesb/broker/src/main/resources/jbmq-queue-service.xml 2008-07-15 18:01:27 UTC (rev 171)
@@ -111,6 +111,12 @@
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker17">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+</mbean>
+<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
Modified: cdl/trunk/samples/jbossesb/client/src/com/acme/services/buyer/BrokerClient.java
===================================================================
--- cdl/trunk/samples/jbossesb/client/src/com/acme/services/buyer/BrokerClient.java 2008-07-15 14:39:41 UTC (rev 170)
+++ cdl/trunk/samples/jbossesb/client/src/com/acme/services/buyer/BrokerClient.java 2008-07-15 18:01:27 UTC (rev 171)
@@ -62,7 +62,7 @@
Message reply=brokerInvoker.deliverSync(mesg, 50000);
System.out.println("Reply: "+reply.getBody().get());
- Thread.sleep(10000);//Waiting...
+ Thread.sleep(5000);//Waiting...
System.out.println("Sending Buy request to Broker...");
String buyReq = "<buy id=\"20\" supplierDesc=\"{http://www.jboss.org/overlord/loanBroker}Supplier1\" quoteValue=\"10\"></buy>";
15 years, 9 months
Overlord SVN: r170 - sam/trunk.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-15 10:39:41 -0400 (Tue, 15 Jul 2008)
New Revision: 170
Modified:
sam/trunk/SAM.iws
sam/trunk/pom.xml
sam/trunk/sam-trunk.iml
Log:
Switch to esper-2.2.0 jboss nightly build
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-15 14:38:53 UTC (rev 169)
+++ sam/trunk/SAM.iws 2008-07-15 14:39:41 UTC (rev 170)
@@ -20,10 +20,7 @@
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/internal/BufferView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/internal/BufferView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/adapter/invm/Alert.java" afterPath="" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServicesContextFactoryDefault.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServicesContextFactoryDefault.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/adapter/invm/InVMAdapterTestCase.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PluginLoader.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PluginLoader.java" />
@@ -31,6 +28,7 @@
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/sam-trunk.iml" afterPath="$PROJECT_DIR$/sam-trunk.iml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/CorrelationView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/CorrelationView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/UnivariateStatisticsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/UnivariateStatisticsView.java" />
@@ -235,7 +233,7 @@
</provider>
</entry>
</file>
- <file leaf-file-name="DatabaseTestCase.java" pinned="false" current="true" current-in-tab="true">
+ <file leaf-file-name="DatabaseTestCase.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java">
<provider selected="true" editor-type-id="text-editor">
<state line="135" column="8" selection-start="4971" selection-end="4971" vertical-scroll-proportion="0.95513576">
@@ -244,6 +242,15 @@
</provider>
</entry>
</file>
+ <file leaf-file-name="pom.xml" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/pom.xml">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="242" column="46" selection-start="7479" selection-end="7511" vertical-scroll-proportion="0.29206732">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
<file leaf-file-name="EsperProcessingStatement.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
<provider selected="true" editor-type-id="text-editor">
@@ -1201,13 +1208,6 @@
<option name="myLastEditedConfigurable" value="IDE Profiles" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartBuilder.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="32" column="10" selection-start="1254" selection-end="1254" vertical-scroll-proportion="0.26918536">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMetadata.java">
<provider selected="true" editor-type-id="text-editor">
<state line="29" column="101" selection-start="1235" selection-end="1235" vertical-scroll-proportion="0.20188902">
@@ -1306,6 +1306,13 @@
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/pom.xml">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="242" column="46" selection-start="7479" selection-end="7511" vertical-scroll-proportion="0.29206732">
+ <folding />
+ </state>
+ </provider>
+ </entry>
</component>
</project>
Modified: sam/trunk/pom.xml
===================================================================
--- sam/trunk/pom.xml 2008-07-15 14:38:53 UTC (rev 169)
+++ sam/trunk/pom.xml 2008-07-15 14:39:41 UTC (rev 170)
@@ -15,7 +15,7 @@
<surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/etc/tst.policy</surefire.security.args>
<surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</surefire.jdwp.args>
- <esper.version>2.2.0-SNAPSHOT</esper.version>
+ <esper.version>2.2.0-JBoss-Nightly</esper.version>
<junit.version>3.8.2</junit.version>
<commons-logging.version>1.1</commons-logging.version>
<antlr.version>3.0.1</antlr.version>
Modified: sam/trunk/sam-trunk.iml
===================================================================
--- sam/trunk/sam-trunk.iml 2008-07-15 14:38:53 UTC (rev 169)
+++ sam/trunk/sam-trunk.iml 2008-07-15 14:39:41 UTC (rev 170)
@@ -120,9 +120,9 @@
</library>
</orderEntry>
<orderEntry type="module-library">
- <library name="M2 Dep: esper:esper:jar:2.2.0-SNAPSHOT:compile">
+ <library name="M2 Dep: esper:esper:jar:2.2.0-JBoss-Nightly:compile">
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../../../.m2/repository/esper/esper/2.2.0-SNAPSHOT/esper-2.2.0-SNAPSHOT.jar!/" />
+ <root url="jar://$MODULE_DIR$/../../../../.m2/repository/esper/esper/2.2.0-JBoss-Nightly/esper-2.2.0-JBoss-Nightly.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
15 years, 9 months
Overlord SVN: r168 - in sam/trunk: src/test/java/org/jboss/test/sam/database and 1 other directory.
by overlord-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-07-15 10:04:23 -0400 (Tue, 15 Jul 2008)
New Revision: 168
Modified:
sam/trunk/SAM.iws
sam/trunk/pom.xml
sam/trunk/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java
Log:
Verify ESPER-254
Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws 2008-07-15 12:34:49 UTC (rev 167)
+++ sam/trunk/SAM.iws 2008-07-15 14:04:23 UTC (rev 168)
@@ -21,6 +21,7 @@
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/std/SizeView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServiceProviderImpl.java" />
<change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/adapter/invm/Alert.java" afterPath="" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServicesContextFactoryDefault.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/core/EPServicesContextFactoryDefault.java" />
<change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/adapter/invm/InVMAdapterTestCase.java" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/RegressionLinestView.java" />
@@ -30,15 +31,10 @@
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/indicator/jmx/TestJMXLastElementDynamicMBean.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/WeightedAverageView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/pattern/PatternContext.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/sam-trunk.iml" afterPath="$PROJECT_DIR$/sam-trunk.iml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java" afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/CorrelationView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/CorrelationView.java" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/UnivariateStatisticsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/UnivariateStatisticsView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/event/BeanEventAdapter.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/resources/viz/esper-cfg.xml" afterPath="$PROJECT_DIR$/src/test/resources/viz/esper-cfg.xml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/resources/adapter/invm/esper-cfg.xml" afterPath="$PROJECT_DIR$/src/test/resources/adapter/invm/esper-cfg.xml" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/ViewFactoryContext.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/Configuration.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/Configuration.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationInformation.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationInformation.java" />
@@ -46,11 +42,6 @@
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/view/stat/MultiDimStatsView.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PlugInEventRepresentationContext.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/plugin/PlugInEventRepresentationContext.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/regression/client/MyTrendSpotterView.java" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/Alert.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/Alert.java" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/adapter/invm" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/InVMAdapterTestCase.java" afterPath="" />
- <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/adapter" afterPath="" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/client/TestConfigurationParser.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/test/java/com/espertech/esper/client/TestConfigurationParser.java" />
<change type="MODIFICATION" beforePath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationPluginLoader.java" afterPath="/home/hbraun/dev/prj/esper-2.1.0-src/trunk/esper/src/main/java/com/espertech/esper/client/ConfigurationPluginLoader.java" />
</list>
@@ -137,6 +128,32 @@
<option name="CONDITION" value="" />
<option name="LOG_MESSAGE" value="" />
</breakpoint>
+ <breakpoint url="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" line="101" class="org.jboss.test.sam.database.DatabaseTestCase" package="org.jboss.test.sam.database">
+ <option name="ENABLED" value="true" />
+ <option name="SUSPEND_POLICY" value="SuspendAll" />
+ <option name="LOG_ENABLED" value="false" />
+ <option name="LOG_EXPRESSION_ENABLED" value="false" />
+ <option name="COUNT_FILTER_ENABLED" value="false" />
+ <option name="COUNT_FILTER" value="0" />
+ <option name="CONDITION_ENABLED" value="false" />
+ <option name="CLASS_FILTERS_ENABLED" value="false" />
+ <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+ <option name="CONDITION" value="" />
+ <option name="LOG_MESSAGE" value="" />
+ </breakpoint>
+ <breakpoint url="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java" line="126" class="org.jboss.test.sam.database.DatabaseTestCase" package="org.jboss.test.sam.database">
+ <option name="ENABLED" value="true" />
+ <option name="SUSPEND_POLICY" value="SuspendAll" />
+ <option name="LOG_ENABLED" value="false" />
+ <option name="LOG_EXPRESSION_ENABLED" value="false" />
+ <option name="COUNT_FILTER_ENABLED" value="false" />
+ <option name="COUNT_FILTER" value="0" />
+ <option name="CONDITION_ENABLED" value="false" />
+ <option name="CLASS_FILTERS_ENABLED" value="false" />
+ <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+ <option name="CONDITION" value="" />
+ <option name="LOG_MESSAGE" value="" />
+ </breakpoint>
</line_breakpoints>
<breakpoint_any>
<breakpoint>
@@ -209,7 +226,7 @@
</component>
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="InVMStreamTestCase.java" pinned="false" current="true" current-in-tab="true">
+ <file leaf-file-name="InVMStreamTestCase.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm/InVMStreamTestCase.java">
<provider selected="true" editor-type-id="text-editor">
<state line="29" column="24" selection-start="1235" selection-end="1235" vertical-scroll-proportion="0.012987013">
@@ -218,6 +235,33 @@
</provider>
</entry>
</file>
+ <file leaf-file-name="DatabaseTestCase.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="135" column="8" selection-start="4971" selection-end="4971" vertical-scroll-proportion="0.95513576">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="EsperProcessingStatement.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="29" column="37" selection-start="1229" selection-end="1253" vertical-scroll-proportion="0.1794569">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="SamTestSetup.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/SamTestSetup.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="54" column="15" selection-start="2086" selection-end="2086" vertical-scroll-proportion="0.26564345">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
</leaf>
</component>
<component name="FindManager">
@@ -523,13 +567,31 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ </PATH>
+ <PATH>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test/sam/stream/invm" />
+ <option name="myItemId" value="SAM.ipr" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="sam-trunk" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -552,6 +614,22 @@
<option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -590,6 +668,10 @@
<option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
@@ -629,7 +711,7 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
- <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation" />
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -639,6 +721,52 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
+ <option name="myItemId" value="sam-trunk" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="SAM.ipr" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
<option name="myItemId" value="esper-2.1.0-src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
</PATH_ELEMENT>
@@ -753,15 +881,15 @@
</key>
</component>
<component name="RestoreUpdateTree" />
- <component name="RunManager" selected="JUnit.AggregationTestCase.testEventAggregation">
- <tempConfiguration default="false" name="AggregationTestCase.testEventAggregation" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
- <pattern value="org.jboss.test.sam.samples.aggregation.*" />
+ <component name="RunManager" selected="JUnit.DatabaseTestCase.testEsperPullAPI">
+ <tempConfiguration default="false" name="DatabaseTestCase.testEsperPullAPI" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+ <pattern value="org.jboss.test.sam.database.*" />
<module name="sam-trunk" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
- <option name="PACKAGE_NAME" value="org.jboss.test.sam.samples.aggregation" />
- <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.samples.aggregation.AggregationTestCase" />
- <option name="METHOD_NAME" value="testEventAggregation" />
+ <option name="PACKAGE_NAME" value="org.jboss.test.sam.database" />
+ <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.database.DatabaseTestCase" />
+ <option name="METHOD_NAME" value="testEsperPullAPI" />
<option name="TEST_OBJECT" value="method" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
@@ -770,7 +898,13 @@
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
+ <RunnerSettings RunnerId="Debug">
+ <option name="DEBUG_PORT" value="37688" />
+ <option name="TRANSPORT" value="0" />
+ <option name="LOCAL" value="true" />
+ </RunnerSettings>
<RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method>
<option name="Make" value="false" />
@@ -952,7 +1086,7 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="25" width="1680" height="1000" extended-state="6" />
- <editor active="false" />
+ <editor active="true" />
<layout>
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
@@ -972,7 +1106,7 @@
<window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
<window_info id="File View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
- <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27590436" order="0" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27590436" order="0" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.15757205" order="2" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.69020504" order="2" />
@@ -1067,34 +1201,6 @@
<option name="myLastEditedConfigurable" value="IDE Profiles" />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMapping.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="33" column="59" selection-start="1488" selection-end="1488" vertical-scroll-proportion="0.24321133">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMappingRegistry.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="28" column="17" selection-start="1175" selection-end="1175" vertical-scroll-proportion="0.1794569">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServer.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="32" column="17" selection-start="1397" selection-end="1397" vertical-scroll-proportion="0.26918536">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/PropertyMapping.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="38" column="22" selection-start="1434" selection-end="1434" vertical-scroll-proportion="0.1570248">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartBuilder.java">
<provider selected="true" editor-type-id="text-editor">
<state line="32" column="10" selection-start="1254" selection-end="1254" vertical-scroll-proportion="0.26918536">
@@ -1172,6 +1278,34 @@
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/SamTestSetup.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="54" column="15" selection-start="2086" selection-end="2086" vertical-scroll-proportion="0.26564345">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="29" column="37" selection-start="1229" selection-end="1253" vertical-scroll-proportion="0.1794569">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/InMemoryDatabase.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="113" column="22" selection-start="3497" selection-end="3497" vertical-scroll-proportion="0.25974026">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="135" column="8" selection-start="4971" selection-end="4971" vertical-scroll-proportion="0.95513576">
+ <folding />
+ </state>
+ </provider>
+ </entry>
</component>
</project>
Modified: sam/trunk/pom.xml
===================================================================
--- sam/trunk/pom.xml 2008-07-15 12:34:49 UTC (rev 167)
+++ sam/trunk/pom.xml 2008-07-15 14:04:23 UTC (rev 168)
@@ -15,7 +15,7 @@
<surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/etc/tst.policy</surefire.security.args>
<surefire.jdwp.args>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</surefire.jdwp.args>
- <esper.version>2.1.0</esper.version>
+ <esper.version>2.2.0-SNAPSHOT</esper.version>
<junit.version>3.8.2</junit.version>
<commons-logging.version>1.1</commons-logging.version>
<antlr.version>3.0.1</antlr.version>
Modified: sam/trunk/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java 2008-07-15 12:34:49 UTC (rev 167)
+++ sam/trunk/src/test/java/org/jboss/test/sam/database/DatabaseTestCase.java 2008-07-15 14:04:23 UTC (rev 168)
@@ -27,6 +27,8 @@
import com.espertech.esper.event.EventBean;
import org.jboss.sam.ProcessingStatement;
import org.jboss.sam.EventMessage;
+import org.jboss.sam.StreamOutput;
+import org.jboss.sam.internal.esper.EsperProcessingStatement;
import org.jboss.test.sam.SamTestSetup;
import org.jboss.test.sam.InMemoryDatabase;
@@ -68,11 +70,11 @@
db.update("INSERT INTO quotes (symbol, name, price) VALUES('ORCL', 'Oracle', 22.85)");
db.update("INSERT INTO quotes (symbol, name, price) VALUES('JAVA', 'Sun', 12.42)" );
db.update("INSERT INTO quotes (symbol, name, price) VALUES('GOOG', 'Goole', 572.51)");
-
+
+ // database dump
db.query("SELECT symbol, price FROM quotes");
}
-
protected void tearDown() throws Exception
{
db.shutdown();
@@ -87,17 +89,17 @@
String epl = "select symbol, price from Query.win:length(1) as query," +
" sql:SamTestDB ['SELECT symbol, price FROM quotes WHERE symbol like (${query.criteria})']";
- ProcessingStatement view = eventProcessor.registerBoundStatement("InVM","TriggerSQL", epl);
+ eventProcessor.registerBoundStatement("InVM","TriggerSQL", epl);
// trigger
generateInVMEvent( new Query("%") );
// evaluate
assertTrue("Listener not invoked", bufferedOutput.isInvoked());
- EventMessage[] lastnews = bufferedOutput.getLastNewData();
- assertFalse(lastnews.length==0);
+ EventMessage[] eventMessages = bufferedOutput.getLastNewData();
+ assertTrue(eventMessages.length==7);
- for(EventMessage event : lastnews)
+ for(EventMessage event : eventMessages)
{
System.out.println("symbol/price -> " + event.getProperty("symbol") + "/" + event.getProperty("price"));
}
@@ -107,47 +109,30 @@
{
System.out.println("FIXME ESPER-254: testPullAPI on database queries");
- /*
- Is going to be fixed in Esper 2.0.2
- See http://jira.codehaus.org/browse/ESPER-254
+ /*See http://jira.codehaus.org/browse/ESPER-254
- String aggregate = "insert into NewQuotes " +
+ String aggregateStmt = "insert into NewQuotes " +
"select symbol, price from " +
"pattern [every timer:interval(1 sec)], "+
- "sql:SamTestDB ['select * from quotes']";
+ "sql:SamTestDB ['select symbol, price from quotes']";
- String action = "select * from NewQuotes.win:length(1)";
+ String pullStmt = "select * from NewQuotes.win:keepall()";
// create two views
- EPLStatement aggregateView = runtime.registerStatement("PullAPI", aggregate);
- EPLStatement actionView = runtime.registerStatement("PullAPIAction", action);
+ eventProcessor.registerStatement("PullAPI", aggregateStmt);
+ ProcessingStatement stmt = eventProcessor.registerStatement("QuotestPull", pullStmt);
- // bind pull listener to it
- PullListener pullListener = new PullListener();
- ((EsperEPLStatement)actionView).getUnderlying().addListener(pullListener);
+ boolean receivedData = false;
+ Iterator<EventBean> it = ((EsperProcessingStatement)stmt).getUnderlying().iterator();
+ while(it.hasNext())
+ {
+ EventBean event = it.next();
+ System.out.println("symbol/price -> " + event.get("symbol") + "/" + event.get("price"));
+ receivedData = true;
+ }
- // evaluate results
- assertTrue("PullListener not invoked", pullListener.invoked);
- assertTrue("No data pulled fronm DB", pullListener.lastData.length>0);
+ assertTrue("Pull API failed, no data received", receivedData);
+
*/
}
-
- class PullListener implements StatementAwareUpdateListener
- {
- public EventBean[] lastData = new EventBean[]{};
- public boolean invoked;
-
- public void update(EventBean[] newEvents, EventBean[] oldEvents,
- EPStatement statement, EPServiceProvider epServiceProvider)
- {
- List<EventBean> batch = new ArrayList<EventBean>();
- Iterator<EventBean> it = statement.iterator();
- while(it.hasNext())
- {
- batch.add(it.next());
- }
- this.invoked = true;
- this.lastData = batch.toArray(new EventBean[]{});
- }
- }
}
15 years, 9 months