From: Jenkins Date: Tue, 18 Sep 2012 04:26:40 +0000 (+0900) Subject: Merge sources from S-Core's RSA git (release) X-Git-Tag: 2.0_alpha^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1459e45b20eebaa97e262e67622ecbfd7b7313c;p=sdk%2Fide%2Fcli.git Merge sources from S-Core's RSA git (release) Change-Id: Id725b7305b38bae9549884df927a5028e29a0c18 --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..6b6f254 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,5 @@ +Gyeongseok Seo +BonYong Lee +Hyeongseok Heo +Kangho Kim +HyunGoo Kang diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bbe9d02 --- /dev/null +++ b/LICENSE @@ -0,0 +1,206 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + 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. + + + diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..ded3804 --- /dev/null +++ b/NOTICE @@ -0,0 +1 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. \ No newline at end of file diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..57dabb7 --- /dev/null +++ b/build.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.tizen.cli/.classpath b/org.tizen.cli/.classpath new file mode 100644 index 0000000..c879acc --- /dev/null +++ b/org.tizen.cli/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/org.tizen.cli/.project b/org.tizen.cli/.project new file mode 100644 index 0000000..16a12da --- /dev/null +++ b/org.tizen.cli/.project @@ -0,0 +1,28 @@ + + + org.tizen.cli + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/org.tizen.cli/.settings/org.eclipse.jdt.core.prefs b/org.tizen.cli/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c328be6 --- /dev/null +++ b/org.tizen.cli/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Jun 07 10:18:19 KST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/org.tizen.cli/.settings/org.eclipse.pde.core.prefs b/org.tizen.cli/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 0000000..d778992 --- /dev/null +++ b/org.tizen.cli/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Thu Jun 07 10:18:19 KST 2012 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/org.tizen.cli/META-INF/MANIFEST.MF b/org.tizen.cli/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9903541 --- /dev/null +++ b/org.tizen.cli/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Command Line Interface +Bundle-SymbolicName: org.tizen.cli;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Samsung +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: org.tizen.web.common, + org.tizen.web.sign, + org.tizen.web.launch, + org.tizen.web.project.wizard +Bundle-ClassPath: ., + lib/ant.jar, + lib/commons-cli-1.2.jar diff --git a/org.tizen.cli/build.properties b/org.tizen.cli/build.properties new file mode 100644 index 0000000..45e04ba --- /dev/null +++ b/org.tizen.cli/build.properties @@ -0,0 +1,11 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/ant.jar,\ + lib/commons-cli-1.2.jar +source.lib/commons-cli-1.2.jar = +jars.compile.order = .,\ + lib/commons-cli-1.2.jar,\ + lib/ant.jar +source.lib/ant.jar = diff --git a/org.tizen.cli/doc/install/bin_/web-debug b/org.tizen.cli/doc/install/bin_/web-debug new file mode 100755 index 0000000..ebc2645 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-debug @@ -0,0 +1,65 @@ +#!/bin/sh + +MAIN=org.tizen.cli.exec.debug.Main + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` + +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac +done + +OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + +EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + +if [ -n "$OPT_TRACE" ] +then + echo "Command :$EXEC" +fi + +$EXEC diff --git a/org.tizen.cli/doc/install/bin_/web-debug.bat b/org.tizen.cli/doc/install/bin_/web-debug.bat new file mode 100644 index 0000000..3920cfd --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-debug.bat @@ -0,0 +1,55 @@ +@echo off +set SCRIPT=%0 + +:: delims is a TAB followed by a space +set KEY=TIZEN_SDK_INSTALLED_PATH + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set MAIN=org.tizen.cli.exec.debug.Main + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + +FOR %%W IN ( %* ) DO ( call:parseArg %%W ) + +set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% +set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %* + +IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + +%EXEC% +goto:eof + +:parseArg + IF y == %READ_ARG% goto SET_LOGGING + +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +:END_STEP +goto:eof + +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n + + goto SECOND_STEP + +:SET_READY + set READ_ARG=y + goto END_STEP + diff --git a/org.tizen.cli/doc/install/bin_/web-gen b/org.tizen.cli/doc/install/bin_/web-gen new file mode 100755 index 0000000..b63a8a4 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-gen @@ -0,0 +1,65 @@ +#!/bin/sh + +MAIN=org.tizen.cli.exec.gen.Main + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` + +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac +done + +OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + +EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + +if [ -n "$OPT_TRACE" ] +then + echo "Command :$EXEC" +fi + +$EXEC diff --git a/org.tizen.cli/doc/install/bin_/web-gen.bat b/org.tizen.cli/doc/install/bin_/web-gen.bat new file mode 100644 index 0000000..9c58522 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-gen.bat @@ -0,0 +1,55 @@ +@echo off +set SCRIPT=%0 + +:: delims is a TAB followed by a space +set KEY=TIZEN_SDK_INSTALLED_PATH + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set MAIN=org.tizen.cli.exec.gen.Main + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + +FOR %%W IN ( %* ) DO ( call:parseArg %%W ) + +set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% +set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %* + +IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + +%EXEC% +goto:eof + +:parseArg + IF y == %READ_ARG% goto SET_LOGGING + +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +:END_STEP +goto:eof + +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n + + goto SECOND_STEP + +:SET_READY + set READ_ARG=y + goto END_STEP + diff --git a/org.tizen.cli/doc/install/bin_/web-install b/org.tizen.cli/doc/install/bin_/web-install new file mode 100755 index 0000000..4939e32 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-install @@ -0,0 +1,65 @@ +#!/bin/sh + +MAIN=org.tizen.cli.exec.install.Main + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` + +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac +done + +OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + +EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + +if [ -n "$OPT_TRACE" ] +then + echo "Command :$EXEC" +fi + +$EXEC diff --git a/org.tizen.cli/doc/install/bin_/web-install.bat b/org.tizen.cli/doc/install/bin_/web-install.bat new file mode 100644 index 0000000..414b9f1 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-install.bat @@ -0,0 +1,55 @@ +@echo off +set SCRIPT=%0 + +:: delims is a TAB followed by a space +set KEY=TIZEN_SDK_INSTALLED_PATH + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set MAIN=org.tizen.cli.exec.install.Main + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + +FOR %%W IN ( %* ) DO ( call:parseArg %%W ) + +set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% +set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %* + +IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + +%EXEC% +goto:eof + +:parseArg + IF y == %READ_ARG% goto SET_LOGGING + +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +:END_STEP +goto:eof + +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n + + goto SECOND_STEP + +:SET_READY + set READ_ARG=y + goto END_STEP + diff --git a/org.tizen.cli/doc/install/bin_/web-list b/org.tizen.cli/doc/install/bin_/web-list new file mode 100755 index 0000000..6f16928 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-list @@ -0,0 +1,65 @@ +#!/bin/sh + +MAIN=org.tizen.cli.exec.query.Main + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` + +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac +done + +OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + +EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + +if [ -n "$OPT_TRACE" ] +then + echo "Command :$EXEC" +fi + +$EXEC diff --git a/org.tizen.cli/doc/install/bin_/web-list.bat b/org.tizen.cli/doc/install/bin_/web-list.bat new file mode 100644 index 0000000..26950f8 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-list.bat @@ -0,0 +1,55 @@ +@echo off +set SCRIPT=%0 + +:: delims is a TAB followed by a space +set KEY=TIZEN_SDK_INSTALLED_PATH + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set MAIN=org.tizen.cli.exec.query.Main + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + +FOR %%W IN ( %* ) DO ( call:parseArg %%W ) + +set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% +set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %* + +IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + +%EXEC% +goto:eof + +:parseArg + IF y == %READ_ARG% goto SET_LOGGING + +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +:END_STEP +goto:eof + +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n + + goto SECOND_STEP + +:SET_READY + set READ_ARG=y + goto END_STEP + diff --git a/org.tizen.cli/doc/install/bin_/web-packaging b/org.tizen.cli/doc/install/bin_/web-packaging new file mode 100755 index 0000000..93b141f --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-packaging @@ -0,0 +1,65 @@ +#!/bin/sh + +MAIN=org.tizen.cli.exec.wgt.Main + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` + +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac +done + +OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" +ARGS=`echo "$@"` +EXEC="java -cp $CLASSPATH $OPT $MAIN $ARGS" + +if [ -n "$OPT_TRACE" ] +then + echo "Command :$EXEC" +fi + +$EXEC diff --git a/org.tizen.cli/doc/install/bin_/web-packaging.bat b/org.tizen.cli/doc/install/bin_/web-packaging.bat new file mode 100644 index 0000000..fe9319c --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-packaging.bat @@ -0,0 +1,55 @@ +@echo off +set SCRIPT=%0 + +:: delims is a TAB followed by a space +set KEY=TIZEN_SDK_INSTALLED_PATH + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set MAIN=org.tizen.cli.exec.wgt.Main + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + +FOR %%W IN ( %* ) DO ( call:parseArg %%W ) + +set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% +set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %* + +IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + +%EXEC% +goto:eof + +:parseArg + IF y == %READ_ARG% goto SET_LOGGING + +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +:END_STEP +goto:eof + +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n + + goto SECOND_STEP + +:SET_READY + set READ_ARG=y + goto END_STEP + diff --git a/org.tizen.cli/doc/install/bin_/web-run b/org.tizen.cli/doc/install/bin_/web-run new file mode 100755 index 0000000..a76202a --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-run @@ -0,0 +1,65 @@ +#!/bin/sh + +MAIN=org.tizen.cli.exec.run.Main + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` + +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac +done + +OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + +EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + +if [ -n "$OPT_TRACE" ] +then + echo "Command :$EXEC" +fi + +$EXEC diff --git a/org.tizen.cli/doc/install/bin_/web-run.bat b/org.tizen.cli/doc/install/bin_/web-run.bat new file mode 100644 index 0000000..fb5cf60 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-run.bat @@ -0,0 +1,55 @@ +@echo off +set SCRIPT=%0 + +:: delims is a TAB followed by a space +set KEY=TIZEN_SDK_INSTALLED_PATH + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set MAIN=org.tizen.cli.exec.run.Main + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + +FOR %%W IN ( %* ) DO ( call:parseArg %%W ) + +set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% +set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %* + +IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + +%EXEC% +goto:eof + +:parseArg + IF y == %READ_ARG% goto SET_LOGGING + +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +:END_STEP +goto:eof + +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n + + goto SECOND_STEP + +:SET_READY + set READ_ARG=y + goto END_STEP + diff --git a/org.tizen.cli/doc/install/bin_/web-signing b/org.tizen.cli/doc/install/bin_/web-signing new file mode 100755 index 0000000..0563925 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-signing @@ -0,0 +1,65 @@ +#!/bin/sh + +MAIN=org.tizen.cli.exec.sign.Main + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` + +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac +done + +OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + +EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + +if [ -n "$OPT_TRACE" ] +then + echo "Command :$EXEC" +fi + +$EXEC diff --git a/org.tizen.cli/doc/install/bin_/web-signing.bat b/org.tizen.cli/doc/install/bin_/web-signing.bat new file mode 100644 index 0000000..f941a59 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-signing.bat @@ -0,0 +1,55 @@ +@echo off +set SCRIPT=%0 + +:: delims is a TAB followed by a space +set KEY=TIZEN_SDK_INSTALLED_PATH + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set MAIN=org.tizen.cli.exec.sign.Main + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + +FOR %%W IN ( %* ) DO ( call:parseArg %%W ) + +set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% +set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %* + +IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + +%EXEC% +goto:eof + +:parseArg + IF y == %READ_ARG% goto SET_LOGGING + +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +:END_STEP +goto:eof + +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n + + goto SECOND_STEP + +:SET_READY + set READ_ARG=y + goto END_STEP + diff --git a/org.tizen.cli/doc/install/bin_/web-uninstall b/org.tizen.cli/doc/install/bin_/web-uninstall new file mode 100755 index 0000000..9644f74 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-uninstall @@ -0,0 +1,65 @@ +#!/bin/sh + +MAIN=org.tizen.cli.exec.uninstall.Main + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` + +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac +done + +OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + +EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + +if [ -n "$OPT_TRACE" ] +then + echo "Command :$EXEC" +fi + +$EXEC diff --git a/org.tizen.cli/doc/install/bin_/web-uninstall.bat b/org.tizen.cli/doc/install/bin_/web-uninstall.bat new file mode 100644 index 0000000..e98f6a3 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/web-uninstall.bat @@ -0,0 +1,55 @@ +@echo off +set SCRIPT=%0 + +:: delims is a TAB followed by a space +set KEY=TIZEN_SDK_INSTALLED_PATH + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set MAIN=org.tizen.cli.exec.uninstall.Main + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + +FOR %%W IN ( %* ) DO ( call:parseArg %%W ) + +set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% +set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %* + +IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + +%EXEC% +goto:eof + +:parseArg + IF y == %READ_ARG% goto SET_LOGGING + +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +:END_STEP +goto:eof + +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n + + goto SECOND_STEP + +:SET_READY + set READ_ARG=y + goto END_STEP + diff --git a/org.tizen.cli/doc/install/bin_/webtizen b/org.tizen.cli/doc/install/bin_/webtizen new file mode 100755 index 0000000..b1f5d84 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/webtizen @@ -0,0 +1,161 @@ +#!/bin/sh + +#variable +SCRIPT="$0" +MAIN= +CMD= + +DIR_BIN=`dirname $SCRIPT` +DIR_HOME=$DIR_BIN/.. +DIR_LIB=$DIR_HOME/lib +DIR_CONFIG=$DIR_HOME/conf + +JARS=`find $DIR_LIB -name "*.jar"` +JAR="" +for JAR_FILE in $JARS; do + JAR=$JAR:$JAR_FILE +done + +CLASSPATH=$DIR_CONFIG:$JAR + +OPT_LOGGING="-Dlog4j.configuration=log4j.xml" +OPT_PRG_NAME="-Dcli.name=$SCRIPT" + +READ_ARG="n" + +OPT_TRACE= + +#method +_print_usage() +{ + echo "Usage: $SCRIPT [option] command [options]" + echo "Usage: $SCRIPT [option] short-command [options]" + echo "" + echo "$SCRIPT is a simple command line interface for Tizen widget." + echo "The most frequently used commands are run and debug." + echo "" + echo "Commands:" + echo " gen : Generation widget project" + echo " packaging : Packaging widget project" + echo " signing : Signing widget project" + echo " list : Display installed widgets handle and name list" + echo " install : Install widget package for target" + echo " uninstall : Uninstall widget package for target" + echo " run : Install wdiget package for target And Launch widget" + echo " debug : Install wdiget package for target And Launch widget And activate debug mode" + echo "" + echo "Short Commands:" + echo " -g : gen command" + echo " -p : packaging command" + echo " -s : signing command" + echo " -l : list command" + echo " -i : install command" + echo " -u : uninstall command" + echo " -r : run command" + echo " -d : debug command" + echo "" + echo "Option" + echo " -h : Display this usage information." + + + exit $1 +} + +_check_zero_option() +{ + if [ "0" = $# ] + then + _print_usage 1 + fi +} + +_select_option() +{ + case "$1" in + help|-h) + _print_usage 0 + ;; + gen|-g) + MAIN=org.tizen.cli.exec.gen.Main + SCRIPT="web-gen" + ;; + packaging|-p) + MAIN=org.tizen.cli.exec.wgt.Main + SCRIPT="web-packaging" + ;; + signing|-s) + MAIN=org.tizen.cli.exec.sign.Main + SCRIPT="web-signing" + ;; + list|-l) + MAIN=org.tizen.cli.exec.query.Main + SCRIPT="web-query" + ;; + install|-i) + MAIN=org.tizen.cli.exec.install.Main + SCRIPT="web-install" + ;; + uninstall|-u) + MAIN=org.tizen.cli.exec.uninstall.Main + SCRIPT="web-uninstall" + ;; + run|-r) + MAIN=org.tizen.cli.exec.run.Main + SCRIPT="web-run" + ;; + debug|-d) + MAIN=org.tizen.cli.exec.debug.Main + SCRIPT="web-debug" + ;; + ?) + _print_usage 1 + ;; + esac +} + +_run_command() +{ + while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi + done + + for WORD in $@; do + if [ "y" = "$READ_ARG" ] + then + OPT_LOGGING="-Dlog4j.configuration=log4j-${WORD}.xml" + if [ "$WORD" = "trace" ] + then + OPT_TRACE="-Dlog4j.debug=true" + fi + READ_ARG="n" + fi + case $WORD in + "--log" | "-l" ) + READ_ARG="y" + ;; + esac + done + + OPT="$OPT_TRACE $OPT_LOGGING $OPT_PRG_NAME" + + EXEC="java -cp $CLASSPATH $OPT $MAIN $@" + + if [ -n "$OPT_TRACE" ] + then + echo "Command :$EXEC" + fi + $EXEC +} + +#script execute +_check_zero_option $@ +_select_option $@ +shift 1 +_run_command $@ diff --git a/org.tizen.cli/doc/install/bin_/webtizen.bat b/org.tizen.cli/doc/install/bin_/webtizen.bat new file mode 100644 index 0000000..0bba2d5 --- /dev/null +++ b/org.tizen.cli/doc/install/bin_/webtizen.bat @@ -0,0 +1,153 @@ +@echo off + +REM variable +set SCRIPT=%0 +set MAIN= +set ISEXIT=false +set CMDLINE= +set KEY=TIZEN_SDK_INSTALLED_PATH +set sdk_conf_path= + +REM find sdk path +set rkey="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" +set rval="Local AppData" +FOR /f "tokens=3*" %%a IN ('reg query %rkey% /v %rval%') DO ( + set sdk_conf_path=%%b +) + +REM find cli path +FOR /f "tokens=1,2 delims==" %%i IN ('type "%sdk_conf_path%\tizen-sdk-data\tizensdkpath"') DO IF %%i==%KEY% (set SDK_PATH=%%j) +set CLI_HOME=%SDK_PATH%\tools\ide + +set OPT_TRACE= +set OPT_LOGGING=-Dlog4j.configuration=log4j.xml +set OPT_PRG_NAME=-Dcli.name=%SCRIPT% + +set READ_ARG=n + + +REM script execute +REM check argment +call:_check_zero_option %* +IF %ISEXIT% == true goto EXIT_STEP + +REM command check and select +call:_select_option %* +IF %ISEXIT% == true goto EXIT_STEP + +REM command's argument create +call:ARG_SHIFT %* + +REM running command +call:_run_command %CMDLINE% + +REM method call end +:END_STEP +goto:eof + +REM print usages method +:_print_usage + echo. Usage: %SCRIPT% [option] command [options] + echo. Usage: %SCRIPT% [option] short-command [options] + echo. + echo. %SCRIPT% is a simple command line interface for Tizen widget. + echo. The most frequently used commands are run and debug. + echo. + echo. Commands: + echo. gen : Generation widget project + echo. packaging : Packaging widget project + echo. signing : Signing widget project + echo. list : Display installed widgets handle and name list + echo. install : Install widget package for target + echo. uninstall : Uninstall widget package for target + echo. run : Install wdiget package for target And Launch widget + echo. debug : Install wdiget package for target And Launch widget And activate debug mode + echo. + echo. Short Commands: + echo. -g : gen command + echo. -p : packaging command + echo. -s : signing command + echo. -l : list command + echo. -i : install command + echo. -u : uninstall command + echo. -r : run command + echo. -d : debug command + echo. + echo. Option + echo. -h : Display this usage information. + set ISEXIT=true +goto:END_STEP + +REM option check method +:_check_zero_option + IF !%1 == ! goto:_print_usage +goto:END_STEP + +REM option select method +:_select_option + IF %1 == -h goto:_print_usage + IF %1 == help goto:_print_usage + IF %1 == -g set MAIN=org.tizen.cli.exec.gen.Main + IF %1 == gen set MAIN=org.tizen.cli.exec.gen.Main + IF %1 == -p set MAIN=org.tizen.cli.exec.wgt.Main + IF %1 == packaging set MAIN=org.tizen.cli.exec.wgt.Main + IF %1 == -s set MAIN=org.tizen.cli.exec.sign.Main + IF %1 == signing set MAIN=org.tizen.cli.exec.sign.Main + IF %1 == -l set MAIN=org.tizen.cli.exec.query.Main + IF %1 == list set MAIN=org.tizen.cli.exec.query.Main + IF %1 == -i set MAIN=org.tizen.cli.exec.install.Main + IF %1 == install set MAIN=org.tizen.cli.exec.install.Main + IF %1 == -u set MAIN=org.tizen.cli.exec.uninstall.Main + IF %1 == uninstall set MAIN=org.tizen.cli.exec.uninstall.Main + IF %1 == -r set MAIN=org.tizen.cli.exec.run.Main + IF %1 == run set MAIN=org.tizen.cli.exec.run.Main + IF %1 == -d set MAIN=org.tizen.cli.exec.debug.Main + IF %1 == debug set MAIN=org.tizen.cli.exec.debug.Main + IF !%MAIN% == ! goto:_print_usage +goto:END_STEP + +REM command line shift method +:ARG_SHIFT + shift + IF !%1 == ! goto:END_STEP + SET "CMDLINE=%CMDLINE% %1" +goto:ARG_SHIFT + +REM command excute method +:_run_command + FOR %%W IN ( %CMDLINE% ) DO ( call:parseArg %%W ) + + set OPT=%OPT_TRACE% %OPT_LOGGING% %OPT_PRG_NAME% + set EXEC=java -cp %CLI_HOME%\conf -Djava.ext.dirs=%CLI_HOME%\lib %OPT% %MAIN% %CMDLINE% + + IF NOT "" == "%OPT_TRACE%" ( echo Command :%EXEC% ) + + %EXEC% +goto:eof + +REM check logging yes +:parseArg + IF y == %READ_ARG% goto SET_LOGGING +goto:SECOND_STEP + +REM check log option -l or --log +:SECOND_STEP + IF %~1 == --log goto SET_READY + IF %~1 == -l goto SET_READY +goto:END_STEP + +REM set logging option +:SET_LOGGING + set OPT_LOGGING=-Dlog4j.configuration=log4j-%~1.xml + IF %~1 == trace set OPT_TRACE=-Dlog4j.debug=true + set READ_ARG=n +goto SECOND_STEP + +REM set ready option +:SET_READY + set READ_ARG=y +goto:END_STEP + +REM exit script +:EXIT_STEP +goto:eof diff --git a/org.tizen.cli/doc/install/conf/log4j-debug.xml b/org.tizen.cli/doc/install/conf/log4j-debug.xml new file mode 100644 index 0000000..625523d --- /dev/null +++ b/org.tizen.cli/doc/install/conf/log4j-debug.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.cli/doc/install/conf/log4j-error.xml b/org.tizen.cli/doc/install/conf/log4j-error.xml new file mode 100644 index 0000000..50905c9 --- /dev/null +++ b/org.tizen.cli/doc/install/conf/log4j-error.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.cli/doc/install/conf/log4j-info.xml b/org.tizen.cli/doc/install/conf/log4j-info.xml new file mode 100644 index 0000000..c1d5f9e --- /dev/null +++ b/org.tizen.cli/doc/install/conf/log4j-info.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.cli/doc/install/conf/log4j-trace.xml b/org.tizen.cli/doc/install/conf/log4j-trace.xml new file mode 100644 index 0000000..61298ea --- /dev/null +++ b/org.tizen.cli/doc/install/conf/log4j-trace.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.cli/doc/install/conf/log4j-warn.xml b/org.tizen.cli/doc/install/conf/log4j-warn.xml new file mode 100644 index 0000000..b984f69 --- /dev/null +++ b/org.tizen.cli/doc/install/conf/log4j-warn.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.cli/doc/install/conf/log4j.xml b/org.tizen.cli/doc/install/conf/log4j.xml new file mode 100644 index 0000000..328d165 --- /dev/null +++ b/org.tizen.cli/doc/install/conf/log4j.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.cli/doc/install/sample/profiles.xml b/org.tizen.cli/doc/install/sample/profiles.xml new file mode 100644 index 0000000..7d352b7 --- /dev/null +++ b/org.tizen.cli/doc/install/sample/profiles.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.tizen.cli/lib/ant.jar b/org.tizen.cli/lib/ant.jar new file mode 100644 index 0000000..b3a94df Binary files /dev/null and b/org.tizen.cli/lib/ant.jar differ diff --git a/org.tizen.cli/lib/commons-cli-1.2.jar b/org.tizen.cli/lib/commons-cli-1.2.jar new file mode 100644 index 0000000..ce4b9ff Binary files /dev/null and b/org.tizen.cli/lib/commons-cli-1.2.jar differ diff --git a/org.tizen.cli/src/org/tizen/cli/exec/AbstractLauncher.java b/org.tizen.cli/src/org/tizen/cli/exec/AbstractLauncher.java new file mode 100644 index 0000000..9096f5a --- /dev/null +++ b/org.tizen.cli/src/org/tizen/cli/exec/AbstractLauncher.java @@ -0,0 +1,522 @@ +/* + * Web IDE - Command Line Interface + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * BonYong Lee + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + * + */ +package org.tizen.cli.exec; + +import static org.tizen.common.util.StringUtil.nvl; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.GnuParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; +import org.apache.commons.cli.PosixParser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.tizen.common.core.command.ExecutionContext; +import org.tizen.common.core.command.Executor; +import org.tizen.common.core.command.Prompter; +import org.tizen.common.core.command.policy.PolicyRegistry; +import org.tizen.common.file.FileHandler; +import org.tizen.common.file.FileHandler.Attribute; +import org.tizen.common.file.StandardFileHandler; +import org.tizen.common.util.MapUtil; + +/** + *

+ * AbstractLauncher. + * + * abstract class for simple command. + * + * provide {@link ExecutionContext} for command line + *

+ * + * @author BonYong Lee{@literal } (S-Core) + */ +abstract public class +AbstractLauncher +{ + /** + * Program name property key + */ + protected static final String PROP_PRG = "cli.name"; + + /** + *

+ * Option for help text + *

+ */ + protected static final String OPT_HELP = "help"; + + /** + *

+ * Description for help option + * + * This is printed out in usage + *

+ * + * @see #OPT_HELP + */ + protected static final String DESC_HELP = "print out this page"; + + /** + *

+ * Option for log level + * + * This option is shared in shell + *

+ */ + protected static final String OPT_LOG = "log"; + + /** + *

+ * Description for log level option + * + * This is printed out in usage + *

+ * + * @see #OPT_LOG + */ + protected static final String DESC_LOG = "specify log level( ex - error, warn, info, debug, trace, none )"; + + /** + *

+ * Option for no output + *

+ */ + protected static final String OPT_QUIET = "quiet"; + + /** + *

+ * Description for no output option + * + * This is printed out in usage + *

+ * + * @see #OPT_QUIET + */ + protected static final String DESC_QUIET = "execute silently"; + + /** + *

+ * Property key for command line parameter parser + *

+ */ + protected static final String PROP_PARSER = "tizen.cli.parser"; + + /** + *

+ * logger for this object + *

+ */ + protected final Logger logger = LoggerFactory.getLogger( getClass() ); + + /** + *

+ * optional flag to be specified by user + * + * flag is formatted in POSIX style in default + *

+ */ + protected CommandLine cmd; + + /** + * {@link Executor} for Command Line Interface + */ + protected Executor executor; + + /** + * Convert path to canonical path + * + * @param path relative or abstract path + * + * @return canonical path + * + * @throws IOException If file system deny request + */ + protected + String + convertPath( + final String path + ) + throws IOException + { + final FileHandler fileHandler = getFileHandler(); + return (String) fileHandler.get( path, Attribute.PATH ); + } + + /** + * return execution command for usage + * + * @return execution command + */ + protected String getSyntax() + { + return nvl( System.getProperty( PROP_PRG ), "java " + getClass().getName() ); + } + + /** + * {@link Options} for usage + * + * @return defined {@link Options} + */ + @SuppressWarnings("static-access") + protected + Options + getOptions() + { + final Options options = new Options(); + + options.addOption( OptionBuilder.withLongOpt( OPT_HELP ).withDescription( DESC_HELP ).create( OPT_HELP.substring( 0, 1 ) ) ); + options.addOption( OptionBuilder.hasArg().withLongOpt( OPT_LOG ).withDescription( DESC_LOG ).create( OPT_LOG.substring( 0, 1 ) ) ); + options.addOption( OptionBuilder.withLongOpt( OPT_QUIET ).withDescription( DESC_QUIET ).create( OPT_QUIET.substring( 0, 1 ) ) ); + + return options; + } + + /** + * Print out usage + * + * @return usage string + */ + protected + String + printHelp() + { + final HelpFormatter formatter = new HelpFormatter(); + + final StringWriter writer = new StringWriter(); + + final PrintWriter stream = new PrintWriter( writer ); + + formatter.printHelp( + stream, + formatter.getWidth(), + getSyntax(), + null, + getOptions(), + formatter.getLeftPadding(), + formatter.getDescPadding(), + null, + false + ); + + final String help = writer.toString(); + + getPrompter().error( help ); + + return help; + } + + + /** + * Entry method for execution + * + * @param args command line argument + * + * @throws Exception If unhandled exception occured + */ + public void + run( + final String... args + ) + throws Exception + { + executor = new CommandLineExecutor( + new ConsolePrompter( System.out, new InputStreamReader( System.in ) ) + ); + if ( logger.isTraceEnabled() ) + { + logger.trace( "System properties :\n{}", MapUtil.toString( System.getProperties() ) ); + } + + + try + { + this.cmd = parse( args ); + + if ( cmd.hasOption( OPT_QUIET ) ) + { + executor = new CommandLineExecutor( + new ConsolePrompter( new PrintStream( new OutputStream() { + public void write(int b) throws IOException { + } + } ), new InputStreamReader( System.in ) ) + ); + + } + + if ( cmd.hasOption( OPT_HELP ) ) + { + printHelp(); + return ; + } + + execute( cmd ); + } + catch ( final ParseException e ) + { + printHelp(); + } + catch ( final Exception e ) + { + handleException( e ); + } + } + + /** + * Handle uncaught exception + * + * @param e uncaught exception + */ + protected + void + handleException( + final Exception e + ) + { + logger.error( "Command stop because of exception", e ); + + Throwable iter = e; + while ( null != iter ) + { + final String localMessage = iter.getLocalizedMessage(); + if ( null != localMessage ) + { + logger.error( localMessage ); + return ; + } + + final String message = iter.getMessage(); + if ( null != message ) + { + logger.error( message ); + return ; + } + iter = iter.getCause(); + } + + } + + /** + * Parse arguments args with {@link CommandLineParser} + * + * @param args arguments to parse + * + * @return {@link CommandLine} to be parsed + * + * @throws InstantiationException If custom parser is invalid + * @throws IllegalAccessException If custom parser is invalid + * @throws ParseException If arguements is invalid + */ + protected + CommandLine + parse( + final String... args + ) + throws InstantiationException, IllegalAccessException, ParseException + { + final CommandLineParser parser = getParser(); + + final Options options = getOptions(); + + final CommandLine cmdLine = parser.parse( options, args ); + + return cmdLine; + } + + /** + * Return default parser {@link Class} + * + * @return {@link Class} for default parser + */ + protected + static + Class + getDefaultParserClass() + { + return PosixParser.class; + } + + /** + * Return parser along user selection. + * + * The selection is specified JVM system properties + * + * Support two built-in parser + *
    + *
  • POSIX style - tar -zxvf foo.tar.gz
  • + *
  • GNU style - du --human-readable --max-depth=1
  • + *
+ * + * if you want use custom parser, specify class name + * + * @return {@link CommandLineParser} to parse + * + * @throws InstantiationException If custom parser can't be instantiated + * @throws IllegalAccessException If custom parser's constructor is NOT accessible + * + * @see #PROP_PARSER + * @see CommandLineParser + */ + protected + CommandLineParser + getParser() + throws InstantiationException, IllegalAccessException { + final String parserName = System.getProperty( PROP_PARSER ); + logger.trace( "Parser name :{}", parserName ); + Class parserClazz = getDefaultParserClass(); + try { + if ( null != parserName ) + { + parserClazz = Class.forName( parserName ); + } + } + catch ( final ClassNotFoundException e ) + { + if ( "posix".equalsIgnoreCase( parserName ) ) + { // tar -zxvf foo.tar.gz + parserClazz = PosixParser.class; + } + else if ( "gnu".equalsIgnoreCase( parserName ) ) + { + parserClazz = GnuParser.class; + } + else + { + logger.warn( "Invalid argument parser :" + parserName ); + } + } + + logger.trace( "Parser class :{}", parserClazz ); + + return (CommandLineParser) parserClazz.newInstance(); + } + + /** + * Return managed command line arguments + * + * @return managed arguments + * + * @see CommandLine + */ + protected + CommandLine + getCommandLine() + { + return this.cmd; + } + + /** + * Return defined executor for command + * + * @return {@link ExecutionContext} to use + */ + protected + Executor + getExecutor() + { + if ( null == executor ) + { + this.executor = new Executor(); + } + + return executor; + } + + /** + * Return {@link ExecutionContext} in cli + * + * @return {@link ExecutionContext} + */ + protected + ExecutionContext + getExecutionContext() + { + return getExecutor().getContext(); + } + + /** + * Return {@link PolicyRegistry} in cli + * + * @return {@link PolicyRegistry} + */ + protected + PolicyRegistry + getPolicy() + { + return getExecutionContext().getPolicyRegistry(); + } + + /** + * Return {@link FileHandler} in cli + * + * @return {@link FileHandler} + * + * @see #getExecutionContext() + * @see StandardFileHandler + */ + protected + FileHandler + getFileHandler() + { + return getExecutionContext().getFileHandler(); + } + + /** + * Return {@link Prompter} in cli + * + * @return {@link Prompter} + * + * @see #getExecutionContext() + */ + protected + Prompter + getPrompter() + { + return getExecutionContext().getPrompter(); + } + + /** + * Execute command + * + * Implement execution of command + * + * @param cmdLine arguments + * + * @throws Exception If Unhandled exception occured + */ + abstract protected void execute( CommandLine cmdLine ) throws Exception; + + +} diff --git a/org.tizen.cli/src/org/tizen/cli/exec/CommandLineExecutor.java b/org.tizen.cli/src/org/tizen/cli/exec/CommandLineExecutor.java new file mode 100755 index 0000000..d839bb0 --- /dev/null +++ b/org.tizen.cli/src/org/tizen/cli/exec/CommandLineExecutor.java @@ -0,0 +1,130 @@ +/* + * Web IDE - Command Line Interface + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * BonYong Lee + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + * + */ +package org.tizen.cli.exec; + +import java.text.MessageFormat; + +import org.tizen.common.Factory; +import org.tizen.common.core.command.ExecutionContext; +import org.tizen.common.core.command.Executor; +import org.tizen.common.core.command.Prompter; +import org.tizen.common.core.command.policy.PolicyRegistry; +import org.tizen.common.file.FileHandler; +import org.tizen.common.file.StandardFileHandler; + +/** + *

+ * CommandLineExecutor. + * + * {@link Executor} for commaand line interface + *

+ * + * @author BonYong Lee{@literal } (S-Core) + */ +public class +CommandLineExecutor +extends Executor +{ + + /** + * Contructor with prompter + * + * @param prompter {@link Prompter} + */ + public + CommandLineExecutor( + final Prompter prompter + ) + { + super( + new Factory() { + + /** + * {@link FileHandler} for Command Line Interface + */ + protected FileHandler fileHandler = new StandardFileHandler(); + + + /** + *

+ * {@link PolicyRegistry} for Command Line Interface + *

+ */ + protected Factory factory = new PolicyRegistryFactory(); + + /** + * Create and return {@link PolicyRegistry} + * + * @return {@link PolicyRegistry} to be created + */ + protected + PolicyRegistry + getRegistry() + { + return factory.create(); + } + + /** + * {@link ExecutionContext} for Command Line Interface + */ + protected + final + ExecutionContext context = new ExecutionContext( + getRegistry(), + prompter, + fileHandler + ); + + /* (non-Javadoc) + * @see org.tizen.common.core.command.ExecutionContextFactory#create() + */ + @Override + public + ExecutionContext + create() + { + return context; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public + String + toString() + { + return MessageFormat.format( + "Policy :{0}, Prompter :{1}, File Handler :{2}", + context.getPolicyRegistry(), + context.getPrompter(), + context.getFileHandler() + ); + }; + } + ); + } + +} diff --git a/org.tizen.cli/src/org/tizen/cli/exec/ConsolePrompter.java b/org.tizen.cli/src/org/tizen/cli/exec/ConsolePrompter.java new file mode 100755 index 0000000..1e7cd59 --- /dev/null +++ b/org.tizen.cli/src/org/tizen/cli/exec/ConsolePrompter.java @@ -0,0 +1,221 @@ +/* + * Web IDE - Command Line Interface + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * BonYong Lee + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + * + */ +package org.tizen.cli.exec; + +import static org.tizen.common.util.StringUtil.isEmpty; +import static org.tizen.common.util.StringUtil.trim; + +import java.io.BufferedReader; +import java.io.Console; +import java.io.IOException; +import java.io.PrintStream; +import java.io.Reader; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashSet; + +import org.tizen.common.core.command.Prompter; +import org.tizen.common.core.command.prompter.AbstractPrompter; +import org.tizen.common.core.command.prompter.Option; +import org.tizen.common.util.ArrayUtil; +import org.tizen.common.util.Assert; +import org.tizen.common.util.CollectionUtil; + +/** + *

+ * ConsolePrompter. + * + * {@link Prompter} for command line interface + * + * Print out using {@link PrintStream} and Read input from console( including standard input ) + *

+ * + * @author BonYong Lee{@literal } (S-Core) + */ +public class +ConsolePrompter +extends AbstractPrompter +implements Prompter +{ + /** + * {@link PrintStream} for output + */ + protected final PrintStream out; + + /** + * {@link BufferedReader} for input + */ + protected final BufferedReader reader; + + /** + * Constructor with {@link PrintStream} and {@link Reader} + * + * @param out {@link PrintStream} for output + * @param reader {@link Reader} for input + */ + public + ConsolePrompter( + final PrintStream out, + final Reader reader + ) + { + Assert.notNull( out ); + this.out = out; + this.reader = new BufferedReader( reader ); + } + + /* (non-Javadoc) + * @see org.tizen.common.core.command.Prompter#interact(java.lang.String, int, org.tizen.common.core.command.prompter.Option[]) + */ + @Override + public + Option + interact( + final String question, + final Option... options + ) + { + final HashSet