Source code: org/acs/damsel/client/ClientApp.java
1 package org.acs.damsel.client;
2
3 import org.acs.damsel.srvr.auth.*;
4 import org.acs.damsel.srvr.user.*;
5 import org.acs.damsel.srvr.collection.*;
6 import org.acs.damsel.srvr.repository.*;
7 import org.acs.damsel.srvr.schema.*;
8 import org.acs.damsel.srvr.search.*;
9 import org.acs.damsel.srvr.user.*;
10 import java.sql.SQLException;
11 import org.acs.damsel.srvr.schema.SchemaException;
12 import org.acs.damsel.srvr.group.*;
13
14 /**
15 * <p>Title: ClientApp</p>
16 * <p>Description: This class is a singleton mediator between the presentation
17 * and application layers and provides the presentation layer access to objects
18 * and services in the application layer</p>
19 * <p>This class provides access to the SchemaMgr, CollectionMgr, AuthMgr
20 * and SearchMgr</p>
21 * @version 1.0
22 */
23 public class ClientApp {
24 private static ClientApp instance = null;
25 private SchemaMgr schemaMgr = null;
26 private SearchMgr searchMgr = null;
27 private UserMgr userMgr = null;
28 private CollectionMgr collectionMgr = null;
29 private AuthMgr authMgr = null;
30 private RepositoryMgr repositoryMgr = null;
31 private GroupMgr groupMgr = null;
32
33 private ClientApp() {
34 }
35
36 public static ClientApp instance() {
37 if(instance == null)
38 instance = new ClientApp();
39 return instance;
40 }
41
42 /**
43 * getCollectionMgr() returns a handle on the CollectionMgr. If the
44 * CollectionMgr has not yet been initialized, Damsel creates one.
45 * @return a handle on the CollectionMgr
46 */
47 public CollectionMgr getCollectionMgr() {
48 if(collectionMgr != null)
49 return collectionMgr;
50 collectionMgr = new CollectionMgr();
51 return collectionMgr;
52 }
53
54 /**
55 * getAuthMgr() returns a handle on the AuthMgr. If the
56 * AuthMgr has not yet been initialized, Damsel creates one.
57 * @return a handle on the AuthMgr
58 */
59 public AuthMgr getAuthMgr(){
60 if(authMgr != null)
61 return authMgr;
62 authMgr = new AuthMgr();
63 return authMgr;
64 }
65
66 /**
67 * getSearchMgr(Collection c) returns a handle on the SearchMgr. A new
68 * SearchMgr is created based on the specified collection.
69 * @return a handle on the SearchMgr
70 * @param Collection c
71 */
72 public SearchMgr getSearchMgr() {
73 if (searchMgr != null)
74 return searchMgr;
75 searchMgr = new SearchMgr();
76 return searchMgr;
77 }
78
79 /**
80 * getSchemaMgr() returns a handle on the SchemaMgr. If the
81 * SchemaMgr has not yet been initialized, Damsel creates one.
82 * @return a handle on the SchemaMgr
83 */
84 public SchemaMgr getSchemaMgr() {
85 if (schemaMgr != null)
86 return schemaMgr;
87 schemaMgr = new SchemaMgr();
88 return schemaMgr;
89 }
90
91 /**
92 * getRepositoryMgr() returns a handle on the RepositoryMgr. If the
93 * repositoryMgr has not yet been initialized, Damsel creates one.
94 * @return a handle on the RepositoryMgr
95 */
96 public RepositoryMgr getRepositoryMgr() {
97 if (repositoryMgr != null)
98 return repositoryMgr;
99 repositoryMgr = new RepositoryMgr();
100 return repositoryMgr;
101 }
102
103 /**
104 * getUserMgr() returns a handle on the UserMgr. If the
105 * userMgr has not yet been initialized, Damsel creates one.
106 * @return a handle on the UserMgr
107 */
108
109 public UserMgr getUserMgr() {
110 if (userMgr != null)
111 return userMgr;
112 userMgr = new UserMgr();
113 return userMgr;
114 }
115
116 /**
117 * getGroupMgr() returns a handle on the GroupMgr. If the
118 * groupMgr has not yet been initialized, Damsel creates one.
119 * @return a handle on the GroupMgr
120 */
121
122 public GroupMgr getGroupMgr() {
123 if (groupMgr != null)
124 return groupMgr;
125 groupMgr = new GroupMgr();
126 return groupMgr;
127 }
128
129
130 }