Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2006, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. 
   * See the copyright.txt in the distribution for a full listing 
   * of individual contributors.
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  * 
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
 package com.arjuna.webservices11.wsarj;
 
 
 
 import  org.jboss.ws.api.addressing.MAPEndpoint;

Representation of an InstanceIdentifier element.

Author(s):
kevin
 
 public class InstanceIdentifier
 {
    
The instance identifier.
 
     private String instanceIdentifier ;

    
Default constructor.
 
      public InstanceIdentifier()
      {
      }

    
Construct an instance identifier with the specific identifier

Parameters:
instanceIdentifier The instance identifier.
 
 
     public InstanceIdentifier(final String instanceIdentifier)
     {
         this. = instanceIdentifier ;
     }

    
Set the instance identifier of this element.

Parameters:
instanceIdentifier The instance identifier of the element.
 
     public void setInstanceIdentifier(final String instanceIdentifier)
     {
         this. = instanceIdentifier ;
     }

    
Get the instance identifier of this element.

Returns:
The instance identifier of the element or null if not set.
 
     public String getInstanceIdentifier()
     {
         return  ;
     }

    
Is the configuration of this element valid?

Returns:
true if valid, false otherwise.
 
     public boolean isValid()
     {
         return ( != null) && (.trim().length() > 0);
     }

    
Get a string representation of this instance identifier.

Returns:
the string representation.
 
     public String toString()
     {
         return ( != null ?  : "") ;
     }

     
Set the identifier on a W3C endpoint reference under construction.

Parameters:
builder The endpoint reference builder.
identifier The identifier.
    public static void setEndpointInstanceIdentifier(final W3CEndpointReferenceBuilder builderfinal String identifier)
    {
        builder.referenceParameter(createInstanceIdentifierElement(identifier));
    }
    
    
Set the identifier on a W3C endpoint reference under construction.

Parameters:
builder The endpoint reference builder.
instanceIdentifier The identifier.
    public static void setEndpointInstanceIdentifier(final W3CEndpointReferenceBuilder builderfinal InstanceIdentifier instanceIdentifier)
    {
        builder.referenceParameter(createInstanceIdentifierElement(instanceIdentifier.getInstanceIdentifier())) ;
    }

    
Set the identifier on a WS Addressing endpoint reference under construction.

Parameters:
epReference The WS Addressing endpoint reference.
instanceIdentifier The identifier.
   public static void setEndpointInstanceIdentifier(final MAPEndpoint epReferencefinal InstanceIdentifier instanceIdentifier)
   {
       setEndpointInstanceIdentifier(epReferenceinstanceIdentifier.getInstanceIdentifier());
   }

    
Set the identifier on a WS Addressing endpoint reference under construction.

Parameters:
epReference The WS Addressing endpoint reference.
instanceIdentifier The identifier string.
   public static void setEndpointInstanceIdentifier(final MAPEndpoint epReferencefinal String instanceIdentifier)
   {
       epReference.addReferenceParameter(createInstanceIdentifierElement(instanceIdentifier));
   }

    
a soap factory used to construct SOAPElement instances representing InstanceIdentifier instances
    private static SOAPFactory factory = createSoapFactory();

    
a name for the WSArj Instance element
    private static Name WSARJ_ELEMENT_INSTANCE_NAME;

    
Create a SOAPElement representing an InstanceIdentifier

Parameters:
instanceIdentifier the identifier string of the InstanceIdentifier being represented
Returns:
a SOAPElement with the InstancreIdentifier QName as its element tag and a text node containing the suppliedidentifier string as its value
    public static Element createInstanceIdentifierElement(final String instanceIdentifier)
    {
        try {
            SOAPElement element = .createElement();
            element.addTextNode(instanceIdentifier);
            return element;
        } catch (SOAPException se) {
            // TODO log error here (should never happen)
            return null;
        }
    }
    private static SOAPFactory createSoapFactory()
    {
        try {
            SOAPFactory factory = SOAPFactory.newInstance();
            Name name = factory.createName(.,
                    .,
                    .);
             = name;
            return factory;
        } catch (SOAPException e) {
            // TODO log error here (should never happen)
        }
        return null;
    }
New to GrepCode? Check out our FAQ X