Source Code Cross Referenced for RegistryObjectImpl.java in  » Web-Services » XML-Registry-JAXR » org » apache » ws » scout » registry » infomodel » 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 » Web Services » XML Registry JAXR » org.apache.ws.scout.registry.infomodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2004 The Apache Software Foundation.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.apache.ws.scout.registry.infomodel;
018:
019:        import java.util.Collection;
020:        import java.util.Collections;
021:        import java.util.HashSet;
022:        import java.util.Iterator;
023:        import java.util.Set;
024:
025:        import javax.xml.registry.JAXRException;
026:        import javax.xml.registry.LifeCycleManager;
027:        import javax.xml.registry.UnsupportedCapabilityException;
028:        import javax.xml.registry.infomodel.Association;
029:        import javax.xml.registry.infomodel.Classification;
030:        import javax.xml.registry.infomodel.Concept;
031:        import javax.xml.registry.infomodel.ExternalIdentifier;
032:        import javax.xml.registry.infomodel.ExternalLink;
033:        import javax.xml.registry.infomodel.InternationalString;
034:        import javax.xml.registry.infomodel.Key;
035:        import javax.xml.registry.infomodel.Organization;
036:        import javax.xml.registry.infomodel.RegistryObject;
037:
038:        /**
039:         * Implements  RegistryObject Interface
040:         * Implements JAXR Interface.
041:         * For futher details, look into the JAXR API Javadoc.
042:         *
043:         * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
044:         * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
045:         */
046:        public class RegistryObjectImpl extends ExtensibleObjectImpl implements 
047:                RegistryObject {
048:            private final LifeCycleManager lifeCycleManager;
049:            private Key key;
050:            private InternationalString name = new InternationalStringImpl();
051:            private InternationalString desc = new InternationalStringImpl();
052:
053:            private Set<Classification> classifications = new HashSet<Classification>();
054:            private Set<Association> associations = new HashSet<Association>();
055:            private Set<ExternalIdentifier> externalIds = new HashSet<ExternalIdentifier>();
056:            private Set<ExternalLink> externalLinks = new HashSet<ExternalLink>();
057:
058:            private OrganizationImpl submittingOrganization;
059:
060:            public RegistryObjectImpl(LifeCycleManager lifeCycleManager) {
061:                this .lifeCycleManager = lifeCycleManager;
062:            }
063:
064:            public RegistryObjectImpl(LifeCycleManager lifeCycleManager,
065:                    InternationalString n) {
066:                this .lifeCycleManager = lifeCycleManager;
067:                name = n;
068:            }
069:
070:            public Key getKey() {
071:                return key;
072:            }
073:
074:            public InternationalString getDescription() {
075:                return desc;
076:            }
077:
078:            public void setDescription(InternationalString description) {
079:                this .desc = description;
080:            }
081:
082:            public InternationalString getName() {
083:                return name;
084:            }
085:
086:            public void setName(InternationalString name) {
087:                this .name = name;
088:            }
089:
090:            public void setKey(Key k) {
091:                key = k;
092:            }
093:
094:            public String toXML() throws JAXRException {
095:                throw new UnsupportedCapabilityException(
096:                        "toXML is not supported");
097:            }
098:
099:            public void addClassification(Classification classification) {
100:                classifications.add(classification);
101:            }
102:
103:            public void addClassifications(Collection collection) {
104:                if (collection != null) {
105:                    for (Iterator i = collection.iterator(); i.hasNext();) {
106:                        Classification classification = (Classification) i
107:                                .next();
108:                        classifications.add(classification);
109:                    }
110:                }
111:            }
112:
113:            public void removeClassification(Classification classification) {
114:                classifications.remove(classification);
115:            }
116:
117:            public void removeClassifications(
118:                    Collection<Classification> collection) {
119:                classifications.removeAll(collection);
120:            }
121:
122:            public Collection getClassifications() {
123:                return Collections.unmodifiableSet(classifications);
124:            }
125:
126:            public void setClassifications(Collection<Classification> collection) {
127:                Set<Classification> newClassifications = new HashSet<Classification>(
128:                        collection.size());
129:                for (Iterator i = collection.iterator(); i.hasNext();) {
130:                    Classification classification = (Classification) i.next();
131:                    newClassifications.add(classification);
132:                }
133:                classifications = newClassifications;
134:            }
135:
136:            /**
137:             *  Adds specified Association to use this object as source.
138:             *  Silently replaces the sourceObject in Association with
139:             *  reference to this object.
140:             *
141:             * @param association
142:             * @throws JAXRException
143:             */
144:            public void addAssociation(Association association)
145:                    throws JAXRException {
146:                associations.add(association);
147:
148:                association.setSourceObject(this );
149:            }
150:
151:            public void addAssociations(Collection collection)
152:                    throws JAXRException {
153:                for (Iterator i = collection.iterator(); i.hasNext();) {
154:                    Association association = (Association) i.next();
155:
156:                    addAssociation(association);
157:                }
158:            }
159:
160:            public Collection<Association> getAssociations()
161:                    throws JAXRException {
162:                return Collections.unmodifiableSet(associations);
163:            }
164:
165:            public void setAssociations(Collection collection) {
166:                Set<Association> newAssociations = new HashSet<Association>(
167:                        collection.size());
168:                for (Iterator i = collection.iterator(); i.hasNext();) {
169:                    Association association = (Association) i.next();
170:                    newAssociations.add(association);
171:                }
172:                associations = newAssociations;
173:            }
174:
175:            public void removeAssociation(Association association) {
176:                associations.remove(association);
177:            }
178:
179:            public void removeAssociations(Collection collection) {
180:                associations.removeAll(collection);
181:            }
182:
183:            public void addExternalIdentifier(
184:                    ExternalIdentifier externalIdentifier) {
185:                externalIds.add(externalIdentifier);
186:                ((ExternalIdentifierImpl) externalIdentifier)
187:                        .setRegistryObject(this );
188:            }
189:
190:            public void addExternalIdentifiers(Collection collection) {
191:                if (collection != null) {
192:                    for (Iterator i = collection.iterator(); i.hasNext();) {
193:                        ExternalIdentifier externalId = (ExternalIdentifier) i
194:                                .next();
195:                        externalIds.add(externalId);
196:                        ((ExternalIdentifierImpl) externalId)
197:                                .setRegistryObject(this );
198:                    }
199:                }
200:            }
201:
202:            public void removeExternalIdentifier(
203:                    ExternalIdentifier externalIdentifier) {
204:                externalIds.remove(externalIdentifier);
205:                ((ExternalIdentifierImpl) externalIdentifier)
206:                        .setRegistryObject(null);
207:            }
208:
209:            public void removeExternalIdentifiers(Collection collection) {
210:                //Lets clear out the reference to this in the ext id
211:                Iterator iter = collection.iterator();
212:                while (iter != null && iter.hasNext()) {
213:                    ExternalIdentifier externalId = (ExternalIdentifier) iter
214:                            .next();
215:                    ((ExternalIdentifierImpl) externalId)
216:                            .setRegistryObject(null);
217:                }
218:                externalIds.removeAll(collection);
219:            }
220:
221:            public Collection<ExternalIdentifier> getExternalIdentifiers() {
222:                return Collections.unmodifiableSet(externalIds);
223:            }
224:
225:            public void setExternalIdentifiers(
226:                    Collection<ExternalIdentifier> collection) {
227:                Set<ExternalIdentifier> newExternalIds = new HashSet<ExternalIdentifier>(
228:                        collection.size());
229:                for (Iterator i = collection.iterator(); i.hasNext();) {
230:                    ExternalIdentifier externalId = (ExternalIdentifier) i
231:                            .next();
232:                    newExternalIds.add(externalId);
233:                }
234:                externalIds = newExternalIds;
235:            }
236:
237:            public void addExternalLink(ExternalLink externalLink) {
238:                externalLinks.add(externalLink);
239:                ((ExternalLinkImpl) externalLink).addLinkedObject(this );
240:            }
241:
242:            public void addExternalLinks(Collection<ExternalLink> collection) {
243:                for (Iterator i = collection.iterator(); i.hasNext();) {
244:                    ExternalLink externalLink = (ExternalLink) i.next();
245:                    externalLinks.add(externalLink);
246:                    ((ExternalLinkImpl) externalLink).addLinkedObject(this );
247:                }
248:            }
249:
250:            public void removeExternalLink(ExternalLink externalLink) {
251:                ((ExternalLinkImpl) externalLink).removeLinkedObject(this );
252:                externalLinks.remove(externalLink);
253:            }
254:
255:            public void removeExternalLinks(Collection collection) {
256:                Iterator iter = collection.iterator();
257:                while (iter != null && iter.hasNext()) {
258:                    ExternalLink externalLink = (ExternalLink) iter.next();
259:                    ((ExternalLinkImpl) externalLink).removeLinkedObject(this );
260:                }
261:                externalLinks.removeAll(collection);
262:            }
263:
264:            public Collection<ExternalLink> getExternalLinks() {
265:                return Collections.unmodifiableSet(externalLinks);
266:            }
267:
268:            public void setExternalLinks(Collection<ExternalLink> collection) {
269:                Set<ExternalLink> newExternalLinks = new HashSet<ExternalLink>(
270:                        collection.size());
271:                for (Iterator i = collection.iterator(); i.hasNext();) {
272:                    ExternalLink externalLink = (ExternalLink) i.next();
273:                    newExternalLinks.add(externalLink);
274:                }
275:                externalLinks = newExternalLinks;
276:            }
277:
278:            public Organization getSubmittingOrganization() {
279:                return submittingOrganization;
280:            }
281:
282:            public LifeCycleManager getLifeCycleManager() {
283:                return lifeCycleManager;
284:            }
285:
286:            /**
287:             * The spec does not define how equality is defined for RegistryObject's.
288:             * We choose to define it as having the same class and key value; if the
289:             * key is null then the objects are not equal.
290:             *
291:             * @param obj the object to compare to
292:             * @return true if the other object is of the same class and has the same key value
293:             */
294:            public boolean equals(Object obj) {
295:                if (obj == this )
296:                    return true;
297:                if (obj == null || !this .getClass().equals(obj.getClass()))
298:                    return false;
299:                final RegistryObjectImpl other = (RegistryObjectImpl) obj;
300:                return this .key != null && key.equals(other.key);
301:            }
302:
303:            public int hashCode() {
304:                return key == null ? 0 : key.hashCode();
305:            }
306:
307:            ///////////////////////////////////////////////////////////////////////////
308:            // Level 1 features must throw exceptions
309:            ///////////////////////////////////////////////////////////////////////////
310:
311:            public Collection getAuditTrail() throws JAXRException {
312:                throw new UnsupportedCapabilityException("Level 1 feature");
313:            }
314:
315:            public Collection getAssociatedObjects() throws JAXRException {
316:                throw new UnsupportedCapabilityException("Level 1 feature");
317:            }
318:
319:            public Concept getObjectType() throws JAXRException {
320:                throw new UnsupportedCapabilityException("Level 1 feature");
321:            }
322:
323:            public Collection getRegistryPackages() throws JAXRException {
324:                throw new UnsupportedCapabilityException("Level 1 feature");
325:            }
326:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.