Package org.apache.ws.resource.handler.axis

Source Code of org.apache.ws.resource.handler.axis.AxisResourceKey

/*=============================================================================*
*  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.ws.resource.handler.axis;

import org.apache.commons.lang.SerializationException;
import org.apache.ws.resource.InvalidResourceKeyException;
import org.apache.ws.resource.impl.AbstractResourceKey;

import javax.xml.namespace.QName;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPHeaderElement;

/**
* LOG-DONE
* @author Sal Campana
*/
public class AxisResourceKey
   extends AbstractResourceKey
{
   /**
    * Creates a new AbstractResourceKey.
    *
    * @param name  the name of the key
    * @param value the value of the key. The value of the key can be any simple/primitive type or any WSDL2Java
    *              generated type or any other type with proper type mappings.
    */
   public AxisResourceKey( QName  name,
                           Object value )
   {
      super( name, value );
   }

   /**
    * Creates a new AbstractResourceKey.
    *
    * @param headerElem the SOAPElement containing the key. The element's name and namespace are used as key name.
    * @param type       the type of the key. The SOAPElement will be deserialized into this type using {@link
    *                   ObjectDeserializer#toObject(SOAPElement, Class) ObjectDeserializer.toObject()}.
    *
    * @throws InvalidResourceKeyException if deserialization of the key fails.
    */
   public AxisResourceKey( SOAPHeaderElement headerElem,
                           Class             type )
   throws InvalidResourceKeyException
   {
      super( headerElem, type );
   }

   /**
    * DOCUMENT_ME
    *
    * @return DOCUMENT_ME
    *
    * @throws SerializationException DOCUMENT_ME
    */
   public SOAPElement toSOAPElement(  )
   throws SerializationException
   {
      return ObjectSerializer.toSOAPElement( getValue(  ),
                                             getName(  ) );
   }

    public Class getType()
    {
        return java.lang.Object.class;
    }

    /**
    * DOCUMENT_ME
    *
    * @param header DOCUMENT_ME
    * @param type   DOCUMENT_ME
    *
    * @return DOCUMENT_ME
    *
    * @throws SerializationException      DOCUMENT_ME
    * @throws InvalidResourceKeyException DOCUMENT_ME
    */
   protected Object deserializeKey( SOAPHeaderElement header,
                                    Class             type )
   throws SerializationException,
          InvalidResourceKeyException
   {
      try
      {
         return ObjectDeserializer.toObject( header, type );
      }
      catch ( Exception e )
      {
         throw new InvalidResourceKeyException( e );
      }
   }
}
TOP

Related Classes of org.apache.ws.resource.handler.axis.AxisResourceKey

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.