Source Code Cross Referenced for Provider.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » component » osid » registry » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » sakai » org.sakaiproject.component.osid.registry 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: $
003:         * $Id:  $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.component.osid.registry;
021:
022:        /**
023:         * <p>
024:         * Provider implements a "straw-man" registry interface.  Each RepositoryManager
025:         * is a separate Provider.  RepositoryManagers are the top-level object in the
026:         * O.K.I. Repository OSID.  Providers have several attributes.
027:         * </p>
028:         * 
029:         * @author Massachusetts Institute of Technology
030:         */
031:        public class Provider implements  edu.mit.osid.registry.Provider {
032:            private edu.mit.osid.registry.RegistryManager registryManager = null;
033:            private String osidService = null;
034:            private String osidVersion = null;
035:            private String osidLoadKey = null;
036:            private String displayName = null;
037:            private String description = null;
038:            private org.osid.shared.Id id = null;
039:            private String creator = null;
040:            private String publisher = null;
041:            private String registrationDate = null;
042:            private String rights = null;
043:
044:            /**
045:             * Store away the input arguments for use by accessors.
046:             */
047:            protected Provider(
048:                    edu.mit.osid.registry.RegistryManager registryManager,
049:                    String osidService, String osidVersion, String osidLoadKey,
050:                    String displayName, String description,
051:                    org.osid.shared.Id id, String creator, String publisher,
052:                    String registrationDate, String rights) {
053:                this .registryManager = registryManager;
054:                this .osidService = osidService;
055:                this .osidVersion = osidVersion;
056:                this .osidLoadKey = osidLoadKey;
057:                this .displayName = displayName;
058:                this .description = description;
059:                this .id = id;
060:                this .creator = creator;
061:                this .publisher = publisher;
062:                this .registrationDate = registrationDate;
063:                this .rights = rights;
064:            }
065:
066:            /**
067:             * The OSID Service is the package name defined by O.K.I.
068:             * An example is org.osid.repository
069:             * Get the value stored at construction or during an update.
070:             */
071:            public String getOsidService()
072:                    throws edu.mit.osid.registry.RegistryException {
073:                return this .osidService;
074:            }
075:
076:            /**
077:             * The OSID Service is the package name defined by O.K.I.
078:             * An example is org.osid.repositor
079:             * Update the value stored at construction or during an earlier update.
080:             * This change is immediately written to the registry.
081:             */
082:            public void updateOsidService(String osidService)
083:                    throws edu.mit.osid.registry.RegistryException {
084:                if ((osidService == null) || (osidService.length() == 0)) {
085:                    throw new edu.mit.osid.registry.RegistryException(
086:                            org.osid.shared.SharedException.NULL_ARGUMENT);
087:                }
088:
089:                String undo = this .osidService;
090:                this .osidService = osidService;
091:                try {
092:                    syncWithXML();
093:                } catch (Throwable t) {
094:                    log(t);
095:                    this .osidService = undo;
096:                }
097:            }
098:
099:            /**
100:             * The version of the OSID -- not the version of the implementation.  An example is 2.0.
101:             * Get the value stored at construction or during an update.	 
102:             */
103:            public String getOsidVersion()
104:                    throws edu.mit.osid.registry.RegistryException {
105:                return this .osidVersion;
106:            }
107:
108:            /**
109:             * The version of the OSID -- not the version of the implementation.  An example is 2.0.
110:             * Update the value stored at construction or during an earlier update.
111:             * This change is immediately written to the registry.
112:             */
113:            public void updateOsidVersion(String osidVersion)
114:                    throws edu.mit.osid.registry.RegistryException {
115:                if ((osidVersion == null) || (osidVersion.length() == 0)) {
116:                    throw new edu.mit.osid.registry.RegistryException(
117:                            org.osid.shared.SharedException.NULL_ARGUMENT);
118:                }
119:
120:                String undo = this .osidVersion;
121:                this .osidVersion = osidVersion;
122:                try {
123:                    syncWithXML();
124:                } catch (Throwable t) {
125:                    log(t);
126:                    this .osidVersion = undo;
127:                }
128:            }
129:
130:            /**
131:             * The information a loader / factory would need to return an instance of an implementation.
132:             * An example is edu.mit.osidimpl.repository.xyz
133:             * Get the value stored at construction or during an update.
134:             */
135:            public String getOsidLoadKey()
136:                    throws edu.mit.osid.registry.RegistryException {
137:                return this .osidLoadKey;
138:            }
139:
140:            /**
141:             * The information a loader / factory would need to return an instance of an implementation.
142:             * An example is edu.mit.osidimpl.repository.xyz
143:             * Update the value stored at construction or during an earlier update.
144:             * This change is immediately written to the registry.
145:             */
146:            public void updateOsidLoadKey(String osidLoadKey)
147:                    throws edu.mit.osid.registry.RegistryException {
148:                if ((osidLoadKey == null) || (osidLoadKey.length() == 0)) {
149:                    throw new edu.mit.osid.registry.RegistryException(
150:                            org.osid.shared.SharedException.NULL_ARGUMENT);
151:                }
152:
153:                String undo = this .osidLoadKey;
154:                this .osidLoadKey = osidLoadKey;
155:                try {
156:                    syncWithXML();
157:                } catch (Throwable t) {
158:                    log(t);
159:                    this .osidLoadKey = undo;
160:                }
161:            }
162:
163:            /**
164:             * A short name for this implementation suitable for display in a picklist.
165:             * Get the value stored at construction or during an update.
166:             */
167:            public String getDisplayName()
168:                    throws edu.mit.osid.registry.RegistryException {
169:                return this .displayName;
170:            }
171:
172:            /**
173:             * A short name for this implementation suitable for display in a picklist.
174:             * Update the value stored at construction or during an earlier update.
175:             * This change is immediately written to the registry.
176:             */
177:            public void updateDisplayName(String displayName)
178:                    throws edu.mit.osid.registry.RegistryException {
179:                if ((displayName == null) || (displayName.length() == 0)) {
180:                    throw new edu.mit.osid.registry.RegistryException(
181:                            org.osid.shared.SharedException.NULL_ARGUMENT);
182:                }
183:
184:                String undo = this .displayName;
185:                this .displayName = displayName;
186:                try {
187:                    syncWithXML();
188:                } catch (Throwable t) {
189:                    log(t);
190:                    this .displayName = undo;
191:                }
192:            }
193:
194:            /**
195:             * Longer and more informative text than the display name.
196:             * Get the value stored at construction or during an update.
197:             */
198:            public String getDescription()
199:                    throws edu.mit.osid.registry.RegistryException {
200:                return this .description;
201:            }
202:
203:            /**
204:             * Longer and more informative text than the display name.
205:             * Update the value stored at construction or during an earlier update.
206:             * This change is immediately written to the registry.
207:             */
208:            public void updateDescription(String description)
209:                    throws edu.mit.osid.registry.RegistryException {
210:                if ((description == null) || (description.length() == 0)) {
211:                    throw new edu.mit.osid.registry.RegistryException(
212:                            org.osid.shared.SharedException.NULL_ARGUMENT);
213:                }
214:
215:                String undo = this .description;
216:                this .description = description;
217:                try {
218:                    syncWithXML();
219:                } catch (Throwable t) {
220:                    log(t);
221:                    this .description = undo;
222:                }
223:            }
224:
225:            /**
226:             * A unique identifier for the Repository.
227:             * Get the value stored at construction or during an update.
228:             */
229:            public org.osid.shared.Id getId()
230:                    throws edu.mit.osid.registry.RegistryException {
231:                return this .id;
232:            }
233:
234:            /**
235:             * A unique identifier for the Repository.
236:             * Update the value stored at construction or during an earlier update.
237:             * This change is immediately written to the registry.
238:             */
239:            public void updateId(org.osid.shared.Id id)
240:                    throws edu.mit.osid.registry.RegistryException {
241:                if (id == null) {
242:                    throw new edu.mit.osid.registry.RegistryException(
243:                            org.osid.shared.SharedException.NULL_ARGUMENT);
244:                }
245:
246:                org.osid.shared.Id undo = this .id;
247:                this .id = id;
248:                try {
249:                    syncWithXML();
250:                } catch (Throwable t) {
251:                    log(t);
252:                    this .id = undo;
253:                }
254:            }
255:
256:            /**
257:             * The author of the implementation.
258:             * Get the value stored at construction or during an update.
259:             */
260:            public String getCreator()
261:                    throws edu.mit.osid.registry.RegistryException {
262:                return this .creator;
263:            }
264:
265:            /**
266:             * The author of the implementation.
267:             * Update the value stored at construction or during an earlier update.
268:             * This change is immediately written to the registry.
269:             */
270:            public void updateCreator(String creator)
271:                    throws edu.mit.osid.registry.RegistryException {
272:                if ((creator == null) || (creator.length() == 0)) {
273:                    throw new edu.mit.osid.registry.RegistryException(
274:                            org.osid.shared.SharedException.NULL_ARGUMENT);
275:                }
276:
277:                String undo = this .creator;
278:                this .creator = creator;
279:                try {
280:                    syncWithXML();
281:                } catch (Throwable t) {
282:                    log(t);
283:                    this .creator = undo;
284:                }
285:            }
286:
287:            /**
288:             * The institution that developed or is providing the implementation.
289:             * Get the value stored at construction or during an update.
290:             */
291:            public String getPublisher()
292:                    throws edu.mit.osid.registry.RegistryException {
293:                return this .publisher;
294:            }
295:
296:            /**
297:             * The institution that developed or is providing the implementation.
298:             * Update the value stored at construction or during an earlier update.
299:             * This change is immediately written to the registry.
300:             */
301:            public void updatePublisher(String publisher)
302:                    throws edu.mit.osid.registry.RegistryException {
303:                if ((publisher == null) || (publisher.length() == 0)) {
304:                    throw new edu.mit.osid.registry.RegistryException(
305:                            org.osid.shared.SharedException.NULL_ARGUMENT);
306:                }
307:
308:                String undo = this .publisher;
309:                this .publisher = publisher;
310:                try {
311:                    syncWithXML();
312:                } catch (Throwable t) {
313:                    log(t);
314:                    this .publisher = undo;
315:                }
316:            }
317:
318:            /**
319:             * The timestamp for this registration.  This is set by the RegistryManager.createProvider()
320:             * method.  Consumers of the Registry may use this date to determine which of two versions
321:             * of a Provider is more recent.
322:             * Get the value stored at construction or during an update.
323:             */
324:            public String getRegistrationDate()
325:                    throws edu.mit.osid.registry.RegistryException {
326:                return this .registrationDate;
327:            }
328:
329:            /**
330:             * The timestamp for this registration.  This is set by the RegistryManager.createProvider()
331:             * method.  Consumers of the Registry may use this date to determine which of two versions
332:             * of a Provider is more recent.  Call this method with care.  Letting createProvider()
333:             * populate this value may be safer.
334:             * Update the value stored at construction or during an earlier update.
335:             * This change is immediately written to the registry.
336:             */
337:            public void updateRegistrationDate(String registrationDate)
338:                    throws edu.mit.osid.registry.RegistryException {
339:                if ((registrationDate == null)
340:                        || (registrationDate.length() == 0)) {
341:                    throw new edu.mit.osid.registry.RegistryException(
342:                            org.osid.shared.SharedException.NULL_ARGUMENT);
343:                }
344:
345:                String undo = this .registrationDate;
346:                this .registrationDate = registrationDate;
347:                try {
348:                    syncWithXML();
349:                } catch (Throwable t) {
350:                    log(t);
351:                    this .registrationDate = undo;
352:                }
353:            }
354:
355:            /**
356:             * A description of how the Repository may be used.  Note there is no digital rights enforcement
357:             * in the Registry, so this is descriptive only.
358:             * Get the value stored at construction or during an update.
359:             */
360:            public String getRights()
361:                    throws edu.mit.osid.registry.RegistryException {
362:                return this .rights;
363:            }
364:
365:            /**
366:             * A description of how the Repository may be used.  Note there is no digital rights enforcement
367:             * in the Registry, so this is descriptive only.
368:             * Update the value stored at construction or during an earlier update.
369:             * This change is immediately written to the registry.
370:             */
371:            public void updateRights(String rights)
372:                    throws edu.mit.osid.registry.RegistryException {
373:                if ((rights == null) || (rights.length() == 0)) {
374:                    throw new edu.mit.osid.registry.RegistryException(
375:                            org.osid.shared.SharedException.NULL_ARGUMENT);
376:                }
377:
378:                String undo = this .rights;
379:                this .rights = rights;
380:                try {
381:                    syncWithXML();
382:                } catch (Throwable t) {
383:                    log(t);
384:                    this .rights = undo;
385:                }
386:            }
387:
388:            private void log(Throwable t) {
389:                t.printStackTrace();
390:            }
391:
392:            /*
393:             * Update the XML by deleting and then creating (with updated data) this provider.  If the update
394:             * fails, the data will be out-of-sync.
395:             */
396:            private void syncWithXML()
397:                    throws edu.mit.osid.registry.RegistryException {
398:                this.registryManager.deleteProvider(this.id);
399:                this.registryManager.createProvider(osidService, osidVersion,
400:                        osidLoadKey, this.displayName, this.description,
401:                        this.id, this.creator, this.publisher,
402:                        this.registrationDate, this.rights);
403:            }
404:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.