You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by sg...@apache.org on 2015/08/06 23:02:23 UTC
svn commit: r1694573 - in /turbine/fulcrum/trunk/yaafi:
src/java/org/apache/fulcrum/yaafi/cli/
src/java/org/apache/fulcrum/yaafi/framework/component/
src/java/org/apache/fulcrum/yaafi/framework/factory/
src/test/org/apache/fulcrum/yaafi/testcontainer/ ...
Author: sgoeschl
Date: Thu Aug 6 21:02:23 2015
New Revision: 1694573
URL: http://svn.apache.org/r1694573
Log:
Clean up code and fix typos.
Modified:
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java
turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/Container.java
turbine/fulcrum/trunk/yaafi/tutorial/src/java/tutorial/service/SystemPropertyService.java
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java?rev=1694573&r1=1694572&r2=1694573&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java Thu Aug 6 21:02:23 2015
@@ -20,7 +20,7 @@ package org.apache.fulcrum.yaafi.cli;
*/
/**
-* Extremly simply command line parsing class.
+* Extremely simply command line parsing class.
*/
public class Getopt
@@ -44,7 +44,7 @@ public class Getopt
* Constructor.
*
* @param args the command line parameters
- * @param prefix the prefix for command line paramters
+ * @param prefix the prefix for command line parameters
*/
public Getopt( String[] args, String prefix )
{
@@ -61,6 +61,8 @@ public class Getopt
}
/**
+ * Does the command-line options exist?
+ *
* @param option the option we are looking for
* @return is the given option contained in the command line arguments?
*/
@@ -80,6 +82,7 @@ public class Getopt
/**
* Returns the string value for the given option.
+ *
* @param option the option
* @return the associated value
*/
@@ -90,6 +93,7 @@ public class Getopt
/**
* Returns the string value for the given option.
+ *
* @param option the option
* @param defaultValue the default value if the option is not defined
* @return the associated value
@@ -101,6 +105,7 @@ public class Getopt
/**
* Returns the boolean value for the given option.
+ *
* @param option the option
* @return the associated value
*/
@@ -112,6 +117,7 @@ public class Getopt
/**
* Returns the boolean value for the given option.
+ *
* @param option the option
* @param defaultValue the default value if the option is not defined
* @return the associated value
@@ -124,6 +130,7 @@ public class Getopt
/**
* Get the given argument.
+ *
* @param index the index of the command line argument
* @return the commandl ine argument
*/
@@ -133,7 +140,9 @@ public class Getopt
}
/**
- * @option the option
+ * Find a command-line option.
+ *
+ * @param option the option
* @return the index of the give option or -1 otherwise
*/
private int find( String option )
@@ -154,13 +163,13 @@ public class Getopt
}
/**
- * Determines if a value is defined for the given option
- * @param option the given option
+ * Determines if a value is defined for the given option.
+ *
* @return true if a value is defined
*/
private boolean hasValue( int index )
{
- String value = null;
+ String value;
if( (index+1) < this.length() )
{
@@ -182,9 +191,9 @@ public class Getopt
}
/**
- * Get the value of a command line option
+ * Get the value of a command line option.
+ *
* @param option the option
- * @param defaultValue the default value if the option was not found
* @return the value of the option
*/
private String getValue( String option )
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java?rev=1694573&r1=1694572&r2=1694573&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java Thu Aug 6 21:02:23 2015
@@ -29,7 +29,6 @@ import org.apache.fulcrum.yaafi.framewor
import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration;
import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerFactory;
-
/**
* An example of the embedding of a YAAFI kernel inside an
* arbitrary application.
@@ -58,7 +57,7 @@ public class Main implements Runnable, D
/** the interval to check for termination */
private static final int SLEEP_TIME = 100;
- /** the timeout for joing the shutdown thread */
+ /** the timeout for joining the shutdown thread */
private static final int JOIN_TIME = 1000;
/** The service manager */
@@ -211,7 +210,7 @@ public class Main implements Runnable, D
/**
* Determines the file location of the given name. If the name denotes
- * a relative file location it will be rsolved using the application
+ * a relative file location it will be resolved using the application
* home directory.
*
* @param baseDir the base directory
@@ -262,7 +261,7 @@ public class Main implements Runnable, D
/**
* Depending on the configuration this method might block
- * the calling thread or return immediatly. We currently
+ * the calling thread or return immediately. We currently
* poll a volatile variable which is not the most elegant
* solution.
*/
@@ -564,7 +563,7 @@ public class Main implements Runnable, D
ServiceContainerConfiguration config = new ServiceContainerConfiguration();
- // intialize the Avalon container
+ // initialize the Avalon container
config.setLogger( this.getLogger() );
config.setApplicationRootDir( this.getApplicationHome() );
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java?rev=1694573&r1=1694572&r2=1694573&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java Thu Aug 6 21:02:23 2015
@@ -46,7 +46,7 @@ import org.apache.fulcrum.yaafi.framewor
/**
* This class implements a service component singleton with
- * an arbitray lifecycle.
+ * an arbitrary lifecycle.
*
* @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
*/
@@ -179,7 +179,7 @@ public class AvalonServiceComponentImpl
}
catch (Throwable t)
{
- String msg = "Resumimg the following service failed : " + this.getShorthand();
+ String msg = "Resuming the following service failed : " + this.getShorthand();
this.getParentLogger().error( msg, t );
lastThrowable = t;
}
Modified: turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java?rev=1694573&r1=1694572&r2=1694573&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerConfiguration.java Thu Aug 6 21:02:23 2015
@@ -109,7 +109,17 @@ public class ServiceContainerConfigurati
/** Constructor */
public ServiceContainerConfiguration()
{
- this.logger = new ConsoleLogger();
+ this(ConsoleLogger.LEVEL_DEBUG);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param logLevel the log level for the console logger.
+ */
+ public ServiceContainerConfiguration(int logLevel)
+ {
+ this.logger = new ConsoleLogger(logLevel);
this.containerFlavour = ServiceConstants.AVALON_CONTAINER_YAAFI;
this.serviceContainerClazzName = ServiceConstants.CLAZZ_NAME;
this.componentRolesLocation = ServiceConstants.COMPONENT_ROLE_VALUE;
Modified: turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/Container.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/Container.java?rev=1694573&r1=1694572&r2=1694573&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/Container.java (original)
+++ turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/Container.java Thu Aug 6 21:02:23 2015
@@ -47,14 +47,17 @@ public class Container extends AbstractL
/** Component manager */
private ServiceContainer manager;
+ /** The log level of the container */
+ private int logLevel = ConsoleLogger.LEVEL_INFO;
+
/**
* Constructor
*/
public Container()
{
// org.apache.log4j.BasicConfigurator.configure();
- this.enableLogging( new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG ) );
- this.config = new ServiceContainerConfiguration();
+ this.enableLogging( new ConsoleLogger( logLevel ) );
+ this.config = new ServiceContainerConfiguration( logLevel );
}
/**
@@ -73,7 +76,7 @@ public class Container extends AbstractL
this.config.setComponentConfigurationLocation( configFileName );
this.config.setComponentRolesLocation( roleFileName );
this.config.setParametersLocation( parametersFileName );
- this.config.setLogger( new ConsoleLogger( ConsoleLogger.LEVEL_DEBUG ) );
+ this.config.setLogger( new ConsoleLogger( logLevel ) );
File configFile = new File(configFileName);
Modified: turbine/fulcrum/trunk/yaafi/tutorial/src/java/tutorial/service/SystemPropertyService.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/yaafi/tutorial/src/java/tutorial/service/SystemPropertyService.java?rev=1694573&r1=1694572&r2=1694573&view=diff
==============================================================================
--- turbine/fulcrum/trunk/yaafi/tutorial/src/java/tutorial/service/SystemPropertyService.java (original)
+++ turbine/fulcrum/trunk/yaafi/tutorial/src/java/tutorial/service/SystemPropertyService.java Thu Aug 6 21:02:23 2015
@@ -29,4 +29,4 @@ package tutorial.service;
public interface SystemPropertyService
{
// This interface doesn't exposes any other methods
-}
+}
\ No newline at end of file