axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Suriarachchi <amilasuriarach...@gmail.com>
Subject Re: svn commit: r779507 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: description/AxisDescription.java description/AxisServiceGroup.java engine/AxisConfiguration.java engine/AxisEvent.java
Date Thu, 28 May 2009 11:36:07 GMT
On Thu, May 28, 2009 at 4:30 PM, Andreas Veithen
<andreas.veithen@gmail.com>wrote:

> -1 for this change. Reasons:
>
> * If you generate the Javadoc from this code, there is ZERO
> documentation for it.
> * As discussed previously, it is ugly and not generic enough.

Could you please attach a patch for the better way you suggest?

then we can compare the two and go the the best one.

thanks,
Amila.

>
> * There are at least two better solutions: add a specific method to
> AxisObserver or add a completely new type of event listener.
> Personally, I favor the second solution.
>
> Andreas
>
> On Thu, May 28, 2009 at 11:31,  <amilas@apache.org> wrote:
> > Author: amilas
> > Date: Thu May 28 09:31:54 2009
> > New Revision: 779507
> >
> > URL: http://svn.apache.org/viewvc?rev=779507&view=rev
> > Log:
> > applied the patch for AXIS2-4347
> >
> > Modified:
> >
>  webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
> >
>  webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java
> >
>  webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
> >
>  webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEvent.java
> >
> > Modified:
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
> > URL:
> http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?rev=779507&r1=779506&r2=779507&view=diff
> >
> ==============================================================================
> > ---
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
> (original)
> > +++
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
> Thu May 28 09:31:54 2009
> > @@ -27,6 +27,7 @@
> >  import org.apache.axis2.AxisFault;
> >  import org.apache.axis2.Constants;
> >  import org.apache.axis2.engine.AxisConfiguration;
> > +import org.apache.axis2.engine.AxisEvent;
> >  import org.apache.axis2.i18n.Messages;
> >  import org.apache.axis2.modules.Module;
> >  import org.apache.axis2.util.JavaUtils;
> > @@ -436,6 +437,8 @@
> >      */
> >     public void engageModule(AxisModule axisModule) throws AxisFault {
> >         engageModule(axisModule, this);
> > +        AxisConfiguration config = getAxisConfiguration();
> > +        config.notifyObservers(new AxisEvent(AxisEvent.MODULE_ENGAGED ,
> this) , axisModule);
> >     }
> >
> >     /**
> > @@ -513,6 +516,11 @@
> >         if (isEngaged(module)) {
> >             onDisengage(module);
> >             engagedModules.remove(module.getArchiveName());
> > +            /**
> > +             * if a Disengaged module belogs to an AxisService or an
> Operation
> > +             * notify with a serviceUpdate
> > +             */
> > +            getAxisConfiguration().notifyObservers(new
> AxisEvent(AxisEvent.MODULE_DISENGAGED, this), module);
> >         }
> >     }
> >
> >
> > Modified:
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java
> > URL:
> http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java?rev=779507&r1=779506&r2=779507&view=diff
> >
> ==============================================================================
> > ---
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java
> (original)
> > +++
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisServiceGroup.java
> Thu May 28 09:31:54 2009
> > @@ -146,7 +146,8 @@
> >         AxisService service = getService(name);
> >
> >         if (service != null) {
> > -
>  getAxisConfiguration().notifyObservers(AxisEvent.SERVICE_REMOVE, service);
> > +            getAxisConfiguration().notifyObservers(new
> AxisEvent(AxisEvent.SERVICE_REMOVE,service),
> > +                    service);
> >         }
> >
> >         removeChild(name);
> >
> > Modified:
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
> > URL:
> http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?rev=779507&r1=779506&r2=779507&view=diff
> >
> ==============================================================================
> > ---
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
> (original)
> > +++
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
> Thu May 28 09:31:54 2009
> > @@ -247,7 +247,7 @@
> >         }
> >
> >         allModules.put(module.getArchiveName(), module);
> > -        notifyObservers(AxisEvent.MODULE_DEPLOY, module);
> > +        notifyObservers(new AxisEvent(AxisEvent.MODULE_DEPLOY,null),
> module);
> >
> >         // Registering the policy namespaces that the module understand
> >         registerModulePolicySupport(module);
> > @@ -332,7 +332,7 @@
> >     public synchronized void addServiceGroup(AxisServiceGroup
> axisServiceGroup)
> >             throws AxisFault {
> >         axisServiceGroup.setParent(this);
> > -        notifyObservers(AxisEvent.SERVICE_DEPLOY, axisServiceGroup);
> > +        notifyObservers(new AxisEvent(AxisEvent.SERVICE_DEPLOY,
> axisServiceGroup), axisServiceGroup);
> >         AxisService axisService;
> >
> >         Iterator<AxisService> services = axisServiceGroup.getServices();
> > @@ -395,7 +395,7 @@
> >             }
> >
> >             if (!axisService.isClientSide()) {
> > -                notifyObservers(AxisEvent.SERVICE_DEPLOY, axisService);
> > +                notifyObservers(new AxisEvent(AxisEvent.SERVICE_DEPLOY
> ,axisService ), axisService);
> >             }
> >         }
> >         // serviceGroups.put(axisServiceGroup.getServiceGroupName(),
> > @@ -440,7 +440,7 @@
> >             AxisService axisService = services.next();
> >             allServices.remove(axisService.getName());
> >             if (!axisService.isClientSide()) {
> > -                notifyObservers(AxisEvent.SERVICE_REMOVE, axisService);
> > +                notifyObservers(new AxisEvent(AxisEvent.SERVICE_REMOVE ,
> axisService), axisService);
> >             } else {
> >                 isClientSide = true;
> >             }
> > @@ -457,7 +457,7 @@
> >         }
> >         removeChild(serviceGroupName);
> >         if (!isClientSide) {
> > -            notifyObservers(AxisEvent.SERVICE_REMOVE, axisServiceGroup);
> > +            notifyObservers(new AxisEvent(AxisEvent.SERVICE_REMOVE,
> axisServiceGroup), axisServiceGroup);
> >         }
> >
> >         return axisServiceGroup;
> > @@ -570,12 +570,10 @@
> >         }
> >     }
> >
> > -    public void notifyObservers(int event_type, AxisService service) {
> > +    public void notifyObservers(AxisEvent event, AxisService service) {
> >         if (service.isClientSide())
> >             return;
> >
> > -        AxisEvent event = new AxisEvent(event_type);
> > -
> >         for (AxisObserver observer : observersList) {
> >             try {
> >                 observer.serviceUpdate(event, service);
> > @@ -586,8 +584,7 @@
> >         }
> >     }
> >
> > -    public void notifyObservers(int event_type, AxisModule moule) {
> > -        AxisEvent event = new AxisEvent(event_type);
> > +    public void notifyObservers(AxisEvent event, AxisModule moule) {
> >
> >         for (AxisObserver anObserversList : observersList) {
> >
> > @@ -600,8 +597,7 @@
> >         }
> >     }
> >
> > -    public void notifyObservers(int event_type, AxisServiceGroup
> serviceGroup) {
> > -        AxisEvent event = new AxisEvent(event_type);
> > +    public void notifyObservers(AxisEvent event, AxisServiceGroup
> serviceGroup) {
> >
> >         for (AxisObserver anObserversList : observersList) {
> >
> > @@ -1143,7 +1139,7 @@
> >                                                     serviceName));
> >         }
> >         service.setActive(false);
> > -        notifyObservers(AxisEvent.SERVICE_STOP, service);
> > +        notifyObservers(new AxisEvent(AxisEvent.SERVICE_STOP , service),
> service);
> >     }
> >
> >     public void startService(String serviceName) throws AxisFault {
> > @@ -1153,7 +1149,7 @@
> >                                                     serviceName));
> >         }
> >         service.setActive(true);
> > -        notifyObservers(AxisEvent.SERVICE_START, service);
> > +        notifyObservers(new AxisEvent(AxisEvent.SERVICE_START ,
> service), service);
> >     }
> >
> >     public List<AxisModule> getModulesForPolicyNamesapce(String
> namesapce) {
> >
> > Modified:
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEvent.java
> > URL:
> http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEvent.java?rev=779507&r1=779506&r2=779507&view=diff
> >
> ==============================================================================
> > ---
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEvent.java
> (original)
> > +++
> webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEvent.java
> Thu May 28 09:31:54 2009
> > @@ -20,6 +20,8 @@
> >
> >  package org.apache.axis2.engine;
> >
> > +import org.apache.axis2.description.AxisDescription;
> > +
> >  public class AxisEvent {
> >
> >     /**
> > @@ -32,14 +34,30 @@
> >     public static final int SERVICE_START = 3;
> >     public static final int MODULE_DEPLOY = 4;
> >     public static final int MODULE_REMOVE = 5;
> > +    public static final int MODULE_ENGAGED = 6;
> > +    public static final int MODULE_DISENGAGED = 7;
> > +
> > +    /**
> > +     * hold a reference to the AxisDiscription
> > +     * that the AxisEvent must carry ot the Observer
> > +     * this referrece can be null of not needed
> > +     */
> > +    private AxisDescription axisDiscription;
> > +
> >     private int EVENT_TYPE;
> >
> > -    public AxisEvent(int EVENT_TYPE) {
> > +    public AxisEvent(int EVENT_TYPE , AxisDescription axisDescription) {
> >         this.EVENT_TYPE = EVENT_TYPE;
> > +        this.axisDiscription = axisDiscription;
> > +
> >     }
> >
> >     public int getEventType() {
> >         return EVENT_TYPE;
> >     }
> > +
> > +    public AxisDescription getAxisDiscription() {
> > +       return axisDiscription;
> > +    }
> >
> >  }
> >
> >
> >
>



-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Mime
View raw message