All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.xml.ws.developer.EPRRecipe Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
/*
 * Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0, which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package com.sun.xml.ws.developer;

import com.sun.istack.NotNull;
import com.sun.xml.ws.api.message.Header;
import com.sun.xml.ws.api.message.Headers;

import javax.xml.transform.Source;
import jakarta.xml.ws.EndpointReference;
import jakarta.xml.ws.wsaddressing.W3CEndpointReference;
import java.util.ArrayList;
import java.util.List;

/**
 * Represents additional data to be added to EPRs
 * created from {@link StatefulWebServiceManager} (for advanced users).
 *
 * 

* Occasionally it is convenient to be able to control the data to be * present on {@link EndpointReference}s created by {@link StatefulWebServiceManager}. * You can do so by using this class like this: * *

 * statefulWebServiceManager.export({@link W3CEndpointReference}.class,myObject,
 *   new EPRRecipe().addReferenceParameter({@link Headers}.create(...))
 *                  .addReferenceParameter({@link Headers}.create(...)));
 * 
* *

* The methods on this class follows * the fluent interface design to allow construction without using a variable. * * *

* See * WS-Addressing EPR information model for more details. * * @author Kohsuke Kawaguchi * @since 2.1.1 * @see StatefulWebServiceManager * @see Headers */ public final class EPRRecipe { private final List

referenceParameters = new ArrayList
(); private final List metadata = new ArrayList(); /** * Gets all the reference parameters added so far. */ public @NotNull List
getReferenceParameters() { return referenceParameters; } /** * Gets all the metadata added so far. */ public @NotNull List getMetadata() { return metadata; } /** * Adds a new reference parameter. */ public EPRRecipe addReferenceParameter(Header h) { if(h==null) throw new IllegalArgumentException(); referenceParameters.add(h); return this; } /** * Adds all the headers as reference parameters. */ public EPRRecipe addReferenceParameters(Header... headers) { for (Header h : headers) addReferenceParameter(h); return this; } /** * Adds all the headers as reference parameters. */ public EPRRecipe addReferenceParameters(Iterable headers) { for (Header h : headers) addReferenceParameter(h); return this; } /** * Adds a new metadata. */ public EPRRecipe addMetadata(Source source) { if(source==null) throw new IllegalArgumentException(); metadata.add(source); return this; } public EPRRecipe addMetadata(Source... sources) { for (Source s : sources) addMetadata(s); return this; } public EPRRecipe addMetadata(Iterable sources) { for (Source s : sources) addMetadata(s); return this; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy