[overlord-commits] Overlord SVN: r172 - in sam/trunk: modules and 84 other directories.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Wed Jul 16 06:37:04 EDT 2008


Author: heiko.braun at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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&amp;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&amp;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&amp;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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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&amp;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&amp;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&amp;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>




More information about the overlord-commits mailing list