dlr 01/08/09 12:44:16
Modified: src/core/java/org/apache/fulcrum BaseService.java
Log:
* Changed init() from an empty implementation--which did not set the
initialization state of the service to true--to an abstract hook to be
overridden in subclasses. By forcing implementation of init() event
in Service implementations which subclass BaseService, we can increase
the chance that services will set their initialization state to true,
rather than allowing implementors to rely on BaseService's empty
implementation (and get an error at runtime instead of at compile
time).
* Added JavaDoc pointers.
Revision Changes Path
1.3 +22 -15
jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseService.java
Index: BaseService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- BaseService.java 2001/08/09 18:38:20 1.2
+++ BaseService.java 2001/08/09 19:44:16 1.3
@@ -69,7 +69,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Leonard Richardson</a>
- * @version $Id: BaseService.java,v 1.2 2001/08/09 18:38:20 dlr Exp $
+ * @version $Id: BaseService.java,v 1.3 2001/08/09 19:44:16 dlr Exp $
*/
public abstract class BaseService
implements Service
@@ -102,19 +102,15 @@
protected String name;
/**
- * Performs late initializtion. Called when the service is requested
- * for the first time (if not already completely initialized by the
- * early initializer).
+ * Implement this method with your own service initiailization
+ * code. Remember to call <code>setInit(true)</code> on proper
+ * service initialization.
*
- * Late intialization of a BaseInitable is alwas successful.
- *
- * @exception InitializationException Initialization of this
- * class was not successful.
+ * @see org.apache.fulcrum.Service#init()
+ * @see org.apache.fulcrum.BaseService#setInit(boolean value)
*/
- public void init()
- throws InitializationException
- {
- }
+ public abstract void init()
+ throws InitializationException;
/**
* Returns an Initable to uninitialized state.
@@ -127,7 +123,6 @@
setInit(false);
}
-
/**
* Returns initialization status.
*
@@ -163,7 +158,7 @@
*
* @param value The new initialization status.
*/
- protected void setInit( boolean value )
+ protected void setInit(boolean value)
{
this.isInitialized = value;
}
@@ -173,7 +168,7 @@
*
* @param name The name of this Service.
*/
- public void setName( String name )
+ public void setName(String name)
{
this.name = name;
}
@@ -230,21 +225,33 @@
return configuration;
}
+ /**
+ * @see org.apache.fulcrum.ServiceBroker#getServiceObject()
+ */
public Object getServiceObject(String name)
{
return getServiceBroker().getServiceObject(name);
}
+ /**
+ * @see org.apache.fulcrum.Service#getRealPath()
+ */
public String getRealPath(String path)
{
return getServiceBroker().getRealPath(path);
}
+ /**
+ * @see org.apache.fulcrum.Service#getCategory()
+ */
public Category getCategory()
{
return getServiceBroker().getCategory();
}
+ /**
+ * @see org.apache.fulcrum.Service#getCategory(String name)
+ */
public Category getCategory(String name)
{
return getServiceBroker().getCategory(name);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]