src/share/jaxws_classes/com/sun/xml/internal/ws/api/pipe/PipelineAssemblerFactory.java

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 368
0989ad8c0860
parent 0
373ffda63c9a
permissions
-rw-r--r--

merge

     1 /*
     2  * Copyright (c) 1997, 2012, 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  */
    26 package com.sun.xml.internal.ws.api.pipe;
    28 import com.sun.xml.internal.ws.api.BindingID;
    29 import com.sun.xml.internal.ws.util.ServiceFinder;
    31 import javax.xml.ws.soap.SOAPBinding;
    32 import java.util.logging.Logger;
    34 /**
    35  * Creates {@link PipelineAssembler}.
    36  *
    37  * <p>
    38  * To create a pipeline,
    39  * the JAX-WS runtime locates {@link PipelineAssemblerFactory}s through
    40  * the <tt>META-INF/services/com.sun.xml.internal.ws.api.pipe.PipelineAssemblerFactory</tt> files.
    41  * Factories found are checked to see if it supports the given binding ID one by one,
    42  * and the first valid {@link PipelineAssembler} returned will be used to create
    43  * a pipeline.
    44  *
    45  * <p>
    46  * TODO: is bindingId really extensible? for this to be extensible,
    47  * someone seems to need to hook into WSDL parsing.
    48  *
    49  * <p>
    50  * TODO: JAX-WSA might not define its own binding ID -- it may just go to an extension element
    51  * of WSDL. So this abstraction might need to be worked on.
    52  *
    53  * @author Kohsuke Kawaguchi
    54  * @deprecated
    55  *      Use {@link TubelineAssemblerFactory} instead.
    56  */
    57 public abstract class PipelineAssemblerFactory {
    58     /**
    59      * Creates a {@link PipelineAssembler} applicable for the given binding ID.
    60      *
    61      * @param bindingId
    62      *      The binding ID for which a pipeline will be created,
    63      *      such as {@link SOAPBinding#SOAP11HTTP_BINDING}.
    64      *      Must not be null.
    65      *
    66      * @return
    67      *      null if this factory doesn't recognize the given binding ID.
    68      */
    69     public abstract PipelineAssembler doCreate(BindingID bindingId);
    71     /**
    72      * Locates {@link PipelineAssemblerFactory}s and create
    73      * a suitable {@link PipelineAssembler}.
    74      *
    75      * @param bindingId
    76      *      The binding ID string for which the new {@link PipelineAssembler}
    77      *      is created. Must not be null.
    78      * @return
    79      *      Always non-null, since we fall back to our default {@link PipelineAssembler}.
    80      */
    81     public static PipelineAssembler create(ClassLoader classLoader, BindingID bindingId) {
    82         for (PipelineAssemblerFactory factory : ServiceFinder.find(PipelineAssemblerFactory.class,classLoader)) {
    83             PipelineAssembler assembler = factory.doCreate(bindingId);
    84             if(assembler!=null) {
    85                 logger.fine(factory.getClass()+" successfully created "+assembler);
    86                 return assembler;
    87             }
    88         }
    90         // default binding IDs that are known
    91         // TODO: replace this with proper ones
    92         return new com.sun.xml.internal.ws.util.pipe.StandalonePipeAssembler();
    93     }
    95     private static final Logger logger = Logger.getLogger(PipelineAssemblerFactory.class.getName());
    96 }

mercurial