Add OSGI functionality to JSS, minor fixes to invoke, engage #1" reader#410
Add OSGI functionality to JSS, minor fixes to invoke, engage #1" reader#410alanruttenberg wants to merge 6 commits intoarmedbear:masterfrom
Conversation
Other minor fixes in invoke.lisp Engage the armedbear#1".." reader, which allows java expressions e.g. armedbear#1"System.out.printLn("foo")"
easye
left a comment
There was a problem hiding this comment.
-
What is being fixed in invoke.lisp? Do you have a small test that demonstrates a before and after?
-
Can you provide an example of an OSGI bundle that I can test?
…ind-java-class and lookup-class-name that I missed in the earlier merge
|
To test OSGI grab https://github.com/alanruttenberg/lsw2/blob/owlapiv4/owl2/lib/uk.ac.manchester.cs.owl.factplusplus-1.6.5.jar and put it in the same directory as the following sysdef (defpackage :asdf/owl2libs (:use :asdf :cl))
(in-package :asdf/owl2libs)
(require 'asdf-mvn-module)
(defun open-osgi-for-lsw ()
(loop for wedge in '("org.osgi.framework.system.packages.extra" "org.osgi.framework.bootdelegation")
do (jss::add-to-comma-separated-osgi-config
wedge
'("com.google.common.collect" "com.google.common.collect.*"
"gnu.trove" "gnu.trove.*" "javax.swing" "javax.swing.*"
"javax.xml.datatype" "javax.xml.datatype.*" "org.apache.log4j" "org.apache.log4j.*"
"org.semanticweb.owlapi.model" "org.semanticweb.owlapi.model.*"
"org.semanticweb.owlapi.reasoner" "org.semanticweb.owlapi.reasoner.*"
"org.semanticweb.owlapi.reasoner.impl" "org.semanticweb.owlapi.reasoner.impl.*"
"org.semanticweb.owlapi.reasoner.knowledgeexploration" "org.semanticweb.owlapi.reasoner.knowledgeexploration.*"
"org.semanticweb.owlapi.util" "org.semanticweb.owlapi.util.*"
"org.semanticweb.owlapi.vocab" "org.semanticweb.owlapi.vocab.*"))))
(defvar cl-user::*before-osgi-starting-hooks* nil)
(pushnew 'open-osgi-for-lsw cl-user::*before-osgi-starting-hooks*)
(asdf:defsystem test
:components
((:mvn-module maven
:dependencies
("javax.xml.bind:jaxb-api:LATEST"
"net.sourceforge.owlapi/owlapi-distribution/4.2.6"
"net.sourceforge.owlapi/owlexplanation/2.0.0"
)
:managed-dependencies
("org.slf4j/slf4j-api/1.7.21"
"org.apache.httpcomponents:httpcore:4.4.5"
"org.apache.httpcomponents:httpclient:4.5"
"net.sourceforge.owlapi:owlapi-distribution:4.2.6")
:exclusions
("net.sourceforge.owlapi:owlapi-osgidistribution"
"edu.stanford.protege:org.protege.editor.owl"
"org.jgrapht:jgrapht-jdk1.5:0.7.3"
))
(:bundle "uk.ac.manchester.cs.owl.factplusplus-1.6.5"))
:serial t
)Load the system and then (jss::find-java-class "uk.ac.manchester.cs.factplusplus.FaCTPlusPlusException")Return value should be the following, a class defined in the bundle. Other tests coming... |
|
maybe-resolve-class-against-imports - add ability to look up bundle classes invoke line 181: object-as-class wasn't used. Could probably drop object-as-class-name in the "or" read-invoke: Try (let ((thread (threads::current-thread))) #1"thread.javaThread.getState().toString()") lookup-class-name: add ability to look up bundle classes shortest-unambiguous-java-class-abbreviation: new function, helper japropos: add ability to find bundle classes jclass-method-names: if "class" argument is instead an object then the methods for the class of the object are returned. |
|
I'm having problems with the way this patch defines the OSGI hook function. Once I load things under SLIME, I can't restart my session getting errors I think it is rather improper abstraction to have the osgi.lisp code in the ABCL-ASDF add code JSS package. And I don't like the use of the hook symbol defined in CL-USER, and imported into JSS. I'll do some hacking to see if I can get things in the places I want them. |
|
See #412 for my preferred approach to adding OSGI. |
…jar and asdj-osgi-bundle to avoid re-adding bundle and always thinking the asdf operation succeeded.
…fer the class over the class name so that the right classloader is used. For the bundle, don't inherit the compile-op method which was adding the bundle jar to the classpath too, which confused find-java-class. Verified to work in java 11
Engage the #1".." reader, which allows java expressions e.g. #1"System.out.printLn("foo")"
Code was already there but needed a couple of lines in read-invoke that check for #1 and load javaparser.
I'm updating to your master. These were the remaining changes in my version that you don't have.