Modified: karaf/site/production/manual/latest/update-notes.html URL: http://svn.apache.org/viewvc/karaf/site/production/manual/latest/update-notes.html?rev=1688715&r1=1688714&r2=1688715&view=diff ============================================================================== --- karaf/site/production/manual/latest/update-notes.html (original) +++ karaf/site/production/manual/latest/update-notes.html Wed Jul 1 19:43:35 2015 @@ -8,7 +8,7 @@ <link href="css/style.css" rel="stylesheet" type="text/css"/> <link href="css/pygmentize.css" rel="stylesheet" type="text/css"/> <title> - Apache Karaf 3.0.3-SNAPSHOT Guides + Apache Karaf 4.0.1-SNAPSHOT Guides </title> </head> <body> @@ -101,11 +101,7 @@ </td> <td height="100%" width="100%"> <div class="wiki-content"> -<h1 id="UpdateNotesfrom2.xto3.x">Update Notes (from 2.x to 3.x)</h1><p>This section is dedicated to users of previous Apache Karaf version.</p><h2 id="Distributions">Distributions</h2><p>The Apache Karaf distributions content has changed.</p><p>On Apache Karaf 2.x, we provide:</p><ul><li>tar.gz archive dedicated for Unix platforms</li><li>zip archive dedicated for Windows platforms</li></ul><p>Now, Apache Karaf 3.x still provide tar.gz and zip archives, but the content is the same.<br/>Especially, the two archives contains a <tt>bin</tt> folder with both Unix scripts and Windows bat scripts.</p><h2 id="Commands">Commands</h2><p>All console commands have been renamed and dispatched in scopes between Apache Karaf 2.x and Apache Karaf 3.x.</p><p>The purpose is to standardize the naming convention, and use more "logic" scope (especially for subshell).</p><p>The following table shows the correspondence between the "old" commands and the "new" ones.</p><div class="table-wrap"><table class ="confluenceTable"><tr><th class="confluenceTh"> Apache Karaf 2.x </th><th class="confluenceTh"> Apache Karaf 3.x </th></tr><tr><td class="confluenceTd"> admin:change-opts </td><td class="confluenceTd"> instance:opts-change </td></tr><tr><td class="confluenceTd"> admin:change-rmi-registry-port </td><td class="confluenceTd"> instance:rmi-registry-port-change </td></tr><tr><td class="confluenceTd"> admin:change-rmi-server-port </td><td class="confluenceTd"> instance:rmi-server-port-change </td></tr><tr><td class="confluenceTd"> admin:change-ssh-port </td><td class="confluenceTd"> instance:ssh-port-change </td></tr><tr><td class="confluenceTd"> admin:clone </td><td class="confluenceTd"> instance:clone </td></tr><tr><td class="confluenceTd"> admin:connect </td><td class="confluenceTd"> instance:connect </td></tr><tr><td class="confluenceTd"> admin:create </td><td class="confluenceTd"> instance:create </td></tr><tr><td class="confluenceTd"> admin:destroy </td><td class="confluenceTd"> instance:destroy </td></tr><tr><td class="confluenceTd"> admin:list </td><td class="confluenceTd"> instance:list </td></tr><tr><td class="confluenceTd"> admin:rename </td><td class="confluenceTd"> instance:rename </td></tr><tr><td class="confluenceTd"> admin:start </td><td class="confluenceTd"> instance:start </td></tr><tr><td class="confluenceTd"> admin:status </td><td class="confluenceTd"> instance:status </td></tr><tr><td class="confluenceTd"> admin:stop </td><td class="conflue nceTd"> instance:stop </td></tr><tr><td class="confluenceTd"> dev:create-dump </td><td class="confluenceTd"> dev:dump-create </td></tr><tr><td class="confluenceTd"> features:add-url </td><td class="confluenceTd"> feature:repo-add </td></tr><tr><td class="confluenceTd"> features:chooseurl </td><td class="confluenceTd"> feature:repo-add </td></tr><tr><td class="confluenceTd"> features:info </td><td class="confluenceTd"> feature:info </td></tr><tr><td class="confluenceTd"> features:install </td><td class="confluenceTd"> feature:install </td></tr><tr><td class="confluenceTd"> features:listVersions </td><td class="confluenceTd"> feature:version-list </td></tr><tr><td class="confluenceTd"> features:list </td><td class="confluenceTd"> feature:list </td></tr><tr><td class="confluenceTd"> features:listRepositories </td><td class="confluenceTd"> feature:repo-list </td></tr><tr><td class="confluenceTd"> features:listUrl </td><td class="confluenceTd"> feature:repo-list </td></tr><tr><td class="confluenceTd"> features:refreshUrl </td><td class="confluenceTd"> feature:repo-refresh </td></tr><tr><td class="confluenceTd"> features:removeRepository </td><td class="confluenceTd"> feature:repo-remove </td></tr><tr><td class="confluenceTd"> features:removeUrl </td><td class="confluenceTd"> feature:repo-remove </td></tr><tr><td class="confluenceTd"> features:uninstall </td><td class="confluenceTd"> feature:uninstall </td></tr><tr><td class="confluen ceTd"> jaas:cancel </td><td class="confluenceTd"> jaas:cancel </td></tr><tr><td class="confluenceTd"> jaas:pending </td><td class="confluenceTd"> jaas:pending-list </td></tr><tr><td class="confluenceTd"> jaas:realms </td><td class="confluenceTd"> jaas:realm-list </td></tr><tr><td class="confluenceTd"> jaas:users </td><td class="confluenceTd"> jaas:user-list </td></tr><tr><td class="confluenceTd"> jaas:manage </td><td class="confluenceTd"> jaas:realm-manage </td></tr><tr><td class="confluenceTd"> jaas:roleadd </td><td class="confluenceTd"> jaas:role-add </td></tr><tr><td class="confluenceTd"> jaas:roledel </td><td class="confluenceTd"> jaas:role-delete < /td></tr><tr><td class="confluenceTd"> jaas:update </td><td class="confluenceTd"> jaas:update </td></tr><tr><td class="confluenceTd"> jaas:useradd </td><td class="confluenceTd"> jaas:user-add </td></tr><tr><td class="confluenceTd"> jaas:userdel </td><td class="confluenceTd"> jaas:user-delete </td></tr><tr><td class="confluenceTd"> shell:alias </td><td class="confluenceTd"> shell:alias </td></tr><tr><td class="confluenceTd"> shell:cat </td><td class="confluenceTd"> shell:cat </td></tr><tr><td class="confluenceTd"> shell:clear </td><td class="confluenceTd"> shell:clear </td></tr><tr><td class="confluenceTd"> shell:date </td><td class="confluenceTd"> shell:date </td></tr><tr><td class="confluenceTd"> shell:each </td><td class="confluenceTd"> shell:each </td></tr><tr><td class="confluenceTd"> shell:echo </td><td class="confluenceTd"> shell:echo </td></tr><tr><td class="confluenceTd"> shell:exec </td><td class="confluenceTd"> shell:exec </td></tr><tr><td class="confluenceTd"> shell:grep </td><td class="confluenceTd"> shell:grep </td></tr><tr><td class="confluenceTd"> shell:head </td><td class="confluenceTd"> shell:head </td></tr><tr><td class="confluenceTd"> shell:history </td><td class="confluenceTd"> shell:history </td></tr><tr><td class="confluenceTd"> shell:if </td><td c lass="confluenceTd"> shell:if </td></tr><tr><td class="confluenceTd"> shell:info </td><td class="confluenceTd"> shell:info </td></tr><tr><td class="confluenceTd"> shell:java </td><td class="confluenceTd"> shell:java </td></tr><tr><td class="confluenceTd"> shell:logout </td><td class="confluenceTd"> shell:logout </td></tr><tr><td class="confluenceTd"> shell:more </td><td class="confluenceTd"> shell:more </td></tr><tr><td class="confluenceTd"> shell:new </td><td class="confluenceTd"> shell:new </td></tr><tr><td class="confluenceTd"> shell:printf </td><td class="confluenceTd"> shell:printf </td></tr><tr><td class="confluenceTd"> shell:sleep </td><td class="confluenceTd"> shell:sleep </td></tr><tr><td class="confluenceTd"> shell:sort </td><td class="confluenceTd"> shell:sort </td></tr><tr><td class="confluenceTd"> shell:source </td><td class="confluenceTd"> shell:source </td></tr><tr><td class="confluenceTd"> shell:tac </td><td class="confluenceTd"> shell:tac </td></tr><tr><td class="confluenceTd"> shell:tail </td><td class="confluenceTd"> shell:tail </td></tr><tr><td class="confluenceTd"> shell:watch </td><td class="confluenceTd"> shell:watch </td></tr><tr><td class="confluenceTd"> shell:wc </td><td class="confluenceTd"> shell:wc </td></tr><tr><td cl ass="confluenceTd"> config:cancel </td><td class="confluenceTd"> config:cancel </td></tr><tr><td class="confluenceTd"> config:delete </td><td class="confluenceTd"> config:delete </td></tr><tr><td class="confluenceTd"> config:edit </td><td class="confluenceTd"> config:edit </td></tr><tr><td class="confluenceTd"> config:list </td><td class="confluenceTd"> config:list </td></tr><tr><td class="confluenceTd"> config:propappend </td><td class="confluenceTd"> config:property-append </td></tr><tr><td class="confluenceTd"> config:propdel </td><td class="confluenceTd"> config:property-delete </td></tr><tr><td class="confluenceTd"> config:proplist </td><td class="confluenceTd"> config:property-list </td></tr><tr><td class="confluenceTd"> config:propset </td><td class="confluenceTd"> config:property-set </td></tr><tr><td class="confluenceTd"> config:update </td><td class="confluenceTd"> config:update </td></tr><tr><td class="confluenceTd"> dev:dynamic-import </td><td class="confluenceTd"> bundle:dynamic-import </td></tr><tr><td class="confluenceTd"> dev:framework </td><td class="confluenceTd"> system:framework </td></tr><tr><td class="confluenceTd"> dev:print-stack-traces </td><td class="confluenceTd"> shell:stack-traces-print </td></tr><tr><td class="confluenceTd"> dev:restart </td><td class="confluenceTd"> system:shutdown </td></tr><tr><td class="confluenceTd"> dev:show-tree </td><td class="confluenceTd" > bundle:tree-show </td></tr><tr><td > class="confluenceTd"> dev:system-property </td><td > class="confluenceTd"> system:property > </td></tr><tr><td class="confluenceTd"> dev:wait-for-service > </td><td class="confluenceTd"> service:wait > </td></tr><tr><td class="confluenceTd"> dev:watch > </td><td class="confluenceTd"> bundle:watch > </td></tr><tr><td class="confluenceTd"> log:clear > </td><td class="confluenceTd"> log:clear > </td></tr><tr><td class="confluenceTd"> log:display-exception > </td><td class="confluenceTd"> log:exception-display > </td></tr><tr><td class="confluenceTd"> log:display > </td><td class="confluenceTd"> log:display > </td></tr><tr><td class="confluenceTd"> log:get </td><td class="confluenceTd"> log:get </td></tr><tr><td class="confluenceTd"> log:tail </td><td class="confluenceTd"> log:tail </td></tr><tr><td class="confluenceTd"> log:set </td><td class="confluenceTd"> log:set </td></tr><tr><td class="confluenceTd"> obr:addUrl </td><td class="confluenceTd"> obr:url-add </td></tr><tr><td class="confluenceTd"> obr:deploy </td><td class="confluenceTd"> obr:deploy </td></tr><tr><td class="confluenceTd"> obr:find </td><td class="confluenceTd"> obr:find </td></tr><tr><td class="confluenceTd"> obr:info </td><td class="confluenceTd"> obr:info </td></tr><tr><td class="confluenceTd"> obr:list </td><td class="confluenceTd"> obr:list </td></tr><tr><td class="confluenceTd"> obr:listUrl </td><td class="confluenceTd"> obr:url-list </td></tr><tr><td class="confluenceTd"> obr:refreshUrl </td><td class="confluenceTd"> obr:url-refresh </td></tr><tr><td class="confluenceTd"> obr:removeUrl </td><td class="confluenceTd"> obr:url-remove </td></tr><tr><td class="confluenceTd"> obr:resolve </td><td class="confluenceTd"> obr:resolve </td></tr><tr><td class="confluenceTd"> obr:source </td><td class="confluenceTd"> obr:source </td></tr><tr><td class="confluenceTd"> obr:start </td><td class="confluenceTd"> obr:start </td></ tr><tr><td class="confluenceTd"> osgi:bundle-level </td><td class="confluenceTd"> bundle:start-level </td></tr><tr><td class="confluenceTd"> osgi:classes </td><td class="confluenceTd"> bundle:classes </td></tr><tr><td class="confluenceTd"> osgi:find-class </td><td class="confluenceTd"> bundle:find-class </td></tr><tr><td class="confluenceTd"> osgi:headers </td><td class="confluenceTd"> bundle:headers </td></tr><tr><td class="confluenceTd"> osgi:info </td><td class="confluenceTd"> bundle:info </td></tr><tr><td class="confluenceTd"> osgi:install </td><td class="confluenceTd"> bundle:install </td></tr><tr><td class="confluenceTd"> osgi:bundle-services </td><td class="confluenceTd"> bundle:services </td></tr><tr><td class="confluenceTd"> osgi:list </td><td class="confluenceTd"> bundle:list </td></tr><tr><td class="confluenceTd"> osgi:ls </td><td class="confluenceTd"> service:list </td></tr><tr><td class="confluenceTd"> osgi:name </td><td class="confluenceTd"> system:name </td></tr><tr><td class="confluenceTd"> osgi:refresh </td><td class="confluenceTd"> bundle:refresh </td></tr><tr><td class="confluenceTd"> osgi:resolve </td><td class="confluenceTd"> bundle:resolve </td></tr><tr><td class="confluenceTd"> osgi:restart </td><td class="confluenceTd"> bundle:restart </td></tr><tr><td class="confluenceTd"> osgi:shutdown </td><td class=" confluenceTd"> system:shutdown </td></tr><tr><td class="confluenceTd"> osgi:start </td><td class="confluenceTd"> bundle:start </td></tr><tr><td class="confluenceTd"> osgi:start-level </td><td class="confluenceTd"> bundle:start-level </td></tr><tr><td class="confluenceTd"> osgi:stop </td><td class="confluenceTd"> bundle:stop </td></tr><tr><td class="confluenceTd"> osgi:uninstall </td><td class="confluenceTd"> bundle:uninstall </td></tr><tr><td class="confluenceTd"> osgi:update </td><td class="confluenceTd"> bundle:update </td></tr><tr><td class="confluenceTd"> osgi:version </td><td class="confluenceTd"> system:version </td></tr><tr><td class="confluenceTd"> packages:exports </td><td class="confluenceTd"> package:exports </td></tr><tr><td class="confluenceTd"> packages:imports </td><td class="confluenceTd"> package:imports </td></tr><tr><td class="confluenceTd"> ssh:ssh </td><td class="confluenceTd"> ssh:ssh </td></tr><tr><td class="confluenceTd"> ssh:sshd </td><td class="confluenceTd"> ssh:sshd </td></tr><tr><td class="confluenceTd"> web:list </td><td class="confluenceTd"> web:list </td></tr><tr><td class="confluenceTd"> wrapper:install </td><td class="confluenceTd"> wrapper:install </td></tr></table></div><p>We encourage the users to use the <tt>--help</tt> option to check the name and type of arguments and options.</p><p>In term of development, the pr eviously shell anotations provided by the <tt>org.apache.felix.gogo.commands*</tt> package (<tt>@Command</tt>, <tt>@Argument</tt>, etc)<br/>are now deprecated. Apache Karaf 3.0.0 still supports these annotations, but we encourage the users to upgrade to the new package <tt>org.apache.karaf.shell.commands</tt>.</p><div class="table-wrap"><table class="confluenceTable"><tr><th class="confluenceTh"> Shell annotation </th><th class="confluenceTh"> Apache Karaf 2.x </th><th class="confluenceTh"> Apache Karaf 3.x </th></tr><tr><td class="confluenceTd"> <tt>@Argument</tt> </td><td class="confluenceTd"> <tt>org.apache.felix.gogo.commands.Argument</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf.shell.commands.Argument</tt> </td></tr><tr><td class="confluenceTd"> <tt>@Command</tt> </td><td class="confluenceTd"> <tt>org.apache.felix.gogo.commands.Command</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf.shell.commands.Command</tt> </td></tr><tr><td clas s="confluenceTd"> <tt>@CompleterValues</tt> </td><td class="confluenceTd"> <tt>org.apache.felix.gogo.commands.CompleterValues</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf.shell.commands.CompleterValues</tt> </td></tr><tr><td class="confluenceTd"> <tt>@Option</tt> </td><td class="confluenceTd"> <tt>org.apache.felix.gogo.commands.Option</tt> </td><td class="confluenceTd"> {{org.apache.karaf.shell.commands.Option </td></tr><tr><td class="confluenceTd"> <tt>@SubShell</tt> </td><td class="confluenceTd"> <tt>org.apache.felix.gogo.commands.SubShell</tt> </td><td class="confluenceTd"> {{org.apache.karaf.shell.commands.SubShell </td></tr></table></div><div class="table-wrap"><table class="confluenceTable"><tr><th class="confluenceTh"> Class name </th><th class="confluenceTh"> Apache Karaf 2.x </th><th class="confluenceTh"> Apache Karaf 3.x </th></tr><tr><td class="confluenceTd"> Action </td><td class="confluenceTd"> <tt>org.apache.felix.gogo.commands.Acti on</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf.shell.commands.Action</tt> </td></tr><tr><td class="confluenceTd"> CommandException </td><td class="confluenceTd"> <tt>org.apache.felix.gogo.commands.CommandException</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf.shell.commands.CommandException</tt> </td></tr><tr><td class="confluenceTd"> AbstractCommand </td><td class="confluenceTd"> <tt>org.apache.felix.gogo.commands.basic.AbstractCommand</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf.shell.commands.basic.AbstractCommand</tt> </td></tr></table></div><h2 id="JMXMBeans">JMX MBeans</h2><p>Like the console commands, the JMX MBeans object names have been renamed and the operations haven been dispatched in<br/>new MBeans.</p><p>The following table shows the correspondence between the "old" MBeans object names and the "new" ones.</p><div class="table-wrap"><table class="confluenceTable"><tr><th class="confluenceTh"> Apache Karaf 2.x </th><th class="confluenceTh"> Apache Karaf 3.x </th></tr><tr><td class="confluenceTd"> <tt>org.apache.karaf:type=bundles,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=bundle,name=*</tt> </td></tr><tr><td class="confluenceTd"> <tt>org.apache.karaf:type=config,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=config,name=*</tt> </td></tr><tr><td class="confluenceTd"> <tt>org.apache.karaf:type=dev,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=system,name=*</tt> </td></tr><tr><td class="confluenceTd"> <tt>org;apache.karaf:type=log,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=log,name=*</tt> </td></tr><tr><td class="confluenceTd"> <tt>org.apache.karaf:type=obr,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=obr,name=*</tt> </td></tr><tr><td cl ass="confluenceTd"> <tt>org.apache.karaf:type=packages,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=package,name=*</tt> </td></tr><tr><td class="confluenceTd"> <tt>org.apache.karaf:type=services,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=service,name=*</tt> </td></tr><tr><td class="confluenceTd"> <tt>org.apache.karaf:type=system,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=system,name=*</tt> </td></tr><tr><td class="confluenceTd"> <tt>org.apache.karaf:type=web,name=*</tt> </td><td class="confluenceTd"> <tt>org.apache.karaf:type=web,name=*</tt> </td></tr></table></div><h2 id="Features">Features</h2><p>The Apache Karaf "core" features repository XML URL have changed:</p><div class="table-wrap"><table class="confluenceTable"><tr><th class="confluenceTh"> Apache Karaf 2.x </th><th class="confl uenceTh"> Apache Karaf 3.x </th></tr><tr><td class="confluenceTd"> <tt>mvn:org.apache.karaf.assemblies.features/standard/2.3.x/xml/features</tt> </td><td class="confluenceTd"> <tt>mvn:org.apache.karaf.features/standard/3.0.x/xml/features</tt> </td></tr><tr><td class="confluenceTd"> <tt>mvn:org.apache.karaf.assemblies.features/enterprise/2.3.x/xml/features</tt> </td><td class="confluenceTd"> <tt>mvn:org.apache.karaf.features/enterprise/3.0.x/xml/features</tt> </td></tr></table></div><p>The Spring features have been isolated in a dedicated features repository (<tt>mvn:org.apache.karaf.features/spring/3.0.x/xml/features</tt>).</p><h2 id="Namespaces">Namespaces</h2><p>Apache Karaf 3.x brings updated version of the namespaces:</p><ul><li>Supported features namespaces:<ul><li><tt>karaf-features-1.0.0.xsd</tt></li><li><tt>karaf-features-1.1.0.xsd</tt></li><li><tt>karaf-features-1.2.0.xsd</tt></li></ul></li><li>Supported jaas na mespaces:<ul><li><tt>karaf-jaas-1.0.0.xsd</tt></li><li><tt>karaf-jaas-1.1.0.xsd</tt></li></ul></li><li>Supported shell namespaces:<ul><li><tt>karaf-shell-1.0.0.xsd</tt></li><li><tt>karaf-shell-1.1.0.xsd</tt></li></ul></li></ul><h2 id="Mavenplugin">Maven plugin</h2><p>The previous <tt>features-maven-plugin</tt> and <tt>cmdhelp-maven-plugin</tt> Maven plugins have been gathered in one main Maven<br/>plugin: <tt>karaf-maven-plugin</tt>.</p><p>The goals have changed as follow:</p><div class="table-wrap"><table class="confluenceTable"><tr><th class="confluenceTh"> Apache Karaf 2.x Maven plugins </th><th class="confluenceTh"> Apache Karaf Maven Plugin (3.x) </th></tr><tr><td class="confluenceTd"> features:add-features-to-repo </td><td class="confluenceTd"> karaf:features-add-to-repository </td></tr><tr><td class="confluenceTd"> features:create-kar </td><td class="confluenceTd"> karaf:features-create- kar </td></tr><tr><td class="confluenceTd"> features:generate-features-file </td><td class="confluenceTd"> karaf:features-generate-descriptor </td></tr><tr><td class="confluenceTd"> features:generate-features-xml </td><td class="confluenceTd"> karaf:features-generate-descriptor </td></tr><tr><td class="confluenceTd"> features:install-kars </td><td class="confluenceTd"> karaf:install-kars </td></tr><tr><td class="confluenceTd"> features:validate-features </td><td class="confluenceTd"> karaf:features-validate-descriptor </td></tr><tr><td class="confluenceTd"> cmdhelp:cmdhelp </td><td class="confluenceTd"> karaf:commands-generate-help </td></tr></table></div><p>Using the <tt>features:add-features-to-repo</tt> goal, you have now to explicitily define the Apache Karaf features URL (previously, the Apache Karaf features were automatically added).<br/>It means that you have to define:</p><pre> -<descriptor>mvn:org.apache.karaf.features/standard/3.0.0/xml/features</descriptor> -<descriptor>mvn:org.apache.karaf.features/spring/3.0.0/xml/features</descriptor> -<descriptor>mvn:org.apache.karaf.features/enterprise/3.0.0/xml/features</descriptor> -</pre><h2 id="Testtooling">Test tooling</h2><p>Apache Karaf 3.0.x is fully supported by OPS4J Pax Exam and "previous" karaf-pax-exam module is no more maintained.</p><h2 id="WebContainer">WebContainer</h2><p>WebApplications using the <tt>WebApp-Context</tt> headers in the MANIFEST are no more supported.</p><p>Apache Karaf now supports only the OSGi standard <tt>Web-ContextPath</tt> header in the MANIFEST.</p><h2 id="Updateguide">Update guide</h2><p>We encourage users to stard a fresh Apache Karaf 3.x container more than trying to override the folders from an<br/>Apache Karaf 2.x container.</p><p>Most of the files in the different Apache Karaf folders have changed, and the merge/diff is very large.</p><p>The future Apache Karaf version will introduce the concept of "Karaf Profiles" to simplify the update process.</p> +<h1 id="UpdateNotesfrom3.xto4.x">Update Notes (from 3.x to 4.x)</h1><p>This section is dedicated to users of previous Apache Karaf version.</p><p>NB: for the users upgrading from Karaf 2.x, please see the "Update Notes (from 2.x to 3.x)" in the Karaf 3.x<br/>documentation first.</p><p>NB: Karaf 4.x supports Java8.</p><h2 id="Distributions">Distributions</h2><p>Apache Karaf 4.x is available as tar.gz and zip archives. The content is the same and works on either Unix or Windows<br/>platforms.<br/>The <tt>bin</tt> folder contains both sh and bat scripts.</p><h2 id="Commands">Commands</h2><p>Karaf 4 commands are close to the ones provided in Karaf 3.</p><p>The sub-shell modes are the same (in <tt>etc/org.apache.karaf.shell.cfg</tt> or using <tt>shell:completion</tt> command).</p><p>However, some minor changes have been introduced and new commands available:</p><div class="table-wrap"><table class="confluenceTable"><tr><th class="confluenceTh"> Apache Karaf 3.x </th><th c lass="confluenceTh"> Apache Karaf 3.x </th></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> feature:requirement-list </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> feature:requirement-add </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> feature:requirement-remove </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> feature:regions </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> feature:start </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> feature:stop </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> jaas:group-create </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> jaas:group-add </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> jaas:group-delete </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> jaas:group-list </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> jaas:group-role-add </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> jaas:group-role-delete </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> jaas:su </td></tr><tr><td cla ss="confluenceTd"> </td><td class="confluenceTd"> jaas:sudo </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> shell:edit </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> shell:env </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> shell:less </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> shell:stack-traces-print </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> shell:threads </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> shell:while </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> log:list </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> bundle:capabilities </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> bundle:diag </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> bundle:id </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> bundle:load-test </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> bundle:requirements </td></tr><tr><td class="confluenceTd"> </td><td class="conf luenceTd"> bundle:resolve </td></tr><tr><td class="confluenceTd"> </td><td class="confluenceTd"> system:name </td></tr></table></div><p>We encourage the users to use the <tt>--help</tt> option to check the name and type of arguments and options.</p><p>In term of development, you can still use the blueprint definition as you do in Karaf 2.x & 3.x (with the corresponding annotations).</p><p>However, in Karaf 4.x, you can use DS and new annotations and avoid the usage of a blueprint XML.</p><p>The new annotations are available: @Service, @Completion, @Parsing, @Reference. It allows you to complete define the command<br/>in the command class directly.</p><p>To simplify the generation of the code and OSGi headers, Karaf 4.x provides the karaf-services-maven-plugin (in org.apache.karaf.tooling Maven groupId).</p><p>Take a look in the developer guide for the command development "new style" detail s.</p><h2 id="Featuresrepositories">Features repositories</h2><p>Karaf 4.x provides:</p><ul><li><tt>mvn:org.apache.karaf.features/enterprise/4.0.x/xml/features</tt></li><li><tt>mvn:org.apache.karaf.features/framework/4.0.x/xml/features</tt></li><li><tt>mvn:org.apache.karaf.features/spring/4.0.x/xml/features</tt></li><li><tt>mvn:org.apache.karaf.features/standard/4.0.x/xml/features</tt></li><li><tt>mvn:org.apache.karaf.features/static/4.0.x/xml/features</tt></li></ul><h2 id="Featuresresolver">Features resolver</h2><p>Apache Karaf 4.x brings a complete new feature resolver. The purpose is to simplify the features installation and<br/>lifecycle.<br/>The new resolver now checks the feature requirements (defined directly in the features XML), and check which bundles<br/>provides the capabilities to satisfy these requirements.<br/>It allows Karaf to automatically install bundles required by features.</p><p>For "old style" feature (features XML using namespace from Karaf 2.x or 3.x), this feature is not enabled.<br/>As soon as you use a "new style" feature (with namespace 1.3.0 used by Karaf 4.x), this feature is enabled.</p><h2 id="Namespaces">Namespaces</h2><p>Apache Karaf 4.x brings updated version of the namespaces:</p><ul><li>Supported features namespaces:<ul><li><tt>karaf-features-1.0.0.xsd</tt></li><li><tt>karaf-features-1.1.0.xsd</tt></li><li><tt>karaf-features-1.2.0.xsd</tt></li><li><tt>karaf-features-1.2.1.xsd</tt></li><li><tt>karaf-features-1.3.0.xsd</tt></li></ul></li><li>Supported jaas namespaces:<ul><li><tt>karaf-jaas-1.0.0.xsd</tt></li><li><tt>karaf-jaas-1.1.0.xsd</tt></li></ul></li><li>Supported shell namespaces:<ul><li><tt>karaf-shell-1.0.0.xsd</tt></li><li><tt>karaf-shell-1.1.0.xsd</tt></li></ul></li></ul><h2 id="Mavenplugin">Maven plugin</h2><p>A cleanup of the goals provided by <tt>karaf-maven-plugin</tt> has been done.</p><p>Now the provided goals are:</p><ul><li><tt>karaf:archive</tt> to create a tar.gz or zip of a Karaf distribution</li><li><tt >karaf:assembly</tt> to create a custom Karaf distribution >assembly</li><li><tt>karaf:kar</tt> to create a kar >file<p>* {{karaf:verify}} to verify and validate Karaf >features</p></li><li><tt>karaf:features-add-to-repository</tt> to recursively >copy features XML and content into a folder >(repository)</li><li><tt>karaf:features-export-meta-data</tt> to extract the >metadata from a features >XML</li><li><tt>karaf:features-generate-descriptor</tt> to generate a >features XML</li><li><tt>karaf:commands-generate-help</tt> to generate >help/documentation on the commands</li></ul><h2 id="Updateguide">Update >guide</h2><p>We encourage users to start a fresh Apache Karaf 4.x >container.</p><p>If you upgrade an existing container, <tt>lib</tt> and ><tt>system</tt> folder have to be updated (just an override copy).</p><p>For >the <tt>etc</tt> folder, a diff is required as some properties changed and >new configurations are available.</p> </div> </td> </tr> @@ -125,7 +121,7 @@ <td id="cell-3-2"> <div id="footer"> <div id="site-footer"> - © 2008-2011 The Apache Software Foundation + © 2008-2014 The Apache Software Foundation <br/> Apache Karaf, Karaf, Apache, the Apache feather logo, and the Apache Karaf project logo are trademarks of The Apache Software Foundation. </div>
Modified: karaf/site/production/manual/latest/users-guide/cdi.html URL: http://svn.apache.org/viewvc/karaf/site/production/manual/latest/users-guide/cdi.html?rev=1688715&r1=1688714&r2=1688715&view=diff ============================================================================== --- karaf/site/production/manual/latest/users-guide/cdi.html (original) +++ karaf/site/production/manual/latest/users-guide/cdi.html Wed Jul 1 19:43:35 2015 @@ -8,7 +8,7 @@ <link href="../css/style.css" rel="stylesheet" type="text/css"/> <link href="../css/pygmentize.css" rel="stylesheet" type="text/css"/> <title> - Apache Karaf 3.0.3-SNAPSHOT Guides + Apache Karaf 4.0.1-SNAPSHOT Guides </title> </head> <body> @@ -101,31 +101,32 @@ </td> <td height="100%" width="100%"> <div class="wiki-content"> -<h1 id="CDI">CDI</h1><p>This section described how to add support of CDI, and embed a CDI container in Apache Karaf. It doesn't describe<br/>how to develop CDI applications. See the developer guide for that.</p><h2 id="PaxCDI">Pax CDI</h2><p>Apache Karaf supports different CDI containers by using Pax CDI.</p><p>Pax CDI is pre-referenced in Apache Karaf. To register the Pax CDI features, you can do:</p><pre> -karaf@root()> feature:repo-add pax-cdi -</pre><p>This command will register the latest pax-cdi features.</p><p>You can see now a set of new CDI features available:</p><pre> +<h1 id="CDI">CDI</h1><p>This section described how to add support of CDI, and embed a CDI container in Apache Karaf. It doesn't describe<br/>how to develop CDI applications. See the developer guide for that.</p><h2 id="PaxCDI">Pax CDI</h2><p>Apache Karaf supports different CDI containers by using Pax CDI.</p><p>Pax CDI is pre-loaded in Apache Karaf.</p><p>You can see now a set of new CDI features available:</p><pre> karaf@root()> feature:list|grep -i cdi -pax-cdi | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | Provide CDI support -pax-cdi-1.1 | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | Provide CDI 1.1 support -pax-cdi-weld | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | Weld CDI support -pax-cdi-1.1-weld | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | Weld CDI 1.1 support -pax-cdi-openwebbeans | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | OpenWebBeans CDI support -pax-cdi-web | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | Web CDI support -pax-cdi-1.1-web | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | Web CDI 1.1 support -pax-cdi-web-weld | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | Weld Web CDI support -pax-cdi-1.1-web-weld | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | Weld Web CDI 1.1 support -pax-cdi-web-openwebbeans | 0.6.0 | | org.ops4j.pax.cdi-0.6.0 | OpenWebBeans Web CDI support -pax-cdi-deltaspike-core | >0.5 | | org.ops4j.pax.cdi-0.6.0 | Apache Deltaspike core support -pax-cdi-deltaspike-jpa | 0.5 | | org.ops4j.pax.cdi-0.6.0 | Apche Deltaspike jpa support -</pre><div class="warning" style="border: 1px solid #c00;background-color: #fcc;margin: 20px;padding: 0px 6px 0px 6px;"><p>Starting from Apache Karaf 3.0.1, the <tt>feature:repo-add pax-cdi</tt> command is no more required.<br/>Pax CDI features are now automatically included in the Apache Karaf enterprise features.</p></div><h2 id="CDIContainers">CDI Containers</h2><p>Thanks to Pax CDI, Apache Karaf supports multiple CDI implementation versions, and different CDI containers.</p><p>You just have to install the feature corresponding to the CDI container and version that you want to use.</p><h3 id="ApacheOpenWebBeans">Apache OpenWebBeans</h3><p>Apache Karaf provides a ready to use feature for Apache OpenWebBeans.</p><p>The <tt>openwebbeans</tt> feature automatically install the Pax CDI features and the Apache OpenWebBeans bundles:</p><pre> -karaf@root()> feature:install openwebbeans -</pre><div class="warning" style="border: 1px solid #c00;background-color: #fcc;margin: 20px;padding: 0px 6px 0px 6px;"><p>With Apache Karaf 3.0.0, don't forget to register the pax-cdi features repository first with:</p><pre> -karaf@root()> feature:repo-add pax-cdi -</pre></div><h3 id="JBossWeldCDIcontainer">JBoss Weld CDI container</h3><p>Apache Karaf provides a ready to use feature for JBoss Weld.</p><p>The <tt>weld</tt> feature automatically install the Pax CDI features and the JBoss Weld bundles:</p><pre> -karaf@root()> feature:install weld -</pre><div class="warning" style="border: 1px solid #c00;background-color: #fcc;margin: 20px;padding: 0px 6px 0px 6px;"><p>With Apache Karaf 3.0.0, don't forget to register the pax-cdi features repository first with:</p><pre> -karaf@root()> feature:repo-add pax-cdi -</pre></div> +pax-cdi | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Provide CDI support +pax-cdi-1.1 | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Provide CDI 1.1 support +pax-cdi-1.2 | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Provide CDI 1.2 support +pax-cdi-weld | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Weld CDI support +pax-cdi-1.1-weld | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Weld CDI 1.1 support +pax-cdi-1.2-weld | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Weld CDI 1.2 support +pax-cdi-openwebbeans | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | OpenWebBeans CDI support +pax-cdi-web | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Web CDI support +pax-cdi-1.1-web | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Web CDI 1.1 support +pax-cdi-1.2-web | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Web CDI 1.2 support +pax-cdi-web-weld | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Weld Web CDI support +pax-cdi-1.1-web-weld | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Weld Web CDI 1.1 support +pax-cdi-1.2-web-weld | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Weld Web CDI 1.2 support +pax-cdi-web-openwebbeans | 0.12.0 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | OpenWebBeans Web CDI support +deltaspike-core | 1.2.1 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Apache Deltaspike core support +deltaspike-jpa | 1.2.1 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Apache Deltaspike jpa support +deltaspike-partial-bean | 1.2.1 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Apache Deltaspike partial bean support +deltaspike-data | 1.2.1 | | Uninstalled | org.ops4j.pax.cdi-0.12.0 | Apache Deltaspike data support +</pre><h2 id="CDIContainers">CDI Containers</h2><p>Thanks to Pax CDI, Apache Karaf supports multiple CDI implementation versions, and different CDI containers.</p><p>You just have to install the feature corresponding to the CDI container and version that you want to use.</p><h3 id="ApacheOpenWebBeans">Apache OpenWebBeans</h3><p>Apache Karaf provides a ready to use feature for Apache OpenWebBeans.</p><p>The <tt>openwebbeans</tt> feature automatically install the Pax CDI features and the Apache OpenWebBeans bundles:</p><pre> +karaf@root()> feature:install http +karaf@root()> feature:install pax-cdi-openwebbeans +</pre><h3 id="JBossWeldCDIcontainer">JBoss Weld CDI container</h3><p>Apache Karaf provides a ready to use feature for JBoss Weld.</p><p>The <tt>weld</tt> feature automatically install the Pax CDI features and the JBoss Weld bundles:</p><pre> +karaf@root()> feature:install pax-cdi-weld +</pre> </div> </td> </tr> @@ -145,7 +146,7 @@ karaf@root()> feature:repo-add pax-cdi <td id="cell-3-2"> <div id="footer"> <div id="site-footer"> - © 2008-2011 The Apache Software Foundation + © 2008-2014 The Apache Software Foundation <br/> Apache Karaf, Karaf, Apache, the Apache feather logo, and the Apache Karaf project logo are trademarks of The Apache Software Foundation. </div> Modified: karaf/site/production/manual/latest/users-guide/configuration.html URL: http://svn.apache.org/viewvc/karaf/site/production/manual/latest/users-guide/configuration.html?rev=1688715&r1=1688714&r2=1688715&view=diff ============================================================================== --- karaf/site/production/manual/latest/users-guide/configuration.html (original) +++ karaf/site/production/manual/latest/users-guide/configuration.html Wed Jul 1 19:43:35 2015 @@ -8,7 +8,7 @@ <link href="../css/style.css" rel="stylesheet" type="text/css"/> <link href="../css/pygmentize.css" rel="stylesheet" type="text/css"/> <title> - Apache Karaf 3.0.3-SNAPSHOT Guides + Apache Karaf 4.0.1-SNAPSHOT Guides </title> </head> <body> @@ -114,12 +114,13 @@ felix.fileinstall.filter = .*\\.cfg felix.fileinstall.poll = 1000 felix.fileinstall.noInitialDelay = true felix.fileinstall.log.level = 3 +felix.fileinstall.log.default = jul ... -</pre><ul><li><tt>felix.fileinstall.enableConfigSave</tt> flush back in the configuration file the changes performed directly on the<p>configuration service (ConfigAdmin). If <tt>true</tt>, any change (using <tt>config:*</tt> commands, MBeans, OSGi service) is<br/>persisted back in the configuration false. Default is <tt>true</tt>.</p></li><li><tt>felix.fileinstall.dir</tt> is the directory where Apache Karaf is looking for configuration files. Default is <tt>${karaf.etc}</tt><p>meaning the value of the <tt>KARAF_ETC</tt> variable.</p></li><li><tt>felix.fileinstall.filter</tt> is the file name pattern used to load only some configuration files. Only files matching<p>the pattern will be loaded. Default value is <tt>.*<br/>.cfg</tt> meaning *.cfg files.</p></li><li><tt>felix.fileinstall.poll</tt> is the polling interval (in milliseconds). Default value is <tt>1000</tt> meaning that Apache<p>Karaf "re-loads" the configuration files every second.</p></li><li><tt>felix.fileinstall.noInit ialDelay</tt> is a flag indicating if the configuration file polling starts as soon as Apache<p>Karaf starts or wait for a certain time. If <tt>true</tt>, Apache Karaf polls the configuration files as soon as the configuration<br/>service starts.</p></li><li><tt>felix.fileinstall.log.level</tt> is the log message verbosity level of the configuration polling service. More<p>this value is high, more verbose the configuration service is.</p><p>You can change the configuration at runtime by directly editiing the configuration file.</p><p>You can also do the same using the <tt>config:*</tt> commands or the ConfigMBean.</p><h2 id="configcommands"><tt>config:*</tt> commands</h2><p>Apache Karaf provides a set of commands to manage the configuration.</p><h3 id="configlist"><tt>config:list</tt></h3><p><tt>config:list</tt> displays the list of all configurations available, or the properties in a given configuration (PID).</p><p>Without the <tt>query</tt> argument, the <tt>config:list</tt> comm and display all configurations, with PID, attached bundle and<br/>properties defined in the configuration:</p><pre> +</pre><ul><li><tt>felix.fileinstall.enableConfigSave</tt> flush back in the configuration file the changes performed directly on the<p>configuration service (ConfigAdmin). If <tt>true</tt>, any change (using <tt>config:*</tt> commands, MBeans, OSGi service) is<br/>persisted back in the configuration false. Default is <tt>true</tt>.</p></li><li><tt>felix.fileinstall.dir</tt> is the directory where Apache Karaf is looking for configuration files. Default is <tt>${karaf.etc}</tt><p>meaning the value of the <tt>KARAF_ETC</tt> variable.</p></li><li><tt>felix.fileinstall.filter</tt> is the file name pattern used to load only some configuration files. Only files matching<p>the pattern will be loaded. Default value is <tt>.*<br/>.cfg</tt> meaning *.cfg files.</p></li><li><tt>felix.fileinstall.poll</tt> is the polling interval (in milliseconds). Default value is <tt>1000</tt> meaning that Apache<p>Karaf "re-loads" the configuration files every second.</p></li><li><tt>felix.fileinstall.noInit ialDelay</tt> is a flag indicating if the configuration file polling starts as soon as Apache<p>Karaf starts or wait for a certain time. If <tt>true</tt>, Apache Karaf polls the configuration files as soon as the configuration<br/>service starts.</p></li><li><tt>felix.fileinstall.log.level</tt> is the log message verbosity level of the configuration polling service. More<p>this value is high, more verbose the configuration service is.</p></li><li><tt>felix.fileinstall.log.default</tt> is the logging framework to use, <tt>jul</tt> meaning Java Util Logging.</li></ul><p>You can change the configuration at runtime by directly editiing the configuration file.</p><p>You can also do the same using the <tt>config:*</tt> commands or the ConfigMBean.</p><h2 id="configcommands"><tt>config:*</tt> commands</h2><p>Apache Karaf provides a set of commands to manage the configuration.</p><h3 id="configlist"><tt>config:list</tt></h3><p><tt>config:list</tt> displays the list of all configurations ava ilable, or the properties in a given configuration (PID).</p><p>Without the <tt>query</tt> argument, the <tt>config:list</tt> command display all configurations, with PID, attached bundle and<br/>properties defined in the configuration:</p><pre> karaf@root()> config:list ---------------------------------------------------------------- Pid: org.apache.karaf.service.acl.command.system.start-level -BundleLocation: mvn:org.apache.karaf.shell/org.apache.karaf.shell.console/3.0.0 +BundleLocation: mvn:org.apache.karaf.shell/org.apache.karaf.shell.console/4.0.0 Properties: service.guard = (&(osgi.command.scope=system)(osgi.command.function=start-level)) * = * @@ -132,81 +133,81 @@ Properties: execute[/.*/,/.*[0-9][0-9][0-9]+.*/] = manager # manager can set startlevels above 100 ---------------------------------------------------------------- Pid: org.apache.karaf.log -BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/3.0.0 +BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/4.0.0 Properties: service.pid = org.apache.karaf.log size = 500 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg ... -</pre></li></ul><p>The <tt>query</tt> argument accepts a query using a LDAP syntax.</p><p>For instance, you can display details on one specific configuration using the following filter:</p><pre> +</pre><p>The <tt>query</tt> argument accepts a query using a LDAP syntax.</p><p>For instance, you can display details on one specific configuration using the following filter:</p><pre> karaf@root()> config:list "(service.pid=org.apache.karaf.log)" ---------------------------------------------------------------- Pid: org.apache.karaf.log -BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/3.0.0 +BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/4.0.0 Properties: + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg + pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n service.pid = org.apache.karaf.log size = 500 - pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg </pre><h3 id="configedit"><tt>config:edit</tt></h3><p><tt>config:edit</tt> is the first command to do when you want to change a configuration. <tt>config:edit</tt> command put you<br/>in edition mode for a given configuration.</p><p>For instance, you can edit the <tt>org.apache.karaf.log</tt> configuration:</p><pre> karaf@root()> config:edit org.apache.karaf.log </pre><p>The <tt>config:edit</tt> command doesn't display anything, it just puts you in configuration edit mode. You are now ready<br/>to use other config commands (like <tt>config:property-append</tt>, <tt>config:property-delete</tt>, <tt>config:property-set</tt>, ...).</p><p>If you provide a configuration PID that doesn't exist yet, Apache Karaf will create a new configuration (and so a new<br/>configuration file) automatically.</p><p>All changes that you do in configuration edit mode are store in your console session: the changes are not directly<br/>applied in the configuration. It allows you to "commit" the changes (see <tt>config:update</tt> command) or "rollback" and<br/>cancel your changes (see <tt>config:cancel</tt> command).</p><h3 id="configpropertylist"><tt>config:property-list</tt></h3><p>The <tt>config:property-list</tt> lists the properties for the currently edited configuration.</p><p>Assuming that you edited the <tt>org.apache.karaf.log</tt> configuration, you can d o:</p><pre> karaf@root()> config:property-list + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg + pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n service.pid = org.apache.karaf.log size = 500 - pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg </pre><h3 id="configpropertyset"><tt>config:property-set</tt></h3><p>The <tt>config:property-set</tt> command update the value of a given property in the currently edited configuration.</p><p>For instance, to change the value of the <tt>size</tt> property of previously edited <tt>org.apache.karaf.log</tt> configuration,<br/>you can do:</p><pre> karaf@root()> config:property-set size 1000 karaf@root()> config:property-list + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg + pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n service.pid = org.apache.karaf.log size = 1000 - pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg </pre><p>If the property doesn't exist, the <tt>config:property-set</tt> command creates the property.</p><p>You can use <tt>config:property-set</tt> command outside the configuration edit mode, by specifying the <tt>-p</tt> (for configuration pid) option:</p><pre> karaf@root()> config:property-set -p org.apache.karaf.log size 1000 karaf@root()> config:list "(service.pid=org.apache.karaf.log)" ---------------------------------------------------------------- Pid: org.apache.karaf.log -BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/3.0.0 +BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/4.0.0 Properties: service.pid = org.apache.karaf.log size = 1000 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg </pre><div class="warning" style="border: 1px solid #c00;background-color: #fcc;margin: 20px;padding: 0px 6px 0px 6px;"><p>Using the <tt>pid</tt> option, you bypass the configuration commit and rollback mechanism.</p></div><h3 id="configpropertyappend"><tt>config:property-append</tt></h3><p>The <tt>config:property-append</tt> is similar to <tt>config:property-set</tt> command, but instead of completely replacing the<br/>property value, it appends a string at the end of the property value.</p><p>For instance, to add 1 at the end of the value of the <tt>size</tt> property in <tt>org.apache.karaf.log</tt> configuration<br/>(and so have 5001 for the value instead of 500), you can do:</p><pre> karaf@root()> config:property-append size 1 karaf@root()> config:property-list service.pid = org.apache.karaf.log size = 5001 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg </pre><p>Like the <tt>config:property-set</tt> command, if the property doesn't exist, the <tt>config:property-set</tt> command creates<br/>the property.</p><p>You can use the <tt>config:property-append</tt> command outside the configuration edit mode, by specifying the <tt>-p</tt> (for configuration pid) option:</p><pre> karaf@root()> config:property-append -p org.apache.karaf.log size 1 karaf@root()> config:list "(service.pid=org.apache.karaf.log)" ---------------------------------------------------------------- Pid: org.apache.karaf.log -BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/3.0.0 +BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/4.0.0 Properties: service.pid = org.apache.karaf.log size = 5001 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg </pre><div class="warning" style="border: 1px solid #c00;background-color: #fcc;margin: 20px;padding: 0px 6px 0px 6px;"><p>Using the <tt>pid</tt> option, you bypass the configuration commit and rollback mechanism.</p></div><h3 id="configpropertydelete"><tt>config:property-delete</tt></h3><p>The <tt>config:property-delete</tt> command delete a property in the currently edited configuration.</p><p>For instance, you previously added a <tt>test</tt> property in <tt>org.apache.karaf.log</tt> configuration. To delete this <tt>test</tt><br/>property, you do:</p><pre> karaf@root()> config:property-set test test karaf@root()> config:property-list service.pid = org.apache.karaf.log size = 500 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg test = test karaf@root()> config:property-delete test karaf@root()> config:property-list service.pid = org.apache.karaf.log size = 500 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg </pre><p>You can use the <tt>config:property-delete</tt> command outside the configuration edit mode, by specifying the <tt>-p</tt> (for configuration pid) option:</p><pre> karaf@root()> config:property-delete -p org.apache.karaf.log test </pre><h3 id="configupdateandconfigcancel"><tt>config:update</tt> and <tt>config:cancel</tt></h3><p>When you are in the configuration edit mode, all changes that you do using <tt>config:property*</tt> commands are stored in "memory"<br/>(actually in the console session).</p><p>Thanks to that, you can "commit" your changes using the <tt>config:update</tt> command. The <tt>config:update</tt> command will<br/>commit your changes, update the configuration, and (if possible) update the configuration files.</p><p>For instance, after changing <tt>org.apache.karaf.log</tt> configuration with some <tt>config:property*</tt> commands, you have<br/>to commit your change like this:</p><pre> @@ -216,12 +217,12 @@ karaf@root()> config:update karaf@root()> config:list "(service.pid=org.apache.karaf.log)" ---------------------------------------------------------------- Pid: org.apache.karaf.log -BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/3.0.0 +BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/4.0.0 Properties: service.pid = org.apache.karaf.log size = 500 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg test = test </pre><p>On the other hand, if you want to "rollback" your changes, you can use the <tt>config:cancel</tt> command. It will cancel all<br/>changes that you did, and return of the configuration state just before the <tt>config:edit</tt> command. The <tt>config:cancel</tt><br/>exits from the edit mode.</p><p>For instance, you added the test property in the <tt>org.apache.karaf.log</tt> configuration, but it was a mistake:</p><pre> karaf@root()> config:edit org.apache.karaf.log @@ -230,12 +231,12 @@ karaf@root()> config:cancel karaf@root()> config:list "(service.pid=org.apache.karaf.log)" ---------------------------------------------------------------- Pid: org.apache.karaf.log -BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/3.0.0 +BundleLocation: mvn:org.apache.karaf.log/org.apache.karaf.log.core/4.0.0 Properties: service.pid = org.apache.karaf.log size = 500 pattern = %d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n - felix.fileinstall.filename = file:/opt/apache-karaf-3.0.0/etc/org.apache.karaf.log.cfg + felix.fileinstall.filename = file:/opt/apache-karaf-4.0.0/etc/org.apache.karaf.log.cfg </pre><h3 id="configdelete"><tt>config:delete</tt></h3><p>The <tt>config:delete</tt> command completely delete an existing configuration. You don't have to be in edit mode to delete<br/>a configuration.</p><p>For instance, you added <tt>my.config</tt> configuration:</p><pre> karaf@root()> config:edit my.config karaf@root()> config:property-set test test @@ -251,7 +252,14 @@ Properties: karaf@root()> config:delete my.config karaf@root()> config:list "(service.pid=my.config)" karaf@root()> -</pre><h2 id="JMXConfigMBean">JMX ConfigMBean</h2><p>On the JMX layer, you have a MBean dedicated to the management of the configurations: the ConfigMBean.</p><p>The ConfigMBean object name is: <tt>org.apache.karaf:type=config,name=*</tt>.</p><h3 id="Attributes">Attributes</h3><p>The <tt>Configs</tt> attribute is a list of all configuration PIDs.</p><h3 id="Operations">Operations</h3><ul><li><tt>listProperties(pid)</tt> returns the list of properties (property=value formatted) for the configuration <tt>pid</tt>.</li><li><tt>deleteProperty(pid, property)</tt> deletes the <tt>property</tt> from the configuration <tt>pid</tt>.</li><li><tt>appendProperty(pid, property, value)</tt> appends <tt>value</tt> at the end of the value of the <tt>property</tt> of the configuration <tt>pid</tt>.</li><li><tt>setProperty(pid, property, value)</tt> sets <tt>value</tt> for the value of the <tt>property</tt> of the configuration <tt>pid</tt>.</li><li><tt>delete(pid)</tt> deletes the configuration iden tified by the <tt>pid</tt>.</li><li><tt>create(pid)</tt> creates an empty (without any property) configuration with <tt>pid</tt>.</li><li><tt>update(pid, properties)</tt> updates a configuration identified with <tt>pid</tt> with the provided <tt>properties</tt> map.</li></ul> +</pre><h3 id="configmeta"><tt>config:meta</tt></h3><p>The <tt>config:meta</tt> command lists the meta type information related to a given configuration.</p><p>It allows you to get details about the configuration properties: key, name, type, default value, and description:</p><pre> +karaf@root()> config:meta -p org.apache.karaf.log +Meta type informations for pid: org.apache.karaf.log +key | name | type | default | description +--------------------------------------------------------------------------------------------------------------------------------------- +size | Size | int | 500 | size of the log to keep in memory +pattern | Pattern | String | %d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n | Pattern used to display log entries +</pre><p> </p><h2 id="JMXConfigMBean">JMX ConfigMBean</h2><p>On the JMX layer, you have a MBean dedicated to the management of the configurations: the ConfigMBean.</p><p>The ConfigMBean object name is: <tt>org.apache.karaf:type=config,name=*</tt>.</p><h3 id="Attributes">Attributes</h3><p>The <tt>Configs</tt> attribute is a list of all configuration PIDs.</p><h3 id="Operations">Operations</h3><ul><li><tt>listProperties(pid)</tt> returns the list of properties (property=value formatted) for the configuration <tt>pid</tt>.</li><li><tt>deleteProperty(pid, property)</tt> deletes the <tt>property</tt> from the configuration <tt>pid</tt>.</li><li><tt>appendProperty(pid, property, value)</tt> appends <tt>value</tt> at the end of the value of the <tt>property</tt> of the configuration <tt>pid</tt>.</li><li><tt>setProperty(pid, property, value)</tt> sets <tt>value</tt> for the value of the <tt>property</tt> of the configuration <tt>pid</tt>.</li><li><tt>delete(pid)</tt> deletes the configurat ion identified by the <tt>pid</tt>.</li><li><tt>create(pid)</tt> creates an empty (without any property) configuration with <tt>pid</tt>.</li><li><tt>update(pid, properties)</tt> updates a configuration identified with <tt>pid</tt> with the provided <tt>properties</tt> map.</li></ul> </div> </td> </tr> @@ -271,7 +279,7 @@ karaf@root()> <td id="cell-3-2"> <div id="footer"> <div id="site-footer"> - © 2008-2011 The Apache Software Foundation + © 2008-2014 The Apache Software Foundation <br/> Apache Karaf, Karaf, Apache, the Apache feather logo, and the Apache Karaf project logo are trademarks of The Apache Software Foundation. </div> Modified: karaf/site/production/manual/latest/users-guide/console.html URL: http://svn.apache.org/viewvc/karaf/site/production/manual/latest/users-guide/console.html?rev=1688715&r1=1688714&r2=1688715&view=diff ============================================================================== --- karaf/site/production/manual/latest/users-guide/console.html (original) +++ karaf/site/production/manual/latest/users-guide/console.html Wed Jul 1 19:43:35 2015 @@ -8,7 +8,7 @@ <link href="../css/style.css" rel="stylesheet" type="text/css"/> <link href="../css/pygmentize.css" rel="stylesheet" type="text/css"/> <title> - Apache Karaf 3.0.3-SNAPSHOT Guides + Apache Karaf 4.0.1-SNAPSHOT Guides </title> </head> <body> @@ -103,13 +103,17 @@ <div class="wiki-content"> <h1 id="Usingtheconsole">Using the console</h1><h2 id="Availablecommands">Available commands</h2><p>To see a list of the available commands in the console, you can use the <tt>help</tt>:</p><pre> karaf@root()> help -COMMANDS -bundle +bundle Enter the subshell bundle:capabilities Displays OSGi capabilities of a given bundles. -bundle:classes Displays a list of classes contained in the bundle +bundle:classes Displays a list of classes/resources contained in the bundle +bundle:diag Displays diagnostic information why a bundle is not Active +bundle:dynamic-import Enables/disables dynamic-import for a given bundle. +bundle:find-class Locates a specified class in any deployed bundle +bundle:headers Displays OSGi headers of a given bundles. +bundle:id Gets the bundle ID. ... </pre><p>You have the list of all commands with a short description.</p><p>You can use the tab key to get a quick list of all commands:</p><pre> -karaf@root()> Display all 280 possibilities? (y or n) +karaf@root()> Display all 294 possibilities? (y or n) ... </pre><h2 id="Subshellandcompletionmode">Subshell and completion mode</h2><p>The commands have a scope and a name. For instance, the command <tt>feature:list</tt> has <tt>feature</tt> as scope, and <tt>list</tt> as name.</p><p>Karaf "groups" the commands by scope. Each scope form a subshell.</p><p>You can directly execute a command with its full qualified name (scope:name):</p><pre> karaf@root()> feature:list @@ -133,7 +137,7 @@ GLOBAL karaf@root()> shell:completion FIRST karaf@root()> shell:completion FIRST -</pre><p><tt>shell:completion</tt> can inform you about the current completion mode used. You can also provide the new completion mode that you want.</p><p>GLOBAL completion mode is the default one in Karaf 3.0.0 (mostly for transition purpose).</p><p>GLOBAL mode doesnât really use subshell: itâs the same behavior as in previous Karaf versions.</p><p>When you type the tab key, whatever in which subshell you are, the completion will display all commands and all aliases:</p><pre> +</pre><p><tt>shell:completion</tt> can inform you about the current completion mode used. You can also provide the new completion mode that you want.</p><p>GLOBAL completion mode is the default one in Karaf 4.0.0 (mostly for transition purpose).</p><p>GLOBAL mode doesnât really use subshell: itâs the same behavior as in previous Karaf versions.</p><p>When you type the tab key, whatever in which subshell you are, the completion will display all commands and all aliases:</p><pre> karaf@root()> <TAB> karaf@root()> Display all 273 possibilities? (y or n) ... @@ -196,15 +200,23 @@ OPTIONS </pre><h3 id="Completion">Completion</h3><p>When you type the tab key, Karaf tries to complete:</p><ul><li>subshell</li><li>commands</li><li>aliases</li><li>command arguments</li><li>command options</li></ul><h3 id="Alias">Alias</h3><p>An alias is another name associated to a given command.</p><p>The <tt>shell:alias</tt> command creates a new alias. For instance, to create the <tt>list-installed-features</tt> alias to the actual<br/><tt>feature:list -i</tt> command, you can do:</p><pre> karaf@root()> alias "list-features-installed = { feature:list -i }" karaf@root()> list-features-installed -Name | Version | Installed | Repository | Description ---------------------------------------------------------------------------------------------------------- -standard | 3.0.0 | x | standard-3.0.0 | Karaf standard feature -config | 3.0.0 | x | standard-3.0.0 | Provide OSGi ConfigAdmin support -region | 3.0.0 | x | standard-3.0.0 | Provide Region Support -package | 3.0.0 | x | standard-3.0.0 | Package commands and mbeans -kar | 3.0.0 | x | standard-3.0.0 | Provide KAR (KARaf archive) support -ssh | 3.0.0 | x | standard-3.0.0 | Provide a SSHd server on Karaf -management | 3.0.0 | x | standard-3.0.0 | Provide a JMX MBeanServer and a set of MBeans in K +Name | Version | Required | State | Repository | Description +------------------------------------------------------------------------------------------------------------------------------ +feature | 4.0.0 | x | Started | standard-4.0.0 | Features Support +shell | 4.0.0 | x | Started | standard-4.0.0 | Karaf Shell +deployer | 4.0.0 | x | Started | standard-4.0.0 | Karaf Deployer +bundle | 4.0.0 | x | Started | standard-4.0.0 | Provide Bundle support +config | 4.0.0 | x | Started | standard-4.0.0 | Provide OSGi ConfigAdmin support +diagnostic | 4.0.0 | x | Started | standard-4.0.0 | Provide Diagnostic support +instance | 4.0.0 | x | Started | standard-4.0.0 | Provide Instance support +jaas | 4.0.0 | x | Started | standard-4.0.0 | Provide JAAS support +log | 4.0.0 | x | Started | standard-4.0.0 | Provide Log support +package | 4.0.0 | x | Started | standard-4.0.0 | Package commands and mbeans +service | 4.0.0 | x | Started | standard-4.0.0 | Provide Service support +system | 4.0.0 | x | Started | standard-4.0.0 | Provide System support +kar | 4.0.0 | x | Started | standard-4.0.0 | Provide KAR (KARaf archive) support +ssh | 4.0.0 | x | Started | standard-4.0.0 | Provide a SSHd server on Karaf +management | 4.0.0 | x | Started | standard-4.0.0 | Provide a JMX MBeanServer and a set of MBeans in </pre><p>At login, the Apache Karaf console reads the <tt>etc/shell.init.script</tt> file where you can create your aliases.<br/>It's similar to a bashrc or profile file on Unix.</p><pre> ld = { log:display $args } ; lde = { log:exception-display $args } ; @@ -216,14 +228,22 @@ help = { *:help $args | more } ; man = { help $args } ; log:list = { log:get ALL } ; </pre><p>You can see here the aliases available by default:</p><ul><li><tt>ld</tt> is a short form to display log (alias to <tt>log:display</tt> command)</li><li><tt>lde</tt> is a short form to display exceptions (alias to <tt>log:exception-display</tt> command)</li><li><tt>la</tt> is a short form to list all bundles (alias to <tt>bundle:list -t 0</tt> command)</li><li><tt>ls</tt> is a short form to list all services (alias to <tt>service:list</tt> command)</li><li><tt>cl</tt> is a short form to list all configurations (alias to <tt>config:list</tt> command)</li><li><tt>halt</tt> is a short form to shutdown Apache Karaf (alias to <tt>system:shutdown -h -f</tt> command)</li><li><tt>help</tt> is a short form to display help (alias to <tt>*:help</tt> command)</li><li><tt>man</tt> is the same as help (alias to <tt>help</tt> command)</li><li><tt>log:list</tt> displays all loggers and level (alias to <tt>log:get ALL</tt> command)</li></ul><p>You can create your own aliases in the <tt>etc/ shell.init.script</tt> file.</p><h3 id="Keybinding">Key binding</h3><p>Like on most Unix environment, Karaf console support some key bindings:</p><ul><li>the arrows key to navigate in the commands history</li><li>CTRL-D to logout/shutdown Karaf</li><li>CTRL-R to search previously executed command</li><li>CTRL-U to remove the current line</li></ul><h3 id="Pipe">Pipe</h3><p>You can pipe the output of one command as input to another one. It's a pipe, using the | character:</p><pre> -karaf@root()> feature:list | grep -i war -war | 3.0.0 | | standard-3.0.0 | Turn Karaf as a full WebContainer -</pre><h3 id="Grepmorefind...">Grep, more, find, ...</h3><p>Karaf console provides some core commands similar to Unix environment:</p><ul><li><tt>shell:head</tt> displays the first line of the input</li><li><tt>shell:source</tt> executes commands contained in a script</li><li><tt>shell:alias</tt> creates an alias to an existing command</li><li><tt>shell:history</tt> prints the commands history</li><li><tt>shell:cat</tt> displays the content of a file or URL</li><li><tt>shell:if</tt> allows you to use conditions (if, then, else blocks) in script</li><li><tt>shell:tac</tt> captures stdin and returns it as a string</li><li><tt>shell:clear</tt> clears the current console display</li><li><tt>shell:info</tt> prints various information about the current Karaf instance</li><li><tt>shell:tail</tt> displays the last lines of the input</li><li><tt>shell:completion</tt> displays or change the current completion mode</li><li><tt>shell:java</tt> executes a Java application</li><li><tt>shell:threa ds</tt> prints the current thread</li><li><tt>shell:date</tt> displays the current date (optionally using a format)</li><li><tt>shell:watch</tt> periodically executes a command and refresh the output</li><li><tt>shell:each</tt> executes a closure on a list of arguments</li><li><tt>shell:more</tt> is a file pager</li><li><tt>shell:wc</tt> prints newline, words, and byte counts for each file</li><li><tt>shell:env</tt> gets/sets the value of a shell session variable</li><li><tt>shell:echo</tt> echoes and prints arguments to stdout</li><li><tt>shell:new</tt> creates a new Java object</li><li><tt>shell:edit</tt> calls a text editor on the current file or URL</li><li><tt>shell:printf</tt> formats and prints arguments</li><li><tt>shell:exec</tt> executes a system command</li><li><tt>shell:sleep</tt> sleeps for a bit then wakes up</li><li><tt>shell:grep</tt> prints lines matching the given pattern</li><li><tt>shell:sort</tt> writes sorted concatenation of all files to stdout</li></ul><p>You don't have to use the fully qualified name of the command, you can directly use the command name as long as it is unique.<br/>So you can use 'head' instead of 'shell:head'</p><p>Again, you can find details and all options of these commands using <tt>help</tt> command or <tt>--help</tt> option.</p><h3 id="Scripting">Scripting</h3><p>The Apache Karaf Console supports a complete scripting language, similar to bash or csh on Unix.</p><p>The <tt>each</tt> (<tt>shell:each</tt>) command can iterate in a list:</p><pre> +karaf@root()> feature:list |grep -i war +pax-war | 4.1.4 | | Uninstalled | org.ops4j.pax.web-4.1.4 | Provide support of a full WebContainer +pax-war-tomcat | 4.1.4 | | Uninstalled | org.ops4j.pax.web-4.1.4 | +war | 4.0.0 | | Uninstalled | standard-4.0.0 | Turn Karaf as a full WebContainer +blueprint-web | 4.0.0 | | Uninstalled | standard-4.0.0 | Provides an OSGI-aware Servlet ContextListener fo +</pre><h3 id="Grepmorefind...">Grep, more, find, ...</h3><p>Karaf console provides some core commands similar to Unix environment:</p><ul><li><tt>shell:alias</tt> creates an alias to an existing command</li><li><tt>shell:cat</tt> displays the content of a file or URL</li><li><tt>shell:clear</tt> clears the current console display</li><li><tt>shell:completion</tt> displays or change the current completion mode</li><li><tt>shell:date</tt> displays the current date (optionally using a format)</li><li><tt>shell:each</tt> executes a closure on a list of arguments</li><li><tt>shell:echo</tt> echoes and prints arguments to stdout</li><li><tt>shell:edit</tt> calls a text editor on the current file or URL</li><li><tt>shell:env</tt> displays or sets the value of a shell session variable</li><li><tt>shell:exec</tt> executes a system command</li><li><tt>shell:grep</tt> prints lines matching the given pattern</li><li><tt>shell:head</tt> displays the first line of the input</li><li><tt>shell:hist ory</tt> prints the commands history</li><li><tt>shell:if</tt> allows you to use conditions (if, then, else blocks) in script</li><li><tt>shell:info</tt> prints various information about the current Karaf instance</li><li><tt>shell:java</tt> executes a Java application</li><li><tt>shell:less</tt> file pager</li><li><tt>shell:logout</tt> disconnects shell from current session</li><li><tt>shell:more</tt> is a file pager</li><li><tt>shell:new</tt> creates a new Java object</li><li><tt>shell:printf</tt> formats and prints arguments</li><li><tt>shell:sleep</tt> sleeps for a bit then wakes up</li><li><tt>shell:sort</tt> writes sorted concatenation of all files to stdout</li><li><tt>shell:source</tt> executes commands contained in a script</li><li><tt>shell:stack-traces-print</tt> prints the full stack trace in the console when the execution of a command throws an exception</li><li><tt>shell:tac</tt> captures the STDIN and returns it as a string</li><li><tt>shell:tail</tt> displays the las t lines of the input</li><li><tt>shell:threads</tt> prints the current thread</li><li><tt>shell:watch</tt> periodically executes a command and refresh the output</li><li><tt>shell:wc</tt> prints newline, words, and byte counts for each file</li><li><tt>shell:while</tt> loop while the condition is true</li></ul><p>You don't have to use the fully qualified name of the command, you can directly use the command name as long as it is unique.<br/>So you can use 'head' instead of 'shell:head'</p><p>Again, you can find details and all options of these commands using <tt>help</tt> command or <tt>--help</tt> option.</p><h3 id="Scripting">Scripting</h3><p>The Apache Karaf Console supports a complete scripting language, similar to bash or csh on Unix.</p><p>The <tt>each</tt> (<tt>shell:each</tt>) command can iterate in a list:</p><pre> karaf@root()> list = [1 2 3]; each ($list) { echo $it } 1 2 3 -</pre><p>You can create the list yourself (as in the previous example), or some commands can return a list too.</p><p>We can note that the console created a "session" variable with the name <tt>list</tt> that you can access with <tt>$list</tt>.</p><p>The <tt>$it</tt> variable is an implicit one corresponding to the current object (here the current iterated value from the<br/>list).</p><p>When you create a list with <tt>[]</tt>, Apache Karaf console creates a Java ArrayList. It means that you can use methods<br/>available in the ArrayList objects (like get or size for instance):</p><pre> +</pre><div class="tip" style="border: 1px solid #090;background-color: #dfd;margin: 20px;padding: 0px 6px 0px 6px;"><p>The same loop could be written with the <tt>shell:while</tt> command:</p><pre> +karaf@root()> a = 0 ; while { %((a+=1) <= 3) } { echo $a } +1 +2 +3 +</pre></div><p>You can create the list yourself (as in the previous example), or some commands can return a list too.</p><p>We can note that the console created a "session" variable with the name <tt>list</tt> that you can access with <tt>$list</tt>.</p><p>The <tt>$it</tt> variable is an implicit one corresponding to the current object (here the current iterated value from the<br/>list).</p><p>When you create a list with <tt>[]</tt>, Apache Karaf console creates a Java ArrayList. It means that you can use methods<br/>available in the ArrayList objects (like get or size for instance):</p><pre> karaf@root()> list = ["Hello" world]; echo ($list get 0) ($list get 1) Hello world </pre><p>We can note here that calling a method on an object is directly using <tt>(object method argument)</tt>.<br/>Here <tt>($list get 0)</tt> means <tt>$list.get(0)</tt> where <tt>$list</tt> is the ArrayList.</p><p>The <tt>class</tt> notation will display details about the object:</p><pre> @@ -279,7 +299,7 @@ Error executing command: Cannot coerce e <td id="cell-3-2"> <div id="footer"> <div id="site-footer"> - © 2008-2011 The Apache Software Foundation + © 2008-2014 The Apache Software Foundation <br/> Apache Karaf, Karaf, Apache, the Apache feather logo, and the Apache Karaf project logo are trademarks of The Apache Software Foundation. </div>
