You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by gianny DAMOUR <gi...@hotmail.com> on 2003/08/13 16:16:58 UTC

[PATCH] State Manageable Object

Hi,


A small issue related to the org.apache.geronimo.common.State component is 
fixed by the enclosed patch (patch-core-java).

Moreover, the proposed patch adds the following components:
- org.apache.geronimo.common.EventMediator: Manage the event distribution 
among the management applications;
- org.apache.geronimo.common.EventProvider: Contained by an 
AbstractComponent. If the component is a "State Manageable Object", SMO, 
then it contains an EventProvider in order to broadcast some specific 
events;
- org.apache.geronimo.common.SMONotification: State event broadcasted by a 
SMO on entering of a specific event; and
- org.apache.geronimo.ejb.ContainerImplStateTest: Basic unit test 
registering a dummy management  application tracking the state of a 
org.apache.geronimo.ejb.ContainerImpl component. As a matter of fact, 
ContainerImpl is not a component to be monitored according to the JSR77. 
However, it could be a good starting point to reflect on the proposed patch 
and decide how we want to provide the hooks required by JSR77.

org.apache.geronimo.ejb.ContainerImplStateTest (contained by 
patch-core-test) should be added to the 
geronimo\incubator\modules\core\src\test sub-project.
The other ones should be added to the 
geronimo\incubator\modules\core\src\java sub-project.

By the way, is it possible to add to the Wiki the exact procedure to follow 
to propose a patch?

A subsidiary question: where can I download the source of the 
javax.management.j2ee interfaces (JSR77)?

Cheers,
Gianny

_________________________________________________________________
Trouvez l'âme soeur sur MSN Rencontres http://g.msn.fr/FR1000/9551

Re: [PATCH] State Manageable Object

Posted by Greg Wilkins <gr...@mortbay.com>.
Gianny,

I'm looking at your patches now and plan to at least commit
the StateManageable interface.

I'll tell you how I go....



gianny DAMOUR wrote:
> Hi,
> 
> 
> A small issue related to the org.apache.geronimo.common.State component 
> is fixed by the enclosed patch (patch-core-java).
> 
> Moreover, the proposed patch adds the following components:
> - org.apache.geronimo.common.EventMediator: Manage the event 
> distribution among the management applications;
> - org.apache.geronimo.common.EventProvider: Contained by an 
> AbstractComponent. If the component is a "State Manageable Object", SMO, 
> then it contains an EventProvider in order to broadcast some specific 
> events;
> - org.apache.geronimo.common.SMONotification: State event broadcasted by 
> a SMO on entering of a specific event; and
> - org.apache.geronimo.ejb.ContainerImplStateTest: Basic unit test 
> registering a dummy management  application tracking the state of a 
> org.apache.geronimo.ejb.ContainerImpl component. As a matter of fact, 
> ContainerImpl is not a component to be monitored according to the JSR77. 
> However, it could be a good starting point to reflect on the proposed 
> patch and decide how we want to provide the hooks required by JSR77.
> 
> org.apache.geronimo.ejb.ContainerImplStateTest (contained by 
> patch-core-test) should be added to the 
> geronimo\incubator\modules\core\src\test sub-project.
> The other ones should be added to the 
> geronimo\incubator\modules\core\src\java sub-project.
> 
> By the way, is it possible to add to the Wiki the exact procedure to 
> follow to propose a patch?
> 
> A subsidiary question: where can I download the source of the 
> javax.management.j2ee interfaces (JSR77)?
> 
> Cheers,
> Gianny
> 
> _________________________________________________________________
> Trouvez l'âme soeur sur MSN Rencontres http://g.msn.fr/FR1000/9551
> Index: org/apache/geronimo/common/AbstractComponent.java
> ===================================================================
> RCS file: 
> /home/cvspublic/incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/AbstractComponent.java,v 
> 
> retrieving revision 1.3
> diff -u -r1.3 AbstractComponent.java
> --- org/apache/geronimo/common/AbstractComponent.java    13 Aug 2003 
> 02:12:40 -0000    1.3
> +++ org/apache/geronimo/common/AbstractComponent.java    13 Aug 2003 
> 13:28:29 -0000
> @@ -64,8 +64,16 @@
>  *
>  * @version $Revision: 1.3 $ $Date: 2003/08/13 02:12:40 $
>  */
> -public class AbstractComponent implements Component
> +public class AbstractComponent
> +    implements Component
> {
> +
> +    /**
> +     * This property can be defined or not. If it is defined, then the 
> component
> +     * is a managed object and provide some event types.
> +     */
> +    private EventProvider m_eventProvider;
> +
>     private State state= State.STOPPED;
>     private long startTime;
>     private Container container;
> @@ -83,11 +91,13 @@
>      */
>     protected void setState(State newState) throws IllegalStateException
>     {
> +        State oldState = state;
> +
>         switch (state.getIndex())
>         {
>             case State.STOPPED_INDEX :
>                 {
> -                    switch (state.getIndex())
> +                    switch (newState.getIndex())
>                     {
>                         case State.STARTING_INDEX :
>                             break;
> @@ -103,7 +113,7 @@
> 
>             case State.STARTING_INDEX :
>                 {
> -                    switch (state.getIndex())
> +                    switch (newState.getIndex())
>                     {
>                         case State.RUNNING_INDEX :
>                         case State.FAILED_INDEX :
> @@ -119,7 +129,7 @@
> 
>             case State.RUNNING_INDEX :
>                 {
> -                    switch (state.getIndex())
> +                    switch (newState.getIndex())
>                     {
>                         case State.STOPPING_INDEX :
>                         case State.FAILED_INDEX :
> @@ -136,7 +146,7 @@
> 
>             case State.STOPPING_INDEX :
>                 {
> -                    switch (state.getIndex())
> +                    switch (newState.getIndex())
>                     {
>                         case State.STOPPED_INDEX :
>                         case State.FAILED_INDEX :
> @@ -152,7 +162,7 @@
> 
>             case State.FAILED_INDEX :
>                 {
> -                    switch (state.getIndex())
> +                    switch (newState.getIndex())
>                     {
>                         case State.STARTING_INDEX :
>                         case State.STOPPING_INDEX :
> @@ -170,7 +180,12 @@
>         if (newState==State.RUNNING)
>             startTime= System.currentTimeMillis();
>         state= newState;
> -
> +
> +        if ( null != m_eventProvider ) {
> +            // TO DO provide the OBJECT_NAME of the managed object.
> +            m_eventProvider.broadCastNotification(
> +                new SMONotification(state, "dummy"));
> +        }
>     }
> 
>     public long getStartTime()
> @@ -247,6 +262,24 @@
>      */
>     public void doStop() throws Exception
>     {
> +    }
> +
> +    /**
> +     * Get the EventProvider, if any, of this component.
> +     *
> +     * @return Underlying EventProvider.
> +     */
> +    public EventProvider getEventProvider() {
> +        return m_eventProvider;
> +    }
> +
> +    /**
> +     * Set the EventProvider of this component.
> +     *
> +     * @param aProvider EventProvider to used to emit notifications.
> +     */
> +    public void setEventProvider(EventProvider aProvider) {
> +        m_eventProvider = aProvider;
>     }
> 
> }
> Index: org/apache/geronimo/common/EventMediator.java
> ===================================================================
> RCS file: org/apache/geronimo/common/EventMediator.java
> diff -N org/apache/geronimo/common/EventMediator.java
> --- /dev/null    1 Jan 1970 00:00:00 -0000
> +++ org/apache/geronimo/common/EventMediator.java    13 Aug 2003 
> 13:28:30 -0000
> @@ -0,0 +1,122 @@
> +/* ====================================================================
> + * The Apache Software License, Version 1.1
> + *
> + * Copyright (c) 2003 The Apache Software Foundation.  All rights
> + * reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + *
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in
> + *    the documentation and/or other materials provided with the
> + *    distribution.
> + *
> + * 3. The end-user documentation included with the redistribution,
> + *    if any, must include the following acknowledgment:
> + *       "This product includes software developed by the
> + *        Apache Software Foundation (http://www.apache.org/)."
> + *    Alternately, this acknowledgment may appear in the software itself,
> + *    if and wherever such third-party acknowledgments normally appear.
> + *
> + * 4. The names "Apache" and "Apache Software Foundation" and
> + *    "Apache Geronimo" must not be used to endorse or promote products
> + *    derived from this software without prior written permission. For
> + *    written permission, please contact apache@apache.org.
> + *
> + * 5. Products derived from this software may not be called "Apache",
> + *    "Apache Geronimo", nor may "Apache" appear in their name, without
> + *    prior written permission of the Apache Software Foundation.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + * ====================================================================
> + *
> + * This software consists of voluntary contributions made by many
> + * individuals on behalf of the Apache Software Foundation.  For more
> + * information on the Apache Software Foundation, please see
> + * <http://www.apache.org/>.
> + *
> + * ====================================================================
> + */
> +package org.apache.geronimo.common;
> +
> +import javax.management.ListenerNotFoundException;
> +import javax.management.Notification;
> +import javax.management.NotificationBroadcasterSupport;
> +import javax.management.NotificationFilter;
> +import javax.management.NotificationListener;
> +
> +/**
> + * Manage the event distribution among the management applications.
> + */
> +public final class EventMediator {
> +
> +    /**
> +     * Used to register the clients and broadcast the events.
> +     */
> +    private NotificationBroadcasterSupport m_broadcaster;
> +
> +    public EventMediator() {
> +
> +        m_broadcaster = new NotificationBroadcasterSupport();
> +    }
> +
> +    /**
> +     * Broadcast the provided client to the registered management 
> applications.
> +     *
> +     * @param aNotification Event to be broadcasted.
> +     */
> +    public void broadCastNotification(Notification aNotification) {
> +
> +        m_broadcaster.sendNotification(aNotification);
> +    }
> +
> +    /**
> +     * Add a management applications to the event mediator. Once 
> registered, the
> +     * application receives the notifications guided to this mediator.
> +     *
> +     * @param aListener The management application to receive 
> notifications.
> +     * @param aFilter A filter object. If filter is null, no filtering 
> will
> +     * be performed before handling notifications.
> +     * @param anOpaque An opaque object to be sent back to the management
> +     * application when a notification is emitted.
> +     */
> +    public void addManagementApplication(
> +        NotificationListener aListener,
> +        NotificationFilter aFilter,
> +        Object anOpaque)
> +        throws IllegalArgumentException {
> +
> +        m_broadcaster.addNotificationListener(aListener, aFilter, 
> anOpaque);
> +    }
> +
> +    /**
> +     * Remove a management application.
> +     *
> +     * @param aListener Management application to be removed.
> +     *
> +     * @exception ListenerNotFoundException If the provided application 
> is not
> +     * registered.
> +     */
> +    public void removeManagementApplication(NotificationListener 
> aListener)
> +        throws ListenerNotFoundException {
> +
> +        m_broadcaster.removeNotificationListener(aListener);
> +    }
> +
> +}
> Index: org/apache/geronimo/common/EventProvider.java
> ===================================================================
> RCS file: org/apache/geronimo/common/EventProvider.java
> diff -N org/apache/geronimo/common/EventProvider.java
> --- /dev/null    1 Jan 1970 00:00:00 -0000
> +++ org/apache/geronimo/common/EventProvider.java    13 Aug 2003 
> 13:28:30 -0000
> @@ -0,0 +1,104 @@
> +/* ====================================================================
> + * The Apache Software License, Version 1.1
> + *
> + * Copyright (c) 2003 The Apache Software Foundation.  All rights
> + * reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + *
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in
> + *    the documentation and/or other materials provided with the
> + *    distribution.
> + *
> + * 3. The end-user documentation included with the redistribution,
> + *    if any, must include the following acknowledgment:
> + *       "This product includes software developed by the
> + *        Apache Software Foundation (http://www.apache.org/)."
> + *    Alternately, this acknowledgment may appear in the software itself,
> + *    if and wherever such third-party acknowledgments normally appear.
> + *
> + * 4. The names "Apache" and "Apache Software Foundation" and
> + *    "Apache Geronimo" must not be used to endorse or promote products
> + *    derived from this software without prior written permission. For
> + *    written permission, please contact apache@apache.org.
> + *
> + * 5. Products derived from this software may not be called "Apache",
> + *    "Apache Geronimo", nor may "Apache" appear in their name, without
> + *    prior written permission of the Apache Software Foundation.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + * ====================================================================
> + *
> + * This software consists of voluntary contributions made by many
> + * individuals on behalf of the Apache Software Foundation.  For more
> + * information on the Apache Software Foundation, please see
> + * <http://www.apache.org/>.
> + *
> + * ====================================================================
> + */
> +package org.apache.geronimo.common;
> +
> +import javax.management.Notification;
> +
> +/**
> + * Abstract an event provider.
> + *
> + * An event provider is a managed object, which emits specific events 
> during
> + * its life-cycle.
> + */
> +public class EventProvider {
> +
> +    /**
> +     * Target of the event emitted by the event provider. It handles the
> +     * distribution of the events.
> +     */
> +    private EventMediator m_eventMediator;
> +
> +    /**
> +     * Broadcast a notification.
> +     *
> +     * @param aNotification Notification to be broadcasted.
> +     */
> +    protected final void broadCastNotification(Notification 
> aNotification) {
> +
> +        if ( null != m_eventMediator ) {
> +            m_eventMediator.broadCastNotification(aNotification);
> +        }
> +    }
> +
> +    /**
> +     * Get the EventMediator handling the distribution of the 
> notifications.
> +     *
> +     * @return EventMediator handling the notifications.
> +     */
> +    public EventMediator getEventMediator() {
> +        return m_eventMediator;
> +    }
> +
> +    /**
> +     * Set the EventMediator, which must distribute the notifications.
> +     *
> +     * @param aMediator EventMediator in charge of the event dispatching.
> +     */
> +    public void setEventMediator(EventMediator aMediator) {
> +        m_eventMediator = aMediator;
> +    }
> +
> +}
> Index: org/apache/geronimo/common/SMONotification.java
> ===================================================================
> RCS file: org/apache/geronimo/common/SMONotification.java
> diff -N org/apache/geronimo/common/SMONotification.java
> --- /dev/null    1 Jan 1970 00:00:00 -0000
> +++ org/apache/geronimo/common/SMONotification.java    13 Aug 2003 
> 13:28:31 -0000
> @@ -0,0 +1,145 @@
> +/* ====================================================================
> + * The Apache Software License, Version 1.1
> + *
> + * Copyright (c) 2003 The Apache Software Foundation.  All rights
> + * reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + *
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in
> + *    the documentation and/or other materials provided with the
> + *    distribution.
> + *
> + * 3. The end-user documentation included with the redistribution,
> + *    if any, must include the following acknowledgment:
> + *       "This product includes software developed by the
> + *        Apache Software Foundation (http://www.apache.org/)."
> + *    Alternately, this acknowledgment may appear in the software itself,
> + *    if and wherever such third-party acknowledgments normally appear.
> + *
> + * 4. The names "Apache" and "Apache Software Foundation" and
> + *    "Apache Geronimo" must not be used to endorse or promote products
> + *    derived from this software without prior written permission. For
> + *    written permission, please contact apache@apache.org.
> + *
> + * 5. Products derived from this software may not be called "Apache",
> + *    "Apache Geronimo", nor may "Apache" appear in their name, without
> + *    prior written permission of the Apache Software Foundation.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + * ====================================================================
> + *
> + * This software consists of voluntary contributions made by many
> + * individuals on behalf of the Apache Software Foundation.  For more
> + * information on the Apache Software Foundation, please see
> + * <http://www.apache.org/>.
> + *
> + * ====================================================================
> + */
> +package org.apache.geronimo.common;
> +
> +import javax.management.Notification;
> +
> +/**
> + * Abstract a state event.
> + *
> + * When the state of a State Manageable Object - SMO - changed, an 
> event MAY or
> + * MUST be broadcasted.
> + * <P>
> + * More accurately, a SMO MAY generate an event on entering of the 
> following:
> + * states:
> + * <ul>
> + * <li>STARTING; and
> + * <li>STOPPING.
> + * </ul>
> + * A SMO MUST generate an event on entering of the following states:
> + * <ul>
> + * <li>RUNNING;
> + * <li>STOPPED; and
> + * <li>FAILED.
> + * </ul>
> + *
> + * TO DO cross-ref JSR77.5.1.1
> + */
> +public final class SMONotification extends Notification {
> +
> +    /**
> +     * Used to generate the sequence number for SMONotification 
> notifications.
> +     * It is used to determine the order of a sequence of events having 
> the same
> +     * timestamp.
> +     */
> +    private static volatile long m_notificationSequence = 0;
> +
> +    /**
> +     * Constructor
> +     *
> +     * @param aState State reached by the SMO.
> +     * @param source Name of the managed object which generates this 
> event.
> +     */
> +    public SMONotification(State aState, Object aSource) {
> +        this(aState, aSource, System.currentTimeMillis(), null);
> +    }
> +
> +    /**
> +     * Constructor
> +     *
> +     * @param aState State reached by the SMO.
> +     * @param aSource Name of the managed object which generates this 
> event.
> +     * @param aTimeStamp Time of the event represented as a long.
> +     */
> +    public SMONotification(
> +        State aState,
> +        Object aSource,
> +        long aTimeStamp) {
> +        this(aState, aSource, aTimeStamp, null);
> +    }
> +
> +    /**
> +     * Constructor
> +     *
> +     * @param aState State reached by the SMO.
> +     * @param aSource Name of the managed object which generates this 
> event.
> +     * @param aMessage An informational message about the event.
> +     */
> +    public SMONotification(
> +        State aState,
> +        Object aSource,
> +        String aMessage) {
> +        this(aState, aSource, System.currentTimeMillis(), aMessage);
> +    }
> +
> +    /**
> +     * Constructor
> +     *
> +     * @param aState State reached by the SMO.
> +     * @param aSource Name of the managed object which generates this 
> event.
> +     * @param aTimeStamp Time of the event represented as a long.
> +     * @param aMessage An informational message about the event.
> +     */
> +    public SMONotification(
> +        State aState,
> +        Object aSource,
> +        long aTimeStamp,
> +        String aMessage) {
> +        super(aState.getEventTypeValue(), aSource, 
> m_notificationSequence++,
> +            aTimeStamp, aMessage);
> +    }
> +
> +}
> Index: org/apache/geronimo/common/State.java
> ===================================================================
> RCS file: 
> /home/cvspublic/incubator-geronimo/modules/core/src/java/org/apache/geronimo/common/State.java,v 
> 
> retrieving revision 1.3
> diff -u -r1.3 State.java
> --- org/apache/geronimo/common/State.java    13 Aug 2003 02:12:40 
> -0000    1.3
> +++ org/apache/geronimo/common/State.java    13 Aug 2003 13:28:31 -0000
> @@ -69,24 +69,39 @@
>     public static final int STOPPED_INDEX=3;
>     public static final int FAILED_INDEX=4;
> 
> -    public static final State STARTING = new 
> State("starting",STARTING_INDEX);
> -    public static final State RUNNING = new 
> State("running",RUNNING_INDEX);
> -    public static final State STOPPING = new 
> State("stopping",STOPPING_INDEX);
> -    public static final State STOPPED = new 
> State("stopped",STOPPED_INDEX);
> -    public static final State FAILED = new State("failed",FAILED_INDEX);
> +    public static final State STARTING =
> +        new State("starting",STARTING_INDEX, "j2ee.state.starting");
> +    public static final State RUNNING =
> +        new State("running",RUNNING_INDEX, "j2ee.state.running");
> +    public static final State STOPPING =
> +        new State("stopping",STOPPING_INDEX, "j2ee.state.stopping");
> +    public static final State STOPPED =
> +        new State("stopped",STOPPED_INDEX, "j2ee.state.stopped");
> +    public static final State FAILED =
> +        new State("failed",FAILED_INDEX, "j2ee.state.failed");
> 
>     private final String name;
>     private final int index;
> +
> +    /**
> +     * Type value to be broadcasted on entering this state.
> +     */
> +    private final String m_eventTypeValue;
> 
> -    private State(String name, int index) {
> +    private State(String name, int index, String anEventTypeValue) {
>         this.name = name;
>         this.index = index;
> +        m_eventTypeValue = anEventTypeValue;
>     }
> 
>     public int getIndex() {
>         return index;
>     }
> 
> +    public String getEventTypeValue() {
> +        return m_eventTypeValue;
> +    }
> +
>     public String toString() {
>         return name;
>     }
> Index: org/apache/geronimo/deployment/service/ServiceDeploymentPlanner.java
> ===================================================================
> RCS file: 
> /home/cvspublic/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/ServiceDeploymentPlanner.java,v 
> 
> retrieving revision 1.1
> diff -u -r1.1 ServiceDeploymentPlanner.java
> --- 
> org/apache/geronimo/deployment/service/ServiceDeploymentPlanner.java    
> 11 Aug 2003 17:59:11 -0000    1.1
> +++ 
> org/apache/geronimo/deployment/service/ServiceDeploymentPlanner.java    
> 13 Aug 2003 13:28:38 -0000
> @@ -167,6 +167,7 @@
> 
>         Document doc;
>         try {
> +
>             doc = parser.parse(url.toString());
>         } catch (SAXException e) {
>             throw new DeploymentException(e);


-- 
Greg Wilkins<gr...@mortbay.com>             Phone/fax: +44 7092063462
Mort Bay Consulting Australia and UK.          http://www.mortbay.com


Re: [PATCH] State Manageable Object

Posted by Greg Wilkins <gr...@mortbay.com>.
I have just committed a patch with a StateManageable interface and
an AbstractStateManageable class.

Component now just has the methods to link it to a container (I
wish the Container had methods to iterate over it's components!)

I have also taken some of Gianny's patch to put in some support
for notification.  I have not put the actual notification classes
themselves in - as I'm not sure what we are doing in that space.
So Gianny, you will have to find somebody who knows more about that
bit to get the rest of your patch handled.

cheers


Sean Hamblett wrote:
> Gianny,
> 
>    The JSR77 Docs can be found here: 
> http://jcp.org/aboutJava/communityprocess/final/jsr077/index.html. In my 
> research of these docs, I understand the JSR is broken down into three 
> main areas, State, Performance, and Events.  At this time the Stat 
> portion is somewhat implemented via the Component interface.  I would 
> like to see the StateManageable interface seperated out from the 
> Component interface and have the State portion of JSR77 implemented in 
> its own scope.  That way the Container and/or the Component can 
> implement this individually.  If it is decided that the Container 
> doesn't need to be a component, then the AbstractContainer interface can 
> implement both Container, and StateManageable (via JSR77) and we can 
> separate out the management duties from the container duties.  Just my 
> two bits.
> 
> Sean
> 
> 
> On Wed, 13 Aug 2003 16:16:58 +0200
>  "gianny DAMOUR" <gi...@hotmail.com> wrote:
> 
>> Hi,
>>
>>
>> A small issue related to the org.apache.geronimo.common.State 
>> component is fixed by the enclosed patch (patch-core-java).
>>
>> Moreover, the proposed patch adds the following components:
>> - org.apache.geronimo.common.EventMediator: Manage the event 
>> distribution among the management applications;
>> - org.apache.geronimo.common.EventProvider: Contained by an 
>> AbstractComponent. If the component is a "State Manageable Object", 
>> SMO, then it contains an EventProvider in order to broadcast some 
>> specific events;
>> - org.apache.geronimo.common.SMONotification: State event broadcasted 
>> by a SMO on entering of a specific event; and
>> - org.apache.geronimo.ejb.ContainerImplStateTest: Basic unit test 
>> registering a dummy management  application tracking the state of a 
>> org.apache.geronimo.ejb.ContainerImpl component. As a matter of fact, 
>> ContainerImpl is not a component to be monitored according to the 
>> JSR77. However, it could be a good starting point to reflect on the 
>> proposed patch and decide how we want to provide the hooks required by 
>> JSR77.
>>
>> org.apache.geronimo.ejb.ContainerImplStateTest (contained by 
>> patch-core-test) should be added to the 
>> geronimo\incubator\modules\core\src\test sub-project.
>> The other ones should be added to the 
>> geronimo\incubator\modules\core\src\java sub-project.
>>
>> By the way, is it possible to add to the Wiki the exact procedure to 
>> follow to propose a patch?
>>
>> A subsidiary question: where can I download the source of the 
>> javax.management.j2ee interfaces (JSR77)?
>>
>> Cheers,
>> Gianny
>>
>> _________________________________________________________________
>> Trouvez l'âme soeur sur MSN Rencontres http://g.msn.fr/FR1000/9551


-- 
Greg Wilkins<gr...@mortbay.com>             Phone/fax: +44 7092063462
Mort Bay Consulting Australia and UK.          http://www.mortbay.com


Re: [PATCH] State Manageable Object

Posted by Sean Hamblett <sh...@charter.net>.
Gianny,

    The JSR77 Docs can be found here: 
http://jcp.org/aboutJava/communityprocess/final/jsr077/index.html. 
 In my research of these docs, I understand the JSR is 
broken down into three main areas, State, Performance, and 
Events.  At this time the Stat portion is somewhat 
implemented via the Component interface.  I would like to 
see the StateManageable interface seperated out from the 
Component interface and have the State portion of JSR77 
implemented in its own scope.  That way the Container 
and/or the Component can implement this individually.  If 
it is decided that the Container doesn't need to be a 
component, then the AbstractContainer interface can 
implement both Container, and StateManageable (via JSR77) 
and we can separate out the management duties from the 
container duties.  Just my two bits.

Sean


On Wed, 13 Aug 2003 16:16:58 +0200
  "gianny DAMOUR" <gi...@hotmail.com> wrote:
>Hi,
>
>
>A small issue related to the 
>org.apache.geronimo.common.State component is fixed by 
>the enclosed patch (patch-core-java).
>
>Moreover, the proposed patch adds the following 
>components:
>- org.apache.geronimo.common.EventMediator: Manage the 
>event distribution among the management applications;
>- org.apache.geronimo.common.EventProvider: Contained by 
>an AbstractComponent. If the component is a "State 
>Manageable Object", SMO, then it contains an 
>EventProvider in order to broadcast some specific events;
>- org.apache.geronimo.common.SMONotification: State event 
>broadcasted by a SMO on entering of a specific event; and
>- org.apache.geronimo.ejb.ContainerImplStateTest: Basic 
>unit test registering a dummy management  application 
>tracking the state of a 
>org.apache.geronimo.ejb.ContainerImpl component. As a 
>matter of fact, ContainerImpl is not a component to be 
>monitored according to the JSR77. However, it could be a 
>good starting point to reflect on the proposed patch and 
>decide how we want to provide the hooks required by 
>JSR77.
>
>org.apache.geronimo.ejb.ContainerImplStateTest (contained 
>by patch-core-test) should be added to the 
>geronimo\incubator\modules\core\src\test sub-project.
>The other ones should be added to the 
>geronimo\incubator\modules\core\src\java sub-project.
>
>By the way, is it possible to add to the Wiki the exact 
>procedure to follow to propose a patch?
>
>A subsidiary question: where can I download the source of 
>the javax.management.j2ee interfaces (JSR77)?
>
>Cheers,
>Gianny
>
>_________________________________________________________________
>Trouvez l'âme soeur sur MSN Rencontres 
>http://g.msn.fr/FR1000/9551