//
// 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.
//
// This script is run each time a shell is created.
// You can define here closures or variables that will be available
// in each session.
//
ld = { log:display $args } ;
lde = { log:display-exception $args } ;
la = { osgi:list -t 0 $args } ;
cl = { config:list "(service.pid=$args)" } ;
help = { *:help $args | more } ;
man = { help $args } ;
log:list = { log:get ALL } ;

enable-3x-aliases = {

    // system:* aliases
    system:framework = { dev:framework $args } ;
    system:name = { osgi:name $args } ;
    system:shutdown = { osgi:shutdown $args } ;
    system:start-level = { osgi:start-level $args } ;
    system:property = { dev:system-property $args } ;
    system:version = { osgi:version $args } ;

    // service:* aliases
    service:list = { ls $args } ;
    service:wait = { dev:wait-for-service $args } ;

    // bundle:* aliases
    bundle:dynamic-import = { dev:dynamic-import $args } ;
    bundle:list = { osgi:list $args } ;
    bundle:install = { osgi:install $args };
    bundle:uninstall = { osgi:uninstall $args } ;
    bundle:start = { osgi:start $args } ;
    bundle:stop = { osgi:stop $args } ;
    bundle:classes = { osgi:classes $args } ;
    bundle:find-class = { osgi:find-class $args } ;
    bundle:headers = { osgi:headers $args } ;
    bundle:info = { osgi:info $args } ;
    bundle:refresh = { osgi:refresh $args } ;
    bundle:resolve = { osgi:resolve $args } ;
    bundle:restart = { osgi:restart $args } ;
    bundle:services = { osgi:bundle-services $args } ;
    bundle:start-level = { osgi:start-level $args } ;
    bundle:tree-show = { dev:show-tree $args } ;
    bundle:update = { osgi:update $args } ;
    bundle:watch = { dev:watch $args } ;

    // config:* aliases
    config:property-append = { config:propappend $args } ;
    config:property-delete = { config:propdel $args } ;
    config:property-list = { config:proplist $args } ;
    config:property-set = { config:propset $args } ;

    // dev:* aliases
    dev:dump-create = { dev:create-dump $args } ;

    // package:* aliases
    package:exports = { packages:exports $args } ;
    package:imports = { packages:imports $args } ;

    // feature:* aliases
    feature:add-url = { features:addurl $args } ;
    feature:repo-add = { features:addurl $args } ;
    feature:refresh-url = { features:refreshurl $args } ;
    feature:info = { features:info $args } ;
    feature:remove-repository = { features:removerepository $args } ;
    feature:install = { features:install $args } ;
    feature:repo-remove = { features:removeurl $args } ;
    feature:list = { features:list $args } ;
    feature:uninstall = { features:uninstall $args } ;
    feature:repo-list = { features:listrepositories $args } ;
    feature:url-list = { features:listurl $args } ;
    feature:version-list = { features:listversions $args } ;

    // system:* aliases
    system:property = { dev:system-property $args } ;

    // instance:* aliases
    instance:opts-change = { admin:change-opts $args } ;
    instance:rmi-registry-port-change = { admin:change-rmi-registry-port $args } ;
    instance:rmi-server-port-change = { admin:change-rmi-server-port $args } ;
    instance:ssh-port-change = { admin:change-ssh-port $args } ;
    instance:clone = { admin:clone $args } ;
    instance:connect = { admin:connect $args } ;
    instance:create = { admin:create $args } ;
    instance:destroy = { admin:destroy $args } ;
    instance:list = { admin:list $args } ;
    instance:rename = { admin:rename $args } ;
    instance:start = { admin:start $args } ;
    instance:stop = { admin:stop $args } ;

    // jaas:* aliases
    jaas:pending-list = { jaas:pending $args } ;
    jaas:realm-list = { jaas:realms $args } ;
    jaas:user-list = { jaas:users $args } ;
    jaas:realm-manage = { jaas:manage $args } ;
    jaas:role-add = { jaas:roleadd $args } ;
    jaas:role-delete = { jaas:roledel $args } ;
    jaas:user-add = { jaas:useradd $args } ;
    jaas:user-delete = { jaas:userdel $args } ;

    // obr:* aliases
    obr:url-add = { obr:addUrl $args } ;
    obr:url-list = { obr:listUrl $args } ;
    obr:url-refresh = { obr:refreshUrl $args } ;
    obr:url-remove = { obr:removeUrl $args } ;

    echo "Karaf 3.x aliases enabled"

}