<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">

    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
        <command name="osgi/bundle-level">
            <action class="org.apache.karaf.shell.osgi.BundleLevel"/>
        </command>
        <command name="osgi/headers">
            <action class="org.apache.karaf.shell.osgi.Headers"/>
        </command>
        <command name="osgi/classes">
            <action class="org.apache.karaf.shell.osgi.Classes"/>
        </command>
        <command name="osgi/find-class">
            <action class="org.apache.karaf.shell.osgi.FindClass"/>
        </command>
        <command name="osgi/info">
            <action class="org.apache.karaf.shell.osgi.Info"/>
        </command>
        <command name="osgi/install">
            <action class="org.apache.karaf.shell.osgi.InstallBundle"/>
        </command>
        <command name="osgi/list">
            <action class="org.apache.karaf.shell.osgi.ListBundles">
                <property name="bundleStateListenerFactories">
                    <list xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
                        <ref component-id="blueprintListener" />
                        <ref component-id="springListener" />
                    </list>
                </property>
            </action>
        </command>
        <command name="osgi/ls">
            <action class="org.apache.karaf.shell.osgi.ListServices"/>
        </command>
        <command name="osgi/bundle-services">
            <action class="org.apache.karaf.shell.osgi.ListBundleServices"/>
        </command>
        <command name="osgi/name">
            <action class="org.apache.karaf.shell.osgi.Name"/>
        </command>
        <command name="osgi/refresh">
            <action class="org.apache.karaf.shell.osgi.RefreshBundle"/>
        </command>
        <command name="osgi/update">
            <action class="org.apache.karaf.shell.osgi.UpdateBundle"/>
        </command>
        <command name="osgi/resolve">
            <action class="org.apache.karaf.shell.osgi.ResolveBundle"/>
        </command>
        <command name="osgi/restart">
            <action class="org.apache.karaf.shell.osgi.RestartBundle"/>
        </command>
        <command name="osgi/shutdown">
            <action class="org.apache.karaf.shell.osgi.Shutdown"/>
        </command>
        <command name="osgi/start">
            <action class="org.apache.karaf.shell.osgi.StartBundle"/>
        </command>
        <command name="osgi/start-level">
            <action class="org.apache.karaf.shell.osgi.StartLevel"/>
        </command>
        <command name="osgi/stop">
            <action class="org.apache.karaf.shell.osgi.StopBundle"/>
        </command>
        <command name="osgi/uninstall">
            <action class="org.apache.karaf.shell.osgi.UninstallBundle"/>
        </command>
        <command name="osgi/version">
            <action class="org.apache.karaf.shell.osgi.Version"/>
        </command>
    </command-bundle>

    <service auto-export="interfaces">
        <service-properties>
            <entry key="name" value="osgi"/>
            <entry key="description" value="Commands to manage the OSGi framework"/>
        </service-properties>
        <bean class="org.apache.karaf.shell.console.commands.BasicSubShell">
            <property name="name" value="osgi"/>
            <property name="description" value="Commands to manage the OSGi framework"/>
            <property name="detailedDescription" value="classpath:/org/apache/karaf/shell/osgi/osgi.txt"/>
        </bean>
    </service>

    <bean id="blueprintListener" class="org.apache.karaf.shell.osgi.BlueprintListener" />
    <service ref="blueprintListener" interface="org.osgi.service.blueprint.container.BlueprintListener" />

    <bean id="springListener" class="org.apache.karaf.shell.osgi.SpringStateListenerFactory" init-method="init" destroy-method="destroy">
        <property name="bundleContext" ref="blueprintBundleContext" />
    </bean>

</blueprint>
