Alignment with new JMI interfaces (PFD2), few bugfixes, new MDR classloader (bugfix to issue #20473)
1.1 --- a/mdr/build.xml Mon May 20 14:26:22 2002 +0000
1.2 +++ b/mdr/build.xml Mon May 20 16:34:24 2002 +0000
1.3 @@ -19,13 +19,17 @@
1.4 <property name="binroot" location="../../nbextra"/>
1.5 <property name="storepass" value="?"/>
1.6 <property name="build.compiler.debug" value="true"/>
1.7 + <property name="homepage.base" value="netbeans.org"/>
1.8 + <property name="dist.base" value="www.netbeans.org/download/nbms/40/MDR"/>
1.9
1.10 <taskdef name="makenbm" classname="org.netbeans.nbbuild.MakeNBM" classpath="${nbext}/nbantext.jar"/>
1.11 <taskdef name="genlist" classname="org.netbeans.nbbuild.MakeListOfNBM" classpath="${nbext}/nbantext.jar"/>
1.12 <taskdef name="locjar" classname="org.netbeans.nbbuild.LocalizedJar" classpath="${nbext}/nbantext.jar"/>
1.13
1.14 <target name="init">
1.15 - <tstamp/>
1.16 + <tstamp>
1.17 + <format property="buildnumber" pattern="yyyyMMddHHmm"/>
1.18 + </tstamp>
1.19 <property name="buildnumber" value="${DSTAMP}-${TSTAMP}"/>
1.20 <echo message="buildnumber = ${buildnumber}"/>
1.21 </target>
1.22 @@ -274,6 +278,7 @@
1.23 <license file="${nbroot}/nbbuild/standard-nbm-license.txt"/>
1.24 <signature keystore="${keystore}" storepass="${storepass}" alias="${nbm_alias}"/>
1.25 <exclude name="netbeans/modules/mdrtoolkit.jar"/>
1.26 + <exclude name="netbeans/modules/mdrexplorer.jar"/>
1.27 <exclude name="netbeans/modules/autoload/"/>
1.28 </makenbm>
1.29 </target>
1.30 @@ -325,6 +330,17 @@
1.31 </makenbm>
1.32 </target>
1.33
1.34 + <target name="apichanges-check" description="Check syntax of API changes list. Requires Ant 1.4!">
1.35 + <xmlvalidate file="api/doc/changes/apichanges.xml" failonerror="true"/>
1.36 + </target>
1.37 + <target name="apichanges" description="Regenerate HTML from XML API changes list." depends="apichanges-check">
1.38 + <!-- Ant 1.3 and 1.4 disagree on style attribute. -->
1.39 + <!-- 1.3: treated as a name relative to XML file. -->
1.40 + <!-- 1.4: treated as a filename consistent with normal Ant usage. -->
1.41 + <!-- Be safe and give the absolute path here. -->
1.42 + <style in="api/doc/changes/apichanges.xml" out="www/apichanges.html" destdir="www" style="api/doc/changes/apichanges.xsl"/>
1.43 + </target>
1.44 +
1.45 <!-- todo: better javadoc -->
1.46 <target name="javadoc">
1.47 <mkdir dir="javadoc"/>
2.1 --- a/mdr/samples/xml/build.xml Mon May 20 14:26:22 2002 +0000
2.2 +++ b/mdr/samples/xml/build.xml Mon May 20 16:34:24 2002 +0000
2.3 @@ -24,6 +24,14 @@
2.4
2.5 <property name="binroot" location="../../../../nbextra"/>
2.6
2.7 + <target name="init">
2.8 + <tstamp>
2.9 + <format property="buildnumber" pattern="yyyyMMddHHmm"/>
2.10 + </tstamp>
2.11 + <property name="buildnumber" value="${DSTAMP}-${TSTAMP}"/>
2.12 + <echo message="buildnumber = ${buildnumber}"/>
2.13 + </target>
2.14 +
2.15 <target name="compile">
2.16 <javac srcdir="api" destdir="api" deprecation="${build.compiler.deprecation}" debug="${build.compiler.debug}">
2.17 <classpath>
2.18 @@ -48,7 +56,7 @@
2.19 </javac>
2.20 </target>
2.21
2.22 - <target name="jars" depends="compile">
2.23 + <target name="jars" depends="init,compile">
2.24 <mkdir dir="netbeans/modules/autoload"/>
2.25 <filter token="BUILD_NUMBER_SUBST" value="${buildnumber}"/>
2.26
2.27 @@ -83,12 +91,16 @@
2.28 </copy>
2.29 <makenbm file="mdrxmlapi.nbm"
2.30 topdir="api-nbm-tmp"
2.31 + homepage="http://mdr.${homepage.base}/"
2.32 + distribution="http://${dist.base}/mdrxmlapi.nbm"
2.33 module="netbeans/modules/autoload/mdrxmlapi.jar">
2.34 <exclude name="netbeans/modules/mdrxml.jar"/>
2.35 </makenbm>
2.36
2.37 <makenbm file="mdrxml.nbm"
2.38 topdir="."
2.39 + homepage="http://mdr.${homepage.base}/"
2.40 + distribution="http://${dist.base}/mdrxml.nbm"
2.41 module="netbeans/modules/mdrxml.jar">
2.42 <exclude name="netbeans/modules/autoload/"/>
2.43 </makenbm>
3.1 --- a/mdr/samples/xml/manifest-api.mf Mon May 20 14:26:22 2002 +0000
3.2 +++ b/mdr/samples/xml/manifest-api.mf Mon May 20 16:34:24 2002 +0000
3.3 @@ -1,6 +1,9 @@
3.4 Manifest-Version: 1.0
3.5 -OpenIDE-Module-Specification-Version: 0.9
3.6 +OpenIDE-Module-Specification-Version: 0.93
3.7 OpenIDE-Module: org.netbeans.jmi.xmlmodel/1
3.8 -OpenIDE-Module-Display-Category: Tools
3.9 +OpenIDE-Module-Display-Category: MDR
3.10 OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
3.11 OpenIDE-Module-Module-Dependencies: javax.jmi.reflect/1
3.12 +OpenIDE-Module-Name: XML Metamodel API
3.13 +OpenIDE-Module-Short-Description: Generated JMI API for sample metamodel of XML.
3.14 +OpenIDE-Module-Long-Description: Generated JMI API for sample metamodel of XML.
4.1 --- a/mdr/samples/xml/manifest.mf Mon May 20 14:26:22 2002 +0000
4.2 +++ b/mdr/samples/xml/manifest.mf Mon May 20 16:34:24 2002 +0000
4.3 @@ -1,13 +1,13 @@
4.4 OpenIDE-Module: org.netbeans.modules.mdrxml/1
4.5 -OpenIDE-Module-Name: MDR XML Module
4.6 -OpenIDE-Module-Display-Category: Tools
4.7 +OpenIDE-Module-Name: Sample MDR XML Module
4.8 +OpenIDE-Module-Display-Category: MDR
4.9 OpenIDE-Module-Install: org/netbeans/modules/mdrxml/MDRXMLModule.class
4.10 OpenIDE-Module-IDE-Dependencies: IDE/1 > 1.10
4.11 OpenIDE-Module-Module-Dependencies: org.netbeans.api.mdr/1, org.netbeans.modules.looks/1, org.netbeans.jmi.xmlmodel/1, org.netbeans.modules.xml.core/1, org.openidex.util/2
4.12 -OpenIDE-Module-Specification-Version: 0.5
4.13 +OpenIDE-Module-Specification-Version: 0.51
4.14 OpenIDE-Module-Implementation-Version: @BUILD_NUMBER_SUBST@
4.15 OpenIDE-Module-Short-Description: Adds support for XML into MDR.
4.16 -OpenIDE-Module-Long-Description: parsing XML documents into MDR and generation of XML documents from metadata stored in MDR.
4.17 +OpenIDE-Module-Long-Description: Parsing XML documents into MDR and generation of XML documents from metadata stored in MDR.
4.18 OpenIDE-Module-Layer: org/netbeans/modules/mdrxml/resources/mdrxml-layer.xml
4.19
4.20 Name: org/netbeans/modules/mdrxml/FillRepositoryAction.class
5.1 --- a/mdr/samples/xml/model/xml.mdl Mon May 20 14:26:22 2002 +0000
5.2 +++ b/mdr/samples/xml/model/xml.mdl Mon May 20 16:34:24 2002 +0000
5.3 @@ -7,7 +7,7 @@
5.4 (object Design "Logical View"
5.5 is_unit TRUE
5.6 is_loaded TRUE
5.7 - quid "3C8CEB0E010F"
5.8 + quid "3CE90F670086"
5.9 defaults (object defaults
5.10 rightMargin 0.250000
5.11 leftMargin 0.250000
5.12 @@ -53,7 +53,7 @@
5.13 subsystem "Component View"
5.14 quidu "3C8140F10313"
5.15 logical_models (list unit_reference_list
5.16 - (object Class_Category "XMLModel"
5.17 + (object Class_Category "X M L Model"
5.18 quid "3C8141250000"
5.19 stereotype "metamodel"
5.20 exportControl "Public"
5.21 @@ -63,14 +63,14 @@
5.22 superclasses (list inheritance_relationship_list
5.23 (object Inheritance_Relationship
5.24 quid "3C8141AC03D0"
5.25 - supplier "Logical View::XMLModel::Node"
5.26 + supplier "Logical View::X M L Model::Node"
5.27 quidu "3C81479D03AF")))
5.28 (object Class "AttributeNode"
5.29 quid "3C8141740393"
5.30 superclasses (list inheritance_relationship_list
5.31 (object Inheritance_Relationship
5.32 quid "3C8141B1003E"
5.33 - supplier "Logical View::XMLModel::Node"
5.34 + supplier "Logical View::X M L Model::Node"
5.35 quidu "3C81479D03AF"))
5.36 class_attributes (list class_attribute_list
5.37 (object ClassAttribute "value"
5.38 @@ -90,7 +90,7 @@
5.39 superclasses (list inheritance_relationship_list
5.40 (object Inheritance_Relationship
5.41 quid "3C8149BB00BF"
5.42 - supplier "Logical View::XMLModel::ElementNode"
5.43 + supplier "Logical View::X M L Model::ElementNode"
5.44 quidu "3C81416F031E"))
5.45 class_attributes (list class_attribute_list
5.46 (object ClassAttribute "documentName"
5.47 @@ -110,7 +110,7 @@
5.48 superclasses (list inheritance_relationship_list
5.49 (object Inheritance_Relationship
5.50 quid "3C82590F015E"
5.51 - supplier "Logical View::XMLModel::ElementNode"
5.52 + supplier "Logical View::X M L Model::ElementNode"
5.53 quidu "3C81416F031E")))
5.54 (object Association "Contains"
5.55 quid "3C8141E60199"
5.56 @@ -118,7 +118,7 @@
5.57 (object Role "nodes"
5.58 quid "3C8141E80282"
5.59 label "nodes"
5.60 - supplier "Logical View::XMLModel::Node"
5.61 + supplier "Logical View::X M L Model::Node"
5.62 quidu "3C81479D03AF"
5.63 client_cardinality (value cardinality "0..n")
5.64 Constraints "ordered"
5.65 @@ -126,7 +126,7 @@
5.66 (object Role "parentNode"
5.67 quid "3C8141E8028C"
5.68 label "parentNode"
5.69 - supplier "Logical View::XMLModel::ElementNode"
5.70 + supplier "Logical View::X M L Model::ElementNode"
5.71 quidu "3C81416F031E"
5.72 client_cardinality (value cardinality "0..1")
5.73 is_navigable TRUE
5.74 @@ -141,7 +141,7 @@
5.75 origin_x 0
5.76 origin_y 0
5.77 items (list diagram_item_list
5.78 - (object ClassView "Class" "Logical View::XMLModel::AttributeNode" @1
5.79 + (object ClassView "Class" "Logical View::X M L Model::AttributeNode" @1
5.80 ShowCompartmentStereotypes TRUE
5.81 SuppressOperation TRUE
5.82 IncludeAttribute TRUE
5.83 @@ -158,10 +158,10 @@
5.84 default_color TRUE)
5.85 label (object ItemLabel
5.86 Parent_View @1
5.87 - location (1332, 541)
5.88 + location (1333, 541)
5.89 fill_color 13434879
5.90 nlines 1
5.91 - max_width 280
5.92 + max_width 278
5.93 justify 0
5.94 label "AttributeNode")
5.95 icon_style "Icon"
5.96 @@ -170,7 +170,7 @@
5.97 quidu "3C8141740393"
5.98 compartment (object Compartment
5.99 Parent_View @1
5.100 - location (1332, 597)
5.101 + location (1333, 597)
5.102 font (object Font
5.103 size 10
5.104 face "Arial"
5.105 @@ -184,12 +184,12 @@
5.106 fill_color 13434879
5.107 anchor 2
5.108 nlines 1
5.109 - max_width 293)
5.110 - width 298
5.111 + max_width 275)
5.112 + width 296
5.113 height 124
5.114 annotation 8
5.115 autoResize TRUE)
5.116 - (object ClassView "Class" "Logical View::XMLModel::Node" @2
5.117 + (object ClassView "Class" "Logical View::X M L Model::Node" @2
5.118 ShowCompartmentStereotypes TRUE
5.119 SuppressOperation TRUE
5.120 IncludeAttribute TRUE
5.121 @@ -232,20 +232,20 @@
5.122 fill_color 13434879
5.123 anchor 2
5.124 nlines 1
5.125 - max_width 303)
5.126 + max_width 271)
5.127 width 292
5.128 height 124
5.129 annotation 8
5.130 autoResize TRUE)
5.131 (object InheritTreeView "" @3
5.132 - location (1072, 273)
5.133 + location (1072, 264)
5.134 line_color 3342489
5.135 fill_color 13434879
5.136 supplier @2
5.137 vertices (list Points
5.138 - (1072, 273)
5.139 + (1072, 264)
5.140 (1072, 174)))
5.141 - (object ClassView "Class" "Logical View::XMLModel::ElementNode" @4
5.142 + (object ClassView "Class" "Logical View::X M L Model::ElementNode" @4
5.143 ShowCompartmentStereotypes TRUE
5.144 SuppressAttribute TRUE
5.145 SuppressOperation TRUE
5.146 @@ -263,21 +263,22 @@
5.147 default_color TRUE)
5.148 label (object ItemLabel
5.149 Parent_View @4
5.150 - location (735, 496)
5.151 + location (678, 519)
5.152 fill_color 13434879
5.153 - nlines 2
5.154 - max_width 162
5.155 + nlines 1
5.156 + max_width 276
5.157 justify 0
5.158 label "ElementNode")
5.159 icon_style "Icon"
5.160 line_color 3342489
5.161 fill_color 13434879
5.162 quidu "3C81416F031E"
5.163 - height 150
5.164 + width 294
5.165 + height 105
5.166 annotation 8
5.167 autoResize TRUE)
5.168 (object AssociationViewNew "Contains" @5
5.169 - location (528, 228)
5.170 + location (528, 220)
5.171 font (object Font
5.172 size 10
5.173 face "Arial"
5.174 @@ -289,7 +290,7 @@
5.175 default_color TRUE)
5.176 label (object SegLabel @6
5.177 Parent_View @5
5.178 - location (605, 301)
5.179 + location (605, 293)
5.180 font (object Font
5.181 size 10
5.182 face "Arial"
5.183 @@ -314,7 +315,7 @@
5.184 roleview_list (list RoleViews
5.185 (object RoleView "nodes" @7
5.186 Parent_View @5
5.187 - location (-208, -460)
5.188 + location (-208, -468)
5.189 font (object Font
5.190 size 10
5.191 face "Arial"
5.192 @@ -326,7 +327,7 @@
5.193 default_color TRUE)
5.194 label (object SegLabel @8
5.195 Parent_View @7
5.196 - location (836, 89)
5.197 + location (837, 89)
5.198 font (object Font
5.199 size 10
5.200 face "Arial"
5.201 @@ -339,7 +340,7 @@
5.202 anchor 1
5.203 anchor_loc 1
5.204 nlines 1
5.205 - max_width 136
5.206 + max_width 179
5.207 justify 0
5.208 label "+nodes"
5.209 pctDist 0.815647
5.210 @@ -351,7 +352,7 @@
5.211 client @5
5.212 supplier @2
5.213 vertices (list Points
5.214 - (528, 228)
5.215 + (528, 220)
5.216 (528, 160)
5.217 (925, 124))
5.218 line_style 0
5.219 @@ -378,7 +379,7 @@
5.220 orientation 1)
5.221 label (object SegLabel @10
5.222 Parent_View @7
5.223 - location (852, 199)
5.224 + location (853, 199)
5.225 font (object Font
5.226 size 10
5.227 face "Arial"
5.228 @@ -399,7 +400,7 @@
5.229 orientation 1))
5.230 (object RoleView "parentNode" @11
5.231 Parent_View @5
5.232 - location (-208, -460)
5.233 + location (-208, -468)
5.234 font (object Font
5.235 size 10
5.236 face "Arial"
5.237 @@ -411,7 +412,7 @@
5.238 default_color TRUE)
5.239 label (object SegLabel @12
5.240 Parent_View @11
5.241 - location (647, 446)
5.242 + location (601, 436)
5.243 font (object Font
5.244 size 10
5.245 face "Arial"
5.246 @@ -424,7 +425,7 @@
5.247 anchor 1
5.248 anchor_loc 1
5.249 nlines 1
5.250 - max_width 237
5.251 + max_width 300
5.252 justify 0
5.253 label "+parentNode"
5.254 pctDist 0.796375
5.255 @@ -436,13 +437,13 @@
5.256 client @5
5.257 supplier @4
5.258 vertices (list Points
5.259 - (528, 228)
5.260 + (528, 220)
5.261 (528, 493)
5.262 - (725, 537))
5.263 + (668, 524))
5.264 line_style 0
5.265 label (object SegLabel @13
5.266 Parent_View @11
5.267 - location (630, 544)
5.268 + location (545, 525)
5.269 font (object Font
5.270 size 10
5.271 face "Arial"
5.272 @@ -469,7 +470,7 @@
5.273 supplier @2
5.274 line_style 3
5.275 origin_attachment (1513, 529)
5.276 - terminal_attachment (1513, 273)
5.277 + terminal_attachment (1513, 264)
5.278 drawSupplier @3)
5.279 (object InheritView "" @15
5.280 stereotype TRUE
5.281 @@ -478,10 +479,10 @@
5.282 client @4
5.283 supplier @2
5.284 line_style 3
5.285 - origin_attachment (819, 485)
5.286 - terminal_attachment (819, 273)
5.287 + origin_attachment (819, 508)
5.288 + terminal_attachment (819, 264)
5.289 drawSupplier @3)
5.290 - (object ClassView "Class" "Logical View::XMLModel::RootNode" @16
5.291 + (object ClassView "Class" "Logical View::X M L Model::RootNode" @16
5.292 ShowCompartmentStereotypes TRUE
5.293 SuppressOperation TRUE
5.294 IncludeAttribute TRUE
5.295 @@ -524,12 +525,12 @@
5.296 fill_color 13434879
5.297 anchor 2
5.298 nlines 1
5.299 - max_width 487)
5.300 + max_width 445)
5.301 width 466
5.302 height 124
5.303 annotation 8
5.304 autoResize TRUE)
5.305 - (object ClassView "Class" "Logical View::XMLModel::TextNode" @17
5.306 + (object ClassView "Class" "Logical View::X M L Model::TextNode" @17
5.307 ShowCompartmentStereotypes TRUE
5.308 SuppressAttribute TRUE
5.309 SuppressOperation TRUE
5.310 @@ -547,28 +548,28 @@
5.311 default_color TRUE)
5.312 label (object ItemLabel
5.313 Parent_View @17
5.314 - location (587, 808)
5.315 + location (588, 807)
5.316 fill_color 13434879
5.317 nlines 1
5.318 - max_width 202
5.319 + max_width 200
5.320 justify 0
5.321 label "TextNode")
5.322 icon_style "Icon"
5.323 line_color 3342489
5.324 fill_color 13434879
5.325 quidu "3C8258F80238"
5.326 - width 220
5.327 - height 103
5.328 + width 218
5.329 + height 105
5.330 annotation 8
5.331 autoResize TRUE)
5.332 (object InheritTreeView "" @18
5.333 - location (816, 725)
5.334 + location (816, 702)
5.335 line_color 3342489
5.336 fill_color 13434879
5.337 supplier @4
5.338 vertices (list Points
5.339 - (816, 725)
5.340 - (816, 635)))
5.341 + (816, 702)
5.342 + (816, 612)))
5.343 (object InheritView "" @19
5.344 stereotype TRUE
5.345 line_color 3342489
5.346 @@ -577,7 +578,7 @@
5.347 supplier @4
5.348 line_style 3
5.349 origin_attachment (1140, 786)
5.350 - terminal_attachment (1140, 725)
5.351 + terminal_attachment (1140, 702)
5.352 drawSupplier @18)
5.353 (object InheritView "" @20
5.354 stereotype TRUE
5.355 @@ -586,8 +587,8 @@
5.356 client @17
5.357 supplier @4
5.358 line_style 3
5.359 - origin_attachment (688, 797)
5.360 - terminal_attachment (688, 725)
5.361 + origin_attachment (688, 796)
5.362 + terminal_attachment (688, 702)
5.363 drawSupplier @18))))))
5.364 logical_presentations (list unit_reference_list
5.365 (object ClassDiagram "Main"
6.1 --- a/mdr/src/org/netbeans/mdr/NBMDRepositoryImpl.java Mon May 20 14:26:22 2002 +0000
6.2 +++ b/mdr/src/org/netbeans/mdr/NBMDRepositoryImpl.java Mon May 20 16:34:24 2002 +0000
6.3 @@ -296,6 +296,8 @@
6.4 installFakeMof();
6.5 installPureMof();
6.6 fail = false;
6.7 + } catch (Throwable e) {
6.8 + e.printStackTrace();
6.9 } finally {
6.10 mdrStorage.setBooting(false);
6.11 endTrans(fail);
7.1 --- a/mdr/src/org/netbeans/mdr/handlers/BaseObjectHandler.java Mon May 20 14:26:22 2002 +0000
7.2 +++ b/mdr/src/org/netbeans/mdr/handlers/BaseObjectHandler.java Mon May 20 16:34:24 2002 +0000
7.3 @@ -39,7 +39,8 @@
7.4 private static final Map facilityCache = new FacilityCache();
7.5 private static final Hashtable classCache = new Hashtable();
7.6
7.7 - private static ClassLoader defaultLoader = null;
7.8 + private static MDRClassLoader defaultLoader = null;
7.9 + private static ClassLoaderProvider provider = null;
7.10
7.11 /** The object in strorage to delegate to
7.12 */
7.13 @@ -67,7 +68,7 @@
7.14 return mdrStorage.getRepository();
7.15 }
7.16
7.17 - private static Class getHandlerClass(ClassLoader loader, Class ifc, StorableBaseObject s) throws IllegalArgumentException {
7.18 + private static Class getHandlerClass(MDRClassLoader loader, Class ifc, StorableBaseObject s) throws IllegalArgumentException {
7.19 check(loader, ifc);
7.20 Map cache = getLoaderCache(loader);
7.21 String className = getName(ifc);
7.22 @@ -85,7 +86,7 @@
7.23 e.printStackTrace();
7.24 }
7.25 */
7.26 - result = defineClass(loader, className, handlerClassFile);
7.27 + result = loader.defineClass(className, handlerClassFile);
7.28 } finally {
7.29 releaseCache(cache, result, className);
7.30 }
7.31 @@ -156,7 +157,7 @@
7.32 return null;
7.33 }
7.34
7.35 - ClassLoader loader = getDefaultClassLoader();
7.36 + MDRClassLoader loader = getDefaultClassLoader();
7.37 Class cl = getHandlerClass(loader, ifc, s);
7.38
7.39 try {
7.40 @@ -187,13 +188,13 @@
7.41 }
7.42 }
7.43
7.44 - public static synchronized void setDefaultClassLoader(ClassLoader loader) {
7.45 - defaultLoader = loader;
7.46 + public static synchronized void setClassLoaderProvider(ClassLoaderProvider provider) {
7.47 + BaseObjectHandler.provider = provider;
7.48 }
7.49
7.50 - public static synchronized ClassLoader getDefaultClassLoader() {
7.51 + public static synchronized MDRClassLoader getDefaultClassLoader() {
7.52 if (defaultLoader == null) {
7.53 - defaultLoader = BaseObjectHandler.class.getClassLoader();
7.54 + defaultLoader = new MDRClassLoader(provider);
7.55 }
7.56 // System.out.println(defaultLoader.toString() + " : " + defaultLoader.getClass().getName());
7.57 return defaultLoader;
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/mdr/src/org/netbeans/mdr/handlers/ClassLoaderProvider.java Mon May 20 16:34:24 2002 +0000
8.3 @@ -0,0 +1,15 @@
8.4 +/*
8.5 + * ClassLoaderProvider.java
8.6 + *
8.7 + * Created on May 18, 2002, 2:15 PM
8.8 + */
8.9 +
8.10 +package org.netbeans.mdr.handlers;
8.11 +
8.12 +/**
8.13 + *
8.14 + * @author mm109185
8.15 + */
8.16 +public interface ClassLoaderProvider {
8.17 + public ClassLoader getClassLoader();
8.18 +}
9.1 --- a/mdr/src/org/netbeans/mdr/handlers/ClassProxyHandler.java Mon May 20 14:26:22 2002 +0000
9.2 +++ b/mdr/src/org/netbeans/mdr/handlers/ClassProxyHandler.java Mon May 20 16:34:24 2002 +0000
9.3 @@ -147,7 +147,7 @@
9.4 }
9.5 }
9.6
9.7 - public final RefEnum refCreateEnum(String enumName, java.lang.String name) {
9.8 + public final RefEnum refGetEnum(String enumName, java.lang.String name) {
9.9 boolean fail = true;
9.10 Object extraInfo = null;
9.11 RefEnum result = null;
9.12 @@ -161,8 +161,8 @@
9.13 }
9.14 }
9.15
9.16 - public final RefEnum refCreateEnum(RefObject enum, String name) {
9.17 - return refCreateEnum(((EnumerationType) enum).getName(), name);
9.18 + public final RefEnum refGetEnum(RefObject enum, String name) {
9.19 + return refGetEnum(((EnumerationType) enum).getName(), name);
9.20 }
9.21
9.22 public final RefStruct refCreateStruct(String structName, java.util.List params) {
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/mdr/src/org/netbeans/mdr/handlers/MDRClassLoader.java Mon May 20 16:34:24 2002 +0000
10.3 @@ -0,0 +1,150 @@
10.4 +/*
10.5 + * MDRClassLoader.java
10.6 + *
10.7 + * Created on May 16, 2002, 10:30 AM
10.8 + */
10.9 +
10.10 +package org.netbeans.mdr.handlers;
10.11 +
10.12 +import java.util.HashMap;
10.13 +import java.net.URL;
10.14 +import java.util.Enumeration;
10.15 +import java.io.IOException;
10.16 +import java.util.Map;
10.17 +
10.18 +/**
10.19 + *
10.20 + * @author mm109185
10.21 + */
10.22 +class MDRClassLoader extends ClassLoader {
10.23 + private final ClassLoaderProvider provider;
10.24 + private Delegator parent;
10.25 +
10.26 + private final HashMap packages = new HashMap();
10.27 +
10.28 + /** Creates a new instance of MDRClassLoader */
10.29 + MDRClassLoader(ClassLoaderProvider provider) {
10.30 + super();
10.31 + this.provider = provider;
10.32 + }
10.33 +
10.34 + private Delegator getDelegator() {
10.35 + if (parent == null) {
10.36 + parent = new Delegator(provider);
10.37 + }
10.38 + return (parent = parent.getDelegator());
10.39 + }
10.40 +
10.41 + protected Class defineClass(String className, byte[] classFile) throws ClassFormatError {
10.42 + int i = className.lastIndexOf('.');
10.43 + String pkgName = className.substring(0, i);
10.44 + Package pkg = getPackage(pkgName);
10.45 + if (pkg == null) {
10.46 + definePackage(pkgName, null, null, null, null, null, null, null);
10.47 + }
10.48 +
10.49 + return defineClass(className, classFile, 0, classFile.length);
10.50 + }
10.51 +
10.52 + protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
10.53 + Class c = findLoadedClass(name);
10.54 + if (c == null) {
10.55 + try {
10.56 + c = getDelegator().accessibleLoadClass(name, false);
10.57 + } catch (ClassNotFoundException e) {
10.58 + // this will always throw exception in this implementation
10.59 + // (all the classes should be loaded by calling defineClass directly)
10.60 + c = findClass(name);
10.61 + }
10.62 + }
10.63 + if (resolve) {
10.64 + resolveClass(c);
10.65 + }
10.66 + return c;
10.67 + }
10.68 +
10.69 + public URL getResource(String name) {
10.70 + URL url;
10.71 + url = getDelegator().getResource(name);
10.72 + if (url == null) {
10.73 + // will always return null in this implementation
10.74 + url = findResource(name);
10.75 + }
10.76 + return url;
10.77 + }
10.78 +
10.79 + protected Enumeration findResources(String name) throws IOException {
10.80 + Enumeration[] tmp = new Enumeration[2];
10.81 + return getDelegator().getResources(name);
10.82 + }
10.83 +
10.84 + protected Package getPackage(String name) {
10.85 + synchronized (packages) {
10.86 + Package pkg = (Package) packages.get(name);
10.87 + if (pkg == null) {
10.88 + pkg = getDelegator().accessibleGetPackage(name);
10.89 + if (pkg != null) {
10.90 + packages.put(name, pkg);
10.91 + }
10.92 + }
10.93 + return pkg;
10.94 + }
10.95 + }
10.96 +
10.97 + protected Package[] getPackages() {
10.98 + Map map;
10.99 + synchronized (packages) {
10.100 + map = (Map) packages.clone();
10.101 + }
10.102 + Package[] pkgs;
10.103 + pkgs = getDelegator().accessibleGetPackages();
10.104 + if (pkgs != null) {
10.105 + for (int i = 0; i < pkgs.length; i++) {
10.106 + String pkgName = pkgs[i].getName();
10.107 + if (map.get(pkgName) == null) {
10.108 + map.put(pkgName, pkgs[i]);
10.109 + }
10.110 + }
10.111 + }
10.112 + return (Package[]) map.values().toArray(new Package[map.size()]);
10.113 + }
10.114 +
10.115 + protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException {
10.116 + synchronized (packages) {
10.117 + Package pkg = getPackage(name);
10.118 + if (pkg != null) {
10.119 + throw new IllegalArgumentException(name);
10.120 + }
10.121 + pkg = super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase);
10.122 + packages.put(name, pkg);
10.123 + return pkg;
10.124 + }
10.125 + }
10.126 +
10.127 + private static class Delegator extends ClassLoader {
10.128 + private final ClassLoaderProvider provider;
10.129 + private final ClassLoader parent;
10.130 +
10.131 + Delegator(ClassLoaderProvider provider) {
10.132 + super(provider == null ? Delegator.class.getClassLoader() : provider.getClassLoader());
10.133 + this.parent = (provider == null ? Delegator.class.getClassLoader() : provider.getClassLoader());
10.134 + this.provider = provider;
10.135 + }
10.136 +
10.137 + Delegator getDelegator() {
10.138 + return ((provider == null || provider.getClassLoader() == parent) ? this : new Delegator(provider));
10.139 + }
10.140 +
10.141 + Class accessibleLoadClass(String name, boolean param) throws ClassNotFoundException {
10.142 + return this.loadClass(name, param);
10.143 + }
10.144 +
10.145 + Package accessibleGetPackage(String name) {
10.146 + return this.getPackage(name);
10.147 + }
10.148 +
10.149 + Package[] accessibleGetPackages() {
10.150 + return this.getPackages();
10.151 + }
10.152 + }
10.153 +}
11.1 --- a/mdr/src/org/netbeans/mdr/handlers/PackageProxyHandler.java Mon May 20 14:26:22 2002 +0000
11.2 +++ b/mdr/src/org/netbeans/mdr/handlers/PackageProxyHandler.java Mon May 20 16:34:24 2002 +0000
11.3 @@ -243,7 +243,7 @@
11.4 return refClass(((MofClass) type).getName());
11.5 }
11.6
11.7 - public final RefEnum refCreateEnum(String enumName, java.lang.String name) {
11.8 + public final RefEnum refGetEnum(String enumName, java.lang.String name) {
11.9 boolean fail = true;
11.10 Object extraInfo = null;
11.11 RefEnum result = null;
11.12 @@ -257,8 +257,8 @@
11.13 }
11.14 }
11.15
11.16 - public final RefEnum refCreateEnum(RefObject enum, String name) {
11.17 - return refCreateEnum(((EnumerationType) enum).getName(), name);
11.18 + public final RefEnum refGetEnum(RefObject enum, String name) {
11.19 + return refGetEnum(((EnumerationType) enum).getName(), name);
11.20 }
11.21
11.22 public final RefStruct refCreateStruct(String structName, java.util.List params) {
12.1 --- a/mdr/src/org/netbeans/mdr/handlers/StructImpl.java Mon May 20 14:26:22 2002 +0000
12.2 +++ b/mdr/src/org/netbeans/mdr/handlers/StructImpl.java Mon May 20 16:34:24 2002 +0000
12.3 @@ -33,7 +33,7 @@
12.4 // fully qualified name of metaobject
12.5 private final List qualifiedName;
12.6
12.7 - private static Class getStructClass(ClassLoader loader, Class ifc) throws IllegalArgumentException {
12.8 + private static Class getStructClass(MDRClassLoader loader, Class ifc) throws IllegalArgumentException {
12.9 check(loader, ifc);
12.10 Map cache = getLoaderCache(loader);
12.11 String className = getName(ifc);
12.12 @@ -42,7 +42,7 @@
12.13 if (result == null) {
12.14 try {
12.15 byte[] structClassFile = StructGenerator.generateStruct(className, ifc);
12.16 - result = defineClass(loader, className, structClassFile);
12.17 + result = loader.defineClass(className, structClassFile);
12.18 } finally {
12.19 releaseCache(cache, result, className);
12.20 }
12.21 @@ -66,7 +66,7 @@
12.22 }
12.23
12.24 public static RefStruct newInstance(Class ifc, List fields, Map values, List qualifiedName) {
12.25 - ClassLoader loader = BaseObjectHandler.getDefaultClassLoader();
12.26 + MDRClassLoader loader = BaseObjectHandler.getDefaultClassLoader();
12.27 Class cl = getStructClass(loader, ifc);
12.28
12.29 try {
13.1 --- a/mdr/src/org/netbeans/mdr/handlers/gen/AssociationGenerator.java Mon May 20 14:26:22 2002 +0000
13.2 +++ b/mdr/src/org/netbeans/mdr/handlers/gen/AssociationGenerator.java Mon May 20 16:34:24 2002 +0000
13.3 @@ -138,7 +138,11 @@
13.4 } else if ((param = dispatchEndMethods.get(methodName)) != null) {
13.5 return getDispatchEndMethod(method, (HashMap) param);
13.6 } else if ((param = dispatchMethods.get(methodName)) != null) {
13.7 - return getDispatchMethod(method, (Method) param);
13.8 + if (param instanceof Method) {
13.9 + return getDispatchMethod(method, (Method) param);
13.10 + } else {
13.11 + return getDummyMethod(method);
13.12 + }
13.13 }
13.14
13.15 return super.getClassMethod(method, fromClass);
13.16 @@ -173,6 +177,10 @@
13.17 private DispatchEndMethod getDispatchEndMethod(Method method, HashMap ends) {
13.18 return new DispatchEndMethod(method, ends);
13.19 }
13.20 +
13.21 + private DummyMethod getDummyMethod(Method method) {
13.22 + return new DummyMethod(method);
13.23 + }
13.24
13.25 private class DispatchEndMethod extends ClassMethod {
13.26 private final HashMap ends;
13.27 @@ -250,6 +258,45 @@
13.28 }
13.29 }
13.30
13.31 + private class DummyMethod extends ClassMethod {
13.32 + private DummyMethod(Method method) {
13.33 + super(method, (short) 0, null);
13.34 + }
13.35 +
13.36 + /**
13.37 + * Return a MethodInfo object for this method, including generating
13.38 + * the code.
13.39 + */
13.40 + public MethodInfo generateMethod() throws IOException {
13.41 + String desc = getMethodDescriptor(parameterTypes, returnType);
13.42 + MethodInfo minfo = new MethodInfo(methodName, desc, ACC_PUBLIC | ACC_FINAL);
13.43 +
13.44 + int[] parameterSlot = new int[parameterTypes.length];
13.45 + int nextSlot = 1;
13.46 + for (int i = 0; i < parameterSlot.length; i++) {
13.47 + parameterSlot[i] = nextSlot;
13.48 + nextSlot += getWordsPerType(parameterTypes[i]);
13.49 + }
13.50 + int localSlot0 = nextSlot;
13.51 +
13.52 + DataOutputStream out = new DataOutputStream(minfo.code);
13.53 +
13.54 + // if the field was not found, throw an exception
13.55 + out.writeByte(opc_new); // new
13.56 + out.writeShort(cp.getClass("org/netbeans/mdr/util/DebugException")); // javax.jmi.reflect.JmiException
13.57 + out.writeByte(opc_dup); // dup
13.58 + out.writeByte(opc_invokespecial);
13.59 + out.writeShort(cp.getMethodRef("org/netbeans/mdr/util/DebugException", "<init>", "()V"));
13.60 + out.writeByte(opc_athrow);
13.61 +
13.62 + minfo.maxStack = 10;
13.63 + minfo.maxLocals = (short) (localSlot0 + 2);
13.64 + minfo.declaredExceptions = new short[0];
13.65 +
13.66 + return minfo;
13.67 + }
13.68 + }
13.69 +
13.70 private class DispatchMethod extends ClassMethod {
13.71 private final Method delegate;
13.72 private final String ifcName;
14.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AttrCollection.java Mon May 20 14:26:22 2002 +0000
14.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AttrCollection.java Mon May 20 16:34:24 2002 +0000
14.3 @@ -100,7 +100,7 @@
14.4 public void write(OutputStream stream) throws IOException {
14.5 IOUtils.writeInt(stream, inner.size());
14.6 for (Iterator it = inner.iterator(); it.hasNext();) {
14.7 - IOUtils.write(stream, it.next());
14.8 + IOUtils.write(stream, it.next(), mdrObject.getMdrStorage());
14.9 }
14.10 IOUtils.writeInt(stream, attrIndex);
14.11 }
14.12 @@ -204,7 +204,7 @@
14.13
14.14 protected void checkType(Object obj) {
14.15 if (!type.isInstance(obj)) {
14.16 - throw new TypeMismatchException(type, obj, getMetaElement());
14.17 + throw new TypeMismatchException(type, obj, getMetaElement(), "Expected type: " + type + ", supplied type: " + obj.getClass().getName());
14.18 }
14.19 }
14.20
15.1 --- a/mdr/src/org/netbeans/mdr/storagemodel/AttrImmutList.java Mon May 20 14:26:22 2002 +0000
15.2 +++ b/mdr/src/org/netbeans/mdr/storagemodel/AttrImmutList.java Mon May 20 16:34:24 2002 +0000
15.3 @@ -86,18 +86,18 @@
15.4 }
15.5 }
15.6
15.7 - public void read(InputStream stream) throws IOException {
15.8 + public void read(InputStream stream, StorableBaseObject storable) throws IOException {
15.9 int size = IOUtils.readInt(stream);
15.10 data = new Object[size];
15.11 for (int i = 0; i < size; i++) {
15.12 - data[i] = IOUtils.read(stream);
15.13 + data[i] = IOUtils.read(stream, storable);
15.14 }
15.15 }
15.16
15.17 - public void write(OutputStream stream) throws IOException {
15.18 + public void write(OutputStream stream, MdrStorage storage) throws IOException {
15.19 IOUtils.writeInt(stream, data.length);
15.20 for (int i = 0; i < data.length; i++) {
15.21 - IOUtils.write(stream, data[i]);
15.22 + IOUtils.write(stream, data[i], storage);
15.23 }
15.24 }
15.25 }
16.1 --- a/mdr/src/org/netbeans/mdr/util/IOUtils.java Mon May 20 14:26:22 2002 +0000
16.2 +++ b/mdr/src/org/netbeans/mdr/util/IOUtils.java Mon May 20 16:34:24 2002 +0000
16.3 @@ -179,13 +179,13 @@
16.4 ((AttrCollection) object).write(outputStream);
16.5
16.6 } else if (object instanceof AttrImmutList) {
16.7 -// Thread.dumpStack();
16.8 + if (storage == null) Thread.dumpStack();
16.9 if (object instanceof AttrImmutUList) {
16.10 outputStream.write(T_LIST_U_IMMUTABLE);
16.11 } else {
16.12 outputStream.write(T_LIST_IMMUTABLE);
16.13 }
16.14 - ((AttrImmutList) object).write(outputStream);
16.15 + ((AttrImmutList) object).write(outputStream, storage);
16.16
16.17 } else if (object instanceof Collection) {
16.18 outputStream.write(T_COLLECTION);
16.19 @@ -359,13 +359,14 @@
16.20 return result;
16.21 } case T_LIST_IMMUTABLE:
16.22 case T_LIST_U_IMMUTABLE: {
16.23 + if (storable == null) Thread.dumpStack();
16.24 AttrImmutList result;
16.25 if (type == T_LIST_IMMUTABLE) {
16.26 result = new AttrImmutList();
16.27 } else {
16.28 result = new AttrImmutUList();
16.29 }
16.30 - result.read(inputStream);
16.31 + result.read(inputStream, storable);
16.32 return result;
16.33 } case T_LIST_MUTABLE:
16.34 case T_LIST_U_MUTABLE:
17.1 --- a/mdr/src/org/netbeans/mdr/util/ImplClass.java Mon May 20 14:26:22 2002 +0000
17.2 +++ b/mdr/src/org/netbeans/mdr/util/ImplClass.java Mon May 20 16:34:24 2002 +0000
17.3 @@ -114,16 +114,16 @@
17.4 }
17.5 }
17.6
17.7 - protected static Class defineClass(ClassLoader loader, String proxyName, byte[] b) throws IllegalArgumentException {
17.8 - try {
17.9 - Method method = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] {String.class, byte[].class, Integer.TYPE, Integer.TYPE, ProtectionDomain.class});
17.10 - method.setAccessible(true);
17.11 - return (Class) method.invoke(loader, new Object[] {proxyName, b, new Integer(0), new Integer(b.length), pd});
17.12 - } catch (ClassFormatError e) {
17.13 - throw new IllegalArgumentException();
17.14 - } catch (Exception e) {
17.15 - e.printStackTrace();
17.16 - throw new DebugException();
17.17 - }
17.18 - }
17.19 +// protected static Class defineClass(ClassLoader loader, String proxyName, byte[] b) throws IllegalArgumentException {
17.20 +// try {
17.21 +// Method method = ClassLoader.class.getDeclaredMethod("defineClass", new Class[] {String.class, byte[].class, Integer.TYPE, Integer.TYPE, ProtectionDomain.class});
17.22 +// method.setAccessible(true);
17.23 +// return (Class) method.invoke(loader, new Object[] {proxyName, b, new Integer(0), new Integer(b.length), pd});
17.24 +// } catch (ClassFormatError e) {
17.25 +// throw new IllegalArgumentException();
17.26 +// } catch (Exception e) {
17.27 +// e.printStackTrace();
17.28 +// throw new DebugException();
17.29 +// }
17.30 +// }
17.31 }
18.1 --- a/mdr/src/org/netbeans/mdr/util/TransactionMutex.java Mon May 20 14:26:22 2002 +0000
18.2 +++ b/mdr/src/org/netbeans/mdr/util/TransactionMutex.java Mon May 20 16:34:24 2002 +0000
18.3 @@ -97,11 +97,12 @@
18.4 if (this.fail) {
18.5 notifier.fireCancelled();
18.6 storage.rollback();
18.7 + Thread.dumpStack();
18.8 System.out.println("rolled back!");
18.9 } else {
18.10 notifier.fireChanged();
18.11 storage.commit();
18.12 - System.out.println("commited");
18.13 + //System.out.println("commited");
18.14 }
18.15 } catch (StorageException e) {
18.16 try {