upload tizen1.0 source 15/15/1
authorSungho Park <chywoo.park@samsung.com>
Mon, 30 Apr 2012 09:06:19 +0000 (18:06 +0900)
committerSungho Park <chywoo.park@samsung.com>
Mon, 30 Apr 2012 09:06:19 +0000 (18:06 +0900)
Change-Id: Ic083759dde66f37a2f23209964036b6927bbc577

23 files changed:
InstallManager_java/build.xml
InstallManager_java/lib/js.jar [deleted file]
InstallManager_java/lib/proxy-vole_20111102.jar [deleted file]
InstallManager_java/src/org/tizen/installmanager/core/Config.java
InstallManager_java/src/org/tizen/installmanager/core/IMFatalException.java
InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java
InstallManager_java/src/org/tizen/installmanager/core/Installer.java
InstallManager_java/src/org/tizen/installmanager/core/Options.java
InstallManager_java/src/org/tizen/installmanager/lib/Downloader.java
InstallManager_java/src/org/tizen/installmanager/lib/ErrorController.java
InstallManager_java/src/org/tizen/installmanager/lib/NetworkProxy.java [new file with mode: 0644]
InstallManager_java/src/org/tizen/installmanager/pkg/lib/PackageManager2.java
InstallManager_java/src/org/tizen/installmanager/ui/InstallManagerWindow.java
InstallManager_java/src/org/tizen/installmanager/ui/page/PageTemplate.java [new file with mode: 0644]
InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java
InstallManager_java/src/org/tizen/installmanager/ui/page/WelcomePage.java
InstallManager_java/src/org/tizen/installmanager/util/PathUtil.java
InstallerStub/linux/installer_stub
InstallerStub/linux/installmanager.conf.unstable [new file with mode: 0644]
InstallerStub/linux/installmanager.conf.unstable_internal [new file with mode: 0644]
InstallerStub/linux/installmanager.conf.unstable_public [new file with mode: 0644]
InstallerStub/linux/makeLocal
InstallerStub/linux/makeNetwork

index 6ef0acc..1f83a3c 100644 (file)
@@ -44,7 +44,6 @@
                <copy file="${basedir}/lib/org.eclipse.jface_3.6.2.M20110210-1200.jar" todir="${distlib.dir}" />
                <copy file="${basedir}/lib/org.eclipse.core.commands_3.6.0.I20100512-1500.jar" todir="${distlib.dir}" />
                <copy file="${basedir}/lib/${swtjar}" todir="${distlib.dir}" />
-               <copy file="${basedir}/lib/proxy-vole_20111102.jar" todir="${distlib.dir}" />
 
                <jar jarfile="${dist.dir}/${PLATFORM}/InstallManager.jar">
                        <fileset dir="${build.dir}" />
                                <attribute name="Rsrc-Class-Path" value="./ org.eclipse.equinox.common_3.6.0.v20100503.jar
                                org.eclipse.core.commands_3.6.0.I20100512-1500.jar 
                                org.eclipse.jface_3.6.2.M20110210-1200.jar
-                                       proxy-vole_20111102.jar
                                ${swtjar}"/>
                                <attribute name="Class-Path" value="."/>
-                               <attribute name="Rsrc-Main-Class" value="com.samsung.installmanager.ui.InstallManagerWindow"/>
+                               <attribute name="Rsrc-Main-Class" value="org.tizen.installmanager.ui.InstallManagerWindow"/>
                                <attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader"/>
                        </manifest>
     </jar>
diff --git a/InstallManager_java/lib/js.jar b/InstallManager_java/lib/js.jar
deleted file mode 100644 (file)
index 2369f99..0000000
Binary files a/InstallManager_java/lib/js.jar and /dev/null differ
diff --git a/InstallManager_java/lib/proxy-vole_20111102.jar b/InstallManager_java/lib/proxy-vole_20111102.jar
deleted file mode 100644 (file)
index f44aac6..0000000
Binary files a/InstallManager_java/lib/proxy-vole_20111102.jar and /dev/null differ
index 52e5f09..61764f2 100644 (file)
@@ -38,6 +38,7 @@ import org.tizen.installmanager.core.IMFatalException;
 import org.tizen.installmanager.lib.ErrorController.ErrorCode;
 import org.tizen.installmanager.lib.Log;
 import org.tizen.installmanager.lib.Platform;
+import org.tizen.installmanager.lib.Registry;
 import org.tizen.installmanager.pkg.model.ConfigFile;
 import org.tizen.installmanager.pkg.model.Version;
 import org.tizen.installmanager.util.PathUtil;
@@ -369,7 +370,11 @@ public class Config {
     
     private String getSaveConfigFilePath() {
        if (Options.userConfPath == null) {
-               return PathUtil.get(this.getTargetDir(), Config.INSTALL_MANAGER_DEFAULT_CONFIG_FILE_PATH);
+               if (Registry.getInstalledPath() == null || Registry.getInstalledPath().isEmpty()) {
+                       return PathUtil.getFromCurrDir(Config.INSTALL_MANAGER_DEFAULT_CONFIG_FILE_NAME);
+               } else {
+                       return PathUtil.getFromInstalledPath(Config.INSTALL_MANAGER_DEFAULT_CONFIG_FILE_PATH);
+               }
        } else {
                return Options.userConfPath;
        }
index f3c4205..5335a9c 100644 (file)
@@ -45,11 +45,14 @@ public class IMFatalException extends RuntimeException {
        public IMFatalException(String msg) {
                Log.err(msg);
                this.msg = msg;
+               ErrorController.setErrorMessage(msg);
        }
        
        public IMFatalException(ErrorCode e) {
-               ErrorController.setError(e);
                this.msg = ErrorController.getMessage(e);
+               Log.err(msg);
+               
+               ErrorController.setError(e);
        }
        
        public String getMessage() {
index 3ff8d26..5805a89 100644 (file)
@@ -104,6 +104,12 @@ public class InstallManager {
                } else {
                        mConfig = new Config();
                        
+                       if (Options.doRepository) {
+                               Log.log("Replace repository => " + Options.repo);
+                               mConfig.getConfigFile().setRepository(Options.repo);
+                               mConfig.saveConfig();
+                       }
+                       
                        if (mConfig.getConfigFile() == null) {
                                Log.log("Loading config file failed");
                                throw new IMFatalException("Loading configuration file failed");
@@ -423,7 +429,7 @@ public class InstallManager {
                if (packageToDownload == null || fileDownloadTargetPath == null
                                || fileDownloadTargetPath.isEmpty()) {
                        Log.err("InstallManager.downloadPackage(): Invalid package: " + packageToDownload + ": This might be a bug of IM");
-                       throw new IMFatalException(ErrorCode.PACKAGES_NOT_EXIST_TO_INSTALL_OR_UNINSTALL);
+                       throw new IMFatalException(ErrorCode.PACKAGE_NOT_EXIST_TO_INSTALL_OR_UNINSTALL);
                }
 
                // Check cache foler
@@ -463,14 +469,14 @@ public class InstallManager {
                        Log.log("Validate package");
                        if (!checkPackageSize(packageToDownload, size)) {
                                Log.err("Package size error. downloaded size => " + size);
-                               throw new IMFatalException(ErrorCode.WRONG_SIZE);
+                               throw new IMFatalException(ErrorCode.PACKAGE_WRONG_SIZE);
                        }
 
                        //TODO : 
                        if (!checkFileChecksum(packageToDownload,
                                        mDownloader.getFileChecksum())) {
                                Log.err("Package checksum error downloaded checksum => " + mDownloader.getFileChecksum());
-                               throw new IMFatalException(ErrorCode.WRONG_CHECKSUM);
+                               throw new IMFatalException(ErrorCode.PACKAGE_WRONG_CHECKSUM);
                        }
                }
 
index 4990936..928da2d 100644 (file)
@@ -90,7 +90,7 @@ public class Installer {
         }
         
         if (!moveToTargetDirectoryFromTempDirectory(tempDir, targetDir)) {
-            PathUtil.remove(tempDir);
+                               PathUtil.remove(tempDir);
             Log.err("Moving temp to target failed. Remove temp and cancel installing.");
             throw new IMFatalException(ErrorCode.CANNOT_MOVE_FILE_TO_TARGET_DIRECTORY);
         }
@@ -114,16 +114,14 @@ public class Installer {
                if (removeScriptTo.exists()) {
                        removeScriptTo.delete();
                 }
-               if (PathUtil.moveFile(removeScriptFrom, removeScriptTo)) {
-                       return true;
-               } else {
-                       Log.err("Cannot move remove script to local => " + pack.getPackageName());
+               if (!PathUtil.moveFile(removeScriptFrom, removeScriptTo)) {
+                       Log.err("Cannot move removeScript to targetDir => " + pack.getPackageName());
                        return false;
                }
             }
-        } else {
-               return true;
-        }
+        } 
+        PathUtil.remove(tempDir);
+        return true;
     }
 
 
@@ -215,7 +213,8 @@ public class Installer {
        Log.log("Move temp to target");
         File fromFile = new File(tempDir + File.separator + Config.DATA_DIRECTORY);
         if (!fromFile.exists()) {
-            return false;
+               Log.err("Data directory is not exist in package.");
+            return true;
         }
         File toFile = new File(targetDir);
    
@@ -238,7 +237,6 @@ public class Installer {
                        return false;
                }
         }
-        
         return true;
     }
     
@@ -252,11 +250,14 @@ public class Installer {
      */
     public boolean uninstall(Package2 pkg, IIMProgressMonitor monitor) {
        Log.log("Installer uninstall start");
+       int resultRemoveScript = executeRemoveScript(pkg, monitor);
        
-       if (executeRemoveScript(pkg, monitor)) {
+       if (resultRemoveScript == 0) {
                Log.log("Execute remove script success.");
-       } else {
+       } else if (resultRemoveScript == 1) {
                Log.err("Execute remove script fail.");
+       } else if (resultRemoveScript == 2) {
+               Log.log("This package does not need a remove script.");
        }
        
        File installedFileList = new File(getInstalledFileListPath(pkg));
@@ -370,32 +371,32 @@ public class Installer {
        }
     
        
-    private boolean executeRemoveScript(Package2 pkg, IIMProgressMonitor monitor) {            
+    private int executeRemoveScript(Package2 pkg, IIMProgressMonitor monitor) {        
        Log.log("executeRemoveScript => " + pkg.getRemoveScript());
        
        //execute remove script
-       if (!pkg.getRemoveScript().isEmpty()) {
-               String script = PathUtil.get(getRemoveScriptLocalPath(pkg));
-               File scriptFile = new File(script);
-               
-               if (scriptFile.exists()) {
-                   
-                   if (monitor != null) {
-                       monitor.setFileName(scriptFile.getName());
-                       monitor.workedFileName();
-                   }
-                   
-                   try {
-                       return executeScript(scriptFile);
-                   } catch (IMShellCommandFail e) {
-                       Log.ExceptionLog(e);
-                                       throw new IMFatalException(ErrorCode.REMOVE_SCRIPT_FATAL_ERROR);
-                   }
-               }
-       } else {
-               return true;
-       }
-       return false;
+               String script = PathUtil.get(getRemoveScriptLocalPath(pkg));
+               File scriptFile = new File(script);
+
+               if (scriptFile.exists()) {
+
+                       if (monitor != null) {
+                               monitor.setFileName(scriptFile.getName());
+                               monitor.workedFileName();
+                       }
+
+                       try {
+                               if (executeScript(scriptFile)) {
+                                       return 0; // succeed to execute remove script. 
+                               } else {
+                                       return 1; // fail to execute remove script.
+                               }
+                       } catch (IMShellCommandFail e) {
+                               Log.ExceptionLog(e);
+                               throw new IMFatalException(ErrorCode.REMOVE_SCRIPT_FATAL_ERROR);
+                       }
+               }
+       return 2; // package does not need remove script.
     }
     
     /**
index c459609..dea70c4 100644 (file)
@@ -67,6 +67,12 @@ public class Options {
        public static String userConfPath = null;
        
        /**
+        * Do replace repository. 
+        * If <code>doRepository</code> is true, change repository address to <code>repo</code> variable.  
+        */
+       public static boolean doRepository = false;
+       
+       /**
         * Do remove packages after installation
         */
        public static boolean doRemovePackages = true;
@@ -86,7 +92,7 @@ public class Options {
         */
        public static boolean useSnapShot = false;
        
-       public static String repository = null;
+       public static String repo = null;
        public static String packageList = null; 
        
        
@@ -104,67 +110,82 @@ public class Options {
        public static void loadCmdArgs(String[] args) {
                Options.args = args;
                Iterator<String> iter = Arrays.asList(args).iterator();
-               while(iter.hasNext()) {
-                       String arg = iter.next();
-                       Log.log(arg+" option is specified");
-
-                       if(arg.equals("-noPackageValidation")) {
-                               doPackageValidation = false;
-                       } else if(arg.equals("-doAutoInstall")) {
-                               doAutoInstall = true;
-                       } else if(arg.equals("-conf")) {
-                               if(iter.hasNext()) {
-                                       userConfPath = iter.next();
-                                       Log.log("User conf path: "+userConfPath);
-                                       File userConf = new File(userConfPath);
-                                       if (!userConf.exists()) {
-                                               Log.err("There is no user config file in this path : " + userConfPath);
+               try {
+                       while(iter.hasNext()) {
+                               String arg = iter.next();
+                               Log.log(arg+" option is specified");
+       
+                               if(arg.equals("-noPackageValidation")) {
+                                       doPackageValidation = false;
+                               } else if(arg.equals("-doAutoInstall")) {
+                                       doAutoInstall = true;
+                               } else if(arg.equals("-conf")) {
+                                       if(iter.hasNext()) {
+                                               userConfPath = iter.next();
+                                               Log.log("User conf path: "+userConfPath);
+                                               File userConf = new File(userConfPath);
+                                               if (!userConf.exists()) {
+                                                       Log.err("There is no user config file in this path : " + userConfPath);
+                                                       throw new IMFatalException(ErrorCode.CANNOT_FIND_USER_CONFIG_FILE);
+                                               } else {
+                                                       Log.log("Found user config file in this path : " + userConfPath);
+                                               }
+                                       } else {
+                                               Log.err("-conf requires absolute path to the user conf file");
                                                throw new IMFatalException(ErrorCode.CANNOT_FIND_USER_CONFIG_FILE);
+                                       }
+                               } else if(arg.equals("-noRemovePackages")) {
+                                       doRemovePackages = false;
+                               } else if(arg.equals("-updated")) {
+                                       // -updated means this execution is run again after self-updating
+                               } else if(arg.equals("-checkPackageUpdate")) {
+                                       checkPackageUpdate = true;
+                               } else if(arg.equals("-printDepGraph")) {
+                                       printDepGraph = true;
+                               } else if(arg.equals("-proxy")) {
+                                       if(iter.hasNext()) {
+                                               proxy = iter.next();
+                                               Log.log("User-provided proxy: "+proxy);
                                        } else {
-                                               Log.log("Found user config file in this path : " + userConfPath);
+                                               Log.err("-proxy requires proxy description");
+                                               throw new IMFatalException(ErrorCode.PROXY_NOT_PROVIDED);
+                                       }
+                               } else if (arg.equals("-useSnapShot")) {
+                                       if(iter.hasNext()) {
+                                               useSnapShot = true;
+                                               repo = iter.next();
+                                               Log.log("User-provided repository: "+repo);
+                                       } else {
+                                               Log.err("-useSnapShot requires repository description");
+                                               throw new IMFatalException(ErrorCode.USESNAPSHOT_REPOSITORY_NOT_PROVIDED);
+                                       }
+                               } else if (arg.equals("-onlyDownload")) {
+                                       if(iter.hasNext()) {
+                                               onlyDownload = true;
+                                               packageList = iter.next();
+                                               Log.log("User-provided package list: "+packageList);
+                                       } else {
+                                               Log.err("-onlyDownload requires packageList description");
+                                               throw new IMFatalException(ErrorCode.REPOSITORY_NOT_PROVIDED);
                                        }
-                               } else {
-                                       Log.err("-conf requires absolute path to the user conf file");
-                                       throw new IMFatalException(ErrorCode.CANNOT_FIND_USER_CONFIG_FILE);
-                               }
-                       } else if(arg.equals("-noRemovePackages")) {
-                               doRemovePackages = false;
-                       } else if(arg.equals("-updated")) {
-                               // -updated means this execution is run again after self-updating
-                       } else if(arg.equals("-checkPackageUpdate")) {
-                               checkPackageUpdate = true;
-                       } else if(arg.equals("-printDepGraph")) {
-                               printDepGraph = true;
-                       } else if(arg.equals("-proxy")) {
-                               if(iter.hasNext()) {
-                                       proxy = iter.next();
-                                       Log.log("User-provided proxy: "+proxy);
-                               } else {
-                                       Log.err("-proxy requires proxy description");
-                                       throw new IMFatalException(ErrorCode.PROXY_NOT_PROVIDED);
-                               }
-                       } else if (arg.equals("-useSnapShot")) {
-                               if(iter.hasNext()) {
-                                       useSnapShot = true;
-                                       repository = iter.next();
-                                       Log.log("User-provided repository: "+repository);
-                               } else {
-                                       Log.err("-useSnapShot requires repository description");
-                                       throw new IMFatalException(ErrorCode.REPOSITORY_NOT_PROVIDED);
-                               }
-                       } else if (arg.equals("-onlyDownload")) {
-                               if(iter.hasNext()) {
                                        onlyDownload = true;
-                                       packageList = iter.next();
-                                       Log.log("User-provided package list: "+packageList);
-                               } else {
-                                       Log.err("-onlyDownload requires repository description");
-                                       throw new IMFatalException(ErrorCode.REPOSITORY_NOT_PROVIDED);
+                               } else if (arg.equals("-noRemoveTempTizenSDK")) {
+                                       doRemoveTempTizenSDK = false;
+                               } else if (arg.equals("-repository")) {
+                                       if(iter.hasNext()) {
+                                               doRepository = true;
+                                               repo = iter.next();
+                                               Log.log("replace repository : "+repo);
+                                       } else {
+                                               Log.err("-replaceRepository requires repository description");
+                                               throw new IMFatalException(ErrorCode.REPOSITORY_NOT_PROVIDED);
+                                       }
                                }
-                               onlyDownload = true;
-                       } else if (arg.equals("-noRemoveTempTizenSDK")) {
-                               doRemoveTempTizenSDK = false;
                        }
+               } catch(Throwable e) {
+                       Log.err("Check your options. => " + Arrays.toString(args));
+                       System.err.println("Check your options. => " + Arrays.toString(args));
+                       System.exit(1);
                }
        }
 
index 38ba6d3..6631d75 100644 (file)
@@ -1,30 +1,30 @@
 /*
-*  InstallManager
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Wooyoung Cho <wooyoung1.cho@samsung.com>
-* Shihyun Kim <shihyun.kim@samsung.com>
-* Taeyoung Son <taeyoung2.son@samsung.com>
-* Yongsung kim <yongsung1.kim@samsung.com>
-*
+ *  InstallManager
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Shihyun Kim <shihyun.kim@samsung.com>
+ * Taeyoung Son <taeyoung2.son@samsung.com>
+ * Yongsung kim <yongsung1.kim@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
-*
-*/
+ * 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.installmanager.lib;
 
@@ -33,6 +33,8 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.ConnectException;
+import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.MalformedURLException;
 import java.net.NoRouteToHostException;
@@ -42,8 +44,10 @@ import java.net.SocketException;
 import java.net.SocketTimeoutException;
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.UnknownHostException;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import java.util.List;
 
 import org.tizen.installmanager.core.Config;
 import org.tizen.installmanager.core.IMFatalException;
@@ -51,12 +55,11 @@ import org.tizen.installmanager.core.InstallManager;
 import org.tizen.installmanager.core.Options;
 import org.tizen.installmanager.lib.ErrorController.ErrorCode;
 
-
 /**
  * Manages downloading from url.
- *
+ * 
  * @author Shihyun Kim <shihyun.kim@samsung.com>
- *
+ * 
  */
 public class Downloader {
        private static final String PROTOCOL_SEPARATOR = "://";
@@ -69,7 +72,7 @@ public class Downloader {
 
        private MessageDigest mDigest;
        private URLConnection mConnection = null;
-       private int mConnectTimeout = 1000; // connection timeout: 1 sec
+       private int connectTimeout = 1000; // connection timeout: 1 sec
 
        private String mUser = "";
        private String mPassword = "";
@@ -85,13 +88,16 @@ public class Downloader {
 
        /**
         * Downloads the url to the local path
-        * @param sUrl url to download
-        * @param localPath local path to save the file from the url
+        * 
+        * @param sUrl
+        *            url to download
+        * @param localPath
+        *            local path to save the file from the url
         * @param monitor
         * @return download size in bytes if success. -1 if fail.
         */
        public long download(URL sUrl, String localPath, IIMProgressMonitor monitor) {
-               Log.log("Downloading: "+sUrl+" -> "+localPath);
+               Log.log("Downloading: " + sUrl + " -> " + localPath);
 
                if (localPath == null || localPath.equals("")) {
                        return ERROR;
@@ -108,11 +114,11 @@ public class Downloader {
                InputStream input = null;
                try {
                        input = mConnection.getInputStream();
-               } catch(FileNotFoundException e) {
+               } catch (FileNotFoundException e) {
                        ErrorController.setError(ErrorCode.CANNOT_FIND_FILE_IN_REPOSITROY);
                        Log.err("Cannot find file => " + sUrl.toExternalForm());
                        return ERROR;
-               } catch(SocketTimeoutException timeoutException) {
+               } catch (SocketTimeoutException timeoutException) {
                        ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
                        Log.err(ErrorController.getErrorMessage());
                        return ERROR;
@@ -120,12 +126,12 @@ public class Downloader {
                        ErrorController.setError(ErrorCode.NO_ROUTE_TO_HOST);
                        Log.err(ErrorController.getErrorMessage());
                        return ERROR;
-        } catch (SocketException e) {
-               ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
-               Log.err(ErrorController.getErrorMessage());
-               return ERROR;
+               } catch (SocketException e) {
+                       ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
+                       Log.err(ErrorController.getErrorMessage());
+                       return ERROR;
                } catch (IOException e) {
-                       if (e.getClass().toString().indexOf("FtpLoginException")>=0) {
+                       if (e.getClass().toString().indexOf("FtpLoginException") >= 0) {
                                ErrorController.setError(ErrorCode.NOT_LOGGED_IN);
                                Log.err(ErrorController.getErrorMessage());
                                return ERROR;
@@ -176,7 +182,7 @@ public class Downloader {
                long beginMS = System.currentTimeMillis();
                try {
                        mDigest.reset();
-                       while(totalWriteSize < totalFileSize) {
+                       while (totalWriteSize < totalFileSize) {
                                if (input.available() > 0) {
                                        int inputReadSize = input.read(buf);
 
@@ -185,14 +191,14 @@ public class Downloader {
                                        totalWriteSize += inputReadSize;
                                        writeSizePerSecond += inputReadSize;
 
-                                       if(mDigest != null) {
+                                       if (mDigest != null) {
                                                mDigest.update(buf, 0, inputReadSize);
                                        }
 
                                        long endMS = System.currentTimeMillis();
                                        if (endMS > (beginMS + 100)) {
                                                if (monitor != null) {
-                                                       if(monitor.isCanceled()) {
+                                                       if (monitor.isCanceled()) {
                                                                ErrorController.setError(ErrorCode.CANCEL);
                                                                return ERROR;
                                                        }
@@ -206,11 +212,12 @@ public class Downloader {
 
                                long endMS = System.currentTimeMillis();
                                if (endMS > (beginMS + 5000)) {
-                                       ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
+                                       ErrorController
+                                                       .setError(ErrorCode.INTERNET_CONNECTION_ERROR);
                                        return ERROR;
                                }
                        }
-               } catch(SocketTimeoutException timeoutException) {
+               } catch (SocketTimeoutException timeoutException) {
                        ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
                        return ERROR;
                } catch (IOException e) {
@@ -229,12 +236,13 @@ public class Downloader {
                                // ignore
                        }
                }
-               Log.log("Downloaded size: "+totalWriteSize);
+               Log.log("Downloaded size: " + totalWriteSize);
                return totalWriteSize;
        }
 
        /**
         * Set user name.
+        * 
         * @param user
         */
        public void setUser(String user) {
@@ -243,6 +251,7 @@ public class Downloader {
 
        /**
         * Set password
+        * 
         * @param password
         */
        public void setPassword(String password) {
@@ -251,6 +260,7 @@ public class Downloader {
 
        /**
         * Get MessageDigest instance from downloading file.
+        * 
         * @return
         */
        public MessageDigest getFileChecksum() {
@@ -259,16 +269,22 @@ public class Downloader {
 
        /**
         * Connect to aUrl and ready to download.
+        * 
         * @param aUrl
         * @return <code>true</code> if connect success.
         */
        public boolean connect(URL aUrl) {
+               if (!isAvailableURL(aUrl)) {
+                       return false;
+               }
+
                boolean bRet = false;
                URL url = null;
                try {
                        if (!mUser.equals("") || !mPassword.equals("")) {
-                               String fullUrl = aUrl.getProtocol() + PROTOCOL_SEPARATOR + mUser + USER_PASSWORD_SEPARATOR +
-                                                               mPassword + ID_SEPARATOR + aUrl.getHost() + aUrl.getPath();
+                               String fullUrl = aUrl.getProtocol() + PROTOCOL_SEPARATOR
+                                               + mUser + USER_PASSWORD_SEPARATOR + mPassword
+                                               + ID_SEPARATOR + aUrl.getHost() + aUrl.getPath();
 
                                url = new URL(fullUrl);
                        } else {
@@ -277,69 +293,257 @@ public class Downloader {
 
                        bRet = connection(url);
 
-                       //set connetion timeout
-                       if (mConnection != null) {
-                               mConnection.setConnectTimeout(mConnectTimeout);
-                       }
-
                } catch (MalformedURLException e) {
-                       Log.err("malformed url: "+url);
-                       return bRet;
+                       Log.ExceptionLog(e);
+                       return false;
+               } catch (Exception e) {
+                       Log.ExceptionLog(e);
+                       return false;
                }
 
                return bRet;
        }
 
+       private boolean isAvailableURL(URL url) {
+               if (url.getProtocol().equalsIgnoreCase("file")) {
+                       return true;
+               }
+               SocketAddress socketAddress = null;
+               try {
+                       int port = url.getPort();
+                       if (port < 0) {
+                               port = url.getDefaultPort();
+                       }
+                       socketAddress = getSocketAddress(url.getHost(), port);
+
+               } catch (IMFatalException e) {
+                       throw new IMFatalException(e.getMessage() + "\n(Repository: " + url
+                                       + ").");
+               }
+
+               if (socketAddress == null) {
+                       return false;
+               } else {
+                       return true;
+               }
+       }
+
        private boolean connection(final URL url) {
+               Log.log("Connect to " + url);
+
+               String protocol = url.getProtocol();
+               Config conf = InstallManager.getInstance().getConfig();
+
+               boolean bRet = false;
+
+               // connect with proxy.
+               if (protocol.startsWith("file")) { // local url
+                       Log.log("Connect to local path.");
+                       return connectToURL(url, Proxy.NO_PROXY);
+
+               } else if (Options.proxy != null) {
+                       Log.log("Connect to repository with '-proxy' option.");
+                       bRet = connectToURL(url, getOptionalProxy());
+
+               } else if (conf.hasProxy()) {
+                       Log.log("Connect to repository with config proxy.");
+                       bRet = connectToURL(url, getConfigProxy());
+
+               } else { // system proxy
+                       Log.log("Connect to repository with system proxy.");
+                       List<Proxy> proxyList = getSystemProxyList(url);
+
+                       for (Proxy proxy : proxyList) {
+                               if (bRet = connectToURL(url, proxy)) {
+                                       break;
+                               }
+                       }
+
+                       // no proxy.
+                       if (!bRet) {
+                               Log.log("Connect to repository with http direct.");
+                               Proxy directProxy = NetworkProxy.getInstance()
+                                               .getHttpDirectProxy(url);
+
+                               bRet = connectToURL(url, directProxy);
+                       }
+               }
+
+               return bRet;
+       }
+
+       private boolean connectToURL(URL url, Proxy proxy) {
                try {
-                       Proxy proxy = getProxy(url);
                        mConnection = url.openConnection(proxy);
+
+                       // set connetion timeout
+                       if (mConnection != null) {
+                               mConnection.setConnectTimeout(connectTimeout);
+                       }
+
+                       mConnection.connect();
+
+               } catch (ConnectException e) {
+                       Log.ExceptionLog(e);
+                       if (proxy.toString().equalsIgnoreCase("DIRECT")) {
+                               ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
+                       } else {
+                               ErrorController.setError(ErrorCode.PROXY_CONNECT_ERROR);
+                       }
+
+               } catch (NoRouteToHostException e) {
+                       Log.ExceptionLog(e);
+                       if (proxy.toString().equalsIgnoreCase("DIRECT")) {
+                               ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
+                       } else {
+                               ErrorController.setError(ErrorCode.PROXY_CONNECT_ERROR);
+                       }
+
+                       return false;
+
+               } catch (SocketTimeoutException e) {
+                       Log.ExceptionLog(e);
+                       if (proxy.toString().equalsIgnoreCase("DIRECT")) {
+                               ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
+                       } else {
+                               ErrorController.setError(ErrorCode.PROXY_CONNECT_ERROR);
+                       }
+
+                       return false;
+
+               } catch (SocketException e) {
+                       Log.ExceptionLog(e);
+                       if (proxy.toString().equalsIgnoreCase("DIRECT")) {
+                               ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
+                       } else {
+                               ErrorController.setError(ErrorCode.PROXY_CONNECT_ERROR);
+                       }
+
+                       return false;
+
+               } catch (FileNotFoundException e) {
+                       Log.ExceptionLog(e);
+                       ErrorController.setError(ErrorCode.CANNOT_FIND_PACKAGE_LIST_FILE_IN_REPOSITORY);
+                       return false;
                } catch (IOException e) {
                        Log.ExceptionLog(e);
+                       return false;
+               }
 
+               if (mConnection.getContentLength() < 0) {
+                       Log.err("Cannot connect to repository(url=>" + url + ", proxy=>" + proxy);
+                       ErrorController.setError(ErrorCode.INTERNET_CONNECTION_ERROR);
                        return false;
+               } else {
+                       return true;
                }
-               return true;
        }
 
        /**
-        * Get the proxy to be used for download files. Proxy is searched in the following order.
-        * - User-provided proxy using -proxy option.
-        * - Proxy specified in installmanager.conf file.
-        * - If both of above are not provided, return direct connection proxy.
+        * Get the proxy to be used for download files. Proxy is searched in the
+        * following order. - User-provided proxy using -proxy option. - Proxy
+        * specified in installmanager.conf file. - If both of above are not
+        * provided, return direct connection proxy.
+        * 
         * @return proxy to be used. never <code>null</code>.
         */
-       private Proxy getProxy(URL url) {
-               String protocol = url.getProtocol();
-               if(protocol.startsWith("file")) {
-                       return Proxy.NO_PROXY;
+       private List<Proxy> getSystemProxyList(final URL url) {
+
+               NetworkProxy netProxy = NetworkProxy.getInstance();
+
+               // get system proxy from NetworkProxy class
+               List<Proxy> proxyList = netProxy.select(url);
+               if (proxyList == null) {
+                       throw new IMFatalException(ErrorCode.INTERNET_CONNECTION_ERROR);
+               } else {
+                       Log.log("Proxy list => " + proxyList);
+                       return proxyList;
                }
+       }
+
+       private Proxy getOptionalProxy() {
                Config conf = InstallManager.getInstance().getConfig();
-               if(Options.proxy != null) {
-                       String[] arr = Options.proxy.split(":");
-                       try {
-                               Log.log("Use user-provided proxy: "+Options.proxy);
-                               SocketAddress addr = new InetSocketAddress(arr[0], Integer.parseInt(arr[1]));
-                               
-                               //set proxy server and port 
-                               conf.getConfigFile().setProxyServer(arr[0]);
-                               conf.getConfigFile().setProxyPort(arr[1]);
-                               
-                               return new Proxy(Proxy.Type.HTTP, addr);
-                       } catch(IllegalArgumentException e) {
-                               throw new IMFatalException(ErrorCode.PROXY_INVALID);
-                       }
-               } else if(conf.hasProxy()) {
-                       Log.log("Use proxy specified in .conf file: "+conf.getConfigFile().getProxyServer() +":"+ conf.getConfigFile().getProxyPort());
-                       SocketAddress addr = new InetSocketAddress(conf.getConfigFile().getProxyServer(), conf.getConfigFile().getProxyPort());
+
+               String[] arr = Options.proxy.split(":");
+               try {
+                       Log.log("Use user-provided proxy: " + Options.proxy);
+
+                       SocketAddress addr = getSocketAddress(arr[0], arr[1]);
+
+                       // save proxy server and port
+                       conf.getConfigFile().setProxyServer(arr[0]);
+                       conf.getConfigFile().setProxyPort(arr[1]);
+
                        return new Proxy(Proxy.Type.HTTP, addr);
-               } else {
-                       return Proxy.NO_PROXY;
+               } catch (IllegalArgumentException e) {
+                       Log.ExceptionLog(e);
+                       throw new IMFatalException(ErrorCode.PROXY_SERVER_IS_WRONG);
+               } catch (ArrayIndexOutOfBoundsException e) {
+                       Log.ExceptionLog(e);
+                       throw new IMFatalException(ErrorCode.PROXY_SERVER_IS_WRONG);
+               } catch (IMFatalException e) {
+                       Log.ExceptionLog(e);
+                       throw new IMFatalException(e.getMessage() + "\n(proxy: " + arr[0]
+                                       + ":" + arr[1] + ").");
                }
        }
 
+       private Proxy getConfigProxy() {
+               Config conf = InstallManager.getInstance().getConfig();
+
+               Log.log("Use proxy specified in .conf file: "
+                               + conf.getConfigFile().getProxyServer() + ":"
+                               + conf.getConfigFile().getProxyPort());
+
+               SocketAddress addr = null;
+               try {
+                       addr = getSocketAddress(conf.getConfigFile().getProxyServer(), conf
+                                       .getConfigFile().getProxyPort());
+               } catch (IMFatalException e) {
+                       throw new IMFatalException(e.getMessage() + "\n(proxy:"
+                                       + conf.getConfigFile().getProxyServer() + ":"
+                                       + conf.getConfigFile().getProxyPort() + ").");
+               }
+
+               return new Proxy(Proxy.Type.HTTP, addr);
+       }
+
+       private SocketAddress getSocketAddress(String address, String port)
+                       throws IMFatalException {
+               try {
+                       return getSocketAddress(address, Integer.parseInt(port));
+               } catch (NumberFormatException e) {
+                       Log.ExceptionLog(e);
+                       throw new IMFatalException(ErrorCode.URL_PORT_IS_WRONG);
+               }
+       }
+
+       private SocketAddress getSocketAddress(String address, int port)
+                       throws IMFatalException {
+               SocketAddress addr = null;
+               try {
+                       addr = new InetSocketAddress(InetAddress.getByName(address), port);
+               } catch (UnknownHostException e) {
+                       Log.ExceptionLog(e);
+                       throw new IMFatalException(ErrorCode.URL_ADDRESS_IS_WRONG);
+
+               } catch (IllegalArgumentException e) {
+                       Log.ExceptionLog(e);
+                       throw new IMFatalException(ErrorCode.URL_PORT_IS_WRONG);
+
+               } catch (SecurityException e) {
+                       Log.ExceptionLog(e);
+
+                       ErrorController.setErrorMessage(e.getMessage());
+                       throw new IMFatalException(ErrorCode.URL_SECURITY_EXCEPTION);
+               }
+
+               return addr;
+       }
+
        /**
         * Get file size to download.
+        * 
         * @return
         */
        public int getDownloadFileSize() {
index 9c04478..9a10891 100644 (file)
@@ -43,9 +43,6 @@ public class ErrorController {
         *
         */
        public enum ErrorCode {
-               NOT_LOGGED_IN("Cannot login."),
-               INTERNET_CONNECTION_ERROR("Cannot connect to server. Please check your network status or use command line option '-proxy <address>:<port>' for using proxy."),
-               NO_ROUTE_TO_HOST("Cannot find server. Please check url."),
                CANNOT_FIND_PACKAGE_LIST_FILE_IN_REPOSITORY("Cannot find Package.list file in repository."),
                CANNOT_FIND_CONFIG_FILE("Cannot find installmanager.conf file."),
                CANNOT_FIND_FILE_IN_REPOSITROY("Cannot find file in repository. The package server could be being updated."),
@@ -54,9 +51,6 @@ public class ErrorController {
                CANNOT_MOVE_FILE_TO_TARGET_DIRECTORY("Cannot move file to target directory."),
                CANNOT_CONNECT_TO_PROXY_SERVER("Cannot connect to proxy server."),
                WRONG_PACKAGE_URL("URLs of packages are invalid."),
-               WRONG_SIZE("Downloaded file's size is wrong."),
-               WRONG_CHECKSUM("Downloaded file's checksum is wrong."),
-               PACKAGES_NOT_EXIST_TO_INSTALL_OR_UNINSTALL("Packages do not exist to install or uninstall."),
                CANCEL("Download is canceled."),
                ERROR("Error occurred from unknown cause."),
                UNKNOWN_PACKAGE_EXTENSION("not supported pakckage extension"),
@@ -82,8 +76,6 @@ public class ErrorController {
                COPY_FILE_IS_FAIL("Copy file to target directory is failed."),
                OLD_TIZEN_SDK_EXISTS("Old version(Tizen SDK) is installed. Remove it first and run Tizen SDK Install Manager again."),
                UNSUPPORTED_PLATFORM("Platform is not supported"),
-               INSTALL_SCRIPT_NOT_EXISTS("Install script not exists."),
-               INSTALL_SCRIPT_FATAL_ERROR("Fatal error occurred while installing Tizen SDK."),
                REMOVE_SCRIPT_NOT_EXISTS("Remove script not exists."),
                REMOVE_SCRIPT_FATAL_ERROR("Fatal error occurred while uninstalling Tizen SDK."),
                INSTALLATION_FAIL("Installation is Failed."),
@@ -92,8 +84,26 @@ public class ErrorController {
                CANNOT_CREATE_FILE("Cannot create file"),
                THREAD_INTERRUPTED("Execution is interrupted"),
                CIRCULAR_PACKAGE_DEPENDENCY("Circular package dependency is detected"),
-               PROXY_SERVER_IS_WRONG("Cannot connect to proxy server. Please, check your proxy server."),
 
+               //Package error
+               PACKAGE_WRONG_SIZE("Size of package is wrong."),
+               PACKAGE_WRONG_CHECKSUM("Package file checksum error."),
+               PACKAGE_NOT_EXIST_TO_INSTALL_OR_UNINSTALL("Installable or removable packages do not exist."),
+               INSTALL_SCRIPT_NOT_EXISTS("There are no install script files."),
+               INSTALL_SCRIPT_FATAL_ERROR("Fatal error occurred while installing Tizen SDK."),
+               
+               // Network error
+               INTERNET_CONNECTION_ERROR("Fail to connect to server. Please check your network status or try again with '-proxy <address>:<port>'."),
+               PROXY_NOT_PROVIDED("Proxy setting is not provided. Use option '-proxy <proxy-address>:<port>'."),
+               PROXY_SERVER_IS_WRONG("Cannot connect to proxy server. Please check your proxy server."),
+               PROXY_CONNECT_ERROR("Fail to connect to your proxy server. Please check it."),
+               URL_SECURITY_EXCEPTION("There are some security problem with proxy."),
+               URL_ADDRESS_IS_WRONG("Wrong address."),
+               URL_PORT_IS_WRONG("Wrong port number."),
+               NO_ROUTE_TO_HOST("Cannot find server. Please check url."),
+               NOT_LOGGED_IN("Cannot login."),
+               
+               //etc
                CANNOT_FIND_INSTALLED_FILE_LIST("Cannot find installed file list."),
                CANNOT_REMOVE_TARGET_DIR("Cannot remove target directory."),
                INSTALLATION_STOP("All packages are not installed for META package."),
@@ -101,10 +111,9 @@ public class ErrorController {
                FILE_NOT_FOUND("File not found"),
                REMOVE_OLD_SDK_OK("Old SDK is removed OK. Please restart InstallManager."),
                INVALID_INSTALL_PATH("Install path is invalid"),
-               PROXY_NOT_PROVIDED("Proxy setting is not provided. Use command line option '-proxy <proxy-address>:<port>'"),
-               REPOSITORY_NOT_PROVIDED("Repository setting is not provided. Use command line option '-useSnapShot <repository>'"),
+               USESNAPSHOT_REPOSITORY_NOT_PROVIDED("Repository setting is not provided. Use command line option '-useSnapShot <repository>'"),
+               REPOSITORY_NOT_PROVIDED("Repository setting is not provided. Use command line option '-repository <repository>'"),
                PACKAGES_NOT_PROVIDED("Repository setting is not provided. Use command line option '-proxy <repository>'"),
-               PROXY_INVALID("Package list are not provided. Use command line '-onlyDownload <package list seperated by \",\">'"),
                DOWNLOAD_AND_EXIT("Download packages are success and exit installmanager."),
                CANNOT_DOWNLOAD_FILE("Cannot download file."),
                CANNOT_FIND_JAVA("Cannot find \'JAVA\'. Please check your java installation.");
@@ -118,6 +127,10 @@ public class ErrorController {
                private String getErrorMessage() {
                        return errorMessage;
                }
+               
+               public void setErrorMessage(String msg) {
+                       errorMessage = msg;
+               }
        }
 
 
@@ -145,7 +158,9 @@ public class ErrorController {
         */
        static public String getErrorMessage() {
                if (mErrorCode != null) {
-                       return mErrorCode.getErrorMessage();
+                       String errorMsg = mErrorCode.getErrorMessage();
+                       
+                       return errorMsg;
                } else {
                        if (checkInstallationSuccess()) {
                                return "No Error";
@@ -154,6 +169,10 @@ public class ErrorController {
                        }
                }
        }
+       
+       static public void setErrorMessage(String msg) {
+               mErrorCode.setErrorMessage(msg);
+       }
 
        /** 
         * @return Latest error code.
diff --git a/InstallManager_java/src/org/tizen/installmanager/lib/NetworkProxy.java b/InstallManager_java/src/org/tizen/installmanager/lib/NetworkProxy.java
new file mode 100644 (file)
index 0000000..869ec1e
--- /dev/null
@@ -0,0 +1,124 @@
+package org.tizen.installmanager.lib;
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+
+/**
+ * 
+ * Get network proxy address from ProxySelector class.
+ * If you create NetworkProxy instance without ProxySelector instance, 
+ * you can get system proxy from select function.
+ * @author Shihyun Kim<shihyun.kim@samsung.com>
+ *
+ */
+public class NetworkProxy {
+       private static NetworkProxy netProxy = null;
+       
+       private static final String PROXY_PROPERTY = "java.net.useSystemProxies";
+       
+       //member variable
+       private ProxySelector proxySelector = null;
+       
+       private NetworkProxy(ProxySelector selector) {
+               proxySelector = selector;
+       }
+       
+       private NetworkProxy() {
+               String proxyPropertyBefore = System.getProperty(PROXY_PROPERTY);
+               /*
+                * "useSystemProxies" property set true.
+                * because get the system proxy in ProxySelector class.
+                */
+               System.setProperty(PROXY_PROPERTY, "true"); 
+               
+               proxySelector = ProxySelector.getDefault();
+               
+               if (proxyPropertyBefore != null) {
+                       System.setProperty(PROXY_PROPERTY, proxyPropertyBefore);
+               } else {
+                       System.setProperty(PROXY_PROPERTY, "null");
+               }
+       }
+       
+       /**
+        * Get proxy list from <code>url</code> parameter.
+        * @param url
+        * @return list of proxy from ProxySelector.
+        */
+       public List<Proxy> select(URL url) {
+               
+               try {
+                       return select(url.toURI());
+               } catch (URISyntaxException e) {
+                       Log.err("Cannot get proxy => " + url);
+                       return null;
+               }
+       }
+       
+       /**
+        * Get proxy list from <code>uri</code> parameter.
+        * @param uri
+        * @return list of proxy from ProxySelector.
+        */
+       public List<Proxy> select(URI uri) {            
+               if (uri == null) {
+                       Log.err("uri is null");
+                       return null;
+               }
+               
+               Log.log("proxy select uri => " + uri.toString());
+               
+               try {
+                       return proxySelector.select(uri);
+                       
+               } catch (IllegalArgumentException e) {
+                       Log.ExceptionLog(e);
+                       return null;
+               } catch (Exception e) {
+                       Log.ExceptionLog(e);
+                       return null;
+               } 
+       }
+       
+       /**
+        * Get direct Proxy instance.
+        * @param url is connected by proxy.
+        * @return Direct proxy instance.
+        */
+       public Proxy getHttpDirectProxy(URL url) {
+               String host = url.getHost();
+               int port = url.getPort();
+               if (port < 0) {
+                       port = url.getDefaultPort();
+               }
+               
+               Proxy directProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
+               return directProxy;
+       }
+       
+       public static NetworkProxy getInstance() {
+               if (netProxy == null) {
+                       netProxy = new NetworkProxy();
+               }
+               
+               return netProxy;
+       }
+       
+       public static NetworkProxy getInstance(ProxySelector selector) {
+               if (netProxy == null) {
+                       netProxy = new NetworkProxy(selector);
+               }
+               
+               return netProxy;
+       }
+}
+
+
+
+
index 0204f0b..7f0755a 100644 (file)
@@ -176,7 +176,7 @@ public class PackageManager2 {
                                String repoBaseDirUrl = PathUtil.getParentDirectory(repoBaseUrl);
                                
                                if (Options.useSnapShot) {
-                                       repoBaseDirUrl = PathUtil.getParentDirectory(Options.repository, 3);
+                                       repoBaseDirUrl = PathUtil.getParentDirectory(Options.repo, 3);
                                }
                                
                                repoPackages.add(new Package2(sect.getProperties(), repoBaseDirUrl));
index 77a31be..9b5cc53 100644 (file)
@@ -532,11 +532,12 @@ public class InstallManagerWindow extends ApplicationWindow {
                        
                        compositeWelcomePage.setButtonStatus();
                } else {
+                       compositeWelcomePage.setVisibleRadioButton(false);
+                       btnNext.setVisible(false);
+                       
                        compositeWelcomePage.setTitle("Cannot start Tizen SDK Install Manager.");
                        compositeWelcomePage.setErrorSubTitle(ErrorController.getErrorMessage());
 
-                       compositeWelcomePage.setVisibleRadioButton(false);
-                       btnNext.setVisible(false);
                        btnClose.setText("Close");
                        
                        btnClose.removeSelectionListener(closeBtnSelectionAdapter);
@@ -644,12 +645,17 @@ public class InstallManagerWindow extends ApplicationWindow {
                } catch (Throwable e) {
                        Log.err("Unexpected error occurred");
                        Log.ExceptionLog(e);
+                       
                        // show error message
-                       window.open();
-                       if (Display.getCurrent() != null
-                                       && !Display.getCurrent().isDisposed()) {
-                               Display.getCurrent().dispose();
+                       if (window != null) {
+                               window.open();
+                               
+                               if (Display.getCurrent() != null
+                                               && !Display.getCurrent().isDisposed()) {
+                                       Display.getCurrent().dispose();
+                               }
                        }
+                       
                        ErrorController.setExitCode(Config.EXITCODE_UNKNOWN_ERROR);
                } finally {
                        if (Options.doRemoveTempTizenSDK) {
diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/page/PageTemplate.java b/InstallManager_java/src/org/tizen/installmanager/ui/page/PageTemplate.java
new file mode 100644 (file)
index 0000000..b88bc07
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+*  InstallManager
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact: 
+* Wooyoung Cho <wooyoung1.cho@samsung.com>
+* Shihyun Kim <shihyun.kim@samsung.com>
+* Taeyoung Son <taeyoung2.son@samsung.com>
+* Yongsung kim <yongsung1.kim@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.installmanager.ui.page;
+
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.tizen.installmanager.ui.InstallManagerWindow;
+import org.tizen.installmanager.util.PathUtil;
+
+
+/**
+ * This class is a parent class of all composite classes.
+ */
+public class PageTemplate extends Composite {
+
+       public static final String RESOURCE_PATH = "/res/images";
+
+       private Label imgLabel;
+       private Label titleLabel;
+       private Label subtitleLabel;
+       public Composite customComposite;
+
+       /**
+        * Set basic environment of child pages.
+        * @param parent
+        * @param style
+        */
+       public PageTemplate(Composite parent, int style) {
+               super(parent, style);
+               setLayout(null);
+               setBackground(InstallManagerWindow.getBackgroundColor());
+
+               imgLabel = new Label(this, SWT.NONE);
+               imgLabel.setBounds(0, 0, 160, 398);
+               imgLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+
+               titleLabel = new Label(this, SWT.NONE);
+               titleLabel.setFont((new Font(Display.getCurrent(), new FontData("Sans", 11, SWT.BOLD))));
+               titleLabel.setBounds(160, 17, 468, 20);
+               titleLabel.setText("New Label");
+               titleLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+
+               subtitleLabel = new Label(this, SWT.WRAP);
+               subtitleLabel.setBounds(160, 43, 451, 40);
+               subtitleLabel.setText("");
+               subtitleLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+
+               customComposite = new Composite(this, SWT.NONE);
+
+               customComposite.setSize(468, 304);
+               customComposite.setLocation(160, 90);
+               customComposite.setBackground(InstallManagerWindow.getBackgroundColor());
+       }
+
+       /**
+        * Set the left image in resource.
+        * @param Image path
+        */
+       public void setLeftImageFromResource(String imgRscPath) {
+               imgLabel.setImage(PathUtil.getImageFromResource(imgRscPath));
+       }
+
+       /**
+        * Set page's title.
+        * @param Title string
+        */
+       public void setTitle(String strTitle) {
+               titleLabel.setText(strTitle);
+       }
+
+       /**
+        * Set page's sub title
+        * @param Sub title string
+        */
+       public void setSubTitle(String strSubTitle) {
+               subtitleLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+               subtitleLabel.setText(strSubTitle);
+       }
+
+       public void setErrorSubTitle(String strSubTitle) {
+               subtitleLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED));
+               subtitleLabel.setText(strSubTitle);
+       }
+
+       /**
+        * Return custom composite
+        * @return custom composite object
+        */
+       public Composite getCustomComposite() {
+               return customComposite;
+       }
+
+       public void setImageBounds(int nX, int nY, int nWidth, int nHeight) {
+               imgLabel.setBounds(nX, nY, nWidth, nHeight);
+       }
+
+       public void setTitleBounds(int nX, int nY, int nWidth, int nHeight) {
+               titleLabel.setBounds(nX, nY, nWidth, nHeight);
+       }
+
+       public void setSubTitleBounds(int nX, int nY, int nWidth, int nHeight) {
+               subtitleLabel.setBounds(nX, nY, nWidth, nHeight);
+       }
+
+       public void setCustomCompositeBounds(int nX, int nY, int nWidth, int nHeight) {
+               customComposite.setSize(nWidth, nHeight);
+               customComposite.setLocation(nX, nY);
+       }
+}
index 7004594..43bef1b 100644 (file)
@@ -34,7 +34,6 @@ import java.util.List;
 
 import org.tizen.installmanager.core.Config;
 import org.tizen.installmanager.core.IMExitException;
-import org.tizen.installmanager.core.IMFatalException;
 import org.tizen.installmanager.core.InstallManager;
 import org.tizen.installmanager.lib.ErrorController;
 import org.tizen.installmanager.lib.IIMProgressMonitor;
@@ -70,10 +69,6 @@ public class ViewController {
                mPackageManager2 = mInstallManager.getPackageManager2();
 
                bResult = bResult && existInstallableOrRemovablePackages();
-               
-               if (bResult == false) {
-                       throw new IMFatalException(ErrorCode.CANNOT_FIND_FILE_IN_REPOSITROY);
-               }
 
                return bResult;
        }
index 5263ec7..510dd3a 100644 (file)
@@ -175,7 +175,7 @@ public class WelcomePage extends PageTemplate {
         * @see InstalledStatus
         */
        public void setButtonStatus() {
-
+               
                if (Registry.isOldSDKInstalled()) {
                        setErrorSubTitle("Old version SDK(Tizen SDK) is installed. " +
                                        "Tizen SDK can be installed after removing old Tizen SDK.\n Close all running SDK processes before remove.");
@@ -187,6 +187,11 @@ public class WelcomePage extends PageTemplate {
 
                        selectedRadioBtn = RADIO_ACTION.UNINSTALL;
                }
+               
+               if (viewController == null) {
+                       return;
+               }
+               
                if (!viewController.existRemovablePackage()) {
                        buttonInstall.setText("Install new version of " + Config.SDK_NAME);
                        buttonInstall.setBounds(26, 40, 500, 22);
index adb30a4..9700e74 100644 (file)
@@ -401,6 +401,7 @@ public class PathUtil {
 
                } else {}//filePath is file.
                
+               System.gc(); // delete() method does not work exactly sometimes. so, there is gc() before delete().
                return filePath.delete() && ret;
        }
        
index b5f922e..81df3ef 100755 (executable)
@@ -114,4 +114,8 @@ fi
 
 echo "$CX Done. $CN"
 echo "$CX============================$CN"
+
+##source bashrc
+source ${HOME}/.bashrc
+
 exit 0
diff --git a/InstallerStub/linux/installmanager.conf.unstable b/InstallerStub/linux/installmanager.conf.unstable
new file mode 100644 (file)
index 0000000..c3c4fbb
--- /dev/null
@@ -0,0 +1,7 @@
+Repository: http://172.21.17.55/dibs/unstable
+InstallManager-Repository: http://172.21.17.55/InstallManager/Linux
+InstallManager-Version: 1.20.10
+
+
+
+
diff --git a/InstallerStub/linux/installmanager.conf.unstable_internal b/InstallerStub/linux/installmanager.conf.unstable_internal
new file mode 100644 (file)
index 0000000..be54161
--- /dev/null
@@ -0,0 +1,7 @@
+Repository: http://172.21.17.55/dibs/unstable_internal
+InstallManager-Repository: http://172.21.17.55/InstallManager/Linux
+InstallManager-Version: 1.20.10
+
+
+
+
diff --git a/InstallerStub/linux/installmanager.conf.unstable_public b/InstallerStub/linux/installmanager.conf.unstable_public
new file mode 100644 (file)
index 0000000..c18487d
--- /dev/null
@@ -0,0 +1,7 @@
+Repository: http://172.21.17.55/dibs/unstable_public
+InstallManager-Repository: http://172.21.17.55/InstallManager/Linux
+InstallManager-Version: 1.20.10
+
+
+
+
index 32c104f..9092e80 100755 (executable)
@@ -21,7 +21,7 @@ then
 fi
 
 currentDate=`date '+%Y%m%d%H%M'`
-binFile=InstallManager-Local-${currentDate}.bin
+binFile=tizen_sdk_${currentDate}.bin
 
 ./makeInstaller InstallManager-Local.tar.gz ${binFile}
 
index 4aae148..0b02ccd 100755 (executable)
@@ -10,7 +10,7 @@ tar cvfz ${tarGzFile} InstallManager InstallManager.jar installmanager.conf
 rm installmanager.conf
 
 currentDate=`date '+%Y%m%d%H%M'`
-binFile=InstallManager-Network-${currentDate}.bin
+binFile=tizen_sdk_${currentDate}.bin
 
 ./makeInstaller InstallManager-Network.tar.gz ${binFile}