Beispiel #1
0
  /**
   * Returns required attachment value from deployment unit.
   *
   * @param <A> expected value
   * @param unit deployment unit
   * @param key attachment key
   * @return required attachment
   * @throws IllegalStateException if attachment value is null
   */
  public static <A> A getRequiredAttachment(final DeploymentUnit unit, final AttachmentKey<A> key) {
    final A value = unit.getAttachment(key);
    if (value == null) {
      ASHelper.LOGGER.error("Cannot find attachment in deployment unit: " + key);
      throw new IllegalStateException();
    }

    return value;
  }
Beispiel #2
0
  /**
   * Returns first webservice description meta data or null if not found.
   *
   * @param wsDescriptionsMD webservice descriptions
   * @return webservice description
   */
  public static WebserviceDescriptionMetaData getWebserviceDescriptionMetaData(
      final WebserviceDescriptionsMetaData wsDescriptionsMD) {
    if (wsDescriptionsMD != null) {
      if (wsDescriptionsMD.size() > 1) {
        ASHelper.LOGGER.warn("Multiple <webservice-description> elements not supported");
      }

      if (wsDescriptionsMD.size() > 0) {
        return wsDescriptionsMD.iterator().next();
      }
    }

    return null;
  }