{"id":4840,"date":"2014-03-30T15:53:42","date_gmt":"2014-03-30T15:53:42","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/platform-independent-osgi-console-collection-of-common-programming-errors\/"},"modified":"2014-03-30T15:53:42","modified_gmt":"2014-03-30T15:53:42","slug":"platform-independent-osgi-console-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/platform-independent-osgi-console-collection-of-common-programming-errors\/","title":{"rendered":"platform independent OSGi console-Collection of common programming errors"},"content":{"rendered":"<p>Yes, of course it is possible to administer OSGi in a platform-independent way. It all depends on how much of the administration you are ready to implement yourself.<\/p>\n<p>The OSGi APIs give you access to everything, you only need to design\/choose your shell, format of the commands etc.<\/p>\n<p>Do you want a command prompt based one, a web-based one or a remote management protocol to be used with some backend management server?<\/p>\n<p>1) Let&#8217;s start with the functionality. Your shell will be implemented as a bundle itself. You can use the BundleContext of this bundle to get access to the other bundle objects. Through them you can:<\/p>\n<ul>\n<li>install, start, stop, update bundles:<\/li>\n<\/ul>\n<p><code>BundleContext.installBundle(String)<\/code> &#8211; Installs a bundle from the specified location string (which should be a URL).<\/p>\n<pre><code>BundleContext.getBundles( )\nBundle.start()\nBundle.update( InputStream input )\n<\/code><\/pre>\n<ul>\n<li>\n<p>Inspect bundles, bundle versions, exported\/imported packages, registered services<\/p>\n<\/li>\n<li>\n<p>From the OSGi service registry you can get the ConfigurationAdmin service, through which you can list the configurations of bundles, and change them<\/p>\n<\/li>\n<li>\n<p>From the registry you can also get the LogService, to read the logs<\/p>\n<\/li>\n<li>\n<p>From the StartLevel service you can control the order of starting of the bundles when the fw is started<\/p>\n<\/li>\n<\/ul>\n<p>etc etc<\/p>\n<p>2) How do you want to make the above info accessible? If you want a command-based console, you can write one, using the system output. You can check this implementation for ideas<\/p>\n<p>If you want a web-based one, the easiest way to remain platform-independent is to write a standard servlet and register it in the standard OSGi HTTP service. The relevant web pages will then call the functions above.<\/p>\n<p>If you want a remote management protocol, you can map to many different possibilities. Check for example the OSGi DMT service, which maps to the OMA DM spec, which maps easily to the TR-069 management protocol. There are existing implementations.<\/p>\n<p>All this is completely independent from Felix, Equinox etc and will work on any of them, as well as any other OSGi fw.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, of course it is possible to administer OSGi in a platform-independent way. It all depends on how much of the administration you are ready to implement yourself. The OSGi APIs give you access to everything, you only need to design\/choose your shell, format of the commands etc. Do you want a command prompt based [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4840","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4840"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4840\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}