1 /*
2 * Copyright (c) 2003-2008 by Cosylab d. d.
3 *
4 * This file is part of CosyBeans.
5 *
6 * CosyBeans is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CosyBeans is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CosyBeans. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 package com.cosylab.gui.displayers;
21
22 import java.beans.PropertyVetoException;
23
24
25 /**
26 * <code>DataSource</code> is interface for generic data source. Data source
27 * source dispatches dynamic value updates to registered data consumers.
28 *
29 * @author <a href="mailto:igor.kriznar@cosylab.com">Igor Kriznar</a>
30 * @version $Id: DataSource.java,v 1.4 2008-04-22 12:31:02 jbobnar Exp $
31 *
32 * @see com.cosylab.gui.displayers2.DataConsumer
33 * @since Nov 24, 2003.
34 */
35 public interface DataSource {
36 /**
37 * Registers data consumer at this data source. This data source can denay
38 * consumer by throwing <code>PropertyVetoException</code> if consumer
39 * does not provide necessary <code>DataConsumer</code> type.
40 *
41 * @param consumer the data consumer to be regitered at this data source
42 *
43 * @see DataConsumer#getDataConsumer(Class)
44 */
45 public void addConsumer(DataConsumer consumer) throws PropertyVetoException;
46
47 /**
48 * Deregisters data consumer from this data source.
49 *
50 * @param consumer data consumer to be deregistered
51 */
52 public void removeConsumer(DataConsumer consumer);
53
54 /**
55 * Returns array of registered data consumer.
56 *
57 * @return array of registered data consumer
58 */
59 public DataConsumer[] getConsumers();
60
61 /**
62 * Returns the array of consumer types, which are acceptable by this data
63 * source.
64 *
65 * @return the array of acceptable data source types
66 */
67 public Class<DataConsumer>[] getAcceptableConsumerTypes();
68
69 /**
70 * Removes all consumers from data source and releases all resources
71 * and bindings allocated inside datasource to the consumers.
72 *
73 */
74 public void removeAllConsumers();
75 }
76
77
78 /* __oOo__ */