Merge sources from S-Core's RSA git (release) 2.0alpha master 2.0_alpha
authorJenkins <taeyoung2.son@samsung.com>
Tue, 18 Sep 2012 04:26:40 +0000 (13:26 +0900)
committerJenkins <taeyoung2.son@samsung.com>
Tue, 18 Sep 2012 04:26:40 +0000 (13:26 +0900)
Change-Id: Id725b7305b38bae9549884df927a5028e29a0c18

67 files changed:
AUTHORS [new file with mode: 0644]
LICENSE [new file with mode: 0644]
NOTICE [new file with mode: 0644]
build.xml [new file with mode: 0644]
org.tizen.cli/.classpath [new file with mode: 0644]
org.tizen.cli/.project [new file with mode: 0644]
org.tizen.cli/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.tizen.cli/.settings/org.eclipse.pde.core.prefs [new file with mode: 0644]
org.tizen.cli/META-INF/MANIFEST.MF [new file with mode: 0644]
org.tizen.cli/build.properties [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/web-debug [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-debug.bat [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/web-gen [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-gen.bat [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/web-install [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-install.bat [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/web-list [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-list.bat [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/web-packaging [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-packaging.bat [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/web-run [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-run.bat [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/web-signing [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-signing.bat [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/web-uninstall [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/web-uninstall.bat [new file with mode: 0644]
org.tizen.cli/doc/install/bin_/webtizen [new file with mode: 0755]
org.tizen.cli/doc/install/bin_/webtizen.bat [new file with mode: 0644]
org.tizen.cli/doc/install/conf/log4j-debug.xml [new file with mode: 0644]
org.tizen.cli/doc/install/conf/log4j-error.xml [new file with mode: 0644]
org.tizen.cli/doc/install/conf/log4j-info.xml [new file with mode: 0644]
org.tizen.cli/doc/install/conf/log4j-trace.xml [new file with mode: 0644]
org.tizen.cli/doc/install/conf/log4j-warn.xml [new file with mode: 0644]
org.tizen.cli/doc/install/conf/log4j.xml [new file with mode: 0644]
org.tizen.cli/doc/install/sample/profiles.xml [new file with mode: 0644]
org.tizen.cli/lib/ant.jar [new file with mode: 0644]
org.tizen.cli/lib/commons-cli-1.2.jar [new file with mode: 0644]
org.tizen.cli/src/org/tizen/cli/exec/AbstractLauncher.java [new file with mode: 0644]
org.tizen.cli/src/org/tizen/cli/exec/CommandLineExecutor.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/ConsolePrompter.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/ILaunchOptions.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/PolicyRegistryFactory.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/TargetDeviceSelector.java [new file with mode: 0644]
org.tizen.cli/src/org/tizen/cli/exec/WRTLauncher.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/debug/Main.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/gen/Main.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/install/Main.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/query/Main.java [new file with mode: 0644]
org.tizen.cli/src/org/tizen/cli/exec/run/Main.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/uninstall/Main.java [new file with mode: 0755]
org.tizen.cli/src/org/tizen/cli/exec/wgt/Main.java [new file with mode: 0755]
org.tizen.cli/test/src/org/tizen/cli/exec/AbstractLauncherTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/AbstractMainTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/TargetDeviceSelectorTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/WRTLauncherTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/debug/MainTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/gen/MainTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/install/MainTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/query/MainTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/run/MainTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/sign/MainTest.java [new file with mode: 0755]
org.tizen.cli/test/src/org/tizen/cli/exec/uninstall/MainTest.java [new file with mode: 0644]
org.tizen.cli/test/src/org/tizen/cli/exec/wgt/MainTest.java [new file with mode: 0644]
package/build.ubuntu-32 [new file with mode: 0755]
package/build.ubuntu-64 [new file with mode: 0755]
package/pkginfo.manifest [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..6b6f254
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,5 @@
+Gyeongseok Seo <gyeongseok.seo@samsung.com>\r
+BonYong Lee <bonyong.lee@samsung.com>\r
+Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+Kangho Kim <kh5325.kim@samsung.com>\r
+HyunGoo Kang <hyungoo1.kang@samsung.com>\r
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..bbe9d02
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+\r
+\r
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
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 (file)
index 0000000..57dabb7
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="cli.build" default="dist">
+       <property name="project" value="org.tizen.cli" />
+       <property name="build" value="build" />
+       <property name="dist" value="dist" />
+       <property name="lib" value="lib" />
+       
+       <target name="dist">
+               <delete dir="${build}" quiet="true" />
+               <mkdir dir="${build}" />
+               <copy todir="${build}">
+                       <fileset dir="${project}/src" />
+               </copy>
+               <javac srcdir="${build}" encoding="utf-8" debug="true" verbose="true">
+                       <classpath>
+                               <fileset dir="${lib}" />
+                       </classpath>
+               </javac>
+               <mkdir dir="${dist}" />
+               <jar basedir="${build}" destfile="${dist}/tizen-cli.jar">
+               </jar>
+               <delete dir="${build}" quiet="true" />
+       </target>
+</project>
diff --git a/org.tizen.cli/.classpath b/org.tizen.cli/.classpath
new file mode 100644 (file)
index 0000000..c879acc
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="test/src"/>
+       <classpathentry kind="lib" path="lib/ant.jar"/>
+       <classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.tizen.cli/.project b/org.tizen.cli/.project
new file mode 100644 (file)
index 0000000..16a12da
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.tizen.cli</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
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 (file)
index 0000000..c328be6
--- /dev/null
@@ -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 (file)
index 0000000..d778992
--- /dev/null
@@ -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 (file)
index 0000000..9903541
--- /dev/null
@@ -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 (file)
index 0000000..45e04ba
--- /dev/null
@@ -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 (executable)
index 0000000..ebc2645
--- /dev/null
@@ -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 (file)
index 0000000..3920cfd
--- /dev/null
@@ -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 (executable)
index 0000000..b63a8a4
--- /dev/null
@@ -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 (file)
index 0000000..9c58522
--- /dev/null
@@ -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 (executable)
index 0000000..4939e32
--- /dev/null
@@ -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 (file)
index 0000000..414b9f1
--- /dev/null
@@ -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 (executable)
index 0000000..6f16928
--- /dev/null
@@ -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 (file)
index 0000000..26950f8
--- /dev/null
@@ -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 (executable)
index 0000000..93b141f
--- /dev/null
@@ -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 (file)
index 0000000..fe9319c
--- /dev/null
@@ -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 (executable)
index 0000000..a76202a
--- /dev/null
@@ -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 (file)
index 0000000..fb5cf60
--- /dev/null
@@ -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 (executable)
index 0000000..0563925
--- /dev/null
@@ -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 (file)
index 0000000..f941a59
--- /dev/null
@@ -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 (executable)
index 0000000..9644f74
--- /dev/null
@@ -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 (file)
index 0000000..e98f6a3
--- /dev/null
@@ -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 (executable)
index 0000000..b1f5d84
--- /dev/null
@@ -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 (file)
index 0000000..0bba2d5
--- /dev/null
@@ -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 (file)
index 0000000..625523d
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="debug" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
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 (file)
index 0000000..50905c9
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="error" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
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 (file)
index 0000000..c1d5f9e
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="info" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
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 (file)
index 0000000..61298ea
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="trace" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
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 (file)
index 0000000..b984f69
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="warn" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
diff --git a/org.tizen.cli/doc/install/conf/log4j.xml b/org.tizen.cli/doc/install/conf/log4j.xml
new file mode 100644 (file)
index 0000000..328d165
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="off" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
diff --git a/org.tizen.cli/doc/install/sample/profiles.xml b/org.tizen.cli/doc/install/sample/profiles.xml
new file mode 100644 (file)
index 0000000..7d352b7
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles>
+       <profile name="test">
+               <profileitem author="true" identifier="%a:%f:%w:%h:%t" key="/home/bylee/dev/cli/sample/samsung.devmode.sdk.cert.p12"/>
+               <profileitem author="false" identifier="%a:%f:%w:%h:%t" key="/home/bylee/dev/cli/sample/samsung.devmode.sdk.cert.p12"/>
+       </profile>
+</profiles>
diff --git a/org.tizen.cli/lib/ant.jar b/org.tizen.cli/lib/ant.jar
new file mode 100644 (file)
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 (file)
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 (file)
index 0000000..9096f5a
--- /dev/null
@@ -0,0 +1,522 @@
+/*
+ * Web IDE - Command Line Interface
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * 
+ * 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;
+
+/**
+ * <p>
+ * AbstractLauncher.
+ * 
+ * abstract class for simple command.
+ * 
+ * provide {@link ExecutionContext} for command line
+ * </p>
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+abstract public class
+AbstractLauncher
+{
+       /**
+        * Program name property key
+        */
+       protected static final String PROP_PRG = "cli.name";
+       
+       /**
+        * <p>
+        * Option for help text
+        * </p>
+        */
+       protected static final String OPT_HELP = "help";
+       
+       /**
+        * <p>
+        * Description for help option
+        * 
+        * This is printed out in usage
+        * </p>
+        * 
+        * @see #OPT_HELP
+        */
+       protected static final String DESC_HELP = "print out this page";
+       
+       /**
+        * <p>
+        * Option for log level
+        * 
+        * This option is shared in shell
+        * </p>
+        */
+       protected static final String OPT_LOG = "log";
+       
+       /**
+        * <p>
+        * Description for log level option
+        * 
+        * This is printed out in usage
+        * </p>
+        * 
+        * @see #OPT_LOG
+        */
+       protected static final String DESC_LOG = "specify log level( ex - error, warn, info, debug, trace, none )";
+       
+       /**
+        * <p>
+        * Option for no output
+        * </p>
+        */
+       protected static final String OPT_QUIET = "quiet";
+       
+       /**
+        * <p>
+        * Description for no output option
+        * 
+        * This is printed out in usage
+        * </p>
+        * 
+        * @see #OPT_QUIET
+        */
+       protected static final String DESC_QUIET = "execute silently";
+       
+       /**
+        * <p>
+        * Property key for command line parameter parser
+        * </p>
+        */
+       protected static final String PROP_PARSER = "tizen.cli.parser";
+       
+       /**
+        * <p>
+        * logger for this object
+        * </p>
+        */
+       protected final Logger logger = LoggerFactory.getLogger( getClass() );
+       
+       /**
+        * <p>
+        * optional flag to be specified by user
+        * 
+        * flag is formatted in POSIX style in default
+        * </p>
+        */
+       protected CommandLine cmd;
+       
+       /**
+        * {@link Executor} for Command Line Interface
+        */
+       protected Executor executor; 
+
+       /**
+        * Convert <code>path</code> 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 <code>args</code> 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
+        * <ul>
+        * <li>POSIX style - tar -zxvf foo.tar.gz</li>
+        * <li>GNU style - du --human-readable --max-depth=1</li>
+        * </ul>
+        * 
+        * 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 (executable)
index 0000000..d839bb0
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Web IDE - Command Line Interface
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * 
+ * 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;
+
+/**
+ * <p>
+ * CommandLineExecutor.
+ * 
+ * {@link Executor} for commaand line interface
+ * </p>
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+CommandLineExecutor
+extends Executor
+{
+
+       /**
+        * Contructor with prompter
+        * 
+        * @param prompter {@link Prompter}
+        */
+       public
+       CommandLineExecutor(
+               final Prompter prompter
+       )
+       {
+               super(
+                       new Factory<ExecutionContext>() {
+                               
+                               /**
+                                * {@link FileHandler} for Command Line Interface
+                                */
+                               protected FileHandler fileHandler = new StandardFileHandler();
+                               
+                               
+                               /**
+                                * <p>
+                                * {@link PolicyRegistry} for Command Line Interface
+                                * </p>
+                                */
+                               protected Factory<PolicyRegistry> 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 (executable)
index 0000000..1e7cd59
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Web IDE - Command Line Interface
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * 
+ * 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;
+
+/**
+ * <p>
+ * ConsolePrompter.
+ * 
+ * {@link Prompter} for command line interface
+ * 
+ * Print out using {@link PrintStream} and Read input from console( including standard input )
+ * </p>
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (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<Option> reducedOptions = new LinkedHashSet<Option>();
+               Option defaultOption = null;
+               final ArrayList<String> optionNames = new ArrayList<String>();
+               for ( final Option option : options )
+               {
+                       if ( reducedOptions.contains( option ) )
+                       {
+                               throw new IllegalArgumentException( "Question can't have duplicated choice(s) :" + option );
+                       }
+                       optionNames.add( option.getName() );
+                       reducedOptions.add( option );
+                       if ( option.isDefault() )
+                       {
+                               if ( null != defaultOption )
+                               {
+                                       throw new IllegalArgumentException(
+                                               "Question must have only one default choice"
+                                       );
+                               }
+                                       
+                               defaultOption = option;
+                       }
+               }
+               
+               String choice = null;
+               try
+               {
+                       while ( true )
+                       {
+                               printQuestion( question, options );
+                               
+                               choice = reader.readLine();
+                               if ( isEmpty( choice ) )
+                               {
+                                       return defaultOption;
+                               }
+                               for ( final Option option : options )
+                               {
+                                       if ( option.isMatch( choice ) )
+                                       {
+                                               return option;
+                                       }
+                               }
+                       }
+               } catch ( final IOException e )
+               {
+                       throw new IllegalStateException( e );
+               }
+       }
+       
+       /**
+        * Print out question and options for choice
+        * 
+        * @param question message to print
+        * @param options options to suggest
+        */
+       protected
+       void
+       printQuestion(
+               final String question,
+               final Option... options
+       )
+       {
+               out.print( question );
+               if ( !ArrayUtil.isEmpty( options ) )
+               {
+                       out.print( "( " );
+                       out.print( CollectionUtil.concatenate( options, " / " ) );
+                       out.print( " )" );
+               }
+       }
+       
+       /* (non-Javadoc)
+        * @see org.tizen.common.core.command.Prompter#notify(java.lang.String, java.lang.Object[])
+        */
+       @Override
+       public
+       void
+       notify(
+               final String message
+       )
+       {
+               out.println( message );
+       }
+
+       /* (non-Javadoc)
+        * @see org.tizen.common.core.command.Prompter#cancel()
+        */
+       @Override
+       public void cancel()
+       {
+       }
+
+       /* (non-Javadoc)
+        * @see org.tizen.common.core.command.Prompter#password(java.lang.String)
+        */
+       @Override
+       public
+       char[] password(
+               final String message
+       )
+       {
+               out.print( trim( message ) );
+               out.print( " " );
+               Console console = System.console();
+               return console.readPassword();
+       }
+
+       /* (non-Javadoc)
+        * @see org.tizen.common.core.command.Prompter#error(java.lang.String, java.lang.Object[])
+        */
+       @Override
+       public
+       void
+       error(
+               final String message
+       )
+       {
+               out.println( message );
+       }
+
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/ILaunchOptions.java b/org.tizen.cli/src/org/tizen/cli/exec/ILaunchOptions.java
new file mode 100755 (executable)
index 0000000..db295ef
--- /dev/null
@@ -0,0 +1,142 @@
+package org.tizen.cli.exec;\r
+\r
+public interface ILaunchOptions\r
+{\r
+    \r
+    /**\r
+     * <p>\r
+     * Description for target widget id\r
+     * \r
+     * This is printed out in usage\r
+     * </p>\r
+     * \r
+     * @see #OPT_WIDGETID\r
+     */\r
+    String DESC_WIDGETID = "Command is performed of running widget kill in target, widget id is user written id in config.xml";\r
+\r
+    /**\r
+     * <p>\r
+     * Option for target widget file\r
+     * </p>\r
+     */\r
+    String OPT_WIDGETFILE = "widget";\r
+\r
+    /**\r
+     * <p>\r
+     * Description for target widget file\r
+     * \r
+     * This is printed out in usage\r
+     * </p>\r
+     * \r
+     * @see #OPT_WIDGETFILE\r
+     */\r
+    String DESC_WIDGETFILE = "Command is performed of widget file install in target";\r
+\r
+    /**\r
+     * <p>\r
+     * Option for target widget id\r
+     * </p>\r
+     */\r
+    String OPT_WIDGETID = "id";\r
+\r
+    /**\r
+     * <p>\r
+     * Option for project name\r
+     * </p>\r
+     */\r
+    String OPT_NAME = "name";\r
+\r
+    /**\r
+     * <p>\r
+     * Description for project name\r
+     * \r
+     * This is printed out in usage\r
+     * </p>\r
+     * \r
+     * @see #OPT_WIDGETFILE\r
+     */\r
+    String DESC_NAME = "generation project name";\r
+\r
+    /**\r
+     * <p>\r
+     * Option for project name\r
+     * </p>\r
+     */\r
+    String OPT_PATH = "path";\r
+\r
+    /**\r
+     * <p>\r
+     * Description for project name\r
+     * \r
+     * This is printed out in usage\r
+     * </p>\r
+     * \r
+     * @see #OPT_WIDGETFILE\r
+     */\r
+    String DESC_PATH = "generation project path";\r
+\r
+    \r
+    /**\r
+     * <p>\r
+     * Option for include file pattern\r
+     * </p>\r
+     */\r
+    String OPT_INCLUDE = "include";\r
+    \r
+    /**\r
+     * <p>\r
+     * Description for include file pattern option\r
+     * \r
+     * It is printed out in usage\r
+     * </p>\r
+     */\r
+    String DESC_INCLUDE = "file name pattern to include";\r
+    \r
+    /**\r
+     * <p>\r
+     * Option for exclude file pattern\r
+     * </p>\r
+     */\r
+    String OPT_EXCLUDE = "exclude";\r
+    \r
+    /**\r
+     * <p>\r
+     * Description for exclude file pattern option\r
+     * \r
+     * It is printed out in usage\r
+     * </p>\r
+     */\r
+    String DESC_EXCLUDE = "file name pattern to exclude";\r
+    \r
+    /**\r
+     * <p>\r
+     * Option for no check of validation\r
+     * </p>\r
+     */\r
+    String OPT_NOCHECK = "nocheck";\r
+    \r
+    /**\r
+     * <p>\r
+     * Description for no check option\r
+     * \r
+     * It is printed out in usage\r
+     * </p>\r
+     */\r
+    String DESC_NOCHECK = "skip validation check";\r
+    \r
+    /**\r
+     * <p>\r
+     * Option for over-writing of output file\r
+     * </p>\r
+     */\r
+    String OPT_OVERWRITE = "overwrite";\r
+    \r
+    /**\r
+     * <p>\r
+     * Description for overwrite option\r
+     * \r
+     * It is printed out in usage\r
+     * </p>\r
+     */\r
+    String DESC_OVERWRITE = "overwrite output file if it exists";\r
+}\r
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/PolicyRegistryFactory.java b/org.tizen.cli/src/org/tizen/cli/exec/PolicyRegistryFactory.java
new file mode 100755 (executable)
index 0000000..3fd56d2
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Web IDE - Command Line Interface
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * 
+ * 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.core.command.Policy.EXIST_OUT_FILE;
+import static org.tizen.common.core.command.Policy.NONEXIST_IN_FILE;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.common.Factory;
+import org.tizen.common.core.command.Policy;
+import org.tizen.common.core.command.policy.AbstractPolicy;
+import org.tizen.common.core.command.policy.FilePolicy;
+import org.tizen.common.core.command.policy.MessagePolicy;
+import org.tizen.common.core.command.policy.PolicyRegistry;
+
+/**
+ * <p>
+ * PolicyRegistryFactory.
+ * 
+ * {@link Factory} to provide {@link PolicyRegistry}
+ * 
+ * </p>
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+PolicyRegistryFactory
+implements Factory<PolicyRegistry>
+{
+       /**
+        * Logger for this instance
+        */
+       protected final Logger logger =
+               LoggerFactory.getLogger( PolicyRegistryFactory.class );
+       
+       /**
+        * <p>
+        * CLIPolicy.
+        * 
+        * {@link Policy} when command line interface
+        * </p>
+        * 
+        * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+        * 
+        * @see PolicyRegistry, {@link Policy}
+        */
+       class CLIPolicy 
+       extends AbstractPolicy
+       {
+               /**
+                * <p>
+                * Constructor with <code>name</code>
+                * </p>
+                * 
+                * @param name policy name
+                */
+               public CLIPolicy( final String name )
+               {
+                       super( name );
+               }
+
+               /* (non-Javadoc)
+                * @see org.tizen.common.Adaptable#adapt(java.lang.Class)
+                */
+               @Override
+               @SuppressWarnings("unchecked")
+               public <T>
+               T
+               adapt(
+                       final Class<T> clazz
+               )
+               {
+                       if ( clazz.isAssignableFrom( FilePolicy.class ) )
+                       {
+                               return (T) FilePolicy.STOP_PROCESS;
+                       }
+                       else if ( clazz.isAssignableFrom( MessagePolicy.class) )
+                       {
+                               return (T) MessagePolicy.PROMPTER;
+                       }
+                       return null;
+               }
+
+       }
+       /* (non-Javadoc)
+        * @see org.tizen.common.Factory#create()
+        */
+       @Override
+       public
+       PolicyRegistry
+       create()
+       {
+               final PolicyRegistry registry = new PolicyRegistry();
+               
+               registry.register( new CLIPolicy( EXIST_OUT_FILE ) );
+               registry.register( new CLIPolicy( NONEXIST_IN_FILE ) );
+               
+               return registry;
+       }
+
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/TargetDeviceSelector.java b/org.tizen.cli/src/org/tizen/cli/exec/TargetDeviceSelector.java
new file mode 100644 (file)
index 0000000..c9d450b
--- /dev/null
@@ -0,0 +1,200 @@
+/*
+ * Web IDE - Command Line Interface
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GyeongSeok Seo <gyeongseok.seo@samsung.com>
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * 
+ * 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.core.command.Prompter;
+import org.tizen.common.core.command.prompter.ChoiceOption;
+import org.tizen.common.core.command.prompter.GenericOption;
+import org.tizen.common.core.command.prompter.Option;
+import org.tizen.common.core.command.sdb.SmartDevelopmentBridgeManager;
+import org.tizen.common.util.ArrayUtil;
+import org.tizen.common.util.StringUtil;
+import org.tizen.sdblib.IDevice;
+
+
+
+/**
+ * common class for WRT command
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+TargetDeviceSelector
+{
+    protected Prompter prompter;
+    protected int sdbtime;
+
+    public int getSdbtime() {
+        return sdbtime;
+    }
+
+    public void setSdbtime(int sdbtime) {
+        this.sdbtime = sdbtime;
+    }
+
+    public TargetDeviceSelector(Prompter prompter) {
+        this.prompter = prompter;
+        this.sdbtime = 3000;
+    }
+
+    protected SmartDevelopmentBridgeManager createSDBManager() {
+        return new SmartDevelopmentBridgeManager();
+    }
+
+    protected void printDeviceList( IDevice[] devices ) {
+        prompter.notify( "-----------------------------" );
+        prompter.notify( "currnet connected target List" );
+        prompter.notify( "-----------------------------" );
+        for( int i = 0; i < devices.length; i++ ) {
+            prompter.notify( (i+1) + ") " + devices[i].toString() );
+        }
+    }
+
+    public IDevice[] getConnectDevices() {
+        SmartDevelopmentBridgeManager mgr = createSDBManager();
+
+        int waitTime = getSdbtime();
+        while ( !mgr.isConnected() ) {
+            try {
+                Thread.sleep( 100 );
+                waitTime -= 100;
+
+                if ( waitTime <= 0 ) {
+                    prompter.notify( "SDB can't started" );
+                    return null;
+                }
+            } catch (InterruptedException e) {
+                prompter.notify( e.getMessage() );
+            }
+        }
+
+        return mgr.getDevices();
+    }
+
+    public boolean isDeviceConnected() {
+        return null != ArrayUtil.pickupFirst( getConnectDevices() );
+    }
+
+    public boolean isDeviceConnected( String name ) {
+        return null != getDevice( name );
+    }
+
+    public boolean isDeviceConnected( IDevice device ) {
+        if ( device == null ) {
+            return false;
+        }
+        return null != getDevice( device.toString() );
+    }
+
+    public IDevice getDevice( String name ) {
+        IDevice device = null;
+        if ( name == null ) {
+            return device;
+        }
+        IDevice[] devices = getConnectDevices();
+        for( int i = 0; i < devices.length; i++ ) {
+            if ( name.equals( devices[i].toString() ) ) {
+                device = devices[i];
+                break;
+            }
+        }
+        return device;
+    }
+
+    public IDevice selectDevice() {
+        IDevice selectDevice = null;
+        IDevice[] devices = getConnectDevices();
+
+        if( devices == null ) {
+            return selectDevice;
+        }
+
+        if ( devices.length == 1 ) {
+            prompter.notify( "Select Device is : " + ArrayUtil.pickupFirst( devices ).toString() );
+            selectDevice = ArrayUtil.pickupFirst( devices );
+        } else if ( devices.length > 1 ) {
+            ChoiceOption yes = new ChoiceOption( "Yes" );
+            ChoiceOption no = new ChoiceOption( "No", true );
+
+            final Option option = prompter.interact(
+                MessageFormat.format( "device is not selected\n" +
+                                      "[{0}] device select and\n" +
+                                      "Do you want to be continue ?", devices[0].toString() ),
+                yes,
+                no
+            );
+
+            if ( yes.equals(option) ) {
+                selectDevice = ArrayUtil.pickupFirst( devices );
+            } else if ( no.equals( option ) ) {
+                printDeviceList( devices );
+
+                ChoiceOption cancel = new ChoiceOption( "Cancel", true );
+                GenericOption num = new GenericOption( "Num" );
+
+                final Option op = prompter.interact(
+                    "select device or cancel process ",
+                    cancel,
+                    num
+                );
+
+                if( cancel.equals( op ) ) {
+                    prompter.notify( "Process is canceled, please selected device" );
+                } else {
+                    String answer = ((GenericOption)op).getAnswer();
+                    if ( !StringUtil.isEmpty( answer ) ) {
+                        boolean isCorrect = false;
+                        int index = 0;
+                        try {
+                            index = Integer.parseInt( answer );
+
+                            // answer check
+                            for ( int i = 1; i <= devices.length; i++ ) {
+                                if ( index == i ) {
+                                    isCorrect = true;
+                                    break;
+                                }
+                            }
+                        } catch (NumberFormatException e) {
+                        } finally {
+                            if ( isCorrect ) {
+                                selectDevice = ArrayUtil.get( devices, index-1 );
+                                prompter.notify( "Select Device is : " + selectDevice.toString() );
+                            } else {
+                                prompter.notify( "Process is canceled, please selected correct device" );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        return selectDevice;
+    }
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/WRTLauncher.java b/org.tizen.cli/src/org/tizen/cli/exec/WRTLauncher.java
new file mode 100755 (executable)
index 0000000..f32fd27
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.util.List;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.common.core.command.ExecutionContext;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.common.util.HostUtil;
+import org.tizen.common.util.OSChecker;
+import org.tizen.common.util.StringUtil;
+import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.SmartDevelopmentBridge;
+
+/**
+ * <p>
+ * WRTLauncher.
+ * 
+ * class for simple WRT command.
+ * 
+ * provide {@link ExecutionContext} for command line
+ * </p>
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+WRTLauncher
+extends AbstractLauncher
+{
+    /**
+     * <p>
+     * Option for select device
+     * </p>
+     */
+    protected static final String OPT_DEVICE = "device";
+
+    /**
+     * <p>
+     * Description for select device
+     * 
+     * This is printed out in usage
+     * </p>
+     * 
+     * @see #OPT_DEVICE
+     */
+    protected static final String DESC_DEVICE = "Command is performed of selected device";
+
+    /**
+     * <p>
+     * Option for wait for the sdb demon connection and command completion.
+     * </p>
+     */
+    protected static final String OPT_TIME = "time";
+
+    /**
+     * <p>
+     * Description for wait for the sdb demon connection and command completion.
+     * 
+     * This is printed out in usage
+     * </p>
+     * 
+     * @see #OPT_TIME
+     */
+    protected static final String DESC_TIME = "sdb demon connection and command completion wating time (sec)";
+
+    /**
+     * <p>
+     * Target device
+     * 
+     * command is running in this device
+     * </p>
+     */
+    protected IDevice device = null;
+
+    /**
+     * Get target device
+     * 
+     * @return device
+     */
+    public IDevice getDevice() {
+        return device;
+    }
+
+    /**
+     * Set target device
+     * 
+     * @param device
+     */
+    public void setDevice(IDevice device) {
+        this.device = device;
+    }
+
+    /**
+     * command and sdb daemon connection wait time
+     */
+    protected int time = 90;
+
+    /**
+     * Get command and sdb daemon connection wait time
+     * 
+     * @return time
+     */
+    public int getTime() {
+        return time;
+    }
+
+    /**
+     * Set command and sdb daemon connection wait time
+     * 
+     * @param time
+     */
+    public void setTime(int time) {
+        this.time = time;
+    }
+
+    /**
+     * {@link Options} for usage
+     * 
+     * @return defined {@link Options}
+     */
+    @SuppressWarnings("static-access")
+    protected
+    Options
+    getOptions()
+    {
+        final Options opts = super.getOptions();
+        opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_DEVICE ).withDescription( DESC_DEVICE ).create( OPT_DEVICE.substring( 0, 1 ) ) );
+        opts.addOption( OptionBuilder.hasOptionalArg().withLongOpt( OPT_TIME ).withDescription( DESC_TIME ).create( OPT_TIME.substring( 0, 1 ) ) );
+
+        return opts;
+    }
+
+    protected void startSDB() {
+        final Prompter prompter = getPrompter();
+        String sdbPath = InstallPathConfig.getSDBPath();
+        logger.trace( "sdb lib Path :{}", sdbPath );
+
+        try {
+            SmartDevelopmentBridge.init();
+            SmartDevelopmentBridge.createBridge(sdbPath, true);
+        } catch (Throwable t) {
+            logger.error("Problem occurred while initializing sdb", t.getMessage(), t);
+            prompter.notify("Failed to start sdb : " + sdbPath );
+        }
+
+        if (OSChecker.isWindows()) {
+            String dllPath = InstallPathConfig.getSdbWinUsbApiPath();
+            if (!HostUtil.exists(dllPath))
+            {
+                prompter.notify("There is no " + dllPath + ".\n" +
+                        "It's not mandatory but you may have problem in using sdb through USB.");
+            }
+        }
+    }
+    @SuppressWarnings("static-access")
+    protected void endSDB() {
+        SmartDevelopmentBridge.getBridge().terminate();
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    protected void execute(CommandLine cmdLine) throws Exception {
+        startSDB();
+        final Prompter prompter = getPrompter();
+        final List<String> args = cmdLine.getArgList();
+        final TargetDeviceSelector deviceSelector = new TargetDeviceSelector(prompter);
+        String time = cmdLine.getOptionValue( OPT_TIME );
+        logger.trace( "option input waiting time value:{} sec", time );
+        if ( !StringUtil.isEmpty( time ) ) {
+            setTime( Integer.parseInt(time) );
+            deviceSelector.setSdbtime( getTime()*1000 );
+        }
+        logger.trace( "waiting time value:{} sec", getTime() );
+        logger.trace( "arguments :{}", args );
+
+        logger.trace("check connected devices");
+        if ( !deviceSelector.isDeviceConnected() ) {
+            prompter.notify( "Device is not connected. Process is canceled" );
+            endSDB();
+            return ;
+        }
+
+        String deviceName = cmdLine.getOptionValue( OPT_DEVICE );
+        logger.trace( "Device option :{}", deviceName );
+
+        if ( !StringUtil.isEmpty( deviceName ) ) {
+            setDevice( deviceSelector.getDevice( deviceName ) );
+            if ( getDevice() == null ) {
+                prompter.notify( "Process is stoped, please select connect device" );
+            }
+        } else {
+            // user not using device select option
+            logger.trace( "user can't use device select option" );
+            setDevice( deviceSelector.selectDevice() );
+        }
+    }
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/debug/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/debug/Main.java
new file mode 100755 (executable)
index 0000000..7436287
--- /dev/null
@@ -0,0 +1,199 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.debug;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.tizen.cli.exec.ILaunchOptions;
+import org.tizen.cli.exec.WRTLauncher;
+import org.tizen.common.core.command.Executor;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.common.core.command.sdb.PushSdbCommand;
+import org.tizen.common.file.FileHandler;
+import org.tizen.common.file.FileHandler.Attribute;
+import org.tizen.common.util.FilenameUtil;
+import org.tizen.common.util.StringUtil;
+import org.tizen.web.launch.cli.command.CheckInstallCommand;
+import org.tizen.web.launch.cli.command.DebugCommand;
+import org.tizen.web.launch.cli.command.InstallCommand;
+import org.tizen.web.launch.cli.command.KillCommand;
+import org.tizen.web.launch.cli.command.ModeCommnad;
+
+/**
+ * Command Line Interface for debug run widget in target
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+Main
+extends WRTLauncher
+implements ILaunchOptions
+{
+
+    /**
+     * <p>
+     * Description for target widget id
+     * 
+     * This is printed out in usage
+     * </p>
+     * 
+     * @see #OPT_WIDGETID
+     */
+    protected static final String DESC_WIDGETID = "Command is performed of widget id uninstall in target, widget id is user written id in config.xml";
+
+    /**
+     * Entry point for cli main
+     * 
+     * @param args user input parameter
+     * 
+     * @throws Exception If unhandled exception occur
+     */
+    public static
+    void
+    main(
+        final String[] args
+    )
+    throws Exception
+    {
+        final Main instance = new Main();
+        instance.run( args );
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+     */
+    @Override
+    protected
+    void
+    execute(
+        final CommandLine cmdLine
+    )
+    throws Exception
+    {
+        super.execute( cmdLine );
+
+        final Prompter prompter = getPrompter();
+        final FileHandler fileHandler = getFileHandler();
+        final Executor exec = getExecutor();
+
+        // device not connect then exit
+        if ( getDevice() == null ) {
+            endSDB();
+            return ;
+        }
+
+        // local widget file path control
+        String inputName = cmdLine.getOptionValue( OPT_WIDGETFILE );
+        logger.trace("input file name : {} ", inputName);
+        if ( StringUtil.isEmpty( inputName ) ) {
+            prompter.notify( "widget file not selected." );
+            printHelp();
+            endSDB();
+        }
+        String widgetId = cmdLine.getOptionValue( OPT_WIDGETID );
+
+        String filePath = (String)fileHandler.get( inputName, Attribute.PATH );
+        logger.trace( "local widget file path : {}", filePath );
+
+        String fileName = FilenameUtil.getFilename( inputName );
+        logger.trace( "local widget file name : {}", fileName );
+
+        // core operation
+        InstallCommand install_command = new InstallCommand();
+        install_command.setWidget( fileName );
+        install_command.setDevice( getDevice() );
+        install_command.setTime( getTime() );
+        String remotePath = install_command.getRemotePath() + fileName;
+        logger.trace( "remote widget file path : {}", remotePath );
+
+        PushSdbCommand push_command = new PushSdbCommand( filePath, remotePath );
+        push_command.setDevice( getDevice() );
+
+        ModeCommnad mode_command = new ModeCommnad();
+        mode_command.setDevice( getDevice() );
+        mode_command.setTime( getTime() );
+
+        // widget push
+        logger.trace( "push command");
+        exec.execute( push_command );
+        if ( "failed".equals( push_command.getResult() ) ) {
+            endSDB();
+        }
+
+        // widget mode
+        logger.trace( "mode command");
+        exec.execute( mode_command );
+        if ( mode_command.getResult().contains( "failed" ) ) {
+            endSDB();
+        }
+
+        if ( !StringUtil.isEmpty( widgetId ) ) {
+            logger.trace( "same widget's pre-install check and kill process" );
+            CheckInstallCommand check_install_cmd = new CheckInstallCommand( widgetId );
+            check_install_cmd.setDevice( getDevice() );
+            check_install_cmd.setTime( getTime() );
+            check_install_cmd.setPrintOption( false );
+            exec.execute( check_install_cmd );
+            if ( check_install_cmd.isInstalled() ) {
+                KillCommand kill_cmd = new KillCommand( widgetId );
+                kill_cmd.setPrintOption( false );
+                kill_cmd.setDevice( getDevice() );
+                kill_cmd.setTime( getTime() );
+                exec.execute( kill_cmd );
+            }
+        }
+
+        // widget install
+        logger.trace( "install command");
+        exec.execute( install_command );
+
+        // widget debug run
+        DebugCommand run_command = new DebugCommand( widgetId );
+        run_command.setDevice( getDevice() );
+        run_command.setTime( getTime() );
+        exec.execute( run_command );
+
+        endSDB();
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#getOptions()
+     */
+    @Override
+    @SuppressWarnings("static-access")
+    protected
+    Options
+    getOptions()
+    {
+        final Options opts = super.getOptions();
+        opts.addOption( OptionBuilder.hasArg().isRequired().withLongOpt( OPT_WIDGETFILE ).withDescription( DESC_WIDGETFILE ).create( OPT_WIDGETFILE.substring( 0, 1 ) ) );
+        opts.addOption( OptionBuilder.hasArg().isRequired().withLongOpt( OPT_WIDGETID ).withDescription( DESC_WIDGETID ).create( OPT_WIDGETID.substring( 0, 1 ) ) );
+
+        return opts;
+    }
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/gen/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/gen/Main.java
new file mode 100755 (executable)
index 0000000..977cf0f
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* Jihoon Song <jihoon80.song@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* Hyeongseok Heo <hyeongseok.heo@samsung.com>
+* 
+* 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.gen;
+
+import java.text.MessageFormat;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.tizen.cli.exec.AbstractLauncher;
+import org.tizen.cli.exec.ILaunchOptions;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.common.core.command.prompter.ChoiceOption;
+import org.tizen.common.core.command.prompter.Option;
+import org.tizen.common.util.ObjectUtil;
+import org.tizen.web.project.wizard.cli.command.ProjectGenCommand;
+
+/**
+ * Command Line Interface for install widget in target
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author Jihoon Song{@literal <jihoon80.song@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * @author Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-Core)
+ */
+public class
+Main
+extends AbstractLauncher
+implements ILaunchOptions
+{
+
+
+       /**
+        * Entry point for cli main
+        * 
+        * @param args user input parameter
+        * 
+        * @throws Exception If unhandled exception occur
+        */
+       public static
+       void
+       main (
+               final String[] args
+       )
+       throws Exception
+       {
+               final Main instance = new Main();
+               instance.run( args );
+       }
+
+       @Override
+       protected
+       void
+       execute(
+               CommandLine cmdLine
+       )
+       throws Exception
+       {
+               final Prompter prompter = getPrompter();
+
+               logger.trace( "create ProjectGenCommand instance" );
+               ProjectGenCommand command = new ProjectGenCommand();
+
+               logger.trace( "get user input options" );
+               String name = cmdLine.getOptionValue( OPT_NAME );
+               String path = cmdLine.getOptionValue( OPT_PATH );
+
+               logger.trace( "set user input options" );
+               command.setProjectName( name );
+               command.setTargetPath( path );
+
+               logger.trace( "check destination directory" );
+               String destDir = command.getDestDir();
+               if ( command.isDirectoryExists( destDir ) ) {
+                       ChoiceOption yes = new ChoiceOption( "Yes" );
+                       ChoiceOption no = new ChoiceOption( "No", true );
+
+                       final Option option = prompter.interact(
+                               MessageFormat.format( "{0} is already exist\nDo you want to be overwrite and continue?", destDir ),
+                               yes,
+                               no
+                       );
+
+                       if ( no.equals( option ) )
+                       {
+                               prompter.notify( "Process is canceled" );
+                               return ;
+                       }
+               }
+
+               logger.trace( "execute project gen command" );
+               getExecutor().execute( command );
+
+               logger.trace( "check excute result" );
+               String result = command.getResult();
+               if ( ObjectUtil.equals("success", result) ) {
+                       command.printInfo(prompter);
+               }
+               prompter.notify( result );
+       }
+
+       /* (non-Javadoc)
+        * @see org.tizen.cli.exec.AbstractLauncher#getOptions()
+        */
+       @Override
+    @SuppressWarnings("static-access")
+       protected
+       Options
+       getOptions()
+       {
+               final Options opts = super.getOptions();
+               opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_NAME ).withDescription( DESC_NAME ).create( OPT_NAME.substring( 0, 1 ) ) );
+               opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_PATH ).withDescription( DESC_PATH ).create( OPT_PATH.substring( 0, 1 ) ) );
+               return opts;
+       }
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/install/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/install/Main.java
new file mode 100755 (executable)
index 0000000..8df3719
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.install;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.tizen.cli.exec.ILaunchOptions;
+import org.tizen.cli.exec.WRTLauncher;
+import org.tizen.common.core.command.Executor;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.common.core.command.sdb.PushSdbCommand;
+import org.tizen.common.file.FileHandler;
+import org.tizen.common.file.FileHandler.Attribute;
+import org.tizen.common.util.FilenameUtil;
+import org.tizen.common.util.StringUtil;
+import org.tizen.web.launch.cli.command.CheckInstallCommand;
+import org.tizen.web.launch.cli.command.InstallCommand;
+import org.tizen.web.launch.cli.command.KillCommand;
+import org.tizen.web.launch.cli.command.ModeCommnad;
+
+/**
+ * Command Line Interface for install widget in target
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+Main
+extends WRTLauncher
+implements ILaunchOptions
+{
+
+    /**
+     * <p>
+     * Description for target widget id
+     * 
+     * This is printed out in usage
+     * </p>
+     * 
+     * @see #OPT_WIDGETID
+     */
+    protected static final String DESC_WIDGETID = "Command is performed of running widget kill in target, widget id is user written id in config.xml";
+
+    /**
+     * Entry point for cli main
+     * 
+     * @param args user input parameter
+     * 
+     * @throws Exception If unhandled exception occur
+     */
+    public static
+    void
+    main(
+        final String[] args
+    )
+    throws Exception
+    {
+        final Main instance = new Main();
+        instance.run( args );
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+     */
+    @Override
+    protected
+    void
+    execute(
+        final CommandLine cmdLine
+    )
+    throws Exception
+    {
+        super.execute( cmdLine );
+
+        final Prompter prompter = getPrompter();
+        final FileHandler fileHandler = getFileHandler();
+        final Executor exec = getExecutor();
+
+        // device not connect then exit
+        if ( getDevice() == null ) {
+            endSDB();
+            return ;
+        }
+
+        // local widget file path control
+        String inputName = cmdLine.getOptionValue( OPT_WIDGETFILE );
+        logger.trace("input file name : {} ", inputName);
+        if ( StringUtil.isEmpty( inputName ) ) {
+            prompter.notify( "widget file not selected." );
+            printHelp();
+            endSDB();
+        }
+        String widgetId = cmdLine.getOptionValue( OPT_WIDGETID );
+
+        String filePath = (String)fileHandler.get( inputName, Attribute.PATH );
+        logger.trace( "local widget file path : {}", filePath );
+
+        String fileName = FilenameUtil.getFilename( inputName );
+        logger.trace( "local widget file name : {}", fileName );
+
+        // core operation
+        InstallCommand install_command = new InstallCommand();
+        install_command.setWidget( fileName );
+        install_command.setDevice( getDevice() );
+        install_command.setTime( getTime() );
+        String remotePath = install_command.getRemotePath() + fileName;
+        logger.trace( "remote widget file path : {}", remotePath );
+
+        PushSdbCommand push_command = new PushSdbCommand( filePath, remotePath );
+        push_command.setDevice( getDevice() );
+
+        ModeCommnad mode_command = new ModeCommnad();
+        mode_command.setDevice( getDevice() );
+        mode_command.setTime( getTime() );
+
+        // widget push
+        logger.trace( "push command");
+        exec.execute( push_command );
+        if ( "failed".equals( push_command.getResult() ) ) {
+            endSDB();
+        }
+
+        // widget mode
+        logger.trace( "mode command");
+        exec.execute( mode_command );
+        if ( mode_command.getResult().contains( "failed" ) ) {
+            endSDB();
+        }
+
+        if ( !StringUtil.isEmpty( widgetId ) ) {
+            logger.trace( "same widget's pre-install check and kill process" );
+            CheckInstallCommand check_install_cmd = new CheckInstallCommand( widgetId );
+            check_install_cmd.setDevice( getDevice() );
+            check_install_cmd.setTime( getTime() );
+            check_install_cmd.setPrintOption( false );
+            exec.execute( check_install_cmd );
+            if ( check_install_cmd.isInstalled() ) {
+                KillCommand kill_cmd = new KillCommand( widgetId );
+                kill_cmd.setPrintOption( false );
+                kill_cmd.setDevice( getDevice() );
+                kill_cmd.setTime( getTime() );
+                exec.execute( kill_cmd );
+            }
+        }
+
+        // widget install
+        logger.trace( "install command");
+        exec.execute( install_command );
+
+        endSDB();
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#getOptions()
+     */
+    @Override
+    @SuppressWarnings("static-access")
+    protected
+    Options
+    getOptions()
+    {
+        final Options opts = super.getOptions();
+        opts.addOption( OptionBuilder.hasArg().isRequired().withLongOpt( OPT_WIDGETFILE ).withDescription( DESC_WIDGETFILE ).create( OPT_WIDGETFILE.substring( 0, 1 ) ) );
+        opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_WIDGETID ).withDescription( DESC_WIDGETID ).create( OPT_WIDGETID.substring( 0, 1 ) ) );
+
+        return opts;
+    }
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/query/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/query/Main.java
new file mode 100644 (file)
index 0000000..b1f80a1
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.query;
+
+import org.apache.commons.cli.CommandLine;
+
+import org.tizen.cli.exec.WRTLauncher;
+import org.tizen.web.launch.cli.command.QueryCommand;
+
+/**
+ * Command Line Interface for show widget list in target's installed
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+Main
+extends WRTLauncher
+{
+    /**
+     * Entry point for cli main
+     * 
+     * @param args user input parameter
+     * 
+     * @throws Exception If unhandled exception occur
+     */
+    public static
+    void
+    main(
+        final String[] args
+    )
+    throws Exception
+    {
+        final Main instance = new Main();
+        instance.run( args );
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+     */
+    @Override
+    protected
+    void
+    execute(
+        final CommandLine cmdLine
+    )
+    throws Exception
+    {
+        super.execute( cmdLine );
+
+        // device not connect then exit
+        if ( getDevice() == null ) {
+            endSDB();
+            return ;
+        }
+
+        // core operation
+        QueryCommand command = new QueryCommand();
+        command.setDevice( getDevice() );
+        command.setTime( getTime() );
+        getExecutor().execute( command );
+
+        endSDB();
+    }
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/run/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/run/Main.java
new file mode 100755 (executable)
index 0000000..d404f17
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.run;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.tizen.cli.exec.ILaunchOptions;
+import org.tizen.cli.exec.WRTLauncher;
+import org.tizen.common.core.command.Executor;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.common.core.command.sdb.PushSdbCommand;
+import org.tizen.common.file.FileHandler;
+import org.tizen.common.file.FileHandler.Attribute;
+import org.tizen.common.util.FilenameUtil;
+import org.tizen.common.util.StringUtil;
+import org.tizen.web.launch.cli.command.CheckInstallCommand;
+import org.tizen.web.launch.cli.command.InstallCommand;
+import org.tizen.web.launch.cli.command.KillCommand;
+import org.tizen.web.launch.cli.command.ModeCommnad;
+import org.tizen.web.launch.cli.command.RunCommand;
+
+/**
+ * Command Line Interface for run widget in target
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+Main
+extends WRTLauncher
+implements ILaunchOptions
+{
+    /**
+     * <p>
+     * Description for target widget id
+     * 
+     * This is printed out in usage
+     * </p>
+     * 
+     * @see #OPT_WIDGETID
+     */
+    protected static final String DESC_WIDGETID = "Command is performed of widget id uninstall in target, widget id is user written id in config.xml";
+
+    /**
+     * Entry point for cli main
+     * 
+     * @param args user input parameter
+     * 
+     * @throws Exception If unhandled exception occur
+     */
+    public static
+    void
+    main(
+        final String[] args
+    )
+    throws Exception
+    {
+        final Main instance = new Main();
+        instance.run( args );
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+     */
+    @Override
+    protected
+    void
+    execute(
+        final CommandLine cmdLine
+    )
+    throws Exception
+    {
+        super.execute( cmdLine );
+
+        final Prompter prompter = getPrompter();
+        final FileHandler fileHandler = getFileHandler();
+        final Executor exec = getExecutor();
+
+        // device not connect then exit
+        if ( getDevice() == null ) {
+            endSDB();
+            return ;
+        }
+
+        // local widget file path control
+        String inputName = cmdLine.getOptionValue( OPT_WIDGETFILE );
+        logger.trace("input file name : {} ", inputName);
+        if ( StringUtil.isEmpty( inputName ) ) {
+            prompter.notify( "widget file not selected." );
+            printHelp();
+            endSDB();
+        }
+        String widgetId = cmdLine.getOptionValue( OPT_WIDGETID );
+
+        String filePath = (String)fileHandler.get( inputName, Attribute.PATH );
+        logger.trace( "local widget file path : {}", filePath );
+
+        String fileName = FilenameUtil.getFilename( inputName );
+        logger.trace( "local widget file name : {}", fileName );
+
+        // core operation
+        InstallCommand install_command = new InstallCommand();
+        install_command.setWidget( fileName );
+        install_command.setDevice( getDevice() );
+        install_command.setTime( getTime() );
+        String remotePath = install_command.getRemotePath() + fileName;
+        logger.trace( "remote widget file path : {}", remotePath );
+
+        PushSdbCommand push_command = new PushSdbCommand( filePath, remotePath );
+        push_command.setDevice( getDevice() );
+
+        ModeCommnad mode_command = new ModeCommnad();
+        mode_command.setDevice( getDevice() );
+        mode_command.setTime( getTime() );
+
+        // widget push
+        logger.trace( "push command");
+        exec.execute( push_command );
+        if ( "failed".equals( push_command.getResult() ) ) {
+            endSDB();
+        }
+
+        // widget mode
+        logger.trace( "mode command");
+        exec.execute( mode_command );
+        if ( mode_command.getResult().contains( "failed" ) ) {
+            endSDB();
+        }
+
+        if ( !StringUtil.isEmpty( widgetId ) ) {
+            logger.trace( "same widget's pre-install check and kill process" );
+            CheckInstallCommand check_install_cmd = new CheckInstallCommand( widgetId );
+            check_install_cmd.setDevice( getDevice() );
+            check_install_cmd.setTime( getTime() );
+            check_install_cmd.setPrintOption( false );
+            exec.execute( check_install_cmd );
+            if ( check_install_cmd.isInstalled() ) {
+                KillCommand kill_cmd = new KillCommand( widgetId );
+                kill_cmd.setPrintOption( false );
+                kill_cmd.setDevice( getDevice() );
+                kill_cmd.setTime( getTime() );
+                exec.execute( kill_cmd );
+            }
+        }
+
+        // widget install
+        logger.trace( "install command");
+        exec.execute( install_command );
+
+        // widget run
+        RunCommand run_command = new RunCommand( widgetId );
+        run_command.setDevice( getDevice() );
+        run_command.setTime( getTime() );
+        exec.execute( run_command );
+
+        endSDB();
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#getOptions()
+     */
+    @Override
+    @SuppressWarnings("static-access")
+    protected
+    Options
+    getOptions()
+    {
+        final Options opts = super.getOptions();
+        opts.addOption( OptionBuilder.hasArg().isRequired().withLongOpt( OPT_WIDGETFILE ).withDescription( DESC_WIDGETFILE ).create( OPT_WIDGETFILE.substring( 0, 1 ) ) );
+        opts.addOption( OptionBuilder.hasArg().isRequired().withLongOpt( OPT_WIDGETID ).withDescription( DESC_WIDGETID ).create( OPT_WIDGETID.substring( 0, 1 ) ) );
+
+        return opts;
+    }
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/sign/Main.java
new file mode 100755 (executable)
index 0000000..d5119db
--- /dev/null
@@ -0,0 +1,266 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.sign;
+
+import static org.tizen.common.util.FilenameUtil.addTailingPath;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.tizen.cli.exec.AbstractLauncher;
+import org.tizen.cli.exec.ILaunchOptions;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.common.core.command.prompter.ChoiceOption;
+import org.tizen.common.core.command.prompter.Option;
+import org.tizen.common.file.FileHandler;
+import org.tizen.common.file.FileHandler.Attribute;
+import org.tizen.common.util.CollectionUtil;
+import org.tizen.web.sign.command.ReadSigningProfileFileCommand;
+import org.tizen.web.sign.command.SignCommand;
+
+/**
+ * Command Line Interface for creation of signature file
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+Main
+extends AbstractLauncher
+implements ILaunchOptions
+{
+       
+       /**
+        * <p>
+        * Option for profile with/without profiles file
+        * 
+        * Examples are following
+        * <ul>
+        * <li>test:/opt/profiles.xml</li>
+        * <li>test - equals to test#${HOME}/.tizen/profiles.xml</li>
+        * </ul>
+        * </p>
+        */
+       protected static final String OPT_PROFILE = "profile";
+       
+       /**
+        * <p>
+        * Description for profile option
+        * 
+        * This is printed out in usage
+        * </p>
+        * 
+        * @see #OPT_PROFILE
+        */
+       protected static final String DESC_PROFILE = "specify profile name with or without profile file( example - test, test:/opt/profile.xml )";
+
+       /**
+        * <p>
+        * separator between profile name and profile file path 
+        * </p>
+        * 
+        * @see #OPT_PROFILE
+        */
+       protected static final int SEPARATOR_PROFILE = ':';
+       
+       /**
+        * Entry point for cli main
+        * 
+        * @param args user input parameter
+        * 
+        * @throws Exception If unhandled exception occur
+        */
+       public static
+       void
+       main(
+               final String[] args
+       )
+       throws Exception
+       {
+               final Main instance = new Main();
+               instance.run( args );
+       }
+       
+       /* (non-Javadoc)
+        * @see org.tizen.cli.exec.AbstractLauncher#getOptions()
+        */
+       @Override
+       @SuppressWarnings("static-access")
+       protected Options getOptions() {
+               final Options opts = super.getOptions();
+               
+               opts.addOption( OptionBuilder.withLongOpt( OPT_NOCHECK ).withDescription( DESC_NOCHECK ).create( OPT_NOCHECK.substring( 0, 1 ) ) );
+               opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_INCLUDE ).withDescription( DESC_INCLUDE ).create( OPT_INCLUDE.substring( 0, 1 ) ) );
+               opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_EXCLUDE ).withDescription( DESC_EXCLUDE ).create( OPT_EXCLUDE.substring( 0, 1 ) ) );
+               
+               opts.addOption( OptionBuilder.hasArg().isRequired().withLongOpt( OPT_PROFILE ).withDescription( DESC_PROFILE ).create( OPT_PROFILE.substring( 0, 1 ) ) );
+               
+               return opts;
+       }
+
+       /* (non-Javadoc)
+        * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+        */
+       @Override
+       @SuppressWarnings("unchecked")
+       protected
+       void
+       execute(
+               final CommandLine cmdLine
+       )
+       throws Exception
+       {
+               final List<String> args = cmdLine.getArgList();
+               logger.trace( "arguments :{}", args );
+               
+               int nArgs = args.size(); 
+               
+               String baseDir = convertPath( "." );
+               if ( 0 < nArgs )
+               {
+                       baseDir = convertPath( args.get( 0 ) );
+               }
+               logger.debug( "Base directory :{}", baseDir );
+
+               final String[] includes = cmdLine.getOptionValues( OPT_INCLUDE );
+               logger.debug( "Includes :{}", CollectionUtil.toString( includes ) );
+               
+               String[] excludes = cmdLine.getOptionValues( OPT_EXCLUDE );
+               if ( null == includes && null == excludes )
+               {
+                       excludes = getDefaultExcludes();
+               }
+               
+               if ( !cmdLine.hasOption( OPT_NOCHECK ) )
+               {
+                       logger.trace( "Check input" );
+                       if ( !isValidRoot( baseDir ) )
+                       {
+                               logger.trace( "Base directory is not valid root" );
+                               ChoiceOption yes = new ChoiceOption( "Yes" );
+                               ChoiceOption no = new ChoiceOption( "No", true );
+                               
+                               final Prompter prompter = getPrompter();
+                               
+                               final Option option = prompter.interact(
+                                       MessageFormat.format( ".projet file doesn''t exist in [{0}]\nDo you want to be continue?", baseDir ),
+                                       yes,
+                                       no
+                               );
+                               
+                               if ( no.equals( option ) )
+                               {
+                                       prompter.notify( "Process is canceled" );
+                                       return ;
+                               }
+                       }
+               }
+               
+               String profileName = cmdLine.getOptionValue( OPT_PROFILE );
+               logger.debug( "Profile option :{}", profileName );
+               
+               String profilesFilePath = null;
+               
+               final int index = profileName.indexOf( SEPARATOR_PROFILE );
+               if ( index < 0 )
+               {
+                       profilesFilePath = System.getProperty( "user.home" ) + "/.tizen/profiles.xml";
+               }
+               else
+               {
+                       profilesFilePath = profileName.substring( index + 1 );
+                       profileName = profileName.substring( 0, index );
+               }
+               
+               logger.debug( "Profile name :{}", profileName );
+               logger.debug( "Profiles file path :{}", profilesFilePath );
+               
+               final ReadSigningProfileFileCommand readProfile = new ReadSigningProfileFileCommand( profilesFilePath, profileName );
+               getExecutor().execute( readProfile );
+               logger.info( "Profiles file[{}] is read", profilesFilePath );
+               
+               if ( readProfile.getProfileItems().isEmpty() )
+               {
+                       getPrompter().error( "No Signing profile[" + profileName + "] item in " + profilesFilePath );
+                       return ;
+               }
+
+               final SignCommand command = new SignCommand( baseDir, profileName, readProfile.getProfileItems() );
+               command.setIncludes( includes );
+               command.setExcludes( excludes );
+               getExecutor().execute( command );
+       }
+
+       /**
+        * Check if <code>path</code> is Tizen web project root
+        * 
+        * @param path directory path to check
+        * 
+        * @return <code>true</code> if <code>path</code> is Tize web project root
+        * 
+        * @throws IOException If <code>path</code>'s sub files can't be accessed
+        */
+       protected
+       boolean
+       isValidRoot(
+               final String path
+       )
+       throws IOException
+       {
+               final FileHandler fileHandler = getFileHandler();
+               if ( !fileHandler.is( addTailingPath( path, ".project" ), Attribute.EXISTS ) )
+               {
+                       return false;
+               }
+               
+               return true;
+       }
+
+       /**
+        * Return default excludes file patterns
+        * 
+        * @return default excludes file patterns
+        */
+       protected
+       String[] getDefaultExcludes()
+       {
+               return new String[] { ".*", "signature*.xml" };
+       }
+
+       /* (non-Javadoc)
+        * @see org.tizen.cli.exec.AbstractLauncher#getSyntax()
+        */
+       @Override
+       protected
+       String
+       getSyntax()
+       {
+               return super.getSyntax() + " [option]... [name] [source]";
+       }
+
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/uninstall/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/uninstall/Main.java
new file mode 100755 (executable)
index 0000000..dc9fe90
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.uninstall;
+
+import java.text.MessageFormat;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.tizen.cli.exec.ILaunchOptions;
+import org.tizen.cli.exec.WRTLauncher;
+import org.tizen.common.core.command.Executor;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.web.launch.cli.command.CheckInstallCommand;
+import org.tizen.web.launch.cli.command.KillCommand;
+import org.tizen.web.launch.cli.command.UninstallCommand;
+
+/**
+ * Command Line Interface for uninstall widget in target
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+Main
+extends WRTLauncher
+implements ILaunchOptions
+{
+    /**
+     * <p>
+     * Description for target widget id
+     * 
+     * This is printed out in usage
+     * </p>
+     * 
+     * @see #OPT_WIDGETID
+     */
+    protected static final String DESC_WIDGETID = "Command is performed of widget id uninstall in target, widget id is user written id in config.xml";
+
+    /**
+     * Entry point for cli main
+     * 
+     * @param args user input parameter
+     * 
+     * @throws Exception If unhandled exception occur
+     */
+    public static
+    void
+    main(
+        final String[] args
+    )
+    throws Exception
+    {
+        final Main instance = new Main();
+        instance.run( args );
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+     */
+    @Override
+    protected
+    void
+    execute(
+        final CommandLine cmdLine
+    )
+    throws Exception
+    {
+        super.execute( cmdLine );
+
+        final Prompter prompter = getPrompter();
+        final Executor exec = getExecutor();
+
+        // device not connect then exit
+        if ( getDevice() == null ) {
+            endSDB();
+            return ;
+        }
+
+        // core operation
+        String widgetID = cmdLine.getOptionValue( OPT_WIDGETID );
+
+        // install check
+        CheckInstallCommand install_check_command = new CheckInstallCommand( widgetID );
+        install_check_command.setDevice( getDevice() );
+        install_check_command.setTime( getTime() );
+        install_check_command.setPrintOption( false );
+        exec.execute( install_check_command );
+        if ( !install_check_command.isInstalled() ) {
+            prompter.notify(
+                    MessageFormat.format( "Uninstall failed, [{0}] widget is not installed", widgetID )
+                    );
+            endSDB();
+            return ;
+        }
+
+        // kill
+        KillCommand kill_command = new KillCommand( widgetID );
+        kill_command.setDevice( getDevice() );
+        kill_command.setTime( getTime() );
+        exec.execute( kill_command );
+
+        // uninstall
+        UninstallCommand uninstall_command = new UninstallCommand( widgetID );
+        uninstall_command.setDevice( getDevice() );
+        uninstall_command.setTime( getTime() );
+        exec.execute( uninstall_command );
+
+        endSDB();
+    }
+
+    /* (non-Javadoc)
+     * @see org.tizen.cli.exec.AbstractLauncher#getOptions()
+     */
+    @Override
+    @SuppressWarnings("static-access")
+    protected
+    Options
+    getOptions()
+    {
+        final Options opts = super.getOptions();
+        opts.addOption( OptionBuilder.hasArg().isRequired().withLongOpt( OPT_WIDGETID ).withDescription( DESC_WIDGETID ).create( OPT_WIDGETID.substring( 0, 1 ) ) );
+
+        return opts;
+    }
+}
diff --git a/org.tizen.cli/src/org/tizen/cli/exec/wgt/Main.java b/org.tizen.cli/src/org/tizen/cli/exec/wgt/Main.java
new file mode 100755 (executable)
index 0000000..fd3b6d3
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.wgt;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.tizen.cli.exec.AbstractLauncher;
+import org.tizen.cli.exec.ILaunchOptions;
+import org.tizen.common.core.command.Executor;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.common.core.command.prompter.ChoiceOption;
+import org.tizen.common.core.command.prompter.Option;
+import org.tizen.common.core.command.zip.ZipCommand;
+import org.tizen.common.file.FileHandler;
+import org.tizen.common.file.FileHandler.Attribute;
+import org.tizen.common.util.CollectionUtil;
+import org.tizen.common.util.FilenameUtil;
+import org.tizen.web.common.WebConstant;
+
+/**
+ * Command Line Interface for creation of wgt file
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+Main
+extends AbstractLauncher
+implements ILaunchOptions
+{
+       
+
+       
+       /**
+        * Entry point for cli main
+        * 
+        * @param args user input parameter
+        * 
+        * @throws Exception If unhandled exception occur
+        */
+       public static
+       void
+       main(
+               final String[] args
+       )
+       throws Exception
+       {
+               final Main instance = new Main();
+               instance.run( args );
+       }
+       
+       /* (non-Javadoc)
+        * @see org.tizen.cli.exec.AbstractLauncher#getOptions()
+        */
+       @Override
+       @SuppressWarnings("static-access")
+       protected
+       Options
+       getOptions()
+       {
+               final Options opts = super.getOptions();
+               
+               opts.addOption( OptionBuilder.withLongOpt( OPT_OVERWRITE ).withDescription( DESC_OVERWRITE ).create( OPT_OVERWRITE.substring( 0, 1 ) ) );
+               opts.addOption( OptionBuilder.withLongOpt( OPT_NOCHECK ).withDescription( DESC_NOCHECK ).create( OPT_NOCHECK.substring( 0, 1 ) ) );
+               opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_INCLUDE ).withDescription( DESC_INCLUDE ).create( OPT_INCLUDE.substring( 0, 1 ) ) );
+               opts.addOption( OptionBuilder.hasArg().withLongOpt( OPT_EXCLUDE ).withDescription( DESC_EXCLUDE ).create( OPT_EXCLUDE.substring( 0, 1 ) ) );
+               
+               return opts;
+       }
+
+       /* (non-Javadoc)
+        * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+        */
+       @Override
+       @SuppressWarnings("unchecked")
+       protected
+       void
+       execute(
+               final CommandLine cmdLine
+       )
+       throws Exception
+       {
+               final List<String> args = cmdLine.getArgList();
+               logger.trace( "arguments :{}", args );
+               
+               int nArgs = args.size(); 
+               
+               final File cwd = new File( "." ).getCanonicalFile();
+               
+               String wgtPath = cwd.getName() + "." + WebConstant.WIDGET_FILE_EXTENSION;
+               if ( 0 < nArgs )
+               {
+                       wgtPath = convertPath( args.get( 0 ) );
+               }
+               logger.debug( "Widget path :{}", wgtPath );
+               
+               String baseDir = convertPath( "." );
+               if ( 1 < nArgs )
+               {
+                       baseDir = convertPath( args.get( 1 ) );
+               }
+               logger.debug( "Base directory :{}", baseDir );
+               
+               final String[] includes = cmdLine.getOptionValues( OPT_INCLUDE );
+               logger.debug( "Includes :{}", CollectionUtil.toString( includes ) );
+               
+               String[] excludes = cmdLine.getOptionValues( OPT_EXCLUDE );
+               if ( null == includes && null == excludes )
+               {
+                       excludes = getDefaultExcludes();
+               }
+               
+               logger.debug( "Excludes :{}", CollectionUtil.toString( excludes ) );
+               
+               if ( !cmdLine.hasOption( OPT_NOCHECK ) )
+               {
+                       logger.trace( "Check input" );
+                       if ( !exists( baseDir ) )
+                       {
+                               logger.trace( "Base directory does exist" );
+                               final Prompter prompter = getPrompter();
+                               
+                               prompter.notify( "Base directory path is wrong :" + baseDir );
+                               return ;
+                               
+                       }
+                       else if ( !isValidRoot( baseDir ) )
+                       {
+                               logger.trace( "Base directory is not valid root" );
+                               final ChoiceOption yes = new ChoiceOption( "Yes" );
+                               final ChoiceOption no = new ChoiceOption( "No", true );
+                               
+                               final Prompter prompter = getPrompter();
+                               
+                               final Option option = prompter.interact(
+                                       MessageFormat.format( ".projet file doesn''t exist in [{0}]\nDo you want to be continue?", baseDir ),
+                                       yes,
+                                       no
+                               );
+                               
+                               if ( no.equals( option ) )
+                               {
+                                       prompter.notify( "Process is canceled" );
+                                       return ;
+                               }
+                       }
+               }
+               
+               if ( cmdLine.hasOption( OPT_OVERWRITE ) )
+               {
+                       getFileHandler().removeFile( wgtPath );
+                       logger.info( "Old wgt file deleted" );
+               }
+               
+               zipFiles( wgtPath, baseDir, includes, excludes );
+       }
+       
+       /**
+        * Check if <code>path</code> exists
+        * 
+        * @param path file path
+        * 
+        * @return <code>true</code> if <code>path</code> exists
+        * 
+        * @throws IOException If <code>path</code> can't be accessed
+        */
+       protected
+       boolean
+       exists(
+               final String path
+       )
+       throws IOException
+       {
+               return getFileHandler().is( path, Attribute.EXISTS );
+       }
+
+       /**
+        * Check if <code>path</code> is Tizen web project root
+        * 
+        * @param path directory path to check
+        * 
+        * @return <code>true</code> if <code>path</code> is Tize web project root
+        * @throws IOException If <code>path</code>'s sub files can't be accessed
+        */
+       protected
+       boolean
+       isValidRoot(
+               final String path
+       )
+       throws IOException
+       {
+               final FileHandler fileHandler = getFileHandler();
+               final String projectFilePath = FilenameUtil.addTailingPath( path, ".project" );
+               return fileHandler.is( projectFilePath, Attribute.EXISTS );
+       }
+
+
+       /**
+        * Return default excludes file patterns
+        * 
+        * @return default excludes file patterns
+        */
+       protected
+       String[] getDefaultExcludes()
+       {
+               return new String[] { ".*", "*.wgt" };
+       }
+
+
+       /**
+        * Archive <code>baseDir</code> to <code>wgtPath</code>
+        * 
+        * including <code>includes</code> and excluding <code>excludes</code>
+        * 
+        * @param wgtPath wgt file path
+        * @param baseDir directory to root
+        * @param includes includes file pattern
+        * @param excludes excludes filee pattern
+        */
+       protected
+       void
+       zipFiles(
+               final String wgtPath,
+               final String baseDir,
+               final String[] includes,
+               final String[] excludes
+       )
+       {
+               final ZipCommand command = new ZipCommand( baseDir, wgtPath );
+               command.setIncludes( includes );
+               command.setExcludes( excludes );
+               
+               final Executor executor = getExecutor();
+               executor.execute( command );
+       }
+       
+       /* (non-Javadoc)
+        * @see org.tizen.cli.exec.AbstractLauncher#getSyntax()
+        */
+       @Override
+       protected
+       String
+       getSyntax()
+       {
+               return super.getSyntax() + " [option]... name source";
+       }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/AbstractLauncherTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/AbstractLauncherTest.java
new file mode 100644 (file)
index 0000000..0cbeb1e
--- /dev/null
@@ -0,0 +1,281 @@
+/*
+*  Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.PosixParser;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.tizen.common.core.command.Executor;
+import org.tizen.common.core.command.prompter.NopPrompter;
+
+
+/**
+ * AbstractLauncherTest
+ *
+ * Test case for {@link AbstractLauncher}
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see AbstractLauncher
+ */
+public class
+AbstractLauncherTest
+{
+       /**
+        * Spi class for {@link AbstractLauncher}
+        */
+       public class
+       LauncherSpi
+       extends AbstractLauncher
+       {
+               /**
+                * Flag to be executed
+                */
+               public boolean bExecute = false;
+               
+               /**
+                * Default constructor
+                */
+               public LauncherSpi() {
+                       executor = new CommandLineExecutor( new NopPrompter() );
+               }
+               
+               /* (non-Javadoc)
+                * @see org.tizen.cli.exec.AbstractLauncher#execute(org.apache.commons.cli.CommandLine)
+                */
+               @Override
+               protected void execute(CommandLine cmdLine) throws Exception {
+                       bExecute = true;
+               }
+       }
+       
+       /**
+        * custom parser
+        */
+       public static class
+       CustomParser
+       implements CommandLineParser
+       {
+               /* (non-Javadoc)
+                * @see org.apache.commons.cli.CommandLineParser#parse(org.apache.commons.cli.Options, java.lang.String[], boolean)
+                */
+               @Override
+               public CommandLine parse(Options arg0, String[] arg1, boolean arg2)
+                       throws ParseException {
+                       return null;
+               }
+               
+               /* (non-Javadoc)
+                * @see org.apache.commons.cli.CommandLineParser#parse(org.apache.commons.cli.Options, java.lang.String[])
+                */
+               @Override
+               public CommandLine parse(Options arg0, String[] arg1) throws ParseException {
+                       return null;
+               }
+       };
+
+       /**
+        * Test target
+        */
+       protected LauncherSpi launcher = null;
+       
+       /**
+        * Old parser property
+        */
+       protected String old = null;
+       
+       /**
+        * Prepare test target
+        */
+       @Before
+       public void setUp()
+       {
+               old = System.getProperty( AbstractLauncher.PROP_PARSER );
+               launcher = new LauncherSpi() {
+                       
+               };
+       }
+       
+       /**
+        * Clean up test setting
+        */
+       @After
+       public void tearDown()
+       {
+               if ( null == old )
+               {
+                       System.getProperties().remove( AbstractLauncher.PROP_PARSER );
+               }
+               else
+               {
+                       System.setProperty( AbstractLauncher.PROP_PARSER, old );
+               }
+       }
+       
+    /**
+     * Test {@link AbstractLauncher#getSyntax()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see AbstractLauncher#getSyntax()
+     */
+       @Test
+       public
+       void
+       test_getSyntax()
+       throws Exception
+       {
+               assertNotNull( launcher.getSyntax() );
+       }
+       
+       
+    /**
+     * Test {@link AbstractLauncher#getOptions()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see AbstractLauncher#getOptions()
+     */
+       @Test
+       public
+       void
+       test_getOptions()
+       throws Exception
+       {
+               assertNotNull( launcher.getOptions() );
+       }
+       
+    /**
+     * Test {@link AbstractLauncher#printHelp()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see AbstractLauncher#printHelp()
+     */
+       @Test
+       public
+       void
+       test_printHelp()
+       throws Exception
+       {
+               assertNotNull( launcher.printHelp() );
+       }
+       
+    /**
+     * Test {@link AbstractLauncher#run(String...)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see AbstractLauncher#run(String...)
+     */
+       @Test
+       public
+       void
+       test_run()
+       throws Exception
+       {
+               assertNull( launcher.getCommandLine() );
+               launcher.run();
+               assertTrue( launcher.bExecute );
+       }
+       
+    /**
+     * Test {@link AbstractLauncher#getParser()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see AbstractLauncher#getParser()
+     */
+       @Test
+       public
+       void
+       test_getParser()
+       throws Exception
+       {
+               assertTrue( AbstractLauncher.getDefaultParserClass().isInstance( launcher.getParser() ) );
+               String old = System.getProperty( AbstractLauncher.PROP_PARSER );
+               System.setProperty( AbstractLauncher.PROP_PARSER, "gnu" );
+               assertTrue( GnuParser.class.isInstance( launcher.getParser() ) );
+               System.setProperty( AbstractLauncher.PROP_PARSER, "posix" );
+               assertTrue( PosixParser.class.isInstance( launcher.getParser() ) );
+               System.setProperty( AbstractLauncher.PROP_PARSER, "wrong" );
+               assertTrue( AbstractLauncher.getDefaultParserClass().isInstance( launcher.getParser() ) );
+               CommandLineParser parser = new CustomParser();
+               System.setProperty( AbstractLauncher.PROP_PARSER, parser.getClass().getName() );
+               assertTrue( CustomParser.class.isInstance( launcher.getParser() ) );
+               
+               if ( null != old )
+               {
+                       System.setProperty( AbstractLauncher.PROP_PARSER, old );
+               }
+       }
+
+    /**
+     * Test {@link AbstractLauncher#getCommandLine()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see AbstractLauncher#getCommandLine()
+     */
+       @Test
+       public
+       void
+       test_getCommandLine()
+       throws Exception
+       {
+               assertNull( launcher.getCommandLine() );
+               launcher.run();
+               assertNotNull( launcher.getCommandLine() );
+       }
+       
+
+    /**
+     * Test {@link AbstractLauncher#getExecutor()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see AbstractLauncher#getExecutor()
+     */
+       @Test
+       public
+       void
+       test_getExecutor()
+       throws Exception
+       {
+               final Executor executor = launcher.getExecutor();
+               assertNotNull( executor );
+       }
+
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/AbstractMainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/AbstractMainTest.java
new file mode 100644 (file)
index 0000000..6d282d1
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Web IDE - Command Line Interface
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * 
+ * 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 org.junit.After;
+import org.junit.Before;
+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.policy.PolicyRegistry;
+import org.tizen.common.core.command.prompter.NopPrompter;
+import org.tizen.common.file.FileHandler;
+import org.tizen.common.file.VirtualFileHandler;
+
+/**
+ * AbstractMainTest
+ *
+ * Abstract class of test case for Main
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ */
+public class
+AbstractMainTest
+{
+       
+       
+       /**
+        * Stub object for {@link FileHandler}
+        */
+       protected VirtualFileHandler fileHandler;
+       
+       /**
+        * {@link Executor} to provide test environment
+        */
+       protected Executor executor;
+       
+       /**
+        * Set up test
+        */
+       @Before
+       public void setUp()
+       {
+               
+               fileHandler = new VirtualFileHandler();
+               
+               executor = new Executor( new Factory<ExecutionContext>() {
+                       public ExecutionContext create() {
+                               return new ExecutionContext( new PolicyRegistry(), new NopPrompter(), fileHandler );
+                       }
+               } );
+       }
+       
+       /**
+        * Tear down test
+        */
+       @After
+       public void tearDown()
+       {
+               executor = null;
+               fileHandler = null;
+       }
+       
+       
+
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/TargetDeviceSelectorTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/TargetDeviceSelectorTest.java
new file mode 100644 (file)
index 0000000..6819b59
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.tizen.common.core.command.Prompter;
+import org.tizen.common.core.command.prompter.ChoiceOption;
+import org.tizen.common.core.command.prompter.GenericOption;
+import org.tizen.sdblib.IDevice;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * TargetDeviceSelectorTest
+ *
+ * Test case for {@link TargetDeviceSelector}
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see TargetDeviceSelector
+ */
+public class
+TargetDeviceSelectorTest
+{
+    /**
+     * mock Prompter
+     */
+    protected Prompter mockPropter;
+
+    /**
+     * mock IDevice
+     */
+    protected IDevice mockDevice1;
+
+    /**
+     * mock IDevice
+     */
+    protected IDevice mockDevice2;
+
+    /**
+     * mock IDevices
+     */
+    IDevice mockDevices[];
+
+    /**
+     * test class
+     */
+    protected TargetDeviceSelector testClass;
+
+    /**
+     * Prepare test target
+     */
+    @Before
+    public
+    void
+    setUp()
+    {
+        mockPropter = mock( Prompter.class );
+        mockDevice1 = mock( IDevice.class );
+        mockDevice2 = mock( IDevice.class );
+        mockDevices = new IDevice[] { mockDevice1, mockDevice2 }; 
+        when( mockDevice1.toString() ).thenReturn( "test1" );
+        when( mockDevice2.toString() ).thenReturn( "test2" );
+
+        testClass = new TargetDeviceSelector( mockPropter ) {
+            @Override
+            public IDevice[] getConnectDevices() {
+                return mockDevices;
+            }
+        };
+    }
+
+    /**
+     * Test {@link TargetDeviceSelector#printDeviceList(org.tizen.sdblib.IDevice[])()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see TargetDeviceSelector#printDeviceList(org.tizen.sdblib.IDevice[])()
+     */
+    @Test
+    public
+    void
+    test_printDeviceList()
+    throws Exception
+    {
+        try {
+            testClass.printDeviceList( mockDevices );
+            verify( mockPropter ).notify( "currnet connected target List" );
+            verify( mockPropter ).notify( "1) test1" );
+            verify( mockPropter ).notify( "2) test2" );
+        } catch (Exception e) {
+            fail( "devices is not null then Not throw exception" );
+        }
+
+        try {
+            testClass.printDeviceList( null );
+            verify( mockPropter ).notify( "-----------------------------" );
+            verify( mockPropter ).notify( "currnet connected target List" );
+            verify( mockPropter ).notify( "-----------------------------" );
+            fail( "devices is null then throw exception" );
+        } catch (Exception e) {}
+    }
+
+    /**
+     * Test {@link TargetDeviceSelector#getConnectDevices()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see TargetDeviceSelector#getConnectDevices()
+     */
+    @Test
+    public
+    void
+    test_getConnectDevices()
+    throws Exception
+    {
+        assertArrayEquals( mockDevices, testClass.getConnectDevices() );
+    }
+
+    /**
+     * Test {@link TargetDeviceSelector#isDeviceConnected()}
+     * Test {@link TargetDeviceSelector#isDeviceConnected(IDevice)}
+     * Test {@link TargetDeviceSelector#isDeviceConnected(String)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see TargetDeviceSelector#isDeviceConnected()
+     * @see TargetDeviceSelector#isDeviceConnected(IDevice)
+     * @see TargetDeviceSelector#isDeviceConnected(String)
+     */
+    @Test
+    public
+    void
+    test_isDeviceConnected()
+    throws Exception
+    {
+        assertTrue( testClass.isDeviceConnected() );
+        assertTrue( testClass.isDeviceConnected( "test1" ) );
+        assertTrue( testClass.isDeviceConnected( "test2" ) );
+        assertTrue( testClass.isDeviceConnected( mockDevice1 ) );
+        assertTrue( testClass.isDeviceConnected( mockDevice2 ) );
+
+        assertFalse( testClass.isDeviceConnected( (String)null ) );
+        assertFalse( testClass.isDeviceConnected( "" ) );
+        assertFalse( testClass.isDeviceConnected( (IDevice)null ) );
+    }
+
+    /**
+     * Test {@link TargetDeviceSelector#getDevice(String)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see TargetDeviceSelector#getConnectDevices()
+     */
+    @Test
+    public
+    void
+    test_getDevice()
+    throws Exception
+    {
+        assertEquals( null, testClass.getDevice( (String)null ) );
+        assertEquals( null, testClass.getDevice( "" ) );
+        assertEquals( mockDevice1, testClass.getDevice( "test1" ) );
+        assertEquals( mockDevice2, testClass.getDevice( "test2" ) );
+    }
+
+    /**
+     * Test {@link TargetDeviceSelector#selectDevice()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see TargetDeviceSelector#selectDevice()
+     */
+    @Test
+    public
+    void
+    test_selectDevice()
+    throws Exception
+    {
+        assertEquals( null, testClass.selectDevice() );
+
+        ChoiceOption yes = new ChoiceOption( "Yes" );
+        ChoiceOption no = new ChoiceOption( "No", true );
+        when( mockPropter.interact( "device is not selected\n" +
+                                    "[test1] device select and\n" +
+                                    "Do you want to be continue ?",
+                                    yes,
+                                    no
+                                    )
+            ).thenReturn( yes );
+        assertEquals( mockDevice1, testClass.selectDevice() );
+
+        when( mockPropter.interact( "device is not selected\n" +
+                "[test1] device select and\n" +
+                "Do you want to be continue ?",
+                yes,
+                no
+                )
+            ).thenReturn( no );
+        ChoiceOption cancel = new ChoiceOption( "Cancel", true );
+        GenericOption num = new GenericOption( "Num" );
+
+        when( mockPropter.interact( "select device or cancel process ",
+                cancel,
+                num
+                )
+            ).thenReturn( cancel );
+        assertEquals( null, testClass.selectDevice() );
+        verify( mockPropter ).notify( "Process is canceled, please selected device" );
+    }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/WRTLauncherTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/WRTLauncherTest.java
new file mode 100644 (file)
index 0000000..6c34355
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * WRTLauncherTest
+ *
+ * Test case for {@link WRTLauncher}
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see WRTLauncher
+ */
+public class
+WRTLauncherTest
+extends AbstractMainTest
+{
+    /**
+     * Test {@link WRTLauncher#getOptions()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see WRTLauncher#getOptions()
+     */
+    @Test
+    public void
+    test_getOptions()
+    throws Exception
+    {
+        WRTLauncher testClass = new WRTLauncher();
+        final Options opts = testClass.getOptions();
+        final PosixParser parser = new PosixParser();
+
+        parser.parse( opts, new String[] {
+                "-help", "-quiet", "-device", "deviceName", "-time", "100"
+        } );
+
+        parser.parse( opts, new String[] {
+                "--help", "--quiet", "--device", "deviceName", "--time", "100"
+        } );
+
+        parser.parse( opts, new String[] {
+                "-h", "-q", "-d", "deviceName", "-t", "100"
+        } );
+
+        try {
+            parser.parse( opts, new String[] {
+                    "-verbose", "-quiet"
+            } );
+            fail();
+        } catch ( final UnrecognizedOptionException e ) {
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] { "--log=trace", "--device", "TestDevice", "--time", "77"} );
+            final String[] args = cmd.getOptionValues( WRTLauncher.OPT_DEVICE );
+            assertEquals( 1, args.length );
+            assertEquals( "TestDevice", args[0] );
+            final String[] shortArgs = cmd.getOptionValues( "d" );
+            assertEquals( 1, shortArgs.length );
+            assertEquals( "TestDevice", shortArgs[0] );
+
+            final String[] args2 = cmd.getOptionValues( WRTLauncher.OPT_TIME );
+            assertEquals( 1, args2.length );
+            assertEquals( "77", args2[0] );
+            final String[] shortArgs2 = cmd.getOptionValues( "t" );
+            assertEquals( 1, shortArgs2.length );
+            assertEquals( "77", shortArgs2[0] );
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] { "--log=debug", "-d", "TestDevice", "--time", "77" } );
+            final String[] args = cmd.getOptionValues( WRTLauncher.OPT_DEVICE );
+            assertNotNull( args );
+            final String[] args2 = cmd.getOptionValues( WRTLauncher.OPT_TIME );
+            assertNotNull( args2 );
+        }
+    }
+
+    /**
+     * Test {@link WRTLauncher#run(String...)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see WRTLauncher#run(String...)
+     */
+    @Test
+    public
+    void
+    test_run()
+    throws Exception
+    {
+        final AtomicBoolean result = new AtomicBoolean( false );
+
+        final WRTLauncher testClass = new WRTLauncher()
+        {
+            protected Executor getExecutor() {
+                return WRTLauncherTest.this.executor;
+            }
+            
+            protected void execute( final CommandLine cmdLine ) throws Exception {
+                result.set( true );
+            }
+        };
+
+        testClass.run( "-d", "TestDevice", "-t", "77" );
+        assertTrue( result.get() );
+    }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/debug/MainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/debug/MainTest.java
new file mode 100644 (file)
index 0000000..d83da99
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.debug;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+    /**
+     * Test {@link Main#getOptions()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#getOptions()
+     */
+    @Test
+    public void
+    test_getOptions()
+    throws Exception
+    {
+        Main testClass = new Main();
+        final Options opts = testClass.getOptions();
+        final PosixParser parser = new PosixParser();
+
+        parser.parse( opts, new String[] {
+                "-help", "-quiet", "-device", "deviceName", "-widget", "test.wgt", "-id", "http://test.com"
+        } );
+
+        parser.parse( opts, new String[] {
+                "--help", "--quiet", "--device", "deviceName", "--widget", "test.wgt", "--id", "http://test.com"
+        } );
+
+        parser.parse( opts, new String[] {
+                "-h", "-q", "-d", "deviceName", "-w", "test.wgt",  "-i", "http://test.com"
+        } );
+
+        try {
+            parser.parse( opts, new String[] {
+                    "-verbose", "-quiet"
+            } );
+            fail();
+        } catch ( final UnrecognizedOptionException e ) {
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] {
+                    "--log=trace", "--device", "TestDevice", "--id", "http://test.com", "--widget", "test.wgt"
+                    } );
+            final String[] args1 = cmd.getOptionValues( Main.OPT_WIDGETID );
+            assertEquals( 1, args1.length );
+            assertEquals( "http://test.com", args1[0] );
+            final String[] shortArgs1 = cmd.getOptionValues( "i" );
+            assertEquals( 1, shortArgs1.length );
+            assertEquals( "http://test.com", shortArgs1[0] );
+
+            final String[] args2 = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+            assertEquals( 1, args2.length );
+            assertEquals( "test.wgt", args2[0] );
+            final String[] shortArgs2 = cmd.getOptionValues( "w" );
+            assertEquals( 1, shortArgs2.length );
+            assertEquals( "test.wgt", shortArgs2[0] );
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] {
+                    "--log=debug", "-i", "http://test.com", "-w", "test.wgt"
+                    } );
+            final String[] args1 = cmd.getOptionValues( Main.OPT_WIDGETID );
+            assertNotNull( args1 );
+            final String[] args2 = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+            assertNotNull( args2 );
+        }
+    }
+
+    /**
+     * Test {@link Main#run(String...)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#run(String...)
+     */
+    @Test
+    public
+    void
+    test_run()
+    throws Exception
+    {
+        final AtomicBoolean result = new AtomicBoolean( false );
+
+        final Main testClass = new Main()
+        {
+            protected Executor getExecutor() {
+                return MainTest.this.executor;
+            }
+
+            protected void execute( final CommandLine cmdLine ) throws Exception {
+                result.set( true );
+            }
+        };
+
+        testClass.run( "-d", "TestDevice", "-i", "http://test.com", "-w", "test.wgt" );
+        assertTrue( result.get() );
+    }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/gen/MainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/gen/MainTest.java
new file mode 100644 (file)
index 0000000..0299b5f
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.gen;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+       /**
+        * Test {@link Main#getOptions()}
+        * 
+        * @throws Exception in case of failure in test
+        * 
+        * @see Main#getOptions()
+        */
+       @Test
+       public void
+       test_getOptions()
+       throws Exception
+       {
+               Main testClass = new Main();
+               final Options opts = testClass.getOptions();
+               final PosixParser parser = new PosixParser();
+
+               parser.parse( opts, new String[] {
+                               "-help", "-quiet", "-name", "myproject", "-path", "/home/myproject"
+               } );
+
+               parser.parse( opts, new String[] {
+                               "--help", "--quiet", "--name", "myproject", "--path", "/home/myproject"
+               } );
+
+               parser.parse( opts, new String[] {
+                               "-h", "-q", "-n", "myproject", "-p", "/home/myproject"
+               } );
+
+               try {
+                       parser.parse( opts, new String[] {
+                                       "-verbose", "-quiet"
+                       } );
+                       fail();
+               } catch ( final UnrecognizedOptionException e ) {
+               }
+
+               {
+                       final CommandLine cmd = parser.parse( opts, new String[] {
+                                       "--log=trace", "--name", "myproject", "--path", "/home/myproject"
+                       } );
+                       final String[] args1 = cmd.getOptionValues( Main.OPT_NAME );
+                       assertEquals( 1, args1.length );
+                       assertEquals( "myproject", args1[0] );
+                       final String[] shortArgs1 = cmd.getOptionValues( "n" );
+                       assertEquals( 1, shortArgs1.length );
+                       assertEquals( "myproject", shortArgs1[0] );
+
+                       final String[] args2 = cmd.getOptionValues( Main.OPT_PATH );
+                       assertEquals( 1, args2.length );
+                       assertEquals( "/home/myproject", args2[0] );
+                       final String[] shortArgs2 = cmd.getOptionValues( "p" );
+                       assertEquals( 1, shortArgs2.length );
+                       assertEquals( "/home/myproject", shortArgs2[0] );
+               }
+
+               {
+                       final CommandLine cmd = parser.parse( opts, new String[] {
+                                       "--log=debug", "-n", "myproject", "-p", "/home/myproject"
+                       } );
+                       final String[] args1 = cmd.getOptionValues( Main.OPT_NAME );
+                       assertNotNull( args1 );
+                       final String[] args2 = cmd.getOptionValues( Main.OPT_PATH );
+                       assertNotNull( args2 );
+               }
+       }
+
+       /**
+        * Test {@link Main#run(String...)}
+        * 
+        * @throws Exception in case of failure in test
+        * 
+        * @see Main#run(String...)
+        */
+       @Test
+       public
+       void
+       test_run()
+       throws Exception
+       {
+               final AtomicBoolean result = new AtomicBoolean( false );
+
+               final Main testClass = new Main()
+               {
+                       protected Executor getExecutor() {
+                               return MainTest.this.executor;
+                       }
+
+                       protected void execute( final CommandLine cmdLine ) throws Exception {
+                               result.set( true );
+                       }
+               };
+
+               testClass.run( "-n", "myproject", "-p", "/home/myproject" );
+               assertTrue( result.get() );
+       }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/install/MainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/install/MainTest.java
new file mode 100644 (file)
index 0000000..00101c5
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.install;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+    /**
+     * Test {@link Main#getOptions()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#getOptions()
+     */
+    @Test
+    public void
+    test_getOptions()
+    throws Exception
+    {
+        Main testClass = new Main();
+        final Options opts = testClass.getOptions();
+        final PosixParser parser = new PosixParser();
+
+        parser.parse( opts, new String[] {
+                "-help", "-quiet", "-device", "deviceName", "-widget", "test.wgt"
+        } );
+
+        parser.parse( opts, new String[] {
+                "--help", "--quiet", "--device", "deviceName", "--widget", "test.wgt"
+        } );
+
+        parser.parse( opts, new String[] {
+                "-h", "-q", "-d", "deviceName", "-w", "test.wgt"
+        } );
+
+        try {
+            parser.parse( opts, new String[] {
+                    "-verbose", "-quiet"
+            } );
+            fail();
+        } catch ( final UnrecognizedOptionException e ) {
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] { "--log=trace", "--device", "TestDevice", "--widget", "test.wgt" } );
+            final String[] args = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+            assertEquals( 1, args.length );
+            assertEquals( "test.wgt", args[0] );
+            final String[] shortArgs = cmd.getOptionValues( "w" );
+            assertEquals( 1, shortArgs.length );
+            assertEquals( "test.wgt", shortArgs[0] );
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] { "--log=debug", "-w", "test.wgt" } );
+            final String[] args = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+            assertNotNull( args );
+        }
+    }
+
+    /**
+     * Test {@link Main#run(String...)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#run(String...)
+     */
+    @Test
+    public
+    void
+    test_run()
+    throws Exception
+    {
+        final AtomicBoolean result = new AtomicBoolean( false );
+
+        final Main testClass = new Main()
+        {
+            protected Executor getExecutor() {
+                return MainTest.this.executor;
+            }
+            
+            protected void execute( final CommandLine cmdLine ) throws Exception {
+                result.set( true );
+            }
+        };
+
+        testClass.run( "-d", "TestDevice", "-w", "test.wgt" );
+        assertTrue( result.get() );
+    }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/query/MainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/query/MainTest.java
new file mode 100644 (file)
index 0000000..0aea6cd
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.query;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+    /**
+     * Test {@link Main#run(String...)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#run(String...)
+     */
+    @Test
+    public
+    void
+    test_run()
+    throws Exception
+    {
+        final AtomicBoolean result = new AtomicBoolean( false );
+
+        final Main testClass = new Main()
+        {
+            protected Executor getExecutor() {
+                return MainTest.this.executor;
+            }
+            
+            protected void execute( final CommandLine cmdLine ) throws Exception {
+                result.set( true );
+            }
+        };
+
+        testClass.run( "-d", "TestDevice" );
+        assertTrue( result.get() );
+    }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/run/MainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/run/MainTest.java
new file mode 100644 (file)
index 0000000..241a4ac
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.run;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+    /**
+     * Test {@link Main#getOptions()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#getOptions()
+     */
+    @Test
+    public void
+    test_getOptions()
+    throws Exception
+    {
+        Main testClass = new Main();
+        final Options opts = testClass.getOptions();
+        final PosixParser parser = new PosixParser();
+
+        parser.parse( opts, new String[] {
+                "-help", "-quiet", "-device", "deviceName", "-widget", "test.wgt", "-id", "http://test.com"
+        } );
+
+        parser.parse( opts, new String[] {
+                "--help", "--quiet", "--device", "deviceName", "--widget", "test.wgt", "--id", "http://test.com"
+        } );
+
+        parser.parse( opts, new String[] {
+                "-h", "-q", "-d", "deviceName", "-w", "test.wgt",  "-i", "http://test.com"
+        } );
+
+        try {
+            parser.parse( opts, new String[] {
+                    "-verbose", "-quiet"
+            } );
+            fail();
+        } catch ( final UnrecognizedOptionException e ) {
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] {
+                    "--log=trace", "--device", "TestDevice", "--id", "http://test.com", "--widget", "test.wgt"
+                    } );
+            final String[] args1 = cmd.getOptionValues( Main.OPT_WIDGETID );
+            assertEquals( 1, args1.length );
+            assertEquals( "http://test.com", args1[0] );
+            final String[] shortArgs1 = cmd.getOptionValues( "i" );
+            assertEquals( 1, shortArgs1.length );
+            assertEquals( "http://test.com", shortArgs1[0] );
+
+            final String[] args2 = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+            assertEquals( 1, args2.length );
+            assertEquals( "test.wgt", args2[0] );
+            final String[] shortArgs2 = cmd.getOptionValues( "w" );
+            assertEquals( 1, shortArgs2.length );
+            assertEquals( "test.wgt", shortArgs2[0] );
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] {
+                    "--log=debug", "-i", "http://test.com", "-w", "test.wgt"
+                    } );
+            final String[] args1 = cmd.getOptionValues( Main.OPT_WIDGETID );
+            assertNotNull( args1 );
+            final String[] args2 = cmd.getOptionValues( Main.OPT_WIDGETFILE );
+            assertNotNull( args2 );
+        }
+    }
+
+    /**
+     * Test {@link Main#run(String...)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#run(String...)
+     */
+    @Test
+    public
+    void
+    test_run()
+    throws Exception
+    {
+        final AtomicBoolean result = new AtomicBoolean( false );
+
+        final Main testClass = new Main()
+        {
+            protected Executor getExecutor() {
+                return MainTest.this.executor;
+            }
+
+            protected void execute( final CommandLine cmdLine ) throws Exception {
+                result.set( true );
+            }
+        };
+
+        testClass.run( "-d", "TestDevice", "-i", "http://test.com", "-w", "test.wgt" );
+        assertTrue( result.get() );
+    }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/sign/MainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/sign/MainTest.java
new file mode 100755 (executable)
index 0000000..400e8f0
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * Web IDE - Command Line Interface
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * 
+ * 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.sign;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+       /**
+        * Test {@link Main#getOptions()}
+        * 
+        * @throws Exception in case of failure in test
+        * 
+        * @see Main#getOptions()}
+        */
+       @Test
+       public void test_getOptions() throws Exception {
+               
+               Main main = new Main();
+               final Options opts = main.getOptions();
+               final PosixParser parser = new PosixParser();
+               
+               parser.parse( opts, new String[] {
+                       "-help", "-quiet", "-profile", "test:/test/profiles.xml"
+               } );
+               parser.parse( opts, new String[] {
+                       "--help", "--quiet", "--profile", "test:/test/profiles.xml"
+               } );
+               parser.parse( opts, new String[] {
+                   "--help", "--quiet", "--profile", "test:/test/profiles.xml", "--include", "*.xml", "--exclude", "*.jpg"
+               } );
+               
+               parser.parse( opts, new String[] {
+                       "-h", "-q", "-p", "test:/test/profiles.xml"
+               } );
+               
+
+               try {
+                       parser.parse( opts, new String[] {
+                               "-verbose", "-quiet"
+                       } );
+                       fail();
+               } catch ( final UnrecognizedOptionException e ) {
+               }
+
+               {
+                       final CommandLine cmd = parser.parse( opts, new String[] { "--exclude", "hello", "--log=trace", "--exclude", "message2", "--profile", "test:/test/prfiles.xml" } );
+                       final String[] args = cmd.getOptionValues( Main.OPT_EXCLUDE );
+                       assertEquals( 2, args.length );
+                       assertEquals( "hello", args[0] );
+                       assertEquals( "message2", args[1] );
+                       final String[] shortArgs = cmd.getOptionValues( "e" );
+                       assertEquals( 2, shortArgs.length );
+                       assertEquals( "hello", shortArgs[0] );
+                       assertEquals( "message2", shortArgs[1] );
+               }
+
+               {
+                       final CommandLine cmd = parser.parse( opts, new String[] { "--log=debug", "-p", "test:/test/prfiles.xml" } );
+                       final String[] args = cmd.getOptionValues( Main.OPT_EXCLUDE );
+                       assertNull( args );
+               }
+       }
+       
+       /**
+        * Test {@link Main#run(String...)}
+        * 
+        * @throws Exception in case of failure in test
+        * 
+        * @see Main#run(String...)}
+        */
+       @Test
+       public
+       void
+       test_run()
+       throws Exception
+       {
+           {
+               final AtomicBoolean result = new AtomicBoolean( false );
+
+               final Main main = new Main()
+               {
+                   protected Executor getExecutor() {
+                       return MainTest.this.executor;
+                   }
+
+                   protected
+                   void
+                   execute(
+                       final CommandLine cmdLine
+                   )
+                   throws Exception
+                   {
+                       result.set( true );
+                   }
+               };
+
+               main.run( "-p", "test" );
+               assertTrue( result.get() );
+           }
+               
+       }
+       
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/uninstall/MainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/uninstall/MainTest.java
new file mode 100644 (file)
index 0000000..c23a067
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+* Web IDE - Command Line Interface
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* GyeongSeok Seo <gyeongseok.seo@samsung.com>
+* BonYong Lee <bonyong.lee@samsung.com>
+* 
+* 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.uninstall;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ * 
+ * @author GyeongSeok Seo{@literal <gyeongseok.seo@samsung.com>} (S-Core)
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+    /**
+     * Test {@link Main#getOptions()}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#getOptions()
+     */
+    @Test
+    public void
+    test_getOptions()
+    throws Exception
+    {
+        Main testClass = new Main();
+        final Options opts = testClass.getOptions();
+        final PosixParser parser = new PosixParser();
+
+        parser.parse( opts, new String[] {
+                "-help", "-quiet", "-device", "deviceName", "-id", "http://test.com"
+        } );
+
+        parser.parse( opts, new String[] {
+                "--help", "--quiet", "--device", "deviceName", "--id", "http://test.com"
+        } );
+
+        parser.parse( opts, new String[] {
+                "-h", "-q", "-d", "deviceName", "-i", "http://test.com"
+        } );
+
+        try {
+            parser.parse( opts, new String[] {
+                    "-verbose", "-quiet"
+            } );
+            fail();
+        } catch ( final UnrecognizedOptionException e ) {
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] { "--log=trace", "--device", "TestDevice", "--id", "http://test.com" } );
+            final String[] args = cmd.getOptionValues( Main.OPT_WIDGETID );
+            assertEquals( 1, args.length );
+            assertEquals( "http://test.com", args[0] );
+            final String[] shortArgs = cmd.getOptionValues( "i" );
+            assertEquals( 1, shortArgs.length );
+            assertEquals( "http://test.com", shortArgs[0] );
+        }
+
+        {
+            final CommandLine cmd = parser.parse( opts, new String[] { "--log=debug", "-i", "http://test.com" } );
+            final String[] args = cmd.getOptionValues( Main.OPT_WIDGETID );
+            assertNotNull( args );
+        }
+    }
+
+    /**
+     * Test {@link Main#run(String...)}
+     * 
+     * @throws Exception in case of failure in test
+     * 
+     * @see Main#run(String...)
+     */
+    @Test
+    public
+    void
+    test_run()
+    throws Exception
+    {
+        final AtomicBoolean result = new AtomicBoolean( false );
+
+        final Main testClass = new Main()
+        {
+            protected Executor getExecutor() {
+                return MainTest.this.executor;
+            }
+
+            protected void execute( final CommandLine cmdLine ) throws Exception {
+                result.set( true );
+            }
+        };
+
+        testClass.run( "-d", "TestDevice", "-i", "http://test.com" );
+        assertTrue( result.get() );
+    }
+}
diff --git a/org.tizen.cli/test/src/org/tizen/cli/exec/wgt/MainTest.java b/org.tizen.cli/test/src/org/tizen/cli/exec/wgt/MainTest.java
new file mode 100644 (file)
index 0000000..4900ad5
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+ * Web IDE - Command Line Interface
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * 
+ * 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.wgt;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.tizen.common.util.ArrayUtil.isEmpty;
+import static org.tizen.common.util.ArrayUtil.size;
+import static org.tizen.common.util.IOUtil.getBytes;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.cli.UnrecognizedOptionException;
+import org.junit.Test;
+import org.tizen.cli.exec.AbstractMainTest;
+import org.tizen.common.core.command.Executor;
+import org.tizen.common.file.FileHandler.Attribute;
+
+/**
+ * MainTest
+ *
+ * Test case for {@link Main}
+ * 
+ * @author BonYong Lee{@literal <bonyong.lee@samsung.com>} (S-Core)
+ * 
+ * @see Main
+ */
+public class
+MainTest
+extends AbstractMainTest
+{
+       
+       /**
+        * Test {@link Main#zipFiles(String, String, String[], String[])}
+        * 
+        * @throws Exception in case of failure in test
+        * 
+        * @see Main#zipFiles(String, String, String[], String[])}
+        */
+       @Test
+       public
+       void
+       test_zipFiles()
+       throws Exception
+       {
+               
+               fileHandler.makeDirectory( "/test" );
+               fileHandler.write( "/test/b.txt", "This is test message" );
+
+               final Main main = new Main() {
+                       protected Executor getExecutor() {
+                               return MainTest.this.executor;
+                       }
+               };
+               
+               main.zipFiles( "/test.zip", "/test", null, null );
+               
+               assertTrue( 0 < size( getBytes( fileHandler.read( "/test.zip" ) ) ) );
+               
+       }
+       
+       /**
+        * Test {@link Main#run(String...)}
+        * 
+        * @throws Exception in case of failure in test
+        * 
+        * @see Main#run(String...)}
+        */
+       @Test
+       public
+       void
+       test_run()
+       throws Exception
+       {
+               final AtomicBoolean result = new AtomicBoolean( false );
+               
+               final Main main = new Main()
+               {
+                       protected void execute(CommandLine cmdLine) throws Exception {
+                               result.set( true );
+                       };
+               };
+               
+               main.run();
+               assertTrue( result.get() );
+       }
+
+       /**
+        * Test {@link Main#execute(CommandLine)}
+        * 
+        * @throws Exception in case of failure in test
+        * 
+        * @see Main#execute(CommandLine)}
+        */
+       @Test
+       public
+       void
+       test_execute()
+       throws Exception
+       {
+               fileHandler.makeDirectory( "/test" );
+               fileHandler.write( "/test/b.txt", "This is test message" );
+
+               final Main main = new Main()
+               {
+                       protected Executor getExecutor()
+                       {
+                               return MainTest.this.executor;
+                       }
+               };
+               
+               final PosixParser parser = new PosixParser();
+               
+               main.execute( parser.parse( main.getOptions(), new String[] {
+                       "-help", "-quiet"
+               } ) );
+               assertFalse( fileHandler.is( "/test.wgt", Attribute.EXISTS ) );
+               
+               main.execute( parser.parse( main.getOptions(), new String[] {
+                       "test.wgt", "test"
+               } ) );
+               assertFalse( fileHandler.is( "/test.wgt", Attribute.EXISTS ) );
+               
+               main.execute( parser.parse( main.getOptions(), new String[] {
+                       "--nocheck", "test.wgt", "test"
+               } ) );
+               assertTrue( fileHandler.is( "/test.wgt", Attribute.EXISTS ) );
+               assertTrue( 0 < size( getBytes( fileHandler.read( "/test.wgt" ) ) ) );
+               main.execute( parser.parse( main.getOptions(), new String[] {
+                       "-i", "*.html"
+               } ) );
+       }
+       
+       /**
+        * Test {@link Main#getOptions()}
+        * 
+        * @throws Exception in case of failure in test
+        * 
+        * @see Main#getOptions()}
+        */
+       @Test
+       public void test_getOptions() throws Exception {
+               
+               Main main = new Main();
+               final Options opts = main.getOptions();
+               final PosixParser parser = new PosixParser();
+               
+               parser.parse( opts, new String[] {
+                       "-help", "-quiet"
+               } );
+               
+
+               try {
+                       parser.parse( opts, new String[] {
+                               "-verbose", "-quiet", "-aaa"
+                       } );
+                       fail();
+               } catch ( final UnrecognizedOptionException e ) {
+               }
+
+               {
+                       final CommandLine cmd = parser.parse( opts, new String[] { "--exclude", "hello", "--log=trace", "--exclude", "message2" } );
+                       final String[] args = cmd.getOptionValues( Main.OPT_EXCLUDE );
+                       assertArrayEquals( new String[] { "hello", "message2" }, args );
+                       final String[] shortArgs = cmd.getOptionValues( "e" );
+                       assertArrayEquals( new String[] { "hello", "message2" }, shortArgs );
+               }
+
+               {
+                       final CommandLine cmd = parser.parse( opts, new String[] { "--log=debug" } );
+                       final String[] args = cmd.getOptionValues( Main.OPT_EXCLUDE );
+                       assertNull( args );
+               }
+               
+               {
+                       final CommandLine cmd = parser.parse( opts, new String[] { "--include", "*.html" } );
+                       final String[] args = cmd.getArgs();
+                       assertTrue( isEmpty( args ) );
+                       assertArrayEquals( new String[] { "*.html" }, cmd.getOptionValues( Main.OPT_INCLUDE ) );
+               }
+       }
+       
+       
+       @Test
+       public void test_printHelp() throws Exception
+       {
+               final Main testTarget = new Main() {
+                       @Override
+                       protected void handleException( Exception e )
+                       {
+                               throw new IllegalStateException( e );
+                       }
+               };
+               testTarget.run( "--help" );
+               
+               
+       }
+       
+
+}
diff --git a/package/build.ubuntu-32 b/package/build.ubuntu-32
new file mode 100755 (executable)
index 0000000..a463f9f
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/sh -xe
+
+PROJECT_HOME="org.tizen.cli"
+BUILD=build
+PLATFORM=$TARGET_OS
+TARGET=package/web-cli.package.$PLATFORM/data/tools/ide
+
+LIB=$SRCDIR/lib
+
+# clean
+clean()
+{
+       echo "$SRCDIR"
+       rm -rf dist lib package/web-cli.package.linux
+}
+
+# build
+build() 
+{
+       echo $LIB
+       mkdir -p $LIB
+       SRC=`find $ROOTDIR -name "org.eclipse.osgi_*" | head -1`
+       cp $SRC $LIB
+
+       SRC=`find $ROOTDIR -name "org.tizen.common_*" | head -1`
+       cp $SRC $LIB
+       jar -xvf $SRC lib
+
+       SRC=`find $ROOTDIR -name "org.tizen.web.common_*" | head -1`
+       cp $SRC $LIB
+
+    SRC=`find $ROOTDIR -name "org.tizen.web.launch_*" | head -1`
+       cp $SRC $LIB
+       jar -xvf $SRC lib
+
+    SRC=`find $ROOTDIR -name "org.tizen.web.project.wizard_*" | head -1`
+       cp $SRC $LIB
+       jar -xvf $SRC lib
+
+       SRC=`find $ROOTDIR -name "org.tizen.web.sign_*" | head -1`
+       cp $SRC $LIB
+       jar -xvf $SRC lib
+
+       cp $PROJECT_HOME/lib/*.jar $LIB
+
+       mkdir -p $BUILD
+       cp -r $PROJECT_HOME/src/* $BUILD
+
+       ant
+
+}
+
+# install
+install() 
+{
+       mkdir -p $TARGET/lib
+
+    # copy command
+    case ${TARGET_OS} in
+        ubuntu-32|ubuntu-64|macos-64)
+               cp -r $PROJECT_HOME/doc/install/bin_ $TARGET/bin
+            rm $TARGET/bin/*.bat
+            ;;
+        windows-32|windows-64)
+            mkdir -p $TARGET/bin
+            cp -r $PROJECT_HOME/doc/install/bin_/*.bat $TARGET/bin
+            ;;
+        *)
+            echo "${TARGET_OS} is not support yet."
+            exit 1
+            ;;
+    esac
+    cp -r $PROJECT_HOME/doc/install/conf $TARGET/conf
+       cp -r $LIB/* $TARGET/lib
+       cp dist/*.jar $TARGET/lib
+}
+
+[ "$1" = "clean" ] && clean
+[ "$1" = "build" ] && build
+[ "$1" = "install" ] && install
+
+echo "success"
diff --git a/package/build.ubuntu-64 b/package/build.ubuntu-64
new file mode 100755 (executable)
index 0000000..a463f9f
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/sh -xe
+
+PROJECT_HOME="org.tizen.cli"
+BUILD=build
+PLATFORM=$TARGET_OS
+TARGET=package/web-cli.package.$PLATFORM/data/tools/ide
+
+LIB=$SRCDIR/lib
+
+# clean
+clean()
+{
+       echo "$SRCDIR"
+       rm -rf dist lib package/web-cli.package.linux
+}
+
+# build
+build() 
+{
+       echo $LIB
+       mkdir -p $LIB
+       SRC=`find $ROOTDIR -name "org.eclipse.osgi_*" | head -1`
+       cp $SRC $LIB
+
+       SRC=`find $ROOTDIR -name "org.tizen.common_*" | head -1`
+       cp $SRC $LIB
+       jar -xvf $SRC lib
+
+       SRC=`find $ROOTDIR -name "org.tizen.web.common_*" | head -1`
+       cp $SRC $LIB
+
+    SRC=`find $ROOTDIR -name "org.tizen.web.launch_*" | head -1`
+       cp $SRC $LIB
+       jar -xvf $SRC lib
+
+    SRC=`find $ROOTDIR -name "org.tizen.web.project.wizard_*" | head -1`
+       cp $SRC $LIB
+       jar -xvf $SRC lib
+
+       SRC=`find $ROOTDIR -name "org.tizen.web.sign_*" | head -1`
+       cp $SRC $LIB
+       jar -xvf $SRC lib
+
+       cp $PROJECT_HOME/lib/*.jar $LIB
+
+       mkdir -p $BUILD
+       cp -r $PROJECT_HOME/src/* $BUILD
+
+       ant
+
+}
+
+# install
+install() 
+{
+       mkdir -p $TARGET/lib
+
+    # copy command
+    case ${TARGET_OS} in
+        ubuntu-32|ubuntu-64|macos-64)
+               cp -r $PROJECT_HOME/doc/install/bin_ $TARGET/bin
+            rm $TARGET/bin/*.bat
+            ;;
+        windows-32|windows-64)
+            mkdir -p $TARGET/bin
+            cp -r $PROJECT_HOME/doc/install/bin_/*.bat $TARGET/bin
+            ;;
+        *)
+            echo "${TARGET_OS} is not support yet."
+            exit 1
+            ;;
+    esac
+    cp -r $PROJECT_HOME/doc/install/conf $TARGET/conf
+       cp -r $LIB/* $TARGET/lib
+       cp dist/*.jar $TARGET/lib
+}
+
+[ "$1" = "clean" ] && clean
+[ "$1" = "build" ] && build
+[ "$1" = "install" ] && install
+
+echo "success"
diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest
new file mode 100644 (file)
index 0000000..c0af547
--- /dev/null
@@ -0,0 +1,38 @@
+Version:1.0.19
+Maintainer: Bon-Yong Lee<bonyong.lee@samsung.com>, gyeongseok seo <gyeongseok.seo@samsung.com>
+
+Package: web-cli
+OS: ubuntu-32
+Build-host-os: ubuntu-32
+Build-dependency: webapp-eplugin [ubuntu-32], base-ide-product [ubuntu-32], common-eplugin [ubuntu-32]
+Install-dependency: sdb [ubuntu-32]
+Description: Tizen IDE Command Line Interface
+
+Package: web-cli
+OS: ubuntu-64
+Build-host-os: ubuntu-64
+Build-dependency: webapp-eplugin [ubuntu-64], base-ide-product [ubuntu-64], common-eplugin [ubuntu-64]
+Install-dependency: sdb [ubuntu-64]
+Description: Tizen IDE Command Line Interface
+
+Package: web-cli
+OS: windows-32
+Build-host-os: ubuntu-32
+Build-dependency: webapp-eplugin [windows-32], base-ide-product [windows-32], common-eplugin [windows-32]
+Install-dependency: sdb [windows-32]
+Description: Tizen IDE Command Line Interface
+
+Package: web-cli
+OS: windows-64
+Build-host-os: ubuntu-64
+Build-dependency: webapp-eplugin [windows-64], base-ide-product [windows-64], common-eplugin [windows-64]
+Install-dependency: sdb [windows-64]
+Description: Tizen IDE Command Line Interface
+
+Package: web-cli
+OS: macos-64
+Build-host-os: ubuntu-64
+Build-dependency: webapp-eplugin [macos-64], base-ide-product [macos-64], common-eplugin [macos-64]
+Install-dependency: sdb [macos-64]
+Description: Tizen IDE Command Line Interface
+