325N/A/*
325N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.xml.internal.ws.api.pipe;
325N/A
325N/Aimport com.sun.xml.internal.ws.api.BindingID;
325N/Aimport com.sun.xml.internal.ws.util.ServiceFinder;
325N/A
325N/Aimport javax.xml.ws.soap.SOAPBinding;
325N/Aimport java.util.logging.Logger;
325N/A
325N/A/**
325N/A * Creates {@link PipelineAssembler}.
325N/A *
325N/A * <p>
325N/A * To create a pipeline,
325N/A * the JAX-WS runtime locates {@link PipelineAssemblerFactory}s through
325N/A * the <tt>META-INF/services/com.sun.xml.internal.ws.api.pipe.PipelineAssemblerFactory</tt> files.
325N/A * Factories found are checked to see if it supports the given binding ID one by one,
325N/A * and the first valid {@link PipelineAssembler} returned will be used to create
325N/A * a pipeline.
325N/A *
325N/A * <p>
325N/A * TODO: is bindingId really extensible? for this to be extensible,
325N/A * someone seems to need to hook into WSDL parsing.
325N/A *
325N/A * <p>
325N/A * TODO: JAX-WSA might not define its own binding ID -- it may just go to an extension element
325N/A * of WSDL. So this abstraction might need to be worked on.
325N/A *
325N/A * @author Kohsuke Kawaguchi
325N/A * @deprecated
325N/A * Use {@link TubelineAssemblerFactory} instead.
325N/A */
325N/Apublic abstract class PipelineAssemblerFactory {
325N/A /**
325N/A * Creates a {@link PipelineAssembler} applicable for the given binding ID.
325N/A *
325N/A * @param bindingId
325N/A * The binding ID for which a pipeline will be created,
325N/A * such as {@link SOAPBinding#SOAP11HTTP_BINDING}.
325N/A * Must not be null.
325N/A *
325N/A * @return
325N/A * null if this factory doesn't recognize the given binding ID.
325N/A */
325N/A public abstract PipelineAssembler doCreate(BindingID bindingId);
325N/A
325N/A /**
325N/A * Locates {@link PipelineAssemblerFactory}s and create
325N/A * a suitable {@link PipelineAssembler}.
325N/A *
325N/A * @param bindingId
325N/A * The binding ID string for which the new {@link PipelineAssembler}
325N/A * is created. Must not be null.
325N/A * @return
325N/A * Always non-null, since we fall back to our default {@link PipelineAssembler}.
325N/A */
325N/A public static PipelineAssembler create(ClassLoader classLoader, BindingID bindingId) {
325N/A for (PipelineAssemblerFactory factory : ServiceFinder.find(PipelineAssemblerFactory.class,classLoader)) {
325N/A PipelineAssembler assembler = factory.doCreate(bindingId);
325N/A if(assembler!=null) {
325N/A logger.fine(factory.getClass()+" successfully created "+assembler);
325N/A return assembler;
325N/A }
325N/A }
325N/A
325N/A // default binding IDs that are known
325N/A // TODO: replace this with proper ones
325N/A return new com.sun.xml.internal.ws.util.pipe.StandalonePipeAssembler();
325N/A }
325N/A
325N/A private static final Logger logger = Logger.getLogger(PipelineAssemblerFactory.class.getName());
325N/A}