[overlord-commits] Overlord SVN: r111 - in sam/trunk: src/main/java/org/jboss/sam and 6 other directories.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Thu Jul 3 16:09:31 EDT 2008


Author: heiko.braun at jboss.com
Date: 2008-07-03 16:09:31 -0400 (Thu, 03 Jul 2008)
New Revision: 111

Added:
   sam/trunk/src/main/java/org/jboss/sam/simulation/
   sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
   sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
   sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java
   sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
   sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
   sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
   sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java
   sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java
   sam/trunk/src/test/java/org/jboss/test/sam/simulation/
   sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
   sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
   sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
   sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
   sam/trunk/src/test/resources/simulation/
   sam/trunk/src/test/resources/simulation/esper-cfg.xml
Removed:
   sam/trunk/src/test/java/org/jboss/test/sam/sim/
   sam/trunk/src/test/resources/sim/
Modified:
   sam/trunk/SAM.iws
   sam/trunk/sam-trunk.iml
   sam/trunk/src/main/java/org/jboss/sam/StreamInput.java
   sam/trunk/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java
Log:
Simulation API, first cut

Modified: sam/trunk/SAM.iws
===================================================================
--- sam/trunk/SAM.iws	2008-07-03 19:06:57 UTC (rev 110)
+++ sam/trunk/SAM.iws	2008-07-03 20:09:31 UTC (rev 111)
@@ -16,7 +16,30 @@
     <option name="USER" value="" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" name="Default" comment="" />
+    <list default="true" name="Default" comment="">
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventSourceEntity.java" afterPath="" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventSink.java" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/sim" afterPath="" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSourceEntity.java" afterPath="" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/resources/simulation" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim" afterPath="" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInput.java" afterPath="$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInput.java" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SensorEventMessage.java" afterPath="" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/SAM.iws" afterPath="$PROJECT_DIR$/SAM.iws" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSink.java" afterPath="" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/resources/simulation/esper-cfg.xml" afterPath="$PROJECT_DIR$/src/test/resources/simulation/esper-cfg.xml" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/EventProcessorEntity.java" afterPath="" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/sam-trunk.iml" afterPath="$PROJECT_DIR$/sam-trunk.iml" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventProcessorEntity.java" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/resources/sim/esper-cfg.xml" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SimulationMain.java" afterPath="" />
+      <change type="DELETED" beforePath="$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java" afterPath="" />
+    </list>
   </component>
   <component name="ChangeListSynchronizer" />
   <component name="ChangesViewManager" flattened_view="true" />
@@ -86,21 +109,6 @@
     <disable_hints />
   </component>
   <component name="DebuggerManager">
-    <line_breakpoints>
-      <breakpoint url="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java" line="50" class="org.jboss.sam.internal.esper.StreamOutputAdapter" package="org.jboss.sam.internal.esper">
-        <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" />
@@ -148,8 +156,8 @@
       <property name="field_breakpoints_groupByClasses" value="true" />
       <property name="method_breakpoints_groupByClasses" value="true" />
       <property name="exception_breakpoints_viewId" value="TABLE" />
+      <property name="field_breakpoints_viewId" value="TABLE" />
       <property name="exception_breakpoints_groupByClasses" value="true" />
-      <property name="field_breakpoints_viewId" value="TABLE" />
       <property name="method_breakpoints_groupByMethods" value="false" />
     </ui_properties>
   </component>
@@ -172,71 +180,15 @@
   </component>
   <component name="FileEditorManager">
     <leaf>
-      <file leaf-file-name="ProcessingStatement.java" pinned="false" current="true" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/ProcessingStatement.java">
+      <file leaf-file-name="SimulationMain.java" pinned="false" current="true" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state line="31" column="17" selection-start="1394" selection-end="1394" vertical-scroll-proportion="0.252111">
+            <state line="52" column="70" selection-start="2013" selection-end="2013" vertical-scroll-proportion="0.60566705">
               <folding />
             </state>
           </provider>
         </entry>
       </file>
-      <file leaf-file-name="EsperRuntimeImpl.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="122" column="53" selection-start="4272" selection-end="4272" vertical-scroll-proportion="0.24366707">
-              <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="32" column="0" selection-start="1333" selection-end="1333" vertical-scroll-proportion="0.27503017">
-              <folding>
-                <element signature="imports" expanded="true" />
-              </folding>
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="StreamInputCallback.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.18335344">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="StreamOutput.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="42" column="20" selection-start="1542" selection-end="1542" vertical-scroll-proportion="0.504222">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="EventMessage.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="46" column="49" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.5958987">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
-      <file leaf-file-name="EventProcessor.java" pinned="false" current="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java">
-          <provider selected="true" editor-type-id="text-editor">
-            <state line="31" column="3" selection-start="1445" selection-end="1445" vertical-scroll-proportion="0.02291918">
-              <folding />
-            </state>
-          </provider>
-        </entry>
-      </file>
     </leaf>
   </component>
   <component name="FindManager">
@@ -249,6 +201,9 @@
     <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/main/java/org/jboss/sam/simulation/EventSourceEntity.java" root0="SKIP_INSPECTION" />
+  </component>
   <component name="InspectionManager">
     <option name="AUTOSCROLL_TO_SOURCE" value="false" />
     <option name="SPLITTER_PROPORTION" value="0.5" />
@@ -365,6 +320,10 @@
           <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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/resources" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
       </PATH>
       <PATH>
         <PATH_ELEMENT>
@@ -388,6 +347,36 @@
           <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
         </PATH_ELEMENT>
         <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/resources" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/resources/simulation" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="SAM.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="sam-trunk" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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" />
+          <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="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
         </PATH_ELEMENT>
@@ -414,6 +403,62 @@
           <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="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="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_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="SAM.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="sam-trunk" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/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" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="SAM.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="sam-trunk" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
           <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
           <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
         </PATH_ELEMENT>
@@ -453,7 +498,113 @@
           <option name="myItemId" value="SAM.ipr" />
           <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
         </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="sam-trunk" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
       </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="SAM.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="sam-trunk" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="SAM.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="sam-trunk" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/main/java/org/jboss/sam/internal" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+        </PATH_ELEMENT>
+      </PATH>
+      <PATH>
+        <PATH_ELEMENT>
+          <option name="myItemId" value="SAM.ipr" />
+          <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+        </PATH_ELEMENT>
+      </PATH>
     </subPane>
   </component>
   <component name="ProjectReloadState">
@@ -467,7 +618,7 @@
       <showLibraryContents />
       <hideEmptyPackages />
       <abbreviatePackageNames />
-      <showStructure PackagesPane="false" ProjectPane="false" Scope="false" Favorites="false" />
+      <showStructure Favorites="false" PackagesPane="false" Scope="false" ProjectPane="false" />
       <autoscrollToSource />
       <autoscrollFromSource />
       <sortByType />
@@ -477,13 +628,13 @@
     <property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
     <property name="GoToFile.includeJavaFiles" value="false" />
     <property name="GoToClass.toSaveIncludeLibraries" value="false" />
+    <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
     <property name="RunManagerConfig.compileBeforeRunning" value="false" />
-    <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
     <property name="GenerateAntBuildDialog.generateSingleFile" value="false" />
     <property name="MemberChooser.sorted" value="false" />
     <property name="MemberChooser.showClasses" value="true" />
+    <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
     <property name="GenerateAntBuildDialog.backupFiles" value="true" />
-    <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
     <property name="GoToClass.includeLibraries" value="false" />
     <property name="MemberChooser.copyJavadoc" value="false" />
   </component>
@@ -491,10 +642,14 @@
     <option name="SHOW_DIALOG" value="true" />
   </component>
   <component name="RecentsManager">
+    <key name="CopyClassDialog.RECENTS_KEY">
+      <recent name="" />
+    </key>
     <key name="IntroduceConstantDialog.RECENTS_KEY">
       <recent name="" />
     </key>
     <key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
+      <recent name="org.jboss.sam.sim" />
       <recent name="org.jboss.test.sam" />
       <recent name="org.jboss.sam.chart" />
       <recent name="org.jboss.sam.chart.internal" />
@@ -503,13 +658,27 @@
   </component>
   <component name="RestoreUpdateTree" />
   <component name="RunManager" selected="Application.SimulationMain">
-    <configuration default="true" type="Remote" factoryName="Remote">
-      <option name="USE_SOCKET_TRANSPORT" value="true" />
-      <option name="SERVER_MODE" value="false" />
-      <option name="SHMEM_ADDRESS" value="javadebug" />
-      <option name="HOST" value="localhost" />
-      <option name="PORT" value="5005" />
-    </configuration>
+    <tempConfiguration default="false" name="SimulationMain" type="Application" factoryName="Application" enabled="false" merge="false">
+      <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.simulation.SimulationMain" />
+      <option name="VM_PARAMETERS" />
+      <option name="PROGRAM_PARAMETERS" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" />
+      <option name="ENABLE_SWING_INSPECTOR" value="false" />
+      <module name="sam-trunk" />
+      <RunnerSettings RunnerId="Debug">
+        <option name="DEBUG_PORT" value="32888" />
+        <option name="TRANSPORT" value="0" />
+        <option name="LOCAL" value="true" />
+      </RunnerSettings>
+      <RunnerSettings RunnerId="Run" />
+      <ConfigurationWrapper RunnerId="Debug" />
+      <ConfigurationWrapper RunnerId="Run" />
+      <method>
+        <option name="Make" value="true" />
+      </method>
+    </tempConfiguration>
     <configuration default="true" type="Applet" factoryName="Applet">
       <module name="" />
       <option name="MAIN_CLASS_NAME" />
@@ -541,6 +710,13 @@
         <option name="Make" value="true" />
       </method>
     </configuration>
+    <configuration default="true" type="Remote" factoryName="Remote">
+      <option name="USE_SOCKET_TRANSPORT" value="true" />
+      <option name="SERVER_MODE" value="false" />
+      <option name="SHMEM_ADDRESS" value="javadebug" />
+      <option name="HOST" value="localhost" />
+      <option name="PORT" value="5005" />
+    </configuration>
     <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
       <option name="MAIN_CLASS_NAME" />
       <option name="VM_PARAMETERS" />
@@ -554,24 +730,8 @@
         <option name="Make" value="true" />
       </method>
     </configuration>
-    <configuration default="false" name="client" type="Remote" factoryName="Remote">
-      <option name="USE_SOCKET_TRANSPORT" value="true" />
-      <option name="SERVER_MODE" value="false" />
-      <option name="SHMEM_ADDRESS" value="javadebug" />
-      <option name="HOST" value="localhost" />
-      <option name="PORT" value="5005" />
-      <RunnerSettings RunnerId="Debug">
-        <option name="DEBUG_PORT" value="5005" />
-        <option name="TRANSPORT" value="0" />
-        <option name="LOCAL" value="false" />
-      </RunnerSettings>
-      <ConfigurationWrapper RunnerId="Debug" />
-      <method>
-        <option name="Make" value="true" />
-      </method>
-    </configuration>
     <configuration default="false" name="SimulationMain" type="Application" factoryName="Application" enabled="false" merge="false">
-      <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.sim.SimulationMain" />
+      <option name="MAIN_CLASS_NAME" value="org.jboss.test.sam.simulation.SimulationMain" />
       <option name="VM_PARAMETERS" />
       <option name="PROGRAM_PARAMETERS" />
       <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
@@ -580,7 +740,7 @@
       <option name="ENABLE_SWING_INSPECTOR" value="false" />
       <module name="sam-trunk" />
       <RunnerSettings RunnerId="Debug">
-        <option name="DEBUG_PORT" value="53589" />
+        <option name="DEBUG_PORT" value="32888" />
         <option name="TRANSPORT" value="0" />
         <option name="LOCAL" value="true" />
       </RunnerSettings>
@@ -591,6 +751,22 @@
         <option name="Make" value="true" />
       </method>
     </configuration>
+    <configuration default="false" name="client" type="Remote" factoryName="Remote">
+      <option name="USE_SOCKET_TRANSPORT" value="true" />
+      <option name="SERVER_MODE" value="false" />
+      <option name="SHMEM_ADDRESS" value="javadebug" />
+      <option name="HOST" value="localhost" />
+      <option name="PORT" value="5005" />
+      <RunnerSettings RunnerId="Debug">
+        <option name="DEBUG_PORT" value="5005" />
+        <option name="TRANSPORT" value="0" />
+        <option name="LOCAL" value="false" />
+      </RunnerSettings>
+      <ConfigurationWrapper RunnerId="Debug" />
+      <method>
+        <option name="Make" value="true" />
+      </method>
+    </configuration>
     <configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
       <Host>localhost</Host>
       <Port>5050</Port>
@@ -678,8 +854,8 @@
       <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
       <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
       <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32915717" order="1" />
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39863327" order="3" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.55580866" order="1" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39749432" order="3" />
       <window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
       <window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
@@ -695,7 +871,7 @@
       <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27774373" 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.47038725" order="2" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4692483" order="2" />
       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="5" />
       <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="0" />
       <window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
@@ -725,7 +901,7 @@
     <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
     <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
     <option name="ERROR_OCCURED" value="false" />
-    <option name="ACTIVE_VCS_NAME" />
+    <option name="ACTIVE_VCS_NAME" value="" />
     <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
     <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
     <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
@@ -778,113 +954,110 @@
     <option name="myPlainMode" value="false" />
     <option name="myLastEditedConfigurable" value="Modules" />
   </component>
-  <component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="" version="1">
-    <option name="myLastEditedConfigurable" />
+  <component name="com.intellij.profile.ui.ErrorOptionsConfigurable" proportions="0.16666667" version="1">
+    <option name="myLastEditedConfigurable" value="IDE Profiles" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSourceEntity.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="34" column="13" selection-start="1418" selection-end="1418" vertical-scroll-proportion="0.1794569">
+        <state line="121" column="16" selection-start="4154" selection-end="4154" vertical-scroll-proportion="0.2545825">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SensorEventMessage.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/StreamOutputAdapter.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="26" column="13" selection-start="1133" selection-end="1133" vertical-scroll-proportion="0.13459268">
+        <state line="34" column="6" selection-start="1420" selection-end="1420" vertical-scroll-proportion="0.33197555">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pom.xml">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="26" column="65" selection-start="1109" selection-end="1109" vertical-scroll-proportion="-4.594952">
+        <state line="59" column="13" selection-start="2120" selection-end="2120" vertical-scroll-proportion="0.33293125">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventProcessorEntity.java">
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="37" column="13" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.022432113">
+        <state line="50" column="6" selection-start="1949" selection-end="1949" vertical-scroll-proportion="0.4571773">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/EventSink.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="38" column="13" selection-start="1528" selection-end="1528" vertical-scroll-proportion="0.022432113">
+        <state line="28" column="17" selection-start="1180" selection-end="1180" vertical-scroll-proportion="0.1794569">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartMapping.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="37" column="19" selection-start="1563" selection-end="1563" vertical-scroll-proportion="0.33293977">
+        <state line="34" column="0" selection-start="1360" selection-end="1360" vertical-scroll-proportion="0.32086852">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/chart/ChartServer.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="47" column="64" selection-start="1705" selection-end="1705" vertical-scroll-proportion="0.60566705">
+        <state line="32" column="0" selection-start="1309" selection-end="1309" vertical-scroll-proportion="0.27503017">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/sim/SimulationMain.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="30" column="13" selection-start="1274" selection-end="1274" vertical-scroll-proportion="0.044864226">
+        <state line="31" column="3" selection-start="1272" selection-end="1272" vertical-scroll-proportion="0.252111">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventProcessor.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSimulation.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="31" column="3" selection-start="1445" selection-end="1445" vertical-scroll-proportion="0.02291918">
-          <folding />
+        <state line="70" column="58" selection-start="2819" selection-end="2819" vertical-scroll-proportion="0.2026538">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperRuntimeImpl.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/Measurement.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="122" column="53" selection-start="4272" selection-end="4272" vertical-scroll-proportion="0.24366707">
+        <state line="27" column="37" selection-start="1160" selection-end="1160" vertical-scroll-proportion="0.16043426">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/internal/esper/EsperProcessingStatement.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/SimulationContext.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="32" column="0" selection-start="1333" selection-end="1333" vertical-scroll-proportion="0.27503017">
-          <folding>
-            <element signature="imports" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamInputCallback.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="28" column="17" selection-start="1218" selection-end="1218" vertical-scroll-proportion="0.18335344">
+        <state line="53" column="19" selection-start="1941" selection-end="1941" vertical-scroll-proportion="0.13027744">
           <folding />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/StreamOutput.java">
+    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="42" column="20" selection-start="1542" selection-end="1542" vertical-scroll-proportion="0.504222">
-          <folding />
+        <state line="119" column="45" selection-start="3754" selection-end="3754" vertical-scroll-proportion="0.15199035">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/EventMessage.java">
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="46" column="49" selection-start="1593" selection-end="1593" vertical-scroll-proportion="0.5958987">
-          <folding />
+        <state line="32" column="13" selection-start="1329" selection-end="1329" vertical-scroll-proportion="0.27503017">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/src/main/java/org/jboss/sam/ProcessingStatement.java">
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state line="31" column="17" selection-start="1394" selection-end="1394" vertical-scroll-proportion="0.252111">
+        <state line="52" column="70" selection-start="2013" selection-end="2013" vertical-scroll-proportion="0.60566705">
           <folding />
         </state>
       </provider>

Modified: sam/trunk/sam-trunk.iml
===================================================================
--- sam/trunk/sam-trunk.iml	2008-07-03 19:06:57 UTC (rev 110)
+++ sam/trunk/sam-trunk.iml	2008-07-03 20:09:31 UTC (rev 111)
@@ -92,43 +92,11 @@
         <SOURCES />
       </library>
     </orderEntry>
-    <orderEntry type="module-library">
-      <library name="M2 Dep: cglib:cglib-nodep:jar:2.1_3:compile">
-        <CLASSES>
-          <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: log4j:log4j:jar:1.2.14:compile">
-        <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../../.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar!/" />
-        </CLASSES>
-        <JAVADOC />
-        <SOURCES />
-      </library>
-    </orderEntry>
-    <orderEntry type="module-library">
-      <library name="M2 Dep: mysql:mysql-connector-java:jar:3.1.14:compile">
-        <CLASSES>
-          <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: commons-logging:commons-logging:jar:1.1.1:compile">
-        <CLASSES>
-          <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>
     <orderEntryProperties />
   </component>
+  <component name="VcsManagerConfiguration">
+    <option name="ACTIVE_VCS_NAME" value="svn" />
+    <option name="USE_PROJECT_VCS" value="false" />
+  </component>
 </module>
 

Modified: sam/trunk/src/main/java/org/jboss/sam/StreamInput.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/StreamInput.java	2008-07-03 19:06:57 UTC (rev 110)
+++ sam/trunk/src/main/java/org/jboss/sam/StreamInput.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -24,7 +24,7 @@
 /**
  * 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 process events.
+ * Typically the CEP runtime itself act's as such a listener in order to finished events.
  * 
  * @author Heiko.Braun <heiko.braun at jboss.com>
  */

Modified: sam/trunk/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java	2008-07-03 19:06:57 UTC (rev 110)
+++ sam/trunk/src/main/java/org/jboss/sam/internal/stream/InVMDispatcher.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -28,6 +28,8 @@
  */
 public class InVMDispatcher
 {
+   public final static String DEFAULT_CHANNEL_NAME = "InVM-Channel";
+   
    private InVMStreamRegistry channelRegistry;
 
    private String streamName;

Added: sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java	                        (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -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/src/main/java/org/jboss/sam/simulation/ContextAwareEntity.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java	                        (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -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/src/main/java/org/jboss/sam/simulation/EventMessageFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java	                        (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,217 @@
+/*
+ * 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 arjuna.JavaSim.Simulation.Scheduler;
+import arjuna.JavaSim.Simulation.SimulationProcess;
+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 java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.UUID;
+
+/**
+ * @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)
+   {
+      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;
+   }
+
+   public void bindStatement(String stmt, EventSinkEntity sink)
+   {
+      // bind the results to a stream output (EventSink)
+      this.eventProcessor.registerBoundStatement(
+        sink.getStreamName(), UUID.randomUUID().toString(), stmt
+      );
+   }
+
+   /**
+    * Execute a single run of this simulation
+    */
+   public void singleRun()
+   {
+      takeControl();
+   }
+   
+   public void begin()
+   {      
+      for(EventSinkEntity sink : eventSinks)
+      {
+         sink.begin();
+      }
+
+      for(EventSourceEntity source : eventSources)
+      {
+         source.begin();
+      }
+   }
+
+   public 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
+      {
+         // begin
+         begin();
+         Scheduler.startSimulation();
+
+         Double totalSimTime = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
+         double end = Scheduler.CurrentTime()+ totalSimTime;
+         while(Scheduler.CurrentTime()<end)
+            Hold(totalSimTime+1);
+
+         // cleanup
+         Scheduler.stopSimulation();
+         end();
+         
+         returnControl();
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         System.exit(-1);
+      }
+   }
+
+   /**
+    * Suspends the test class thread and gives
+    * control to the simulation
+    */
+   private void takeControl()
+   {
+      this.Resume();
+      SimulationProcess.mainSuspend();
+   }
+
+   /**
+    * Returns control to the test class thread
+    */
+   private void returnControl()
+   {
+      try
+      {
+         SimulationProcess.mainResume();
+         Suspend();
+      } catch (Exception e)
+      {
+         e.printStackTrace();
+         System.exit(-1);
+      }
+   }
+
+   public static EventSimulation createSimulation(Properties config, URL bootstrap)
+   {
+      return new EventSimulation(config, bootstrap);
+   }
+}


Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSimulation.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java	                        (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,124 @@
+/*
+ * 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;
+import org.jboss.sam.chart.Chart;
+import org.jfree.chart.JFreeChart;
+
+/**
+ * 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 static Chart<JFreeChart> currentChart = 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/src/main/java/org/jboss/sam/simulation/EventSinkEntity.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java	                        (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -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/src/main/java/org/jboss/sam/simulation/EventSinkHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java	                        (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,150 @@
+/*
+ * 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 arjuna.JavaSim.Simulation.RestartException;
+import arjuna.JavaSim.Simulation.SimulationException;
+import arjuna.JavaSim.Simulation.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:
+ * <ul>
+ *  <li>1.00: A single event per simulation
+ *  <li>0.01: An event per each simulation time sample
+ * </ul>
+ * 
+ * @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)
+   {
+      this.name = name;
+      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()
+   {
+      for (; ;)
+      {
+         try
+         {
+            double totalSim = (Double) context.getConfig(EventSimulation.TOTAL_SIM_TIME);
+            double holdTime = (totalSim / 100.00) * (100.00*eventRatio);
+            Hold(holdTime);
+         }
+         catch (SimulationException e)
+         {
+         }
+         catch (RestartException e)
+         {
+         }
+
+         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);
+
+      }
+   }
+
+   public void begin()
+   {
+      try
+      {
+         super.Activate();
+      } catch (SimulationException e)
+      {
+         e.printStackTrace();
+
+      } catch (RestartException e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   public void end()
+   {
+      super.terminate();      
+   }
+
+
+}


Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/EventSourceEntity.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java	                        (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -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.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;
+   }
+}


Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/Measurement.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java
===================================================================
--- sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java	                        (rev 0)
+++ sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -0,0 +1,87 @@
+/*
+ * 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 arjuna.JavaSim.Simulation.Scheduler;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * 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();
+   }
+}


Property changes on: sam/trunk/src/main/java/org/jboss/sam/simulation/SimulationContext.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java	                        (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -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/src/test/java/org/jboss/test/sam/simulation/ChartGenerationHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java	                        (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -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 threshold, double simTime)
+   {
+      this.source = source;
+      this.surveyValue = threshold;
+      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/src/test/java/org/jboss/test/sam/simulation/SensorEventMessage.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java	                        (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -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 arjuna.JavaSim.Distributions.ExponentialStream;
+import org.jboss.sam.simulation.EventMessageFactory;
+import org.jboss.sam.simulation.SimulationContext;
+
+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/src/test/java/org/jboss/test/sam/simulation/SensorMessageFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
===================================================================
--- sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java	                        (rev 0)
+++ sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java	2008-07-03 20:09:31 UTC (rev 111)
@@ -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.test.sam.simulation;
+
+import org.jboss.sam.chart.Chart;
+import org.jboss.sam.simulation.*;
+import org.jboss.test.sam.JFreeChartViewer;
+import org.jfree.chart.JFreeChart;
+
+import java.util.Properties;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class SimulationMain
+{
+   public static void main(String[] args)
+   {
+      // config
+      Properties config = new Properties();
+      config.put(EventSimulation.TOTAL_SIM_TIME, 60.00);
+
+      // init
+      EventSimulation simulation = EventSimulation.createSimulation (
+        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 SensorMessageFactory() );
+
+      // create an event sink
+      EventSinkEntity sink = new EventSinkEntity("sensor-events-viz");
+      sink.setEventHandler( new ChartGenerationHandler() );
+
+      simulation.addSource(source);
+      simulation.addSink(sink);
+
+      // bind statements to test
+      simulation.bindStatement("select * from SensorEventMessage.win:length_batch(10)", sink);
+  
+      // start simulation
+      simulation.singleRun();
+
+      // context results
+      double dispatched = context.getMeasurement("numDispatched").getCurrent();
+      double processed = context.getMeasurement("numProcessed").getCurrent();
+      double unmatched = context.getMeasurement(EventSimulation.NUM_UNMATCHED_EVENTS).getCurrent();
+
+      System.out.println("Dispatched: " +dispatched);
+      System.out.println("Processed: " +processed);
+      System.out.println("Unmatched: " +unmatched);
+
+      // chart generation handler results 
+      if(context.getAttachment(Chart.class)!=null)
+      {
+         Chart<JFreeChart> chart = context.getAttachment(Chart.class);
+         new JFreeChartViewer().setChart(chart.getUnderlying()).display();
+      }
+      else
+      {
+         System.out.println("* No chart rendered *");
+         System.exit(0);
+      }
+
+
+   }
+}


Property changes on: sam/trunk/src/test/java/org/jboss/test/sam/simulation/SimulationMain.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: sam/trunk/src/test/resources/simulation/esper-cfg.xml
===================================================================
--- sam/trunk/src/test/resources/simulation/esper-cfg.xml	                        (rev 0)
+++ sam/trunk/src/test/resources/simulation/esper-cfg.xml	2008-07-03 20:09:31 UTC (rev 111)
@@ -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/src/test/resources/simulation/esper-cfg.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the overlord-commits mailing list