{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/803","labels_url":"https://api.github.com/repos/eclipse/smarthome/issues/803/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/smarthome/issues/803/comments","events_url":"https://api.github.com/repos/eclipse/smarthome/issues/803/events","html_url":"https://github.com/eclipse/smarthome/pull/803","id":124599085,"number":803,"title":"ScriptEngine: Expose ScriptEngine as OSGI-Bundle, ScriptExtension, GlobalScope optimization","user":{"login":"smerschjohann","id":11621401,"avatar_url":"https://avatars.githubusercontent.com/u/11621401?v=3","gravatar_id":"","url":"https://api.github.com/users/smerschjohann","html_url":"https://github.com/smerschjohann","followers_url":"https://api.github.com/users/smerschjohann/followers","following_url":"https://api.github.com/users/smerschjohann/following{/other_user}","gists_url":"https://api.github.com/users/smerschjohann/gists{/gist_id}","starred_url":"https://api.github.com/users/smerschjohann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smerschjohann/subscriptions","organizations_url":"https://api.github.com/users/smerschjohann/orgs","repos_url":"https://api.github.com/users/smerschjohann/repos","events_url":"https://api.github.com/users/smerschjohann/events{/privacy}","received_events_url":"https://api.github.com/users/smerschjohann/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/eclipse/smarthome/labels/Automation","name":"Automation","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-01-02T16:43:07Z","updated_at":"2016-01-23T23:04:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eclipse/smarthome/pulls/803","html_url":"https://github.com/eclipse/smarthome/pull/803","diff_url":"https://github.com/eclipse/smarthome/pull/803.diff","patch_url":"https://github.com/eclipse/smarthome/pull/803.patch"},"body":"This PR will allow other bundles to use and instantiate ScriptEngines.\r\n\r\nIt also contains a GlobalScope optimization, which is required to circumvent some OSGI related issues concerning the current implementation of class loading for the Nashorn-based solution. It will use \"variable = variable.static\" instead of \"variable = Java.type(...)\". In addition the Scope will be initialized only one time and injected as GLOBAL_SCOPE instead of ENGINE_SCOPE.\r\n\r\nFuthermore this PR introduces a ScriptExtensionProvider. This allows OSGI-Bundles to provide functionality which is not needed at all times. The given features can be requested from a script and are not imported in all ScriptEngine instances. It furthermore allows to keep track of the loaded instances based on a ScriptEngineId. If the ScriptEngine gets unloaded, the ScriptExtensionProvider will be notified about this and can unload or undo changes it has done to the runtime."},"comment":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/comments/174229152","html_url":"https://github.com/eclipse/smarthome/pull/803#issuecomment-174229152","issue_url":"https://api.github.com/repos/eclipse/smarthome/issues/803","id":174229152,"user":{"login":"smerschjohann","id":11621401,"avatar_url":"https://avatars.githubusercontent.com/u/11621401?v=3","gravatar_id":"","url":"https://api.github.com/users/smerschjohann","html_url":"https://github.com/smerschjohann","followers_url":"https://api.github.com/users/smerschjohann/followers","following_url":"https://api.github.com/users/smerschjohann/following{/other_user}","gists_url":"https://api.github.com/users/smerschjohann/gists{/gist_id}","starred_url":"https://api.github.com/users/smerschjohann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smerschjohann/subscriptions","organizations_url":"https://api.github.com/users/smerschjohann/orgs","repos_url":"https://api.github.com/users/smerschjohann/repos","events_url":"https://api.github.com/users/smerschjohann/events{/privacy}","received_events_url":"https://api.github.com/users/smerschjohann/received_events","type":"User","site_admin":false},"created_at":"2016-01-23T23:04:30Z","updated_at":"2016-01-23T23:04:30Z","body":"You can look into my code, as it is already present as PR. I cannot in yours, so it's up to you. I don't know what you've added and therefore what is missing in my PR. With the sum of my PRs you can write rules and modules in scripts, so I don't really see what is missing here, except the OSGI classloader addition you already mentioned. But of course, you can commit yours and link to your git-branch here.\r\n\r\nBut I think you are doing the effort a second time in a lot of places as these PRs already provide the scriptable automation feature with the JSR223 extension of openhab1 in mind. The Script-Extension support is a thing needed or at least beneficial for that. Also, my additions keep in mind that scripts can be loaded and unloaded which leads to rule/module removal etc. (a thing a script-extension can deal with) and allow scripts to be loaded from directory. It might be a better idea to tell me what is missing here or fork my branch and simply add what you think is missing. I will look into it then.\r\n\r\nNontheless, there might be areas that needs to be fixed in general as @kaikreuzer has not looked into this code until now."}}