View Javadoc
1   /*
2    * Copyright (c) 1997, 2011, 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.bind.api;
27  
28  import javax.xml.bind.ValidationEventHandler;
29  import javax.xml.bind.attachment.AttachmentMarshaller;
30  import javax.xml.bind.attachment.AttachmentUnmarshaller;
31  
32  /**
33   * Holds thread specific state information for {@link Bridge}s,
34   * to make {@link Bridge} thread-safe.
35   *
36   * <p>
37   * This object cannot be used concurrently; two threads cannot
38   * use the same object with {@link Bridge}s at the same time, nor
39   * a thread can use a {@link BridgeContext} with one {@link Bridge} while
40   * the same context is in use by another {@link Bridge}.
41   *
42   * <p>
43   * {@link BridgeContext} is relatively a heavy-weight object, and
44   * therefore it is expected to be cached by the JAX-RPC RI.
45   *
46   * <p>
47   * <b>Subject to change without notice</b>.
48   *
49   * @author Kohsuke Kawaguchi
50   * @since 2.0 EA1
51   * @see Bridge
52   * @deprecated
53   *      The caller no longer needs to use this, as {@link Bridge} has
54   *      methods that can work without {@link BridgeContext}.
55   */
56  public abstract class BridgeContext {
57      protected BridgeContext() {}
58  
59      /**
60       * Registers the error handler that receives unmarshalling/marshalling errors.
61       *
62       * @param handler
63       *      can be null, in which case all errors will be considered fatal.
64       *
65       * @since 2.0 EA1
66       */
67      public abstract void setErrorHandler(ValidationEventHandler handler);
68  
69      /**
70       * Sets the {@link AttachmentMarshaller}.
71       *
72       * @since 2.0 EA1
73       */
74      public abstract void setAttachmentMarshaller(AttachmentMarshaller m);
75  
76      /**
77       * Sets the {@link AttachmentUnmarshaller}.
78       *
79       * @since 2.0 EA1
80       */
81      public abstract void setAttachmentUnmarshaller(AttachmentUnmarshaller m);
82  
83      /**
84       * Gets the last {@link AttachmentMarshaller} set through
85       * {@link AttachmentMarshaller}.
86       *
87       * @since 2.0 EA2
88       */
89      public abstract AttachmentMarshaller getAttachmentMarshaller();
90  
91      /**
92       * Gets the last {@link AttachmentUnmarshaller} set through
93       * {@link AttachmentUnmarshaller}.
94       *
95       * @since 2.0 EA2
96       */
97      public abstract AttachmentUnmarshaller getAttachmentUnmarshaller();
98  }