pax_global_header00006660000000000000000000000064115566022650014522gustar00rootroot0000000000000052 comment=1322a052ca29108be6469fc183e64779106cc299 felix-shell-1.4.2/000077500000000000000000000000001155660226500137425ustar00rootroot00000000000000felix-shell-1.4.2/LICENSE000066400000000000000000000261361155660226500147570ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed 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. felix-shell-1.4.2/NOTICE000066400000000000000000000013631155660226500146510ustar00rootroot00000000000000Apache Felix Shell Service Copyright 2006-2010 The Apache Software Foundation I. Included Software This product includes software developed at The Apache Software Foundation (http://www.apache.org/). Licensed under the Apache License 2.0. This product includes software developed at The OSGi Alliance (http://www.osgi.org/). Copyright (c) OSGi Alliance (2000, 2007). Licensed under the Apache License 2.0. II. Used Software This product uses software developed at The OSGi Alliance (http://www.osgi.org/). Copyright (c) OSGi Alliance (2000, 2007). Licensed under the Apache License 2.0. This product uses software developed at The Codehaus (http://www.codehaus.org) Licensed under the Apache License 2.0. III. License Summary - Apache License 2.0 felix-shell-1.4.2/doc/000077500000000000000000000000001155660226500145075ustar00rootroot00000000000000felix-shell-1.4.2/doc/apache-felix-shell-service.html000066400000000000000000000434411155660226500224740ustar00rootroot00000000000000 Apache Felix - Apache Felix Shell Service
Apache

Apache Felix Shell Service

Overview

In order to interact with Felix it is necessary to have some sort of interactive shell that allows you to issue commands to the framework and to obtain information from it. The OSGi specification does not define how an OSGi framework should provide this interactivity. Felix defines a shell service for creating and executing arbitrary commands. The shell service does not define a user interface, only a service API.

The benefit of the Felix shell service approach is that it is possible to:

The remainder of this document describes how the shell service works and how to create custom commands for it. This document does not describe how to use the command shell, nor does it describe the text-based or GUI-based user interfaces that are available for the shell.

How the Shell Service Works

The Felix shell service is intended to be a simple, but extensible shell service that can have multiple user interface implementations, all of which are independent from the Felix framework. The shell service is currently not intended to be sophisticated, rather it is just a mechanism to execute commands. The shell service maintains a list of command services, each of which have a unique command name. The shell service is defined by the following service interface:

Using the shell service interface, it is possible to access and execute available commands. The shell service methods perform the following functions:

Most of the shell service methods require no explanation except for the executeCommand() method. Even though this method is the most complex, it is still fairly simplistic. The assumption of the shell service is that a command line will be typed by the user (or perhaps constructed by a GUI) and passed into it for execution. The shell service interprets the command line in a very simplistic fashion; it takes the leading string of characters terminated by a space character (not including it) and assumes that this leading token is the command name. Consider the following command line:

update 3 http://www.foo.com/bar.jar

The shell service interprets this as an update command and will search for a command service with the same name. If a corresponding command service is not found, then it will print an error message to the error print stream. If a corresponding command service is found, then it will pass the entire command line string and the print streams into the executeCommand() method of the command service (for a more detailed description of command services, see the next section).

Notice that there is no method to add commands to the shell service interface. This is because commands are implemented as OSGi services and the shell service listens for service events and when a command service registers/unregisters it automatically updates its list of commands accordingly.

How Commands Work

All commands available in the shell service are implemented as OSGi services. The advantage of this approach is two-fold: the shell service can leverage OSGi service events to maintain its list of available commands and the set available commands is dynamically extendable by installed bundles. The command service interface is defined as follows:

The semantics of the command service methods are:

Creating a Command

The following example creates a simple version of the start command.

A bundle activator class is needed for packaging the command servce; the bundle activator registers the command service in its start() method. Note: You do not need one activator per command, a single activator can register any number of commands.

To compile these classes you will need to have the framework.jar file on your class path. Compile all of the source files using a command like:

java -d c:\classes *.java

This command compiles all of the source files and outputs the generated class files into a subdirectory of the c:\classes directory, called test, named after the package of the source files; for the above command to work, the c:\classes directory must exist. Once you have compiled all of the above classes, you need to create a bundle JAR file of the generated package directory. The bundle JAR file needs a manifest, so create a file called manifest.mf with the following contents:

To create the bundle JAR file, issue the command:

jar cfm mystart.jar manifest.mf -C c:\classes test

This command creates a JAR file using the manifest you created and includes all of the classes in the test directory inside of the c:\classes directory. Once the bundle JAR file is created, you are ready to add the command service to the shell service; simply start Felix and install and start the bundle created by the above command. By doing so, the new mystart command is made available via the shell service.

Security and the Shell Service

The shell service security handling is quite simple, all security is handled by the standard OSGi framework mechanisms. For example, if a bundle should not be able to register a shell service, then it should not be given the corresponding service permission. Security handling may change in future release after some experience is gained through usage.

Feedback

Subscribe to the Felix users mailing list by sending a message to users-subscribe@felix.apache.org; after subscribing, email questions or feedback to users@felix.apache.org.

felix-shell-1.4.2/doc/apache-felix-shell-service_files/000077500000000000000000000000001155660226500227625ustar00rootroot00000000000000felix-shell-1.4.2/doc/apache-felix-shell-service_files/apache-felix-small.png000066400000000000000000000150541155660226500271310ustar00rootroot00000000000000PNG  IHDR%i[iCCPICC ProfilexWy4m޿p88 q"Ly<2qC(%)P$%"cEH(Cd:zzz_׽ukk0syHA( 1ÀN {zt R$Rñ|q%:n/ " l~Xؼv=EG"`@@lookw./y@C h½p @I057w[`ɑd: PO- p* @B) ؾ@lޢPF#Q Azyο @> $eJŇ9y@w[`J`uۀg|_ >AiB"r:%pvR9үd.lTSZUaTݧ&+'/`mf`69f`l|bUuMm]}CcSsaױ#nEGU"F%gVu߆OF,DnEcbXbyDei7L4=auCcSiT3igMgRtQbe<+ZW\7/a֑"b;Aeaw#++cVޏyU06ȻޭFէRMϘ{62闍]Y>=Խ}^m~&utq!awGTFߗ}3QOwSS3B3_.}v|;3g>6?яE%eV+Y)eF/xAE}CRbi/b0ᆙRYdXGُqss\هs hu$E%- .k)&W񨒣*ڂ#|mwmzޤ~Ai#!Y-i^GEV'I6vv*|NLTΫvyvGѓd/oo{#ޟ @l2:E'{ߘPw;'rOfJJKM!>jw$M7]9 Yq9i/Qr)6\]6_T7ou4nS[Z]VU^y^EU{Vw?{8SX^4=󄭑)w3ftHj\؋g/RI=ν:} ޼y3@y+3847ݝFbc>|j,>9oʗ_ gU7|oѵ0q /U5u_G77onP,‚,PTJRG:N3M%sLC,lq99~3۷y@ }Bƒ"ebF8$-0ROCe2rBr= <  X{JvJ*Z*jj,ΚZ:S:ut{9 yc" YhX,Z[Yݴwq`qqLqv\s8Eeҵ[{Q&x/U5ZH"aͷ$I%Q7""#D=>7_yp\#-qDɂSI)蔏R/ KH?K{v\[FL, ً9o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@F+&CFs<ݷ™ZYA9P!&`@1]wYKH|nZ1<.j%؂ox-r/&>?3_Gu]Ǥ9zt48MZLU|T4g!USޣA_q:' GOAp 2@<*S<X҃e?jv(%CDJ_p~-DqE QKՠ9 -dsp3]y' ʛލc1d 9PChq4@s.^E*9dT'8#=9tnCIy.rLAgM(9f(i9"cDP(l &D W@<!w'e#IR/C84WBoS |2>XL<<:dȐ!C 2L2T&M8IENDB`felix-shell-1.4.2/doc/apache-felix-shell-service_files/apache.png000066400000000000000000000277221155660226500247230ustar00rootroot00000000000000PNG  IHDR<!X[iCCPICC ProfilexXy8o>aLvBȾ}߳K/BDB!DDdH)%%ʒ/4?{]zz_s>yu6^o %!T{S7 0 t%X`@ƛB ~|[2{Ӵ<" X8}#pDR"$x Mu7@ᅪﳍM@гCs:"^|}#!llHH/k )H/ zݲ7@Obp'@(럜1rr??OIf4QlYm:U h &FQ@. +$eލa?˸W`A{ψlW>a"cb %2/tC.kRUYQcQߥ!/k a(dgil1lŸՐK^n.NNN.nnoGNxx.xy#w7IO ZVEyE}19eKOT={81N)..'OڧfX2?mixF/K;[Zj9y*T/j\2l\hvŲ5J|JnoWDފWw'&ntmz}bGMd@˷'mmYO:p]SϚ(PzɫAק0i{dXmx]{W >0N;5i:I2-2=LדssϙZZ[aWJ͵ޟk›[i4FP>L/ V" ka.>10=hB©{[E6d=%2%>ʠe4<})RqV5USQ`Ик]멧10l3*1>aB6/omi>ekyߪ:-QIy +ugay}7ՇHt5!I8ɸ@Tzra1hᨡ聘؞' MoTt4XT҉i'3O)9#ŗu-t<]*va+js_L]}wmz_qWI[iƛue5UnWVWݽ}N[󻃵F;r6>k{ i[i}YAwsJk^h?SW/k_P^ ;yp;{Q_z>6WON^*?}/E3%_+fk~\uiuȪC1g6ol:ŽPkNL]}##Ε"pi!vnkx+ <ݼC;ն^paOP^-]"bq&xɗRge2erq " =JJ-H8**+j:j)5ôص]u ut'NKr6xL'qGXX Y[iY-X۶%+8\stsbwqNuuZ{ Mm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-1.4.2/doc/apache-felix-shell-service_files/button.html000066400000000000000000000003671155660226500251710ustar00rootroot00000000000000 felix-shell-1.4.2/doc/apache-felix-shell-service_files/button_data/000077500000000000000000000000001155660226500252665ustar00rootroot00000000000000felix-shell-1.4.2/doc/apache-felix-shell-service_files/button_data/2008-usa-125x125.png000066400000000000000000000332001155660226500300760ustar00rootroot00000000000000PNG  IHDR}}l% cHRMz&u0`:pQ<gAMA|QsRGBbKGD pHYs+ IDATx}x\ՙ;wz4F#iԛ%B %a!!O6q6$%6b` l6mdKdiMwe٬m9~5s{=W|˻$2UaND /A[f0ϗ"[x ԤI ## ALq{B_.d?C(C"LR1jy, /NH|>6gPmP.e\ d?~TQz飣~8az|L4ioЏ?щ7mba<~X 0|=qB0dQivC@UiZ0Z hQL !s d@(A$pXˠZJ,[/꼟$ԒQ唜RK ȟF&9,~}Ơ S(p'jk+p-aNIDO`)-'#Go KDV֬(6\=Gh>-'s6 ܩ|%nP{s= yM<+*˲P$KApxWtVKp]?kÍbժU[hf1G":(r!I}*GqD[aF %IYZ^؇9_. VuR O5JTkS~܏j9~U5 őKqҟx79fMnYH\{0u⹎ K2,,p^Wn4yJn+C 烩ؘ~t R(^}؀,V$t]ōdȑ%4B_q7uQ?P $^O]G>B ݽ9H"AU k`ǎxgܸ UX4YJ>D j@+w0~/Bԗp(|G߆ƠA_$D9?wQ#"2mH-8Loqr|7^JGE7$e1W8бjfL#ƪ(~n<X丒tT :w8b8p؏緸ӻ w$aXy*,Q:Z1yW.E|5܇iuװM.-x*!CXӌӟ}੧ /+V`h鷁!?G5d$rA k1y: l(m(d5FS|'{J6}c&4&EZY PYp \>U*>&^Em0-PGd2I7 IM,7K$ƚ{?0k(̙ /`ƍáCr[Aq U_y–T:)B\  +3D]a43ବm ċoDq45ĉ蟔+X}`rMkeh&]Dc"pmi@c3OT16"BLb$ os߿ݻs;qΦ!PO D ךp56T@%B BYp@6\A ~ރ> =?b[|1V)A7{& 1ob.$hpykk R'8 OY h0^ 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-1.4.2/doc/apache-felix-shell-service_files/linkext7.gif000066400000000000000000000002461155660226500252200ustar00rootroot00000000000000GIF89aD̙@*ApAwhFVR7xN~N\\=F/vNE/!,# T$ % C)P,Q/H 2;felix-shell-1.4.2/doc/apache-felix-shell-service_files/logo.png000066400000000000000000000351171155660226500244370ustar00rootroot00000000000000PNG  IHDR?[iCCPICC ProfilexXy8o>aLvBȾ}߳K/BDB!DDdH)%%ʒ/4?{]zz_s>yu6^o %!T{S7 0 t%X`@ƛB ~|[2{Ӵ<" X8}#pDR"$x Mu7@ᅪﳍM@гCs:"^|}#!llHH/k )H/ zݲ7@Obp'@(럜1rr??OIf4QlYm:U h &FQ@. +$eލa?˸W`A{ψlW>a"cb %2/tC.kRUYQcQߥ!/k a(dgil1lŸՐK^n.NNN.nnoGNxx.xy#w7IO ZVEyE}19eKOT={81N)..'OڧfX2?mixF/K;[Zj9y*T/j\2l\hvŲ5J|JnoWDފWw'&ntmz}bGMd@˷'mmYO:p]SϚ(PzɫAק0i{dXmx]{W >0N;5i:I2-2=LדssϙZZ[aWJ͵ޟk›[i4FP>L/ V" ka.>10=hB©{[E6d=%2%>ʠe4<})RqV5USQ`Ик]멧10l3*1>aB6/omi>ekyߪ:-QIy +ugay}7ՇHt5!I8ɸ@Tzra1hᨡ聘؞' MoTt4XT҉i'3O)9#ŗu-t<]*va+js_L]}wmz_qWI[iƛue5UnWVWݽ}N[󻃵F;r6>k{ i[i}YAwsJk^h?SW/k_P^ ;yp;{Q_z>6WON^*?}/E3%_+fk~\uiuȪC1g6ol:ŽPkNL]}##Ε"pi!vnkx+ <ݼC;ն^paOP^-]"bq&xɗRge2erq " =JJ-H8**+j:j)5ôص]u ut'NKr6xL'qGXX Y[iY-X۶%+8\stsbwqNuuZ{ Mm½Gg!ԡfuUboI8@ ^  ShԫQ\QĜSgOhH:L:ę4wXdTLiO[eHb85}=LroY睾e%< W>_6z}xdtZBa{U;j~rӨO_0PQvsV'QmMOC;=^ٗ"7zoGJ'j?--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9L v7sl:_a+馛oI^^?ߍ8w\'1%k)oyT)ENi,`:v5 Px>ѮHL5:ra7icL"H{5:]6nf99';~(Ίs~Lׯo_7\z}RÕ<O^^gΜy%t$;n;pV7ibС[+V8pK!DVV֓O>yfs9?ロ\qxӧr>=f]H0)*{N ظlR$0T28J0 $\IB. ` >a"H"{b{!dBpq|,&1ĐH8v X]rSɷFDݎ $egggggcʆ=dȐ#Z9$Sۦi䜧҅l,+5i$u?k٦=O)r$I^_^14A.2@ $ $\W寧;ds0 HdkRsDQ2pl o^'ۤx89Qcpזnɥq{=jS3XL(Nw WX- 3AvWv|#\FFӉEsym&@[U)0{\EC[(L#‚*`(^‘yk 䰪gDF$s&K*ZdJb۠Ȓ[ Y"2IK0Ȑ$* t~l n/?G=_-WJQdKɯLu9ìsb/ X"M~rըMMMQKV$GHUi]}mg},3Kak>>ʇŐl$6LP_6ukCr*Kq"* :./Ҥ 8\rᦪMmAݒSY1& q"HrӋ2:pC~mӾd_"leɌI1mH tnrI~^÷W6nZmq;_hKyia93'M/bSsl}S|K^;-0"1bQXK*Ic ytr|q!cFH32ᠴ[4;fa@,y|"c8>vIENDB`felix-shell-1.4.2/doc/apache-felix-shell-service_files/mail_small.gif000066400000000000000000000003121155660226500255570ustar00rootroot00000000000000GIF89a fffәstsቈ}~}!, G"( Ģ j31/QoA!~ BAp0v78X! OxctZn;felix-shell-1.4.2/doc/apache-felix-shell-service_files/site.css000066400000000000000000000030471155660226500244440ustar00rootroot00000000000000/* @override http://felix.apache.org/site/media.data/site.css */ body { background-color: #ffffff; color: #3b3b3b; font-family: Tahoma, Arial, sans-serif; font-size: 10pt; line-height: 140% } h1, h2, h3, h4, h5, h6 { font-weight: normal; color: #000000; line-height: 100%; margin-top: 0px} h1 { font-size: 200% } h2 { font-size: 175% } h3 { font-size: 150% } h4 { font-size: 140% } h5 { font-size: 130% } h6 { font-size: 120% } a { color: #1980af } a:visited { color: #1980af } a:hover { color: #1faae9 } .title { position: absolute; left: 1px; right: 1px; top:25px; height: 81px; background: url(http://felix.apache.org/site/media.data/gradient.png) repeat-x; background-position: bottom; } .logo { position: absolute; width: 15em; height: 81px; text-align: center; } .header { text-align: right; margin-right: 20pt; margin-top: 30pt;} .menu { border-top: 10px solid #f9bb00; position: absolute; top: 107px; left: 1px; width: 15em; bottom: 0px; padding: 0px; background-color: #fcfcfc } .menu ul { background-color: #fdf5d9; list-style: none; padding-left: 4em; margin-top: 0px; padding-top: 2em; padding-bottom: 2em; margin-left: 0px; color: #4a4a43} .menu a { text-decoration: none; color: #4a4a43 } .main { position: absolute; border-top: 10px solid #cde0ea; top: 107px; left: 15em; right: 1px; margin-left: 2px; padding-right: 4em; padding-left: 1em; padding-top: 1em;} .code { background-color: #eeeeee; border: solid 1px black; padding: 0.5em } .code-keyword { color: #880000 } .code-quote { color: #008800 } .code-object { color: #0000dd } .code-java { margin: 0em }felix-shell-1.4.2/doc/changelog.txt000066400000000000000000000052501155660226500172010ustar00rootroot00000000000000Changes from 1.4.1 to 1.4.2 --------------------------- ** Improvement * [FELIX-1987] - Stacktraces are not displayed by the "log" Felix shell command Changes from 1.4.0 to 1.4.1 --------------------------- ** Bug * [FELIX-1653] - [Shell] The new sysprop command does not allow to delete a system property * [FELIX-1662] - find returns invalid level for bundles and find all returns strange listing * [FELIX-1699] - The 'version' shell command is framework specific ** Improvement * [FELIX-1561] - [Shell] Add a command to display and modify system properties with the Felix Shell ** Task * [FELIX-1617] - Modify framework, main, shell, shell.tui, and obr to depend on official OSGi JAR files Changes from 1.2.0 to 1.4.0 --------------------------- ** Bug * [FELIX-1019] - New shell commands "requirers" and "exports" do not handle invalid bundle case properly ** Improvement * [FELIX-1058] - [PATCH] Add a "find" command to the shell * [FELIX-1145] - Modify help shell command to avoid issues with long command descriptions * [FELIX-1151] - Improve naming and consistency of shell commands for inspecting dependencies ** New Feature * [FELIX-1052] - Add log shell command * [FELIX-1181] - Add support for activation policy in shell "start" command * [FELIX-1510] - There is no command to set the initial bundle start level Changes from 1.0.2 to 1.2.0 --------------------------- ** Bug * [FELIX-703] - Cannot install ShellGUIPlugin with OBR ** Improvement * [FELIX-669] - Shell & Shell TUI OBR descriptions * [FELIX-1008] - Rename "packages" command to "exports" to match better with new "imports" command ** New Feature * [FELIX-741] - Modify shell start/stop commands to support transient starting/stopping of bundles * [FELIX-1006] - Add command to shell to list a bundles imported packages * [FELIX-1009] - Add requires/requirers commands to shell Changes from 1.0.1 to 1.0.2 --------------------------- * [2008-08-12] Added OBR descriptor and updated to bundle plugin version 1.4.3. (FELIX-669) * [2008-05-08] Modified "update" command to not append ".jar" to URLs and modified the "install" command to use the same code. (FELIX-544) Changes from 1.0.0 to 1.0.1 --------------------------- * [2008-04-21] Re-release to make bytecode executable on jre 1.3. Changes from 0.8.0-incubator to 1.0.0 ------------------------------------- * [2006-12-15] Changed the symbolic name, since it was being calculated incorrectly. * [2007-05-03] Modified 'ps' so that it displays reasonable defaults if headers are missing. Also added ability to display symbolic name. * [2007-06-14] Modified refresh command to accept bundle IDs. felix-shell-1.4.2/obr.xml000066400000000000000000000027371155660226500152570ustar00rootroot00000000000000 Import Service org.apache.felix.shell.Command Import Service org.ungoverned.osgi.service.shell.Command

felix-shell-1.4.2/pom.xml000066400000000000000000000072471155660226500152710ustar00rootroot00000000000000 org.apache.felix felix-parent 1.2.0 ../pom/pom.xml 4.0.0 bundle Apache Felix Shell Service A simple OSGi command shell service. org.apache.felix.shell 1.4.2 org.osgi org.osgi.core 4.1.0 org.osgi org.osgi.compendium 4.0.0 org.apache.felix maven-bundle-plugin 1.4.3 true org.osgi.service.log, org.apache.felix.shell; org.ungoverned.osgi.service.shell; version=1.0.0 org.apache.felix.* ${pom.artifactId} org.apache.felix.shell.impl.Activator The Apache Software Foundation org.apache.felix.shell.ShellService, org.ungoverned.osgi.service.shell.ShellService org.osgi.service.startlevel.StartLevel, org.osgi.service.packageadmin.PackageAdmin org.codehaus.mojo rat-maven-plugin false true true doc/* maven-eclipse.xml .checkstyle .externalToolBuilders/* scm:svn:https://svn.apache.org/repos/asf/felix/releases/org.apache.felix.shell-1.4.2 scm:svn:https://svn.apache.org/repos/asf/felix/releases/org.apache.felix.shell-1.4.2 scm:svn:https://svn.apache.org/repos/asf/felix/releases/org.apache.felix.shell-1.4.2 felix-shell-1.4.2/src/000077500000000000000000000000001155660226500145315ustar00rootroot00000000000000felix-shell-1.4.2/src/main/000077500000000000000000000000001155660226500154555ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/000077500000000000000000000000001155660226500163765ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/000077500000000000000000000000001155660226500171655ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/apache/000077500000000000000000000000001155660226500204065ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/apache/felix/000077500000000000000000000000001155660226500215155ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/apache/felix/shell/000077500000000000000000000000001155660226500226245ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/apache/felix/shell/CdCommand.java000066400000000000000000000035571155660226500253260ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell; /** * This interface defines the cd command service interface for the * Felix impl service. The cd command does not really change the * directory of the impl, rather it maintains a base URL for * simplifying URL entry. *

* For example, if the base URL is http://www.foo.com/ and you * try to install a bundle foo.jar, the actual URL will be * expanded to http://www.foo.com/foo.jar. Any bundles wishing * to retrieve or set the current directory of the impl can use this * service interface. **/ public interface CdCommand extends Command { /** * Property used to configure the base URL. **/ public static final String BASE_URL_PROPERTY = "felix.shell.baseurl"; /** * Returns the current directory of the impl service. * @return the current impl directory. **/ public String getBaseURL(); /** * Sets the current directory of the impl service. * @param s the new value for the base URL. **/ public void setBaseURL(String s); } felix-shell-1.4.2/src/main/java/org/apache/felix/shell/Command.java000066400000000000000000000051751155660226500250550ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell; import java.io.PrintStream; /** * This interface is used to define commands for the Felix impl * service. Any bundle wishing to create commands for the * impl service simply needs to create a service object that * implements this interface and then register it with the OSGi * framework. The impl service automatically includes any * registered command services in its list of available commands. **/ public interface Command { /** * Returns the name of the command that is implemented by the * interface. The command name should not contain whitespace * and should also be unique. * @return the name of the command. **/ public String getName(); /** * Returns the usage string for the command. The usage string is * a short string that illustrates how to use the command on the * command line. This information is used when generating command * help information. An example usage string for the install * command is: *

     *     install  [ ...]
     * 
* @return the usage string for the command. **/ public String getUsage(); /** * Returns a short description of the command; this description * should be as short as possible. This information is used when * generating the command help information. * @return a short description of the command. **/ public String getShortDescription(); /** * Executes the command using the supplied command line, output * print stream, and error print stream. * @param line the complete command line, including the command name. * @param out the print stream to use for standard output. * @param err the print stream to use for standard error. **/ public void execute(String line, PrintStream out, PrintStream err); } felix-shell-1.4.2/src/main/java/org/apache/felix/shell/ShellService.java000066400000000000000000000076161155660226500260710ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell; import java.io.PrintStream; import org.osgi.framework.ServiceReference; /** * This interface defines the Felix impl service. The impl service * is an extensible, user interface neutral impl for controlling and * interacting with the framework. In general, the impl service assumes that * it is operating in a command line fashion, i.e., it receives a * complete command line, parses it, and executes the corresponding * command, but graphical interfaces are also possible. *

* All commands in the impl service are actually implemented as OSGi * services; these services implement the Command service * interface. Any bundle can implement custom commands by creating * command services and registering them with the OSGi framework. **/ public interface ShellService { /** * Returns an array of command names available in the impl service. * @return an array of available command names or an empty array. **/ public String[] getCommands(); /** * Returns the usage string associated with the specified command name. * @param name the name of the target command. * @return the usage string of the specified command or null. **/ public String getCommandUsage(String name); /** * Returns the description associated with the specified command name. * @param name the name of the target command. * @return the description of the specified command or null. **/ public String getCommandDescription(String name); /** * Returns the service reference associated with the specified * command name. * @param name the name of the target command. * @return the description of the specified command or null. **/ public ServiceReference getCommandReference(String name); /** * * This method executes the supplied command line using the * supplied output and error print stream. The assumption of * this method is that a command line will be typed by the user * (or perhaps constructed by a GUI) and passed into it for * execution. The command line is interpretted in a very * simplistic fashion; it takes the leading string of characters * terminated by a space character (not including it) and * assumes that this leading token is the command name. For an * example, consider the following command line: *

*
     *     update 3 http://www.foo.com/bar.jar
     * 
*

* This is interpretted as an update command; as a * result, the entire command line (include command name) is * passed into the execute() method of the command * service with the name update if one exists. If the * corresponding command service is not found, then an error * message is printed to the error print stream. * @param commandLine the command line to execute. * @param out the standard output print stream. * @param err the standard error print stream. **/ public void executeCommand( String commandLine, PrintStream out, PrintStream err) throws Exception; }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/000077500000000000000000000000001155660226500235655ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/Activator.java000066400000000000000000000313611155660226500263700ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.security.*; import java.util.*; import org.apache.felix.shell.Command; import org.osgi.framework.*; public class Activator implements BundleActivator { private transient BundleContext m_context = null; private transient ShellServiceImpl m_shell = null; public void start(BundleContext context) { m_context = context; // Register impl service implementation. String[] classes = { org.apache.felix.shell.ShellService.class.getName(), org.ungoverned.osgi.service.shell.ShellService.class.getName() }; context.registerService(classes, m_shell = new ShellServiceImpl(), null); // Listen for registering/unregistering of impl command // services so that we can automatically add/remove them // from our list of available commands. ServiceListener sl = new ServiceListener() { public void serviceChanged(ServiceEvent event) { if (event.getType() == ServiceEvent.REGISTERED) { m_shell.addCommand(event.getServiceReference()); } else if (event.getType() == ServiceEvent.UNREGISTERING) { m_shell.removeCommand(event.getServiceReference()); } else { } } }; try { m_context.addServiceListener(sl, "(|(objectClass=" + org.apache.felix.shell.Command.class.getName() + ")(objectClass=" + org.ungoverned.osgi.service.shell.Command.class.getName() + "))"); } catch (InvalidSyntaxException ex) { System.err.println("Activator: Cannot register service listener."); System.err.println("Activator: " + ex); } // Now manually try to find any commands that have already // been registered (i.e., we didn't see their service events). initializeCommands(); // Register "bundlelevel" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new BundleLevelCommandImpl(m_context), null); // Register "cd" command service. classes = new String[2]; classes[0] = org.apache.felix.shell.Command.class.getName(); classes[1] = org.apache.felix.shell.CdCommand.class.getName(); context.registerService( classes, new CdCommandImpl(m_context), null); // Register "find" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new FindCommandImpl(m_context), null); // Register "headers" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new HeadersCommandImpl(m_context), null); // Register "help" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new HelpCommandImpl(m_context), null); // Register "inspect" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new InspectCommandImpl(m_context), null); // Register "install" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new InstallCommandImpl(m_context), null); // Register "log" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new LogCommandImpl(m_context), null); // Register "ps" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new PsCommandImpl(m_context), null); // Register "refresh" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new RefreshCommandImpl(m_context), null); // Register "resolve" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new ResolveCommandImpl(m_context), null); // Register "startlevel" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new StartLevelCommandImpl(m_context), null); // Register "shutdown" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new ShutdownCommandImpl(m_context), null); // Register "start" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new StartCommandImpl(m_context), null); // Register "stop" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new StopCommandImpl(m_context), null); // Register "sysprop" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new SystemPropertiesCommandImpl(), null); // Register "uninstall" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new UninstallCommandImpl(m_context), null); // Register "update" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new UpdateCommandImpl(m_context), null); // Register "version" command service. context.registerService( org.apache.felix.shell.Command.class.getName(), new VersionCommandImpl(m_context), null); } public void stop(BundleContext context) { m_shell.clearCommands(); } private void initializeCommands() { synchronized (m_shell) { try { ServiceReference[] refs = m_context.getServiceReferences( org.apache.felix.shell.Command.class.getName(), null); if (refs != null) { for (int i = 0; i < refs.length; i++) { m_shell.addCommand(refs[i]); } } } catch (Exception ex) { System.err.println("Activator: " + ex); } } } private class ShellServiceImpl implements org.apache.felix.shell.ShellService, org.ungoverned.osgi.service.shell.ShellService { private HashMap m_commandRefMap = new HashMap(); private TreeMap m_commandNameMap = new TreeMap(); public synchronized String[] getCommands() { Set ks = m_commandNameMap.keySet(); String[] cmds = (ks == null) ? new String[0] : (String[]) ks.toArray(new String[ks.size()]); return cmds; } public synchronized String getCommandUsage(String name) { Command command = (Command) m_commandNameMap.get(name); return (command == null) ? null : command.getUsage(); } public synchronized String getCommandDescription(String name) { Command command = (Command) m_commandNameMap.get(name); return (command == null) ? null : command.getShortDescription(); } public synchronized ServiceReference getCommandReference(String name) { ServiceReference ref = null; Iterator itr = m_commandRefMap.entrySet().iterator(); while (itr.hasNext()) { Map.Entry entry = (Map.Entry) itr.next(); if (((Command) entry.getValue()).getName().equals(name)) { ref = (ServiceReference) entry.getKey(); break; } } return ref; } public synchronized void removeCommand(ServiceReference ref) { Command command = (Command) m_commandRefMap.remove(ref); if (command != null) { m_commandNameMap.remove(command.getName()); } } public synchronized void executeCommand( String commandLine, PrintStream out, PrintStream err) throws Exception { commandLine = commandLine.trim(); String commandName = (commandLine.indexOf(' ') >= 0) ? commandLine.substring(0, commandLine.indexOf(' ')) : commandLine; Command command = getCommand(commandName); if (command != null) { if (System.getSecurityManager() != null) { try { AccessController.doPrivileged( new ExecutePrivileged(command, commandLine, out, err)); } catch (PrivilegedActionException ex) { throw ex.getException(); } } else { try { command.execute(commandLine, out, err); } catch (Throwable ex) { err.println("Unable to execute command: " + ex); ex.printStackTrace(err); } } } else { err.println("Command not found."); } } protected synchronized Command getCommand(String name) { Command command = (Command) m_commandNameMap.get(name); return (command == null) ? null : command; } protected synchronized void addCommand(ServiceReference ref) { Object cmdObj = m_context.getService(ref); Command command = (cmdObj instanceof org.ungoverned.osgi.service.shell.Command) ? new OldCommandWrapper((org.ungoverned.osgi.service.shell.Command) cmdObj) : (Command) cmdObj; m_commandRefMap.put(ref, command); m_commandNameMap.put(command.getName(), command); } protected synchronized void clearCommands() { m_commandRefMap.clear(); m_commandNameMap.clear(); } } private static class OldCommandWrapper implements Command { private org.ungoverned.osgi.service.shell.Command m_oldCommand = null; public OldCommandWrapper(org.ungoverned.osgi.service.shell.Command oldCommand) { m_oldCommand = oldCommand; } public String getName() { return m_oldCommand.getName(); } public String getUsage() { return m_oldCommand.getUsage(); } public String getShortDescription() { return m_oldCommand.getShortDescription(); } public void execute(String line, PrintStream out, PrintStream err) { m_oldCommand.execute(line, out, err); } } public static class ExecutePrivileged implements PrivilegedExceptionAction { private Command m_command = null; private String m_commandLine = null; private PrintStream m_out = null; private PrintStream m_err = null; public ExecutePrivileged( Command command, String commandLine, PrintStream out, PrintStream err) throws Exception { m_command = command; m_commandLine = commandLine; m_out = out; m_err = err; } public Object run() throws Exception { m_command.execute(m_commandLine, m_out, m_err); return null; } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/BundleLevelCommandImpl.java000066400000000000000000000145321155660226500307570ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.osgi.framework.*; import org.osgi.service.startlevel.StartLevel; public class BundleLevelCommandImpl implements Command { private static final String INITIAL_LEVEL_SWITCH = "-i"; private BundleContext m_context = null; public BundleLevelCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "bundlelevel"; } public String getUsage() { return "bundlelevel ... | | -i "; } public String getShortDescription() { return "set/get bundle start level or set initial bundle start level."; } public void execute(String s, PrintStream out, PrintStream err) { // Get start level service. ServiceReference ref = m_context.getServiceReference( org.osgi.service.startlevel.StartLevel.class.getName()); if (ref == null) { out.println("StartLevel service is unavailable."); return; } StartLevel sl = (StartLevel) m_context.getService(ref); if (sl == null) { out.println("StartLevel service is unavailable."); return; } // Parse command line. StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // If there is only one token, then assume it is // a bundle ID for which we must retrieve the bundle // level. if (st.countTokens() == 1) { // Get the bundle and display start level. Bundle bundle = null; String token = null; try { token = st.nextToken(); long id = Long.parseLong(token); bundle = m_context.getBundle(id); if (bundle != null) { out.println("Bundle " + token + " is level " + sl.getBundleStartLevel(bundle)); } else { err.println("Bundle ID " + token + " is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse integer '" + token + "'."); } catch (Exception ex) { err.println(ex.toString()); } } // If there is more than one token, assume the first // token is the new start level and the remaining // tokens are the bundle IDs whose start levels should // be changed. else if (st.countTokens() > 1) { // Get the bundle. Bundle bundle = null; String token = null; int startLevel = -1; token = st.nextToken().trim(); // If next token is the initial level switch, // then set it. if (token.equals(INITIAL_LEVEL_SWITCH)) { if (st.countTokens() == 1) { try { token = st.nextToken().trim(); startLevel = Integer.parseInt(token); sl.setInitialBundleStartLevel(startLevel); } catch (NumberFormatException ex) { err.println("Unable to parse start level '" + token + "'."); } } else { err.println("Incorrect number of arguments."); } } // Otherwise, set the start level for the specified bundles. else { try { startLevel = Integer.parseInt(token); } catch (NumberFormatException ex) { err.println("Unable to parse start level '" + token + "'."); } // Ignore invalid start levels. if (startLevel > 0) { // Set the start level for each specified bundle. while (st.hasMoreTokens()) { try { token = st.nextToken(); long id = Long.parseLong(token); bundle = m_context.getBundle(id); if (bundle != null) { sl.setBundleStartLevel(bundle, startLevel); } else { err.println("Bundle ID '" + token + "' is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse bundle ID '" + token + "'."); } catch (Exception ex) { err.println(ex.toString()); } } } else { err.println("Invalid start level."); } } } else { err.println("Incorrect number of arguments."); } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/CdCommandImpl.java000066400000000000000000000044451155660226500271060ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.felix.shell.CdCommand; import org.osgi.framework.BundleContext; public class CdCommandImpl implements CdCommand { private BundleContext m_context = null; private String m_baseURL = ""; public CdCommandImpl(BundleContext context) { m_context = context; // See if the initial base URL is specified. String baseURL = m_context.getProperty(BASE_URL_PROPERTY); setBaseURL(baseURL); } public String getName() { return "cd"; } public String getUsage() { return "cd []"; } public String getShortDescription() { return "change or display base URL."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // No more tokens means to display the base URL, // otherwise set the base URL. if (st.countTokens() == 0) { out.println(m_baseURL); } else if (st.countTokens() == 1) { setBaseURL(st.nextToken()); } else { err.println("Incorrect number of arguments"); } } public String getBaseURL() { return m_baseURL; } public void setBaseURL(String s) { m_baseURL = (s == null) ? "" : s; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/FindCommandImpl.java000066400000000000000000000062601155660226500274350ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; import org.osgi.service.startlevel.StartLevel; /** * Shell command to display a list of bundles whose * Bundle-Name or Bundle-Symbolic-Name contains * a specified string * */ public class FindCommandImpl extends PsCommandImpl { public FindCommandImpl(BundleContext context) { super(context); } public void execute(String line, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(line); if (st.countTokens() < 2) { out.println("Please specify a bundle name"); return; } // Get start level service. ServiceReference ref = m_context.getServiceReference( org.osgi.service.startlevel.StartLevel.class.getName()); StartLevel sl = null; if (ref != null) { sl = (StartLevel) m_context.getService(ref); } if (sl == null) { out.println("StartLevel service is unavailable."); } st.nextToken(); String pattern = st.nextToken(); Bundle[] bundles = m_context.getBundles(); List found = new ArrayList(); for (int i = 0; i < bundles.length; i++) { Bundle bundle = bundles[i]; String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME); if (match(bundle.getSymbolicName(), pattern) || match(name, pattern)) { found.add(bundle); } } if (found.size() > 0) { printBundleList((Bundle[]) found.toArray(new Bundle[found.size()]), sl, out, false, false, false); } else { out.println("No matching bundles found"); } } private boolean match(String name, String pattern) { return name != null && name.toLowerCase().contains(pattern.toLowerCase()); } public String getName() { return "find"; } public String getShortDescription() { return "find bundles by name."; } public String getUsage() { return "find "; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/HeadersCommandImpl.java000066400000000000000000000064121155660226500301270ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.*; import org.apache.felix.shell.Command; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; public class HeadersCommandImpl implements Command { private BundleContext m_context = null; public HeadersCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "headers"; } public String getUsage() { return "headers [ ...]"; } public String getShortDescription() { return "display bundle header properties."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // Print the specified bundles or all if none are specified. if (st.hasMoreTokens()) { while (st.hasMoreTokens()) { String id = st.nextToken().trim(); try { long l = Long.parseLong(id); Bundle bundle = m_context.getBundle(l); if (bundle != null) { printHeaders(out, bundle); } else { err.println("Bundle ID " + id + " is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse id '" + id + "'."); } catch (Exception ex) { err.println(ex.toString()); } } } else { Bundle[] bundles = m_context.getBundles(); for (int i = 0; i < bundles.length; i++) { printHeaders(out, bundles[i]); } } } private void printHeaders(PrintStream out, Bundle bundle) { String title = Util.getBundleName(bundle); out.println("\n" + title); out.println(Util.getUnderlineString(title)); Dictionary dict = bundle.getHeaders(); Enumeration keys = dict.keys(); while (keys.hasMoreElements()) { Object k = (String) keys.nextElement(); Object v = dict.get(k); out.println(k + " = " + Util.getValueString(v)); } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/HelpCommandImpl.java000066400000000000000000000077461155660226500274570ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.apache.felix.shell.ShellService; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; public class HelpCommandImpl implements Command { private BundleContext m_context = null; public HelpCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "help"; } public String getUsage() { return "help [ ...]"; } public String getShortDescription() { return "display available command usage and description."; } public void execute(String s, PrintStream out, PrintStream err) { try { // Get a reference to the impl service. ServiceReference ref = m_context.getServiceReference( org.apache.felix.shell.ShellService.class.getName()); if (ref != null) { ShellService ss = (ShellService) m_context.getService(ref); // Parse command line. StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); if (!st.hasMoreTokens()) { String[] cmds = ss.getCommands(); for (int i = 0; i < cmds.length; i++) { out.println(cmds[i]); } out.println("\nUse 'help ' for more information."); } else { String[] cmds = ss.getCommands(); String[] targets = new String[st.countTokens()]; for (int i = 0; i < targets.length; i++) { targets[i] = st.nextToken().trim(); } boolean found = false; for (int cmdIdx = 0; (cmdIdx < cmds.length); cmdIdx++) { for (int targetIdx = 0; targetIdx < targets.length; targetIdx++) { if (cmds[cmdIdx].equals(targets[targetIdx])) { if (found) { out.println("---"); } found = true; out.println("Command : " + cmds[cmdIdx]); out.println("Usage : " + ss.getCommandUsage(cmds[cmdIdx])); out.println("Description : " + ss.getCommandDescription(cmds[cmdIdx])); } } } } } else { err.println("No ShellService is unavailable."); } } catch (Exception ex) { err.println(ex.toString()); } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/InspectCommandImpl.java000066400000000000000000000704021155660226500301610ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; import org.osgi.service.packageadmin.ExportedPackage; import org.osgi.service.packageadmin.PackageAdmin; import org.osgi.service.packageadmin.RequiredBundle; public class InspectCommandImpl implements Command { public static final String PACKAGE_TYPE = "package"; public static final String BUNDLE_TYPE = "bundle"; public static final String FRAGMENT_TYPE = "fragment"; public static final String SERVICE_TYPE = "service"; public static final String CAPABILITY = "capability"; public static final String REQUIREMENT = "requirement"; private final BundleContext m_context; private ServiceReference m_ref = null; public InspectCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "inspect"; } public String getUsage() { return "inspect (package|bundle|fragment|service) (capability|requirement) [ ...]"; } public String getShortDescription() { return "inspects dependency information."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); if (st.countTokens() < 2) { out.println("Too few arguments."); out.println(getUsage()); } else { // Get dependency type. String type = st.nextToken(); // Get dependency direction. String direction = st.nextToken(); // Get target bundle identifiers. String[] ids = new String[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { ids[i] = st.nextToken().trim(); } // Verify arguments. if (isValidType(type) && isValidDirection(direction)) { // Now determine what needs to be printed. if (PACKAGE_TYPE.startsWith(type)) { if (CAPABILITY.startsWith(direction)) { printExportedPackages(ids, out, err); } else { printImportedPackages(ids, out, err); } } else if (BUNDLE_TYPE.startsWith(type)) { if (CAPABILITY.startsWith(direction)) { printRequiringBundles(ids, out, err); } else { printRequiredBundles(ids, out, err); } } else if (FRAGMENT_TYPE.startsWith(type)) { if (CAPABILITY.startsWith(direction)) { printFragmentHosts(ids, out, err); } else { printHostedFragments(ids, out, err); } } else { if (CAPABILITY.startsWith(direction)) { printExportedServices(ids, out, err); } else { printImportedServices(ids, out, err); } } } else { if (!isValidType(type)) { out.println("Invalid argument: " + type); } if (!isValidDirection(direction)) { out.println("Invalid argument: " + direction); } } } } private void printExportedPackages(String[] ids, PrintStream out, PrintStream err) { PackageAdmin pa = getPackageAdmin(); if (pa == null) { out.println("PackageAdmin service is unavailable."); } else { boolean separatorNeeded = false; Bundle[] bundles = null; if ((ids == null) || (ids.length == 0)) { bundles = m_context.getBundles(); } else { bundles = new Bundle[ids.length]; for (int idIdx = 0; idIdx < ids.length; idIdx++) { try { long l = Long.parseLong(ids[idIdx]); Bundle b = m_context.getBundle(l); if (b == null) { err.println("Bundle ID " + ids[idIdx] + " is invalid."); } bundles[idIdx] = b; } catch (NumberFormatException ex) { err.println("Unable to parse id '" + ids[idIdx] + "'."); } } } for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++) { try { if (bundles[bundleIdx] != null) { ExportedPackage[] exports = pa.getExportedPackages(bundles[bundleIdx]); if (separatorNeeded) { out.println(""); } String title = bundles[bundleIdx] + " exports packages:"; out.println(title); out.println(Util.getUnderlineString(title)); if ((exports != null) && (exports.length > 0)) { for (int expIdx = 0; expIdx < exports.length; expIdx++) { out.println(exports[expIdx]); } } else { out.println("Nothing"); } separatorNeeded = true; } } catch (Exception ex) { err.println(ex.toString()); } } } ungetPackageAdmin(); } private void printImportedPackages(String[] ids, PrintStream out, PrintStream err) { boolean separatorNeeded = false; Bundle[] bundles = null; if ((ids == null) || (ids.length == 0)) { bundles = m_context.getBundles(); } else { bundles = new Bundle[ids.length]; for (int idIdx = 0; idIdx < ids.length; idIdx++) { try { long l = Long.parseLong(ids[idIdx]); Bundle b = m_context.getBundle(l); if (b == null) { err.println("Bundle ID " + ids[idIdx] + " is invalid."); } bundles[idIdx] = b; } catch (NumberFormatException ex) { err.println("Unable to parse id '" + ids[idIdx] + "'."); } } } for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++) { try { if (bundles[bundleIdx] != null) { if (separatorNeeded) { out.println(""); } _printImportedPackages(bundles[bundleIdx], out, err); separatorNeeded = true; } } catch (Exception ex) { err.println(ex.toString()); } } } private void _printImportedPackages(Bundle bundle, PrintStream out, PrintStream err) { // Get package admin service. PackageAdmin pa = getPackageAdmin(); if (pa == null) { out.println("PackageAdmin service is unavailable."); } else { ExportedPackage[] exports = pa.getExportedPackages((Bundle) null); String title = bundle + " imports packages:"; out.println(title); out.println(Util.getUnderlineString(title)); boolean found = false; for (int expIdx = 0; expIdx < exports.length; expIdx++) { Bundle[] importers = exports[expIdx].getImportingBundles(); for (int impIdx = 0; (importers != null) && (impIdx < importers.length); impIdx++) { if (importers[impIdx] == bundle) { out.println(exports[expIdx] + " -> " + exports[expIdx].getExportingBundle()); found = true; } } } if (!found) { out.println("Nothing"); } ungetPackageAdmin(); } } private void printRequiringBundles(String[] ids, PrintStream out, PrintStream err) { PackageAdmin pa = getPackageAdmin(); if (pa == null) { out.println("PackageAdmin service is unavailable."); } else { boolean separatorNeeded = false; Bundle[] bundles = null; if ((ids == null) || (ids.length == 0)) { bundles = m_context.getBundles(); } else { bundles = new Bundle[ids.length]; for (int idIdx = 0; idIdx < ids.length; idIdx++) { try { long l = Long.parseLong(ids[idIdx]); Bundle b = m_context.getBundle(l); if (b == null) { err.println("Bundle ID " + ids[idIdx] + " is invalid."); } bundles[idIdx] = b; } catch (NumberFormatException ex) { err.println("Unable to parse id '" + ids[idIdx] + "'."); } } } for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++) { try { if (bundles[bundleIdx] != null) { RequiredBundle[] rbs = pa.getRequiredBundles( bundles[bundleIdx].getSymbolicName()); for (int rbIdx = 0; (rbs != null) && (rbIdx < rbs.length); rbIdx++) { if (rbs[rbIdx].getBundle() == bundles[bundleIdx]) { if (separatorNeeded) { out.println(""); } String title = bundles[bundleIdx] + " is required by:"; out.println(title); out.println(Util.getUnderlineString(title)); if ((rbs[rbIdx].getRequiringBundles() != null) && (rbs[rbIdx].getRequiringBundles().length > 0)) { for (int reqIdx = 0; reqIdx < rbs[rbIdx].getRequiringBundles().length; reqIdx++) { out.println(rbs[rbIdx].getRequiringBundles()[reqIdx]); } } else { out.println("Nothing"); } separatorNeeded = true; } } } } catch (Exception ex) { err.println(ex.toString()); } } } } private void printRequiredBundles(String[] ids, PrintStream out, PrintStream err) { boolean separatorNeeded = false; Bundle[] bundles = null; if ((ids == null) || (ids.length == 0)) { bundles = m_context.getBundles(); } else { bundles = new Bundle[ids.length]; for (int idIdx = 0; idIdx < ids.length; idIdx++) { try { long l = Long.parseLong(ids[idIdx]); Bundle b = m_context.getBundle(l); if (b == null) { err.println("Bundle ID " + ids[idIdx] + " is invalid."); } bundles[idIdx] = b; } catch (NumberFormatException ex) { err.println("Unable to parse id '" + ids[idIdx] + "'."); } } } for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++) { try { if (bundles[bundleIdx] != null) { if (separatorNeeded) { out.println(""); } _printRequiredBundles(bundles[bundleIdx], out, err); separatorNeeded = true; } } catch (Exception ex) { err.println(ex.toString()); } } } private void _printRequiredBundles(Bundle bundle, PrintStream out, PrintStream err) { // Get package admin service. PackageAdmin pa = getPackageAdmin(); if (pa == null) { out.println("PackageAdmin service is unavailable."); } else { RequiredBundle[] rbs = pa.getRequiredBundles(null); String title = bundle + " requires bundles:"; out.println(title); out.println(Util.getUnderlineString(title)); boolean found = false; for (int rbIdx = 0; rbIdx < rbs.length; rbIdx++) { Bundle[] requirers = rbs[rbIdx].getRequiringBundles(); for (int reqIdx = 0; (requirers != null) && (reqIdx < requirers.length); reqIdx++) { if (requirers[reqIdx] == bundle) { out.println(rbs[reqIdx]); found = true; } } } if (!found) { out.println("Nothing"); } ungetPackageAdmin(); } } private void printFragmentHosts(String[] ids, PrintStream out, PrintStream err) { PackageAdmin pa = getPackageAdmin(); if (pa == null) { out.println("PackageAdmin service is unavailable."); } else { Bundle[] bundles = null; if ((ids == null) || (ids.length == 0)) { bundles = m_context.getBundles(); } else { bundles = new Bundle[ids.length]; for (int idIdx = 0; idIdx < ids.length; idIdx++) { try { long l = Long.parseLong(ids[idIdx]); Bundle b = m_context.getBundle(l); if (b == null) { err.println("Bundle ID " + ids[idIdx] + " is invalid."); } bundles[idIdx] = b; } catch (NumberFormatException ex) { err.println("Unable to parse id '" + ids[idIdx] + "'."); } } } for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++) { // Print a separator for some whitespace. if (bundleIdx > 0) { out.println(""); } try { if ((bundles[bundleIdx] != null) && isFragment(bundles[bundleIdx])) { String title = bundles[bundleIdx] + " is attached to:"; out.println(title); out.println(Util.getUnderlineString(title)); Bundle[] hosts = pa.getHosts(bundles[bundleIdx]); for (int hostIdx = 0; (hosts != null) && (hostIdx < hosts.length); hostIdx++) { out.println(hosts[hostIdx]); } if ((hosts == null) || (hosts.length == 0)) { out.println("Nothing"); } } else if ((bundles[bundleIdx] != null) && !isFragment(bundles[bundleIdx])) { out.println("Bundle " + bundles[bundleIdx] + " is not a fragment."); } } catch (Exception ex) { err.println(ex.toString()); } } } } private void printHostedFragments(String[] ids, PrintStream out, PrintStream err) { PackageAdmin pa = getPackageAdmin(); if (pa == null) { out.println("PackageAdmin service is unavailable."); } else { Bundle[] bundles = null; if ((ids == null) || (ids.length == 0)) { bundles = m_context.getBundles(); } else { bundles = new Bundle[ids.length]; for (int idIdx = 0; idIdx < ids.length; idIdx++) { try { long l = Long.parseLong(ids[idIdx]); Bundle b = m_context.getBundle(l); if (b == null) { err.println("Bundle ID " + ids[idIdx] + " is invalid."); } bundles[idIdx] = b; } catch (NumberFormatException ex) { err.println("Unable to parse id '" + ids[idIdx] + "'."); } } } for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++) { // Print a separator for some whitespace. if (bundleIdx > 0) { out.println(""); } try { if ((bundles[bundleIdx] != null) && !isFragment(bundles[bundleIdx])) { String title = bundles[bundleIdx] + " hosts:"; out.println(title); out.println(Util.getUnderlineString(title)); Bundle[] fragments = pa.getFragments(bundles[bundleIdx]); for (int fragIdx = 0; (fragments != null) && (fragIdx < fragments.length); fragIdx++) { out.println(fragments[fragIdx]); } if ((fragments == null) || (fragments.length == 0)) { out.println("Nothing"); } } else if ((bundles[bundleIdx] != null) && isFragment(bundles[bundleIdx])) { out.println("Bundle " + bundles[bundleIdx] + " is a fragment."); } } catch (Exception ex) { err.println(ex.toString()); } } } } public void printExportedServices(String[] ids, PrintStream out, PrintStream err) { Bundle[] bundles = null; if ((ids == null) || (ids.length == 0)) { bundles = m_context.getBundles(); } else { bundles = new Bundle[ids.length]; for (int idIdx = 0; idIdx < ids.length; idIdx++) { try { long l = Long.parseLong(ids[idIdx]); Bundle b = m_context.getBundle(l); if (b == null) { err.println("Bundle ID " + ids[idIdx] + " is invalid."); } bundles[idIdx] = b; } catch (NumberFormatException ex) { err.println("Unable to parse id '" + ids[idIdx] + "'."); } } } for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++) { // Print a separator for some whitespace. if (bundleIdx > 0) { out.println(""); } try { if (bundles[bundleIdx] != null) { ServiceReference[] refs = bundles[bundleIdx].getRegisteredServices(); // Print header if we have not already done so. String title = Util.getBundleName(bundles[bundleIdx]) + " provides services:"; out.println(title); out.println(Util.getUnderlineString(title)); if ((refs == null) || (refs.length == 0)) { out.println("Nothing"); } // Print properties for each service. for (int refIdx = 0; (refs != null) && (refIdx < refs.length); refIdx++) { // Print service properties. String[] keys = refs[refIdx].getPropertyKeys(); for (int keyIdx = 0; (keys != null) && (keyIdx < keys.length); keyIdx++) { Object v = refs[refIdx].getProperty(keys[keyIdx]); out.println( keys[keyIdx] + " = " + Util.getValueString(v)); } // Print service separator if necessary. if ((refIdx + 1) < refs.length) { out.println("----"); } } } } catch (Exception ex) { err.println(ex.toString()); } } } public void printImportedServices(String[] ids, PrintStream out, PrintStream err) { Bundle[] bundles = null; if ((ids == null) || (ids.length == 0)) { bundles = m_context.getBundles(); } else { bundles = new Bundle[ids.length]; for (int idIdx = 0; idIdx < ids.length; idIdx++) { try { long l = Long.parseLong(ids[idIdx]); Bundle b = m_context.getBundle(l); if (b == null) { err.println("Bundle ID " + ids[idIdx] + " is invalid."); } bundles[idIdx] = b; } catch (NumberFormatException ex) { err.println("Unable to parse id '" + ids[idIdx] + "'."); } } } for (int bundleIdx = 0; bundleIdx < bundles.length; bundleIdx++) { // Print a separator for some whitespace. if (bundleIdx > 0) { out.println(""); } try { if (bundles[bundleIdx] != null) { ServiceReference[] refs = bundles[bundleIdx].getServicesInUse(); // Print header if we have not already done so. String title = Util.getBundleName(bundles[bundleIdx]) + " requires services:"; out.println(title); out.println(Util.getUnderlineString(title)); if ((refs == null) || (refs.length == 0)) { out.println("Nothing"); } // Print properties for each service. for (int refIdx = 0; (refs != null) && (refIdx < refs.length); refIdx++) { // Print the registering bundle. out.println("Registering bundle = " + refs[refIdx].getBundle()); // Print service properties. String[] keys = refs[refIdx].getPropertyKeys(); for (int keyIdx = 0; (keys != null) && (keyIdx < keys.length); keyIdx++) { Object v = refs[refIdx].getProperty(keys[keyIdx]); out.println( keys[keyIdx] + " = " + Util.getValueString(v)); } // Print service separator if necessary. if ((refIdx + 1) < refs.length) { out.println("----"); } } } } catch (Exception ex) { err.println(ex.toString()); } } } private PackageAdmin getPackageAdmin() { PackageAdmin pa = null; m_ref = m_context.getServiceReference( org.osgi.service.packageadmin.PackageAdmin.class.getName()); if (m_ref != null) { pa = (PackageAdmin) m_context.getService(m_ref); } return pa; } private void ungetPackageAdmin() { m_context.ungetService(m_ref); } private static boolean isValidType(String type) { return (PACKAGE_TYPE.startsWith(type) || BUNDLE_TYPE.startsWith(type) || FRAGMENT_TYPE.startsWith(type) || SERVICE_TYPE.startsWith(type)); } private static boolean isValidDirection(String direction) { return (CAPABILITY.startsWith(direction) || REQUIREMENT.startsWith(direction)); } private static boolean isFragment(Bundle bundle) { return bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/InstallCommandImpl.java000066400000000000000000000112571155660226500301650ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.net.MalformedURLException; import java.net.URL; import java.util.StringTokenizer; import org.apache.felix.shell.CdCommand; import org.apache.felix.shell.Command; import org.osgi.framework.*; public class InstallCommandImpl implements Command { private BundleContext m_context = null; public InstallCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "install"; } public String getUsage() { return "install [ ...]"; } public String getShortDescription() { return "install bundle(s)."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // There should be at least one URL. if (st.countTokens() >= 1) { StringBuffer sb = new StringBuffer(); while (st.hasMoreTokens()) { String location = st.nextToken().trim(); Bundle bundle = install(location, out, err); if (bundle != null) { if (sb.length() > 0) { sb.append(", "); } sb.append(bundle.getBundleId()); } } if (sb.toString().indexOf(',') > 0) { out.println("Bundle IDs: " + sb.toString()); } else if (sb.length() > 0) { out.println("Bundle ID: " + sb.toString()); } } else { err.println("Incorrect number of arguments"); } } protected Bundle install(String location, PrintStream out, PrintStream err) { String abs = absoluteLocation(location); if (abs == null) { err.println("Malformed location: " + location); } else { try { return m_context.installBundle(abs, null); } catch (IllegalStateException ex) { err.println(ex.toString()); } catch (BundleException ex) { if (ex.getNestedException() != null) { err.println(ex.getNestedException().toString()); } else { err.println(ex.toString()); } } catch (Exception ex) { err.println(ex.toString()); } } return null; } private String absoluteLocation(String location) { try { new URL(location); } catch (MalformedURLException ex) { // Try to create a valid URL using the base URL // contained in the "cd" command service. String baseURL = ""; try { // Get a reference to the "cd" command service. ServiceReference ref = m_context.getServiceReference( org.apache.felix.shell.CdCommand.class.getName()); if (ref != null) { CdCommand cd = (CdCommand) m_context.getService(ref); baseURL = cd.getBaseURL(); baseURL = (baseURL == null) ? "" : baseURL; m_context.ungetService(ref); } String theURL = baseURL + location; new URL(theURL); location = theURL; } catch (Exception ex2) { // Just fall through and return the original location. } } return location; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/LogCommandImpl.java000066400000000000000000000077111155660226500273000ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Enumeration; import org.apache.felix.shell.Command; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogEntry; import org.osgi.service.log.LogReaderService; /** * Apache Felix Shell command to display recent log entries */ public class LogCommandImpl implements Command { private final BundleContext m_bundleContext; public LogCommandImpl(BundleContext context) { m_bundleContext = context; } public void execute(String line, PrintStream out, PrintStream err) { LogOptions options = new LogOptions(line); ServiceReference ref = m_bundleContext.getServiceReference(LogReaderService.class.getName()); if (ref != null) { LogReaderService service = (LogReaderService) m_bundleContext.getService(ref); Enumeration entries = service.getLog(); int index = 0; while (entries.hasMoreElements() && (options.getMaxNumberOfLogs() < 0 | index < options.getMaxNumberOfLogs())) { LogEntry entry = (LogEntry) entries.nextElement(); if (entry.getLevel() <= options.getMinLevel()) { display(entry, out); index++; } } } else { out.println("No LogReaderService available"); } } private void display(LogEntry entry, PrintStream out) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); StringBuffer buffer = new StringBuffer(); buffer.append(sdf.format(new Date(entry.getTime()))).append(" "); buffer.append(levelAsAString(entry.getLevel())).append(" - "); buffer.append("Bundle: ").append(entry.getBundle().getSymbolicName()); if (entry.getServiceReference() != null) { buffer.append(" - "); buffer.append(entry.getServiceReference().toString()); } buffer.append(" - ").append(entry.getMessage()); if (entry.getException() != null) { buffer.append(" - "); StringWriter writer = new StringWriter(); PrintWriter pw = new PrintWriter(writer); entry.getException().printStackTrace(pw); buffer.append(writer.toString()); } out.println(buffer.toString()); } private String levelAsAString(int level) { switch (level) { case 1: return "ERROR"; case 2: return "WARNING"; case 3: return "INFO"; default: return "DEBUG"; } } public String getName() { return "log"; } public String getShortDescription() { return "list the most recent log entries."; } public String getUsage() { return "log [] [error | warn | info | debug]"; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/LogOptions.java000066400000000000000000000042111155660226500265230ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.util.StringTokenizer; /** * Parse and encapsulate command line options * */ public class LogOptions { private int minLevel = 4; private int maxNumberOfLogs = -1; public LogOptions(String commandLine) { StringTokenizer st = new StringTokenizer(commandLine); readOptions(st); } private void readOptions(StringTokenizer st) { if (st.countTokens() > 1) { st.nextToken(); String firstOption = st.nextToken(); checkOption(firstOption); if (st.hasMoreTokens()) { checkOption(st.nextToken()); } } } private void checkOption(String opt) { try { maxNumberOfLogs = Integer.parseInt(opt); } catch (NumberFormatException nfe) { //do nothing, it's not a number } if ("info".equalsIgnoreCase(opt)) { minLevel = 3; } else if ("warn".equalsIgnoreCase(opt)) { minLevel = 2; } else if ("error".equalsIgnoreCase(opt)) { minLevel = 1; } } public int getMinLevel() { return minLevel; } public int getMaxNumberOfLogs() { return maxNumberOfLogs; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/PsCommandImpl.java000066400000000000000000000152741155660226500271440ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; import org.osgi.service.startlevel.StartLevel; public class PsCommandImpl implements Command { private static final String LOCATION_SWITCH = "-l"; private static final String SYMBOLIC_NAME_SWITCH = "-s"; private static final String UPDATE_LOCATION_SWITCH = "-u"; protected final BundleContext m_context; public PsCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "ps"; } public String getUsage() { return "ps [" + LOCATION_SWITCH + " | " + SYMBOLIC_NAME_SWITCH + " | " + UPDATE_LOCATION_SWITCH + "]"; } public String getShortDescription() { return "list installed bundles."; } public void execute(String s, PrintStream out, PrintStream err) { // Get start level service. ServiceReference ref = m_context.getServiceReference( org.osgi.service.startlevel.StartLevel.class.getName()); StartLevel sl = null; if (ref != null) { sl = (StartLevel) m_context.getService(ref); } if (sl == null) { out.println("StartLevel service is unavailable."); } // Parse command line. StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // Check for optional argument. boolean showLoc = false; boolean showSymbolic = false; boolean showUpdate = false; if (st.countTokens() >= 1) { while (st.hasMoreTokens()) { String token = st.nextToken().trim(); if (token.equals(LOCATION_SWITCH)) { showLoc = true; } else if (token.equals(SYMBOLIC_NAME_SWITCH)) { showSymbolic = true; } else if (token.equals(UPDATE_LOCATION_SWITCH)) { showUpdate = true; } } } Bundle[] bundles = m_context.getBundles(); if (bundles != null) { printBundleList(bundles, sl, out, showLoc, showSymbolic, showUpdate); } else { out.println("There are no installed bundles."); } } protected void printBundleList( Bundle[] bundles, StartLevel startLevel, PrintStream out, boolean showLoc, boolean showSymbolic, boolean showUpdate) { // Display active start level. if (startLevel != null) { out.println("START LEVEL " + startLevel.getStartLevel()); } // Print column headers. String msg = " Name"; if (showLoc) { msg = " Location"; } else if (showSymbolic) { msg = " Symbolic name"; } else if (showUpdate) { msg = " Update location"; } String level = (startLevel == null) ? "" : " Level "; out.println(" ID " + " State " + level + msg); for (int i = 0; i < bundles.length; i++) { // Get the bundle name or location. String name = (String) bundles[i].getHeaders().get(Constants.BUNDLE_NAME); // If there is no name, then default to symbolic name. name = (name == null) ? bundles[i].getSymbolicName() : name; // If there is no symbolic name, resort to location. name = (name == null) ? bundles[i].getLocation() : name; // Overwrite the default value is the user specifically // requested to display one or the other. if (showLoc) { name = bundles[i].getLocation(); } else if (showSymbolic) { name = bundles[i].getSymbolicName(); name = (name == null) ? "" : name; } else if (showUpdate) { name = (String) bundles[i].getHeaders().get(Constants.BUNDLE_UPDATELOCATION); name = (name == null) ? bundles[i].getLocation() : name; } // Show bundle version if not showing location. String version = (String) bundles[i].getHeaders().get(Constants.BUNDLE_VERSION); name = (!showLoc && !showUpdate && (version != null)) ? name + " (" + version + ")" : name; long l = bundles[i].getBundleId(); String id = String.valueOf(l); if (startLevel == null) { level = "1"; } else { level = String.valueOf(startLevel.getBundleStartLevel(bundles[i])); } while (level.length() < 5) { level = " " + level; } while (id.length() < 4) { id = " " + id; } out.println("[" + id + "] [" + getStateString(bundles[i].getState()) + "] [" + level + "] " + name); } } public String getStateString(int i) { if (i == Bundle.ACTIVE) return "Active "; else if (i == Bundle.INSTALLED) return "Installed "; else if (i == Bundle.RESOLVED) return "Resolved "; else if (i == Bundle.STARTING) return "Starting "; else if (i == Bundle.STOPPING) return "Stopping "; return "Unknown "; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/RefreshCommandImpl.java000066400000000000000000000065731155660226500301620ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.List; import java.util.ArrayList; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.packageadmin.PackageAdmin; public class RefreshCommandImpl implements Command { private BundleContext m_context = null; public RefreshCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "refresh"; } public String getUsage() { return "refresh [ ...]"; } public String getShortDescription() { return "refresh packages."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // Refresh the specified bundles or all if none are specified. List bundleList = new ArrayList(); if (st.hasMoreTokens()) { while (st.hasMoreTokens()) { String id = st.nextToken().trim(); try { long l = Long.parseLong(id); Bundle bundle = m_context.getBundle(l); if (bundle != null) { bundleList.add(bundle); } else { err.println("Bundle ID " + id + " is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse id '" + id + "'."); } catch (Exception ex) { err.println(ex.toString()); } } } // Get package admin service. ServiceReference ref = m_context.getServiceReference( org.osgi.service.packageadmin.PackageAdmin.class.getName()); if (ref == null) { out.println("PackageAdmin service is unavailable."); return; } PackageAdmin pa = (PackageAdmin) m_context.getService(ref); if (pa == null) { out.println("PackageAdmin service is unavailable."); return; } pa.refreshPackages((bundleList.size() == 0) ? null : (Bundle[]) bundleList.toArray(new Bundle[bundleList.size()])); } } felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/ResolveCommandImpl.java000066400000000000000000000062721155660226500301770ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.*; import org.apache.felix.shell.Command; import org.osgi.framework.*; import org.osgi.service.packageadmin.PackageAdmin; public class ResolveCommandImpl implements Command { private BundleContext m_context = null; public ResolveCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "resolve"; } public String getUsage() { return "resolve [ ...]"; } public String getShortDescription() { return "attempt to resolve the specified bundles."; } public void execute(String s, PrintStream out, PrintStream err) { // Get package admin service. ServiceReference ref = m_context.getServiceReference( org.osgi.service.packageadmin.PackageAdmin.class.getName()); if (ref == null) { out.println("PackageAdmin service is unavailable."); return; } PackageAdmin pa = (PackageAdmin) m_context.getService(ref); if (pa == null) { out.println("PackageAdmin service is unavailable."); return; } // Array to hold the bundles. Bundle[] bundles = null; // Parse the bundle identifiers. StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); if (st.countTokens() >= 1) { List bundleList = new ArrayList(); while (st.hasMoreTokens()) { String id = st.nextToken().trim(); try { long l = Long.parseLong(id); Bundle bundle = m_context.getBundle(l); if (bundle != null) { bundleList.add(bundle); } else { err.println("Bundle ID " + id + " is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse id '" + id + "'."); } } if (bundleList.size() > 0) { bundles = (Bundle[]) bundleList.toArray(new Bundle[bundleList.size()]); } } pa.resolveBundles(bundles); } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/ShutdownCommandImpl.java000066400000000000000000000033321155660226500303650ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import org.apache.felix.shell.Command; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; public class ShutdownCommandImpl implements Command { private BundleContext m_context = null; public ShutdownCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "shutdown"; } public String getUsage() { return "shutdown"; } public String getShortDescription() { return "shutdown framework."; } public void execute(String s, PrintStream out, PrintStream err) { // Get system bundle and use it to shutdown Felix. try { Bundle bundle = m_context.getBundle(0); bundle.stop(); } catch (Exception ex) { err.println(ex.toString()); } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/StartCommandImpl.java000066400000000000000000000104641155660226500276530ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.osgi.framework.*; public class StartCommandImpl extends InstallCommandImpl implements Command { private static final String TRANSIENT_SWITCH = "-t"; private static final String POLICY_SWITCH = "-p"; private BundleContext m_context = null; public StartCommandImpl(BundleContext context) { super(context); m_context = context; } public String getName() { return "start"; } public String getUsage() { return "start [-t | -p] [ ...]"; } public String getShortDescription() { return "start bundle(s)."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // Put the remaining tokens into a list. List tokens = new ArrayList(); for (int i = 0; st.hasMoreTokens(); i++) { tokens.add(st.nextToken()); } // Default switch values. int options = 0; // Check for "transient" switch. if (tokens.contains(TRANSIENT_SWITCH)) { // Remove the switch and set boolean flag. tokens.remove(TRANSIENT_SWITCH); options |= Bundle.START_TRANSIENT; } // Check for "start policy" switch. if (tokens.contains(POLICY_SWITCH)) { // Remove the switch and set boolean flag. tokens.remove(POLICY_SWITCH); options |= Bundle.START_ACTIVATION_POLICY; } // There should be at least one bundle id. if (tokens.size() >= 1) { while (tokens.size() > 0) { String id = ((String) tokens.remove(0)).trim(); try { Bundle bundle = null; // The id may be a number or a URL, so check. if (Character.isDigit(id.charAt(0))) { long l = Long.parseLong(id); bundle = m_context.getBundle(l); } else { bundle = install(id, out, err); } if (bundle != null) { bundle.start(options); } else { err.println("Bundle ID " + id + " is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse id '" + id + "'."); } catch (BundleException ex) { if (ex.getNestedException() != null) { ex.printStackTrace(); err.println(ex.getNestedException().toString()); } else { err.println(ex.toString()); } } catch (Exception ex) { err.println(ex.toString()); } } } else { err.println("Incorrect number of arguments"); } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/StartLevelCommandImpl.java000066400000000000000000000054011155660226500306360ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.startlevel.StartLevel; public class StartLevelCommandImpl implements Command { private BundleContext m_context = null; public StartLevelCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "startlevel"; } public String getUsage() { return "startlevel []"; } public String getShortDescription() { return "get or set framework start level."; } public void execute(String s, PrintStream out, PrintStream err) { // Get start level service. ServiceReference ref = m_context.getServiceReference( org.osgi.service.startlevel.StartLevel.class.getName()); if (ref == null) { out.println("StartLevel service is unavailable."); return; } StartLevel sl = (StartLevel) m_context.getService(ref); if (sl == null) { out.println("StartLevel service is unavailable."); return; } // Parse command line. StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); if (st.countTokens() == 0) { out.println("Level " + sl.getStartLevel()); } else if (st.countTokens() >= 1) { String levelStr = st.nextToken().trim(); try { int level = Integer.parseInt(levelStr); sl.setStartLevel(level); } catch (NumberFormatException ex) { err.println("Unable to parse integer '" + levelStr + "'."); } catch (Exception ex) { err.println(ex.toString()); } } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/StopCommandImpl.java000066400000000000000000000070641155660226500275050ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.osgi.framework.*; public class StopCommandImpl implements Command { private static final String TRANSIENT_SWITCH = "-t"; private BundleContext m_context = null; public StopCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "stop"; } public String getUsage() { return "stop [-t] [ ...]"; } public String getShortDescription() { return "stop bundle(s)."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // Put the remaining tokens into a list. List tokens = new ArrayList(); for (int i = 0; st.hasMoreTokens(); i++) { tokens.add(st.nextToken()); } // Default switch value. int options = 0; // Check for "transient" switch. if (tokens.contains(TRANSIENT_SWITCH)) { // Remove the switch and set boolean flag. tokens.remove(TRANSIENT_SWITCH); options |= Bundle.STOP_TRANSIENT; } // There should be at least one bundle id. if (tokens.size() >= 1) { while (tokens.size() > 0) { String id = ((String) tokens.remove(0)).trim(); try { long l = Long.parseLong(id); Bundle bundle = m_context.getBundle(l); if (bundle != null) { bundle.stop(options); } else { err.println("Bundle ID " + id + " is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse id '" + id + "'."); } catch (BundleException ex) { if (ex.getNestedException() != null) { err.println(ex.getNestedException().toString()); } else { err.println(ex.toString()); } } catch (Exception ex) { err.println(ex.toString()); } } } else { err.println("Incorrect number of arguments"); } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/SystemPropertiesCommandImpl.java000066400000000000000000000060711155660226500321160ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.Iterator; import java.util.StringTokenizer; import org.apache.felix.shell.Command; /** * Command to display, set and modify system properties * Usage: * sysprop -> displays all the system properties * sysprop [key] -> displays the [key] property * sysprop -r [key] -> removes the [key] property * sysprop [key] [value] -> set the property [key] to [value] */ public class SystemPropertiesCommandImpl implements Command { private static final String REMOVE_PROP_SWITCH = "-r"; public void execute(String line, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(line); int tokens = st.countTokens(); if (tokens == 1) { printAll(out); } else { st.nextToken(); String secondArgument = st.nextToken(); if (tokens == 2) { out.println(secondArgument + "=" + System.getProperty(secondArgument)); } else if (tokens == 3) { if (REMOVE_PROP_SWITCH.equals(secondArgument)) { removeProperty(st.nextToken()); } else { String value = st.nextToken(); System.setProperty(secondArgument, value); out.println("Set " + secondArgument + "=" + value); } } } } private void printAll(PrintStream out) { out.println("-------System properties------"); for (Iterator keyIterator = System.getProperties().keySet().iterator(); keyIterator.hasNext(); ) { Object key = keyIterator.next(); out.println(key.toString() + "=" + System.getProperty(key.toString())); } } private void removeProperty(String key) { System.getProperties().remove(key); } public String getName() { return "sysprop"; } public String getShortDescription() { return "Display, set, modify and remove system properties"; } public String getUsage() { return "sysprop [-r] [] []"; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/UninstallCommandImpl.java000066400000000000000000000054061155660226500305270ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import java.util.StringTokenizer; import org.apache.felix.shell.Command; import org.osgi.framework.*; public class UninstallCommandImpl implements Command { private BundleContext m_context = null; public UninstallCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "uninstall"; } public String getUsage() { return "uninstall [ ...]"; } public String getShortDescription() { return "uninstall bundle(s)."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // There must be at least one bundle ID. if (st.countTokens() >= 1) { while (st.hasMoreTokens()) { String id = st.nextToken().trim(); try { long l = Long.parseLong(id); Bundle bundle = m_context.getBundle(l); if (bundle != null) { bundle.uninstall(); } else { err.println("Bundle ID " + id + " is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse id '" + id + "'."); } catch (BundleException ex) { if (ex.getNestedException() != null) err.println(ex.getNestedException().toString()); else err.println(ex.toString()); } catch (Exception ex) { err.println(ex.toString()); } } } else { err.println("Incorrect number of arguments"); } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/UpdateCommandImpl.java000066400000000000000000000121371155660226500277770ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.*; import java.net.MalformedURLException; import java.net.URL; import java.util.StringTokenizer; import org.apache.felix.shell.CdCommand; import org.apache.felix.shell.Command; import org.osgi.framework.*; public class UpdateCommandImpl implements Command { private BundleContext m_context = null; public UpdateCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "update"; } public String getUsage() { return "update []"; } public String getShortDescription() { return "update bundle."; } public void execute(String s, PrintStream out, PrintStream err) { StringTokenizer st = new StringTokenizer(s, " "); // Ignore the command name. st.nextToken(); // There should be at least a bundle ID, but there may // also be a URL. if ((st.countTokens() == 1) || (st.countTokens() == 2)) { String id = st.nextToken().trim(); String location = st.countTokens() == 0 ? null : st.nextToken().trim(); if (location != null) { location = absoluteLocation(location); if (location == null) { err.println("Malformed location: " + location); } } try { // Get the bundle id. long l = Long.parseLong(id); // Get the bundle. Bundle bundle = m_context.getBundle(l); if (bundle != null) { // Create input stream from location if present // and use it to update, otherwise just update. if (location != null) { InputStream is = new URL(location).openStream(); bundle.update(is); } else { bundle.update(); } } else { err.println("Bundle ID " + id + " is invalid."); } } catch (NumberFormatException ex) { err.println("Unable to parse id '" + id + "'."); } catch (MalformedURLException ex) { err.println("Unable to parse URL."); } catch (IOException ex) { err.println("Unable to open input stream: " + ex); } catch (BundleException ex) { if (ex.getNestedException() != null) { err.println(ex.getNestedException().toString()); } else { err.println(ex.toString()); } } catch (Exception ex) { err.println(ex.toString()); } } else { err.println("Incorrect number of arguments"); } } private String absoluteLocation(String location) { try { new URL(location); } catch (MalformedURLException ex) { // Try to create a valid URL using the base URL // contained in the "cd" command service. String baseURL = ""; try { // Get a reference to the "cd" command service. ServiceReference ref = m_context.getServiceReference( org.apache.felix.shell.CdCommand.class.getName()); if (ref != null) { CdCommand cd = (CdCommand) m_context.getService(ref); baseURL = cd.getBaseURL(); baseURL = (baseURL == null) ? "" : baseURL; m_context.ungetService(ref); } String theURL = baseURL + location; new URL(theURL); location = theURL; } catch (Exception ex2) { // Just fall through and return the original location. } } return location; } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/Util.java000066400000000000000000000061451155660226500253530ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; public class Util { public static String getBundleName(Bundle bundle) { if (bundle != null) { String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME); return (name == null) ? "Bundle " + Long.toString(bundle.getBundleId()) : name + " (" + Long.toString(bundle.getBundleId()) + ")"; } return "[STALE BUNDLE]"; } private static StringBuffer m_sb = new StringBuffer(); public static String getUnderlineString(String s) { synchronized (m_sb) { m_sb.delete(0, m_sb.length()); for (int i = 0; i < s.length(); i++) { m_sb.append('-'); } return m_sb.toString(); } } public static String getValueString(Object obj) { synchronized (m_sb) { if (obj instanceof String) { return (String) obj; } else if (obj instanceof String[]) { String[] array = (String[]) obj; m_sb.delete(0, m_sb.length()); for (int i = 0; i < array.length; i++) { if (i != 0) { m_sb.append(", "); } m_sb.append(array[i].toString()); } return m_sb.toString(); } else if (obj instanceof Boolean) { return ((Boolean) obj).toString(); } else if (obj instanceof Long) { return ((Long) obj).toString(); } else if (obj instanceof Integer) { return ((Integer) obj).toString(); } else if (obj instanceof Short) { return ((Short) obj).toString(); } else if (obj instanceof Double) { return ((Double) obj).toString(); } else if (obj instanceof Float) { return ((Float) obj).toString(); } return ""; } } }felix-shell-1.4.2/src/main/java/org/apache/felix/shell/impl/VersionCommandImpl.java000066400000000000000000000030701155660226500301760ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.PrintStream; import org.apache.felix.shell.Command; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; public class VersionCommandImpl implements Command { private BundleContext m_context = null; public VersionCommandImpl(BundleContext context) { m_context = context; } public String getName() { return "version"; } public String getUsage() { return "version"; } public String getShortDescription() { return "display version of framework."; } public void execute(String s, PrintStream out, PrintStream err) { out.println(m_context.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION)); } }felix-shell-1.4.2/src/main/java/org/ungoverned/000077500000000000000000000000001155660226500213415ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/ungoverned/osgi/000077500000000000000000000000001155660226500223025ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/ungoverned/osgi/service/000077500000000000000000000000001155660226500237425ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/ungoverned/osgi/service/shell/000077500000000000000000000000001155660226500250515ustar00rootroot00000000000000felix-shell-1.4.2/src/main/java/org/ungoverned/osgi/service/shell/CdCommand.java000066400000000000000000000035711155660226500275470ustar00rootroot00000000000000/* * 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. */ package org.ungoverned.osgi.service.shell; /** * This interface defines the cd command service interface for the * Felix impl service. The cd command does not really change the * directory of the impl, rather it maintains a base URL for * simplifying URL entry. *

* For example, if the base URL is http://www.foo.com/ and you * try to install a bundle foo.jar, the actual URL will be * expanded to http://www.foo.com/foo.jar. Any bundles wishing * to retrieve or set the current directory of the impl can use this * service interface. **/ public interface CdCommand extends Command { /** * Property used to configure the base URL. **/ public static final String BASE_URL_PROPERTY = "felix.impl.baseurl"; /** * Returns the current directory of the impl service. * @return the current impl directory. **/ public String getBaseURL(); /** * Sets the current directory of the impl service. * @param s the new value for the base URL. **/ public void setBaseURL(String s); } felix-shell-1.4.2/src/main/java/org/ungoverned/osgi/service/shell/Command.java000066400000000000000000000052101155660226500272700ustar00rootroot00000000000000/* * 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. */ package org.ungoverned.osgi.service.shell; import java.io.PrintStream; /** * This interface is used to define commands for the Felix impl * service. Any bundle wishing to create commands for the * impl service simply needs to create a service object that * implements this interface and then register it with the OSGi * framework. The impl service automatically includes any * registered command services in its list of available commands. **/ public interface Command { /** * Returns the name of the command that is implemented by the * interface. The command name should not contain whitespace * and should also be unique. * @return the name of the command. **/ public String getName(); /** * Returns the usage string for the command. The usage string is * a short string that illustrates how to use the command on the * command line. This information is used when generating command * help information. An example usage string for the install * command is: *

     *     install  [ ...]
     * 
* @return the usage string for the command. **/ public String getUsage(); /** * Returns a short description of the command; this description * should be as short as possible. This information is used when * generating the command help information. * @return a short description of the command. **/ public String getShortDescription(); /** * Executes the command using the supplied command line, output * print stream, and error print stream. * @param line the complete command line, including the command name. * @param out the print stream to use for standard output. * @param err the print stream to use for standard error. **/ public void execute(String line, PrintStream out, PrintStream err); } felix-shell-1.4.2/src/main/java/org/ungoverned/osgi/service/shell/ShellService.java000066400000000000000000000076311155660226500303130ustar00rootroot00000000000000/* * 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. */ package org.ungoverned.osgi.service.shell; import java.io.PrintStream; import org.osgi.framework.ServiceReference; /** * This interface defines the Felix impl service. The impl service * is an extensible, user interface neutral impl for controlling and * interacting with the framework. In general, the impl service assumes that * it is operating in a command line fashion, i.e., it receives a * complete command line, parses it, and executes the corresponding * command, but graphical interfaces are also possible. *

* All commands in the impl service are actually implemented as OSGi * services; these services implement the Command service * interface. Any bundle can implement custom commands by creating * command services and registering them with the OSGi framework. **/ public interface ShellService { /** * Returns an array of command names available in the impl service. * @return an array of available command names or an empty array. **/ public String[] getCommands(); /** * Returns the usage string associated with the specified command name. * @param name the name of the target command. * @return the usage string of the specified command or null. **/ public String getCommandUsage(String name); /** * Returns the description associated with the specified command name. * @param name the name of the target command. * @return the description of the specified command or null. **/ public String getCommandDescription(String name); /** * Returns the service reference associated with the specified * command name. * @param name the name of the target command. * @return the description of the specified command or null. **/ public ServiceReference getCommandReference(String name); /** * * This method executes the supplied command line using the * supplied output and error print stream. The assumption of * this method is that a command line will be typed by the user * (or perhaps constructed by a GUI) and passed into it for * execution. The command line is interpretted in a very * simplistic fashion; it takes the leading string of characters * terminated by a space character (not including it) and * assumes that this leading token is the command name. For an * example, consider the following command line: *

*
     *     update 3 http://www.foo.com/bar.jar
     * 
*

* This is interpretted as an update command; as a * result, the entire command line (include command name) is * passed into the execute() method of the command * service with the name update if one exists. If the * corresponding command service is not found, then an error * message is printed to the error print stream. * @param commandLine the command line to execute. * @param out the standard output print stream. * @param err the standard error print stream. **/ public void executeCommand( String commandLine, PrintStream out, PrintStream err) throws Exception; }felix-shell-1.4.2/src/test/000077500000000000000000000000001155660226500155105ustar00rootroot00000000000000felix-shell-1.4.2/src/test/java/000077500000000000000000000000001155660226500164315ustar00rootroot00000000000000felix-shell-1.4.2/src/test/java/org/000077500000000000000000000000001155660226500172205ustar00rootroot00000000000000felix-shell-1.4.2/src/test/java/org/apache/000077500000000000000000000000001155660226500204415ustar00rootroot00000000000000felix-shell-1.4.2/src/test/java/org/apache/felix/000077500000000000000000000000001155660226500215505ustar00rootroot00000000000000felix-shell-1.4.2/src/test/java/org/apache/felix/shell/000077500000000000000000000000001155660226500226575ustar00rootroot00000000000000felix-shell-1.4.2/src/test/java/org/apache/felix/shell/impl/000077500000000000000000000000001155660226500236205ustar00rootroot00000000000000felix-shell-1.4.2/src/test/java/org/apache/felix/shell/impl/LogOptionsTest.java000066400000000000000000000103321155660226500274170ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import junit.framework.TestCase; public class LogOptionsTest extends TestCase { public void testOnlyLogCommand() { LogOptions opt = new LogOptions("log"); assertEquals(4, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); opt = new LogOptions("log "); assertEquals(4, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); } public void testLogWithMinLevelDebug() { LogOptions opt = new LogOptions("log debug"); assertEquals(4, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); opt = new LogOptions("log DEBUG"); assertEquals(4, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); } public void testLogWithMinLevelInfo() { LogOptions opt = new LogOptions("log info"); assertEquals(3, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); opt = new LogOptions("log INFO"); assertEquals(3, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); } public void testLogWithMinLevelWarn() { LogOptions opt = new LogOptions("log warn"); assertEquals(2, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); opt = new LogOptions("log WARN"); assertEquals(2, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); } public void testLogWithMinLevelError() { LogOptions opt = new LogOptions("log error"); assertEquals(1, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); opt = new LogOptions("log ERROR"); assertEquals(1, opt.getMinLevel()); assertEquals(-1, opt.getMaxNumberOfLogs()); } public void testLogWithMaxNumberOfLogs() { LogOptions opt = new LogOptions("log 42"); assertEquals(4, opt.getMinLevel()); assertEquals(42, opt.getMaxNumberOfLogs()); } public void testLogWithMinLevelDebugAndMaxNumberOfLogs() { LogOptions opt = new LogOptions("log debug 12"); assertEquals(4, opt.getMinLevel()); assertEquals(12, opt.getMaxNumberOfLogs()); opt = new LogOptions("log 13 DEBUG"); assertEquals(4, opt.getMinLevel()); assertEquals(13, opt.getMaxNumberOfLogs()); } public void testLogWithMinLevelInfoAndMaxNumberOfLogs() { LogOptions opt = new LogOptions("log info 14"); assertEquals(3, opt.getMinLevel()); assertEquals(14, opt.getMaxNumberOfLogs()); opt = new LogOptions("log 15 INFO"); assertEquals(3, opt.getMinLevel()); assertEquals(15, opt.getMaxNumberOfLogs()); } public void testLogWithMinLevelWarnAndMaxNumberOfLogs() { LogOptions opt = new LogOptions("log warn 16"); assertEquals(2, opt.getMinLevel()); assertEquals(16, opt.getMaxNumberOfLogs()); opt = new LogOptions("log 17 WARN"); assertEquals(2, opt.getMinLevel()); assertEquals(17, opt.getMaxNumberOfLogs()); } public void testLogWithMinLevelErrorAndMaxNumberOfLogs() { LogOptions opt = new LogOptions("log error 18"); assertEquals(1, opt.getMinLevel()); assertEquals(18, opt.getMaxNumberOfLogs()); opt = new LogOptions("log 19 ERROR"); assertEquals(1, opt.getMinLevel()); assertEquals(19, opt.getMaxNumberOfLogs()); } }felix-shell-1.4.2/src/test/java/org/apache/felix/shell/impl/SystemPropertiesTest.java000066400000000000000000000043151155660226500306670ustar00rootroot00000000000000/* * 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. */ package org.apache.felix.shell.impl; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import junit.framework.TestCase; public class SystemPropertiesTest extends TestCase { SystemPropertiesCommandImpl sysprop = new SystemPropertiesCommandImpl(); public void testCanDisplayASingleProperty() { System.setProperty("first", "foo"); assertEquals("foo", System.getProperty("first")); ByteArrayOutputStream bos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(bos); sysprop.execute("sysprop first", ps, System.err); assertTrue(bos.toString().startsWith("first=foo")); } public void testCanCreateProperty() { assertNull(System.getProperty("foo")); sysprop.execute("sysprop foo bar", System.out, System.err); assertEquals("bar", System.getProperty("foo")); } public void testCanChangePropertyValue() { System.setProperty("foo", "bar"); assertEquals("bar", System.getProperty("foo")); sysprop.execute("sysprop foo barbar", System.out, System.err); assertEquals("barbar", System.getProperty("foo")); } public void testCanRemoveProperty() { System.setProperty("foo", "bar"); assertEquals("bar", System.getProperty("foo")); sysprop.execute("sysprop -r foo", System.out, System.err); assertNull(System.getProperty("foo")); } }