mcconnell 02/05/14 00:29:15
Modified: enterprise/ins build.xml
enterprise/orb build.xml
enterprise/orb/src/java/org/apache/orb
DefaultORBContext.java DefaultORBFactory.java
ORB.java ORBContext.java
ORBFactoryRuntimeException.java
ORBFactoryService.java
enterprise/orb/src/java/org/apache/orb/util
ExceptionHelper.java IOR.java
enterprise/pss build.xml
enterprise/time build.xml server.bat
enterprise/time/src/java/org/apache/time DefaultTIO.java
DefaultTimerEventHandler.java
DefaultTimerEventService.java DefaultUTO.java
Initializer.java ReleaseInfo.java TimeProvider.java
TimeUtils.java
Log:
checkstyle compliance
Revision Changes Path
1.3 +14 -0 jakarta-avalon-apps/enterprise/ins/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/enterprise/ins/build.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build.xml 3 Apr 2002 07:55:50 -0000 1.2
+++ build.xml 14 May 2002 07:29:14 -0000 1.3
@@ -4,6 +4,20 @@
<property file="local.properties"/>
<property file="build.properties"/>
+ <!-- common target wrappers -->
+
+ <property name="enterprise.path" value=".."/>
+ <property name="common.path" value="${enterprise.path}/../common"/>
+ <target name="checkstyle">
+ <ant antfile="${common.path}/util/checkstyle.xml">
+ <property name="checkstyle.failOnViolation" value="true"/>
+ <property name="build.dir" value="${build}"/>
+ <property name="java.dir" value="${src}/java"/>
+ </ant>
+ </target>
+
+ <!-- local build environment -->
+
<target name="help" >
<echo>
1.11 +39 -24 jakarta-avalon-apps/enterprise/orb/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/enterprise/orb/build.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- build.xml 12 May 2002 03:29:20 -0000 1.10
+++ build.xml 14 May 2002 07:29:14 -0000 1.11
@@ -4,6 +4,20 @@
<property file="local.properties"/>
<property file="build.properties"/>
+ <!-- common target wrappers -->
+
+ <property name="enterprise.path" value=".."/>
+ <property name="common.path" value="${enterprise.path}/../common"/>
+ <target name="checkstyle">
+ <ant antfile="${common.path}/util/checkstyle.xml">
+ <property name="checkstyle.failOnViolation" value="false"/>
+ <property name="build.dir" value="${build.dir}"/>
+ <property name="java.dir" value="${java.dir}"/>
+ </ant>
+ </target>
+
+ <!-- local build environment -->
+
<target name="help" >
<echo>
@@ -44,11 +58,12 @@
<property name="lib" value="lib" />
<property name="src" value="src" />
+ <property name="java.dir" value="${src}/java" />
<property name="idl" value="${src}/idl" />
<property name="etc" value="${src}/etc" />
- <property name="build" value="build" />
+ <property name="build.dir" value="build" />
<property name="dist" value="dist" />
<property name="overview.html" value="${etc}/overview.html" />
@@ -56,7 +71,7 @@
<property name="avalon.href"
value="http://jakarta.apache.org/avalon/api/" />
<property name="jdk.href" value="http://java.sun.com/j2se/1.4/docs/api/"
/>
- <!-- the following properrties must be updated locally using the
local.properties file -->
+ <!-- the following properties must be updated locally using the
local.properties file -->
<property name="openorb.href" value="" />
<property name="openorb.src" value="${src}" />
@@ -79,23 +94,23 @@
<target name="dist" depends="build,support"/>
<target name="clean">
- <delete dir="${build}"/>
+ <delete dir="${build.dir}"/>
<delete dir="${dist}"/>
</target>
<!-- PREPARE -->
<target name="prepare" >
- <mkdir dir="${build}" />
+ <mkdir dir="${build.dir}" />
<mkdir dir="${dist}" />
</target>
<!-- ORB BLOCK/MANGER -->
<target name="orb.context" depends="prepare" >
- <mkdir dir="${build}/orb" />
- <mkdir dir="${build}/orb/src" />
- <mkdir dir="${build}/orb/lib" />
+ <mkdir dir="${build.dir}/orb" />
+ <mkdir dir="${build.dir}/orb/src" />
+ <mkdir dir="${build.dir}/orb/lib" />
</target>
<target name="orb.build.context" depends="orb.context">
@@ -106,7 +121,7 @@
<srcfiles dir="${etc}">
<include name="factory.mf"/>
</srcfiles>
- <srcfiles dir="${build}/orb/src">
+ <srcfiles dir="${build.dir}/orb/src">
<include name="org/apache/orb/**/*.*"/>
</srcfiles>
</uptodate>
@@ -114,24 +129,24 @@
<target name="orb" depends="orb.build.context" unless="orb.uptodate" >
<echo message="Building ORB Manager Implementation."/>
- <mkdir dir="${build}/orb/lib"/>
- <javac debug="off" destdir="${build}/orb/lib" deprecation="true"
target="1.2">
+ <mkdir dir="${build.dir}/orb/lib"/>
+ <javac debug="off" destdir="${build.dir}/orb/lib" deprecation="true"
target="1.2">
<classpath>
<path refid="project.classpath" />
- <pathelement path="${build}/orb/lib" />
+ <pathelement path="${build.dir}/orb/lib" />
</classpath>
- <src path="${build}/orb/src" />
+ <src path="${build.dir}/orb/src" />
<src path="${src}/java" />
<include name="org/apache/orb/**"/>
</javac>
- <copy todir="${build}/orb/lib">
+ <copy todir="${build.dir}/orb/lib">
<fileset dir="${src}/java">
<include name="org/apache/orb/*.xinfo"/>
<include name="org/apache/orb/**/*.xml"/>
<include name="org/apache/orb/**/orb.properties"/>
</fileset>
</copy>
- <jar jarfile="${dist}/${orb.manager.jar}" basedir="${build}/orb/lib"
+ <jar jarfile="${dist}/${orb.manager.jar}"
basedir="${build.dir}/orb/lib"
manifest="${etc}/factory.mf" />
</target>
@@ -142,16 +157,16 @@
<srcfiles dir="${src}/examples">
<include name="hello/**/*.*"/>
</srcfiles>
- <srcfiles dir="${build}/examples">
+ <srcfiles dir="${build.dir}/examples">
<include name="hello/**/*.*"/>
</srcfiles>
</uptodate>
</target>
<target name="hello.idl.context" >
- <mkdir dir="${build}/examples/src"/>
+ <mkdir dir="${build.dir}/examples/src"/>
<uptodate property="hello.modified"
targetfile="${src}/examples/hello/idl/hello.idl">
- <srcfiles dir="${build}/examples/src">
+ <srcfiles dir="${build.dir}/examples/src">
<include name="**/*"/>
</srcfiles>
</uptodate>
@@ -159,28 +174,28 @@
<target name="hello.idl" depends="hello.idl.context" if="hello.modified">
<antcall target="idl2java" >
- <param name="idl.destination" value="${build}/examples/src"/>
+ <param name="idl.destination" value="${build.dir}/examples/src"/>
<param name="idl.target" value="${src}/examples/hello/idl/hello.idl" />
</antcall>
</target>
<target name="hello.build" depends="orb,hello.idl,hello.build.context"
unless="examples.uptodate">
- <mkdir dir="${build}/examples/lib"/>
- <javac debug="off" destdir="${build}/examples/lib" deprecation="true"
target="1.2">
+ <mkdir dir="${build.dir}/examples/lib"/>
+ <javac debug="off" destdir="${build.dir}/examples/lib"
deprecation="true" target="1.2">
<classpath>
<path refid="project.classpath" />
<pathelement path="${dist}/${orb.manager.jar}" />
</classpath>
- <src path="${build}/examples/src" />
+ <src path="${build.dir}/examples/src" />
<src path="${src}/examples/hello/java" />
</javac>
- <copy todir="${build}/examples/lib">
+ <copy todir="${build.dir}/examples/lib">
<fileset dir="${src}/examples/hello/java">
<include name="**/*.xml"/>
<include name="**/*.xinfo"/>
</fileset>
</copy>
- <jar jarfile="${dist}/${orb.examples.jar}"
basedir="${build}/examples/lib" />
+ <jar jarfile="${dist}/${orb.examples.jar}"
basedir="${build.dir}/examples/lib" />
</target>
<target name="hello" depends="hello.build">
@@ -258,7 +273,7 @@
excludepackagenames="org.omg.*,org.apache.avalon.excalibur.*"
>
<sourcepath path="${src}/java"/>
- <sourcepath path="${build}/orb/src"/>
+ <sourcepath path="${build.dir}/orb/src"/>
<sourcepath path="${openorb.src}"/>
<sourcepath path="${openorb.build.src}"/>
<classpath>
1.3 +5 -7
jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/DefaultORBContext.java
Index: DefaultORBContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/DefaultORBContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultORBContext.java 12 May 2002 03:29:21 -0000 1.2
+++ DefaultORBContext.java 14 May 2002 07:29:14 -0000 1.3
@@ -7,10 +7,6 @@
package org.apache.orb;
-import java.io.File;
-import java.net.URL;
-
-import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.DefaultContext;
@@ -43,6 +39,7 @@
/**
* Creation of a new DefaultORBContext.
* @param orb the ORB
+ * @param parent the parent context
*/
public DefaultORBContext( ORB orb, Context parent )
{
@@ -58,9 +55,9 @@
/**
* Returns the ORB.
* @return ORB the object request broker
- * @exception ContextException if the ORB reference has not been set
+ * @exception CascadingRuntimeException if the ORB reference has not been
set
*/
- public ORB getORB( )
+ public ORB getORB( ) throws CascadingRuntimeException
{
try
{
@@ -69,7 +66,8 @@
catch( ContextException e )
{
// will not happen
- throw new CascadingRuntimeException("Unexpeted context error
while retrieving ORB value.", e );
+ throw new CascadingRuntimeException(
+ "Unexpected context error while retrieving ORB value.", e );
}
}
1.3 +46 -29
jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/DefaultORBFactory.java
Index: DefaultORBFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/DefaultORBFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultORBFactory.java 2 Mar 2002 17:48:56 -0000 1.2
+++ DefaultORBFactory.java 14 May 2002 07:29:14 -0000 1.3
@@ -8,11 +8,7 @@
package org.apache.orb;
import java.io.File;
-import java.net.URL;
import java.io.InputStream;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.Enumeration;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.LogEnabled;
@@ -22,12 +18,10 @@
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.phoenix.Block;
import org.apache.avalon.phoenix.BlockContext;
@@ -44,18 +38,18 @@
* <tr>
* <td width="20%">Contextualizable</td>
* <td>
- * The <code>Context</code> value passed to the <code>ORBFactory</code>
during this phase
- * provides the runtime execution context.</td></tr>
+ * The <code>Context</code> value passed to the <code>ORBFactory</code>
+ * during this phase provides the runtime execution context.</td></tr>
* <tr>
* <td width="20%">Configurable</td>
* <td>
- * The configuration phase handles the internalization of a static
configuration data
- * including ORB default properties.
+ * The configuration phase handles the internalization of a static
+ * configuration data including ORB default properties.
* </td></tr>
* <tr><td width="20%">Initalizable</td>
* <td>
- * Signals completion of the Contextualization and Configuration phases
enabling the factory
- * to prepare for handling of ORB creation requests.
+ * Signals completion of the Contextualization and Configuration phases
enabling
+ * the factory to prepare for handling of ORB creation requests.
* </td></tr>
* <tr><td width="20%">Disposable</td>
* <td>
@@ -67,7 +61,8 @@
*/
public class DefaultORBFactory extends AbstractLogEnabled
-implements Block, LogEnabled, Contextualizable, Configurable, Initializable,
Disposable, ORBFactoryService
+implements Block, LogEnabled, Contextualizable, Configurable, Initializable,
+Disposable, ORBFactoryService
{
//=================================================================
@@ -113,6 +108,11 @@
// Contextualizable
//=================================================================
+ /**
+ * Contextualization of the component by its container.
+ * @param context the runtime context
+ * @exception ContextException if a context error occurs
+ */
public void contextualize( Context context ) throws ContextException
{
this.m_context = context;
@@ -148,6 +148,7 @@
/**
* Initialization is invoked by the framework following configuration,
* following which the factory can support ORB creation.
+ * @exception Exception if an error occurs during initialization
*/
public void initialize()
throws Exception
@@ -161,7 +162,7 @@
/**
* Creation of a new ORB instance based on the supplied properties.
* NOTE: Semantic of this interface are under discussion.
- * @param props initialization properties
+ * @return ORB a new ORB instance
*/
public ORB createORB( )
{
@@ -173,7 +174,8 @@
* The properties supplied to the ORB init function will be supplimented
* with default properties declared under the factory configuration.
*
- * @param props the supplimentary ORB initialization properties
+ * @param properties the supplimentary ORB initialization properties
+ * @return ORB a new ORB instance
*/
public ORB createORB( java.util.Properties properties )
{
@@ -185,8 +187,9 @@
* The properties supplied to the ORB init function will be supplimented
* with default properties declared under the factory configuration.
*
- * @param the ORB init argument array
- * @param props the supplimentary ORB initialization properties
+ * @param args the ORB init argument array
+ * @param properties the supplimentary ORB initialization properties
+ * @return ORB a new ORB instance
*/
public ORB createORB( String[] args, java.util.Properties properties )
{
@@ -202,8 +205,8 @@
* added to the generated ORB properties, followed by addition
* of any properties declared in the supplied configuration
* argument (enabling modification of default values).
- * @param the ORB init argument array
- * @param properties the supplimentary ORB initialization properties
+ * @param args the ORB init argument array
+ * @param props the supplimentary ORB initialization properties
* @param logger the logging channel to be used by the orb during
* initalization
* @param context optional context to be applied to orb subsytems
@@ -215,13 +218,20 @@
{
Logger log = logger;
- if( log == null ) log = getLogger().getChildLogger(
- m_config.getChild("logging").getAttribute("channel","orb") );
+ if( log == null )
+ {
+ log = getLogger().getChildLogger(
+ m_config.getChild("logging").getAttribute("channel","orb") );
+ }
Context ctx = context;
- if( ctx == null ) ctx = m_context;
+ if( ctx == null )
+ {
+ ctx = m_context;
+ }
- CascadingConfiguration config = new CascadingConfiguration(
configuration, m_config );
+ CascadingConfiguration config = new CascadingConfiguration(
+ configuration, m_config );
//
// Override the default properties with any properrties supplied by
the client.
@@ -229,7 +239,7 @@
java.util.Properties properties = new java.util.Properties();
properties.setProperty("org.omg.CORBA.ORBClass", DEFAULT_ORB_CLASS );
- properties.setProperty("org.omg.CORBA.ORBSingletonClass",
DEFAULT_ORB_SINGLETON );
+ properties.setProperty("org.omg.CORBA.ORBSingletonClass",
DEFAULT_ORB_SINGLETON );
properties.setProperty("openorb.ORBLoader", DEFAULT_ORB_LOADER );
// add the logger, context and config as properties
@@ -246,7 +256,7 @@
}
catch ( Throwable e )
{
- final String error = "ORB initialization failure.";
+ final String error = "ORB initialization failure.";
throw new ORBFactoryRuntimeException( error, e );
}
}
@@ -264,13 +274,16 @@
m_context = null;
m_root = null;
}
-
+
//=================================================================
// utilities
//=================================================================
/**
* Returns the default configuration resource.
+ * @param path the path to the configuration
+ * @exception ConfigurationException if the confiugration could not
+ * bu loaded from the supplied path
*/
private Configuration loadConfiguration( String path )
throws ConfigurationException
@@ -279,13 +292,17 @@
{
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder( );
InputStream is =
this.getClass().getClassLoader().getResourceAsStream( path );
- if( is == null ) throw new Exception(
- "Could not find the configuration resource \"" + path + "\""
);
+ if( is == null )
+ {
+ throw new ConfigurationException(
+ "Could not find the configuration resource \"" + path +
"\"" );
+ }
return builder.build( is );
}
catch( Throwable e )
{
- throw new ConfigurationException("Unexpected excetion while
loading configration.", e );
+ throw new ConfigurationException(
+ "Unexpected excetion while loading configration.", e );
}
}
}
1.5 +73 -35
jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/ORB.java
Index: ORB.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/ORB.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ORB.java 12 May 2002 03:29:21 -0000 1.4
+++ ORB.java 14 May 2002 07:29:14 -0000 1.5
@@ -7,13 +7,9 @@
package org.apache.orb;
-import java.io.File;
-import java.net.URL;
import java.util.Properties;
import org.apache.avalon.framework.logger.Logger;
-import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.ContextException;
@@ -27,12 +23,8 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.CascadingRuntimeException;
-import org.apache.avalon.phoenix.Block;
-import org.apache.avalon.phoenix.BlockContext;
-import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.PortableServer.POA;
-import org.omg.PortableServer.POAHelper;
/**
* The <code>ORB</code> class.
@@ -78,7 +70,6 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
-
public class ORB extends org.openorb.CORBA.ORB
implements Component, Configurable, Contextualizable, Initializable,
Startable, Disposable,
ORBContext, POAContext, ServiceManager
@@ -142,6 +133,8 @@
/**
* Declaration of a runtime context.
+ * @param context the runtime context supplied by the component container
+ * @exception ContextException if a context related error occurs
*/
public void contextualize( Context context ) throws ContextException
{
@@ -175,13 +168,16 @@
* creates an <code>ORBInitContext</code> value that is used as an
* argument to the ORB.init funtion. The implementation directs ORB
* loading to the org.apache.orb.CORBA.kernel.DefaultLoader class.
- * @see org.apache.orb.CORBA.kernel.DefaultLoader
* @exception Exception if an error occurs during initalization
+ * @see org.apache.orb.CORBA.kernel.DefaultLoader
*/
public void initialize()
throws Exception
{
- if( getLogger().isDebugEnabled() ) getLogger().debug(
"initialization (ORB)" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "initialization (ORB)" );
+ }
//
// create an ORBInitContext that will be used as the properties
argument
@@ -191,7 +187,7 @@
Properties p = new Properties();
p.setProperty("openorb.ORBLoader","org.apache.orb.CORBA.kernel.DefaultLoader");
p.setProperty("org.omg.CORBA.ORBClass", "org.openorb.CORBA.ORB" );
- p.setProperty("org.omg.CORBA.ORBSingletonClass",
"org.openorb.CORBA.ORBSingleton" );
+ p.setProperty("org.omg.CORBA.ORBSingletonClass",
"org.openorb.CORBA.ORBSingleton" );
p.put( "CONFIGURATION", m_config );
p.put( "LOGGER", getLogger() );
p.put( "CONTEXT", m_context );
@@ -202,7 +198,7 @@
}
catch ( Throwable e )
{
- final String error = "ORB initialization failure.";
+ final String error = "ORB initialization failure.";
throw new CascadingRuntimeException( error, e );
}
}
@@ -215,11 +211,16 @@
* The start operation is invoked by a manager following completion of
the
* initialization phase, during which a new thread is created for the
execution
* of the ORB.
+ * @exception Exception if an error occurs while starting the component
*/
public void start()
throws Exception
{
- if( getLogger().isDebugEnabled() ) getLogger().debug( "starting" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "starting" );
+ }
+
m_thread = new Thread(
new Runnable() {
public void run()
@@ -230,8 +231,12 @@
}
catch( Throwable e )
{
- final String warning = "Error encountered while
attempting to start the POA.";
- if( getLogger().isWarnEnabled() ) getLogger().warn(
warning, e );
+ final String warning =
+ "Error encountered while attempting to start the POA.";
+ if( getLogger().isWarnEnabled() )
+ {
+ getLogger().warn( warning, e );
+ }
}
try
@@ -240,8 +245,7 @@
}
catch (Exception e)
{
- final String error = "unexpected exception raised by
the ORB";
- if( getLogger().isErrorEnabled() ) getLogger().error(
error, e );
+ final String error = "unexpected exception raised by the
ORB";
throw new CascadingRuntimeException( error, e );
}
}
@@ -249,8 +253,11 @@
);
m_thread.setName( "orb-" + System.identityHashCode( m_orb ) );
m_thread.start();
- final String debug = "started";
- if( getLogger().isDebugEnabled() ) getLogger().debug( debug );
+ final String debug = "started";
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( debug );
+ }
}
/**
@@ -258,24 +265,34 @@
*/
public void stop()
{
- if( getLogger().isDebugEnabled() ) getLogger().debug( "stop" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "stop" );
+ }
try
{
getPOA().destroy( true, true );
}
catch( Throwable e )
{
- if( getLogger().isWarnEnabled() ) getLogger().warn( "ignoring
POA related exception" );
+ if( getLogger().isWarnEnabled() )
+ {
+ getLogger().warn(
+ "ignoring POA related exception" );
+ }
}
- try
- {
+ try
+ {
shutdown( true );
m_stopped = true;
- }
- catch( Throwable e )
- {
- final String warning = "Internal error while shutting down the
ORB.";
- if( getLogger().isWarnEnabled() ) getLogger().warn( warning, e );
+ }
+ catch( Throwable e )
+ {
+ final String warning = "Internal error while shutting down the
ORB.";
+ if( getLogger().isWarnEnabled() )
+ {
+ getLogger().warn( warning, e );
+ }
}
}
@@ -288,9 +305,18 @@
*/
public void dispose()
{
- if( m_disposed ) return;
- if( !m_stopped ) stop();
- if( getLogger().isDebugEnabled() ) getLogger().debug( "disposal" );
+ if( m_disposed )
+ {
+ return;
+ }
+ if( !m_stopped )
+ {
+ stop();
+ }
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "disposal" );
+ }
m_disposed = true;
m_config = null;
m_context = null;
@@ -302,7 +328,7 @@
/**
* Return TRUE is the named service is available.
- * @param the service key
+ * @param key the service key
* @return boolean TRUE if the service is available
*/
public boolean hasService( String key )
@@ -324,7 +350,7 @@
* operation.
* @param key the service key
* @return Object the service
- * @exception ServiceException if the service cannot be located
+ * @exception ServiceException if the requested key is unknown
*/
public Object lookup( String key ) throws ServiceException
{
@@ -334,13 +360,15 @@
}
catch( Throwable e )
{
- throw new ServiceException( "Could not locate service with key:
" + key );
+ throw new ServiceException(
+ "Could not locate service with key: " + key );
}
}
/**
* Release a service.
* (empty implementation)
+ * @param service the service to release
*/
public void release( Object service )
{
@@ -350,6 +378,10 @@
// POAContext
//=================================================================
+ /**
+ * Returns the root POA.
+ * @return POA the root POA
+ */
public POA getPOA()
{
try
@@ -376,6 +408,12 @@
return this;
}
+ /**
+ * Returns a context value given a key.
+ * @param key the context key
+ * @return Object the context value
+ * @exception ContextException if the key is unkwnown within the context
+ */
public Object get( Object key ) throws ContextException
{
if( key.equals( ORBContext.ORB_KEY ) )
1.3 +4 -2
jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/ORBContext.java
Index: ORBContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/ORBContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ORBContext.java 12 May 2002 03:29:21 -0000 1.2
+++ ORBContext.java 14 May 2002 07:29:14 -0000 1.3
@@ -9,7 +9,6 @@
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
/**
* The <code>ORBContext</code> interface defines a <code>Context</code> type
that
@@ -21,12 +20,15 @@
public interface ORBContext extends Context, Component
{
+ /**
+ * Static context key to retrieve the ORB.
+ */
public static final String ORB_KEY = "orb";
/**
* Returns the ORB.
* @return ORB the object request broker
*/
- public ORB getORB( );
+ ORB getORB( );
}
1.2 +2 -7
jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/ORBFactoryRuntimeException.java
Index: ORBFactoryRuntimeException.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/ORBFactoryRuntimeException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ORBFactoryRuntimeException.java 28 Feb 2002 16:29:38 -0000 1.1
+++ ORBFactoryRuntimeException.java 14 May 2002 07:29:14 -0000 1.2
@@ -5,10 +5,6 @@
*/
package org.apache.orb;
-import java.io.StringWriter;
-import java.util.StringTokenizer;
-import java.io.PrintWriter;
-
import org.apache.avalon.framework.CascadingRuntimeException;
/**
@@ -20,7 +16,8 @@
* @version 1.0
*/
-public class ORBFactoryRuntimeException extends CascadingRuntimeException {
+public class ORBFactoryRuntimeException extends CascadingRuntimeException
+{
/**
* Construct a new <code>PipelineRuntimeException</code> instance with
the
@@ -28,7 +25,6 @@
*
* @param message Message summarising the exception.
*/
-
public ORBFactoryRuntimeException( final String message )
{
this( message, null );
@@ -41,7 +37,6 @@
* @param message The detail message for this exception.
* @param cause the root cause of the exception
*/
-
public ORBFactoryRuntimeException( final String message, final Throwable
cause )
{
super( message, cause );
1.2 +11 -10
jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/ORBFactoryService.java
Index: ORBFactoryService.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/ORBFactoryService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ORBFactoryService.java 28 Feb 2002 16:29:38 -0000 1.1
+++ ORBFactoryService.java 14 May 2002 07:29:14 -0000 1.2
@@ -7,7 +7,6 @@
package org.apache.orb;
-import java.util.Properties;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.configuration.Configuration;
@@ -25,28 +24,30 @@
/**
* Creation of a new ORB instance based on the supplied properties.
* NOTE: Semantic of this interface are under discussion.
- * @param props initialization properties
+ * @return ORB the new ORB instance
*/
- public ORB createORB( );
+ ORB createORB( );
/**
* Creation of a new ORB instance based on the supplied properties.
* The properties supplied to the ORB init function will be supplimented
* with default properties declared under the factory configuration.
*
- * @param props the supplimentary ORB initialization properties
+ * @param properties the supplimentary ORB initialization properties
+ * @return ORB the new ORB instance
*/
- public ORB createORB( java.util.Properties properties );
+ ORB createORB( java.util.Properties properties );
/**
* Creation of a new ORB instance based on the supplied properties.
* The properties supplied to the ORB init function will be supplimented
* with default properties declared under the factory configuration.
*
- * @param the ORB init argument array
- * @param props the supplimentary ORB initialization properties
+ * @param args the ORB init argument array
+ * @param properties the supplimentary ORB initialization properties
+ * @return ORB the new ORB instance
*/
- public ORB createORB( String[] args, java.util.Properties properties );
+ ORB createORB( String[] args, java.util.Properties properties );
/**
* Creation of a new ORB instance based on a supplied logger,
@@ -57,7 +58,7 @@
* added to the generated ORB properties, followed by addition
* of any properties declared in the supplied configuration
* argument (enabling modification of default values).
- * @param the ORB init argument array
+ * @param args the ORB init argument array
* @param properties the supplimentary ORB initialization properties
* @param logger the logging channel to be used by the orb during
* initalization
@@ -65,7 +66,7 @@
* @param configuration optional orb configuration
* @return ORB a portable CORBA Object Request Broker (ORB)
*/
- public ORB createORB( String[] args, java.util.Properties properties,
+ ORB createORB( String[] args, java.util.Properties properties,
Logger logger, Context context, Configuration configuration );
}
1.2 +73 -28
jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/util/ExceptionHelper.java
Index: ExceptionHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/util/ExceptionHelper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExceptionHelper.java 14 Mar 2002 12:51:36 -0000 1.1
+++ ExceptionHelper.java 14 May 2002 07:29:14 -0000 1.2
@@ -14,11 +14,11 @@
/**
* General utilities supporting the packaging of exception messages.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
-
public class ExceptionHelper
{
-
+
/**
* Prints the exception to the standard error out together with
* cause statements.
@@ -26,7 +26,7 @@
*/
public static void printException( Throwable e )
{
- printException( null, e );
+ printException( null, e );
}
/**
@@ -43,9 +43,9 @@
/**
* Prints the exception to the standard error out together with
* source and cause statements.
- * @param source the source of the request
* @param label label identifying the error
* @param e the exception to print
+ * @param source the source of the request
*/
public static void printException( String label, Throwable e, Object
source )
{
@@ -55,74 +55,119 @@
/**
* Prints the exception to the standard error out together with
* source and cause statements.
- * @param source the source of the request
* @param label label identifying the error
* @param e the exception to print
+ * @param source the source of the request
+ * @param trace boolean value inidication if a stack trace though be
included
*/
public static void printException( String label, Throwable e, Object
source, boolean trace )
{
java.io.PrintStream out = System.err;
synchronized( out )
- {
- out.println( "================================================="
);
- if( label != null ) out.println( "Message: " + label );
- if( source != null ) out.println( "Source: " + source );
- out.println( "Exception: " + e.toString() );
- if( e.getCause() != null ) printCause( out, e );
- out.println( "================================================="
);
- if( trace ) e.printStackTrace();
- out.println( "================================================="
);
+ {
+ out.println( "================================================="
);
+ if( label != null )
+ {
+ out.println( "Message: " + label );
+ }
+ if( source != null )
+ {
+ out.println( "Source: " + source );
+ }
+ out.println( "Exception: " + e.toString() );
+ if( e.getCause() != null )
+ {
+ printCause( out, e );
+ }
+ out.println( "================================================="
);
+ if( trace )
+ {
+ e.printStackTrace();
+ out.println(
"=================================================" );
+ }
}
}
private static void printCause( java.io.PrintStream out, Throwable e )
{
- Throwable cause = e.getCause();
- out.println( "Cause: " + cause.toString() );
- if( cause.getCause() != null ) printCause( out, cause );
+ Throwable cause = e.getCause();
+ out.println( "Cause: " + cause.toString() );
+ if( cause.getCause() != null )
+ {
+ printCause( out, cause );
+ }
}
+ /**
+ * Returns the exception and causal exceptions as a formatted string.
+ * @param message the header message
+ * @param e the exception
+ * @return String the formatting string
+ */
public static String packException( final String message, final
Throwable e )
{
- String error = "Message: " + message;
- if( e == null ) return error;
+ String error = "Message: " + message;
+ if( e == null )
+ {
+ return error;
+ }
error = error + "\nException: " + e.toString();
- return packCause( error, e.getCause() );
+ return packCause( error, e.getCause() );
}
private static String packCause( String s, Throwable cause )
{
- if( cause == null ) return s;
+ if( cause == null )
+ {
+ return s;
+ }
s = s + "\nCause: " + cause.toString();
return packCause( s, cause.getCause() );
}
+ /**
+ * Prints the message to the System.out stream.
+ * @param message the message to print
+ */
public static void printMessage( String message )
{
java.io.PrintStream out = System.out;
synchronized( out )
- {
+ {
out.println( message );
}
}
+ /**
+ * Returns a HTML formatted exception report.
+ * @param message the header message
+ * @param e the exception
+ * @return String the HTML formatted string
+ */
public static String packExceptionAsHTML( final String message, final
Throwable e )
{
String header = "<html><body><table>";
String footer = "</table></body></html>";
- String error = header + "<tr bgcolor='#ccccff'><td
valign=top>Message</td><td>" + message + "</td></tr>";
- if( e == null ) return error + footer;
+ String error = header + "<tr bgcolor='#ccccff'><td
valign=top>Message</td><td>"
+ + message + "</td></tr>";
+ if( e == null )
+ {
+ return error + footer;
+ }
error = error + "<tr><td valign='top'>Exception</td><td>"
- + e.getClass().getName() + " <br>" + e.getMessage() +
"</td></tr>";
- return packCauseInTable( error, e.getCause() ) + footer;
+ + e.getClass().getName() + " <br>" + e.getMessage() +
"</td></tr>";
+ return packCauseInTable( error, e.getCause() ) + footer;
}
private static String packCauseInTable( String s, Throwable cause )
{
- if( cause == null ) return s;
+ if( cause == null )
+ {
+ return s;
+ }
s = s + "<tr><td valign='top'>Cause:</td><td>"
- + cause.getClass().getName() + " <br>" + cause.getMessage() +
"</td></tr>";
+ + cause.getClass().getName() + " <br>" + cause.getMessage() +
"</td></tr>";
return packCauseInTable( s, cause.getCause() );
}
1.2 +26 -10
jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/util/IOR.java
Index: IOR.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/orb/src/java/org/apache/orb/util/IOR.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IOR.java 9 Mar 2002 05:11:44 -0000 1.1
+++ IOR.java 14 May 2002 07:29:14 -0000 1.2
@@ -26,16 +26,20 @@
/**
* General utilities supporting the reading and writing of an IOR to and
from a file.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
-
public class IOR
{
/**
* Write an IOR to a file.
+ * @param orb the current ORB
+ * @param object the object to write as an IOR
+ * @param filename the filename path to write to
+ * @exception IOException if an error occured while attempting to write
the IOR
*/
-
- public static void writeIOR( ORB orb, org.omg.CORBA.Object object,
String filename ) throws IOException
+ public static void writeIOR( ORB orb, org.omg.CORBA.Object object,
String filename )
+ throws IOException
{
FileOutputStream file = new FileOutputStream( filename );
PrintWriter pfile = new PrintWriter( file );
@@ -45,12 +49,20 @@
/**
* Read an IOR from a file.
+ * @param orb the current ORB
+ * @param filename the filename path to read from
+ * @return org.omg.CORBA.Object the object referenced by the IOR
+ * @exception IOException if an error occured while attempting to read
the IOR
+ * @exception FileNotFoundException if the filename does not referenece a
file
*/
-
- public static org.omg.CORBA.Object readIOR( ORB orb, String filename )
throws FileNotFoundException, IOException
+ public static org.omg.CORBA.Object readIOR( ORB orb, String filename )
+ throws FileNotFoundException, IOException
{
- if( filename.indexOf("://") > -1 ) return readIOR( orb, new URL(
filename ));
-
+ if( filename.indexOf("://") > -1 )
+ {
+ return readIOR( orb, new URL( filename ));
+ }
+
FileInputStream file = new FileInputStream( filename );
InputStreamReader input = new InputStreamReader( file );
BufferedReader reader = new BufferedReader(input);
@@ -60,15 +72,19 @@
/**
* Read an IOR from a URL.
+ * @param orb the current ORB
+ * @param url the URL path to read from
+ * @return org.omg.CORBA.Object the object referenced by the IOR
+ * @exception IOException if an error occured while attempting to read
the IOR
*/
-
+
public static org.omg.CORBA.Object readIOR( ORB orb, URL url ) throws
IOException
{
URLConnection connection = url.openConnection();
InputStream input = connection.getInputStream();
BufferedReader buffer = new BufferedReader( new
InputStreamReader(input) );
- String IOR = buffer.readLine();
+ String ior = buffer.readLine();
buffer.close();
- return orb.string_to_object( IOR );
+ return orb.string_to_object( ior );
}
}
1.4 +15 -1 jakarta-avalon-apps/enterprise/pss/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/enterprise/pss/build.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- build.xml 12 May 2002 03:17:14 -0000 1.3
+++ build.xml 14 May 2002 07:29:14 -0000 1.4
@@ -4,6 +4,20 @@
<property file="local.properties"/>
<property file="build.properties"/>
+ <!-- common target wrappers -->
+
+ <property name="enterprise.path" value=".."/>
+ <property name="common.path" value="${enterprise.path}/../common"/>
+ <target name="checkstyle">
+ <ant antfile="${common.path}/util/checkstyle.xml">
+ <property name="checkstyle.failOnViolation" value="true"/>
+ <property name="build.dir" value="${build}"/>
+ <property name="java.dir" value="${src}/java"/>
+ </ant>
+ </target>
+
+ <!-- local build environment -->
+
<target name="help" >
<echo>
@@ -11,7 +25,7 @@
-----------
${project.title}
- ${project.description}
+ ${project.description}
General Targets:
----------------
1.6 +16 -3 jakarta-avalon-apps/enterprise/time/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/enterprise/time/build.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- build.xml 5 Apr 2002 07:02:34 -0000 1.5
+++ build.xml 14 May 2002 07:29:15 -0000 1.6
@@ -8,6 +8,21 @@
<property file="local.properties"/>
<property file="build.properties"/>
+ <!-- common target wrappers -->
+
+ <property name="enterprise.path" value=".."/>
+ <property name="common.path" value="${enterprise.path}/../common"/>
+ <property name="tools.path" value="${enterprise.path}/tools" />
+
+ <target name="checkstyle">
+ <ant antfile="${tools.path}/util/checkstyle.xml">
+ <property name="checkstyle.failOnViolation" value="true"/>
+ <property name="build.dir" value="${build}"/>
+ <property name="java.dir" value="${src}/java"/>
+ </ant>
+ </target>
+
+ <!-- local build environment -->
<target name="help" >
<echo>
@@ -35,10 +50,8 @@
<property name="VERSION" value="${MAJOR}.${MINOR}.${MICRO}"/>
- <property name="enterprise" value=".." />
- <property name="tools.path" value="${enterprise}/tools" />
<property name="tools.lib.path" value="${tools.path}/lib" />
- <property name="orb.path" value="${enterprise}/orb" />
+ <property name="orb.path" value="${enterprise.path}/orb" />
<property name="orb.lib.path" value="${orb.path}/lib" />
<property name="orb.dist.path" value="${orb.path}/dist" />
1.3 +1 -1 jakarta-avalon-apps/enterprise/time/server.bat
Index: server.bat
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/enterprise/time/server.bat,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- server.bat 12 May 2002 01:16:08 -0000 1.2
+++ server.bat 14 May 2002 07:29:15 -0000 1.3
@@ -1,2 +1,2 @@
-java -jar ..\tools\lib\excalibur-merlin-1.0.jar
..\tools\lib\phoenix-client.jar ..\orb\lib\openorb-1.3.0.jar
dist\time-2.0.0.jar ..\orb\dist\orb-manager-2.0.1.jar -target
org.apache.time.TimeProvider -verbose true -priority debug -disposal false
+java -jar ..\..\common\lib\merlin.jar ..\..\common\lib\phoenix-client.jar
..\orb\lib\openorb-1.3.0.jar dist\time-2.0.0.jar
..\orb\dist\orb-manager-2.0.1.jar -target org.apache.time.TimeProvider -verbose
true -priority debug -disposal false
1.3 +55 -5
jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/DefaultTIO.java
Index: DefaultTIO.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/DefaultTIO.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultTIO.java 5 Apr 2002 07:02:34 -0000 1.2
+++ DefaultTIO.java 14 May 2002 07:29:15 -0000 1.3
@@ -8,36 +8,69 @@
package org.apache.time;
-import org.omg.CORBA.ORB;
-import org.omg.CosTime.*;
import org.omg.TimeBase.IntervalT;
+import org.omg.CosTime.TIOPOA;
+import org.omg.CosTime.UTO;
+import org.omg.CosTime.TIO;
+import org.omg.CosTime.TIOHolder;
+import org.omg.CosTime.OverlapType;
/**
- * Implementation of a Time Interval Object.
+ * Implementation of a Time Interval Object.
+ * @author multiple
*/
public class DefaultTIO extends TIOPOA
{
- IntervalT m_interval;
+ private IntervalT m_interval;
- public DefaultTIO()
+ /**
+ * Creation of a new TIO.
+ */
+ public DefaultTIO()
{
}
+ /**
+ * Creation of a new TIO.
+ * @param intervalt value
+ */
public DefaultTIO(IntervalT intervalt)
{
m_interval = intervalt;
}
+ /**
+ * Creation of a new TIO.
+ * @param l value
+ * @param l1 value
+ */
public DefaultTIO(long l, long l1)
{
m_interval = new IntervalT(l, l1);
}
+ /**
+ * This attribute returns an IntervalT structure with the values of its
fields filled
+ * in with the corresponding values from the TIO.
+ * @return IntervalT the time interval
+ */
public IntervalT time_interval()
{
return m_interval;
}
+ /**
+ * This operation returns a value of type OverlapType depending on how
the interval in
+ * the object and the time range represented by the parameter UTO
overlap. See the
+ * definition of OverlapType in Section 14.2.2, Data Types. The interval
in the object is
+ * interval A and the interval in the parameter UTO is interval B. If
OverlapType is not
+ * OTNoOverlap, then the out parameter overlap contains the overlap
interval, otherwise
+ * the out parameter contains the gap between the two intervals. The
exception
+ * CORBA::BAD_PARAM is raised if the UTO passed in is invalid.
+ * @param uto universal time object
+ * @param tioholder time interval holder
+ * @return OverlapType the overlap type
+ */
public OverlapType spans(UTO uto, TIOHolder tioholder)
{
long l = uto.time();
@@ -75,6 +108,18 @@
}
}
+ /**
+ * This operation returns a value of type OverlapType depending on how
the interval in
+ * the object and interval in the parameter TIO overlap. See the
definition of
+ * OverlapType in Section 14.2.2, Data Types. The interval in the object
is interval A and
+ * the interval in the parameter TIO is interval B. If OverlapType is
not OTNoOverlap,
+ * then the out parameter overlap contains the overlap interval,
otherwise the out
+ * parameter contains the gap between the two intervals. The exception
+ * CORBA::BAD_PARAM is raised if the TIO passed in is invalid.
+ * @param tio time interval
+ * @param tioholder time interval holder
+ * @return OverlapType the overlap type
+ */
public OverlapType overlaps(TIO tio, TIOHolder tioholder)
{
long l = tio.time_interval().lower_bound
@@ -113,6 +158,11 @@
}
}
+ /**
+ * Returns a UTO in which the inaccuracy interval is equal to the time
interval in the ITO
+ * and time value is the midpoint of the interval.
+ * @return UTO universal time object
+ */
public UTO time()
{
DefaultUTO uto = new DefaultUTO(
1.4 +80 -32
jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/DefaultTimerEventHandler.java
Index: DefaultTimerEventHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/DefaultTimerEventHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultTimerEventHandler.java 5 Apr 2002 07:02:34 -0000 1.3
+++ DefaultTimerEventHandler.java 14 May 2002 07:29:15 -0000 1.4
@@ -17,80 +17,115 @@
import org.omg.CosEventComm.PushConsumer;
import org.omg.CosTime.UTO;
import org.omg.CosTime.UTOHolder;
-import org.omg.CosTimerEvent.*;
+import org.omg.CosTimerEvent.TimerEventHandlerPOA;
+import org.omg.CosTimerEvent.EventStatus;
+import org.omg.CosTimerEvent.TimeType;
+import org.omg.CosTimerEvent.TimerEventT;
+import org.omg.CosTimerEvent.TimerEventTHelper;
import org.omg.TimeBase.UtcT;
/**
* Default implementation of the timer event handler.
+ * @author multiple
*/
public class DefaultTimerEventHandler extends TimerEventHandlerPOA
implements Runnable
{
- ORB m_orb;
- DefaultTimerEventService m_parent;
- PushConsumer m_event_channel;
- EventStatus m_status;
- Any m_data;
- boolean m_is_set;
- boolean m_periodic;
- long m_delay;
- long m_last_relative;
- long m_current_time;
- long m_set_time;
- Thread m_thread;
-
- public DefaultTimerEventHandler(DefaultTimerEventService service,
PushConsumer cosumer, long value)
+ private ORB m_orb;
+ private DefaultTimerEventService m_parent;
+ private PushConsumer m_eventChannel;
+ private EventStatus m_status;
+ private Any m_data;
+ private boolean m_isSet;
+ private boolean m_periodic;
+ private long m_delay;
+ private long m_lastRelative;
+ private long m_currentTime;
+ private long m_setTime;
+ private Thread m_thread;
+
+ /**
+ * Creation of a new timer event handler.
+ * @param service timer event service implementation
+ * @param consumer event consumer
+ * @param value the value
+ */
+ public DefaultTimerEventHandler(DefaultTimerEventService service,
+ PushConsumer consumer, long value)
{
m_status = null;
m_data = null;
- m_is_set = false;
+ m_isSet = false;
m_periodic = false;
- m_last_relative = 0L;
+ m_lastRelative = 0L;
m_thread = null;
m_parent = service;
m_orb = this._orb();
- m_event_channel = cosumer;
+ m_eventChannel = consumer;
m_status = EventStatus.ESTimeCleared;
- m_current_time = value;
+ m_currentTime = value;
}
- public EventStatus status()
+ /**
+ * Read accessor for status attribute
+ * @return org.omg.CosTimerEvent.EventStatus the attribute value
+ */
+ public org.omg.CosTimerEvent.EventStatus status()
{
return m_status;
}
+ /**
+ * Operation time_set
+ * @param utoholder a holder of a UTO value
+ * @return boolean value
+ */
public boolean time_set(UTOHolder utoholder)
{
- return m_is_set && m_status.value() == 0;
+ return m_isSet && m_status.value() == 0;
}
+ /**
+ * Set the timer.
+ * @param timetype the time type
+ * @param uto the time value
+ */
public void SetTimer(TimeType timetype, UTO uto)
{
m_thread = null;
- m_set_time = (new Date()).getTime();
+ m_setTime = (new Date()).getTime();
if(timetype.value() == 0)
{
Date date = new Date();
m_delay = uto.time() - date.getTime();
- } else
+ }
+ else
{
if(timetype.value() == 2)
+ {
m_periodic = true;
+ }
if(uto.time() == 0L)
{
- if(m_last_relative == 0L)
+ if(m_lastRelative == 0L)
+ {
throw new BAD_PARAM();
- m_delay = m_last_relative;
+ }
+ m_delay = m_lastRelative;
}
m_delay = uto.time();
- m_last_relative = m_delay;
+ m_lastRelative = m_delay;
}
m_status = EventStatus.ESTimeSet;
m_thread = new Thread(this, "");
m_thread.start();
}
+ /**
+ * Cancel the timer.
+ * @return boolean value
+ */
public boolean cancel_timer()
{
if(m_status.value() == 0 || m_status.value() == 2 && m_periodic)
@@ -98,18 +133,26 @@
m_status = EventStatus.ESTimeCleared;
m_thread = null;
return true;
- } else
+ }
+ else
{
return false;
}
}
+ /**
+ * Set timer data.
+ * @param any an any
+ */
public void set_data(Any any)
{
m_data = m_orb.create_any();
m_data = any;
}
+ /**
+ * Run the timmer.
+ */
public void run()
{
TimerEventT timereventt = new TimerEventT(null, m_data);
@@ -122,9 +165,10 @@
Thread.sleep(m_delay);
try
{
- timereventt.utc = new UtcT((new Date()).getTime(), 0,
(short)0, (short)0);
+ timereventt.utc = new UtcT((new Date()).getTime(),
+ 0, (short)0, (short)0);
TimerEventTHelper.insert(any, timereventt);
- m_event_channel.push(any);
+ m_eventChannel.push(any);
m_status = EventStatus.ESTriggered;
}
catch(Disconnected disconnected)
@@ -136,11 +180,15 @@
m_parent.unregister(_this());
break;
}
- if(!m_periodic) break;
+ if(!m_periodic)
+ {
+ break;
+ }
+ }
+ catch(InterruptedException interruptedexception)
+ {
}
- catch(InterruptedException interruptedexception) { }
}
m_thread = null;
}
-
}
1.3 +28 -7
jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/DefaultTimerEventService.java
Index: DefaultTimerEventService.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/DefaultTimerEventService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultTimerEventService.java 5 Apr 2002 07:02:34 -0000 1.2
+++ DefaultTimerEventService.java 14 May 2002 07:29:15 -0000 1.3
@@ -14,23 +14,35 @@
import org.omg.CORBA.ORB;
import org.omg.CosEventComm.PushConsumer;
import org.omg.CosTime.UTO;
-import org.omg.CosTimerEvent.*;
+import org.omg.CosTimerEvent.TimerEventT;
+import org.omg.CosTimerEvent.TimerEventServicePOA;
+import org.omg.CosTimerEvent.TimerEventHandler;
/**
* Default implementation of the timer event service.
+ * @author multiple
*/
public class DefaultTimerEventService extends TimerEventServicePOA
{
- Vector m_vector;
- ORB m_orb;
+ private Vector m_vector;
+ private ORB m_orb;
+ /**
+ * Creation of a new event timer service.
+ */
public DefaultTimerEventService()
{
m_orb = this._orb();
m_vector = new Vector();
}
+ /**
+ * Returns a timer event handler.
+ * @param consumer the event consumer
+ * @param any an any
+ * @return TimerEventHandler the handler
+ */
public TimerEventHandler register(PushConsumer consumer, Any any)
{
DefaultTimerEventHandler timereventhandlerimpl = new
DefaultTimerEventHandler(
@@ -40,14 +52,23 @@
return timereventhandlerimpl._this( m_orb );
}
- public void unregister(TimerEventHandler timereventhandler)
+ /**
+ * Unregister a timer event handler.
+ * @param handler the handler to unregister
+ */
+ public void unregister(TimerEventHandler handler)
{
- m_vector.removeElement(timereventhandler);
+ m_vector.removeElement(handler);
}
- public UTO event_time(TimerEventT timereventt)
+ /**
+ * Return the event time from a timer event.
+ * @param event the timer event containg the event time
+ * @return UTO the time
+ */
+ public UTO event_time(TimerEventT event )
{
- DefaultUTO uto = new DefaultUTO( timereventt.utc);
+ DefaultUTO uto = new DefaultUTO( event.utc);
return uto._this( this._orb() );
}
1.3 +129 -39
jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/DefaultUTO.java
Index: DefaultUTO.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/DefaultUTO.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultUTO.java 5 Apr 2002 07:02:34 -0000 1.2
+++ DefaultUTO.java 14 May 2002 07:29:15 -0000 1.3
@@ -9,59 +9,104 @@
package org.apache.time;
import java.util.Date;
-import org.omg.CORBA.ORB;
-import org.omg.CosTime.*;
+import org.omg.CosTime.UTO;
+import org.omg.CosTime.TIO;
+import org.omg.CosTime.UTOPOA;
+import org.omg.CosTime.ComparisonType;
+import org.omg.CosTime.TimeComparison;
import org.omg.TimeBase.UtcT;
/**
- * Implementation of a Universal Time Object.
+ * Implementation of a Universal Time Object.
+ * @author multiple
*/
public class DefaultUTO extends UTOPOA
{
- private long m_uto_time;
- private long m_uto_inaccuracy;
- private short m_uto_tdf;
-
+ private long m_utoTime;
+ private long m_utoInaccuracy;
+ private short m_utoTdf;
+
+ /**
+ * Creation of a new UTO.
+ */
public DefaultUTO()
{
}
+ /**
+ * Creation of a new UTO.
+ * @param utct value
+ */
public DefaultUTO(UtcT utct)
{
- m_uto_time = utct.time;
- m_uto_tdf = utct.tdf;
- m_uto_inaccuracy = (utct.inacchi << 4) + utct.inacclo;
- }
-
- public DefaultUTO(long l, long l1, short word0)
- {
- m_uto_time = l;
- m_uto_inaccuracy = l1;
- m_uto_tdf = word0;
- }
-
+ m_utoTime = utct.time;
+ m_utoTdf = utct.tdf;
+ m_utoInaccuracy = (utct.inacchi << 4) + utct.inacclo;
+ }
+
+ /**
+ * Creation of a new UTO.
+ * @param time value
+ * @param inaccuracy value
+ * @param tdf value
+ */
+ public DefaultUTO(long time, long inaccuracy, short tdf )
+ {
+ m_utoTime = time;
+ m_utoInaccuracy = inaccuracy;
+ m_utoTdf = tdf;
+ }
+
+ /**
+ * This is the time attribute of a UTO represented as a value of type
TimeT.
+ * @return long the time value
+ */
public long time()
{
- return m_uto_time;
+ return m_utoTime;
}
+ /**
+ * This is the inaccuracy attribute of a UTO represented as a value of
+ * type InaccuracyT.
+ * @return long inaccuracy value
+ */
public long inaccuracy()
{
- return m_uto_inaccuracy;
+ return m_utoInaccuracy;
}
+ /**
+ * This is the time displacement factor attribute tdf of a UTO
represented as a value
+ * of type TdfT.
+ * @return short tdf value
+ */
public short tdf()
{
- return m_uto_tdf;
+ return m_utoTdf;
}
+ /**
+ * This attribute returns a properly populated UtcT structure with data
corresponding to
+ * the contents of the UTO.
+ * @return UtcT the UtcT value
+ */
public UtcT utc_time()
{
- long l = m_uto_inaccuracy >> 32;
- return new UtcT(m_uto_time, (int)(m_uto_inaccuracy & 0x7fffffffL),
(short)(int)(l & 32767L), m_uto_tdf);
+ long l = m_utoInaccuracy >> 32;
+ return new UtcT(m_utoTime, (int)(m_utoInaccuracy & 0x7fffffffL),
+ (short)(int)(l & 32767L), m_utoTdf);
}
+ /**
+ * This attribute returns a UTO containing the absolute time
+ * corresponding to the relative time in object. Absolute
+ * time = current time + time in the object. Raises
+ * <CODE>CORBA::DATA_CONVERSION</CODE> exception if the
+ * attempt to obtain absolute time causes an overflow.
+ * @return UTO abosolute time object
+ */
public UTO absolute_time()
{
long l = (new Date()).getTime();
@@ -69,53 +114,98 @@
return DefaultUTO._this( this._orb() );
}
+ /**
+ * Compares the time contained in the object with the time given in the
input parameter
+ * uto using the comparison type specified in the in parameter
comparison_type, and
+ * returns the result. See the description of TimeComparison in Section
14.2.2, Data
+ * Types, for an explanation of the result. See the explanation of
ComparisonType in
+ * Section 14.2.2 for an explanation of comparison types. Note that the
time in the object
+ * is always used as the first parameter in the comparison. The time in
the utc parameter
+ * is used as the second parameter in the comparison.
+ * @param comparisontype the comparison type
+ * @param uto time object
+ * @return TimeComparison time comparison
+ */
public TimeComparison compare_time(ComparisonType comparisontype, UTO
uto)
{
if(comparisontype.value() == ComparisonType.IntervalC.value())
{
- if(uto.time() == m_uto_time && uto.inaccuracy() == 0L &&
m_uto_inaccuracy == 0L)
+ if(uto.time() == m_utoTime && uto.inaccuracy() == 0L &&
m_utoInaccuracy == 0L)
+ {
return TimeComparison.TCEqualTo;
- if(m_uto_time < uto.time() && m_uto_time + m_uto_inaccuracy >
uto.time() - uto.inaccuracy())
+ }
+ if(m_utoTime < uto.time() && m_utoTime + m_utoInaccuracy >
+ uto.time() - uto.inaccuracy())
+ {
return TimeComparison.TCIndeterminate;
- if(m_uto_time > uto.time() && m_uto_time - m_uto_inaccuracy <
uto.time() + uto.inaccuracy())
+ }
+ if(m_utoTime > uto.time() && m_utoTime - m_utoInaccuracy
+ < uto.time() + uto.inaccuracy())
+ {
return TimeComparison.TCIndeterminate;
- if(m_uto_time > uto.time())
+ }
+ if(m_utoTime > uto.time())
+ {
return TimeComparison.TCGreaterThan;
- if(m_uto_time < uto.time())
+ }
+ if(m_utoTime < uto.time())
+ {
return TimeComparison.TCLessThan;
- } else
- if(comparisontype.value() == ComparisonType.MidC.value())
+ }
+ }
+ else if(comparisontype.value() == ComparisonType.MidC.value())
{
- if(uto.time() == m_uto_time)
+ if(uto.time() == m_utoTime)
+ {
return TimeComparison.TCEqualTo;
- if(uto.time() < m_uto_time)
+ }
+ if(uto.time() < m_utoTime)
+ {
return TimeComparison.TCGreaterThan;
- if(uto.time() > m_uto_time)
+ }
+ if(uto.time() > m_utoTime)
+ {
return TimeComparison.TCLessThan;
+ }
}
return TimeComparison.TCLessThan;
}
+ /**
+ * Returns a TIO representing the time interval between the time in the
object and the
+ * time in the UTO passed in the parameter uto. The interval returned is
the interval
+ * between the midpoints of the two UTOs and the inaccuracies in the
UTOs are not
+ * taken into consideration. The result is meaningless if the time base
used by the two
+ * UTOs are different.
+ * @param uto value
+ * @return TIO representing the time interval between the time in the
object and the
+ * time in the UTO passed in the parameter uto
+ */
public TIO time_to_interval(UTO uto)
{
long l;
long l1;
- if(m_uto_time < uto.time())
+ if(m_utoTime < uto.time())
{
- l = m_uto_time;
+ l = m_utoTime;
l1 = uto.time();
- } else
+ }
+ else
{
- l1 = m_uto_time;
+ l1 = m_utoTime;
l = uto.time();
}
DefaultTIO tio = new DefaultTIO(l, l1);
return tio._this( this._orb());
}
+ /**
+ * Return the interval of this UTO
+ * @return TIO time interval object
+ */
public TIO interval()
{
- DefaultTIO tio = new DefaultTIO(m_uto_time - m_uto_inaccuracy,
m_uto_time + m_uto_inaccuracy);
+ DefaultTIO tio = new DefaultTIO(m_utoTime - m_utoInaccuracy,
m_utoTime + m_utoInaccuracy);
return tio._this( this._orb());
}
1.5 +31 -20
jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/Initializer.java
Index: Initializer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/Initializer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Initializer.java 5 Apr 2002 07:02:34 -0000 1.4
+++ Initializer.java 14 May 2002 07:29:15 -0000 1.5
@@ -6,16 +6,12 @@
*/
package org.apache.time;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Policy;
-import org.omg.CORBA.LocalObject;
import org.omg.PortableServer.POA;
import org.omg.PortableInterceptor.ORBInitInfo;
import org.omg.PortableInterceptor.ORBInitializer;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.configuration.Configurable;
@@ -32,7 +28,6 @@
* Initializer for an embedded time server.
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
-
public class Initializer extends LoggableLocalObject
implements Configurable, Contextualizable, ORBInitializer, Disposable
{
@@ -48,7 +43,8 @@
/**
* Method invoked by the Apache ORB initializer to declare the runtime
context.
- * @param Context runtime application context
+ * @param context Context runtime application context
+ * @exception ContextException if a context related error occurs
*/
public void contextualize( Context context ) throws ContextException
{
@@ -61,7 +57,8 @@
/**
* Method invoked by the ORB initializer to declare the static
configuration.
- * @param Configuration application static configuration
+ * @param config Configuration application static configuration
+ * @exception ConfigurationException if a configuration related error
occurs
*/
public void configure( final Configuration config )
throws ConfigurationException
@@ -77,21 +74,23 @@
* Method invoked by the ORB. The implementation establish the POA and
servant
* and passes the ORBInitInfo to the target POA as a context parameter
for inital
* reference registration.
- * @param info
+ * @param info the ORB init info
*/
public void pre_init( ORBInitInfo info )
{
-
}
/**
* Post initalization of the interceptor invoked by the
* ORB in which this interceptor is installed.
- * @param info
+ * @param info the ORB init info
*/
public void post_init( ORBInitInfo info )
{
- if( getLogger().isDebugEnabled() ) getLogger().debug("Initializer" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug("Initializer" );
+ }
//
// create an TimePOA
@@ -100,7 +99,10 @@
try
{
POA root = (POA) info.resolve_initial_references("RootPOA");
- if( getLogger().isDebugEnabled() ) getLogger().debug("creating
POA" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug("creating POA" );
+ }
m_target = new TimeProvider();
m_target.enableLogging( getLogger().getChildLogger("provider") );
m_target.contextualize( m_context );
@@ -113,17 +115,19 @@
}
catch( Throwable e)
{
- throw new CascadingRuntimeException( "Unable to instantiate
embedded server.", e);
+ throw new CascadingRuntimeException(
+ "Unable to instantiate embedded server.", e);
}
try
{
- info.register_initial_reference(
+ info.register_initial_reference(
"TimeService", m_target._this_object() );
}
catch( Throwable e)
{
- throw new CascadingRuntimeException( "Unable to register
server.", e);
+ throw new CascadingRuntimeException(
+ "Unable to register server.", e);
}
try
@@ -132,7 +136,8 @@
}
catch( Throwable e)
{
- throw new CascadingRuntimeException( "Unable to start embedded
server.", e);
+ throw new CascadingRuntimeException(
+ "Unable to start embedded server.", e);
}
m_initialized = true;
@@ -142,7 +147,7 @@
//=======================================================================
// Disposable
//=======================================================================
-
+
/**
* Disposal will be invoked by the ORB initializer following shutdown of
the
* ORB we have been initialized within.
@@ -155,15 +160,21 @@
return;
}
- if( getLogger().isDebugEnabled() ) getLogger().debug("initializer
disposal" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug("initializer disposal" );
+ }
try
{
m_target.stop();
}
catch( Throwable e )
{
- if( getLogger().isWarnEnabled() ) getLogger().warn(
- "ignoring exception while stopping the time provider", e );
+ if( getLogger().isWarnEnabled() )
+ {
+ getLogger().warn(
+ "ignoring exception while stopping the time provider", e );
+ }
}
finally
{
1.2 +32 -2
jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/ReleaseInfo.java
Index: ReleaseInfo.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/ReleaseInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReleaseInfo.java 8 Mar 2002 05:55:06 -0000 1.1
+++ ReleaseInfo.java 14 May 2002 07:29:15 -0000 1.2
@@ -10,16 +10,46 @@
/**
* Release information for the time service implementation.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
public class ReleaseInfo extends org.openorb.ReleaseInfo
{
+ /**
+ * Major version.
+ */
public static final short OPENORB_TIME_MAJOR = 2;
+
+ /**
+ * Monor version.
+ */
public static final short OPENORB_TIME_MINOR = 0;
+
+ /**
+ * Monor change.
+ */
public static final short OPENORB_TIME_MINOR_CHANGE = 0;
+
+ /**
+ * Basic version.
+ */
public static final String OPENORB_TIME_VERSION = "2.0";
+
+ /**
+ * Composite version
+ */
public static final String VERSION = "2.0 over ORB Version 1.3";
- public static final String RELEASE = "TimeService Version 2.0 over ORB
Implementation Version 1.3.0";
- public static String RELEASE_TAG =
"TimeService_2_0_0_over_ORB_Implementation_Version 1.3.0";
+
+ /**
+ * Release string.
+ */
+ public static final String RELEASE =
+ "TimeService Version 2.0 over ORB Implementation Version 1.3.0";
+
+ /**
+ * Release tag.
+ */
+ public static final String RELEASE_TAG =
+ "TimeService_2_0_0_over_ORB_Implementation_Version 1.3.0";
}
1.3 +151 -78
jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/TimeProvider.java
Index: TimeProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/TimeProvider.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TimeProvider.java 5 Apr 2002 07:02:34 -0000 1.2
+++ TimeProvider.java 14 May 2002 07:29:15 -0000 1.3
@@ -11,30 +11,16 @@
package org.apache.time;
import java.io.File;
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.Properties;
import java.util.Date;
-import org.omg.CORBA.ORB;
import org.omg.CORBA.Policy;
-import org.omg.CORBA.LocalObject;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
-import org.omg.PortableInterceptor.ORBInitializer;
import org.omg.PortableServer.POA;
-import org.omg.PortableServer.Servant;
-import org.omg.PortableServer.POAHelper;
-import org.omg.PortableServer.ImplicitActivationPolicyValue;
import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.IdUniquenessPolicyValue;
import org.omg.CosTime.TimeServiceHelper;
-import org.omg.CosTime.TimeService;
import org.omg.CosTime.TimeServicePOA;
import org.omg.PortableServer.IdAssignmentPolicyValue;
import org.apache.avalon.framework.CascadingException;
-import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.Contextualizable;
@@ -50,15 +36,11 @@
import org.apache.avalon.framework.activity.Executable;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.logger.LogEnabled;
-import org.apache.avalon.phoenix.BlockContext;
import org.apache.avalon.phoenix.Block;
import org.apache.orb.POAContext;
-import org.apache.orb.DefaultSingletonManager;
import org.apache.orb.util.IOR;
-import org.openorb.CORBA.LoggableLocalObject;
-
/**
* <code>TimeBlock</code> compliant with the OMG CosTime interface
specification.
* <p><table border="1" cellpadding="3" cellspacing="0" width="100%">
@@ -198,18 +180,27 @@
/**
* Set the component context.
* @param context the component context
+ * @exception ContextException if a context related exception occurs
*/
public void contextualize( Context context )
throws ContextException
{
- if( getLogger().isDebugEnabled() ) getLogger().debug(
"contextualization" );
- m_context = context;
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "contextualization" );
+ }
+ m_context = context;
}
//=======================================================================
// Configurable
//=======================================================================
+ /**
+ * Set the component configuration.
+ * @param config the component configuration
+ * @exception ConfigurationException if a configuration related exception
occurs
+ */
public void configure( final Configuration config )
throws ConfigurationException
{
@@ -222,13 +213,20 @@
try
{
m_inaccuracy =
m_config.getChild("profile").getAttributeAsInteger(
- "inaccuracy", m_inaccuracy );
- if( getLogger().isDebugEnabled() ) getLogger().debug(
- "setting inaccuracy to " + m_inaccuracy );
- } catch (Exception e)
+ "inaccuracy", m_inaccuracy );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug(
+ "setting inaccuracy to " + m_inaccuracy );
+ }
+ }
+ catch (Exception e)
{
- if( getLogger().isDebugEnabled() ) getLogger().debug(
- "setting inaccuracy to default " + m_inaccuracy );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug(
+ "setting inaccuracy to default " + m_inaccuracy );
+ }
}
}
@@ -244,11 +242,15 @@
*
* @param manager The <code>ServiceManager</code> which this
* <code>Serviceable</code> uses.
+ * @exception ServiceException if a service related exception occurs
*/
public void service( ServiceManager manager )
throws ServiceException
{
- if( getLogger().isDebugEnabled() ) getLogger().debug( "service
composition" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "service composition" );
+ }
m_manager = manager;
}
@@ -258,29 +260,45 @@
/**
* One-time initalization of the service during which the POA is
established.
- * @exception IllegalStateException if the server has been disposed of,
if
- * has not log enabled, configured, contextualized, or serviced.
* @exception Exception if a general initalization error occurs
*/
public void initialize()
throws Exception
{
- if( m_disposed ) throw new IllegalStateException(
- "Service is disposed.");
+ if( m_disposed )
+ {
+ throw new IllegalStateException(
+ "Service is disposed.");
+ }
- if( m_initialized ) throw new IllegalStateException(
- "Service cannot be re-initialized.");
+ if( m_initialized )
+ {
+ throw new IllegalStateException(
+ "Service cannot be re-initialized.");
+ }
- if( m_logger == null ) throw new IllegalStateException(
- "Missing logger.");
+ if( m_logger == null )
+ {
+ throw new IllegalStateException(
+ "Missing logger.");
+ }
- if( m_config == null ) throw new IllegalStateException(
- "Missing configuration.");
+ if( m_config == null )
+ {
+ throw new IllegalStateException(
+ "Missing configuration.");
+ }
- if( m_manager == null ) throw new IllegalStateException(
- "Missing service manager.");
+ if( m_manager == null )
+ {
+ throw new IllegalStateException(
+ "Missing service manager.");
+ }
- if( getLogger().isDebugEnabled() ) getLogger().debug(
"initialization" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "initialization" );
+ }
//
// create the POA
@@ -290,7 +308,7 @@
String name = "TIME";
try
- {
+ {
m_poa = m_root.create_POA(
name,
m_root.the_POAManager(),
@@ -300,16 +318,16 @@
m_root.create_lifespan_policy(
LifespanPolicyValue.PERSISTENT )
}
);
- }
- catch( Throwable e )
- {
- String error = "Unable to create the application POA";
- throw new CascadingException( error, e );
- }
-
- byte[] ID = name.getBytes();
- m_poa.activate_object_with_id( ID, this );
- m_service = TimeServiceHelper.narrow( m_poa.id_to_reference(ID) );
+ }
+ catch( Throwable e )
+ {
+ String error = "Unable to create the application POA";
+ throw new CascadingException( error, e );
+ }
+
+ byte[] id = name.getBytes();
+ m_poa.activate_object_with_id( id, this );
+ m_service = TimeServiceHelper.narrow( m_poa.id_to_reference( id ) );
//
// publish the service
@@ -321,13 +339,19 @@
try
{
IOR.writeIOR( this._orb(), m_service, ior );
- if( getLogger().isDebugEnabled() ) getLogger().debug(
- "IOR published to path: " + ior );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug(
+ "IOR published to path: " + ior );
+ }
}
catch( Throwable e )
{
final String warning = "IOR publication disabled due to
internal error.";
- if( getLogger().isWarnEnabled() ) getLogger().warn( warning,
e );
+ if( getLogger().isWarnEnabled() )
+ {
+ getLogger().warn( warning, e );
+ }
}
}
@@ -341,13 +365,18 @@
/**
* Logs the current time.
+ * @exception Exception if a time service related error occurs
*/
public void execute() throws Exception
{
- if( getLogger().isInfoEnabled() ) getLogger().info(
- "current time: " + TimeUtils.convertToDate(
this.universal_time().time() ));
+ if( getLogger().isInfoEnabled() )
+ {
+ getLogger().info(
+ "current time: "
+ + TimeUtils.convertToDate( this.universal_time().time() ));
+ }
}
-
+
//=======================================================================
// Startable
//=======================================================================
@@ -358,19 +387,33 @@
*/
public void start()
{
- if( !m_initialized ) throw new IllegalStateException(
- "Chooser has not been initalized.");
- if( m_disposed ) throw new IllegalStateException(
- "Chooser is disposed.");
+ if( !m_initialized )
+ {
+ throw new IllegalStateException(
+ "Chooser has not been initalized.");
+ }
+
+ if( m_disposed )
+ {
+ throw new IllegalStateException(
+ "Chooser is disposed.");
+ }
- if( getLogger().isDebugEnabled() ) getLogger().debug( "start" );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "start" );
+ }
+
try
{
m_poa.the_POAManager().activate();
}
catch( Throwable e )
{
- if( getLogger().isWarnEnabled() ) getLogger().warn( "startup
exception", e );
+ if( getLogger().isWarnEnabled() )
+ {
+ getLogger().warn( "startup exception", e );
+ }
}
}
@@ -379,19 +422,32 @@
*/
public void stop()
{
- if( !m_initialized ) throw new IllegalStateException(
- "Chooser has not been initalized.");
- if( m_disposed ) throw new IllegalStateException(
- "Chooser is disposed.");
+ if( !m_initialized )
+ {
+ throw new IllegalStateException(
+ "Chooser has not been initalized.");
+ }
+ if( m_disposed )
+ {
+ throw new IllegalStateException(
+ "Chooser is disposed.");
+ }
+
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "stop" );
+ }
- if( getLogger().isDebugEnabled() ) getLogger().debug( "stop" );
try
{
m_poa.destroy( true, true );
}
catch( Throwable e )
{
- if( getLogger().isWarnEnabled() ) getLogger().warn( "ignoring
POA related exception" );
+ if( getLogger().isWarnEnabled() )
+ {
+ getLogger().warn( "ignoring POA related exception" );
+ }
}
}
@@ -417,14 +473,22 @@
File file = new File( ior );
try
{
- if( file.exists() );
- file.delete();
- if( getLogger().isDebugEnabled() ) getLogger().debug(
"IOR removed" );
+ if( file.exists() )
+ {
+ file.delete();
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "IOR removed" );
+ }
+ }
}
catch( Throwable e )
{
final String warning = "Failed to remove the IOR.";
- if( getLogger().isWarnEnabled() ) getLogger().warn(
warning, e );
+ if( getLogger().isWarnEnabled() )
+ {
+ getLogger().warn( warning, e );
+ }
}
}
}
@@ -446,8 +510,9 @@
* a UTO. It raises TimeUnavailable exceptions to indicate failure of an
underlying time
* provider. The time returned in the UTO by this operation is not
guaranteed to be secure
* or trusted. If any time is available at all, that time is returned by
this operation.
+ * @return org.omg.CosTime.UTO time object
+ * @exception org.omg.CosTime.TimeUnavailable if time unavailable
*/
-
public org.omg.CosTime.UTO universal_time()
throws org.omg.CosTime.TimeUnavailable
{
@@ -464,8 +529,9 @@
* uncertainty at all about meeting any aspect of these criteria, then
this operation must
* return the TimeUnavailable exception. Thus, time obtained through this
operation can
* always be trusted.
+ * @return org.omg.CosTime.UTO time object
+ * @exception org.omg.CosTime.TimeUnavailable if time unavailable
*/
-
public org.omg.CosTime.UTO secure_universal_time()
throws org.omg.CosTime.TimeUnavailable
{
@@ -481,8 +547,11 @@
* is expected to be used for building UTOs that can be passed as the
various time
* arguments to the Timer Event Service, for example. CORBA::BAD_PARAM is
* raised in the case of an out-of-range parameter value for inaccuracy.
+ * @param t time
+ * @param inac inaccuracy
+ * @param tdf value
+ * @return org.omg.CosTime.UTO time object
*/
-
public org.omg.CosTime.UTO new_universal_time(long t, long inac, short
tdf)
{
DefaultUTO uto = new DefaultUTO(t, inac, tdf);
@@ -494,8 +563,9 @@
* This has a single in parameter UTC, which contains a time together
with inaccuracy
* and tdf. The UTO returned is initialized with the values from the UTC
parameter. This
* operation is used to convert a UTC received over the wire into a UTO.
+ * @param utc UtcT time object
+ * @return org.omg.CosTime.UTO time object
*/
-
public org.omg.CosTime.UTO uto_from_utc(org.omg.TimeBase.UtcT utc)
{
long l = (utc.inacchi << 4) + utc.inacclo;
@@ -508,11 +578,14 @@
* and upper, both of type TimeT, holding the lower and upper bounds of
the interval. If
* the value of the lower parameter is greater than the value of the
upper parameter, then
* a CORBA::BAD_PARAM exception is raised.
+ * @param lower value
+ * @param upper value
+ * @return org.omg.CosTime.TIO
*/
-
public org.omg.CosTime.TIO new_interval(long lower, long upper)
{
DefaultTIO tio = new DefaultTIO(lower, upper);
return tio._this(this._orb());
}
}
+
\ No newline at end of file
1.3 +59 -37
jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/TimeUtils.java
Index: TimeUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-apps/enterprise/time/src/java/org/apache/time/TimeUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TimeUtils.java 9 Mar 2002 04:50:20 -0000 1.2
+++ TimeUtils.java 14 May 2002 07:29:15 -0000 1.3
@@ -13,41 +13,54 @@
import org.omg.CosTime.TimeService;
import java.util.Date;
-import java.util.GregorianCalendar;
/**
* The TimeUtils class contains a set of static utility methods
* supporting maniputlation of UTcT values.
+ * @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
-
-public abstract class TimeUtils {
+public abstract class TimeUtils
+{
private static final long STDACCURACCY = 10000;
- /**
- * Converts a UtcT datastructure to a java.util.Date format.
- */
-
- public static Date convertToDate( UtcT utc ) {
+ /**
+ * Converts a UtcT datastructure to a java.util.Date format.
+ * @param utc the UTC structure
+ * @return Date the equivalent date
+ */
+ public static Date convertToDate( UtcT utc )
+ {
long t = utc.time;
return new Date(t);
}
- public static Date convertToDate( long value ) {
+ /**
+ * Converts a UtcT time value to a java.util.Date format.
+ * @param value the UTC time value
+ * @return Date the equivalent date
+ */
+ public static Date convertToDate( long value )
+ {
long t = convertToUtcT( value ).time;
return new Date(t);
}
+ /**
+ * Converts a long value to a UtcT format.
+ * @param value the time value
+ * @return UtcT the equivalent UtcT value
+ */
public static UtcT convertToUtcT( long value )
{
long tmp = STDACCURACCY >> 32;
return new UtcT
(
- value,
- (int )( STDACCURACCY & Integer.MAX_VALUE),
- (short )(tmp & Short.MAX_VALUE),
- (short )0
+ value,
+ (int)( STDACCURACCY & Integer.MAX_VALUE),
+ (short)(tmp & Short.MAX_VALUE),
+ (short) 0
);
}
@@ -58,47 +71,56 @@
* TimeService - however, the operation does not involve a server request
* and as such is usefull when setting UtcT default values in local
* valuetype constructors.
+ * @param date the date to convert
+ * @return UtcT value
*/
-
- public static UtcT dateToUtc( Date date ) {
+ public static UtcT dateToUtc( Date date )
+ {
long tmp = STDACCURACCY >> 32;
- return new org.omg.TimeBase.UtcT
- (
- date.getTime(),
- (int )( STDACCURACCY & Integer.MAX_VALUE),
- (short )(tmp & Short.MAX_VALUE),
- (short )0
+ return new org.omg.TimeBase.UtcT(
+ date.getTime(),
+ (int )( STDACCURACCY & Integer.MAX_VALUE),
+ (short )(tmp & Short.MAX_VALUE),
+ (short )0
);
}
- public static UtcT getCurrentTime() {
- return dateToUtc( new java.util.Date() );
+ /**
+ * Returns the current time as a UtcT value.
+ * @return UtcT the current time
+ */
+ public static UtcT getCurrentTime()
+ {
+ return dateToUtc( new java.util.Date() );
}
- /**
+ /**
* Returns the current time in the form of a long based on the
* the current time from the supplied time server.
- */
-
- public static long getTime( TimeService time ) throws TimeUnavailable
+ * @param service the time service
+ * @return long the time value
+ * @exception TimeUnavailable if the time is unavailable
+ */
+ public static long getTime( TimeService service ) throws TimeUnavailable
{
- return time.universal_time().time();
+ return service.universal_time().time();
}
/**
* Resolves time by attempting to get time from a time server, and if
* unavailable, uses the JVM.
+ * @param service the time service
+ * @return long the current time value
*/
-
- public static long resolveTime( TimeService time )
+ public static long resolveTime( TimeService service )
{
- try
- {
- return getTime( time );
- }
- catch(Exception e)
- {
- return getCurrentTime().time;
+ try
+ {
+ return getTime( service );
+ }
+ catch(Exception e)
+ {
+ return getCurrentTime().time;
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>