[openrtm-commit:01633] r736 - in branches/RELENG_1_1: . jp.go.aist.rtm.RTC jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/executionContext jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util
openrtm @ openrtm.org
openrtm @ openrtm.org
2015年 10月 28日 (水) 18:02:58 JST
Author: kawauchi
Date: 2015-10-28 18:02:58 +0900 (Wed, 28 Oct 2015)
New Revision: 736
Added:
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java
Removed:
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/CorbaObjectManagerTest.java
Modified:
branches/RELENG_1_1/
branches/RELENG_1_1/buildInstaller.bat
branches/RELENG_1_1/buildPackage.sh
branches/RELENG_1_1/buildRTC.bat
branches/RELENG_1_1/buildRTC.sh
branches/RELENG_1_1/buildTests.sh
branches/RELENG_1_1/jp.go.aist.rtm.RTC/
branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTests.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConfigSampleTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConsoleInTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConsoleOutTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/CorbaNamingTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ManagerTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/MyServiceConsumerTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/MyServiceProviderTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/NamingManagerTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/NamingOnCorbaTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/SeqInTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/SeqOutTest.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContextTests.java
branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java
Log:
[compat,merge] r664,665,674,675,687,700 merged from trunk.
Property changes on: branches/RELENG_1_1
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/RELENG_1_0_0:60-401
/branches/work/ConfigurationCallback:631-635
/branches/work/DesignChangeOfEC:648-660
/branches/work/ForComponentActionListener:521-522
/branches/work/ForComponentObserverConsumer:534-543
/branches/work/ForConfigurationListener:524-526
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/LoggerService:666-669
/branches/work/SourceSharing:591-603
/branches/work/ToGetProperties:545-548
/branches/work/ToIFR_ID:509-514
/trunk:622,630-637,639-658,661,663,670,672-673,678,680-685,688,691-692,695-696,698,707-727
+ /branches/RELENG_1_0_0:60-401
/branches/work/ConfigurationCallback:631-635
/branches/work/DesignChangeOfEC:648-660
/branches/work/ForComponentActionListener:521-522
/branches/work/ForComponentObserverConsumer:534-543
/branches/work/ForConfigurationListener:524-526
/branches/work/ForLogFormat:518-519
/branches/work/ForPortConnectListener:528-532
/branches/work/ForSDOServiceAdminClass:505-507
/branches/work/LoggerService:666-669
/branches/work/SourceSharing:591-603
/branches/work/ToGetProperties:545-548
/branches/work/ToIFR_ID:509-514
/trunk:622,630-637,639-658,661,663-665,670,672-675,678,680-685,687-688,691-692,695-696,698,700,707-727
Modified: branches/RELENG_1_1/buildInstaller.bat
===================================================================
--- branches/RELENG_1_1/buildInstaller.bat 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/buildInstaller.bat 2015-10-28 09:02:58 UTC (rev 736)
@@ -1,18 +1,10 @@
-set DUMMY=%ANT_HOME%
- at rem set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.6.5\
- at rem set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.7.0.v200706080842\
-set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.8.3.v20120321-1730\
-
-
cd jp.go.aist.rtm.RTC
-call ant javaInstaller -lib %ECLIPSE_HOME%\plugins\net.sf.ant4eclipse.plugin_0.5.0.rc1\lib\
+call ant javaInstaller -lib %ANT_HOME%\lib\
if ERRORLEVEL 1 goto error_end
cd ..
-set ANT_HOME=%DUMMY%
exit /b 0
:error_end
cd ..
-set ANT_HOME=%DUMMY%
exit /b 1
Modified: branches/RELENG_1_1/buildPackage.sh
===================================================================
--- branches/RELENG_1_1/buildPackage.sh 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/buildPackage.sh 2015-10-28 09:02:58 UTC (rev 736)
@@ -2,11 +2,39 @@
#
#
-DUMMY=$ANT_HOME
-export ANT_HOME=$ECLIPSE_HOME/plugins/org.apache.ant_1.6.5/
+#------------------------------------------------------------
+# find_anthome
+#
+# This function estimate ANT_HOME from ant, which usually
+# is a symbolic link to $ANT_HOME/bin/ant.
+#------------------------------------------------------------
+find_anthome()
+{
+ if test ! "x$ANT_HOME" = "x" ; then
+ if test -d $ANT_HOME && test -f $ANT_HOME/bin/ant ; then
+ return 0
+ fi
+ echo "ant cannot be found under ANT_HOME: $ANT_HOME"
+ fi
+ echo "Valid Environment variable ANT_HOME is not set. Searching..."
+ tmp=`readlink -e $(which ant)`
+ ant_path=`dirname $tmp | sed 's/\/bin$//'`
+ if test "x$ant_path" = "x" ; then
+ echo "Ant not found. Please install Ant and set ANT_HOME."
+ exit 1
+ fi
+ export ANT_HOME=$ant_path
+ return 0
+}
-
+find_anthome
+echo "------------------------------------------------------------"
+echo "Environment variables:"
+echo "ANT_HOME: $ANT_HOME"
+echo "------------------------------------------------------------"
+
+
if test $# -eq 0 ; then
var_for="dist"
else
@@ -17,14 +45,10 @@
#
#
cd jp.go.aist.rtm.RTC
-ant $var_for -lib $ECLIPSE_HOME/plugins/net.sf.ant4eclipse.plugin_0.5.0.rc1/lib/ -lib $ECLIPSE_HOME/plugins/org.apache.ant_1.7.0.v200803061910/lib
+ant $var_for -lib $ANT_HOME/lib/
if [ $? -ne 0 ];
then
exit 1
fi
echo "--"
cd ..
-
-export ANT_HOME=$DUMMY
-
-
Modified: branches/RELENG_1_1/buildRTC.bat
===================================================================
--- branches/RELENG_1_1/buildRTC.bat 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/buildRTC.bat 2015-10-28 09:02:58 UTC (rev 736)
@@ -1,18 +1,10 @@
-set DUMMY=%ANT_HOME%
- at rem set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.6.5\
- at rem set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.7.0.v200706080842\
-set ANT_HOME=%ECLIPSE_HOME%\plugins\org.apache.ant_1.8.3.v20120321-1730\
-
-
cd jp.go.aist.rtm.RTC
-call ant buildAll -lib %ECLIPSE_HOME%\plugins\net.sf.ant4eclipse.plugin_0.5.0.rc1\lib\
+call ant buildAll -lib %ANT_HOME%\lib\
if ERRORLEVEL 1 goto error_end
cd ..
-set ANT_HOME=%DUMMY%
exit /b 0
:error_end
cd ..
-set ANT_HOME=%DUMMY%
exit /b 1
Modified: branches/RELENG_1_1/buildRTC.sh
===================================================================
--- branches/RELENG_1_1/buildRTC.sh 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/buildRTC.sh 2015-10-28 09:02:58 UTC (rev 736)
@@ -2,11 +2,39 @@
#
#
-DUMMY=$ANT_HOME
-export ANT_HOME=$ECLIPSE_HOME/plugins/org.apache.ant_1.6.5/
+#------------------------------------------------------------
+# find_anthome
+#
+# This function estimate ANT_HOME from ant, which usually
+# is a symbolic link to $ANT_HOME/bin/ant.
+#------------------------------------------------------------
+find_anthome()
+{
+ if test ! "x$ANT_HOME" = "x" ; then
+ if test -d $ANT_HOME && test -f $ANT_HOME/bin/ant ; then
+ return 0
+ fi
+ echo "ant cannot be found under ANT_HOME: $ANT_HOME"
+ fi
+ echo "Valid Environment variable ANT_HOME is not set. Searching..."
+ tmp=`readlink -e $(which ant)`
+ ant_path=`dirname $tmp | sed 's/\/bin$//'`
+ if test "x$ant_path" = "x" ; then
+ echo "Ant not found. Please install Ant and set ANT_HOME."
+ exit 1
+ fi
+ export ANT_HOME=$ant_path
+ return 0
+}
-
+find_anthome
+echo "------------------------------------------------------------"
+echo "Environment variables:"
+echo "ANT_HOME: $ANT_HOME"
+echo "------------------------------------------------------------"
+
+
if test $# -eq 0 ; then
var_for="buildAllLinux"
else
@@ -17,15 +45,10 @@
#
#
cd jp.go.aist.rtm.RTC
-#ant buildAllLinux -lib $ECLIPSE_HOME/plugins/net.sf.ant4eclipse.plugin_0.5.0.rc1/lib/
-ant $var_for -lib $ECLIPSE_HOME/plugins/net.sf.ant4eclipse.plugin_0.5.0.rc1/lib/ -lib $ECLIPSE_HOME/plugins/org.apache.ant_1.7.0.v200803061910/lib
+ant $var_for -lib $ANT_HOME/lib
if [ $? -ne 0 ];
then
exit 1
fi
echo "--"
cd ..
-
-export ANT_HOME=$DUMMY
-
-
Modified: branches/RELENG_1_1/buildTests.sh
===================================================================
--- branches/RELENG_1_1/buildTests.sh 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/buildTests.sh 2015-10-28 09:02:58 UTC (rev 736)
@@ -3,22 +3,48 @@
#
-set DUMMY=$ANT_HOME
-export ANT_HOME=$ECLIPSE_HOME/plugins/org.apache.ant_1.6.5/
+#------------------------------------------------------------
+# find_anthome
+#
+# This function estimate ANT_HOME from ant, which usually
+# is a symbolic link to $ANT_HOME/bin/ant.
+#------------------------------------------------------------
+find_anthome()
+{
+ if test ! "x$ANT_HOME" = "x" ; then
+ if test -d $ANT_HOME && test -f $ANT_HOME/bin/ant ; then
+ return 0
+ fi
+ echo "ant cannot be found under ANT_HOME: $ANT_HOME"
+ fi
+ echo "Valid Environment variable ANT_HOME is not set. Searching..."
+ tmp=`readlink -e $(which ant)`
+ ant_path=`dirname $tmp | sed 's/\/bin$//'`
+ if test "x$ant_path" = "x" ; then
+ echo "Ant not found. Please install Ant and set ANT_HOME."
+ exit 1
+ fi
+ export ANT_HOME=$ant_path
+ return 0
+}
+find_anthome
+
+export JUNIT_HOME=$ANT_HOME/lib
+echo "------------------------------------------------------------"
+echo "Environment variables:"
+echo "ANT_HOME: $ANT_HOME"
+echo "------------------------------------------------------------"
+
+
#
#
#
cd jp.go.aist.rtm.RTC
-ant buildTests -lib $ECLIPSE_HOME/plugins/net.sf.ant4eclipse.plugin_0.5.0.rc1/lib/ -lib $JUNIT_HOME/junit.jar
+ant buildTests -lib $ANT_HOME/lib/
if [ $? -ne 0 ];
then
exit 1
fi
echo "--"
cd ..
-
-set ANT_HOME=$DUMMY
-
-
-
Property changes on: branches/RELENG_1_1/jp.go.aist.rtm.RTC
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/RELENG_1_0/jp.go.aist.rtm.RTC:408-498
/branches/RELENG_1_0_0/jp.go.aist.rtm.RTC:60-401
/branches/work/ConfigurationCallback/jp.go.aist.rtm.RTC:631-635
/branches/work/DesignChangeOfEC/jp.go.aist.rtm.RTC:648-660
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForComponentObserverConsumer/jp.go.aist.rtm.RTC:534-543
/branches/work/ForConfigurationListener/jp.go.aist.rtm.RTC:524-526
/branches/work/ForLogFormat/jp.go.aist.rtm.RTC:518-519
/branches/work/ForPortConnectListener/jp.go.aist.rtm.RTC:528-532
/branches/work/ForSDOServiceAdminClass/jp.go.aist.rtm.RTC:505-507
/branches/work/LoggerService/jp.go.aist.rtm.RTC:666-669
/branches/work/SourceSharing/jp.go.aist.rtm.RTC:591-603
/branches/work/ToGetProperties/jp.go.aist.rtm.RTC:545-548
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
/trunk/jp.go.aist.rtm.RTC:622,630-637,639-658,661,663,670,672-673,678,680-685,688,691-692,695-696,698,707-727
+ /branches/RELENG_1_0/jp.go.aist.rtm.RTC:408-498
/branches/RELENG_1_0_0/jp.go.aist.rtm.RTC:60-401
/branches/work/ConfigurationCallback/jp.go.aist.rtm.RTC:631-635
/branches/work/DesignChangeOfEC/jp.go.aist.rtm.RTC:648-660
/branches/work/ForComponentActionListener/jp.go.aist.rtm.RTC:521-522
/branches/work/ForComponentObserverConsumer/jp.go.aist.rtm.RTC:534-543
/branches/work/ForConfigurationListener/jp.go.aist.rtm.RTC:524-526
/branches/work/ForLogFormat/jp.go.aist.rtm.RTC:518-519
/branches/work/ForPortConnectListener/jp.go.aist.rtm.RTC:528-532
/branches/work/ForSDOServiceAdminClass/jp.go.aist.rtm.RTC:505-507
/branches/work/LoggerService/jp.go.aist.rtm.RTC:666-669
/branches/work/SourceSharing/jp.go.aist.rtm.RTC:591-603
/branches/work/ToGetProperties/jp.go.aist.rtm.RTC:545-548
/branches/work/ToIFR_ID/jp.go.aist.rtm.RTC:509-514
/trunk/jp.go.aist.rtm.RTC:622,630-637,639-658,661,663-665,670,672-675,678,680-685,687-688,691-692,695-696,698,700,707-727
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/build.xml 2015-10-28 09:02:58 UTC (rev 736)
@@ -902,8 +902,12 @@
<target name="compile_tests" description="ソースをコンパイルします">
- <javac srcdir="${source.sdo}:${source.rtc}:${source.rtm}:${source.openrtm}:${source.main}:${source.examples}:${source.test}:${source.tests.bind}" destdir="${build.dir.test}" classpath="lib/commons-cli-1.1.jar:${env.JUNIT_HOME}/junit.jar:" encoding="UTF-8" />
+ <javac srcdir="${source.sdo}:${source.rtc}:${source.rtm}:${source.openrtm}" destdir="${build.dir.test}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" />
+ <javac srcdir="${source.main}" destdir="${build.dir.test}" classpath="lib/commons-cli-1.1.jar" encoding="UTF-8" includes="go/aist/**" excludes="go/aist/ForSunOrb/**,go/aist/ForJacOrb/**"/>
+
+ <javac srcdir="${source.examples}:${source.extension}:${source.test}:${source.tests.bind}" destdir="${build.dir.test}" classpath="lib/commons-cli-1.1.jar:${env.JUNIT_HOME}/junit.jar" encoding="UTF-8" debug="on"/>
+
</target>
@@ -922,19 +926,21 @@
<pathelement location="${env.JUNIT_HOME}/junit.jar"/>
<pathelement location="${env.ANT_HOME}/lib/ant-junit.jar"/>
</classpath>
+ <test name="jp.go.aist.rtm.AllTest110"/>
<!--
<test name="jp.go.aist.rtm.RTC.FactoryTest"/>
<test name="jp.go.aist.rtm.RTC.StateMachineTests"/>
-->
+ <!--
<batchtest todir="${build.dir.test}/reports">
<fileSet dir="${build.dir.test}">
- <include name="jp/go/aist/rtm/RTC/*Test.class" />
<include name="jp/go/aist/rtm/RTC/*Tests.class" />
<include name="jp/go/aist/rtm/RTC/**/*Test.class" />
<include name="jp/go/aist/rtm/RTC/**/*Tests.class" />
<exclude name="jp/go/aist/rtm/RTC/SampleTest.class" />
</fileSet>
</batchtest>
+ -->
</junit>
<echo>All Test complete!</echo>
</target>
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/RTObject_impl.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -1,5 +1,8 @@
package jp.go.aist.rtm.RTC;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.Vector;
import java.util.Set;
import java.lang.reflect.Method;
@@ -24,6 +27,7 @@
import jp.go.aist.rtm.RTC.util.ORBUtil;
import jp.go.aist.rtm.RTC.util.POAUtil;
import jp.go.aist.rtm.RTC.util.Properties;
+import jp.go.aist.rtm.RTC.util.StringUtil;
import jp.go.aist.rtm.RTC.util.ValueHolder;
import jp.go.aist.rtm.RTC.util.equalFunctor;
import jp.go.aist.rtm.RTC.util.operatorFunc;
@@ -656,77 +660,42 @@
if( !m_created ) {
return ReturnCode_t.PRECONDITION_NOT_MET;
}
-
- String ec_args = new String();
- String ec_type = m_properties.getProperty("exec_cxt.periodic.type");
- ec_args += m_properties.getProperty("exec_cxt.periodic.type");
- ec_args += "?";
- ec_args += "rate=" + m_properties.getProperty("exec_cxt.periodic.rate");
-
- ExecutionContextFactory<ExecutionContextBase,String> factory
- = ExecutionContextFactory.instance();
- ExecutionContextBase ec;
- ec = factory.createObject(ec_type);
- if (ec == null) {
- rtcout.println(Logbuf.ERROR,"EC ("
- + ec_type
- + ") creation failed.");
- Set ecs = ExecutionContextFactory.instance().getIdentifiers();
- rtcout.println(Logbuf.DEBUG,"Available EC list: "
- + ecs.toString() );
- return ReturnCode_t.RTC_ERROR;
-/*
- coil::vstring ecs;
- ecs = RTC::ExecutionContextFactory::instance().getIdentifiers();
- RTC_DEBUG(("Available EC list: %s",
- coil::flatten(ecs).c_str()));
- return RTC::RTC_ERROR;
-*/
+ // EC creation
+ ArrayList<Properties> ec_args = new ArrayList<Properties>() ;
+ if (getContextOptions(ec_args)!=ReturnCode_t.RTC_OK )
+ {
+ rtcout.println(Logbuf.ERROR,"Vaild EC options are nao available. Aborting");
+ return ReturnCode_t.BAD_PARAMETER;
+
}
- rtcout.println(Logbuf.DEBUG,"EC (" + ec_type + ") created.");
-// RTC_DEBUG(("EC (%s) created.", ec_type.c_str()));
-/*
- ec = Manager.instance().createContext(ec_args);
- if (ec == null) {
- return ReturnCode_t.RTC_ERROR;
+ if(createContexts(ec_args)!=ReturnCode_t.RTC_OK)
+ {
+ rtcout.println(Logbuf.ERROR,"EC creation failed. Maybe out of resources. Aborting.");
+ return ReturnCode_t.OUT_OF_RESOURCES;
}
-*/
- //ec.getObjRef().set_rate(Double.valueOf(m_properties.getProperty("exec_cxt.periodic.rate")).doubleValue());
- m_eclist.add(ec);
- ExecutionContextService ecv;
- ecv = ec.getObjRef();
- if (ecv == null) {
- rtcout.println(Logbuf.ERROR,
- "Getting object reference of ec failed.");
- return ReturnCode_t.RTC_ERROR;
- }
- double ec_rate = Double.valueOf(m_properties.getProperty("exec_cxt.periodic.rate")).doubleValue();
- ecv.set_rate(ec_rate);
- rtcout.println(Logbuf.DEBUG,"Execution context rate is set to "
- + ec_rate + ".");
- ec.bindComponent(this);
+ // -- entering alive state --
+ rtcout.println(Logbuf.INFO,m_ecMine.value.length
+ + " execution context"
+ + (m_ecMine.value.length == 1 ? "was created." :"s were created." ));
ReturnCode_t ret;
ret = on_initialize();
m_created = false;
if( ret!=ReturnCode_t.RTC_OK ) {
+ rtcout.println(Logbuf.ERROR, "on_Initialize() failed.");
return ret;
}
- // -- entering alive state --
- // at least one EC must be attached
- if (m_ecMine.value.length == 0) {
- rtcout.println(Logbuf.ERROR, "No EC of this RTC.");
- return ReturnCode_t.PRECONDITION_NOT_MET;
- }
+ rtcout.println(Logbuf.DEBUG,"on_initialize() was properly done.");
for(int intIdx=0; intIdx < m_ecMine.value.length; ++intIdx) {
rtcout.println(Logbuf.DEBUG, "EC[" + intIdx + "] starting");
m_ecMine.value[intIdx].start();
}
// ret must be RTC_OK
+ assert(ret == ReturnCode_t.RTC_OK);
return ret;
}
@@ -6138,8 +6107,253 @@
m_actionListeners.ecaction_[ExecutionContextActionListenerType.EC_DETACHED].notify(ec_id);
}
+ protected ReturnCode_t getInheritedECOptions(Properties default_opts){
+ final String inherited_opts[] =
+ {
+ "sync_transition",
+ "sync_activation",
+ "sync_deactivation",
+ "sync_reset",
+ "transition_timeout",
+ "activation_timeout",
+ "deactivation_timeout",
+ "reset_timeout",
+ ""
+ };
+ Properties node = m_properties.findNode("exec_cxt");
+ if (node == null) {
+ rtcout.println(Logbuf.WARN, "No exec_cxt option found.");
+ return ReturnCode_t.RTC_ERROR;
+ }
+ rtcout.println(Logbuf.DEBUG, "Copying inherited EC options.");
+ for (int ic=0; inherited_opts[ic].length()<1; ++ic) {
+ if (node.findNode(inherited_opts[ic]) != null) {
+ rtcout.println(Logbuf.PARANOID, "Option "
+ + inherited_opts[ic]
+ + " exists.");
+ default_opts.setProperty(inherited_opts[ic],
+ node.getProperty(inherited_opts[ic]));
+ }
+ }
+ return ReturnCode_t.RTC_OK;
+ }
+ /**
+ * {@.ja getting individual EC options from RTC's configuration file}
+ * {@.en getting individual EC options from RTC's configuration file}
+ */
+ protected ReturnCode_t
+ getPrivateContextOptions(ArrayList<Properties> ec_args) {
+ rtcout.println(Logbuf.TRACE, "getPrivateContextOptions()");
+ // Component specific multiple EC option available
+ if (m_properties.findNode("execution_contexts") == null) {
+ rtcout.println(Logbuf.DEBUG, "No component specific EC specified.");
+ return ReturnCode_t.RTC_ERROR;
+ }
+ String args = m_properties.getProperty("execution_contexts");
+ ArrayList<String> ecs_tmp
+ = new ArrayList(Arrays.asList(args.split(",")));
+ if (ecs_tmp.isEmpty()) {
+ return ReturnCode_t.RTC_ERROR;
+ }
+ rtcout.println(Logbuf.DEBUG,
+ "Component specific e EC option available,"
+ + args);
+ Properties default_opts = new Properties();
+ getInheritedECOptions(default_opts);
+ for (int ic=0; ic < ecs_tmp.size(); ++ic) {
+ if (StringUtil.normalize(ecs_tmp.get(ic)).equals("none")) {
+ rtcout.println(Logbuf.INFO,
+ "EC none. EC will not be bound to the RTC.");
+ ec_args.clear();
+ return ReturnCode_t.RTC_OK;
+ }
+ ArrayList<String> type_and_name
+ = new ArrayList(Arrays.asList(ecs_tmp.get(ic).split("(")));
+ if (type_and_name.size() > 2) {
+ rtcout.println(Logbuf.DEBUG,
+ "Invalid EC type specified: "
+ + ecs_tmp.get(ic));
+ continue;
+ }
+ Properties prop = default_opts;
+ // create EC's properties
+ prop.setProperty("type",type_and_name.get(0));
+ rtcout.println(Logbuf.DEBUG,
+ "p_type: "
+ + prop.getProperty("type"));
+ Properties p_type
+ = m_properties.findNode("ec." + prop.getProperty("type"));
+ if (p_type != null) {
+ rtcout.println(Logbuf.DEBUG, "p_type props:");
+ String str = new String();
+ str = p_type._dump(str,p_type,0);
+ prop.merge(p_type);
+ }
+ else {
+ rtcout.println(Logbuf.DEBUG, "p_type none");
+ }
+
+ // EC name specified
+ rtcout.println(Logbuf.DEBUG, "size: "
+ + type_and_name.size()
+ + "name: "
+ + type_and_name.get(1));
+ if (type_and_name.size() == 2 &&
+ type_and_name.get(1).charAt(type_and_name.get(1).length() - 1) == ')') {
+ type_and_name.set(1, type_and_name.get(1).substring(type_and_name.get(1).length() - 1));
+ prop.setProperty("name", type_and_name.get(1));
+ Properties p_name
+ = m_properties.findNode("ec." + prop.getProperty("name"));
+ if (p_name != null) {
+ rtcout.println(Logbuf.DEBUG, "p_name props:");
+ String str = new String();
+ str = p_name._dump(str,p_name,0);
+ prop.merge(p_name);
+ }
+ else {
+ rtcout.println(Logbuf.DEBUG, "p_name none");
+ }
+ }
+ ec_args.add(prop);
+ rtcout.println(Logbuf.DEBUG, "New EC properties stored:");
+ String str = new String();
+ str = prop._dump(str,prop,0);
+ }
+ return ReturnCode_t.RTC_OK;
+ }
+
/**
+ * {@.ja getting global EC options from rtc.conf}
+ * {@.en getting global EC options from rtc.conf}
+ */
+ protected ReturnCode_t
+ getGlobalContextOptions(Properties global_ec_props){
+ // exec_cxt option is obsolete
+ rtcout.println(Logbuf.TRACE, "getGlobalContextOptions()");
+
+ Properties prop = m_properties.findNode("exec_cxt.periodic");
+ if (prop == null) {
+ rtcout.println(Logbuf.WARN, "No global EC options found.");
+ return ReturnCode_t.RTC_ERROR;
+ }
+ rtcout.println(Logbuf.DEBUG, "Global EC options are specified.");
+ String str = new String();
+ str = prop._dump(str,prop,0);
+ getInheritedECOptions(global_ec_props);
+ global_ec_props.merge(prop);
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja getting EC options}
+ * {@.en getting EC options}
+ */
+ protected ReturnCode_t
+ getContextOptions(ArrayList<Properties> ec_args) {
+ rtcout.println(Logbuf.TRACE, "getContextOptions()");
+ Properties global_props = new Properties();
+ ReturnCode_t ret_global = getGlobalContextOptions(global_props);
+ ReturnCode_t ret_private = getPrivateContextOptions(ec_args);
+
+ // private(X), global(X) -> error
+ // private(O), global(O) -> private
+ // private(X), global(O) -> global
+ // private(O), global(X) -> private
+ if (ret_global != ReturnCode_t.RTC_OK
+ && ret_private != ReturnCode_t.RTC_OK) {
+ return ReturnCode_t.RTC_ERROR;
+ }
+ if (ret_global == ReturnCode_t.RTC_OK
+ && ret_private != ReturnCode_t.RTC_OK) {
+ ec_args.add(global_props);
+ }
+ return ReturnCode_t.RTC_OK;
+ }
+
+ /**
+ * {@.ja fiding existing EC from the factory}
+ * {@.en fiding existing EC from the factory}
+ */
+ protected ReturnCode_t findExistingEC(Properties ec_arg,
+ ExecutionContextBase ec){
+ ArrayList<ExecutionContextBase> eclist;
+ eclist = ExecutionContextFactory.instance().createdObjects();
+ for (int ic=0; ic < eclist.size(); ++ic) {
+ if (eclist.get(ic).getProperties().getProperty("type").equals(ec_arg.getProperty("type")) &&
+ eclist.get(ic).getProperties().getProperty("name").equals(ec_arg.getProperty("name"))) {
+ ec = eclist.get(ic);
+ return ReturnCode_t.RTC_OK;
+ }
+ }
+ return ReturnCode_t.RTC_ERROR;
+ }
+ /**
+ * {@.ja creating, initializing and binding context}
+ * {@.en creating, initializing and binding context}
+ */
+ protected ReturnCode_t createContexts(ArrayList<Properties> ec_args){
+ ReturnCode_t ret = ReturnCode_t.RTC_OK;
+ Set<String> avail_ec
+ = ExecutionContextFactory.instance().getIdentifiers();
+
+ for (int ic=0; ic < ec_args.size(); ++ic) {
+ String ec_type = ec_args.get(ic).getProperty("type");
+ String ec_name = ec_args.get(ic).getProperty("name");
+ ExecutionContextBase ec = null;
+ // if EC's name exists, find existing EC in the factory.
+ if (!(ec_name.length()<1) &&
+ findExistingEC(ec_args.get(ic), ec) == ReturnCode_t.RTC_OK) {
+ rtcout.println(Logbuf.DEBUG, "EC: type="
+ + ec_type
+ + ", name="
+ + ec_name
+ + " already exists.");
+ }
+ // If EC's name is empty or no existing EC, create new EC.
+ else { // If EC's name is empty or no existing EC, create new EC.
+ boolean find_flag = false;
+ Iterator it = avail_ec.iterator();
+ while (it.hasNext()) {
+ if(it.next().equals(ec_type)){
+ find_flag= true;
+ }
+ }
+ if (!find_flag) {
+ rtcout.println(Logbuf.WARN, "EC: "
+ + ec_type
+ + " is not available.");
+ rtcout.println(Logbuf.DEBUG, "Available ECs: "
+ + avail_ec.toString());
+ continue;
+ }
+ ExecutionContextFactory<ExecutionContextBase,String> factory
+ = ExecutionContextFactory.instance();
+ ec = factory.createObject(ec_type);
+
+ }
+
+ // EC factory available but creation failed. Resource full?
+ if (ec == null) {
+ rtcout.println(Logbuf.ERROR, "EC ("
+ + ec_type
+ + ") creation failed.");
+ rtcout.println(Logbuf.DEBUG, "Available EC list: "
+ + avail_ec.toString());
+ ret = ReturnCode_t.RTC_ERROR;
+ continue;
+ }
+ rtcout.println(Logbuf.DEBUG, "EC ("
+ + ec_type
+ + ") created.");
+
+ ec.init(ec_args.get(ic));
+ m_eclist.add(ec);
+ ec.bindComponent(this);
+ }
+ return ret;
+ }
+ /**
* {@.ja マネージャオブジェクト}
* {@.en Manager object}
*/
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextBase.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -8,7 +8,9 @@
import jp.go.aist.rtm.RTC.RTObject_impl;
import jp.go.aist.rtm.RTC.util.Properties;
import RTC.ExecutionKind;
+import RTC.LightweightRTObject;
import RTC.ReturnCode_t;
+import RTC.RTObject;
/**
* <p>Periodic Sampled Data Processing(周期実行用)ExecutionContextのベースとなる
@@ -154,6 +156,108 @@
return m_profile.getKindString(kind);
}
*/
+ /**
+ * {@.ja ExecutionKind を設定する
+ * {@.en Set the ExecutionKind}
+ * <p>
+ * {@.ja この ExecutionContext の ExecutionKind を設定する}
+ * {@.en This operation sets the kind of the execution context.}
+ *
+ * @param kind
+ * {@.ja ExecutionKind}
+ * {@.en ExecutionKind}
+ */
+ public ReturnCode_t setKind(ExecutionKind kind);
+
+ /**
+ * {@.ja Ownerコンポーネントをセットする。}
+ * {@.en Setting owner component of the execution context}
+ * <p>
+ * {@.ja このECのOwnerとなるRTCをセットする。}
+ * {@.en This function sets an RT-Component to be owner of
+ * the execution context.}
+ *
+ * @param comp
+ * {@.ja OwnerとなるRTコンポーネント}
+ * {@.en an owner RT-Component of this execution context}
+ * @return
+ * {@.ja ReturnCode_t 型のリターンコード}
+ * {@.en The return code of ReturnCode_t type}
+ */
+ public ReturnCode_t setOwner(LightweightRTObject comp);
+
+ /**
+ * {@.ja Ownerコンポーネントの参照を取得する}
+ * {@.en Getting a reference of the owner component}
+ * <p>
+ * {@.ja このECのOwnerであるRTCの参照を取得する。}
+ * {@.en This function returns a reference of the owner RT-Component of
+ * this execution context}
+ *
+ * @return
+ * {@.ja OwnerRTコンポーネントの参照}
+ * {@.en a reference of the owner RT-Component}
+ */
+ public RTObject getOwner();
+
+ /**
+ * {@.ja RTコンポーネントの参加者リストを取得する}
+ * {@.en Getting participant RTC list}
+ * <p>
+ * {@.ja 現在登録されている参加者RTCのリストを取得する。}
+ * {@.en This function returns a list of participant RTC of
+ * the execution context.}
+ *
+ * @return
+ * {@.ja 参加者RTCのリスト}
+ * {@.en Participants RTC list}
+ *
+ */
+ public RTObject[] getComponentList();
+
+ /**
+ * {@.ja Propertiesをセットする}
+ * {@.en Setting Properties}
+ * <p>
+ * {@.ja ExecutionContextProfile::properties をセットする。}
+ * {@.en This function sets ExecutionContextProfile::properties by
+ * coil::Properties.}
+ *
+ * @param props
+ * {@.ja ExecutionContextProfile::properties にセットするプロパティー}
+ * {@.en Properties to be set to ExecutionContextProfile::properties.}
+ *
+ */
+ public void setProperties(Properties props);
+
+ /**
+ * {@.ja Propertiesを取得する}
+ * {@.en Setting Properties}
+ * <p>
+ * {@.ja ExecutionContextProfile::properties を取得する。}
+ * {@.en This function sets ExecutionContextProfile::properties by
+ * coil::Properties.}
+ *
+ * @return
+ * {@.ja Propertiesに変換された ExecutionContextProfile::properties}
+ * {@.en Properties to be set to ExecutionContextProfile::properties.}
+ *
+ */
+ public Properties getProperties();
+
+ /**
+ * {@.ja Profileを取得する}
+ * {@.en Getting Profile}
+ * <p>
+ * {@.ja ExecutionContextProfile を取得する。}
+ * {@.en This function gets RTC::ExecutionContextProfile.}
+ *
+ * @return
+ * {@.ja RTC.ExecutionContextProfile}
+ * {@.en RTC.ExecutionContextProfile}
+ *
+ */
+ public RTC.ExecutionContextProfile getProfile() ;
public boolean finalizeExecutionContext();
// public abstract boolean finalizeExecutionContext();
/*
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExecutionContextProfile.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -64,14 +64,18 @@
* {@.ja CORBA オブジェクトの設定}
* {@.en Sets the reference to the CORBA object}
* <p>
- * {@.ja 本オブジェクトの ExecutioncontextService としての CORBA オブジェ
- * クトを設定する。}
- * {@.en Sets the reference to the CORBA object as
- * ExecutioncontextService of this object.}
+ * {@ja .ExecutioncontextService の CORBA オブジェクト参照をセットする。
+ * セットされると、それまでセットされていたオブジェクト参照は
+ * releaseされる。セットするオブジェクト参照は有効な参照でなければ
+ * ならない。}
+ * {@.en This operation sets a object reference to
+ * ExecutionContextService. After setting a new object reference,
+ * old reference is released. The object reference have to be
+ * valid reference.}
*
* @param ec_ptr
- * {@.ja オブジェクトリファレンス}
- * {@.en The object reference}
+ * {@.ja ExecutionContextServiceのCORBAオブジェクト}
+ * {@.en A CORBA object reference of ExecutionContextService}
*/
public void setObjRef(ExecutionContextService ec_ptr){
rtcout.println(Logbuf.TRACE, "setObjRef()");
@@ -129,7 +133,7 @@
*
*/
public ReturnCode_t setRate(double rate) {
- rtcout.println(Logbuf.TRACE, "set_rate("+rate+")");
+ rtcout.println(Logbuf.TRACE, "setRate("+rate+")");
if (rate < 0.0) {
return ReturnCode_t.BAD_PARAMETER;
}
@@ -180,13 +184,11 @@
*
*/
public double getRate() {
- rtcout.println(Logbuf.TRACE, "get_rate()");
synchronized (m_profile){
return m_profile.rate;
}
}
public TimeValue getPeriod(){
- rtcout.println(Logbuf.TRACE, "getPeriod()");
synchronized (m_profile){
return m_period;
}
@@ -255,9 +257,11 @@
* {@.en ExecutionKind}
*/
public ExecutionKind getKind() {
- rtcout.println(Logbuf.TRACE, getKindString(m_profile.kind)
+ synchronized (m_profile) {
+ rtcout.println(Logbuf.TRACE, getKindString(m_profile.kind)
+ " = getKind()");
- return m_profile.kind;
+ return m_profile.kind;
+ }
}
/**
@@ -285,10 +289,12 @@
rtobj = RTObjectHelper.narrow(comp);
if (rtobj==null) {
rtcout.println(Logbuf.ERROR,"Narrowing failed.");
- return ReturnCode_t.RTC_ERROR;
+ return ReturnCode_t.BAD_PARAMETER;
}
- m_profile.owner = (RTObject)rtobj._duplicate();
- return ReturnCode_t.RTC_OK;
+ synchronized (m_profile) {
+ m_profile.owner = (RTObject)rtobj._duplicate();
+ return ReturnCode_t.RTC_OK;
+ }
}
/**
@@ -305,7 +311,9 @@
*/
public final RTObject getOwner() {
rtcout.println(Logbuf.TRACE, "getOwner()");
- return (RTObject)m_profile.owner._duplicate();
+ synchronized (m_profile) {
+ return (RTObject)m_profile.owner._duplicate();
+ }
}
/**
@@ -343,10 +351,12 @@
rtcout.println(Logbuf.ERROR,"Narrowing was failed.");
return ReturnCode_t.RTC_ERROR;
}
- RTCListHolder holder = new RTCListHolder(m_profile.participants);
- CORBA_SeqUtil.push_back(holder, rtobj);
- m_profile.participants = holder.value;
- return ReturnCode_t.RTC_OK;
+ synchronized (m_profile) {
+ RTCListHolder holder = new RTCListHolder(m_profile.participants);
+ CORBA_SeqUtil.push_back(holder, rtobj);
+ m_profile.participants = holder.value;
+ return ReturnCode_t.RTC_OK;
+ }
}
/**
@@ -404,9 +414,17 @@
* {@.ja RTコンポーネントの参加者リストを取得する}
* {@.en Getting participant RTC list}
* <p>
- * {@.ja 現在登録されている参加者RTCのリストを取得する。}
- * {@.en This function returns a list of participant RTC of the
- * execution context.}
+ * {@.ja 現在登録されている参加者RTCのリストを取得する。この関数はコンポー
+ * ネントリストのメンバ変数への参照を返すので、リスト使用前に
+ * ExecutionContextProfile::lock() でロックし、リスト使用後は
+ * ExecutionContextProfile::unlock() でロックを開放しなければならな
+ * い。}
+ * {@.en This function returns a list of participant RTC of the
+ * execution context. Since the function returns a reference to
+ * the member variable of component list, user have to lock by
+ * ExecutionContextProfile::lock() before using the list, and user
+ * also have to release the unlock by
+ * ExecutionContextProfile::unlock().}
*
* @return
* {@.ja 参加者RTCのリスト}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/ExtTrigExecutionContext.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -1163,5 +1163,123 @@
public final String getKindString(ExecutionKind kind) {
return m_profile.getKindString(kind);
}
+ /**
+ * {@.ja ExecutionKind を設定する}
+ * {@.en Set the ExecutionKind}
+ * <p>
+ * {@.ja この ExecutionContext の ExecutionKind を設定する}
+ * {@.en This operation sets the kind of the execution context.}
+ *
+ * @param kind
+ * {@.ja ExecutionKind}
+ * {@.en kind ExecutionKind}
+ *
+ */
+ public ReturnCode_t setKind(ExecutionKind kind) {
+ return m_profile.setKind(kind);
+ }
+ /**
+ * {@.ja Ownerコンポーネントをセットする。}
+ * {@.en Setting owner component of the execution context}
+ * <p>
+ * {@.ja このECのOwnerとなるRTCをセットする。}
+ * {@.en This function sets an RT-Component to be owner of
+ * the execution context.}
+ *
+ * @param comp
+ * {@.ja OwnerとなるRTコンポーネント}
+ * {@.en an owner RT-Component of this execution context}
+ * @return
+ * {@.ja ReturnCode_t 型のリターンコード}
+ * {@.en The return code of ReturnCode_t type}
+ */
+ public ReturnCode_t setOwner(LightweightRTObject comp){
+ return m_profile.setOwner(comp);
+ }
+
+ /**
+ * {@.ja Ownerコンポーネントの参照を取得する}
+ * {@.en Getting a reference of the owner component}
+ * <p>
+ * {@.ja このECのOwnerであるRTCの参照を取得する。}
+ * {@.en This function returns a reference of the owner RT-Component of
+ * this execution context}
+ *
+ * @return
+ * {@.ja OwnerRTコンポーネントの参照}
+ * {@.en a reference of the owner RT-Component}
+ */
+ public RTC.RTObject getOwner() {
+ return m_profile.getOwner();
+ }
+
+ /**
+ * {@.ja RTコンポーネントの参加者リストを取得する}
+ * {@.en @brief Getting participant RTC list}
+ * <p>
+ * {@.ja 現在登録されている参加者RTCのリストを取得する。}
+ * {@.en This function returns a list of participant RTC of
+ * the execution context.}
+ *
+ * @return
+ * {@.ja 参加者RTCのリスト}
+ * {@.en Participants RTC list}
+ *
+ */
+ public RTC.RTObject[] getComponentList(){
+ return m_profile.getComponentList();
+ }
+
+
+ /**
+ * {@.ja Propertiesをセットする}
+ * {@.en Setting Properties}
+ * <p>
+ * {@.ja ExecutionContextProfile::properties をセットする。}
+ * {@.en This function sets ExecutionContextProfile::properties by
+ * Properties.}
+ *
+ * @param props
+ * {@.ja ExecutionContextProfile::properties にセットするプロパティー}
+ * {@.en Properties to be set to ExecutionContextProfile::properties.}
+ *
+ */
+ public void setProperties(Properties props){
+ m_profile.setProperties(props);
+ }
+
+ /**
+ * {@.ja Propertiesを取得する}
+ * {@.en Setting Properties}
+ * <p>
+ * {@.ja ExecutionContextProfile::properties を取得する。}
+ * {@.en This function sets ExecutionContextProfile::properties by
+ * Properties.}
+ *
+ * @return
+ * {@.ja Propertiesに変換された ExecutionContextProfile::properties}
+ * {@.en Properties to be set to ExecutionContextProfile::properties.}
+ *
+ */
+ public Properties getProperties() {
+ return m_profile.getProperties();
+ }
+
+ /**
+ * {@.ja rofileを取得する}
+ * {@.en Getting Profile}
+ * <p>
+ * {@.ja ExecutionContextProfile を取得する。}
+ * {@.en This function gets ExecutionContextProfile.}
+ *
+ * @return
+ * {@.ja ExecutionContextProfile}
+ * {@.en ExecutionContextProfile}
+ *
+ */
+ public RTC.ExecutionContextProfile getProfile(){
+ return m_profile.getProfile();
+ }
+
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContext.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -375,11 +375,6 @@
rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_rate()");
return m_profile.getRate();
-/*
- synchronized (m_profile) {
- return m_profile.rate;
- }
-*/
}
/**
@@ -394,11 +389,6 @@
if( rate<=0.0 ) return ReturnCode_t.BAD_PARAMETER;
m_profile.setRate(rate);
-/*
- synchronized (m_profile) {
- m_profile.rate = rate;
- }
-*/
this.m_usec = (long)(1000000/rate);
if( m_usec == 0 ) {
m_nowait = true;
@@ -521,7 +511,6 @@
+ m_profile.getKindString());
return m_profile.getKind();
- //return m_profile.kind;
}
/**
@@ -566,7 +555,9 @@
return ReturnCode_t.BAD_PARAMETER;
}
//
- int id = dfp.attach_context(m_ref);
+ //int id = dfp.attach_context(m_ref);
+ ExecutionContextService ec = m_profile.getObjRef();
+ int id = dfp.attach_context(ec);
//
m_comps.add(new Comp((LightweightRTObject)comp._duplicate(),
(DataFlowComponent)dfp._duplicate(), id));
@@ -611,7 +602,9 @@
DataFlowComponent dfp;
dfp = DataFlowComponentHelper.narrow(comp);
- int id = rtc.bindContext(m_ref);
+ ExecutionContextService ec = m_profile.getObjRef();
+ int id = rtc.bindContext(ec);
+ //int id = rtc.bindContext(m_ref);
if (id < 0 || id > RTObject_impl.ECOTHER_OFFSET) {
rtcout.println(Logbuf.ERROR, "bindContext returns invalid id: "+id);
return ReturnCode_t.RTC_ERROR;
@@ -621,7 +614,6 @@
(DataFlowComponent)dfp._duplicate(),
id));
m_profile.setOwner((LightweightRTObject)dfp._duplicate());
- //m_profile.owner = (DataFlowComponent)dfp._duplicate();
return ReturnCode_t.RTC_OK;
@@ -668,27 +660,6 @@
rtcout.println(Logbuf.TRACE,
"remove_component(): an RTC removed from this context.");
m_profile.removeComponent(comp);
-/*
- RTC.RTObject rtcomp = RTC.RTObjectHelper.narrow(comp);
- if(rtcomp == null){
- rtcout.println(Logbuf.ERROR,"Invalid object reference.");
- return ReturnCode_t.RTC_ERROR;
- }
- synchronized (m_profile) {
- long index;
- RTC.RTCListHolder holder
- = new RTC.RTCListHolder(m_profile.participants);
- index = CORBA_SeqUtil.find(holder, new is_equiv(rtcomp));
-
- if (index < 0) { // not found in my list
- rtcout.println(Logbuf.ERROR, "Not found.");
- return ReturnCode_t.BAD_PARAMETER;
- }
-
- CORBA_SeqUtil.erase(holder, (int)index);
- m_profile.participants = holder.value;
- }
-*/
return ReturnCode_t.RTC_OK;
}
}
@@ -708,13 +679,6 @@
rtcout.println(Logbuf.TRACE, "PeriodicExecutionContext.get_profile()");
return m_profile.getProfile();
-/*
- ExecutionContextProfileHolder p;
- synchronized (m_profile) {
- p = new ExecutionContextProfileHolder(m_profile);
- }
- return p.value;
-*/
}
/**
@@ -1300,4 +1264,122 @@
public final String getKindString(ExecutionKind kind) {
return m_profile.getKindString(kind);
}
+ /**
+ * {@.ja ExecutionKind を設定する}
+ * {@.en Set the ExecutionKind}
+ * <p>
+ * {@.ja この ExecutionContext の ExecutionKind を設定する}
+ * {@.en This operation sets the kind of the execution context.}
+ *
+ * @param kind
+ * {@.ja ExecutionKind}
+ * {@.en kind ExecutionKind}
+ *
+ */
+ public ReturnCode_t setKind(ExecutionKind kind) {
+ return m_profile.setKind(kind);
+ }
+
+ /**
+ * {@.ja Ownerコンポーネントをセットする。}
+ * {@.en Setting owner component of the execution context}
+ * <p>
+ * {@.ja このECのOwnerとなるRTCをセットする。}
+ * {@.en This function sets an RT-Component to be owner of
+ * the execution context.}
+ *
+ * @param comp
+ * {@.ja OwnerとなるRTコンポーネント}
+ * {@.en an owner RT-Component of this execution context}
+ * @return
+ * {@.ja ReturnCode_t 型のリターンコード}
+ * {@.en The return code of ReturnCode_t type}
+ */
+ public ReturnCode_t setOwner(LightweightRTObject comp){
+ return m_profile.setOwner(comp);
+ }
+
+ /**
+ * {@.ja Ownerコンポーネントの参照を取得する}
+ * {@.en Getting a reference of the owner component}
+ * <p>
+ * {@.ja このECのOwnerであるRTCの参照を取得する。}
+ * {@.en This function returns a reference of the owner RT-Component of
+ * this execution context}
+ *
+ * @return
+ * {@.ja OwnerRTコンポーネントの参照}
+ * {@.en a reference of the owner RT-Component}
+ */
+ public RTC.RTObject getOwner() {
+ return m_profile.getOwner();
+ }
+
+ /**
+ * {@.ja RTコンポーネントの参加者リストを取得する}
+ * {@.en @brief Getting participant RTC list}
+ * <p>
+ * {@.ja 現在登録されている参加者RTCのリストを取得する。}
+ * {@.en This function returns a list of participant RTC of
+ * the execution context.}
+ *
+ * @return
+ * {@.ja 参加者RTCのリスト}
+ * {@.en Participants RTC list}
+ *
+ */
+ public RTC.RTObject[] getComponentList(){
+ return m_profile.getComponentList();
+ }
+
+
+ /**
+ * {@.ja Propertiesをセットする}
+ * {@.en Setting Properties}
+ * <p>
+ * {@.ja ExecutionContextProfile::properties をセットする。}
+ * {@.en This function sets ExecutionContextProfile::properties by
+ * Properties.}
+ *
+ * @param props
+ * {@.ja ExecutionContextProfile::properties にセットするプロパティー}
+ * {@.en Properties to be set to ExecutionContextProfile::properties.}
+ *
+ */
+ public void setProperties(Properties props){
+ m_profile.setProperties(props);
+ }
+
+ /**
+ * {@.ja Propertiesを取得する}
+ * {@.en Setting Properties}
+ * <p>
+ * {@.ja ExecutionContextProfile::properties を取得する。}
+ * {@.en This function sets ExecutionContextProfile::properties by
+ * Properties.}
+ *
+ * @return
+ * {@.ja Propertiesに変換された ExecutionContextProfile::properties}
+ * {@.en Properties to be set to ExecutionContextProfile::properties.}
+ *
+ */
+ public Properties getProperties() {
+ return m_profile.getProperties();
+ }
+
+ /**
+ * {@.ja rofileを取得する}
+ * {@.en Getting Profile}
+ * <p>
+ * {@.ja ExecutionContextProfile を取得する。}
+ * {@.en This function gets ExecutionContextProfile.}
+ *
+ * @return
+ * {@.ja ExecutionContextProfile}
+ * {@.en ExecutionContextProfile}
+ *
+ */
+ public RTC.ExecutionContextProfile getProfile(){
+ return m_profile.getProfile();
+ }
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/log/Logbuf.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -1,7 +1,9 @@
package jp.go.aist.rtm.RTC.log;
+import java.text.DecimalFormat;
import java.util.Date;
import java.util.IllegalFormatException;
+import java.util.Locale;
import java.util.Vector;
import java.util.logging.Formatter;
import java.util.logging.Handler;
@@ -43,6 +45,9 @@
public static final String VERBOSE_H = "VERBOSE :";
public static final String PARANOID_H = "PARANOID :";
+ private int TIME_CONV_UNIT = 1000;
+ private double DELTA_TIME = 0.000000000005;
+
/**
* <p>デフォルトコンストラクタです。</p>
* Manager.* としてロガーを作成する。
@@ -56,7 +61,7 @@
m_clock = ClockManager.getInstance().getClock("system");
if(Manager.isActive() ) {
if( Manager.instance().getConfig().getNode("logger.date_format")!=null ) {
- setDateFormat(Manager.instance().getConfig().getProperty("logger.date_format"));
+ setDateFormat(Manager.instance().getConfig().getProperty("logger.date_format"));
}
if( Manager.instance().getConfig().getNode("logger.clock_type")!=null ) {
setClockType(Manager.instance().getConfig().getProperty("logger.clock_type"));
@@ -165,11 +170,13 @@
protected String getDate() {
//桁落ちを防ぐために微少値を加算
- long sec = (long)(m_clock.getTime().toDouble()*1000+0.0000005);
- Date date = new Date(sec);
+// long sec = (long)(m_clock.getTime().toDouble()*1000+0.000000000005);
+// Date date = new Date(sec);
StringBuilder sb = new StringBuilder();
- java.util.Formatter formatter = new java.util.Formatter(sb, java.util.Locale.US);
- return formatter.format(m_dateFormat,date,date,date,date,date,date,date,date,date,date).toString();
+// java.util.Formatter formatter = new java.util.Formatter(sb, java.util.Locale.US);
+// return formatter.format(m_dateFormat,date,date,date,date,date,date,date,date,date,date).toString();
+ TimeFormatter formatter = new TimeFormatter(sb, java.util.Locale.US);
+ return formatter.format(m_dateFormat, m_clock);
}
/**
@@ -477,11 +484,11 @@
* {@.en A clock type above mentioned.}
*/
public void setClockType(String clocktype) {
- m_clock = ClockManager.getInstance().getClock(clocktype);
- //論理時間の場合は出力書式のデフォルト設定を変更
- if(m_clock instanceof LogicalClock) {
- setDateFormat("%S %L");
- }
+ m_clock = ClockManager.getInstance().getClock(clocktype);
+ //論理時間の場合は出力書式のデフォルト設定を変更
+ if(m_clock instanceof LogicalClock) {
+ setDateFormat("%S %L");
+ }
}
/**
@@ -539,7 +546,7 @@
*/
private static boolean m_Enabled = false;
- class NullHandler extends Handler{
+ private class NullHandler extends Handler{
public void close() {
}
public void flush() {
@@ -547,5 +554,38 @@
public void publish(LogRecord record){
}
}
+
+ private class TimeFormatter {
+ private java.util.Formatter formatter;
+
+ public TimeFormatter(StringBuilder sb, Locale local ) {
+ formatter = new java.util.Formatter(sb, local);
+ }
+
+ public String format(String format, IClock clock) {
+ String result = "";
+ TimeValue time = clock.getTime();
+
+ if(format.contains("%tN")) {
+ long mc = time.getUsec()%TIME_CONV_UNIT;
+ String strmc = "";
+ try {
+ DecimalFormat df = new DecimalFormat();
+ df.applyPattern("0");
+ df.setMaximumIntegerDigits(3);
+ df.setMinimumIntegerDigits(3);
+ strmc = df.format(mc);
+ } catch(Exception e) {
+ strmc = Long.valueOf(mc).toString();
+ }
+ format = format.replace("%tN", strmc);
+ }
+ long sec = (long)(time.toDouble()*TIME_CONV_UNIT+DELTA_TIME);
+ Date date = new Date(sec);
+ result = formatter.format(format,date,date,date,date,date,date,date,date,date,date).toString();
+
+ return result;
+ }
+ }
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/AdjustedClock.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -12,19 +12,17 @@
* {@.en This class stores a offset time with current system clock when
* settime(), and gettime() returns adjusted clock by the offset.}
*/
-public class AdjustedClock implements IClock {
+public class AdjustedClock extends SystemClock {
private TimeValue m_offset;
public AdjustedClock() {
+ super();
m_offset = new TimeValue(0.0);
}
public TimeValue getTime() {
synchronized (m_offset) {
- long msec = System.currentTimeMillis();
- long sec = msec/1000;
- long usec = (msec - sec*1000)*1000;
- TimeValue base = new TimeValue(sec, usec);
+ TimeValue base = super.getTime();
return base.minus(m_offset);
}
}
@@ -32,10 +30,11 @@
public boolean setTime(TimeValue clocktime) {
synchronized (m_offset) {
long msec = System.currentTimeMillis();
- long sec = msec/1000;
- long usec = (msec - sec*1000)*1000;
+ long sec = msec/TIME_CONV_UNIT;
+ long usec = (msec - sec*TIME_CONV_UNIT)*TIME_CONV_UNIT;
TimeValue base = new TimeValue(sec, usec);
m_offset = base.minus(clocktime);
+ nanoBase = System.nanoTime();
}
return true;
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/clock/SystemClock.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -11,11 +11,28 @@
* {@.en This class sets and gets system clock.}
*/
public class SystemClock implements IClock {
+ protected int TIME_CONV_UNIT = 1000;
+
+ protected long nanoBase;
+ private long prevmcSec;
+ private long nanoOffset;
+
+ public SystemClock() {
+ nanoBase = System.nanoTime();
+ nanoOffset = 0;
+ }
public TimeValue getTime() {
long msec = System.currentTimeMillis();
- long sec = msec/1000;
- long usec = (msec - sec*1000)*1000;
+ long diffNano = System.nanoTime() - nanoBase;
+ //
+ long sec = msec/TIME_CONV_UNIT;
+ if(prevmcSec!=msec) {
+ prevmcSec = msec;
+ nanoOffset = diffNano;
+ }
+ long modNano = ((diffNano-nanoOffset)%(TIME_CONV_UNIT*TIME_CONV_UNIT))/TIME_CONV_UNIT;
+ long usec = (msec - sec*TIME_CONV_UNIT)*TIME_CONV_UNIT + modNano;
TimeValue base = new TimeValue(sec, usec);
return base;
}
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java (from rev 687, trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTest110.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -0,0 +1,23 @@
+package jp.go.aist.rtm;
+
+import jp.go.aist.rtm.RTC.log.LogBufTimeTest;
+import jp.go.aist.rtm.RTC.log.LogbufTest;
+import jp.go.aist.rtm.RTC.util.AdjustedClockTest;
+import jp.go.aist.rtm.RTC.util.TimeValueTest;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTest110 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for 1.1.0");
+
+ suite.addTestSuite(TimeValueTest.class);
+ suite.addTestSuite(LogbufTest.class);
+ suite.addTestSuite(AdjustedClockTest.class);
+
+ suite.addTestSuite(LogBufTimeTest.class);
+
+ return suite;
+ }
+}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTests.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTests.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/AllTests.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -6,7 +6,6 @@
import jp.go.aist.rtm.RTC.ConsoleInTest;
import jp.go.aist.rtm.RTC.ConsoleOutTest;
import jp.go.aist.rtm.RTC.CorbaNamingTest;
-import jp.go.aist.rtm.RTC.CorbaObjectManagerTest;
import jp.go.aist.rtm.RTC.FactoryTest;
import jp.go.aist.rtm.RTC.ManagerConfigTest;
import jp.go.aist.rtm.RTC.ManagerTest;
@@ -75,7 +74,6 @@
suite.addTestSuite(ConfigTest.class);
suite.addTestSuite(CorbaConsumerTest.class);
suite.addTestSuite(CorbaNamingTest.class);
- suite.addTestSuite(CorbaObjectManagerTest.class);
suite.addTestSuite(CorbaPortTest.class);
suite.addTestSuite(DataHolderTest.class);
suite.addTestSuite(DataInPortTest.class);
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConfigSampleTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConfigSampleTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConfigSampleTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -67,7 +67,6 @@
}
protected void tearDown() throws Exception {
for(int intIdx=0;intIdx<manager.m_ecs.size();intIdx++) {
- manager.m_ecs.elementAt(intIdx).stop();
Thread.yield();
}
Thread.sleep(300);
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConsoleInTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConsoleInTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConsoleInTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -61,7 +61,6 @@
}
protected void tearDown() throws Exception {
for(int intIdx=0;intIdx<manager.m_ecs.size();intIdx++) {
- manager.m_ecs.elementAt(intIdx).stop();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConsoleOutTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConsoleOutTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ConsoleOutTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -61,7 +61,6 @@
}
protected void tearDown() throws Exception {
for(int intIdx=0;intIdx<manager.m_ecs.size();intIdx++) {
- manager.m_ecs.elementAt(intIdx).stop();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/CorbaNamingTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/CorbaNamingTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/CorbaNamingTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -93,7 +93,6 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
naming.bindByString("localhost3.host_cxt/mgr3.mgr_cxt/sample3.rtc", rtobj.getObjRef());
@@ -156,7 +155,6 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
// オブジェクトをバインドし、それが正しく設定されるか?
@@ -185,7 +183,6 @@
naming.init("localhost:2809");
assertNotNull(naming.m_rootContext);
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
naming.rebindByString("localhost.host_cxt/mgr.mgr_cxt/sample.rtc", rtobj.getObjRef());
@@ -243,7 +240,6 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
final String fullName0 = "id0-lv0.kind0-lv0/id0-lv1.kind0-lv1";
@@ -274,7 +270,6 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
// オブジェクトをバインドし、それが正しく設定されるか?
@@ -308,7 +303,6 @@
naming.init("localhost:2809");
assertNotNull(naming.m_rootContext);
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
naming.bindByString("localhost.host_cxt", rtobj.getObjRef());
// naming.bindByString("localhost.host_cxt", rtobj.getObjRef());
@@ -345,11 +339,9 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
rtobj2 = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj2);
assertNotNull(rtobj2.getObjRef());
// オブジェクトをバインドし、それが正しく設定されるか?
@@ -379,10 +371,8 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
rtobj2= new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj2);
assertNotNull(rtobj2.getObjRef());
// オブジェクトをバインドし、それが正しく設定されるか?
@@ -422,11 +412,9 @@
// テスト用にバインドするオブジェクトを作成しておく
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
rtobj2 = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj2);
assertNotNull(rtobj2.getObjRef());
// 1つ目のオブジェクトをバインドする
@@ -455,7 +443,6 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
// テストに用いるコンテキストを準備しておく
@@ -499,7 +486,6 @@
// バインドするコンテキストを作成しておく
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
NamingContext nc = naming.newContext();
@@ -531,10 +517,8 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
rtobj2 = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj2);
assertNotNull(rtobj2.getObjRef());
NamingContext nc1 = naming.newContext();
@@ -581,11 +565,9 @@
// テストに用いるコンテキストを準備しておく
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
rtobj2 = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj2);
assertNotNull(rtobj2.getObjRef());
NamingContext nc1 = naming.newContext();
@@ -623,7 +605,6 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
// オブジェクトをバインドする
@@ -661,7 +642,6 @@
naming.init("localhost:2809");
assertNotNull(naming.m_rootContext);
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
naming.rebindByString("localhost2.host_cxt2/mgr2/sample2.rtc2", rtobj.getObjRef());
@@ -884,7 +864,6 @@
try {
naming.init("localhost:2809");
rtobj = new RTObject_impl(manager);
- manager.m_objManager.activate(rtobj);
assertNotNull(rtobj.getObjRef());
// 新しいコンテキストをバインドできるか?
Deleted: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/CorbaObjectManagerTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/CorbaObjectManagerTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/CorbaObjectManagerTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -1,112 +0,0 @@
-package jp.go.aist.rtm.RTC;
-
-import junit.framework.TestCase;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.ORBPackage.InvalidName;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.POAManager;
-import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
-import org.omg.PortableServer.POAPackage.ObjectNotActive;
-import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
-import org.omg.PortableServer.POAPackage.ServantNotActive;
-import org.omg.PortableServer.POAPackage.WrongPolicy;
-
-/**
-*
-* CORBAオブジェクトマネージャクラス テスト
-* 対象クラス:CorbaObjectManager
-*
-*/
-public class CorbaObjectManagerTest extends TestCase {
- private CorbaObjectManager objManager;
- private POA m_POA;
- private ORB m_ORB;
-
- protected void setUp() throws Exception {
- super.setUp();
- String[] argv = new String[0];
- // (1-1) ORBの初期化
- java.util.Properties props = new java.util.Properties();
- m_ORB = ORB.init(argv, props);
-
- // (1-2) POAManagerのactivate
- try {
- m_POA = org.omg.PortableServer.POAHelper.narrow(
- m_ORB.resolve_initial_references("RootPOA"));
- } catch (InvalidName e1) {
- e1.printStackTrace();
- fail();
- }
- POAManager pman = m_POA.the_POAManager();
- try {
- pman.activate();
- } catch (AdapterInactive e1) {
- e1.printStackTrace();
- fail();
- }
- objManager = new CorbaObjectManager(m_ORB, m_POA);
- }
- protected void tearDown() throws Exception {
- super.tearDown();
- if( m_ORB != null) {
- m_ORB.destroy();
- m_ORB = null;
- }
- }
-
- /**
- * <p>RTObjectのActivate/Deactivate
- * <ul>
- * <li>RTObjectをActivateできるか?</li>
- * <li>RTObjectをDeactivateできるか?</li>
- * </ul>
- * </p>
- */
- public void test_activate_deactivate_rtobject() {
- Manager manager = Manager.instance();
- RTObject_impl rtobject = new RTObject_impl(manager);
- try {
- rtobject._this();
- fail();
- } catch ( Exception ex ) {
- }
- try {
- // RTObjectをアクティブ化する
- objManager.activate(rtobject);
- assertNotNull(rtobject._this());
- // RTObjectに参照が設定されているか確認することでアクティブ化の成功を確認する
- assertNotNull(rtobject.getObjRef());
- rtobject.get_sdo_id();
- } catch (ServantAlreadyActive e) {
- e.printStackTrace();
- fail();
- } catch (WrongPolicy e) {
- e.printStackTrace();
- fail();
- } catch (ObjectNotActive e) {
- e.printStackTrace();
- fail();
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- try {
- // 非アクティブ化する
- objManager.deactivate(rtobject);
- } catch (ServantNotActive e) {
- e.printStackTrace();
- fail();
- } catch (WrongPolicy e) {
- e.printStackTrace();
- fail();
- } catch (ObjectNotActive e) {
- e.printStackTrace();
- fail();
- }
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- }
- }
-}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ManagerTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ManagerTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/ManagerTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -1097,7 +1097,6 @@
assertNotNull(manager.getORB());
assertNotNull(manager.getPOA());
assertNotNull(manager.getPOAManager());
- assertNotNull(manager.m_objManager);
}
/**
@@ -1170,7 +1169,6 @@
assertNotNull(manager.getORB());
assertNotNull(manager.getPOA());
assertNotNull(manager.getPOAManager());
- assertNotNull(manager.m_objManager);
assertNotNull(manager.m_namingManager);
assertNotNull(manager.m_module);
assertNotNull(manager.m_terminator);
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/MyServiceConsumerTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/MyServiceConsumerTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/MyServiceConsumerTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -62,10 +62,6 @@
comp = manager.createComponent("MyServiceConsumer");
}
protected void tearDown() throws Exception {
- for(int intIdx=0;intIdx<manager.m_ecs.size();intIdx++) {
- manager.m_ecs.elementAt(intIdx).stop();
- Thread.yield();
- }
Thread.sleep(300);
manager.shutdownComponents();
manager.shutdownNaming();
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/MyServiceProviderTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/MyServiceProviderTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/MyServiceProviderTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -62,10 +62,6 @@
comp = manager.createComponent("MyServiceProvider");
}
protected void tearDown() throws Exception {
- for(int intIdx=0;intIdx<manager.m_ecs.size();intIdx++) {
- manager.m_ecs.elementAt(intIdx).stop();
- Thread.yield();
- }
Thread.sleep(300);
manager.shutdownComponents();
manager.shutdownNaming();
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/NamingManagerTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/NamingManagerTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/NamingManagerTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -96,10 +96,7 @@
*/
public void test_bindObject_and_unbindObject() throws Exception {
- // バインドするオブジェクトを作成しておく
- CorbaObjectManager objMgr = new CorbaObjectManager(m_pORB, m_pPOA);
RTObject_impl rto = new RTObject_impl(m_pORB, m_pPOA);
-// objMgr.activate(rto);
assertNotNull(rto.getObjRef());
ManagerServant mgs = new ManagerServant();
@@ -127,7 +124,6 @@
mgs = null;
rto = null;
- objMgr = null;
}
/**
@@ -139,15 +135,10 @@
*/
public void test_unbindAll() throws Exception {
- // バインドするオブジェクトを作成しておく
- CorbaObjectManager objMgr = new CorbaObjectManager(m_pORB, m_pPOA);
-
RTObject_impl rto1 = new RTObject_impl(m_pORB, m_pPOA);
-// objMgr.activate(rto1);
assertNotNull(rto1.getObjRef());
RTObject_impl rto2 = new RTObject_impl(m_pORB, m_pPOA);
-// objMgr.activate(rto2);
assertNotNull(rto2.getObjRef());
ManagerServant mgs1 = new ManagerServant();
@@ -187,7 +178,6 @@
mgs1 = null;
rto2 = null;
rto1 = null;
- objMgr = null;
}
/**
@@ -199,15 +189,10 @@
*/
public void test_getObjects() throws Exception {
- // バインドするオブジェクトを作成しておく
- CorbaObjectManager objMgr = new CorbaObjectManager(m_pORB, m_pPOA);
-
RTObject_impl rto1 = new RTObject_impl(m_pORB, m_pPOA);
-// objMgr.activate(rto1);
assertNotNull(rto1.getObjRef());
RTObject_impl rto2 = new RTObject_impl(m_pORB, m_pPOA);
-// objMgr.activate(rto2);
assertNotNull(rto2.getObjRef());
// NamingManagerを生成する
@@ -232,7 +217,6 @@
rto2 = null;
rto1 = null;
- objMgr = null;
}
/**
@@ -255,11 +239,7 @@
String kind = new String("kind"+Integer.toString(num));
String idkind = id + "." + kind;
- // バインドするオブジェクトを作成しておく
- CorbaObjectManager objMgr = new CorbaObjectManager(m_pORB, m_pPOA);
-
RTObject_impl rto = new RTObject_impl(m_pORB, m_pPOA);
-// objMgr.activate(rto);
assertNotNull(rto.getObjRef());
@@ -285,7 +265,6 @@
rto = null;
- objMgr = null;
nmgr = null;
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/NamingOnCorbaTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/NamingOnCorbaTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/NamingOnCorbaTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -57,10 +57,7 @@
final String name_server = "localhost:2809";
NamingOnCorba noc = new NamingOnCorba(m_pORB, name_server);
- // バインドするオブジェクトを作成しておく
- CorbaObjectManager objMgr = new CorbaObjectManager(m_pORB, m_pPOA);
RTObject_impl rto = new RTObject_impl(m_pORB, m_pPOA);
-// objMgr.activate(rto);
assertNotNull(rto.getObjRef());
// RTObject_implオブジェクトをバインドできるか?
@@ -83,7 +80,6 @@
nc.resolve(name);
fail("Exception not thrown.");
} catch (Exception expected) {}
- objMgr.deactivate(rto);
}
/**
@@ -98,10 +94,7 @@
final String name_server = "localhost:2809";
NamingOnCorba noc = new NamingOnCorba(m_pORB, name_server);
- // バインドするオブジェクトを作成しておく
- CorbaObjectManager objMgr = new CorbaObjectManager(m_pORB, m_pPOA);
ManagerServant rto = new ManagerServant();
-// objMgr.activate(rto);
assertNotNull(rto.getObjRef());
// RTObject_implオブジェクトをバインドできるか?
@@ -124,7 +117,6 @@
nc.resolve(name);
fail("Exception not thrown.");
} catch (Exception expected) {}
- objMgr.deactivate(rto);
}
}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/SeqInTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/SeqInTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/SeqInTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -60,10 +60,6 @@
comp = manager.createComponent("SeqIn");
}
protected void tearDown() throws Exception {
- for(int intIdx=0;intIdx<manager.m_ecs.size();intIdx++) {
- manager.m_ecs.elementAt(intIdx).stop();
- Thread.yield();
- }
Thread.sleep(600);
manager.shutdownComponents();
manager.shutdownNaming();
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/SeqOutTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/SeqOutTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/SeqOutTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -60,10 +60,6 @@
comp = manager.createComponent("SeqOut");
}
protected void tearDown() throws Exception {
- for(int intIdx=0;intIdx<manager.m_ecs.size();intIdx++) {
- manager.m_ecs.elementAt(intIdx).stop();
- Thread.yield();
- }
Thread.sleep(600);
manager.shutdownComponents();
manager.shutdownNaming();
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContextTests.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContextTests.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/executionContext/PeriodicExecutionContextTests.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -462,6 +462,7 @@
// ExecutionContextにRTObjectを登録する
assertEquals(ReturnCode_t.RTC_OK, ec.add_component(mock._this()));
+ ec.m_worker.updateComponentList();
try {
Thread.sleep(100);
Copied: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java (from rev 687, trunk/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java)
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java (rev 0)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/log/LogBufTimeTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -0,0 +1,60 @@
+package jp.go.aist.rtm.RTC.log;
+
+import java.util.logging.ConsoleHandler;
+
+import junit.framework.TestCase;
+
+public class LogBufTimeTest extends TestCase {
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ *
+ * マイクロ秒の出力テスト
+ * clock_time=adjustedの場合,clock_time=systemの場合
+ * それぞれでマイクロ秒の値が正常に出力されるかを確認する
+ */
+ public void test_case0() {
+ Logbuf rtcout = new Logbuf("test0");
+
+ rtcout.setEnabled();
+ rtcout.setClockType("adjusted");
+ rtcout.addStream(new ConsoleHandler());
+ rtcout.setEnabled();
+ // Junit出力ファイル*.xmlの <system-err>の欄に出力される
+ System.err.println("--- test_case0() adjusted ---");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT 2");
+ rtcout.setDateFormat("%b %d %H:%M:%S.%L %q");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT 2");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT 2");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT 2");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT 2");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT 2");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT 2");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT 2");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT 2");
+ // PARANOIDはマイクロ秒の出力なし
+ // VERBOSE以降はマイクロ秒の出力があればOK
+
+ System.err.println("--- test_case0() system ---");
+ rtcout.setClockType("system");
+ rtcout.setDateFormat("%b %d %H:%M:%S.%L");
+ rtcout.println(Logbuf.PARANOID, "PARANOID string to STDOUT 2");
+ rtcout.setDateFormat("%b %d %H:%M:%S.%L %q");
+ rtcout.println(Logbuf.VERBOSE, "VERBOSE string to STDOUT 2");
+ rtcout.println(Logbuf.TRACE, "TRACE string to STDOUT 2");
+ rtcout.println(Logbuf.DEBUG, "DEBUG string to STDOUT 2");
+ rtcout.println(Logbuf.INFO, "INFO string to STDOUT 2");
+ rtcout.println(Logbuf.WARN, "WARN string to STDOUT 2");
+ rtcout.println(Logbuf.ERROR, "ERROR string to STDOUT 2");
+ rtcout.println(Logbuf.FATAL, "FATAL string to STDOUT 2");
+ rtcout.println(Logbuf.SILENT, "SILENT string to STDOUT 2");
+ // PARANOIDはマイクロ秒の出力なし
+ // VERBOSE以降はマイクロ秒の出力があればOK
+ }
+}
Modified: branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java
===================================================================
--- branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java 2015-10-28 02:50:04 UTC (rev 735)
+++ branches/RELENG_1_1/jp.go.aist.rtm.RTC/tests/src/jp/go/aist/rtm/RTC/util/AdjustedClockTest.java 2015-10-28 09:02:58 UTC (rev 736)
@@ -38,7 +38,7 @@
long sec2 = msec2/1000;
long usec2 = (msec2 - sec2*1000)*1000;
assertEquals(sec2-30, clock.getTime().getSec());
- assertEquals(usec2, clock.getTime().getUsec());
+// assertEquals(usec2, clock.getTime().getUsec());
}
}
More information about the openrtm-commit
mailing list