Thu, 31 Aug 2017 15:18:52 +0800
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.oracle.webservices.internal.api.message;
28 import java.util.Map;
30 import com.sun.istack.internal.Nullable;
32 /**
33 * {@link PropertySet} that combines properties exposed from multiple
34 * {@link PropertySet}s into one.
35 *
36 * <p>
37 * This implementation allows one {@link PropertySet} to assemble
38 * all properties exposed from other "satellite" {@link PropertySet}s.
39 * (A satellite may itself be a {@link DistributedPropertySet}, so
40 * in general this can form a tree.)
41 *
42 * <p>
43 * This is useful for JAX-WS because the properties we expose to the application
44 * are contributed by different pieces, and therefore we'd like each of them
45 * to have a separate {@link PropertySet} implementation that backs up
46 * the properties. For example, this allows FastInfoset to expose its
47 * set of properties to {@link RequestContext} by using a strongly-typed fields.
48 *
49 * <p>
50 * This is also useful for a client-side transport to expose a bunch of properties
51 * into {@link ResponseContext}. It simply needs to create a {@link PropertySet}
52 * object with methods for each property it wants to expose, and then add that
53 * {@link PropertySet} to {@link Packet}. This allows property values to be
54 * lazily computed (when actually asked by users), thus improving the performance
55 * of the typical case where property values are not asked.
56 *
57 * <p>
58 * A similar benefit applies on the server-side, for a transport to expose
59 * a bunch of properties to {@link WebServiceContext}.
60 *
61 * <p>
62 * To achieve these benefits, access to {@link DistributedPropertySet} is slower
63 * compared to {@link PropertySet} (such as get/set), while adding a satellite
64 * object is relatively fast.
65 *
66 * @author Kohsuke Kawaguchi
67 */
68 public interface DistributedPropertySet extends com.oracle.webservices.internal.api.message.PropertySet {
70 public @Nullable <T extends com.oracle.webservices.internal.api.message.PropertySet> T getSatellite(Class<T> satelliteClass);
72 public Map<Class<? extends com.oracle.webservices.internal.api.message.PropertySet>, com.oracle.webservices.internal.api.message.PropertySet> getSatellites();
74 public void addSatellite(com.oracle.webservices.internal.api.message.PropertySet satellite);
76 public void addSatellite(Class<? extends com.oracle.webservices.internal.api.message.PropertySet> keyClass, com.oracle.webservices.internal.api.message.PropertySet satellite);
78 public void removeSatellite(com.oracle.webservices.internal.api.message.PropertySet satellite);
80 public void copySatelliteInto(com.oracle.webservices.internal.api.message.MessageContext r);
81 }