You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Leonard Richardson <le...@collab.net> on 2001/06/07 02:59:29 UTC

[PATCH] Service status self-description

I am adding code to all my application-specific Turbine services to give them
the ability to describe their current status. For instance, I have a service
which performs a complex action on demand; it keeps track of the number of
successes and failures, and the average time the action takes to execute. I'm
going to make this information accessible to an admin of my app, and similar
information for my other application-specific Turbine services.

The following is a patch which adds a new method (public String getStatus()) to
the Service interface, so that it's easy to add this sort of capability to your
Turbine services. Simple implementations are provided for BaseService and
BaseUnicastRemoteObject; they display whether or not the service has
been initialized.

Let me know whether you think this feature would be generally useful in Turbine.

Index: BaseService.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/services/BaseService.java,v
retrieving revision 1.8
diff -u -r1.8 BaseService.java
--- BaseService.java    2001/05/05 13:26:55     1.8
+++ BaseService.java    2001/06/07 00:51:15
@@ -159,4 +159,14 @@
         }
         return configuration;
     }
+
+    /**
+     * Returns the current status of this Service.
+     *
+     * @return The current status of this Service.
+     */
+    public String getStatus()
+    {
+        return (getInit() ? "Initialized." : "Uninitialized.");
+    }
 }
Index: BaseUnicastRemoteService.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/services/BaseUnicastRemoteService.java,v
retrieving revision 1.2
diff -u -r1.2 BaseUnicastRemoteService.java
--- BaseUnicastRemoteService.java       2001/06/07 00:01:36     1.2
+++ BaseUnicastRemoteService.java       2001/06/07 00:51:15
@@ -123,6 +123,16 @@
         return name;
     }
 
+    /**
+     * Returns the current status of this Service.
+     *
+     * @return The current status of this Service.
+     */
+    public String getStatus()
+    {
+        return (getInit() ? "Initialized." : "Uninitialized.");
+    }
+
     public ServiceBroker getServiceBroker()
     {
         return serviceBroker;
Index: Service.java
===================================================================
RCS file: /home/cvspublic/jakarta-turbine/src/java/org/apache/turbine/services/Service.java,v
retrieving revision 1.8
diff -u -r1.8 Service.java
--- Service.java        2001/06/07 00:03:46     1.8
+++ Service.java        2001/06/07 00:51:15
@@ -121,4 +121,11 @@
      * @return The Configuration of this Service.
      */
     public Configuration getConfiguration();
+
+    /**
+     * Returns the current status of this Service.
+     *
+     * @return The current status of this Service.
+     */
+    public String getStatus();
 }  

-- 
Leonard Richardson  | CollabNet
leonardr@collab.net | http://collab.net/
"Duty now for the future"

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [PATCH] Service status self-description

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Leonard Richardson <le...@collab.net> writes:

> I am adding code to all my application-specific Turbine services to give them
> the ability to describe their current status. For instance, I have a service
> which performs a complex action on demand; it keeps track of the number of
> successes and failures, and the average time the action takes to execute. I'm
> going to make this information accessible to an admin of my app, and similar
> information for my other application-specific Turbine services.
> 
> The following is a patch which adds a new method (public String getStatus()) to
> the Service interface, so that it's easy to add this sort of capability to your
> Turbine services. Simple implementations are provided for BaseService and
> BaseUnicastRemoteObject; they display whether or not the service has
> been initialized.
> 
> Let me know whether you think this feature would be generally useful in Turbine.

Commited to CVS HEAD.

Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [PATCH] Service status self-description

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Leonard Richardson <le...@collab.net> writes:

> I am adding code to all my application-specific Turbine services to give them
> the ability to describe their current status. For instance, I have a service
> which performs a complex action on demand; it keeps track of the number of
> successes and failures, and the average time the action takes to execute. I'm
> going to make this information accessible to an admin of my app, and similar
> information for my other application-specific Turbine services.
> 
> The following is a patch which adds a new method (public String getStatus()) to
> the Service interface, so that it's easy to add this sort of capability to your
> Turbine services. Simple implementations are provided for BaseService and
> BaseUnicastRemoteObject; they display whether or not the service has
> been initialized.
> 
> Let me know whether you think this feature would be generally useful in Turbine.

This is great!  I really like the move towards enabling services to
describe themselves in a human-readable fashion.  +1

Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [PATCH] Service status self-description

Posted by Jon Stevens <jo...@latchkey.com>.
on 6/6/01 5:59 PM, "Leonard Richardson" <le...@collab.net> wrote:

> Let me know whether you think this feature would be generally useful in
> Turbine.

Totally. +1

-jon

-- 
"Open source is not available to commercial companies."
            -Steve Balmer, CEO Microsoft
<http://www.suntimes.com/output/tech/cst-fin-micro01.html>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org