added basic JAX-RS, Jersey and Grizzly HTTP server support
This commit is contained in:
parent
cee06a2230
commit
7133c42c00
12 changed files with 597 additions and 191 deletions
249
akka.iws
249
akka.iws
|
|
@ -1,11 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project relativePaths="false" version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" readonly="true" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
|
||||
<list default="true" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/Configuration.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/Configuration.scala" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/kernel/src/test/scala/restManagerSpec.scala" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api-java/pom.xml" afterPath="$PROJECT_DIR$/api-java/pom.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/test/scala/ActiveObjectSuite.scala" afterPath="$PROJECT_DIR$/kernel/src/test/scala/ActiveObjectSuite.scala" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/src/main/scala/ActiveObject.scala" afterPath="$PROJECT_DIR$/kernel/src/main/scala/ActiveObject.scala" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/api-java/src/main/java/com/scalablesolutions/akka/api/ActiveObjectGuiceConfigurator.java" afterPath="$PROJECT_DIR$/api-java/src/main/java/com/scalablesolutions/akka/api/ActiveObjectGuiceConfigurator.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/kernel.iml" afterPath="$PROJECT_DIR$/kernel/kernel.iml" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/kernel/src/main/scala/Logging.scala" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/kernel/pom.xml" afterPath="$PROJECT_DIR$/kernel/pom.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/akka.iws" afterPath="$PROJECT_DIR$/akka.iws" />
|
||||
</list>
|
||||
<ignored path=".idea/workspace.xml" />
|
||||
<ignored path="akka.iws" />
|
||||
<ignored path=".idea/workspace.xml" />
|
||||
</component>
|
||||
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
||||
<component name="Commander">
|
||||
|
|
@ -64,28 +75,35 @@
|
|||
<file leaf-file-name="ActiveObject.scala" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/ActiveObject.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="24" column="47" selection-start="876" selection-end="876" vertical-scroll-proportion="0.0">
|
||||
<state line="2" column="9" selection-start="49" selection-end="49" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="SupervisorConfig.class" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="jar://$MAVEN_REPOSITORY$/org/scala-libs/scala-otp-behavior/0.1-SNAPSHOT/scala-otp-behavior-0.1-SNAPSHOT.jar!/scala/actors/behavior/SupervisorConfig.class">
|
||||
<file leaf-file-name="Kernel.scala" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="11" selection-start="41" selection-end="41" vertical-scroll-proportion="0.0">
|
||||
<state line="51" column="0" selection-start="1624" selection-end="1624" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="ActiveObjectGuiceConfigurator.java" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/api-java/src/main/java/com/scalablesolutions/akka/api/ActiveObjectGuiceConfigurator.java">
|
||||
<file leaf-file-name="Logging.scala" pinned="false" current="true" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Logging.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="29" column="49" selection-start="1037" selection-end="1058" vertical-scroll-proportion="-12.96">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
<state line="19" column="0" selection-start="411" selection-end="411" vertical-scroll-proportion="0.219865">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="restManagerSpec.scala" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/test/scala/restManagerSpec.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="4" column="8" selection-start="59" selection-end="92" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
|
@ -93,27 +111,16 @@
|
|||
<file leaf-file-name="ActiveObjectSuite.scala" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/test/scala/ActiveObjectSuite.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="138" column="0" selection-start="1036" selection-end="3797" vertical-scroll-proportion="0.0">
|
||||
<state line="5" column="0" selection-start="0" selection-end="93" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="ActiveObjectGuiceConfiguratorTest.java" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/api-java/src/test/java/com/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java">
|
||||
<file leaf-file-name="pom.xml" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/kernel/pom.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="39" column="35" selection-start="1115" selection-end="1115" vertical-scroll-proportion="0.0">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name=".gitignore" pinned="false" current="true" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="14" column="0" selection-start="100" selection-end="100" vertical-scroll-proportion="0.17142858">
|
||||
<state line="56" column="4" selection-start="1771" selection-end="1771" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
|
@ -209,6 +216,14 @@
|
|||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="main" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="scala" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
|
|
@ -220,6 +235,20 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="akka" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="api-java" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="api-java" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="akka" />
|
||||
|
|
@ -280,7 +309,25 @@
|
|||
<property name="options.searchVisible" value="true" />
|
||||
<property name="options.splitter.details.proportions" value="0.2" />
|
||||
</component>
|
||||
<component name="RunManager" selected="JUnit.ActiveObjectGuiceConfiguratorTest">
|
||||
<component name="RunManager" selected="Application.Kernel">
|
||||
<tempConfiguration default="false" name="Kernel" type="Application" factoryName="Application" enabled="false" merge="false" runner="emma">
|
||||
<option name="MAIN_CLASS_NAME" value="com.scalablesolutions.akka.kernel.Kernel" />
|
||||
<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" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="kernel" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method>
|
||||
<option name="Make" value="true" />
|
||||
</method>
|
||||
</tempConfiguration>
|
||||
<configuration default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
|
|
@ -288,7 +335,7 @@
|
|||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="5005" />
|
||||
</configuration>
|
||||
<configuration default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false">
|
||||
<configuration default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false" runner="emma">
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
|
|
@ -382,8 +429,27 @@
|
|||
<option name="Make" value="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="JUnit.GuiceConfigurationTest" />
|
||||
<configuration default="false" name="Kernel" type="Application" factoryName="Application" enabled="false" merge="false" runner="emma">
|
||||
<option name="MAIN_CLASS_NAME" value="com.scalablesolutions.akka.kernel.Kernel" />
|
||||
<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" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="kernel" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method>
|
||||
<option name="Make" value="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<list size="2">
|
||||
<item index="0" class="java.lang.String" itemvalue="JUnit.ActiveObjectGuiceConfiguratorTest" />
|
||||
<item index="1" class="java.lang.String" itemvalue="Application.RESTManager" />
|
||||
</list>
|
||||
<configuration name="<template>" type="WebApp" default="true" selected="false">
|
||||
<Host>localhost</Host>
|
||||
|
|
@ -429,33 +495,33 @@
|
|||
</todo-panel>
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="13" width="1523" height="1156" extended-state="0" />
|
||||
<frame x="0" y="21" width="1080" height="1179" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32902583" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" />
|
||||
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32902583" sideWeight="0.5" order="7" side_tool="false" />
|
||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32902583" sideWeight="0.5" order="1" side_tool="false" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32894737" sideWeight="0.5" order="1" side_tool="false" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" />
|
||||
<window_info id="Dataflow to this" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="FindBugs-IDEA" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32902583" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32902583" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Dataflow to this" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" />
|
||||
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" />
|
||||
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" />
|
||||
<window_info id="FindBugs-IDEA" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298872" sideWeight="0.5" order="7" side_tool="false" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32902583" sideWeight="0.5" order="7" side_tool="false" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.75475687" sideWeight="0.5" order="7" side_tool="false" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32902583" sideWeight="0.5" order="6" side_tool="false" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" />
|
||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.23945579" sideWeight="0.6640159" order="0" side_tool="false" />
|
||||
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Web Preview" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24965987" sideWeight="0.5" order="2" side_tool="false" />
|
||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.19787645" sideWeight="0.44496706" order="0" side_tool="false" />
|
||||
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" />
|
||||
<window_info id="Web Preview" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24965987" sideWeight="0.5" order="2" side_tool="false" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
|
|
@ -491,9 +557,23 @@
|
|||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="14" column="0" selection-start="100" selection-end="100" vertical-scroll-proportion="0.17142858">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/api-java/pom.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="26" column="0" selection-start="786" selection-end="786" vertical-scroll-proportion="0.0">
|
||||
<state line="50" column="0" selection-start="1448" selection-end="1732" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://$MAVEN_REPOSITORY$/org/scala-libs/scala-otp-behavior/0.1-SNAPSHOT/scala-otp-behavior-0.1-SNAPSHOT.jar!/scala/actors/behavior/RestartStrategy.class">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
|
@ -507,67 +587,86 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Configuration.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="89" column="11" selection-start="3465" selection-end="3465" vertical-scroll-proportion="0.0">
|
||||
<state line="4" column="0" selection-start="51" selection-end="106" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/ErrRef.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="48" column="6" selection-start="1092" selection-end="1092" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/pom.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="0" column="18" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||
<state line="10" column="14" selection-start="412" selection-end="412" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/kernel/pom.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="76" column="41" selection-start="2321" selection-end="2321" vertical-scroll-proportion="0.93061227">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://$MAVEN_REPOSITORY$/org/scala-libs/scala-otp-behavior/0.1-SNAPSHOT/scala-otp-behavior-0.1-SNAPSHOT.jar!/scala/actors/behavior/SupervisorConfig.class">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="1" column="11" selection-start="41" selection-end="41" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/test/scala/ActiveObjectSuite.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="138" column="0" selection-start="1036" selection-end="3797" vertical-scroll-proportion="0.0">
|
||||
<state line="56" column="4" selection-start="1771" selection-end="1771" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/ActiveObject.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="24" column="47" selection-start="876" selection-end="876" vertical-scroll-proportion="0.0">
|
||||
<state line="2" column="9" selection-start="49" selection-end="49" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/api-java/src/test/java/com/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="2" column="51" selection-start="49" selection-end="49" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/api-java/src/main/java/com/scalablesolutions/akka/api/ActiveObjectGuiceConfigurator.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="29" column="49" selection-start="1037" selection-end="1058" vertical-scroll-proportion="-12.96">
|
||||
<state line="1" column="1" selection-start="40" selection-end="40" vertical-scroll-proportion="0.0">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/api-java/src/test/java/com/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java">
|
||||
<entry file="jar://$MAVEN_REPOSITORY$/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0.jar!/javax/ws/rs/core/UriBuilder.class">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="39" column="35" selection-start="1115" selection-end="1115" vertical-scroll-proportion="0.0">
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
<state line="54" column="59" selection-start="3092" selection-end="3092" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/test/scala/restManagerSpec.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="14" column="0" selection-start="100" selection-end="100" vertical-scroll-proportion="0.17142858">
|
||||
<state line="4" column="8" selection-start="59" selection-end="92" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/test/scala/ActiveObjectSuite.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="5" column="0" selection-start="0" selection-end="93" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Kernel.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="51" column="0" selection-start="1624" selection-end="1624" vertical-scroll-proportion="0.0">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/kernel/src/main/scala/Logging.scala">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="19" column="0" selection-start="411" selection-end="411" vertical-scroll-proportion="0.219865">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
|
|
|||
|
|
@ -55,9 +55,6 @@
|
|||
<excludes>
|
||||
<exclude>**/Abstract*</exclude>
|
||||
</excludes>
|
||||
<!--<suiteXmlFiles>-->
|
||||
<!--<suiteXmlFile>testng.xml</suiteXmlFile>-->
|
||||
<!--</suiteXmlFiles>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.scalablesolutions.akka.api;
|
||||
|
||||
import com.scalablesolutions.akka.kernel.configuration.*;
|
||||
|
||||
import com.google.inject.*;
|
||||
import com.google.inject.jsr250.ResourceProviderFactory;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,150 @@
|
|||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-json/1.0.1/jersey-json-1.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-server/1.0.1/jersey-server-1.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-atom/1.0.1/jersey-atom-1.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/jersey/jersey-core/1.0.1/jersey-core-1.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/xml/bind/jaxb-impl/2.1/jaxb-impl-2.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/grizzly/grizzly-framework/1.8.6.3/grizzly-framework-1.8.6.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/grizzly/grizzly-http/1.8.6.3/grizzly-http-1.8.6.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/grizzly/grizzly-servlet-webserver/1.8.6.3/grizzly-servlet-webserver-1.8.6.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/grizzly/grizzly-rcm/1.8.6.3/grizzly-rcm-1.8.6.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/grizzly/grizzly-portunif/1.8.6.3/grizzly-portunif-1.8.6.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/grizzly/grizzly-http-utils/1.8.6.3/grizzly-http-utils-1.8.6.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/sun/grizzly/grizzly-http-servlet/1.8.6.3/grizzly-http-servlet-1.8.6.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/lag/configgy/1.2/configgy-1.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,26 @@
|
|||
<artifactId>guice-jsr250</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.grizzly</groupId>
|
||||
<artifactId>grizzly-servlet-webserver</artifactId>
|
||||
<version>1.8.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-server</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-json</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-atom</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.specs</groupId>
|
||||
<artifactId>specs</artifactId>
|
||||
|
|
@ -113,6 +133,15 @@
|
|||
</classpathContainers>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/Abstract*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
|
|
@ -123,7 +152,7 @@
|
|||
<format>html</format>
|
||||
</formats>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,13 @@ object ActiveObject {
|
|||
proxy).asInstanceOf[T]
|
||||
}
|
||||
|
||||
def newInstance[T](intf: Class[_], target: AnyRef, timeout: Int): T = {
|
||||
val proxy = new ActiveObjectProxy(intf, target.getClass, timeout)
|
||||
proxy.setTargetInstance(target)
|
||||
supervise(proxy)
|
||||
newInstance(intf, proxy)
|
||||
}
|
||||
|
||||
def supervise(restartStrategy: RestartStrategy, components: List[Worker]): Supervisor = {
|
||||
object factory extends SupervisorFactory {
|
||||
override def getSupervisorConfig = SupervisorConfig(restartStrategy, components)
|
||||
|
|
@ -44,6 +51,14 @@ object ActiveObject {
|
|||
supervisor ! scala.actors.behavior.Start
|
||||
supervisor
|
||||
}
|
||||
|
||||
private def supervise(proxy: ActiveObjectProxy): Supervisor =
|
||||
supervise(
|
||||
RestartStrategy(OneForOne, 5, 1000),
|
||||
Worker(
|
||||
proxy.server,
|
||||
LifeCycle(Permanent, 100))
|
||||
:: Nil)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,10 +73,16 @@ class ActiveObjectProxy(val intf: Class[_], val target: Class[_], val timeout: I
|
|||
override def body: PartialFunction[Any, Unit] = {
|
||||
case invocation: Invocation =>
|
||||
try {
|
||||
println("==========> " + invocation)
|
||||
reply(ErrRef(invocation.invoke))
|
||||
} catch {
|
||||
case e: InvocationTargetException => reply(ErrRef({ throw e.getTargetException }))
|
||||
case e => reply(ErrRef({ throw e }))
|
||||
case e: InvocationTargetException =>
|
||||
val te = e.getTargetException
|
||||
te.printStackTrace
|
||||
reply(ErrRef({ throw te }))
|
||||
case e =>
|
||||
e.printStackTrace
|
||||
reply(ErrRef({ throw e }))
|
||||
}
|
||||
case 'exit => exit; reply()
|
||||
case unexpected => throw new ActiveObjectException("Unexpected message to actor proxy: " + unexpected)
|
||||
|
|
@ -89,10 +110,10 @@ class ActiveObjectProxy(val intf: Class[_], val target: Class[_], val timeout: I
|
|||
*/
|
||||
case class Invocation(val method: Method, val args: Array[Object], val target: AnyRef) {
|
||||
method.setAccessible(true);
|
||||
|
||||
def invoke: AnyRef = method.invoke(target, args: _*)
|
||||
|
||||
override def toString: String = "Invocation[method: " + method.getName + ", args: " + args + ", target: " + target + "]"
|
||||
def invoke: AnyRef = method.invoke(target, args:_*)
|
||||
|
||||
override def toString: String = "Invocation [method: " + method.getName + ", args: " + argsToString(args) + ", target: " + target + "]"
|
||||
|
||||
override def hashCode(): Int = {
|
||||
var result = HashCode.SEED
|
||||
|
|
@ -106,8 +127,13 @@ case class Invocation(val method: Method, val args: Array[Object], val target: A
|
|||
that != null &&
|
||||
that.isInstanceOf[Invocation] &&
|
||||
that.asInstanceOf[Invocation].method == method &&
|
||||
that.asInstanceOf[Invocation].args == args
|
||||
that.asInstanceOf[Invocation].target == target
|
||||
that.asInstanceOf[Invocation].target == target &&
|
||||
isEqual(that.asInstanceOf[Invocation].args, args)
|
||||
}
|
||||
}
|
||||
|
||||
private def isEqual(a1: Array[Object], a2: Array[Object]): Boolean =
|
||||
(a1 == null && a2 == null) ||
|
||||
(a1 != null && a2 != null && a1.size == a2.size && a1.zip(a2).find(t => t._1 == t._2).isDefined)
|
||||
|
||||
private def argsToString(array: Array[Object]): String = array.foldLeft("(")(_ + " " + _) + ")"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright (C) 2009 Scalable Solutions.
|
||||
*/
|
||||
|
||||
package com.scalablesolutions.akka.api
|
||||
package com.scalablesolutions.akka.kernel.configuration
|
||||
|
||||
import com.scalablesolutions.akka.kernel.{ActiveObject, ActiveObjectProxy}
|
||||
import google.inject.{AbstractModule}
|
||||
|
|
@ -52,54 +52,8 @@ abstract class Server extends Configuration
|
|||
// def transform = scala.actors.behavior.SupervisorConfig(restartStrategy.transform, servers.toArray.toList.asInstanceOf[List[Server]].map(_.transform))
|
||||
//}
|
||||
class Component(@BeanProperty val intf: Class[_],
|
||||
@BeanProperty val target: Class[_],
|
||||
@BeanProperty val lifeCycle: LifeCycle,
|
||||
@BeanProperty val timeout: Int) extends Server {
|
||||
@BeanProperty val target: Class[_],
|
||||
@BeanProperty val lifeCycle: LifeCycle,
|
||||
@BeanProperty val timeout: Int) extends Server {
|
||||
def newWorker(proxy: ActiveObjectProxy) = scala.actors.behavior.Worker(proxy.server, lifeCycle.transform)
|
||||
}
|
||||
|
||||
|
||||
// ============================================
|
||||
|
||||
/**
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
//object Configuration {
|
||||
// import com.google.inject.{Module, AbstractModule, CreationException, Guice, Injector, Provides, Singleton, Binder}
|
||||
// import com.google.inject.jsr250.{ResourceProviderFactory}
|
||||
//
|
||||
// private val modules = new ArrayList[Module]
|
||||
//
|
||||
// def addModule(module: Module) = modules.add(module)
|
||||
//
|
||||
// def supervise(restartStrategy: RestartStrategy, components: Array[Component]): Supervisor = {
|
||||
// val componentList = components.toList.asInstanceOf[List[Component]]
|
||||
//
|
||||
// object defaultModule extends AbstractModule {
|
||||
// protected def configure {
|
||||
// bind(classOf[ResourceProviderFactory[_]])
|
||||
// //componentList.foreach(c => bind(c.proxy.intf.asInstanceOf[Class[_]]).to(c.proxy.target.getClass.asInstanceOf[Class[_]]).in(classOf[Singleton]))
|
||||
// }
|
||||
//
|
||||
// // @Provides
|
||||
// // def createJndiContext: Context = {
|
||||
// // val answer = new JndiContext
|
||||
// // answer.bind("foo", new AnotherBean("Foo"))
|
||||
// // answer.bind("xyz", new AnotherBean("XYZ"))
|
||||
// // answer
|
||||
// // }
|
||||
// }
|
||||
// modules.add(defaultModule)
|
||||
// val injector = Guice.createInjector(modules)
|
||||
//
|
||||
// // swap 'target' in proxy before running supervise
|
||||
// // componentList.foreach(c => c.proxy.target = injector.getInstance(c.proxy.targetClass))
|
||||
//
|
||||
// ActiveObject.supervise(
|
||||
// restartStrategy.transform,
|
||||
// componentList.map(c => scala.actors.behavior.Worker(c.proxy.server, c.lifeCycle.transform)))
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,52 @@
|
|||
/**
|
||||
* Copyright (C) 2009 Scalable Solutions.
|
||||
*/
|
||||
|
||||
package com.scalablesolutions.akka.kernel
|
||||
|
||||
object Kernel {
|
||||
}
|
||||
/**
|
||||
* Copyright (C) 2009 Scalable Solutions.
|
||||
*/
|
||||
|
||||
package com.scalablesolutions.akka.kernel
|
||||
|
||||
import com.sun.grizzly.http.SelectorThread
|
||||
import com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory
|
||||
import java.io.IOException
|
||||
import java.net.URI
|
||||
import java.util.{Map, HashMap}
|
||||
import javax.ws.rs.core.UriBuilder
|
||||
import javax.ws.rs.{Produces, Path, GET}
|
||||
|
||||
object Kernel extends Logging {
|
||||
|
||||
val SERVER_URL = "http://localhost/"
|
||||
val SERVER_PORT = 9998
|
||||
val BASE_URI = UriBuilder.fromUri(SERVER_URL).port(getPort(SERVER_PORT)).build()
|
||||
|
||||
def getPort(defaultPort: Int) = {
|
||||
val port = System.getenv("JERSEY_HTTP_PORT")
|
||||
if (null != port) Integer.parseInt(port)
|
||||
else defaultPort;
|
||||
}
|
||||
|
||||
// @GET
|
||||
// @Produces("application/json")
|
||||
// @Path("/network/{id: [0-9]+}/{nid}")
|
||||
// def getUserByNetworkId(@PathParam {val value = "id"} id: Int, @PathParam {val value = "nid"} networkId: String): User = {
|
||||
// val q = em.createQuery("SELECT u FROM User u WHERE u.networkId = :id AND u.networkUserId = :nid")
|
||||
// q.setParameter("id", id)
|
||||
// q.setParameter("nid", networkId)
|
||||
// q.getSingleResult.asInstanceOf[User]
|
||||
// }
|
||||
|
||||
def startServer: SelectorThread = {
|
||||
val initParams = new java.util.HashMap[String, String]
|
||||
initParams.put(
|
||||
"com.sun.jersey.config.property.packages",
|
||||
"com.scalablesolutions.akka.kernel")
|
||||
log.info("Starting grizzly...")
|
||||
GrizzlyWebContainerFactory.create(BASE_URI, initParams)
|
||||
}
|
||||
|
||||
def main(args: Array[String]) {
|
||||
val threadSelector = startServer
|
||||
log.info("Akka kernel started at s%", BASE_URI)
|
||||
System.in.read
|
||||
threadSelector.stopEndpoint
|
||||
}
|
||||
}
|
||||
|
|
|
|||
68
kernel/src/main/scala/Logging.scala
Executable file
68
kernel/src/main/scala/Logging.scala
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* Copyright (C) 2009 Scalable Solutions.
|
||||
*/
|
||||
|
||||
package com.scalablesolutions.akka.kernel
|
||||
|
||||
import net.lag.configgy.Config
|
||||
import net.lag.logging.Logger
|
||||
|
||||
import java.util.Date
|
||||
import java.io.StringWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* Base trait for all classes that wants to be able use the logging infrastructure.
|
||||
*/
|
||||
trait Logging {
|
||||
@transient val log = Logger.get(this.getClass.getName)
|
||||
}
|
||||
|
||||
/**
|
||||
* LoggableException is a subclass of Exception and can be used as the base exception
|
||||
* for application specific exceptions.
|
||||
* <p/>
|
||||
* It keeps track of the exception is logged or not and also stores the unique id,
|
||||
* so that it can be carried all along to the client tier and displayed to the end user.
|
||||
* The end user can call up the customer support using this number.
|
||||
*/
|
||||
class LoggableException extends Exception with Logging {
|
||||
private val uniqueId = getExceptionID
|
||||
private var originalException: Option[Exception] = None
|
||||
private var isLogged = false
|
||||
|
||||
def this(baseException: Exception) = {
|
||||
this()
|
||||
originalException = Some(baseException)
|
||||
}
|
||||
|
||||
def logException = synchronized {
|
||||
if (!isLogged) {
|
||||
originalException match {
|
||||
case Some(e) => log.error("Logged Exception [%s] %s", uniqueId, getStackTrace(e))
|
||||
case None => log.error("Logged Exception [%s] %s", uniqueId, getStackTrace(this))
|
||||
}
|
||||
isLogged = true
|
||||
}
|
||||
}
|
||||
|
||||
def getExceptionID: String = {
|
||||
val hostname: String = try {
|
||||
InetAddress.getLocalHost.getHostName
|
||||
} catch {
|
||||
case e: UnknownHostException =>
|
||||
log.error("Could not get hostname to generate loggable exception")
|
||||
"N/A"
|
||||
}
|
||||
hostname + "_" + System.currentTimeMillis
|
||||
}
|
||||
|
||||
def getStackTrace(exception: Throwable): String = {
|
||||
val sw = new StringWriter
|
||||
val pw = new PrintWriter(sw)
|
||||
exception.printStackTrace(pw)
|
||||
sw.toString
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package com.scalablesolutions.akka.kernel
|
||||
|
||||
import org.specs.runner.JUnit4
|
||||
import org.specs.Specification
|
||||
import scala.actors.behavior._
|
||||
import scala.actors.annotation.oneway
|
||||
|
||||
|
|
@ -11,57 +13,55 @@ import scala.actors.annotation.oneway
|
|||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
|
||||
class activeObjectSpecTest extends JUnit4(activeObjectSpec) // for JUnit4 and Maven
|
||||
object activeObjectSpec extends Specification {
|
||||
|
||||
// class ActiveObjectSuite extends TestNGSuite {
|
||||
private var messageLog = ""
|
||||
|
||||
// private var messageLog = ""
|
||||
trait Foo {
|
||||
def foo(msg: String): String
|
||||
@oneway def bar(msg: String)
|
||||
def longRunning
|
||||
def throwsException
|
||||
}
|
||||
|
||||
// trait Foo {
|
||||
// def foo(msg: String): String
|
||||
// @oneway def bar(msg: String)
|
||||
// def longRunning
|
||||
// def throwsException
|
||||
// }
|
||||
class FooImpl extends Foo {
|
||||
val bar: Bar = new BarImpl
|
||||
def foo(msg: String): String = {
|
||||
messageLog += msg
|
||||
"return_foo "
|
||||
}
|
||||
def bar(msg: String) = bar.bar(msg)
|
||||
def longRunning = Thread.sleep(10000)
|
||||
def throwsException = error("expected")
|
||||
}
|
||||
|
||||
// class FooImpl extends Foo {
|
||||
// val bar: Bar = new BarImpl
|
||||
// def foo(msg: String): String = {
|
||||
// messageLog += msg
|
||||
// "return_foo "
|
||||
// }
|
||||
// def bar(msg: String) = bar.bar(msg)
|
||||
// def longRunning = Thread.sleep(10000)
|
||||
// def throwsException = error("expected")
|
||||
// }
|
||||
trait Bar {
|
||||
@oneway def bar(msg: String)
|
||||
}
|
||||
|
||||
// trait Bar {
|
||||
// @oneway def bar(msg: String)
|
||||
// }
|
||||
class BarImpl extends Bar {
|
||||
def bar(msg: String) = {
|
||||
Thread.sleep(100)
|
||||
messageLog += msg
|
||||
}
|
||||
}
|
||||
|
||||
// class BarImpl extends Bar {
|
||||
// def bar(msg: String) = {
|
||||
// Thread.sleep(100)
|
||||
// messageLog += msg
|
||||
// }
|
||||
// }
|
||||
// "make sure default supervisor works correctly" in {
|
||||
// val foo = ActiveObject.newInstance[Foo](classOf[Foo], classOf[FooImpl], 1000)
|
||||
//
|
||||
// val result = foo.foo("foo ")
|
||||
// messageLog += result
|
||||
//
|
||||
// foo.bar("bar ")
|
||||
// messageLog += "before_bar "
|
||||
//
|
||||
// Thread.sleep(500)
|
||||
// messageLog must equalIgnoreCase("foo return_foo before_bar bar ")
|
||||
// }
|
||||
|
||||
// @BeforeMethod
|
||||
// def setup = messageLog = ""
|
||||
|
||||
// @Test { val groups=Array("unit") }
|
||||
// def testCreateGenericServerBasedComponentUsingDefaultSupervisor = {
|
||||
// val foo = ActiveObject.newInstance[Foo](classOf[Foo], new FooImpl, 1000)
|
||||
|
||||
// val result = foo.foo("foo ")
|
||||
// messageLog += result
|
||||
|
||||
// foo.bar("bar ")
|
||||
// messageLog += "before_bar "
|
||||
|
||||
// Thread.sleep(500)
|
||||
// assert(messageLog === "foo return_foo before_bar bar ")
|
||||
// }
|
||||
|
||||
}
|
||||
// @Test { val groups=Array("unit") }
|
||||
// def testCreateGenericServerBasedComponentUsingCustomSupervisorConfiguration = {
|
||||
// val proxy = new ActiveObjectProxy(new FooImpl, 1000)
|
||||
|
|
@ -137,3 +137,6 @@ import scala.actors.annotation.oneway
|
|||
// assert(true === true)
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
31
kernel/src/test/scala/restManagerSpec.scala
Executable file
31
kernel/src/test/scala/restManagerSpec.scala
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* Copyright (C) 2009 Scalable Solutions.
|
||||
*/
|
||||
|
||||
package com.scalablesolutions.akka.kernel
|
||||
|
||||
import org.specs.runner.JUnit4
|
||||
import org.specs.Specification
|
||||
import javax.ws.rs.{Produces, Path, GET}
|
||||
|
||||
/**
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
|
||||
@Path("/helloworld")
|
||||
class HelloWorldResource {
|
||||
@GET
|
||||
@Produces(Array("text/plain"))
|
||||
def getClichedMessage = "Hello World"
|
||||
}
|
||||
|
||||
class restManagerSpecTest extends JUnit4(restManagerSpec) // for JUnit4 and Maven
|
||||
object restManagerSpec extends Specification {
|
||||
|
||||
"test" in {
|
||||
val threadSelector = Kernel.startServer
|
||||
val reply = System.in.read
|
||||
println("==============> " + reply)
|
||||
threadSelector.stopEndpoint
|
||||
}
|
||||
}
|
||||
15
pom.xml
15
pom.xml
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
<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>Akka Actor Kernel</name>
|
||||
|
|
@ -44,6 +43,16 @@
|
|||
<name>Configgy's' Repository</name>
|
||||
<url>http://www.lag.net/repo</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>maven2-repository.dev.java.net</id>
|
||||
<name>Java.net Repository for Maven</name>
|
||||
<url>http://download.java.net/maven/2</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>java.net</id>
|
||||
<url>http://download.java.net/maven/1</url>
|
||||
<layout>legacy</layout>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
|
|
@ -51,7 +60,7 @@
|
|||
<id>scala-tools.org</id>
|
||||
<name>Scala-Tools Maven2 Repository</name>
|
||||
<url>http://scala-tools.org/repo-releases</url>
|
||||
</pluginRepository>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue