-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

oops! checked in some work in progress (osgi) by mistake.

- -- dims

[EMAIL PROTECTED] wrote:
| Author: dims
| Date: Wed Feb 20 06:59:43 2008
| New Revision: 629488
|
| URL: http://svn.apache.org/viewvc?rev=629488&view=rev
| Log:
| Don't try to deploy interfaces, slightly better try/catch and log.info
|
| Added:
|     
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/
|     
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleClassLoader.java
|     
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleListener.java
| Modified:
|     
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
|     
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java
|     
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java
|
| Modified: 
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
| URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java?rev=629488&r1=629487&r2=629488&view=diff
| ==============================================================================
| --- 
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
 (original)
| +++ 
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
 Wed Feb 20
06:59:43 2008
| @@ -177,13 +177,16 @@
|              if (wsAnnotation == null) {
|                  wspAnnotation = (WebServiceProvider) 
pojoClass.getAnnotation(WebServiceProvider.class);
|              }
| -            if (wsAnnotation != null || wspAnnotation != null) {
| +            if ((wsAnnotation != null || wspAnnotation != null) && 
!pojoClass.isInterface()) {
| +                log.info("Deploying JAXWS class : " + className);
|                  AxisService axisService;
|                  axisService =
|                          createAxisService(classLoader,
|                                  className,
|                                  location);
| -                axisServiceList.add(axisService);
| +                if(axisService != null) {
| +                    axisServiceList.add(axisService);
| +                }
|              }
|          }
|          int count = axisServiceList.size();
| @@ -248,7 +251,13 @@
|              IllegalAccessException,
|              AxisFault {
|          Class pojoClass = Loader.loadClass(classLoader, className);
| -        AxisService axisService = 
DescriptionFactory.createAxisService(pojoClass);
| +        AxisService axisService;
| +        try {
| +            axisService = DescriptionFactory.createAxisService(pojoClass);
| +        } catch (Throwable t) {
| +            log.info("Exception creating Axis Service : " + t.getCause(), t);
| +            return null;
| +        }
|          if (axisService != null) {
|              Iterator operations = axisService.getOperations();
|              while (operations.hasNext()) {
| @@ -260,7 +269,6 @@
|          }
|          axisService.setElementFormDefault(false);
|          axisService.setFileName(serviceLocation);
| -        log.info("Deploying JAXWS Service : " + className);
|          return axisService;
|      }
|
|
| Modified: 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java
| URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java?rev=629488&r1=629487&r2=629488&view=diff
| ==============================================================================
| --- 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java
 (original)
| +++ 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java
 Wed Feb 20 06:59:43 2008
| @@ -19,32 +19,28 @@
|
|  package org.apache.axis2.extensions.osgi;
|
| +import org.apache.axis2.extensions.osgi.util.BundleListener;
|  import org.osgi.framework.BundleActivator;
|  import org.osgi.framework.BundleContext;
|  import org.osgi.framework.ServiceReference;
|  import org.osgi.service.http.HttpService;
|
| -import javax.servlet.Servlet;
| -
|  public class Activator implements BundleActivator {
|
|      BundleContext context;
|
|      public void start(BundleContext context) throws Exception {
|          this.context = context;
| -        doServletRegistration();
| -    }
|
| -
| -    private void doServletRegistration() {
|          ServiceReference sr = 
context.getServiceReference(HttpService.class.getName());
|          if (sr != null) {
|              HttpService httpServ = (HttpService) context.getService(sr);
|
|              try {
| -                Servlet servlet = new OSGiAxis2Servlet();
| +                OSGiAxis2Servlet servlet = new OSGiAxis2Servlet();
|                  httpServ.registerServlet("/axis2",
|                          servlet, null, null);
| +                context.addBundleListener(new BundleListener(servlet));
|              } catch (Exception e) {
|                  System.err.println("Exception registering Axis Servlet:"
|                          + e);
| @@ -54,4 +50,5 @@
|
|      public void stop(BundleContext context) throws Exception {
|      }
| +
|  }
|
| Modified: 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java
| URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java?rev=629488&r1=629487&r2=629488&view=diff
| ==============================================================================
| --- 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java
 (original)
| +++ 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java
 Wed Feb 20
06:59:43 2008
| @@ -19,6 +19,7 @@
|
|  package org.apache.axis2.extensions.osgi;
|
| +import org.apache.axis2.engine.AxisConfiguration;
|  import org.apache.axis2.transport.http.AxisServlet;
|
|  import javax.servlet.ServletConfig;
| @@ -56,5 +57,9 @@
|          this.contextRoot = contextPath;
|
|          configContext.setContextRoot(contextRoot);
| +    }
| +
| +    public AxisConfiguration getConfiguration() {
| +        return this.axisConfiguration;
|      }
|  }
|
| Added: 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleClassLoader.java
| URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleClassLoader.java?rev=629488&view=auto
| ==============================================================================
| --- 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleClassLoader.java
 (added)
| +++ 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleClassLoader.java
 Wed Feb
20 06:59:43 2008
| @@ -0,0 +1,77 @@
| +/*
| + * Licensed to the Apache Software Foundation (ASF) under one
| + * or more contributor license agreements. See the NOTICE file
| + * distributed with this work for additional information
| + * regarding copyright ownership. The ASF licenses this file
| + * to you under the Apache License, Version 2.0 (the
| + * "License"); you may not use this file except in compliance
| + * with the License. You may obtain a copy of the License at
| + *
| + * http://www.apache.org/licenses/LICENSE-2.0
| + *
| + * Unless required by applicable law or agreed to in writing,
| + * software distributed under the License is distributed on an
| + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
| + * KIND, either express or implied. See the License for the
| + * specific language governing permissions and limitations
| + * under the License.
| + */
| +
| +package org.apache.axis2.extensions.osgi.util;
| +
| +import org.osgi.framework.Bundle;
| +
| +import java.io.IOException;
| +import java.net.URL;
| +import java.util.Enumeration;
| +
| +public class BundleClassLoader extends ClassLoader {
| +    private final Bundle bundle;
| +
| +    public BundleClassLoader(Bundle bundle, ClassLoader parent) {
| +        super(parent);
| +        this.bundle = bundle;
| +    }
| +
| +    protected Class findClass(String name) throws ClassNotFoundException {
| +        return bundle.loadClass(name);
| +    }
| +
| +    protected URL findResource(String name) {
| +        URL resource = bundle.getResource(name);
| +        if (resource != null) {
| +            return resource;
| +        }
| +        return super.findResource(name);
| +    }
| +
| +    protected Enumeration findResources(String name) throws IOException {
| +        Enumeration enumeration = bundle.getResources(name);
| +        if (enumeration != null) {
| +            return enumeration;
| +        }
| +        return super.findResources(name);
| +    }
| +
| +    public URL getResource(String name) {
| +        URL resource = findResource(name);
| +        if (resource != null) {
| +            return resource;
| +        }
| +        return super.getResource(name);
| +    }
| +
| +    protected Class loadClass(String name, boolean resolve) throws 
ClassNotFoundException {
| +        Class clazz;
| +        try {
| +            clazz = findClass(name);
| +        }
| +        catch (ClassNotFoundException cnfe) {
| +            clazz = super.loadClass(name, resolve);
| +        }
| +        if (resolve) {
| +            resolveClass(clazz);
| +        }
| +        return clazz;
| +    }
| +}
|
| Added: 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleListener.java
| URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleListener.java?rev=629488&view=auto
| ==============================================================================
| --- 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleListener.java
 (added)
| +++ 
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleListener.java
 Wed Feb 20
06:59:43 2008
| @@ -0,0 +1,55 @@
| +/*
| + * Licensed to the Apache Software Foundation (ASF) under one
| + * or more contributor license agreements. See the NOTICE file
| + * distributed with this work for additional information
| + * regarding copyright ownership. The ASF licenses this file
| + * to you under the Apache License, Version 2.0 (the
| + * "License"); you may not use this file except in compliance
| + * with the License. You may obtain a copy of the License at
| + *
| + * http://www.apache.org/licenses/LICENSE-2.0
| + *
| + * Unless required by applicable law or agreed to in writing,
| + * software distributed under the License is distributed on an
| + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
| + * KIND, either express or implied. See the License for the
| + * specific language governing permissions and limitations
| + * under the License.
| + */
| +
| +package org.apache.axis2.extensions.osgi.util;
| +
| +import org.apache.axis2.transport.http.AxisServlet;
| +import org.apache.axis2.extensions.osgi.OSGiAxis2Servlet;
| +import org.apache.axis2.engine.AxisConfiguration;
| +import org.osgi.framework.Bundle;
| +import org.osgi.framework.BundleEvent;
| +import org.osgi.framework.SynchronousBundleListener;
| +
| +public class BundleListener implements SynchronousBundleListener {
| +    private OSGiAxis2Servlet servlet;
| +
| +    public BundleListener(OSGiAxis2Servlet servlet) {
| +        this.servlet = servlet;
| +    }
| +
| +    public void bundleChanged(BundleEvent event) {
| +        switch (event.getType()) {
| +            case BundleEvent.STARTED:
| +                onBundleStarted(event.getBundle());
| +                break;
| +            case BundleEvent.STOPPED:
| +                onBundleStopped(event.getBundle());
| +                break;
| +        }
| +    }
| +
| +    private void onBundleStarted(Bundle bundle) {
| +        AxisConfiguration config = servlet.getConfiguration();
| +        System.out.println("onBundleStarted : " + bundle);
| +    }
| +
| +    private void onBundleStopped(Bundle bundle) {
| +        System.out.println("onBundleStopped : " + bundle);
| +    }
| +}
|
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iD8DBQFHvEE4gNg6eWEDv1kRAqtlAJ9rr1YEMvPxA3DNjRgHiT6j9toxiQCfThdy
6O0BqVQMQiO4IVWHWgopHIs=
=mZUz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to