Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Story Points:
      3
    • Sprint:
      Summer 2 2023 May 29, Summer 3 2023 June 12, Summer 4 2023 June 26

      Description

      Situation: This ticket is part of a series of tutorials on OSGI.

      Task: Read and complete this tutorial: https://medium.com/javarevisited/learn-osgi-from-scratch-eclipse-intellij-and-wso2-platform-%EF%B8%8F-bf4c5629e097

      Document how useful this tutorial was and any useful information from the tutorial in the Jira comments below.

        Attachments

          Issue Links

            Activity

            Hide
            ann.loraine Ann Loraine added a comment -

            Summarizing the findings thus far:

            • karaf has many commands that help with detecting and solving errors, such as "import" and "export", which list packages being exported from or imported into various bundles
            • unix commands such as "grep" and "wc -l" are supported, making debugging faster and easier
            • the framework does not appear to contain service component infrastructure needed by this project
            Show
            ann.loraine Ann Loraine added a comment - Summarizing the findings thus far: karaf has many commands that help with detecting and solving errors, such as "import" and "export", which list packages being exported from or imported into various bundles unix commands such as "grep" and "wc -l" are supported, making debugging faster and easier the framework does not appear to contain service component infrastructure needed by this project
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            In the previous comment, I said "the framework does not appear to contain service component infrastructure needed by this project."

            This seems very strange!

            I found a Web page on karaf that mentioned some useful commands, include "feature:list".

            There are 174 "features" listed! One of these is "scr", with Description "Declarative Service support." Its current "State" is "Uninstalled."

            Maybe, if I somehow "install" this feature, I would not need to install the "org.osgi:org.osgi.service.component" bundle from my local "mvn" repository?

            So, I tried to install it with:

            karaf@root()> feature:install scr
            

            After this, the "scr" feature State changed to "Started."

            Show
            ann.loraine Ann Loraine added a comment - - edited In the previous comment, I said "the framework does not appear to contain service component infrastructure needed by this project." This seems very strange! I found a Web page on karaf that mentioned some useful commands, include "feature:list". There are 174 "features" listed! One of these is "scr", with Description "Declarative Service support." Its current "State" is "Uninstalled." Maybe, if I somehow "install" this feature, I would not need to install the "org.osgi:org.osgi.service.component" bundle from my local "mvn" repository? So, I tried to install it with: karaf@root()> feature:install scr After this, the "scr" feature State changed to "Started."
            Hide
            ann.loraine Ann Loraine added a comment -

            I then uninstalled the previously installed bundles. Freshly attempting to re-install and re-start bundle org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT succeeded without any error.

            I then quit and restarted karaf with a fresh, clean environment with "karaf clean".
            I confirmed that the "scr" feature was not active. I then activated it as before with "feature:install scr" and then tried to load the "provider" bundle.

            This time, it loaded without any error.

            Thus, karaf actually does contain support declarative services. You just have to install that feature within the framework to activate it, I guess.

            Show
            ann.loraine Ann Loraine added a comment - I then uninstalled the previously installed bundles. Freshly attempting to re-install and re-start bundle org.wso2.carbon/org.wso2.carbon.book.provider/1.0-SNAPSHOT succeeded without any error. I then quit and restarted karaf with a fresh, clean environment with "karaf clean". I confirmed that the "scr" feature was not active. I then activated it as before with "feature:install scr" and then tried to load the "provider" bundle. This time, it loaded without any error. Thus, karaf actually does contain support declarative services. You just have to install that feature within the framework to activate it, I guess.
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            Trying now to figure out which version of declarative services / scr is used in this tutorial.

            I was able to build it using JDK 11 and run it in the latest version (4.3.9) of karaf, also running in JDK 11. This suggests that maybe the most up-to-date system for declarative services is being used?

            Upon consultation with Nowlan Freese, we realized that the only way to be truly sure about this is to look at the package import statements in the code.

            Investigating the code:

            package org.wso2.carbon.book.provider.internal;
            
            import org.osgi.framework.BundleContext;
            import org.osgi.service.component.ComponentContext;
            import org.osgi.service.component.annotations.Activate;
            import org.osgi.service.component.annotations.Component;
            import org.osgi.service.component.annotations.Deactivate;
            import org.wso2.carbon.book.provider.BookProvider;
            import org.wso2.carbon.book.provider.BookProviderImpl;
            
            import java.util.logging.Logger;
            
            @Component(
                    name = "org.wso2.carbon.book.provider",
                    immediate = true
            )
            
            Show
            ann.loraine Ann Loraine added a comment - - edited Trying now to figure out which version of declarative services / scr is used in this tutorial. I was able to build it using JDK 11 and run it in the latest version (4.3.9) of karaf, also running in JDK 11. This suggests that maybe the most up-to-date system for declarative services is being used? Upon consultation with Nowlan Freese , we realized that the only way to be truly sure about this is to look at the package import statements in the code. Investigating the code: package org.wso2.carbon.book.provider.internal; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; import org.wso2.carbon.book.provider.BookProvider; import org.wso2.carbon.book.provider.BookProviderImpl; import java.util.logging.Logger; @Component( name = "org.wso2.carbon.book.provider" , immediate = true )
            Hide
            ann.loraine Ann Loraine added a comment - - edited

            Now, looking at Component imports in an IGB project (master branch, jdk 1.8 build):

            • ./core/igb-services-api/src/main/java/org/lorainelab/igb/services/search/SearchModeRegistry.java

            imports and Component annotation:

            import aQute.bnd.annotation.component.Component;
            import aQute.bnd.annotation.component.Reference;
            ...
            @Component(name = SearchModeRegistry.COMPONENT_NAME, immediate = true, provide = SearchModeRegistry.class)
            

            Our project (IGB) does not appear to be using felix scr but instead is using something perhaps even older - annotations from package aQute.bnd.annotation.component.

            Show
            ann.loraine Ann Loraine added a comment - - edited Now, looking at Component imports in an IGB project (master branch, jdk 1.8 build): ./core/igb-services-api/src/main/java/org/lorainelab/igb/services/search/SearchModeRegistry.java imports and Component annotation: import aQute.bnd.annotation.component.Component; import aQute.bnd.annotation.component.Reference; ... @Component(name = SearchModeRegistry.COMPONENT_NAME, immediate = true , provide = SearchModeRegistry.class) Our project (IGB) does not appear to be using felix scr but instead is using something perhaps even older - annotations from package aQute.bnd.annotation.component.

              People

              • Assignee:
                kgopu Kaushik Gopu
                Reporter:
                nfreese Nowlan Freese
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: