[ 
https://issues.apache.org/jira/browse/KARAF-2807?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on KARAF-2807 started by Jean-Baptiste Onofré.

> Unable to have multiple subshells in one bundle
> -----------------------------------------------
>
>                 Key: KARAF-2807
>                 URL: https://issues.apache.org/jira/browse/KARAF-2807
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 3.0.0
>         Environment: JDK7, Aries Blueprint, karaf shell schema v1.1.0
>            Reporter: Rebecca Chan
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 3.0.1, 4.0.0
>
>         Attachments: fixSubshell.patch
>
>
> *PROBLEM:*
> According to Karaf 3.0.0 release note, Karaf "groups" the commands by scope. 
> Each scope form a subshell.  Users should be able to enter subshell directly 
> by typing the subshell name.  
> However, if commands with different scopes are packaged in one OSGI  bundle, 
> only the scope of the first command in the blueprint xml file will be 
> registered as subshell.
> For example, I have the following three commands in a OSGI bundle
> {quote}
> @Command(scope = "children", name = "boy", description = "boy's command")
> public class BoyCommand extends OsgiCommandSupport {
> }
> @Command(scope = "children", name = "girl", description = "girl's command")
> public class GirlCommand extends OsgiCommandSupport {
> }
> @Command(scope = "pet", name = "dog", description = "dog's command")
> public class DogCommand extends OsgiCommandSupport {
> }
> {quote}
> And they are in blueprint xml file.
> {quote}
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"; 
> default-activation="lazy">
>     <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0";>
>         <command>
>             <action class="com.test.BoyCommand" />
>         </command>
>         <command>
>             <action class="com.test.GirlCommand" /> 
>         </command>
>         <command>
>             <action class="com.test.DogCommand" /> 
>         </command>        
>     </command-bundle>
> </blueprint>        
> {quote}
> I can access children subshell directly by type "children" but I cannot acess 
> pet subshell by typing "pet"
> *SUGGESTION:*
> After looking into the source code of karaf 3.0.0, there is a bug around line 
> 188 in org.apache.karaf.shell.console.commands.NamespaceHandler.  If the 
> schema is not SHELL_NAMESPACE_1_0_0 or the action name does not contain the 
> scope name, the variable "scope" will be null and the subShellName will 
> always be ".subshell.null".  Therefore, if schema is not 1.0.0, only the 
> scope of the first defined command in the OSGI bundle will be registered as 
> subshell in the if statement.  
> A patch is attached.  Please review if it is a proper fix to the bug



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to