Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10243/verifier class loader #872

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions doc-bridgepoint/notes/10243_verifier_class_loader_int.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
= Verifier class loader enhancements

xtUML Project Implementation Note

== 1 Abstract

This work resolves some of the problems/pain related to working with realized
implementations interfacing with verifier.

== 2 Introduction and Background

Verifier has the ability to interface with hand-written Java code. It achieves
this by dynamically loading the `.class` files for the realized implementations
at runtime. Naming and path conventions are in place to determine the fully
qualified class names. If external libraries are used, the classpath must be
specified in a modeled attribute attached to the realized model element
(Component or External Entity). This mechanism is not ideal becuase it requires
the user to hard-code paths related to realized Java code in the model data
itself. It is also quite finicky and difficult to use. The work simplifies the
BridgePoint implementation by delegating the responsibility of managing Java
dependencies to the Java build path maintiatined in the JDT project properties.

== 3 Requirements

=== 3.1 Verifier shall search for realized Java class definitions using the build path configured in the Java project

=== 3.2 The attributes for encoding classpath elements in the model data shall be deprecated

== 4 Work Required

. Remove `BPClassLoader` -- it is not needed.
. Update `Vm_c` to create instances of `URLClassLoader` based on the elements of the Java `.classpath` file.
. Remove `VM::addUserClassPath` and `VM::setUserClassPath` and all references to these bridges.

== 6 Acceptance Test

The changes were tested in a project which contained a combination of code
contained in the project itself and third party libraries.

== 7 User Documentation

The "Model Verifier Java Interface" page of the documentation has been updated
to reflect the changes.

== 9 Document References

. [[dr-1]] https://support.onefact.net/issues/10243[Verifier class loader enhancements]

---

This work is licensed under the Creative Commons CC0 License

---
Original file line number Diff line number Diff line change
Expand Up @@ -3767,8 +3767,9 @@ INSERT INTO O_ATTR
"2786d973-1537-44a1-81d6-3ddbd2377865",
"759ed624-58ea-4eac-a5fb-e1144a55f799",
'Realized_Class_Path',
'Full Name: Realized Component Path
Description: Specifies where Verifier will look for a realized executable resource.',
'This mechanism is deprecated. Verifier will use the classpath specified as part of the Java project.

User_Visible:false',
'',
'Realized_Class_Path',
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Bridge:GD',
1,
'',
"aa5f57f9-4d45-42dd-8108-588f212c1226",
0,
0);
INSERT INTO O_TFR
VALUES ("051a8ae5-d474-4e10-925f-daa19ec88254",
Expand All @@ -35,6 +36,7 @@ Bridge:GD',
1,
'',
"64b117b8-bb50-4b4a-8653-a6f9645f158c",
0,
0);
INSERT INTO S_DT_PROXY
VALUES ("6e636321-0fd1-4577-b185-e4d76b0d0c71",
Expand Down Expand Up @@ -133,6 +135,7 @@ return result;',
1,
'',
"47b4912e-6356-420d-882b-4bc83d06ac61",
0,
0);
INSERT INTO O_TPARM
VALUES ("f358dea6-8a65-4aa3-a329-d50098bdb805",
Expand Down Expand Up @@ -193,6 +196,7 @@ end if;',
1,
'',
"11fbbd9d-cfa9-48da-b85c-2f81a943df32",
0,
0);
INSERT INTO O_TPARM
VALUES ("85f75223-c956-4ebd-82dd-62edc46cfeea",
Expand All @@ -216,6 +220,7 @@ Bridge:GD',
1,
'',
"051a8ae5-d474-4e10-925f-daa19ec88254",
0,
0);
INSERT INTO O_TPARM
VALUES ("d0e37499-e63f-43b8-a2a2-5d5fc6bf12fc",
Expand Down Expand Up @@ -266,6 +271,7 @@ self.Key_Lett = OS::remove_spaces(s:name);',
1,
'',
"3bb8b8cb-581e-4676-99d9-29a0408f7f18",
0,
0);
INSERT INTO O_TFR
VALUES ("7ab78ccd-467f-4207-8ce6-479cc648f5d8",
Expand Down Expand Up @@ -321,6 +327,7 @@ delete object instance self;',
1,
'',
"ac08f70f-08b8-4f6a-b394-0dd6be1c6193",
0,
0);
INSERT INTO O_TFR
VALUES ("c6099bc7-cf40-4dc0-9253-e53ad114ffc3",
Expand All @@ -336,6 +343,7 @@ brg.initialize();',
1,
'',
"929d523b-5c18-41c9-9be4-ed1574afab27",
0,
0);
INSERT INTO O_TFR
VALUES ("64b117b8-bb50-4b4a-8653-a6f9645f158c",
Expand All @@ -350,6 +358,7 @@ Bridge:GD',
1,
'',
"456c447e-08b7-4c37-92cf-949e7b12173f",
0,
0);
INSERT INTO O_TFR
VALUES ("47b4912e-6356-420d-882b-4bc83d06ac61",
Expand All @@ -373,6 +382,7 @@ return result;',
1,
'',
"7ab78ccd-467f-4207-8ce6-479cc648f5d8",
0,
0);
INSERT INTO O_TFR
VALUES ("ac08f70f-08b8-4f6a-b394-0dd6be1c6193",
Expand All @@ -389,6 +399,7 @@ return this;',
0,
'',
"00000000-0000-0000-0000-000000000000",
0,
0);
INSERT INTO S_DT_PROXY
VALUES ("bc3722c8-5188-4529-8519-cf9eb9816b17",
Expand Down Expand Up @@ -419,6 +430,7 @@ INSERT INTO O_TFR
1,
'',
"c6099bc7-cf40-4dc0-9253-e53ad114ffc3",
0,
0);
INSERT INTO O_TFR
VALUES ("45c44bb8-b208-4224-9c8c-8a7beba6d6d6",
Expand All @@ -442,6 +454,7 @@ return GD::NULL_UNIQUE_ID();
1,
'',
"cd8830d0-53a6-4fcc-81a0-e5bbdcef7e33",
0,
0);
INSERT INTO O_TFR
VALUES ("5b99f4e3-05b2-4f5c-9671-aeff98f8aba3",
Expand All @@ -465,6 +478,7 @@ end if;',
1,
'',
"45c44bb8-b208-4224-9c8c-8a7beba6d6d6",
0,
0);
INSERT INTO O_TPARM
VALUES ("f6a596c6-c76f-4808-9cb9-e3f29c6e6e67",
Expand Down Expand Up @@ -503,6 +517,7 @@ end for;
1,
'',
"5b99f4e3-05b2-4f5c-9671-aeff98f8aba3",
0,
0);
INSERT INTO O_TFR
VALUES ("d5225d5c-eae8-4b61-a84e-ef9fdab20ad8",
Expand All @@ -515,6 +530,7 @@ INSERT INTO O_TFR
1,
'',
"b04655fc-86af-476d-ae98-a620d244abd9",
0,
0);
INSERT INTO O_TFR
VALUES ("8594e84c-e38e-4fe3-92a3-5086d9f00e2f",
Expand All @@ -531,6 +547,7 @@ self.Name = param.new_name;
1,
'',
"d5225d5c-eae8-4b61-a84e-ef9fdab20ad8",
0,
0);
INSERT INTO O_TPARM
VALUES ("445b753e-062c-4426-b043-8d8cec84adc1",
Expand Down Expand Up @@ -661,7 +678,9 @@ INSERT INTO O_ATTR
"a361b553-b2e3-46ea-a8f4-8b8633921011",
"91ff0c2d-e5b3-4da0-a245-56cbfed9e24c",
'Realized_Class_Path',
'Full Name: Realized External Entity Path',
'This mechanism is deprecated. Verifier will use the classpath specified as part of the Java project.

User_Visible:false',
'',
'Realized_Class_Path',
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3739,26 +3739,6 @@ INSERT INTO S_BPARM
'',
"00000000-0000-0000-0000-000000000000",
'');
INSERT INTO S_BRG
VALUES ("10f871d1-7bfd-4d67-a020-56ae1f5bc7ed",
"78c0d209-aae1-4a81-a2d1-e5876d473deb",
'setUserClassPath',
'',
0,
"ba5eda7a-def5-0000-0000-000000000000",
'',
0,
'',
0);
INSERT INTO S_BPARM
VALUES ("271c8756-460a-463f-b4d4-ed51bd8b043c",
"10f871d1-7bfd-4d67-a020-56ae1f5bc7ed",
'System_ID',
"ba5eda7a-def5-0000-0000-000000000005",
0,
'',
"00000000-0000-0000-0000-000000000000",
'');
INSERT INTO S_BRG
VALUES ("7eb4a3dc-8734-4d1f-b313-f5efbf869357",
"78c0d209-aae1-4a81-a2d1-e5876d473deb",
Expand All @@ -3770,35 +3750,6 @@ INSERT INTO S_BRG
0,
'',
0);
INSERT INTO S_BRG
VALUES ("59d05ddd-caeb-4856-8ea1-dfc69adc1727",
"78c0d209-aae1-4a81-a2d1-e5876d473deb",
'addUserClassPath',
'',
0,
"ba5eda7a-def5-0000-0000-000000000000",
'',
0,
'',
0);
INSERT INTO S_BPARM
VALUES ("e0507dda-d697-48ac-a171-c963f0ce31f3",
"59d05ddd-caeb-4856-8ea1-dfc69adc1727",
'System_ID',
"ba5eda7a-def5-0000-0000-000000000005",
0,
'',
"00000000-0000-0000-0000-000000000000",
'');
INSERT INTO S_BPARM
VALUES ("980119b3-5a39-4ee9-9014-2755233b879b",
"59d05ddd-caeb-4856-8ea1-dfc69adc1727",
'path',
"ba5eda7a-def5-0000-0000-000000000004",
0,
'',
"e0507dda-d697-48ac-a171-c963f0ce31f3",
'');
INSERT INTO PE_PE
VALUES ("78c0d209-aae1-4a81-a2d1-e5876d473deb",
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ delete object instance self;
1,
'',
"00000000-0000-0000-0000-000000000000",
0,
0);
INSERT INTO O_TFR
VALUES ("d124d99d-eaca-4c48-92c7-64fee4aad3e3",
Expand Down Expand Up @@ -113,12 +114,6 @@ else
end if;

VM::resetValues();
// Look for a user class that matches the EE name
if(ee.Realized_Class_Path != "")
VM::addUserClassPath(System_ID:sys.Sys_ID, path:ee.Realized_Class_Path);
else
VM::setUserClassPath(System_ID:sys.Sys_ID);
end if;
loadedClass = VM::loadClass(system_id:sys.Sys_ID, name:ee.Key_Lett);
if ( loadedClass )
// Find the first parameter in the ordered relationship. Use the ordered
Expand Down Expand Up @@ -193,6 +188,7 @@ end if;
1,
'',
"730927e7-9e9c-450f-84f7-821fb603831c",
0,
0);
INSERT INTO O_TPARM
VALUES ("163b0786-09af-48f0-85e7-9019e74e4400",
Expand Down Expand Up @@ -318,6 +314,7 @@ return true;',
1,
'',
"d124d99d-eaca-4c48-92c7-64fee4aad3e3",
0,
0);
INSERT INTO O_TPARM
VALUES ("ddd8bde2-7d87-41bb-9048-713ada684c79",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ delete object instance self;
1,
'',
"00000000-0000-0000-0000-000000000000",
0,
0);
INSERT INTO O_TFR
VALUES ("cdfab58d-383c-4bb4-9487-4fef53a559c7",
Expand Down Expand Up @@ -123,12 +124,6 @@ else
end if;

VM::resetValues();
// Look for a user class that matches the EE name
if(ee.Realized_Class_Path != "")
VM::addUserClassPath(System_ID:sys.Sys_ID, path:ee.Realized_Class_Path);
else
VM::setUserClassPath(System_ID:sys.Sys_ID);
end if;
loadedClass = VM::loadClass(system_id:sys.Sys_ID, name:ee.Key_Lett);
if ( loadedClass )
// Find the first parameter in the ordered relationship. Use the ordered
Expand Down Expand Up @@ -210,6 +205,7 @@ end if;
1,
'',
"d2b47707-97d9-4858-96b6-43d55c1e4154",
0,
0);
INSERT INTO O_TPARM
VALUES ("c6ea4153-7c15-4edf-9557-90082ee7c706",
Expand Down Expand Up @@ -337,6 +333,7 @@ return true;',
1,
'',
"cdfab58d-383c-4bb4-9487-4fef53a559c7",
0,
0);
INSERT INTO O_TPARM
VALUES ("5b681b44-a4c0-46cd-8542-dd95703eb1dc",
Expand Down
Loading