Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2014, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY 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 along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.jboss.ws.common.integration;
 
 import static org.jboss.wsf.spi.deployment.EndpointType.JAXWS_EJB3;
 import static org.jboss.wsf.spi.deployment.EndpointType.JAXWS_JSE;
 
Cross WS stack and JBoss AS integration helper.

Author(s):
Richard Opalka
 
 public final class WSHelper {
 
    private static final EndpointTypeFilter JAXWS_JSE_ENDPOINT_FILTER = new EndpointTypeFilterImpl );
    private static final String WAR_EXTENSION = ".war";
    private static final String JAR_EXTENSION = ".jar";
    private static final String EAR_EXTENSION = ".ear";

   
Forbidden constructor.
 
    private WSHelper()
    {
       // forbidden inheritance
    }

   
Returns required attachment value from webservice deployment.

Parameters:
<A> expected value
dep webservice deployment
key attachment key
Returns:
required attachment
Throws:
java.lang.IllegalStateException if attachment value is null
 
    public static <A> A getRequiredAttachmentfinal Deployment depfinal Class< A > key )
    {
       final A value = dep.getAttachmentkey );
       if ( value == null )
       {
          throw ..cannotFindAttachmentInDeployment(keydep.getSimpleName());
       }
       return value;
    }

   
Returns optional attachment value from webservice deployment or null if not bound.

Parameters:
<A> expected value
dep webservice deployment
key attachment key
Returns:
optional attachment value or null
 
    public static <A> A getOptionalAttachmentfinal Deployment depfinal Class< A > key )
    {
       return dep.getAttachmentkey );
    }

   
Returns true if webservice deployment have attachment value associated with the key.

Parameters:
dep webservice deployment
key attachment key
Returns:
true if contains attachment, false otherwise
 
    public static boolean hasAttachmentfinal Deployment depfinal Class< ? > key )
    {
       return WSHelper.getOptionalAttachmentdepkey ) != null;
    }

   
Returns true if deployment represents JAXWS JSE deployment.

Parameters:
dep webservice deployment
Returns:
true if JAXWS JSE deployment, false otherwise
   public static boolean isJaxwsJseDeploymentfinal Deployment dep )
   {
      return dep.getService().getEndpoints ).size() > 0;
   }

   
Returns true if deployment represents JAXWS EJB deployment.

Parameters:
dep webservice deployment
Returns:
true if JAXWS EJB deployment, false otherwise
   public static boolean isJaxwsEjbDeploymentfinal Deployment dep )
   {
     return dep.getService().getEndpoints ).size() > 0;
   }

   
Returns true if deployment represents a JSE deployment.

Parameters:
dep webservice deployment
Returns:
true if JSE deployment, false otherwise.
   public static boolean isJseDeploymentfinal Deployment dep )
   {
      return isJaxwsJseDeploymentdep );
   }

   
Returns true if deployment represents an EJB deployment.

Parameters:
dep webservice deployment
Returns:
true if either EJB deployment, false otherwise
   public static boolean isEjbDeploymentfinal Deployment dep )
   {
      return isJaxwsEjbDeploymentdep );
   }

   
Returns true if archive name ends with '.jar' suffix.

Parameters:
dep webservice deployment
Returns:
true if archive name ends with '.jar' suffix, false otherwise
   public static boolean isJarArchivefinal Deployment dep )
   {
      return dep.getSimpleName().endsWith();
   }

   
Returns true if archive name ends with '.war' suffix.

Parameters:
dep webservice deployment
Returns:
true if archive name ends with '.war' suffix, false otherwise
   public static boolean isWarArchivefinal Deployment dep )
   {
      return dep.getSimpleName().endsWith();
   }

   
Returns true if archive name ends with '.ear' suffix.

Parameters:
dep webservice deployment
Returns:
true if archive name ends with '.ear' suffix, false otherwise
   public static boolean isEarArchivefinal Deployment dep )
   {
      return dep.getSimpleName().endsWith();
   }

   
Returns true if endpoint represents JAXWS JSE endpoint.

Parameters:
ep webservice endpoint
Returns:
true if either JAXWS JSE endpoint, false otherwise
   public static boolean isJaxwsJseEndpointfinal Endpoint ep )
   {
      return  == ep.getType();
   }

   
Returns true if endpoint represents JAXWS EJB3 endpoint.

Parameters:
ep webservice endpoint
Returns:
true if JAXWS EJB3 endpoint, false otherwise
   public static boolean isJaxwsEjbEndpointfinal Endpoint ep )
   {
      return  == ep.getType();
   }

   
Returns true if endpoint represents a JSE endpoint.

Parameters:
ep webservice endpoint
Returns:
true if JSE endpoint, false otherwise
   public static boolean isJseEndpointfinal Endpoint ep )
   {
      return isJaxwsJseEndpointep );
   }

   
Returns true if endpoint represents either an EJB endpoint.

Parameters:
ep webservice endpoint
Returns:
true if EJB endpoint, false otherwise
   public static boolean isEjbEndpointfinal Endpoint ep )
   {
      return isJaxwsEjbEndpointep );
   }

   
Returns true if endpoint represents a JAXWS endpoint.

Parameters:
ep webservice endpoint
Returns:
true if either JAXWS endpoint, false otherwise
   public static boolean isJaxwsEndpointfinal Endpoint ep )
   {
      return isJaxwsJseEndpointep );
   }
New to GrepCode? Check out our FAQ X