You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by sc...@apache.org on 2009/02/27 17:37:19 UTC
svn commit: r748580 [1/5] - in /incubator/etch/branches/router: ./
services/router/ services/router/scripts/ services/router/src/main/etch/
services/router/src/main/java/cisco/ services/router/src/main/java/org/
services/router/src/main/java/org/apache...
Author: sccomer
Date: Fri Feb 27 16:37:17 2009
New Revision: 748580
URL: http://svn.apache.org/viewvc?rev=748580&view=rev
Log:
- namespace change for etch-router java code
- updated the junit code for the router-home dir change
Added:
incubator/etch/branches/router/services/router/scripts/
incubator/etch/branches/router/services/router/scripts/Compile Router Etch Files Lnx.launch
incubator/etch/branches/router/services/router/scripts/Compile Router Etch Files Win.launch
incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bash (with props)
incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bat (with props)
incubator/etch/branches/router/services/router/src/main/java/org/
incubator/etch/branches/router/services/router/src/main/java/org/apache/
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationConnectionInfo.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationInstallInfo.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ConnectionStackInfo.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/DynamicValueFactory.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemote.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteClient.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteServer.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStub.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStubHelper.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMain.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterManager.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterManagerHelper.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMessageFilter.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMgrTransportFactory.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ImplBase.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ImplClient.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ImplServer.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/PluginInstallInfo.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/FailoverPluginGroup.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/PluginGroup.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/PluginMember.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/PluginMemberConnection.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/PluginStateMonitor.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/RoundRobinPluginGroup.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/ApplicationAttributes.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/AttributesBase.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalEnumImportExportHelper.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalStructImportExportHelper.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalTypeImportExportHelper.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/PluginAttributes.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/StructValueImportExportHelper.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/UniqueKeyGenerator.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingData.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingDataParser.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Exception.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Field.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Module.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/NewDataSet.java (with props)
incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/ObjectFactory.java (with props)
incubator/etch/branches/router/services/router/src/test/java/org/
incubator/etch/branches/router/services/router/src/test/java/org/apache/
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/TestEtchRouter.java (with props)
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/plugin/
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/plugin/ImplTestPluginServer.java (with props)
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/utils/
incubator/etch/branches/router/services/router/src/test/java/org/apache/etch/services/router/test/utils/PluginTestServerRunner.java (with props)
Removed:
incubator/etch/branches/router/services/router/src/main/java/cisco/
incubator/etch/branches/router/services/router/src/test/java/cisco/
Modified:
incubator/etch/branches/router/.classpath
incubator/etch/branches/router/BUILD.txt
incubator/etch/branches/router/services/router/EtchRouter-test.properties
incubator/etch/branches/router/services/router/EtchRouter.properties
incubator/etch/branches/router/services/router/src/main/etch/EtchRouter.etch
incubator/etch/branches/router/services/router/src/test/etch/TestApp.etch
incubator/etch/branches/router/services/router/src/test/etch/TestPlugin.etch
Modified: incubator/etch/branches/router/.classpath
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/.classpath?rev=748580&r1=748579&r2=748580&view=diff
==============================================================================
--- incubator/etch/branches/router/.classpath (original)
+++ incubator/etch/branches/router/.classpath Fri Feb 27 16:37:17 2009
@@ -43,6 +43,8 @@
<classpathentry kind="src" path="interoptester/src/test/java"/>
<classpathentry kind="src" path="services/router/src/main/java"/>
<classpathentry kind="src" path="services/router/target/generated-sources/main/etch/java"/>
+ <classpathentry kind="src" path="services/router/src/test/java"/>
+ <classpathentry kind="src" path="services/router/target/generated-sources/test/etch/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ETCH_DEPENDENT_JARS"/>
<classpathentry kind="output" path="bin"/>
Modified: incubator/etch/branches/router/BUILD.txt
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/BUILD.txt?rev=748580&r1=748579&r2=748580&view=diff
==============================================================================
--- incubator/etch/branches/router/BUILD.txt (original)
+++ incubator/etch/branches/router/BUILD.txt Fri Feb 27 16:37:17 2009
@@ -253,6 +253,8 @@
Select Run / External Tools / Compile Java Etch Files.
+ Select Run / External Tools / Compile Router Etch Files.
+
(You may want to configure the external tools first. Select Run / External
Tools / Organize Favorites... Click Add... Select All. Ok. Ok.)
Modified: incubator/etch/branches/router/services/router/EtchRouter-test.properties
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/EtchRouter-test.properties?rev=748580&r1=748579&r2=748580&view=diff
==============================================================================
--- incubator/etch/branches/router/services/router/EtchRouter-test.properties (original)
+++ incubator/etch/branches/router/services/router/EtchRouter-test.properties Fri Feb 27 16:37:17 2009
@@ -5,7 +5,7 @@
#Home directory of the etch-router component, default value is "."
#The etch-router-manager will try to look for EtchRouter.xml (the etch-router's
#XML binding file) in this directory:
-etch.router.home=target/runtime
+etch.router.home=services/router/target/runtime
#The root directory where all the plugin group schema dir's/files are saved
#Default value is "<etch.router.home>/plugins"
Modified: incubator/etch/branches/router/services/router/EtchRouter.properties
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/EtchRouter.properties?rev=748580&r1=748579&r2=748580&view=diff
==============================================================================
--- incubator/etch/branches/router/services/router/EtchRouter.properties (original)
+++ incubator/etch/branches/router/services/router/EtchRouter.properties Fri Feb 27 16:37:17 2009
@@ -5,7 +5,7 @@
#Home directory of the etch-router component, default value is "."
#The etch-router-manager will try to look for EtchRouter.xml (the etch-router's
#XML binding file) in this directory:
-etch.router.home=target/runtime
+etch.router.home=services/router/target/runtime
#The root directory where all the plugin group schema dir's/files are saved
#Default value is "<etch.router.home>/plugins"
@@ -17,7 +17,7 @@
#In this metadata.txt, currently only one property "plugin.group.type" is
#supported by etch router: it indicates the type of the plugin-group,
#which could be: simple, failover or roundrobin
-plugins.root.dir=./plugins
+plugins.root.dir=services/router/plugins
#The root directory where all the application schema dir's/files are saved
#Default value is "<etch.router.home>/applications"
@@ -25,7 +25,7 @@
#The application sub-directory will contain one or multiple Etch XML binding
#file(s) that define all the types and methods that the installed application
#references during its run-time.
-applications.root.dir=./applications
+applications.root.dir=services/router/applications
#Number of miliseconds between the plugin monitor's polling cycle.
#This defines how frequently the plugin monitor try opening connection to
Added: incubator/etch/branches/router/services/router/scripts/Compile Router Etch Files Lnx.launch
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/scripts/Compile%20Router%20Etch%20Files%20Lnx.launch?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/scripts/Compile Router Etch Files Lnx.launch (added)
+++ incubator/etch/branches/router/services/router/scripts/Compile Router Etch Files Lnx.launch Fri Feb 27 16:37:17 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ -->
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc}/services/router/scripts/compileRouterEtchFiles.bash"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}/services/router/scripts"/>
+</launchConfiguration>
Added: incubator/etch/branches/router/services/router/scripts/Compile Router Etch Files Win.launch
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/scripts/Compile%20Router%20Etch%20Files%20Win.launch?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/scripts/Compile Router Etch Files Win.launch (added)
+++ incubator/etch/branches/router/services/router/scripts/Compile Router Etch Files Win.launch Fri Feb 27 16:37:17 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <!--
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ -->
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${project_loc}/services/router/scripts/compileRouterEtchFiles.bat"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}/services/router/scripts"/>
+</launchConfiguration>
Added: incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bash
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bash?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bash (added)
+++ incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bash Fri Feb 27 16:37:17 2009
@@ -0,0 +1,58 @@
+#!/usr/local/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one *
+# or more contributor license agreements. See the NOTICE file *
+# distributed with this work for additional information *
+# regarding copyright ownership. The ASF licenses this file *
+# to you under the Apache License, Version 2.0 (the *
+# "License"); you may not use this file except in compliance *
+# with the License. You may obtain a copy of the License at *
+# *
+# http://www.apache.org/licenses/LICENSE-2.0 *
+# *
+# Unless required by applicable law or agreed to in writing, *
+# software distributed under the License is distributed on an *
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+# KIND, either express or implied. See the License for the *
+# specific language governing permissions and limitations *
+# under the License. *
+
+set -e
+
+q=-q
+b="-b java"
+b_xml="-b xml"
+d="-d ../../../target/generated-sources/main/etch/java"
+d_test="-d ../../../target/generated-sources/test/etch/java"
+d_xml="-d ../../../target/generated-sources/main/etch/xml"
+d_xml_test="-d ../../../target/generated-sources/test/etch/xml"
+i="-I ."
+n=-n
+namespace_path="org/apache/etch/services/router"
+
+walf="-w all,force"
+
+testsdir=tests/src/main/etch
+examplesdir=examples
+
+x=`pwd`/../../../
+
+pushd ../src/main/etch > /dev/null
+${x}scripts/etch-eclipse.bat $q $b $n $d $i -w server EtchRouter.etch
+${x}scripts/etch-eclipse.bat $q $b_xml $n $d_xml $i -w both,all EtchRouter.etch
+popd > /dev/null
+
+pushd ../src/test/etch > /dev/null
+${x}scripts/etch-eclipse.bat $q $b $n $d_test $i -w client,all TestApp.etch
+${x}scripts/etch-eclipse.bat $q $b_xml $n $d_xml_test $i -w both,all TestApp.etch
+
+${x}scripts/etch-eclipse.bat $q $b $n $d_test $i -w both,all TestPlugin.etch
+${x}scripts/etch-eclipse.bat $q $b_xml $n $d_xml_test $i -w both,all TestPlugin.etch
+
+rm ../../../target/generated-sources/test/etch/java/${namespace_path}/test/plugin/ImplTestPluginServer.java
+
+mkdir ../../../target/runtime/applications
+mkdir ../../../target/runtime/plugins/TestPlugin
+cp ../../../target/generated-sources/main/etch/xml/${namespace_path}/EtchRouter.xml ../../../target/runtime/
+cp ../../../target/generated-sources/test/etch/xml/${namespace_path}/test/plugin/TestPlugin.xml ../../../target/runtime/plugins/TestPlugin/
+
+popd > /dev/null
Propchange: incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bash
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bash
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bat
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bat?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bat (added)
+++ incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bat Fri Feb 27 16:37:17 2009
@@ -0,0 +1,56 @@
+@rem Licensed to the Apache Software Foundation (ASF) under one *
+@rem or more contributor license agreements. See the NOTICE file *
+@rem distributed with this work for additional information *
+@rem regarding copyright ownership. The ASF licenses this file *
+@rem to you under the Apache License, Version 2.0 (the *
+@rem "License"); you may not use this file except in compliance *
+@rem with the License. You may obtain a copy of the License at *
+@rem *
+@rem http://www.apache.org/licenses/LICENSE-2.0 *
+@rem *
+@rem Unless required by applicable law or agreed to in writing, *
+@rem software distributed under the License is distributed on an *
+@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+@rem KIND, either express or implied. See the License for the *
+@rem specific language governing permissions and limitations *
+@rem under the License. *
+@set q=-q
+@set b=-b java
+@set b_xml=-b xml
+@set d=-d ..\..\..\target\generated-sources\main\etch\java
+@set d_test=-d ..\..\..\target\generated-sources\test\etch\java
+@set d_xml=-d ..\..\..\target\generated-sources\main\etch\xml
+@set d_xml_test=-d ..\..\..\target\generated-sources\test\etch\xml
+@set i=-I .
+@set n=-n
+@set namespace_path=org\apache\etch\services\router
+
+@set walf=-w all,force
+
+@set testsdir=tests\src\main\etch
+@set examplesdir=examples
+
+@set x=%CD%\..\..\..\
+
+@pushd ..\src\main\etch
+@call %x%scripts\etch-eclipse.bat %q% %b% %n% %d% %i% -w server EtchRouter.etch
+@call %x%scripts\etch-eclipse.bat %q% %b_xml% %n% %d_xml% %i% -w both,all EtchRouter.etch
+@popd
+
+@pushd ..\src\test\etch
+@call %x%scripts\etch-eclipse.bat %q% %b% %n% %d_test% %i% -w client,all TestApp.etch
+@call %x%scripts\etch-eclipse.bat %q% %b_xml% %n% %d_xml_test% %i% -w both,all TestApp.etch
+
+@call %x%scripts\etch-eclipse.bat %q% %b% %n% %d_test% %i% -w both,all TestPlugin.etch
+@call %x%scripts\etch-eclipse.bat %q% %b_xml% %n% %d_xml_test% %i% -w both,all TestPlugin.etch
+
+del ..\..\..\target\generated-sources\test\etch\java\%namespace_path%\test\plugin\ImplTestPluginServer.java
+
+mkdir ..\..\..\target\runtime\applications
+mkdir ..\..\..\target\runtime\plugins\TestPlugin
+copy ..\..\..\target\generated-sources\main\etch\xml\%namespace_path%\EtchRouter.xml ..\..\..\target\runtime\
+copy ..\..\..\target\generated-sources\test\etch\xml\%namespace_path%\test\plugin\TestPlugin.xml ..\..\..\target\runtime\plugins\TestPlugin\
+
+@popd
+
+
Propchange: incubator/etch/branches/router/services/router/scripts/compileRouterEtchFiles.bat
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/etch/branches/router/services/router/src/main/etch/EtchRouter.etch
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/etch/EtchRouter.etch?rev=748580&r1=748579&r2=748580&view=diff
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/etch/EtchRouter.etch (original)
+++ incubator/etch/branches/router/services/router/src/main/etch/EtchRouter.etch Fri Feb 27 16:37:17 2009
@@ -1,7 +1,7 @@
// The service module namespace, this will be translated to the
// namespace of the generated source code.
-module cisco.uc.cuae.etchrouter
+module org.apache.etch.services.router
// The name of your service.
service EtchRouter
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationConnectionInfo.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationConnectionInfo.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationConnectionInfo.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationConnectionInfo.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,390 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.etch.bindings.java.msg.Direction;
+import org.apache.etch.bindings.java.msg.Type;
+import org.apache.etch.services.router.EtchRouter.EtchRouterException;
+import org.apache.etch.services.router.EtchRouter.PluginServiceState;
+import org.apache.etch.services.router.plugin.PluginGroup;
+import org.apache.etch.services.router.plugin.PluginMember;
+import org.apache.etch.services.router.plugin.PluginMemberConnection;
+import org.apache.etch.services.router.utils.ApplicationAttributes;
+
+/**
+ *
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class ApplicationConnectionInfo
+{
+ private static final Logger _LOGGER = Logger.getLogger( ApplicationConnectionInfo.class.getName());
+
+ private ConnectionStackInfo _appClientConnInfo = null;
+
+ private Map<Type, PluginGroup> _method2pluginGroupMap = null;
+
+ private Map<PluginGroup, PluginMemberConnection> _pluginGroup2PluginMemberConnMap = null;
+
+ private Map<String, PluginGroup> _pluginGroups = null;
+
+ EtchRouterManager _etchRouterManager = null;
+
+ private String _applicationParam = null;
+
+ private ApplicationAttributes _applicationAttrs = null;
+
+ // plugin name to statuc map:
+ private Map<String, PluginServiceState> _previousStateSentMap = new HashMap<String, PluginServiceState>();
+
+ /**
+ *
+ * @param appClientConnInfo
+ * @param routerMgr
+ * @param initMethod
+ * @throws Exception
+ */
+ public ApplicationConnectionInfo( ConnectionStackInfo appClientConnInfo, EtchRouterManager routerMgr, Type initMethod) throws Exception
+ {
+ initFields(null, appClientConnInfo, routerMgr);
+ loadPluginGroupByMethodType( initMethod );
+ }
+
+ /**
+ *
+ * @param methodType
+ * @throws Exception
+ */
+ public void loadPluginGroupByMethodType( Type methodType ) throws Exception
+ {
+ PluginGroup pluginGrp = _etchRouterManager.getPluginGroup( methodType );
+ if (pluginGrp==null)
+ throw new EtchRouterException(1, String.format( "The method \"%s\" is not an installed plugin API", methodType.getName() ));
+ if (_pluginGroups.get( pluginGrp.getName() )==null)
+ {
+ _LOGGER.log( Level.INFO, "Loading plugin group \"{0}\" for client connection {1}", new Object[] { pluginGrp.getName(), _appClientConnInfo } );
+ Collection<Type> methods = pluginGrp.getInstallInfo().getMethods();
+ synchronized(_method2pluginGroupMap)
+ {
+ for (Type method : methods)
+ _method2pluginGroupMap.put( method, pluginGrp );
+ }
+ synchronized(_pluginGroups)
+ {
+ if (_pluginGroups.get( pluginGrp.getName() )==null)
+ _pluginGroups.put( pluginGrp.getName(), pluginGrp );
+ }
+ pluginGrp.addApplicationConnection( this );
+ initPluginConnectionIfNotConnected(pluginGrp);
+ }
+ }
+
+ /**
+ *
+ * @param appParam
+ * @param appInstallInfo
+ * @param appClientConnInfo
+ * @param routerMgr
+ * @throws Exception
+ */
+ public ApplicationConnectionInfo( String appParam, ApplicationInstallInfo appInstallInfo, ConnectionStackInfo appClientConnInfo, EtchRouterManager routerMgr )
+ throws Exception
+ {
+ initFields(appParam, appClientConnInfo, routerMgr);
+ initPluginGroups(appInstallInfo);
+ connectToPlugins();
+ }
+
+ public boolean isAnonymous()
+ {
+ return _appClientConnInfo.getPluginOrAppName()==null;
+ }
+
+ public void setApplicationName( String applicationName )
+ {
+ _appClientConnInfo.setPluginOrAppName( applicationName );
+ }
+
+ private void initFields(String appParam, ConnectionStackInfo appClientConnInfo, EtchRouterManager routerMgr) throws Exception
+ {
+ _appClientConnInfo = appClientConnInfo;
+ setApplicationParam( appParam );
+ _method2pluginGroupMap = new HashMap<Type, PluginGroup>();
+ _pluginGroup2PluginMemberConnMap = new HashMap<PluginGroup, PluginMemberConnection>();
+ _etchRouterManager = routerMgr;
+ _pluginGroups = new LinkedHashMap<String, PluginGroup>();
+ }
+
+ public void setApplicationParam( String appParam ) throws Exception
+ {
+ _applicationParam = appParam;
+ try
+ {
+ _applicationAttrs = new ApplicationAttributes( _applicationParam );
+ }
+ catch (Exception e)
+ {
+ String msg = String.format( "Invalid application parameter \"%s\"", _applicationParam);
+ _LOGGER.log( Level.SEVERE, msg, e );
+ throw new EtchRouterException(1, msg);
+ }
+ }
+
+ private void initPluginGroups(ApplicationInstallInfo appInstallInfo) throws Exception
+ {
+ if (appInstallInfo==null)
+ {
+ //Allow an anonymous application to be registered :
+ return;
+ //throw new EtchRouterException(1, String.format( "Application '%s' is not installed with Etch Router manager.", appInstallInfo.getName() ));
+ }
+ Collection<Type> appMethods = appInstallInfo.getMethods();
+ for (Type method : appMethods)
+ {
+ if (method.getDirection()!=Direction.CLIENT)
+ {
+ PluginGroup pluginGroup = _etchRouterManager.getPluginGroup( method );
+ if (pluginGroup==null)
+ {
+ if (!_etchRouterManager.isLocalMethodType( method ))
+ throw new EtchRouterException(1, String.format( "Cannot find an installed plugin prividing API method service: '%s'", method.getName() ));
+ }
+ else
+ {
+ _method2pluginGroupMap.put( method, pluginGroup );
+ if ( _pluginGroups.get( pluginGroup.getName() )==null)
+ {
+ _pluginGroups.put( pluginGroup.getName(), pluginGroup );
+ pluginGroup.addApplicationConnection( this );
+ }
+ }
+ }
+ }
+ }
+
+ private void connectToPlugins()
+ {
+ for (PluginGroup pluginGrp : _pluginGroups.values())
+ {
+ InitPluginConnectionRunner runner = new InitPluginConnectionRunner(pluginGrp);
+ new Thread(runner).start();
+ }
+ }
+
+ private class InitPluginConnectionRunner implements Runnable
+ {
+ private PluginGroup _pluginGrp = null;
+ private InitPluginConnectionRunner(PluginGroup pluginGrp)
+ {
+ _pluginGrp = pluginGrp;
+ }
+ public void run()
+ {
+ initPluginConnection( _pluginGrp );
+ }
+ }
+
+ /**
+ *
+ * @param pluginGrp
+ */
+ public synchronized void initPluginConnectionIfNotConnected( PluginGroup pluginGrp )
+ {
+ if (isConnectedToPluginGroup( pluginGrp )) return;
+ initPluginConnection( pluginGrp );
+ }
+
+ private void sendEventToClientConnection( String pluginName, String detail, PluginServiceState state)
+ {
+ synchronized (_previousStateSentMap)
+ {
+ // do not send duplicate plugin state change message to client:
+ if (_previousStateSentMap.get( pluginName )==state) return;
+ _previousStateSentMap.put( pluginName, state);
+ }
+ try
+ {
+ _etchRouterManager.sentNotifyMsgToConnection( String.format( "Plugin: %s, Status: %s, Detail: %s", pluginName, state, detail ), this._appClientConnInfo);
+ }
+ catch (Exception e)
+ {
+ _LOGGER.log( Level.INFO, "Got Exception", e);
+ }
+ if (this.isAnonymous())
+ {
+ _LOGGER.log( Level.FINEST, "No plugin service {0} event sent to anonymous connection: {1}", new Object[]{ state, _appClientConnInfo} );
+ }
+ else
+ {
+ try
+ {
+ _etchRouterManager.callAppClientMethod_pluginServiceStateChange( pluginName, state, detail, this._appClientConnInfo );
+ }
+ catch (Exception ee)
+ {
+ _LOGGER.log( Level.SEVERE, "Got Exception: ", ee);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param pluginGrp
+ */
+ public synchronized void initPluginConnection( PluginGroup pluginGrp )
+ {
+ PluginMember member = null;
+ try
+ {
+ member = pluginGrp.getActiveMember( _applicationAttrs );
+ }
+ catch (Exception e)
+ {
+ String detail = String.format( "The plugin group '%s' failed to return an active plugin instance", pluginGrp.getName());
+ if (_LOGGER.isLoggable( Level.FINEST ))
+ _LOGGER.log( Level.FINEST, detail, e);
+ else
+ _LOGGER.log( Level.INFO, detail + " : " + e.getLocalizedMessage());
+ sendEventToClientConnection( pluginGrp.getName(), detail, PluginServiceState.DOWN);
+ return;
+ }
+ ERRemoteServer remoteServer = null;
+ try
+ {
+ remoteServer = EtchRouterManagerHelper.newServer( _etchRouterManager, member.getUrl(), null, pluginGrp.getName() );
+ }
+ catch (Exception e)
+ {
+ String detail = String.format( "Failed to create a remote server handle with url '%s' for plugin group '%s'", member.getUrl(), pluginGrp.getName());
+ if (_LOGGER.isLoggable( Level.FINEST ))
+ _LOGGER.log( Level.FINEST, detail, e);
+ else
+ _LOGGER.log( Level.INFO, detail + " : " + e.getLocalizedMessage());
+ sendEventToClientConnection( pluginGrp.getName(), detail, PluginServiceState.DOWN);
+ return;
+ }
+ PluginMemberConnection instConn = new PluginMemberConnection( member, remoteServer );
+
+ _LOGGER.log( Level.INFO, "Connecting to remote server: {0}, application connection: {1} ", new Object[] { remoteServer.toString(), this._appClientConnInfo } );
+ try
+ {
+ remoteServer._startAndWaitUp( _etchRouterManager.getConnectionStartMaxDelay() );
+ }
+ catch (Exception e)
+ {
+ String detail = String.format( "The remote server failed to start, url is '%s', plugin group is '%s'", member.getUrl(), pluginGrp.getName());
+ if (_LOGGER.isLoggable( Level.FINEST ))
+ _LOGGER.log( Level.FINEST, detail, e);
+ else
+ _LOGGER.log( Level.INFO, detail + " : " + e.getLocalizedMessage());
+ sendEventToClientConnection( pluginGrp.getName(), detail, PluginServiceState.DOWN);
+ return;
+ }
+ String detail = String.format( "Successfully connected to plugin '%s' for application connection '%s', remote plugin connection is '%s'", pluginGrp.getName(), this._appClientConnInfo.toString(), remoteServer.toString());
+ _LOGGER.log( Level.INFO, detail);
+ sendEventToClientConnection( pluginGrp.getName(), detail, PluginServiceState.UP);
+ member.addMemberConnection( instConn );
+ _pluginGroup2PluginMemberConnMap.put( pluginGrp, instConn );
+ _etchRouterManager.addAppConnectionInfo( remoteServer.getConnectionStackInfo(), this );
+ }
+
+ public synchronized boolean isConnectedToPluginGroup( PluginGroup pluginGroup )
+ {
+ return _pluginGroup2PluginMemberConnMap.containsKey( pluginGroup );
+ }
+
+ public PluginGroup getPluginGroupByName( String pluginGrpName )
+ {
+ return _pluginGroups.get( pluginGrpName );
+ }
+
+ public Collection<PluginGroup> getReferencedPluginGroups()
+ {
+ return _pluginGroups.values();
+ }
+
+ public synchronized void stopAllPluginConnections()
+ {
+ for (PluginGroup pluginGrp : _pluginGroups.values())
+ stopPluginConnection( pluginGrp, false );
+ }
+
+ public synchronized void stopPluginConnection( PluginGroup pluginGrp, boolean sendEventToApp )
+ {
+ PluginMemberConnection instConn = _pluginGroup2PluginMemberConnMap.remove( pluginGrp );
+ if ( instConn != null)
+ {
+ instConn.getMember().removeMemberConnection( instConn );
+ ERRemoteServer server = instConn.getRemoteServer();
+ _etchRouterManager.removeAppConnectionInfo( server.getConnectionStackInfo() );
+ _LOGGER.log( Level.INFO, "Stopping remote server: {0} for application connection: {1}", new Object[] { server.toString(), this._appClientConnInfo } );
+ try
+ {
+ server._stopAndWaitDown( _etchRouterManager.getConnectionStopMaxDelay() );
+ }
+ catch (Exception e)
+ {
+ _LOGGER.log( Level.FINE, "Got Exception: ", e);
+ }
+ if (sendEventToApp)
+ {
+ sendEventToClientConnection( pluginGrp.getName(), String.format( "The remote server disconnected: %s", server ), PluginServiceState.DOWN);
+ }
+ }
+ }
+
+ /**
+ * Getter
+ *
+ * @return
+ */
+ public ConnectionStackInfo getApplicationClientConnectionStackInfo()
+ {
+ return _appClientConnInfo;
+ }
+
+ /**
+ *
+ * @param method
+ * @return
+ */
+ public PluginMemberConnection getPluginConnectionByMethod( Type method )
+ {
+ PluginGroup grp = _method2pluginGroupMap.get( method );
+ if (grp==null) return null;
+ return _pluginGroup2PluginMemberConnMap.get( grp );
+ }
+
+ /**
+ *
+ * @param pluginName
+ * @return
+ */
+ public synchronized PluginMemberConnection getPluginConnectionByPluginGroup( PluginGroup pluginGrp )
+ {
+ if (pluginGrp==null) return null;
+ return _pluginGroup2PluginMemberConnMap.get( pluginGrp );
+ }
+
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationConnectionInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationConnectionInfo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationInstallInfo.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationInstallInfo.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationInstallInfo.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationInstallInfo.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,72 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.etch.bindings.java.msg.Type;
+
+public class ApplicationInstallInfo
+{
+ private String _name = null;
+
+ private Map<String, Type> _methodMapByName = null;
+
+ private Map<Integer, Type> _methodMapById = null;
+
+ /**
+ * Constructor
+ *
+ * @param name
+ */
+ public ApplicationInstallInfo(String name)
+ {
+ _name = name;
+ _methodMapByName = new HashMap<String, Type>();
+ _methodMapById = new HashMap<Integer, Type>();
+ }
+
+ public void addMethod(Type method)
+ {
+ if (method==null) return;
+ _methodMapByName.put( method.getName(), method );
+ _methodMapById.put( method.getId(), method );
+ }
+
+ public Type getMethod(String name)
+ {
+ return _methodMapByName.get( name );
+ }
+
+ public Type getMethod(Integer id)
+ {
+ return _methodMapById.get( id );
+ }
+
+ public Collection<Type> getMethods()
+ {
+ return _methodMapByName.values();
+ }
+
+ public String getName()
+ {
+ return _name;
+ }
+
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationInstallInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ApplicationInstallInfo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ConnectionStackInfo.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ConnectionStackInfo.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ConnectionStackInfo.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ConnectionStackInfo.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,158 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import org.apache.etch.bindings.java.msg.ValueFactory;
+import org.apache.etch.bindings.java.support.DeliveryService;
+import org.apache.etch.bindings.java.transport.MailboxManager;
+import org.apache.etch.services.router.utils.UniqueKeyGenerator;
+import org.apache.etch.util.core.io.Connection;
+
+/**
+ *
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class ConnectionStackInfo
+{
+ public enum ConnectionType
+ {
+ APP_CLIENT_CONN, PLUGIN_MONITOR_CONN, PLUGIN_SERVER_CONN
+ }
+
+ private String _pluginOrAppName = null;
+
+ private MailboxManager _mailboxMgr = null;
+ private DeliveryService _deliveryService = null;
+ private ValueFactory _valueFactory = null;
+
+ private EtchRouterMessageFilter _messageFilter = null;
+
+ private ConnectionType _connectionType = null;
+
+ private String _id = null;
+
+ private String _cachedLocalAddress = null;
+
+ private String _cachedRemoteAddress = null;
+
+ /**
+ * Constructor
+ *
+ * @param messageFilter
+ * @param mailboxMgr
+ * @param deliveryService
+ * @param valueFactory
+ */
+ public ConnectionStackInfo(EtchRouterMessageFilter messageFilter, MailboxManager mailboxMgr, DeliveryService deliveryService,
+ ValueFactory valueFactory )
+ {
+ _id = UniqueKeyGenerator.getInstance().generateKey( null );
+ _messageFilter = messageFilter;
+ _mailboxMgr = mailboxMgr;
+ _deliveryService = deliveryService;
+ _valueFactory = valueFactory;
+ }
+
+ public ConnectionType getConnectionType()
+ {
+ return _connectionType;
+ }
+
+ public void setConnectionType(ConnectionType connType, String pluginOrAppName)
+ {
+ _connectionType = connType;
+ _pluginOrAppName = pluginOrAppName;
+ }
+
+ public void setPluginOrAppName(String pluginOrAppName)
+ {
+ _pluginOrAppName = pluginOrAppName;
+ }
+
+ public String getPluginOrAppName()
+ {
+ return _pluginOrAppName;
+ }
+
+ public EtchRouterMessageFilter getMessageFilter()
+ {
+ return _messageFilter;
+ }
+
+ /**
+ * Getter
+ *
+ * @return
+ */
+ public MailboxManager getMailboxMgr()
+ {
+ return _mailboxMgr;
+ }
+
+ /**
+ * Getter
+ *
+ * @return
+ */
+ public DeliveryService getDeliveryService()
+ {
+ return _deliveryService;
+ }
+
+ /**
+ * Getter
+ *
+ * @return
+ */
+ public ValueFactory getValueFactory()
+ {
+ return _valueFactory;
+ }
+
+ @Override
+ public String toString()
+ {
+ //return String.format( "%s[ID:%s, name:%s, conn-type:%s, delivery-service:%s]", this.getClass().getSimpleName(), _id, _pluginOrAppName, _connectionType, _deliveryService.toString() );
+ Object localAddr = null;
+ try
+ {
+ localAddr = _deliveryService.transportQuery( Connection.LOCAL_ADDRESS );
+ }
+ catch (Exception e)
+ {
+ }
+ if (localAddr != null)
+ {
+ _cachedLocalAddress = localAddr.toString();
+ }
+ Object remoteAddr = null;
+ try
+ {
+ remoteAddr = _deliveryService.transportQuery( Connection.REMOTE_ADDRESS );
+ }
+ catch (Exception e)
+ {
+ }
+ if (remoteAddr!=null)
+ {
+ _cachedRemoteAddress = remoteAddr.toString();
+ }
+ return String.format( "[Remote_Address:%s;Local_Address:%s]", _cachedRemoteAddress, _cachedLocalAddress );
+ }
+
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ConnectionStackInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ConnectionStackInfo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/DynamicValueFactory.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/DynamicValueFactory.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/DynamicValueFactory.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/DynamicValueFactory.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,103 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.etch.bindings.java.msg.Type;
+import org.apache.etch.bindings.java.msg.TypeMap;
+import org.apache.etch.bindings.java.support.Class2TypeMap;
+import org.apache.etch.bindings.java.support.DefaultValueFactory;
+import org.apache.etch.bindings.java.support.Validator_long;
+import org.apache.etch.bindings.java.support.Validator_string;
+
+/**
+ *
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class DynamicValueFactory extends DefaultValueFactory
+{
+ private static final Logger _LOGGER = Logger.getLogger( DynamicValueFactory.class.getName());
+
+ private static final Object _SYNC_OBJ = new Object();
+
+ private static TypeMap _types = new TypeMap();
+
+ private static Class2TypeMap _class2type = new Class2TypeMap();
+
+ static
+ {
+ DefaultValueFactory.init( _types, _class2type );
+ }
+
+ /**
+ *
+ * @param uri
+ * @param types
+ * @param class2type
+ */
+ public DynamicValueFactory(String uri)
+ {
+ super(uri, _types, _class2type);
+ }
+
+ /**
+ * Add collection of types to dynamic value factory
+ *
+ * @param types
+ * @return list of types that were added successfully
+ */
+ public List<Type> addTypeDefinitions(Collection<Type> types)
+ {
+ List<Type> typesAdded = new ArrayList<Type>(types.size());
+ synchronized(_SYNC_OBJ)
+ {
+ for (Type myType : types)
+ {
+ try
+ {
+ _types.add( myType );
+ typesAdded.add( myType );
+ }
+ catch (Exception e)
+ {
+ _LOGGER.log( Level.FINER, "Failed to add type definition \"{0}\" to DynamicValueFactory: {1}", new Object[] { myType.getName(), e.getLocalizedMessage() } );
+ }
+ }
+ }
+ return typesAdded;
+ }
+
+ /**
+ *
+ * @param clss
+ * @param myType
+ */
+ public void addClass2TypeMap( Class clss, Type myType)
+ {
+ synchronized(_SYNC_OBJ)
+ {
+ _class2type.put( clss, myType );
+ }
+ }
+
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/DynamicValueFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/DynamicValueFactory.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemote.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemote.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemote.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemote.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,65 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import org.apache.etch.bindings.java.msg.ValueFactory;
+import org.apache.etch.bindings.java.support.DeliveryService;
+import org.apache.etch.bindings.java.support.RemoteBase;
+
+/**
+ *
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class ERRemote extends RemoteBase
+{
+
+ private EtchRouterManager _etchRouterManager = null;
+
+ private ConnectionStackInfo _connectionInfo = null;
+
+ /**
+ *
+ * @param svc
+ * @param vf
+ * @param etchRouterManager
+ */
+ public ERRemote( DeliveryService svc, ValueFactory vf, EtchRouterManager etchRouterManager, ConnectionStackInfo connInfo )
+ {
+ super( svc, vf );
+ _etchRouterManager = etchRouterManager;
+ _connectionInfo = connInfo;
+ }
+
+ public EtchRouterManager getEtchRouterManager()
+ {
+ return _etchRouterManager;
+ }
+
+ public ConnectionStackInfo getConnectionStackInfo()
+ {
+ return _connectionInfo;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format( "%s[connection-info:%s]", this.getClass().getSimpleName(), _connectionInfo );
+ }
+
+
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemote.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemote.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteClient.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteClient.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteClient.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteClient.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,30 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import org.apache.etch.bindings.java.msg.ValueFactory;
+import org.apache.etch.bindings.java.support.DeliveryService;
+
+public class ERRemoteClient extends ERRemote
+{
+
+ public ERRemoteClient( DeliveryService svc, ValueFactory vf, EtchRouterManager etchRouterManager, ConnectionStackInfo connInfo )
+ {
+ super(svc, vf, etchRouterManager, connInfo);
+ }
+
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteClient.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteServer.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteServer.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteServer.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteServer.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,28 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import org.apache.etch.bindings.java.msg.ValueFactory;
+import org.apache.etch.bindings.java.support.DeliveryService;
+
+public class ERRemoteServer extends ERRemote
+{
+ public ERRemoteServer( DeliveryService svc, ValueFactory vf, EtchRouterManager etchRouterManager, ConnectionStackInfo connInfo )
+ {
+ super(svc, vf, etchRouterManager, connInfo);
+ }
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteServer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERRemoteServer.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStub.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStub.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStub.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStub.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,32 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import org.apache.etch.bindings.java.support.DeliveryService;
+import org.apache.etch.bindings.java.support.Pool;
+import org.apache.etch.bindings.java.support.StubBase;
+
+public class ERStub extends StubBase<ImplBase>
+{
+ private EtchRouterManager _etchRouterManager = null;
+
+ public ERStub( DeliveryService svc, ImplBase obj, Pool queued, Pool free )
+ {
+ super(svc, obj, queued, free);
+ _etchRouterManager = obj.getEtchRouterManager();
+ }
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStub.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStub.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStubHelper.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStubHelper.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStubHelper.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStubHelper.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,40 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import org.apache.etch.bindings.java.msg.Message;
+import org.apache.etch.bindings.java.support.DeliveryService;
+import org.apache.etch.bindings.java.support.StubHelper;
+import org.apache.etch.util.core.Who;
+
+/**
+ *
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ * @param <T>
+ */
+public class ERStubHelper extends StubHelper<EtchRouterManager>
+{
+
+ @Override
+ public void run( DeliveryService svc, EtchRouterManager obj, Who sender, Message msg )
+ throws Exception
+ {
+ obj.handleStubHelperCall( svc, sender, msg );
+ }
+
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStubHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/ERStubHelper.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMain.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMain.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMain.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMain.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,106 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.etch.services.router;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+import java.util.logging.LogManager;
+
+/**
+ * Main execution class for the Etch Router service
+ *
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class EtchRouterMain
+{
+
+ private File _routerPropFile = null;
+
+ private File _loggerConfFile = null;
+
+ public EtchRouterMain( File routerPropFile, File loggerConfFile)
+ {
+ _routerPropFile = routerPropFile;
+ _loggerConfFile = loggerConfFile;
+ }
+
+ /**
+ * main method
+ *
+ * @param args
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception
+ {
+ File routerPropFile = (args!=null && args.length>0 ? new File(args[0]) : new File("EtchRouter.properties"));
+ File loggerConfFile = (args!=null && args.length>1 ? new File(args[1]) : null);
+ EtchRouterMain mainClass = new EtchRouterMain(routerPropFile, loggerConfFile);
+ mainClass.run();
+ }
+
+ private EtchRouterManager _routerMgr = null;
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void run() throws Exception
+ {
+ if (_loggerConfFile!=null && _loggerConfFile.exists())
+ {
+ System.out.println(String.format( "Loading logger config file %s", _loggerConfFile.getAbsolutePath()));
+ try
+ {
+ LogManager.getLogManager().readConfiguration(new FileInputStream(_loggerConfFile));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ }
+ Properties prop = loadPropertiesFile();
+ _routerMgr = new EtchRouterManager(prop);
+ _routerMgr.start();
+ }
+
+ public EtchRouterManager getRouterManager()
+ {
+ return _routerMgr;
+ }
+
+ private Properties loadPropertiesFile()
+ {
+ Properties prop = new Properties();
+ if (_routerPropFile!=null && _routerPropFile.exists())
+ {
+ System.out.println( String.format("Loading properties file %s", _routerPropFile.getAbsolutePath()) );
+ try
+ {
+ prop.load( new FileInputStream(_routerPropFile) );
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace( System.err );
+ }
+ }
+ return prop;
+ }
+
+
+}
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMain.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/EtchRouterMain.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"