Source Code Cross Referenced for ModelAssistantFactory.java in  » UML » MetaBoss » com » metaboss » sdlctools » models » modelassistant » metabossmodel » codeconstraints » 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.modelassistant.metabossmodel.codeconstraints 
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.modelassistant.metabossmodel.codeconstraints;
016:
017:        import java.util.Collection;
018:        import java.util.HashMap;
019:        import java.util.Map;
020:
021:        import javax.jmi.reflect.RefObject;
022:
023:        import com.metaboss.sdlctools.models.ModelAssistant;
024:        import com.metaboss.sdlctools.models.ModelRepositoryException;
025:
026:        /** Assistant factory implementation. Special implementation ensures that there
027:         * is a dedicated assistant per model and all calls are dispatched to it */
028:        public class ModelAssistantFactory implements 
029:                javax.naming.spi.ObjectFactory {
030:            // Map is static in the factory - so there is always only one assistant for a model
031:            private static Map sDedicatedAssistantsMap = new HashMap();
032:
033:            // Special implementation which dispatches methods to objects dedicated to a model
034:            private class DispatchingModelAssistant implements  ModelAssistant {
035:
036:                public void assignToModel(String pModelName)
037:                        throws ModelRepositoryException {
038:                    if (sDedicatedAssistantsMap.containsKey(pModelName))
039:                        throw new ModelRepositoryException(
040:                                "Assistant is already assigned to the '"
041:                                        + pModelName + "'model");
042:                    ModelAssistant lDedicatedModelAssistant = new ModelAssistantImpl();
043:                    sDedicatedAssistantsMap.put(pModelName,
044:                            lDedicatedModelAssistant);
045:                    lDedicatedModelAssistant.assignToModel(pModelName);
046:                }
047:
048:                public void dismissFromModel(String pModelName)
049:                        throws ModelRepositoryException {
050:                    ModelAssistant lDedicatedModelAssistant = (ModelAssistant) sDedicatedAssistantsMap
051:                            .remove(pModelName);
052:                    if (lDedicatedModelAssistant != null)
053:                        lDedicatedModelAssistant.dismissFromModel(pModelName);
054:                }
055:
056:                public void setActionsLogger(String pModelName,
057:                        ModelAssistant.ModelActionsLogger pModelActionsLogger)
058:                        throws ModelRepositoryException {
059:                    ModelAssistant lDedicatedModelAssistant = (ModelAssistant) sDedicatedAssistantsMap
060:                            .remove(pModelName);
061:                    if (lDedicatedModelAssistant != null)
062:                        lDedicatedModelAssistant.setActionsLogger(pModelName,
063:                                pModelActionsLogger);
064:                }
065:
066:                public Collection verifyConstraints(String pModelName)
067:                        throws ModelRepositoryException {
068:                    ModelAssistant lDedicatedModelAssistant = (ModelAssistant) sDedicatedAssistantsMap
069:                            .get(pModelName);
070:                    if (lDedicatedModelAssistant == null)
071:                        throw new ModelRepositoryException(
072:                                "Assistant is not assigned to the '"
073:                                        + pModelName + "'model");
074:                    return lDedicatedModelAssistant
075:                            .verifyConstraints(pModelName);
076:                }
077:
078:                public void rectifyModel(String pModelName)
079:                        throws ModelRepositoryException {
080:                    ModelAssistant lDedicatedModelAssistant = (ModelAssistant) sDedicatedAssistantsMap
081:                            .get(pModelName);
082:                    if (lDedicatedModelAssistant == null)
083:                        throw new ModelRepositoryException(
084:                                "Assistant is not assigned to the '"
085:                                        + pModelName + "'model");
086:                    lDedicatedModelAssistant.rectifyModel(pModelName);
087:                }
088:
089:                public void onModelElementBeingDeleted(String pModelName,
090:                        RefObject pModelElementToBeDeleted)
091:                        throws ModelRepositoryException {
092:                    ModelAssistant lDedicatedModelAssistant = (ModelAssistant) sDedicatedAssistantsMap
093:                            .get(pModelName);
094:                    if (lDedicatedModelAssistant == null)
095:                        throw new ModelRepositoryException(
096:                                "Assistant is not assigned to the '"
097:                                        + pModelName + "'model");
098:                    lDedicatedModelAssistant.onModelElementBeingDeleted(
099:                            pModelName, pModelElementToBeDeleted);
100:                }
101:
102:                public void onModelElementJustCreated(String pModelName,
103:                        RefObject pModelElementJustCreated)
104:                        throws ModelRepositoryException {
105:                    ModelAssistant lDedicatedModelAssistant = (ModelAssistant) sDedicatedAssistantsMap
106:                            .get(pModelName);
107:                    if (lDedicatedModelAssistant == null)
108:                        throw new ModelRepositoryException(
109:                                "Assistant is not assigned to the '"
110:                                        + pModelName + "'model");
111:                    lDedicatedModelAssistant.onModelElementJustCreated(
112:                            pModelName, pModelElementJustCreated);
113:                }
114:
115:                public void onModelElementAttributeBeingUpdated(
116:                        String pModelName, RefObject pModelElementBeingUpdated,
117:                        String pAttributeName, Object pOldAttributeValue,
118:                        Object pNewAttributeValue)
119:                        throws ModelRepositoryException {
120:                    ModelAssistant lDedicatedModelAssistant = (ModelAssistant) sDedicatedAssistantsMap
121:                            .get(pModelName);
122:                    if (lDedicatedModelAssistant == null)
123:                        throw new ModelRepositoryException(
124:                                "Assistant is not assigned to the '"
125:                                        + pModelName + "'model");
126:                    lDedicatedModelAssistant
127:                            .onModelElementAttributeBeingUpdated(pModelName,
128:                                    pModelElementBeingUpdated, pAttributeName,
129:                                    pOldAttributeValue, pNewAttributeValue);
130:                }
131:
132:                public void onModelElementReferenceBeingUpdated(
133:                        String pModelName, RefObject pModelElementBeingUpdated,
134:                        String pReferenceName,
135:                        RefObject pReferencedModelElementToRemove,
136:                        RefObject pReferencedModelElementToAdd)
137:                        throws ModelRepositoryException {
138:                    ModelAssistant lDedicatedModelAssistant = (ModelAssistant) sDedicatedAssistantsMap
139:                            .get(pModelName);
140:                    if (lDedicatedModelAssistant == null)
141:                        throw new ModelRepositoryException(
142:                                "Assistant is not assigned to the '"
143:                                        + pModelName + "'model");
144:                    lDedicatedModelAssistant
145:                            .onModelElementReferenceBeingUpdated(pModelName,
146:                                    pModelElementBeingUpdated, pReferenceName,
147:                                    pReferencedModelElementToRemove,
148:                                    pReferencedModelElementToAdd);
149:                }
150:
151:            };
152:
153:            /* Returns the instance of the dispatching assistant, which will always ensure that
154:             * each model has own copy of actual assistant implementation */
155:            public Object getObjectInstance(Object obj, javax.naming.Name name,
156:                    javax.naming.Context nameCtx,
157:                    java.util.Hashtable environment) throws Exception {
158:                return new DispatchingModelAssistant();
159:            }
160:        }
w_w_w___.j__a__v___a__2__s_.___c__o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.