<?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"
           default-activation="lazy">

    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
        <command name="admin/create">
            <action class="org.apache.karaf.admin.command.CreateCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <optional-completers>
                   <entry key="-f" value-ref="allFeatureCompleter"/>
                   <entry key="-furl" value-ref="featureUrlCompleter"/>
            </optional-completers>
        </command>
        <command name="admin/connect">
            <action class="org.apache.karaf.admin.command.ConnectCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null/>
            </completers>
        </command>
        <command name="admin/list">
            <action class="org.apache.karaf.admin.command.ListCommand">
                <property name="adminService" ref="adminService" />
            </action>
        </command>
        <command name="admin/start">
            <action class="org.apache.karaf.admin.command.StartCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null/>
            </completers>
        </command>
        <command name="admin/stop">
            <action class="org.apache.karaf.admin.command.StopCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null/>
            </completers>
        </command>
        <command name="admin/destroy">
            <action class="org.apache.karaf.admin.command.DestroyCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null/>
            </completers>
        </command>
        <command name="admin/rename">
            <action class="org.apache.karaf.admin.command.RenameCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null />
            </completers>
        </command>
        <command name="admin/clone">
            <action class="org.apache.karaf.admin.command.CloneCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null />
            </completers>
        </command>
        <command name="admin/change-ssh-port">
            <action class="org.apache.karaf.admin.command.ChangeSshPortCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null/>
            </completers>
        </command>
        <command name="admin/change-rmi-registry-port">
            <action class="org.apache.karaf.admin.command.ChangeRmiRegistryPortCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null />
            </completers>
        </command>
        <command name="admin/change-rmi-server-port">
            <action class="org.apache.karaf.admin.command.ChangeRmiServerPortCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null />
            </completers>
        </command>
        <command name="admin/change-opts">
            <action class="org.apache.karaf.admin.command.ChangeOptsCommand">
                <property name="adminService" ref="adminService" />
            </action>
            <completers>
                <ref component-id="instanceCompleter" />
                <null/>
            </completers>
        </command>
    </command-bundle>

    <reference id="adminService" interface="org.apache.karaf.admin.AdminService" />
    <reference id="featuresService" interface="org.apache.karaf.features.FeaturesService" />

    <bean id="instanceCompleter" class="org.apache.karaf.admin.command.completers.InstanceCompleter">
        <property name="adminService" ref="adminService" />
    </bean>

    <bean id="allFeatureCompleter" class="org.apache.karaf.features.command.completers.AllFeatureCompleter">
        <property name="featuresService" ref="featuresService" />
    </bean>

    <bean id="featureUrlCompleter" class="org.apache.karaf.features.command.completers.FeatureRepositoryCompleter">
        <property name="featuresService" ref="featuresService" />
    </bean>

</blueprint>
