1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.xml.internal.ws.api;
  27 
  28 import com.sun.istack.internal.Nullable;
  29 import com.sun.istack.internal.NotNull;
  30 
  31 import javax.xml.ws.WebServiceException;
  32 
  33 /**
  34  * Extension point to plug in additional {@link BindingID} parsing logic.
  35  *
  36  * <p>
  37  * When the JAX-WS RI is asked to parse a binding ID string into a {@link BindingID}
  38  * object, it uses service idiom to look for the implementations of this class
  39  * in the {@code META-INF/services/...}.
  40  *
  41  * @since JAX-WS 2.0.next
  42  * @author Kohsuke Kawaguchi
  43  * @see BindingID#parse(String)
  44  */
  45 public abstract class BindingIDFactory {
  46     /**
  47      * Parses a binding ID string into {@link BindingID} if possible.
  48      *
  49      * @return
  50      *      a non-null return value would cause the JAX-WS RI to consider
  51      *      the parsing to be successful. No furhter {@link BindingIDFactory}
  52      *      will be consulted.
  53      *
  54      *      <p>
  55      *      Retruning a null value indicates that this factory doesn't understand
  56      *      this string, in which case the JAX-WS RI will keep asking next
  57      *      {@link BindingIDFactory}.
  58      *
  59      * @throws WebServiceException
  60      *      if the implementation understood the lexical value but it is not correct,
  61      *      this exception can be thrown to abort the parsing with error.
  62      *      No further {@link BindingIDFactory} will be consulted, and
  63      *      {@link BindingID#parse(String)} will throw the exception.
  64      */
  65     public abstract @Nullable BindingID parse(@NotNull String lexical) throws WebServiceException;
  66 
  67     /**
  68      * Creates a {@link BindingID} for given transport and SOAPVersion.
  69      *
  70      * @return
  71      *      a non-null return value would cause the JAX-WS RI to consider
  72      *      the creation to be successful. No furhter {@link BindingIDFactory}
  73      *      will be consulted.
  74      *
  75      *      <p>
  76      *      Retruning a null value indicates that this factory doesn't understand
  77      *      the transport, in which case the JAX-WS RI will keep asking next
  78      *      {@link BindingIDFactory}.
  79      *
  80      * @throws WebServiceException
  81      *      if the implementation understood the transport but it is not correct,
  82      *      this exception can be thrown to abort the creation with error.
  83      *      No further {@link BindingIDFactory} will be consulted, and
  84      *      {@link BindingID#create(String, SOAPVersion)} will throw the exception.
  85      */
  86     public @Nullable BindingID create(@NotNull String transport, @NotNull SOAPVersion soapVersion) throws WebServiceException {
  87         return null;
  88     }
  89 }
--- EOF ---