Beispiel #1
0
  /**
   * Returns context root associated with webservice deployment.
   *
   * <p>If there's application.xml descriptor provided defining nested web module, then context root
   * defined there will be returned. Otherwise context root defined in jboss-web.xml will be
   * returned.
   *
   * @param dep webservice deployment
   * @param jbossWebMD jboss web meta data
   * @return context root
   */
  public static String getContextRoot(final Deployment dep, final JBossWebMetaData jbossWebMD) {
    final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
    final JBossAppMetaData jbossAppMD =
        unit.getParent() == null
            ? null
            : ASHelper.getOptionalAttachment(
                unit.getParent(), WSAttachmentKeys.JBOSS_APP_METADATA_KEY);

    String contextRoot = null;

    // prefer context root defined in application.xml over one defined in jboss-web.xml
    if (jbossAppMD != null) {
      final ModuleMetaData moduleMD = jbossAppMD.getModules().get(dep.getSimpleName());
      if (moduleMD != null) {
        final WebModuleMetaData webModuleMD = (WebModuleMetaData) moduleMD.getValue();
        contextRoot = webModuleMD.getContextRoot();
      }
    }

    if (contextRoot == null) {
      contextRoot = jbossWebMD != null ? jbossWebMD.getContextRoot() : null;
    }

    return contextRoot;
  }
Beispiel #2
0
 /**
  * Gets the JBossWebMetaData from the WarMetaData attached to the provided deployment unit, if
  * any.
  *
  * @param unit
  * @return the JBossWebMetaData or null if either that or the parent WarMetaData are not found.
  */
 public static JBossWebMetaData getJBossWebMetaData(final DeploymentUnit unit) {
   final WarMetaData warMetaData =
       ASHelper.getOptionalAttachment(unit, WarMetaData.ATTACHMENT_KEY);
   JBossWebMetaData result = null;
   if (warMetaData != null) {
     result = warMetaData.getMergedJBossWebMetaData();
     if (result == null) {
       result = warMetaData.getJbossWebMetaData();
     }
   }
   return result;
 }
Beispiel #3
0
  /**
   * Returns true if unit contains JAXRPC EJB deployment.
   *
   * @param unit deployment unit
   * @return true if JAXRPC EJB deployment, false otherwise
   */
  public static boolean isJaxrpcEjbDeployment(final DeploymentUnit unit) {
    final DeploymentType deploymentType =
        ASHelper.getOptionalAttachment(unit, WSAttachmentKeys.DEPLOYMENT_TYPE_KEY);

    return DeploymentType.JAXRPC_EJB21.equals(deploymentType);
  }
Beispiel #4
0
 /**
  * Returns true if unit contains JAXWS JSE, JAXRPC JSE, JAXWS EJB or JAXRPC EJB deployment.
  *
  * @param unit deployment unit
  * @return true if JAXWS JSE, JAXRPC JSE, JAXWS EJB or JAXRPC EJB deployment, false otherwise.
  */
 public static boolean isWebServiceDeployment(final DeploymentUnit unit) {
   return ASHelper.getOptionalAttachment(unit, WSAttachmentKeys.DEPLOYMENT_TYPE_KEY) != null;
 }
Beispiel #5
0
 /**
  * Returns true if deployment unit have attachment value associated with the <b>key</b>.
  *
  * @param unit deployment unit
  * @param key attachment key
  * @return true if contains attachment, false otherwise
  */
 public static boolean hasAttachment(final DeploymentUnit unit, final AttachmentKey<?> key) {
   return ASHelper.getOptionalAttachment(unit, key) != null;
 }