Source Code Cross Referenced for ServicemoduleImpl.java in  » UML » MetaBoss » com » metaboss » sdlctools » models » impl » metabossmodel » enterprisemodel » 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 » UML » MetaBoss » com.metaboss.sdlctools.models.impl.metabossmodel.enterprisemodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012:        // POSSIBILITY OF SUCH DAMAGE.
013:        //
014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015:        package com.metaboss.sdlctools.models.impl.metabossmodel.enterprisemodel;
016:
017:        import java.util.ArrayList;
018:        import java.util.Arrays;
019:        import java.util.Collection;
020:        import java.util.Collections;
021:        import java.util.HashSet;
022:        import java.util.Iterator;
023:        import java.util.List;
024:        import java.util.Set;
025:
026:        import org.netbeans.mdr.storagemodel.StorableObject;
027:
028:        import com.metaboss.sdlctools.models.impl.metabossmodel.ModelElementImpl;
029:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
030:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataDictionary;
031:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataType;
032:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.Structure;
033:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.StructureField;
034:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.EventSubscription;
035:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Message;
036:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Service;
037:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Servicemodule;
038:
039:        public abstract class ServicemoduleImpl extends ModelElementImpl
040:                implements  Servicemodule {
041:            // Required constructor
042:            protected ServicemoduleImpl(StorableObject storable) {
043:                super (storable);
044:            }
045:
046:            /**
047:             * @param pEventSubscriptionName 
048:             * @return requested EventSubscription or throws exception if none found
049:             */
050:            public EventSubscription getEventSubscription(
051:                    String pEventSubscriptionName) {
052:                EventSubscription lFoundEventSubscription = findEventSubscription(pEventSubscriptionName);
053:                // Throw exception if nothing found
054:                if (lFoundEventSubscription == null)
055:                    throw new IllegalArgumentException(
056:                            "Unable to locate EventSubscription named '"
057:                                    + pEventSubscriptionName
058:                                    + "' in Servicemodule. ServicemoduleRef: "
059:                                    + getRef());
060:                return lFoundEventSubscription;
061:            }
062:
063:            /**
064:             * @param pEventSubscriptionName 
065:             * @return requested EventSubscription or null if none found
066:             */
067:            public EventSubscription findEventSubscription(
068:                    String pEventSubscriptionName) {
069:                Collection lEventSubscriptions = getEventSubscriptions();
070:                if (!lEventSubscriptions.isEmpty()) {
071:                    for (Iterator lEventSubscriptionsIterator = lEventSubscriptions
072:                            .iterator(); lEventSubscriptionsIterator.hasNext();) {
073:                        EventSubscription lEventSubscription = (EventSubscription) lEventSubscriptionsIterator
074:                                .next();
075:                        if (lEventSubscription.getName().equals(
076:                                pEventSubscriptionName))
077:                            return lEventSubscription;
078:                    }
079:                }
080:                return null;
081:            }
082:
083:            /**
084:             * @param pServiceName 
085:             * @return requested Service or throws exception if none found
086:             */
087:            public Service getService(String pServiceName) {
088:                Service lFoundService = findService(pServiceName);
089:                // Throw exception if nothing found
090:                if (lFoundService == null)
091:                    throw new IllegalArgumentException(
092:                            "Unable to locate Service named '" + pServiceName
093:                                    + "' in Servicemodule. ServicemoduleRef: "
094:                                    + getRef());
095:                return lFoundService;
096:            }
097:
098:            /**
099:             * @param pServiceName 
100:             * @return requested Service or null if none found
101:             */
102:            public Service findService(String pServiceName) {
103:                Collection lServices = getServices();
104:                if (!lServices.isEmpty()) {
105:                    for (Iterator lServicesIterator = lServices.iterator(); lServicesIterator
106:                            .hasNext();) {
107:                        Service lService = (Service) lServicesIterator.next();
108:                        if (lService.getName().equals(pServiceName))
109:                            return lService;
110:                    }
111:                }
112:                return null;
113:            }
114:
115:            /**
116:             * @param pStructureName 
117:             * @return requested Structure or throws exception if none found
118:             */
119:            public Structure getStructure(String pStructureName) {
120:                Structure lFoundStructure = findStructure(pStructureName);
121:                // Throw exception if nothing found
122:                if (lFoundStructure == null)
123:                    throw new IllegalArgumentException(
124:                            "Unable to locate Structure named '"
125:                                    + pStructureName
126:                                    + "' in Servicemodule. ServicemoduleRef: "
127:                                    + getRef());
128:                return lFoundStructure;
129:            }
130:
131:            /**
132:             * @param pStructureName 
133:             * @return requested Structure or null if none found
134:             */
135:            public Structure findStructure(String pStructureName) {
136:                Collection lStructures = getStructures();
137:                if (!lStructures.isEmpty()) {
138:                    for (Iterator lStructuresIterator = lStructures.iterator(); lStructuresIterator
139:                            .hasNext();) {
140:                        Structure lStructure = (Structure) lStructuresIterator
141:                                .next();
142:                        if (lStructure.getName().equals(pStructureName))
143:                            return lStructure;
144:                    }
145:                }
146:                return null;
147:            }
148:
149:            // Returns list of of Structures directly within this namespace in its dependency order. Any external structures are ignored
150:            public List getStructuresInDependencyOrder() {
151:                Collection lStructures = getStructures();
152:                Structure[] lReturnArray = new Structure[lStructures.size()];
153:                HashSet lUnprocessedStructRefs = new HashSet();
154:                {
155:                    int i = 0;
156:                    for (Iterator lStructsIterator = lStructures.iterator(); lStructsIterator
157:                            .hasNext();) {
158:                        Structure lStruct = (Structure) lStructsIterator.next();
159:                        lReturnArray[i++] = lStruct;
160:                        lUnprocessedStructRefs.add(lStruct.getRef());
161:                    }
162:                }
163:                HashSet lProcessedStructRefs = new HashSet();
164:                ArrayList lProcessedStructs = new ArrayList();
165:                for (int i = 0; i < lReturnArray.length;) {
166:                    Structure lStructure = lReturnArray[i];
167:                    boolean lMustBeMoved = false;
168:                    StructureField[] lFields = (StructureField[]) lStructure
169:                            .getFields().toArray(new StructureField[0]);
170:                    for (int j = 0; j < lFields.length; j++) {
171:                        StructureField lField = lFields[j];
172:                        Structure lFieldStructureType = lField
173:                                .getStructureType();
174:                        if (lFieldStructureType != null
175:                                && lStructures.contains(lFieldStructureType)) {
176:                            if (lFieldStructureType.equals(lStructure))
177:                                continue; // Structure is referring to itself - already defined
178:                            if (lProcessedStructRefs
179:                                    .contains(lFieldStructureType.getRef()))
180:                                continue; // Structure is referring to already defined structure
181:                            if (!lUnprocessedStructRefs
182:                                    .contains(lFieldStructureType.getRef()))
183:                                throw new RuntimeException(
184:                                        "Unexpected situation. Structure reference not found.");
185:                            lMustBeMoved = true;
186:                            break;
187:                        }
188:                    }
189:                    if (!lMustBeMoved) {
190:                        lUnprocessedStructRefs.remove(lStructure.getRef());
191:                        lProcessedStructRefs.add(lStructure.getRef());
192:                        i++;
193:                        continue; // Only has already defined fields
194:                    }
195:                    // Shift this structure to the back and do not increment index
196:                    System.arraycopy(lReturnArray, i + 1, lReturnArray, i,
197:                            lReturnArray.length - i - 1);
198:                    lReturnArray[lReturnArray.length - 1] = lStructure;
199:                }
200:                return Arrays.asList(lReturnArray);
201:            }
202:
203:            /**
204:             * @param pMessageName 
205:             * @return requested Message or throws exception if none found
206:             */
207:            public Message getMessage(String pMessageName) {
208:                Message lFoundMessage = findMessage(pMessageName);
209:                // Throw exception if nothing found
210:                if (lFoundMessage == null)
211:                    throw new IllegalArgumentException(
212:                            "Unable to locate Message named '" + pMessageName
213:                                    + "' in Servicemodule. ServicemoduleRef: "
214:                                    + getRef());
215:                return lFoundMessage;
216:            }
217:
218:            /**
219:             * @param pMessageName 
220:             * @return requested Message or null if none found
221:             */
222:            public Message findMessage(String pMessageName) {
223:                Collection lMessages = getMessages();
224:                if (!lMessages.isEmpty()) {
225:                    for (Iterator lMessagesIterator = lMessages.iterator(); lMessagesIterator
226:                            .hasNext();) {
227:                        Message lMessage = (Message) lMessagesIterator.next();
228:                        if (lMessage.getName().equals(pMessageName))
229:                            return lMessage;
230:                    }
231:                }
232:                return null;
233:            }
234:
235:            /** Returns read-only collection of referenced servicemodules */
236:            public Collection getReferencedServicemodules() {
237:                Set lReferencedServicemodules = new HashSet();
238:                for (Iterator lTypesIterator = getCombinedTypes().iterator(); lTypesIterator
239:                        .hasNext();) {
240:                    ModelElement lTypeElement = (ModelElement) lTypesIterator
241:                            .next();
242:                    if (lTypeElement instanceof  Structure) {
243:                        Structure lStructure = (Structure) lTypeElement;
244:                        Servicemodule lServicemodule = lStructure
245:                                .getServicemodule();
246:                        if (lServicemodule != null
247:                                && lServicemodule.equals(this ) == false)
248:                            lReferencedServicemodules.add(lServicemodule); // Duplicate add will be discarded
249:                    } else if (lTypeElement instanceof  Message) {
250:                        Message lMessage = (Message) lTypeElement;
251:                        Servicemodule lServicemodule = lMessage
252:                                .getServicemodule();
253:                        if (lServicemodule != null
254:                                && lServicemodule.equals(this ) == false)
255:                            lReferencedServicemodules.add(lServicemodule); // Duplicate add will be discarded
256:                    }
257:                }
258:                return Collections
259:                        .unmodifiableCollection(lReferencedServicemodules);
260:            }
261:
262:            /** Returns read-only collection of referenced datadictionaries */
263:            public Collection getReferencedDataDictionaries() {
264:                Set lReferencedDataDictionaries = new HashSet();
265:                for (Iterator lTypesIterator = getCombinedTypes().iterator(); lTypesIterator
266:                        .hasNext();) {
267:                    ModelElement lTypeElement = (ModelElement) lTypesIterator
268:                            .next();
269:                    if (lTypeElement instanceof  Structure) {
270:                        Structure lStructure = (Structure) lTypeElement;
271:                        DataDictionary lDataDictionary = lStructure
272:                                .getOwnerDataDictionary();
273:                        if (lDataDictionary != null)
274:                            lReferencedDataDictionaries.add(lDataDictionary);
275:                    } else if (lTypeElement instanceof  Message) {
276:                        Message lMessage = (Message) lTypeElement;
277:                        DataDictionary lDataDictionary = lMessage
278:                                .getOwnerDataDictionary();
279:                        if (lDataDictionary != null)
280:                            lReferencedDataDictionaries.add(lDataDictionary);
281:                    } else if (lTypeElement instanceof  DataType) {
282:                        DataType lDataType = (DataType) lTypeElement;
283:                        DataDictionary lDataDictionary = lDataType
284:                                .getOwnerDataDictionary();
285:                        if (lDataDictionary != null)
286:                            lReferencedDataDictionaries.add(lDataDictionary);
287:                    }
288:                }
289:                return Collections
290:                        .unmodifiableCollection(lReferencedDataDictionaries);
291:            }
292:
293:            /** @return All combined structures and types used in all services structures and messages */
294:            public Collection getCombinedTypes() {
295:                Set lCombinedTypes = new HashSet();
296:                for (Iterator lServicesIterator = getServices().iterator(); lServicesIterator
297:                        .hasNext();) {
298:                    Service lService = (Service) lServicesIterator.next();
299:                    lCombinedTypes.addAll(lService.getCombinedTypes());
300:                }
301:                for (Iterator lStructuresIterator = getStructures().iterator(); lStructuresIterator
302:                        .hasNext();) {
303:                    Structure lStructure = (Structure) lStructuresIterator
304:                            .next();
305:                    lCombinedTypes.add(lStructure);
306:                    lCombinedTypes.addAll(lStructure.getCombinedTypes());
307:                }
308:                for (Iterator lMessagesIterator = getMessages().iterator(); lMessagesIterator
309:                        .hasNext();) {
310:                    Message lMessage = (Message) lMessagesIterator.next();
311:                    lCombinedTypes.add(lMessage);
312:                    lCombinedTypes.addAll(lMessage.getCombinedTypes());
313:                }
314:                return java.util.Collections
315:                        .unmodifiableCollection(lCombinedTypes);
316:            }
317:        }
w___ww._j__a__v___a___2s__._c__o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.