01: /*
02: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03: *
04: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
05: *
06: * The contents of this file are subject to the terms of either the GNU
07: * General Public License Version 2 only ("GPL") or the Common
08: * Development and Distribution License("CDDL") (collectively, the
09: * "License"). You may not use this file except in compliance with the
10: * License. You can obtain a copy of the License at
11: * http://www.netbeans.org/cddl-gplv2.html
12: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13: * specific language governing permissions and limitations under the
14: * License. When distributing the software, include this License Header
15: * Notice in each file and include the License file at
16: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17: * particular file as subject to the "Classpath" exception as provided
18: * by Sun in the GPL Version 2 section of the License file that
19: * accompanied this code. If applicable, add the following below the
20: * License Header, with the fields enclosed by brackets [] replaced by
21: * your own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Contributor(s):
25: *
26: * The Original Software is NetBeans. The Initial Developer of the Original
27: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
28: * Microsystems, Inc. All Rights Reserved.
29: *
30: * If you wish your version of this file to be governed by only the CDDL
31: * or only the GPL Version 2, indicate your decision by adding
32: * "[Contributor] elects to include this software in this distribution
33: * under the [CDDL or GPL Version 2] license." If you do not indicate a
34: * single choice of license, a recipient has the option to distribute
35: * your version of this file under either the CDDL, the GPL Version 2 or
36: * to extend the choice of license to its licensees as provided above.
37: * However, if you add GPL Version 2 code and therefore, elected the GPL
38: * Version 2 license, then the option applies only if the new code is
39: * made subject to such option by the copyright holder.
40: */
41:
42: package com.sun.data.provider;
43:
44: /**
45: * <p>Behavioral interface that is implemented by {@link DataProvider} classes
46: * that offer refresh support. Calling the <code>refresh()</code> method on
47: * this interface causes the DataProvider to re-fetch whatever data it is
48: * representing from the underlying source. This may be a JDBC call, or an EJB
49: * or web service method invocation, etc. Any cached changes in the
50: * DataProvider will be lost.</p>
51: *
52: * @author Joe Nuxoll
53: */
54: public interface RefreshableDataProvider extends DataProvider {
55:
56: /**
57: * <p>Cause a re-fetch of whatever data this {@link DataProvider} is
58: * representing from the underlying source. This may result in a JDBC call,
59: * or an EJB or web service method invocation, etc. Any cached changes in
60: * the DataProvider will be lost.</p>
61: *
62: * @throws DataProviderException Implementations may wish to surface
63: * internal exceptions (nested in DataProviderException). Consult
64: * the documentation of the specific DataProvider implementation for
65: * details on what exceptions might be wrapped by a DPE.
66: */
67: public void refresh() throws DataProviderException;
68:
69: // ---------------------------------------------- Event Registration Methods
70:
71: /**
72: * <p>Register a new {@link RefreshableDataListener} to this
73: * {@link RefreshableDataProvider} instance.</p>
74: *
75: * @param listener New {@link RefreshableDataListener} to register
76: */
77: public void addRefreshableDataListener(
78: RefreshableDataListener listener);
79:
80: /**
81: * <p>Deregister an existing {@link RefreshableDataListener} from
82: * {@link RefreshableDataProvider} instance.</p>
83: *
84: * @param listener Old {@link RefreshableDataListener} to remove
85: */
86: public void removeRefreshableDataListener(
87: RefreshableDataListener listener);
88:
89: /**
90: * @return An array of the {@link RefreshableDataListener}s
91: * currently registered on this {@link RefreshableDataProvider}.
92: * If there are no registered listeners, a zero-length array is
93: * returned.
94: */
95: public RefreshableDataListener[] getRefreshableDataListeners();
96: }
|