1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.caleigo.core;
20
21 /*** Basic implementation of IDataSource that wraps a IDataService.
22 *
23 * @author Dennis Zikovic
24 * @version 1.00
25 *
26 *//*
27 *
28 * WHEN WHO WHY & WHAT
29 * -----------------------------------------------------------------------------
30 * 2001-10-31 Dennis Zikovic Creation
31 */
32 public class SingleServiceDataSource implements IDataSource
33 {
34
35 private IDataService mDataService;
36 private IDataSourceDescriptor mDataSourceDescriptor;
37
38
39
40 /*** Creates new AbstractDataSource
41 */
42 public SingleServiceDataSource(IDataService dataService)
43 {
44 mDataService = dataService;
45 mDataSourceDescriptor = mDataService.getDataSourceDescriptor();
46 }
47
48
49
50 /*** Returns the IDataSourceDescriptor for this data source.
51 */
52 public IDataSourceDescriptor getDataSourceDescriptor()
53 {
54 return mDataSourceDescriptor;
55 }
56
57 /*** Returns the IDataService for this data source.
58 */
59 public IDataService getDataService()
60 {
61 return mDataService;
62 }
63
64 /*** Creates a new entity and lets the data source be the manafer of that
65 * entity. This method can be used to create an entity with a data source
66 * that is not the default data source for the entitys realated
67 * IDataSourceDescriptor.
68 */
69 public IEntity createEntity(IEntityDescriptor entityDescriptor)
70 {
71 return entityDescriptor.createEntity();
72 }
73
74 /*** The load method returnes a single entity object intentified by the
75 * provided indentity qualifier that must be able to uniquely identify
76 * a single entity instance.
77 */
78 public IEntity loadEntity(IEntityDescriptor entityDescriptor, Qualifier identityQualifier)
79 {
80 return mDataService.load(entityDescriptor, identityQualifier);
81 }
82
83 /*** Loads a selection of entities identyfied by the provided qualifier.
84 */
85 public ISelection loadSelection(IEntityDescriptor entityDescriptor, Qualifier qualifier)
86 {
87 return mDataService.loadSelection(entityDescriptor, qualifier);
88 }
89
90 /*** Creates a new entity and lets the data source be the manafer of that
91 * entity. This method can be used to create an entity with a data source
92 * that is not the default data source for the entitys realated
93 * IDataSourceDescriptor. The entity is loaded with data from the provided
94 * property source.
95 */
96 public IEntity createEntity(IEntityDescriptor entityDescriptor, IDataProvider propertySource)
97 {
98 return entityDescriptor.createEntity(propertySource);
99 }
100
101 /*** Instucts the data source object to take over the control of an entity.
102 * The entity will henceforth belong to this data source and will have its
103 * PERSISTENT flag reset. This method is optional and may throw an
104 * UnsupportedOperationException.
105 */
106 public IEntity manageEntity(IEntity entity)
107 {
108 throw new UnsupportedOperationException();
109 }
110
111
112
113
114
115
116
117
118 }