Source Code Cross Referenced for KeyPattern.java in  » Testing » KeY » de » uka » ilkd » key » casetool » together » keydebugclassloader » 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 » Testing » KeY » de.uka.ilkd.key.casetool.together.keydebugclassloader 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // This file is part of KeY - Integrated Deductive Software Design
002:        // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
003:        //                         Universitaet Koblenz-Landau, Germany
004:        //                         Chalmers University of Technology, Sweden
005:        //
006:        // The KeY system is protected by the GNU General Public License. 
007:        // See LICENSE.TXT for details.
008:        //
009:        //
010:
011:        /* Generated by Together */
012:
013:        package de.uka.ilkd.key.casetool.together.keydebugclassloader;
014:
015:        import java.lang.reflect.Field;
016:        import java.util.Vector;
017:
018:        import com.togethersoft.openapi.sci.pattern.SciPattern;
019:
020:        import de.uka.ilkd.key.casetool.together.patterns.HelperClasses.MyPatternBase.MyClassPatternBase;
021:        import de.uka.ilkd.key.util.Debug;
022:
023:        public abstract class KeyPattern extends MyClassPatternBase implements 
024:                SciPattern {
025:
026:            public String KEY_SET_METHOD;
027:            public String KEY_CONSTRUCTOR_PARAMETER;
028:            public String KEY_NONE;
029:
030:            {
031:                Field field = null;
032:                try {
033:                    field = getClass().getField("UI_NONE");
034:                    if (field == null) {
035:                        Debug.out("Together-API<6.0");
036:                        KEY_SET_METHOD = (String) getClass().getField(
037:                                "SET_METHOD").get(this );
038:                        KEY_CONSTRUCTOR_PARAMETER = (String) getClass()
039:                                .getField("CONSTRUCTOR_PARAMETER").get(this );
040:                        KEY_NONE = (String) getClass().getField("NONE").get(
041:                                this );
042:                    } else {
043:                        Debug.out("Together-API>=6.0");
044:                        KEY_SET_METHOD = (String) getClass().getField(
045:                                "UI_SET_METHOD").get(this );
046:                        KEY_CONSTRUCTOR_PARAMETER = (String) getClass()
047:                                .getField("UI_CONSTRUCTOR_PARAMETER").get(this );
048:                        KEY_NONE = (String) getClass().getField("UI_NONE").get(
049:                                this );
050:                    }
051:                } catch (IllegalAccessException iae) {
052:                    System.err
053:                            .println("keypattern: underlying constructor is inaccesible.");
054:                    System.err.println("The exception was: " + iae);
055:                    iae.printStackTrace();
056:                } catch (IllegalArgumentException iae) {
057:                    System.err
058:                            .println("keypattern: specified object is not an "
059:                                    + "instance of the class or interface declaring"
060:                                    + "the underlying field (or a subclass or implementor"
061:                                    + "thereof).field is not accessible.");
062:                    System.err.println("The exception was: " + iae);
063:                    iae.printStackTrace();
064:                } catch (NoSuchFieldException e) {
065:                    String message = "Together renamed some fields, when changing from API <6.0 to >=6.0.\n";
066:                    message += "The thrown exception indicates that you have a (probably) new version,\n";
067:                    message += "where the fields have been renamed once again.\n";
068:                    message += " Please mail this error to: key@ira.uka.de\n";
069:                    message += "The thrown exception was " + e;
070:                    System.err.println("keypattern:" + message);
071:                    e.printStackTrace();
072:                } catch (SecurityException se) {
073:                    String message = "Together renamed some fields, when changing from API <6.0 to >=6.0.\n";
074:                    message += "The thrown exception indicates, that you use (probably) a newer\n";
075:                    message += "version, where the access permissions have been restricted.";
076:                    message += " Please mail this error to: key@ira.uka.de\n";
077:                    message += "The thrown exception was: " + se;
078:                    System.err.println("keypattern:" + message);
079:                    se.printStackTrace();
080:                }
081:
082:            }
083:
084:            private KeyPattern this clone;
085:
086:            public final boolean prepare() {
087:                int i;
088:                if ("on".equals(System.getProperty("KeyDebugClassLoader"))) {
089:                    this clone = reloadClassDef();
090:                    //	    IdeMessageManagerAccess.printMessage(IdeMessageType.INFORMATION, "jetzt habe ich reload gemacht!\n");
091:                    Class cl = this .getClass();
092:                    Vector fieldVector = new Vector();
093:                    Field[] fields = cl.getDeclaredFields();
094:                    for (i = 0; i < fields.length; i++) {
095:                        fieldVector.addElement(fields[i]);
096:                    }
097:                    Class help = cl;
098:                    while (help.getSuperclass() != null) {
099:                        help = help.getSuperclass();
100:                        fields = help.getDeclaredFields();
101:                        for (i = 0; i < fields.length; i++) {
102:                            fields[i].setAccessible(true); // damit auch private der Oberklassen lesbar werden
103:                            fieldVector.addElement(fields[i]);
104:                        }
105:                    }
106:                    for (i = 0; i < fieldVector.size(); i++) {
107:                        Field actField = (Field) fieldVector.elementAt(i);
108:                        try {
109:                            //    System.out.println(actField.getName() + " mit wert " +  actField.get(this)+"\n");
110:                            actField.set(this clone, actField.get(this ));
111:                        } catch (IllegalAccessException iae) {
112:                            System.err
113:                                    .println("keypattern: setting/getting of field failed. Reason:\n"
114:                                            + "the underlying constructor is inaccessible.");
115:                            System.err.println("The exception was:" + iae);
116:                            iae.printStackTrace();
117:                        } catch (IllegalArgumentException iarg) {
118:                            System.err
119:                                    .println("keypattern: setting/getting of field failed. Reason:\n"
120:                                            + "The specified object is not an instance of the\n"
121:                                            + "class or interface declaring the underlying field\n"
122:                                            + "(or a subclass or implementor thereof), or if an\n"
123:                                            + "unwrapping conversion fails.");
124:                            System.err.println("The exception was:" + iarg);
125:                            iarg.printStackTrace();
126:                        } catch (NullPointerException ne) {
127:                            System.err
128:                                    .println("keypattern: setting of field failed. Reason:\n"
129:                                            + "the specified object is null and the field is\n"
130:                                            + "an instance field.");
131:                            System.err.println("The exception was:" + ne);
132:                            ne.printStackTrace();
133:                        } catch (ExceptionInInitializerError ei) {
134:                            System.err
135:                                    .println("keypattern: setting of field failed. Reason:\n"
136:                                            + "the initialization provoked by this method fails.");
137:                            System.err.println("The exception was:" + ei);
138:                            ei.printStackTrace();
139:                        }
140:
141:                    }
142:                } else {
143:                    this clone = this ;
144:                }
145:
146:                return this clone.prepare1();
147:            }
148:
149:            /* because we change the semantics of the original prepare method, we introduce this simulation method
150:               to invoke the prepare method in the super class */
151:            public final void super PrepareSimu() {
152:                super .prepare();
153:            }
154:
155:            public boolean prepare1() {
156:                return true;
157:            }
158:
159:            public boolean canApply() {
160:                return this clone.canApply1();
161:            }
162:
163:            public boolean canApply1() {
164:                return true;
165:            }
166:
167:            public void apply() {
168:                this clone.apply1();
169:            }
170:
171:            public void apply1() {
172:            }
173:
174:            public final void super ApplySimu() {
175:                super .apply();
176:            }
177:
178:            protected void finalize() throws Throwable {
179:                this clone.finalize1();
180:            }
181:
182:            protected void finalize1() throws Throwable {
183:            }
184:
185:            protected void super FinalizeSimu() throws Throwable {
186:                super .finalize();
187:            }
188:
189:            // reloads the class-definition of the this-object
190:            // and returns a new instance of it.
191:            private KeyPattern reloadClassDef() {
192:                String this ClassName = this .getClass().getName();
193:                //	IdeMessageManagerAccess.printMessage(IdeMessageType.INFORMATION,"Name der nachgeladenen Klasse: "+thisClassName+"\n");
194:                KeyPattern pattern = null;
195:                try {
196:                    KeyDebugClassLoader classLoader = new KeyDebugClassLoader();
197:                    // Because of the explicit cast later KeyScript must not be 
198:                    // reloaded by KeyDebugClassLoader (otherwise we get an cast-error)
199:                    classLoader.setClassAlwaysAskParent(KeyPattern.class);
200:                    Class cl = classLoader.loadClass(this ClassName);
201:                    pattern = (KeyPattern) cl.newInstance();
202:                } catch (ExceptionInInitializerError ei) {
203:                    System.err
204:                            .println("keypattern: the initialization provoked "
205:                                    + "by this method fails.");
206:                    System.err.println("The exception was: " + ei);
207:                    ei.printStackTrace();
208:                } catch (IllegalAccessException iae) {
209:                    System.err.println("keypattern: class or "
210:                            + "initializer is not accessible.");
211:                    System.err.println("The exception was: " + iae);
212:                    iae.printStackTrace();
213:                } catch (InstantiationException ie) {
214:                    System.err
215:                            .println("keypattern: class tried to\n"
216:                                    + "instantiate represents an abstract class, an interface,"
217:                                    + "an array class, a primitive type, or void; or if the"
218:                                    + "instantiation fails for some other reason.");
219:                    System.err.println("The exception was: " + ie);
220:                    ie.printStackTrace();
221:                } catch (SecurityException se) {
222:                    System.err.println("keypattern: no permission to create"
223:                            + "a new instance");
224:                    System.err.println("The exception was: " + se);
225:                    se.printStackTrace();
226:                }
227:                return pattern;
228:            }
229:        }
ww___w_._j___a__v___a_2__s___.co___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.