[Title] initiate New CLI dev.
authorHeongseok Heo <hyeongseok.heo@samsung.com>
Wed, 2 Oct 2013 06:07:21 +0000 (15:07 +0900)
committerHeongseok Heo <hyeongseok.heo@samsung.com>
Wed, 2 Oct 2013 06:07:21 +0000 (15:07 +0900)
[Desc.]
[Issue]

Change-Id: I98a9100c462e956ebaeb37ba2ca6ac41e9425cd7
Signed-off-by: Heongseok Heo <hyeongseok.heo@samsung.com>
45 files changed:
org.tizen.ncli.ide/.classpath [new file with mode: 0644]
org.tizen.ncli.ide/.gitignore [new file with mode: 0644]
org.tizen.ncli.ide/.project [new file with mode: 0644]
org.tizen.ncli.ide/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.tizen.ncli.ide/.settings/org.eclipse.pde.core.prefs [new file with mode: 0644]
org.tizen.ncli.ide/META-INF/MANIFEST.MF [new file with mode: 0644]
org.tizen.ncli.ide/build.properties [new file with mode: 0644]
org.tizen.ncli.ide/jgit.sh [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/CLIConstant.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/Tizen.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/TizenCLIConfig.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/config/CLIConfig.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/config/ConfigConstant.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/CreateCommand.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/SaveConfigFileCommand.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/SetConfigCommand.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/TizenCommand.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/config/NCLIConfigLoader.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/config/TizenCLIConfigProvider.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/exec/NewCommandLineExecutor.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildNativeCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/ConfigCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateCertificateCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateProject.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateSecProfileCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateSecProfileItemCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/Main.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/SignCLI.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/TizenAppType.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/ConfigCLICommand.java [new file with mode: 0644]
org.tizen.ncli.ide/test/resource/tizen-cli-config [new file with mode: 0644]
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/shell/test/Args4JTestBase.java [new file with mode: 0644]
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/shell/test/ConfigCLITest.java [new file with mode: 0644]
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/CommonCLISubCommandTest.java [new file with mode: 0644]
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/ConfigCommandTest.java [new file with mode: 0644]
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/TizenCLIConfigProviderTest.java [new file with mode: 0644]
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/tizen-cli-config-global [new file with mode: 0644]
org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/tizen-cli-config-local [new file with mode: 0644]
org.tizen.ncli.ide/tizen.bat [new file with mode: 0644]
org.tizen.ncli.ide/tizen.sh [new file with mode: 0644]
org.tizen.ncli.ide/todo.txt [new file with mode: 0644]

diff --git a/org.tizen.ncli.ide/.classpath b/org.tizen.ncli.ide/.classpath
new file mode 100644 (file)
index 0000000..088f649
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="lib" path="lib/args4j-2.0.24-SNAPSHOT.jar" sourcepath="/args4j/args4j/src"/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry kind="src" path="src"/>\r
+       <classpathentry kind="src" path="test/src"/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>\r
+       <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
diff --git a/org.tizen.ncli.ide/.gitignore b/org.tizen.ncli.ide/.gitignore
new file mode 100644 (file)
index 0000000..5e56e04
--- /dev/null
@@ -0,0 +1 @@
+/bin
diff --git a/org.tizen.ncli.ide/.project b/org.tizen.ncli.ide/.project
new file mode 100644 (file)
index 0000000..4f860b0
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.tizen.ncli.ide</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.ManifestBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.SchemaBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.pde.PluginNature</nature>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/org.tizen.ncli.ide/.settings/org.eclipse.jdt.core.prefs b/org.tizen.ncli.ide/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..54e493c
--- /dev/null
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.6\r
diff --git a/org.tizen.ncli.ide/.settings/org.eclipse.pde.core.prefs b/org.tizen.ncli.ide/.settings/org.eclipse.pde.core.prefs
new file mode 100644 (file)
index 0000000..b7e72d0
--- /dev/null
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1\r
+pluginProject.extensions=false\r
+resolve.requirebundle=false\r
diff --git a/org.tizen.ncli.ide/META-INF/MANIFEST.MF b/org.tizen.ncli.ide/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..e348cce
--- /dev/null
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Newcli-prototype
+Bundle-SymbolicName: org.tizen.ncli.ide
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.tizen.common;bundle-version="2.0.0"
diff --git a/org.tizen.ncli.ide/build.properties b/org.tizen.ncli.ide/build.properties
new file mode 100644 (file)
index 0000000..41eb6ad
--- /dev/null
@@ -0,0 +1,4 @@
+source.. = src/\r
+output.. = bin/\r
+bin.includes = META-INF/,\\r
+               .\r
diff --git a/org.tizen.ncli.ide/jgit.sh b/org.tizen.ncli.ide/jgit.sh
new file mode 100644 (file)
index 0000000..6b9ce40
--- /dev/null
@@ -0,0 +1,114 @@
+#!/bin/sh
+# Copyright (C) 2008-2009, Google Inc.
+# Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
+# and other copyright owners as documented in the project's IP log.
+#
+# This program and the accompanying materials are made available
+# under the terms of the Eclipse Distribution License v1.0 which
+# accompanies this distribution, is reproduced below, and is
+# available at http://www.eclipse.org/org/documents/edl-v10.php
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or
+# without modification, are permitted provided that the following
+# conditions are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# - Redistributions in binary form must reproduce the above
+#   copyright notice, this list of conditions and the following
+#   disclaimer in the documentation and/or other materials provided
+#   with the distribution.
+#
+# - Neither the name of the Eclipse Foundation, Inc. nor the
+#   names of its contributors may be used to endorse or promote
+#   products derived from this software without specific prior
+#   written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cmd=
+for a in "$@"
+do
+       case "$a" in
+       -*) continue ;;
+       *)  cmd=$a; break; ;;
+       esac
+done
+
+use_pager=
+case "$cmd" in
+blame)    use_pager=1 ;;
+diff)     use_pager=1 ;;
+log)      use_pager=1 ;;
+esac
+
+this_script=`which "$0" 2>/dev/null`
+[ $? -gt 0 -a -f "$0" ] && this_script="$0"
+cp=$this_script
+
+if [ -n "$JGIT_CLASSPATH" ]
+then
+       cp="$cp:$JGIT_CLASSPATH"
+fi
+
+# Cleanup paths for Cygwin.
+#
+case "`uname`" in
+CYGWIN*)
+       cp=`cygpath --windows --mixed --path "$cp"`
+       ;;
+Darwin)
+       if [ -e /System/Library/Frameworks/JavaVM.framework ]
+       then
+               java_args='
+                       -Dcom.apple.mrj.application.apple.menu.about.name=JGit
+                       -Dcom.apple.mrj.application.growbox.intrudes=false
+                       -Dapple.laf.useScreenMenuBar=true
+                       -Xdock:name=JGit
+                       -Dfile.encoding=UTF-8
+               '
+       fi
+       ;;
+esac
+
+CLASSPATH="$cp"
+export CLASSPATH
+
+java=java
+if [ -n "$JAVA_HOME" ]
+then
+       java="$JAVA_HOME/bin/java"
+fi
+
+if [ -n "$use_pager" ]
+then
+       use_pager=${GIT_PAGER:-${PAGER:-less}}
+       [ cat = "$use_pager" ] && use_pager=
+fi
+
+if [ -n "$use_pager" ]
+then
+       LESS=${LESS:-FSRX}
+       export LESS
+
+       "$java" $java_args org.eclipse.jgit.pgm.Main "$@" | $use_pager
+       exit
+else
+  exec "$java" $java_args org.eclipse.jgit.pgm.Main "$@"
+  exit 1
+fi
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/CLIConstant.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/CLIConstant.java
new file mode 100644 (file)
index 0000000..5801ed5
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ *\r
+ */\r
+public class CLIConstant {\r
+       \r
+       public static final String TIZEN_CLI_GLOBAL_KEY = "TIZEN.CLI.GLOBAL";//Preference key\r
+       public static final String TIZEN_CLI_LOCAL_KEY = "TIZEN.CLI.LOCAL";//Preference key\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/Tizen.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/Tizen.java
new file mode 100644 (file)
index 0000000..262e48e
--- /dev/null
@@ -0,0 +1,35 @@
+/**\r
+ * \r
+ */\r
+package org.tizen.ncli.ide;\r
+\r
+import org.tizen.ncli.ide.core.command.CreateCommand;\r
+import org.tizen.ncli.ide.core.command.SetConfigCommand;\r
+import org.tizen.ncli.ide.subcommands.ConfigCLICommand;\r
+\r
+\r
+/**\r
+ * This class offers Tizen CLI command with API level\r
+ * @author Hyeongseok Heo\r
+ *\r
+ */\r
+public class Tizen {\r
+    \r
+    public Tizen() {\r
+    \r
+    }\r
+    \r
+\r
+    @SuppressWarnings("rawtypes")\r
+       public CreateCommand<?> create(){\r
+               return new CreateCommand();\r
+       }\r
+\r
+    /**\r
+     * @return config command instance\r
+     */\r
+    public ConfigCLICommand config() {\r
+        return new ConfigCLICommand();\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/TizenCLIConfig.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/TizenCLIConfig.java
new file mode 100644 (file)
index 0000000..7cc389e
--- /dev/null
@@ -0,0 +1,51 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide;\r
+\r
+import java.io.File;\r
+\r
+import org.tizen.common.config.Preference;\r
+import org.tizen.common.config.PreferenceProvider;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class TizenCLIConfig {\r
+    \r
+    public TizenCLIConfig(File configfile) {\r
+    }\r
+\r
+    /**\r
+     * \r
+     */\r
+    public TizenCLIConfig() {\r
+        // TODO Auto-generated constructor stub\r
+    }\r
+    \r
+    \r
+    \r
+    \r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/config/CLIConfig.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/config/CLIConfig.java
new file mode 100644 (file)
index 0000000..f1f4a55
--- /dev/null
@@ -0,0 +1,75 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.config;\r
+\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+\r
+import org.tizen.common.config.Preference;\r
+import org.tizen.common.util.CollectionUtil;\r
+import org.tizen.ncli.ide.CLIConstant;\r
+\r
+/**\r
+ * This class represents Tizen CLI config information.\r
+ * \r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class CLIConfig {\r
+    \r
+    private Collection<String> globalKeys;\r
+    private Collection<String> localKeys;\r
+\r
+\r
+    public CLIConfig() {\r
+        setConfigValues();\r
+    }\r
+    \r
+    /**\r
+     * \r
+     */\r
+    private void setConfigValues() {\r
+        globalKeys = Preference.list("TIZEN.CLI.GLOBAL");\r
+        localKeys = Preference.list("TIZEN.CLI.LOCAL");\r
+    }\r
+\r
+    \r
+    public Collection<String> getGlobalKeys(){\r
+        return globalKeys;\r
+    }\r
+    \r
+    public Collection<String> getLocalKeys(){\r
+        return localKeys;\r
+    }\r
+    \r
+    public String getValue(String key) {\r
+        if( null != localKeys && localKeys.contains(key)) {\r
+            return Preference.get(CLIConstant.TIZEN_CLI_LOCAL_KEY, key);\r
+        }else if ( null != globalKeys && globalKeys.contains(key)) {\r
+               return Preference.get(CLIConstant.TIZEN_CLI_GLOBAL_KEY, key);\r
+        }\r
+       return null;\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/config/ConfigConstant.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/config/ConfigConstant.java
new file mode 100644 (file)
index 0000000..a9fa0d4
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.config;\r
+\r
+/**\r
+ * This class provids CLI config key name constant.\r
+ * \r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ *\r
+ */\r
+public class ConfigConstant {\r
+       public static final String KEY = "";\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/CreateCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/CreateCommand.java
new file mode 100644 (file)
index 0000000..257845b
--- /dev/null
@@ -0,0 +1,65 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.core.command;\r
+\r
+import org.tizen.common.core.command.ExecutionContext;\r
+import org.tizen.common.core.command.Executor;\r
+import org.tizen.ncli.ide.shell.CreateCLI;\r
+\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ * @param <T>\r
+ */\r
+public class CreateCommand<T> extends TizenCommand<T> {\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.core.command.Command#run(org.tizen.common.core.command.Executor, org.tizen.common.core.command.ExecutionContext)\r
+     */\r
+    @Override\r
+    public void run(Executor executor, ExecutionContext context) throws Exception {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.core.command.Command#undo(org.tizen.common.core.command.Executor, org.tizen.common.core.command.ExecutionContext)\r
+     */\r
+    @Override\r
+    public void undo(Executor executor, ExecutionContext context) throws Exception {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.core.command.Command#getResult()\r
+     */\r
+    @Override\r
+    public T getResult() {\r
+        // TODO Auto-generated method stub\r
+        return null;\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/SaveConfigFileCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/SaveConfigFileCommand.java
new file mode 100644 (file)
index 0000000..f684846
--- /dev/null
@@ -0,0 +1,46 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.core.command;\r
+\r
+import org.tizen.common.core.command.AbstractCommand;\r
+import org.tizen.common.core.command.ExecutionContext;\r
+import org.tizen.common.core.command.Executor;\r
+import org.tizen.common.core.command.file.WriteFileCommand;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class SaveConfigFileCommand extends AbstractCommand<Object>{\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.core.command.AbstractCommand#run(org.tizen.common.core.command.Executor, org.tizen.common.core.command.ExecutionContext)\r
+     */\r
+    @Override\r
+    public void run(Executor executor, ExecutionContext context) throws Exception {\r
+        \r
+        \r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/SetConfigCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/SetConfigCommand.java
new file mode 100644 (file)
index 0000000..5148130
--- /dev/null
@@ -0,0 +1,80 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.core.command;\r
+\r
+import java.util.Map;\r
+\r
+import org.tizen.common.config.PreferenceProvider;\r
+import org.tizen.common.core.command.AbstractCommand;\r
+import org.tizen.common.core.command.CompositeCommand;\r
+import org.tizen.common.core.command.ExecutionContext;\r
+import org.tizen.common.core.command.Executor;\r
+import org.tizen.common.file.FileHandler;\r
+import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;\r
+\r
+/**\r
+ * This class handles setting and saving cli config to specific file.\r
+ * \r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ *\r
+ */\r
+public class SetConfigCommand extends AbstractCommand<Object>{\r
+    private static final String CONFIG_FILE_NAME = ".tizen-cli-config";\r
+   \r
\r
+    /**\r
+     * @param key\r
+     * @param value\r
+     */\r
+    public void setConfig(String key, String value) {\r
+    }\r
+    \r
+    public void setConfig(Map keyValueMap) {\r
+        \r
+    }\r
+\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.core.command.Command#run(org.tizen.common.core.command.Executor, org.tizen.common.core.command.ExecutionContext)\r
+     */\r
+    @Override\r
+    public void run(Executor executor, ExecutionContext context) throws Exception {\r
+        FileHandler fileHandler = context.getFileHandler();\r
+//        WriteFileCommand writeFileCmd = new WriteFileCommand(path, contents);\r
+        \r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.core.command.Command#undo(org.tizen.common.core.command.Executor, org.tizen.common.core.command.ExecutionContext)\r
+     */\r
+    @Override\r
+    public void undo(Executor executor, ExecutionContext context) throws Exception {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+    \r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/TizenCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/command/TizenCommand.java
new file mode 100644 (file)
index 0000000..3309ab0
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.core.command;\r
+\r
+import org.tizen.common.core.command.Command;\r
+\r
+/**\r
+ * Abstract class for CLI command classes.\r
+ * \r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ * @param <T>\r
+ *\r
+ */\r
+public abstract class TizenCommand<T> implements Command<T>{\r
+    \r
+    protected T result;\r
+    \r
+    \r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/config/NCLIConfigLoader.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/config/NCLIConfigLoader.java
new file mode 100644 (file)
index 0000000..c40645e
--- /dev/null
@@ -0,0 +1,139 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.core.config;\r
+\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.util.Properties;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.tizen.common.config.Loader;\r
+import org.tizen.common.config.Preference;\r
+import org.tizen.common.core.application.InstallPathConfig;\r
+import org.tizen.common.util.Assert;\r
+import org.tizen.common.util.FileUtil;\r
+import org.tizen.common.util.IOUtil;\r
+import org.tizen.ncli.ide.CLIConstant;\r
+\r
+/**\r
+ * This class loads Tizen configuration from the specified file <tt>.tizen-cli-config</tt> .\r
+ *  \r
+ * <p>Tizen configuration file could be located at two location. <br>\r
+ * First, global configuration file is located under the <tt>user home</tt> location.In Windows it would be C:\Users\accountName.\r
+ * <br>\r
+ * Second, local configuration file is located under the <tt>Tizen SDK tools path</tt>.<br>\r
+ * <br>  \r
+ * Make sure that local config will have high priority to global config if there is same key. \r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class NCLIConfigLoader implements Loader {\r
+    private static final String configFileName =".tizen-cli-config";\r
+    private static Logger log = LoggerFactory.getLogger(NCLIConfigLoader.class);\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.config.Loader#load(java.lang.String)\r
+     */\r
+    @Override\r
+    public void load(String ns) throws IOException {\r
+       Assert.notNull(ns,"Namespace could not be null");\r
+       if(CLIConstant.TIZEN_CLI_GLOBAL_KEY.equals(ns)) {\r
+               Preference.register(ns, new TizenCLIConfigProvider(loadGlobalConf()));\r
+       }else if(CLIConstant.TIZEN_CLI_LOCAL_KEY.equals(ns)) {\r
+               Preference.register(ns, new TizenCLIConfigProvider(loadLocalConf()));\r
+       }\r
+    }\r
+    \r
+    \r
+    /**\r
+     * Load local configuration from <tt>Tizen SDK Tools</tt>\r
+     * @return localProperties return null if config file not exist. \r
+     */\r
+    public static Properties loadLocalConf(){\r
+        InputStream inStream = null;\r
+        Properties localProp = null;\r
+        try {\r
+            File file = getLocalConfigFile();\r
+            boolean isLocalConfExist = file.exists();\r
+            log.trace("isLocalConfExist:{}",isLocalConfExist);\r
+            if(isLocalConfExist) {\r
+                               inStream = new FileInputStream(file);\r
+                               localProp = new Properties();\r
+                localProp.load(inStream);\r
+            }\r
+            \r
+        }catch (FileNotFoundException e) {\r
+            //FIXME something to do\r
+        }catch(IOException io){\r
+            //FIXME something to do\r
+        }finally {\r
+            IOUtil.tryClose(inStream);\r
+        }\r
+        return localProp;\r
+    }\r
+\r
+       public static File getLocalConfigFile() {\r
+               String sdkToolPath = InstallPathConfig.getToolsPath();\r
+               return new File(sdkToolPath+"/"+configFileName);\r
+       }\r
+    /**\r
+     * Load global configuration from <tt>USER HOME</tt>\r
+     * @return globalProperties return null if config file not exist.\r
+     */\r
+    public static Properties loadGlobalConf(){\r
+        InputStream inStream = null;\r
+        Properties prop = new Properties();\r
+        try {\r
+            File file = getGlobalConfigFile();\r
+            boolean isGlobalConfExist = file.exists();\r
+            log.trace("isGlobalConfExist:{}",isGlobalConfExist);\r
+            if(isGlobalConfExist) {\r
+                inStream = new FileInputStream(file);\r
+                prop.load(inStream);\r
+            } else {\r
+              log.info("Tizen CLI Global config file does not exist.");  \r
+            }\r
+        }catch (FileNotFoundException e) {\r
+            //FIXME something to do\r
+        }catch(IOException io){\r
+            //FIXME something to do\r
+        }finally {\r
+            IOUtil.tryClose(inStream);\r
+        }\r
+        return prop;\r
+        \r
+    }\r
+\r
+       public static File getGlobalConfigFile() {\r
+               File userHome = new File(System.getProperty("user.home"));\r
+               return new File(userHome.getAbsolutePath()+"/"+configFileName);\r
+       }\r
+    \r
+    \r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/config/TizenCLIConfigProvider.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/core/config/TizenCLIConfigProvider.java
new file mode 100644 (file)
index 0000000..c7c21a1
--- /dev/null
@@ -0,0 +1,73 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.core.config;\r
+\r
+import java.util.Collection;\r
+import java.util.Properties;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.tizen.common.config.PreferenceProvider;\r
+import org.tizen.common.config.provider.PropertiesProvider;\r
+\r
+/**\r
+ * This class provides Tizen CLI config information based on {@link PropertiesProvider} \r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class TizenCLIConfigProvider implements PreferenceProvider{\r
+    private PropertiesProvider propProvider = null;\r
+    \r
+    public TizenCLIConfigProvider(Properties props) {\r
+        this.propProvider = new PropertiesProvider(props);\r
+    }\r
+    \r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.config.PreferenceProvider#keys()\r
+     */\r
+    @Override\r
+    public Collection<String> keys() {\r
+        return this.propProvider.keys();\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.config.PreferenceProvider#get(java.lang.String)\r
+     */\r
+    @Override\r
+    public String get(String key) {\r
+        return this.propProvider.get(key);\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.common.config.PreferenceProvider#set(java.lang.String, java.lang.String)\r
+     */\r
+    @Override\r
+    public void set(String key, String value) {\r
+        this.propProvider.set(key, value);\r
+    }\r
+    \r
+    \r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/exec/NewCommandLineExecutor.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/exec/NewCommandLineExecutor.java
new file mode 100644 (file)
index 0000000..24cc5fd
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.exec;\r
+\r
+import org.tizen.common.core.command.Executor;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class NewCommandLineExecutor extends Executor {\r
+    \r
+    /**\r
+     * \r
+     */\r
+    public NewCommandLineExecutor() {\r
+        \r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java
new file mode 100644 (file)
index 0000000..401cb45
--- /dev/null
@@ -0,0 +1,71 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+import java.io.File;\r
+import java.io.PrintWriter;\r
+\r
+import org.kohsuke.args4j.CmdLineException;\r
+import org.kohsuke.args4j.CmdLineParser;\r
+import org.kohsuke.args4j.Option;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+/**\r
+ * Implemented common function of CLI options\r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public abstract class AbstractCLI {\r
+       protected Logger log = LoggerFactory.getLogger(getClass());\r
+       \r
+    @Option(name="--" , metaVar="target path" , usage="Specify where the root path for the command")\r
+    public File targetPath;\r
+    \r
+    protected PrintWriter output = new PrintWriter(System.out);;\r
+    \r
+    public final void execute(String[] args) {\r
+        parseArgument(args);\r
+        execute();\r
+    }\r
+    \r
+    /**\r
+     * @param args\r
+     */\r
+    private void parseArgument(String[] args) {\r
+        log.trace("Could not use parsing argument again!");\r
+//     log.trace("parseArgument...");\r
+//        CmdLineParser parser = new CmdLineParser(this);\r
+//        \r
+//        try {\r
+//            parser.parseArgument(args);\r
+//        } catch (CmdLineException e) {\r
+//             e.printStackTrace();\r
+//            System.err.println("Error occurred during parsing the arguments.");\r
+//            System.exit(1);\r
+//        }\r
+    }\r
+\r
+    public abstract void execute();\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildNativeCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildNativeCLI.java
new file mode 100644 (file)
index 0000000..61f6367
--- /dev/null
@@ -0,0 +1,45 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class BuildNativeCLI extends AbstractCLI{\r
+    private Logger log = LoggerFactory.getLogger(getClass());\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.shell.AbstractCLI#execute()\r
+     */\r
+    @Override\r
+    public void execute() {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java
new file mode 100644 (file)
index 0000000..20fa704
--- /dev/null
@@ -0,0 +1,23 @@
+package org.tizen.ncli.ide.shell;\r
+\r
+import org.kohsuke.args4j.Option;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.tizen.ncli.ide.TizenCLIConfig;\r
+import org.tizen.ncli.ide.core.command.TizenCommand;\r
+\r
+\r
+public class BuildWebCLI extends AbstractCLI{\r
+    private Logger log = LoggerFactory.getLogger(getClass());\r
+    \r
+    @Option(name="--optimize" , usage="Optimize option" )\r
+    private String optimize;\r
+    \r
+    \r
+    \r
+    public  void execute() {\r
+        \r
+    }\r
+    \r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/ConfigCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/ConfigCLI.java
new file mode 100644 (file)
index 0000000..601ab59
--- /dev/null
@@ -0,0 +1,95 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import org.kohsuke.args4j.Argument;\r
+import org.kohsuke.args4j.CmdLineException;\r
+import org.kohsuke.args4j.CmdLineParser;\r
+import org.kohsuke.args4j.Option;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.tizen.ncli.ide.Tizen;\r
+import org.tizen.ncli.ide.TizenCLIConfig;\r
+import org.tizen.ncli.ide.config.CLIConfig;\r
+import org.tizen.ncli.ide.core.command.SetConfigCommand;\r
+import org.tizen.ncli.ide.subcommands.ConfigCLICommand;\r
+\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class ConfigCLI extends AbstractCLI{\r
+    private Map<String, String> properties = new HashMap<String, String>();\r
+    \r
+    @Argument\r
+    private void setConfigProperty(final String property) throws CmdLineException {\r
+        log.trace("setConfigProperty {}",property);\r
+        if( null == property || property.startsWith("-")) return;\r
+        String[] arr = property.split("=");\r
+        if(arr.length != 2) {\r
+            throw new CmdLineException("Properties must be specified in the form:"+\r
+                    "<property>=<value>");\r
+        }\r
+        properties.put(arr[0], arr[1]);\r
+    }\r
+    \r
+    @Option (name="-l", aliases="--list", usage="Show config list")\r
+    public boolean list;\r
+    \r
+    @Option (name="-g" , aliases="--global", usage="Setting global Tizen CLI config")\r
+    public boolean global;\r
+    \r
+    \r
+    public void execute() {\r
+        log.trace("Execute configCLI...");\r
+        ConfigCLICommand configCommand = new Tizen().config();\r
+        \r
+        //Setting options\r
+        configCommand.setList(list);\r
+        configCommand.setGlobal(global);\r
+        configCommand.setKeyValue(properties);\r
+        \r
+        CLIConfig tizenCLIConfig = configCommand.runCommand();\r
+        //Printout result of command \r
+        if(list) {\r
+            //TODO print message should be refined \r
+               output.format("list config key values....{}", tizenCLIConfig);\r
+        }else if(global){\r
+            output.format("Setting global configuration is succeeded....");\r
+        }else {\r
+            output.format("Setting configuration is succeeded....");\r
+        }\r
+        \r
+        output.flush();\r
+        \r
+        \r
+        \r
+    }\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateCLI.java
new file mode 100644 (file)
index 0000000..66aeb6e
--- /dev/null
@@ -0,0 +1,36 @@
+package org.tizen.ncli.ide.shell;\r
+\r
+import org.kohsuke.args4j.Argument;\r
+import org.kohsuke.args4j.spi.SubCommand;\r
+import org.kohsuke.args4j.spi.SubCommandHandler;\r
+import org.kohsuke.args4j.spi.SubCommands;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+\r
+\r
+public class CreateCLI extends AbstractCLI {\r
+    private Logger log = LoggerFactory.getLogger(CreateCLI.class);\r
+    \r
+    @Argument(index = 0, required = true, handler = SubCommandHandler.class, usage = "Command is needed!")\r
+    @SubCommands({ \r
+            @SubCommand(name = "project", impl = CreateProject.class),\r
+            @SubCommand(name = "security-profile", impl = CreateSecProfileCLI.class),\r
+            @SubCommand(name = "security-profile-item", impl = CreateSecProfileItemCLI.class),\r
+            @SubCommand(name = "certificate", impl = CreateCertificateCLI.class)\r
+    })\r
+    private AbstractCLI tizenCLI;\r
+    \r
+    \r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.shell.TizenCLI#execute()\r
+     */\r
+    @Override\r
+    public void execute() {\r
+        log.trace("execute Create cli...");\r
+    }\r
+    \r
+       \r
+       \r
+    \r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateCertificateCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateCertificateCLI.java
new file mode 100644 (file)
index 0000000..cf431c0
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class CreateCertificateCLI extends AbstractCLI {\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.shell.AbstractCLI#execute()\r
+     */\r
+    @Override\r
+    public void execute() {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateProject.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateProject.java
new file mode 100644 (file)
index 0000000..585c5f4
--- /dev/null
@@ -0,0 +1,62 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+import org.kohsuke.args4j.Option;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class CreateProject extends AbstractCLI {\r
+    private Logger logger = LoggerFactory.getLogger(CreateProject.class);\r
+    \r
+    @Option(name="-t" , aliases= {"--type"})\r
+    private TizenAppType appType;\r
+    \r
+    @Option(name="-n" , aliases="--name" , required=true)\r
+    private String projectName;\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.shell.AbstractCLI#execute()\r
+     */\r
+    @Override\r
+    public void execute() {\r
+        logger.info("Project Name:{}",projectName);\r
+        \r
+        switch (appType) {\r
+        case NATIVE:\r
+            logger.trace("Native app is being created");\r
+            break;\r
+        case WEB:\r
+            logger.trace("Web app is being created");\r
+            break;\r
+        default:\r
+            break;\r
+        }\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateSecProfileCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateSecProfileCLI.java
new file mode 100644 (file)
index 0000000..ce2f0df
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class CreateSecProfileCLI extends AbstractCLI {\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.shell.AbstractCLI#execute()\r
+     */\r
+    @Override\r
+    public void execute() {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateSecProfileItemCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateSecProfileItemCLI.java
new file mode 100644 (file)
index 0000000..33e47e7
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class CreateSecProfileItemCLI extends AbstractCLI {\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.shell.AbstractCLI#execute()\r
+     */\r
+    @Override\r
+    public void execute() {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/Main.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/Main.java
new file mode 100644 (file)
index 0000000..6447db4
--- /dev/null
@@ -0,0 +1,68 @@
+/**\r
+ * \r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+import java.util.List;\r
+\r
+import org.kohsuke.args4j.Argument;\r
+import org.kohsuke.args4j.CmdLineException;\r
+import org.kohsuke.args4j.CmdLineParser;\r
+import org.kohsuke.args4j.spi.OptionHandler;\r
+import org.kohsuke.args4j.spi.SubCommand;\r
+import org.kohsuke.args4j.spi.SubCommandHandler;\r
+import org.kohsuke.args4j.spi.SubCommands;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+\r
+/**\r
+ * This class is entry point of Tizen New Command Line Interface. All the command\r
+ * line argument would be parsed and then proper Command class is called.\r
+ * \r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ * \r
+ */\r
+public class Main {\r
+\r
+    private Logger log = LoggerFactory.getLogger(Main.class);\r
+\r
+    @Argument(index = 0, required = true, handler = SubCommandHandler.class, usage = "Command is needed!")\r
+    @SubCommands({ @SubCommand(name = "create", impl = CreateCLI.class),\r
+            @SubCommand(name = "build-native", impl = BuildNativeCLI.class),\r
+            @SubCommand(name = "build-web", impl = BuildWebCLI.class),\r
+            @SubCommand(name = "sign", impl = SignCLI.class),\r
+            @SubCommand(name = "cli-config", impl = ConfigCLI.class) })\r
+    private AbstractCLI tizenCLI;\r
+\r
+    /**\r
+     * @param args\r
+     */\r
+    public static void main(String[] args) {\r
+        Main tizen = new Main();\r
+        tizen.run(args);\r
+\r
+    }\r
+\r
+    private void run(String[] args) {\r
+        CmdLineParser cmdParser = new CmdLineParser(this);\r
+\r
+        log.trace("Start running Tizen CLI Main class...");\r
+        try {\r
+            //Argument parsing - make metadata from annotation.\r
+            cmdParser.parseArgument(args);\r
+            if( null != this.tizenCLI) {\r
+                this.tizenCLI.execute();\r
+            }\r
+            \r
+        } catch (CmdLineException e) {\r
+            // TODO Handle CLI exception\r
+            e.printStackTrace();\r
+        } catch (Exception e) {\r
+                       // TODO: handle exception\r
+               e.printStackTrace();\r
+               }\r
+\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/SignCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/SignCLI.java
new file mode 100644 (file)
index 0000000..8998c12
--- /dev/null
@@ -0,0 +1,19 @@
+package org.tizen.ncli.ide.shell;\r
+\r
+import org.kohsuke.args4j.Option;\r
+\r
+public class SignCLI extends AbstractCLI {\r
+    \r
+\r
+    @Option(name = "--exclude" , usage="Set exclude file pattern")\r
+    private String excludePattern;\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.shell.AbstractCLI#execute()\r
+     */\r
+    @Override\r
+    public void execute() {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/TizenAppType.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/TizenAppType.java
new file mode 100644 (file)
index 0000000..0120382
--- /dev/null
@@ -0,0 +1,34 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@leteral <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public enum TizenAppType {\r
+    NATIVE,\r
+    WEB,\r
+    Hybrid\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java
new file mode 100644 (file)
index 0000000..dda8757
--- /dev/null
@@ -0,0 +1,80 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.subcommands;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.tizen.common.config.Preference;\r
+import org.tizen.common.config.provider.EnvironmentProvider;\r
+import org.tizen.common.config.provider.SystemPropertiesProvider;\r
+import org.tizen.ncli.ide.CLIConstant;\r
+import org.tizen.ncli.ide.core.config.NCLIConfigLoader;\r
+import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;\r
+import org.tizen.ncli.ide.exec.NewCommandLineExecutor;\r
+\r
+\r
+/**\r
+ * This class provides common environment to other SubCommand.\r
+ * \r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+abstract public class AbstractSubCommand<T> {\r
+    protected final Logger logger = LoggerFactory.getLogger( getClass() );\r
+    \r
+    \r
+    /**\r
+     * This method is called by CLI entry class.<p>\r
+     * And then call <code>call()</code> method.   \r
+     * \r
+     * @return T\r
+     * @throws Exception\r
+     */\r
+    public T runCommand() {\r
+        initializeConfig();\r
+        \r
+        T ret = call();\r
+        \r
+        return ret;\r
+    }\r
+\r
+    /**\r
+     * \r
+     */\r
+    private void initializeConfig() {\r
+        Preference.register( "OS", new EnvironmentProvider() );\r
+        Preference.register( "JVM", new SystemPropertiesProvider() );\r
+        Preference.register(CLIConstant.TIZEN_CLI_GLOBAL_KEY, new TizenCLIConfigProvider(NCLIConfigLoader.loadGlobalConf()));\r
+        Preference.register(CLIConstant.TIZEN_CLI_LOCAL_KEY, new TizenCLIConfigProvider(NCLIConfigLoader.loadLocalConf()));\r
+    }\r
+    \r
+    /**\r
+     * Execute command logic  \r
+     * <p>This method should be called only by {@link #runCommand()}<br>\r
+     * <b>Do not call this directly</b>\r
+     * \r
+     */\r
+    protected abstract T call();\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/ConfigCLICommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/ConfigCLICommand.java
new file mode 100644 (file)
index 0000000..ebd45ad
--- /dev/null
@@ -0,0 +1,134 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.subcommands;\r
+\r
+import java.io.File;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+import java.util.Properties;\r
+import java.util.Set;\r
+\r
+import org.tizen.common.util.IOUtil;\r
+import org.tizen.ncli.ide.config.CLIConfig;\r
+import org.tizen.ncli.ide.core.config.NCLIConfigLoader;\r
+\r
+/**\r
+ * This class is for 'cli-config' command processing.\r
+ * \r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class ConfigCLICommand extends AbstractSubCommand<CLIConfig>{\r
+    private boolean list = false;\r
+    private boolean global = false;\r
+    private Map<String, String> properties = new HashMap<String, String>();\r
+\r
+    /**\r
+     * @param key\r
+     * @param value\r
+     */\r
+    public void setConfig(String key, String value) {\r
+       this.properties.put(key, value);\r
+    }\r
+\r
+    /**\r
+     * @param list\r
+     */\r
+    public void setList(boolean list) {\r
+        this.list = list;\r
+    }\r
+\r
+    /**\r
+     * @param global\r
+     */\r
+    public void setGlobal(boolean global) {\r
+        this.global = global;\r
+    }\r
+\r
+    /**\r
+     * @param properties\r
+     */\r
+    public void setKeyValue(Map<String, String> properties) {\r
+        this.properties = properties;\r
+        \r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.subcommands.AbstractSubCommand#call()\r
+     */\r
+    @Override\r
+    public CLIConfig call() {\r
+        CLIConfig cliConfig = new CLIConfig();\r
+        if(list) {\r
+            return cliConfig;\r
+        }else if(global){\r
+               //global config setting\r
+               logger.trace("global config set call() - {}",properties);\r
+               \r
+            File file = NCLIConfigLoader.getGlobalConfigFile();\r
+               //Write global config file\r
+            Properties load = NCLIConfigLoader.loadGlobalConf();;\r
+            writeProperties2File(file, load);\r
+        }else {\r
+               //local config setting\r
+               logger.trace("local config set call() - {}",properties);\r
+               \r
+            File file = NCLIConfigLoader.getLocalConfigFile();\r
+               //Write local config file\r
+            Properties load = NCLIConfigLoader.loadLocalConf();;\r
+            writeProperties2File(file, load);\r
+        }\r
+        \r
+        return cliConfig;\r
+    }\r
+\r
+       private void writeProperties2File(File file, Properties load) {\r
+               Set<String> keySet = this.properties.keySet();\r
+               for (String key : keySet) {\r
+                   String value = properties.get(key);\r
+                   load.setProperty(key, value);\r
+                   \r
+                   logger.trace("key :{}",key);\r
+                   logger.trace("value:{}",value);\r
+               }\r
+               OutputStream ous = null;\r
+               try {\r
+                       ous = new FileOutputStream(file); \r
+                       load.store(ous, "This is generated by Tizen CLI!");\r
+               } catch (FileNotFoundException e) {\r
+                       // TODO Auto-generated catch block\r
+                       e.printStackTrace();\r
+               } catch (IOException e) {\r
+                       // TODO Auto-generated catch block\r
+                       e.printStackTrace();\r
+               } finally {\r
+                       IOUtil.tryClose(ous);\r
+               }\r
+       }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/test/resource/tizen-cli-config b/org.tizen.ncli.ide/test/resource/tizen-cli-config
new file mode 100644 (file)
index 0000000..0fa2e73
--- /dev/null
@@ -0,0 +1 @@
+security.store.path=default\r
diff --git a/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/shell/test/Args4JTestBase.java b/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/shell/test/Args4JTestBase.java
new file mode 100644 (file)
index 0000000..59bba4e
--- /dev/null
@@ -0,0 +1,137 @@
+package org.tizen.ncli.ide.shell.test;\r
+\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+import java.util.Locale;\r
+\r
+import static org.junit.Assert.*;\r
+import org.junit.After;\r
+import org.junit.Before;\r
+\r
+import org.kohsuke.args4j.CmdLineParser;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+\r
+\r
+/**\r
+ * Base class for Args4J Tests.\r
+ * It instantiates the test object, the CmdLineParser for\r
+ * that test object and provides a String array for passing\r
+ * to the parser.\r
+ *\r
+ * @author Jan Materne\r
+ */\r
+public abstract class Args4JTestBase<T>{\r
+\r
+    CmdLineParser parser;\r
+    String[] args;\r
+    T testObject;\r
+    Logger log = LoggerFactory.getLogger(getClass());\r
+    \r
+    private Locale defaultLocale;\r
+\r
+    /**\r
+     * Specifies which concrete object to return as test object.\r
+     * @return the test object\r
+     */\r
+    public abstract T getTestObject();\r
+    \r
+    /**\r
+     * Setter for args in a vararg manner.\r
+     * @param args\r
+     */\r
+    public void setArgs(String... args) {\r
+       this.args = args;\r
+    }\r
+    \r
+    /**\r
+     * Returns the Locale to use for the tests.\r
+     * Defaults to use the US-Locale but should be overwritten by classes\r
+     * which tests I18N.          \r
+     */         \r
+    public Locale getLocale() {\r
+        return Locale.US;\r
+    }\r
+\r
+    /**\r
+     * Initializes the testObject and the parser for that object.\r
+     * @see junit.framework.TestCase#setUp()\r
+     */\r
+    @Before\r
+    public void setUp() throws Exception {\r
+        defaultLocale = Locale.getDefault();\r
+        Locale.setDefault(getLocale());\r
+        testObject = getTestObject();\r
+        parser = createParser();\r
+    }\r
+\r
+    protected CmdLineParser createParser() {\r
+        return new CmdLineParser(testObject);\r
+    }\r
+\r
+    /**\r
+     * Restores the environment, namely the default Locale.\r
+     */         \r
+    @After\r
+    public void tearDown() throws Exception {\r
+        Locale.setDefault(defaultLocale);\r
+    }\r
+\r
+    /**\r
+     * Checks the number of lines of the parsers usage message.\r
+     * @param expectedLength\r
+     * @see TestCase#assertEquals(String, int, int)\r
+     * @see Args4JTestBase#getUsageMessage()\r
+     */\r
+    public void assertUsageLength(int expectedLength) {\r
+        assertEquals("Wrong amount of lines in usage message", expectedLength, getUsageMessage().length);\r
+    }\r
+    \r
+    /**\r
+     * Asserts that a given text is part of the usage message.\r
+     * @param message Error message if the text is not found.\r
+     * @param containingText Text to search for.\r
+     */\r
+    public void assertUsageContains(String message, String containingText) {\r
+       boolean contains = false;\r
+       for (String line : getUsageMessage()) {\r
+               if (line.contains(containingText)) {\r
+                       contains = true;\r
+                       break;\r
+               }\r
+       }\r
+       if (!contains) {\r
+               throw new AssertionError(message);\r
+       }\r
+    }\r
+\r
+    /**\r
+     * Extracts the usage message from the parser as String array.\r
+     * @return the usage message\r
+     * @see CmdLineParser#printUsage(OutputStream)\r
+     */\r
+    public String[] getUsageMessage() {\r
+        Stream2String s2s = new Stream2String();\r
+        parser.printUsage(s2s);\r
+        return s2s.getString().split(System.getProperty("line.separator"));\r
+    }\r
+\r
+    /**\r
+     * Utility class for capturing an OutputStream into a String.\r
+     * @author Jan Materne\r
+     */\r
+    private class Stream2String extends OutputStream {\r
+        private StringBuffer sb = new StringBuffer();\r
+\r
+        @Override\r
+        public void write(int b) throws IOException {\r
+            sb.append((char)b);\r
+        }\r
+\r
+        public String getString() {\r
+            return sb.toString();\r
+        }\r
+    }\r
+\r
+}
\ No newline at end of file
diff --git a/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/shell/test/ConfigCLITest.java b/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/shell/test/ConfigCLITest.java
new file mode 100644 (file)
index 0000000..3d8b9ab
--- /dev/null
@@ -0,0 +1,85 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.shell.test;\r
+\r
+import static org.junit.Assert.*;\r
+import org.junit.Test;\r
+import org.kohsuke.args4j.CmdLineException;\r
+import org.tizen.ncli.ide.shell.ConfigCLI;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class ConfigCLITest extends Args4JTestBase<ConfigCLI>{\r
+\r
+    @Test\r
+    public void test_wrong_option() throws Exception {\r
+        String [] wrongOptions = {"-ggg"};\r
+        try {\r
+            parser.parseArgument(wrongOptions);\r
+        } catch (CmdLineException e) {\r
+            assertNotNull(e);\r
+            log.error(e.toString());\r
+            assertTrue(e.toString().contains("is not a valid option"));\r
+        }\r
+    }\r
+    \r
+    \r
+    /**\r
+     * Test method for {@link org.tizen.ncli.ide.shell.ConfigCLI#execute()}.\r
+     */\r
+    @Test\r
+    public void test_list_Execute() throws Exception{\r
+        String [] args = {"-l"};\r
+        \r
+        try {\r
+            parser.parseArgument(args);\r
+        } catch (CmdLineException e) {\r
+            // TODO Auto-generated catch block\r
+            e.printStackTrace();\r
+            throw new Exception();\r
+        }\r
+        String[] usageMessage = getUsageMessage();\r
+        \r
+        for (String usageMsg : usageMessage) {\r
+            log.debug("Usage:{}" , usageMsg);\r
+            \r
+        }\r
+        testObject.execute();\r
+        \r
+    }\r
+\r
+\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.tizen.ncli.ide.shell.test.Args4JTestBase#getTestObject()\r
+     */\r
+    @Override\r
+    public ConfigCLI getTestObject() {\r
+        // TODO Auto-generated method stub\r
+        return new ConfigCLI();\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/CommonCLISubCommandTest.java b/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/CommonCLISubCommandTest.java
new file mode 100644 (file)
index 0000000..5cd40f6
--- /dev/null
@@ -0,0 +1,84 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.test;\r
+\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.util.Properties;\r
+\r
+import org.junit.BeforeClass;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.tizen.common.util.IOUtil;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class CommonCLISubCommandTest {\r
+\r
+    protected static Logger log = LoggerFactory.getLogger(CommonCLISubCommandTest.class);\r
+    protected static Properties testGlobalProp = new Properties();\r
+    protected static Properties testLocalProp = new Properties();\r
+\r
+    @BeforeClass\r
+    public static void prepare_once() {\r
+       InputStream configStream = null;\r
+       try {\r
+               configStream = loadTestGlobalConfig();\r
+               testGlobalProp.load(configStream);\r
+               configStream = loadTestLocalConfig();\r
+               testLocalProp.load(configStream);\r
+       } catch (IOException e) {\r
+               log.error("Load test config failed!");\r
+               e.printStackTrace();\r
+       } finally {\r
+               IOUtil.tryClose(configStream);\r
+       }\r
+    }\r
+\r
+       protected static InputStream loadTestGlobalConfig() {\r
+               final ClassLoader classLoader = CommonCLISubCommandTest.class.getClassLoader();\r
+       final String testFilePath = CommonCLISubCommandTest.class.getPackage().getName().replace(".", "/")+"/tizen-cli-config-global";\r
+       InputStream configStream = null;\r
+       configStream = classLoader.getResourceAsStream(testFilePath);\r
+               return configStream;\r
+       }\r
+       \r
+       protected static InputStream loadTestLocalConfig() {\r
+               final ClassLoader classLoader = CommonCLISubCommandTest.class.getClassLoader();\r
+       final String testFilePath = CommonCLISubCommandTest.class.getPackage().getName().replace(".", "/")+"/tizen-cli-config-local";\r
+       InputStream configStream = null;\r
+       configStream = classLoader.getResourceAsStream(testFilePath);\r
+               return configStream;\r
+       }\r
+\r
+    /**\r
+     * \r
+     */\r
+    public CommonCLISubCommandTest() {\r
+        super();\r
+    }\r
+\r
+}
\ No newline at end of file
diff --git a/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/ConfigCommandTest.java b/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/ConfigCommandTest.java
new file mode 100644 (file)
index 0000000..74d1839
--- /dev/null
@@ -0,0 +1,107 @@
+/**\r
+ * \r
+ */\r
+package org.tizen.ncli.ide.test;\r
+\r
+import static org.junit.Assert.*;\r
+import static org.powermock.api.mockito.PowerMockito.doAnswer;\r
+import static org.powermock.api.mockito.PowerMockito.spy;\r
+\r
+import java.io.InputStream;\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+import java.util.HashSet;\r
+import java.util.Properties;\r
+\r
+import org.hamcrest.core.Is;\r
+import org.junit.Test;\r
+import org.junit.runner.RunWith;\r
+import org.mockito.invocation.InvocationOnMock;\r
+import org.mockito.stubbing.Answer;\r
+import org.powermock.core.classloader.annotations.PowerMockIgnore;\r
+import org.powermock.core.classloader.annotations.PrepareForTest;\r
+import org.powermock.modules.junit4.PowerMockRunner;\r
+import org.tizen.common.config.Preference;\r
+import org.tizen.common.config.provider.EnvironmentProvider;\r
+import org.tizen.common.config.provider.SystemPropertiesProvider;\r
+import org.tizen.ncli.ide.config.CLIConfig;\r
+import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;\r
+import org.tizen.ncli.ide.subcommands.ConfigCLICommand;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ * \r
+ */\r
+@PowerMockIgnore({ "org.apache.log4j.*", "org.slf4j.Logger" })\r
+@RunWith(PowerMockRunner.class)\r
+@PrepareForTest(TizenCLIConfigProvider.class)\r
+public class ConfigCommandTest extends CommonCLISubCommandTest{\r
+\r
+    @Test\r
+    public void test_listConfig() throws Exception {\r
+\r
+        final TizenCLIConfigProvider globalProvider = new TizenCLIConfigProvider(testGlobalProp);\r
+        final TizenCLIConfigProvider localProvider = new TizenCLIConfigProvider(testLocalProp);\r
+\r
+        ConfigCLICommand configCmd = spy(new ConfigCLICommand());\r
+\r
+        doAnswer(new Answer<Object>() {\r
+\r
+            @Override\r
+            public Object answer(InvocationOnMock invocation) throws Throwable {\r
+                Preference.register("OS", new EnvironmentProvider());\r
+                Preference.register("JVM", new SystemPropertiesProvider());\r
+                Preference.register("TIZEN.CLI.GLOBAL", globalProvider);\r
+                Preference.register("TIZEN.CLI.LOCAL", localProvider);\r
+                return "run command called";\r
+            }\r
+\r
+        }).when(configCmd, "runCommand");\r
+\r
+        assertEquals("run command called", configCmd.runCommand());\r
+        \r
+        configCmd.setList(true);\r
+        \r
+        CLIConfig cliConfig = configCmd.call();\r
+        assertNotNull(cliConfig);\r
+        \r
+        Collection<String> expectedGlobalKeys = new HashSet<String>();\r
+        expectedGlobalKeys.add("global.key1");\r
+        expectedGlobalKeys.add("global.key2");\r
+        expectedGlobalKeys.add("global.key1.subkey1");\r
+        assertTrue(cliConfig.getGlobalKeys().containsAll(expectedGlobalKeys));\r
+        \r
+        Collection<String> expectedLocalKeys = new HashSet<String>();\r
+        expectedLocalKeys.add("global.key1");\r
+        expectedLocalKeys.add("local.key2");\r
+        expectedLocalKeys.add("local.key1.subkey1"); \r
+        \r
+        assertTrue(cliConfig.getLocalKeys().containsAll(expectedLocalKeys));\r
+        \r
+    }\r
+    \r
+    @Test\r
+    public void test_setLocalConfig() throws Exception {\r
+        final TizenCLIConfigProvider globalProvider = new TizenCLIConfigProvider(testGlobalProp);\r
+         final TizenCLIConfigProvider localProvider = new TizenCLIConfigProvider(testLocalProp);\r
+\r
+        ConfigCLICommand configCmd = spy(new ConfigCLICommand());\r
+\r
+        doAnswer(new Answer<Object>() {\r
+\r
+            @Override\r
+            public Object answer(InvocationOnMock invocation) throws Throwable {\r
+                Preference.register("OS", new EnvironmentProvider());\r
+                Preference.register("JVM", new SystemPropertiesProvider());\r
+                Preference.register("TIZEN.CLI.GLOBAL", globalProvider);\r
+                Preference.register("TIZEN.CLI.LOCAL", localProvider);\r
+                return "run command called";\r
+            }\r
+\r
+        }).when(configCmd, "runCommand");\r
+        \r
+        configCmd.setConfig("local.key.test", "this is LOCAL test value");\r
+        configCmd.call();\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/TizenCLIConfigProviderTest.java b/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/TizenCLIConfigProviderTest.java
new file mode 100644 (file)
index 0000000..550ae08
--- /dev/null
@@ -0,0 +1,65 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\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
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
+package org.tizen.ncli.ide.test;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+import java.util.HashSet;\r
+\r
+import org.junit.Test;\r
+import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;\r
+\r
+/**\r
+ * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
+ */\r
+public class TizenCLIConfigProviderTest extends CommonCLISubCommandTest {\r
+    @Test\r
+    public void test_getKey() throws Exception {\r
+        log.trace("test_getKey");\r
+        HashSet<String> keySet = new HashSet<String>();\r
+        keySet.add("global.key1");\r
+        keySet.add("global.key1");\r
+        keySet.add("global.key1.subkey1");\r
+        \r
+        Collection<String> expectKeys = Collections.unmodifiableCollection(keySet);\r
+        \r
+        TizenCLIConfigProvider cliProvider = new TizenCLIConfigProvider(testGlobalProp);        \r
+        Collection<String> keys = cliProvider.keys();\r
+        \r
+        assertTrue(keys.containsAll(expectKeys));\r
+    }\r
+    \r
+    @Test\r
+    public void test_getValue() {\r
+       TizenCLIConfigProvider cliProvider = new TizenCLIConfigProvider(testGlobalProp);\r
+       assertEquals("This is global value1", cliProvider.get("global.key1"));\r
+       assertEquals("This is global value2", cliProvider.get("global.key2"));\r
+       assertEquals("This is global subkey value1", cliProvider.get("global.key1.subkey1"));\r
+    }\r
+\r
+}\r
diff --git a/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/tizen-cli-config-global b/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/tizen-cli-config-global
new file mode 100644 (file)
index 0000000..e625c2f
--- /dev/null
@@ -0,0 +1,3 @@
+global.key1=This is global value1\r
+global.key2=This is global value2\r
+global.key1.subkey1=This is global subkey value1\r
diff --git a/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/tizen-cli-config-local b/org.tizen.ncli.ide/test/src/org/tizen/ncli/ide/test/tizen-cli-config-local
new file mode 100644 (file)
index 0000000..f9f1762
--- /dev/null
@@ -0,0 +1,3 @@
+global.key1=This is local value1\r
+local.key2=This is global value2\r
+local.key1.subkey1=This is local subkey value1\r
diff --git a/org.tizen.ncli.ide/tizen.bat b/org.tizen.ncli.ide/tizen.bat
new file mode 100644 (file)
index 0000000..f67e15b
--- /dev/null
@@ -0,0 +1,3 @@
+\r
+\r
+command=java -cp 
\ No newline at end of file
diff --git a/org.tizen.ncli.ide/tizen.sh b/org.tizen.ncli.ide/tizen.sh
new file mode 100644 (file)
index 0000000..d7259fd
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh\r
+cmd=\r
+for a in "$@"\r
+do\r
+       case "$a" in\r
+       -*) continue ;;\r
+       *)  cmd=$a; break; ;;\r
+       esac\r
+done\r
diff --git a/org.tizen.ncli.ide/todo.txt b/org.tizen.ncli.ide/todo.txt
new file mode 100644 (file)
index 0000000..33945bc
--- /dev/null
@@ -0,0 +1,4 @@
+1. tizen.sh  \r
+2. Main - entry point of Tizen new cli\r
+3. Command handler\r
+4. Sub command handler
\ No newline at end of file