You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by di...@apache.org on 2004/08/09 18:34:54 UTC

cvs commit: ws-fx/addressing/src/org/apache/axis/message/addressing/uuid AxisUUIdGenerator.java

dims        2004/08/09 09:34:54

  Added:       addressing/src/org/apache/axis/message/addressing/uuid
                        AxisUUIdGenerator.java
  Log:
  Contribution from Ian Springer <ia...@hp.com>
  ===================================================
  The attached classes are intended to replace the existing class
  AddressingHandler. They are in the following class hierarchies, which
  are designed to facilitate easy porting to any JAX-RPC container:
  
  AxisClientSideAddressingHandler extends ClientSideAddressingHandler
  extends AbstractAddressingHandler
  
  AxisServerSideAddressingHandler extends ServerSideAddressingHandler
  extends AbstractAddressingHandler
  
  AbstractAddressingHandler is an abstract base class containing
  functionality shared by server-side and client-side handlers.
  ClientSideAddressingHandler and ServerSideAddressingHandler are
  client-side and server-side JAX-RPC handlers, respectively, that should
  work within any JAX-RPC container. They contain a few methods that can
  be overridden by platform-specific subclasses to provide more robust
  functionality. AxisClientSideAddressingHandler and
  AxisServerSideAddressingHandler are subclasses of the platform-neutral
  handlers that implement the Axis Handler interface and that leverage
  some Axis-specific APIs in overridden methods.
  
  All platform-neutral classes are below the org.apache.ws.addressing
  package, and all Axis-specific classes are below
  org.apache.axis.message.addressing.handler.
  
  I've written unit tests that test the key methods - handleRequest() and
  handleResponse() - in the platform-neutral handlers.
  
  Additionally, I've written an interface and factory that allow one to
  easily plug in different UUID-generation impls. The platform-neutral
  handlers utilize the opensource JUG library as the UUID generator, but
  use refelction to avoid a compile-time dependency on it. The
  Axis-specific handlers utilize the UUID generator that comes with Axis.
  
  There are still a number of data structure classes and interfaces in
  Apache Addressing that use Axis-specific classes like MessageElement and
  URI. These could be refactored fairly easily to be platform-neutral.
  Once this is done, Apache Addressing will be a portable WS-Addressing
  implementation that can be deployed and utilized on any JAX-RPC
  container. I think this will broaden the project's user and developer
  base.
  
  ===================================================
  
  Revision  Changes    Path
  1.1                  ws-fx/addressing/src/org/apache/axis/message/addressing/uuid/AxisUUIdGenerator.java
  
  Index: AxisUUIdGenerator.java
  ===================================================================
  /*
   * Copyright  2004 The Apache Software Foundation.
   *
   *  Licensed 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.axis.message.addressing.uuid;
  
  import org.apache.axis.components.uuid.UUIDGen;
  import org.apache.axis.components.uuid.UUIDGenFactory;
  import org.apache.ws.addressing.uuid.UUIdGenerator;
  
  /**
   * A {@link UUIdGenerator} implementation that uses the UUID generator that
   * comes with Apache Axis.
   *
   * @author Ian P. Springer <ia...@hp.com>
   */
  public class AxisUUIdGenerator implements UUIdGenerator {
  
      private ThreadLocal AXIS_UUIDGENERATOR =
              new ThreadLocal() {
                  protected synchronized Object initialValue() {
                      return UUIDGenFactory.getUUIDGen();
                  }
              };
  
      public String generateUUId() {
          UUIDGen uuidGen = (UUIDGen) AXIS_UUIDGENERATOR.get();
          return uuidGen.nextUUID();
      }
  }