LAUNCH: Marks warning when RDS error occurs 66/13766/2
authorkh5325.kim <kh5325.kim@samsung.com>
Mon, 16 Dec 2013 02:44:31 +0000 (11:44 +0900)
committerkh5325.kim <kh5325.kim@samsung.com>
Mon, 16 Dec 2013 03:03:14 +0000 (12:03 +0900)
Marks warning to project when RDS error occurs. (RDS Problem)
Refactors RdsDeployer's preDeploy().

Change-Id: I2b5e40e1af57cbb8084831384a8133c1e6324caa
Signed-off-by: kh5325.kim <kh5325.kim@samsung.com>
23 files changed:
org.tizen.common.gom/src/org/tizen/common/gom/smartlaunch/action/GomSmartLaunchAction.java
org.tizen.common.sdblib/src/org/tizen/sdblib/util/StringUtil.java
org.tizen.common.sign/src/org/tizen/common/sign/model/Certification.java
org.tizen.common.sign/src/org/tizen/common/sign/signer/TizenSigner.java
org.tizen.common/plugin.xml
org.tizen.common/src/org/tizen/common/core/command/file/DirectoryCopyHandlingCommand.java
org.tizen.common/src/org/tizen/common/core/command/prompter/RunnableOption.java
org.tizen.common/src/org/tizen/common/launch/ITizenNativeLaunchConfiguration.java
org.tizen.common/src/org/tizen/common/launch/ITizenWebLaunchConfiguration.java
org.tizen.common/src/org/tizen/common/rds/RdsDeltaDetector.java
org.tizen.common/src/org/tizen/common/rds/RdsDeltaListFile.java
org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java
org.tizen.common/src/org/tizen/common/rds/RdsMessages.java
org.tizen.common/src/org/tizen/common/rds/RdsMessages.properties
org.tizen.common/src/org/tizen/common/rds/ui/preference/RdsPreferencePage.java
org.tizen.common/src/org/tizen/common/sdb/command/SdbCommand.java
org.tizen.common/src/org/tizen/common/sdb/command/message/CommandErrorException.java
org.tizen.common/src/org/tizen/common/sdb/command/message/PkgcmdErrorType.java
org.tizen.common/src/org/tizen/common/util/StringUtil.java
org.tizen.common/src/org/tizen/common/util/log/EclipseAppender.java
org.tizen.common/test/src/org/tizen/common/sdb/RootTest.java
org.tizen.common/test/src/org/tizen/common/sdb/ShellTest.java
org.tizen.common/test/src/org/tizen/common/sdb/StatusWindowTest.java

index a3eaf7f..2ff1d21 100644 (file)
@@ -28,12 +28,11 @@ package org.tizen.common.gom.smartlaunch.action;
 import org.eclipse.debug.ui.actions.LaunchAction;
 import org.tizen.common.gom.launch.GomLaunchData;
 
-public class GomSmartLaunchAction  extends LaunchAction{
+public class GomSmartLaunchAction  extends LaunchAction {
 
     public GomSmartLaunchAction(GomLaunchData data) {
         super(data.getLaunchConfiguration(), data.getMode());
         this.setText(data.getDataInfo());
         this.setToolTipText(data.toString());
     }
-
 }
index c0cefa6..d3acc25 100644 (file)
@@ -163,12 +163,12 @@ public class StringUtil
         }
         return sb.toString();
     }
-    public static String asString(InputStream is) throws IOException{
+
+    public static String asString(InputStream is) throws IOException {
         StringBuffer out = new StringBuffer();
         byte[] b = new byte[4096];
 
-        for (int n; (n = is.read(b)) != -1;)
-        {
+        for (int n; (n = is.read(b)) != -1;) {
             out.append(new String(b,0,n));
         }
         return out.toString();
index 4cf7316..2f98d9e 100644 (file)
@@ -264,7 +264,6 @@ public class Certification {
                }
        }
 
-
        protected void loadCertificate( final String location ) throws KeyStoreException, ComplicatedCertificationException {
                final Certificate cert = keyStore.getCertificate(privateKeyAlias);
                if (cert instanceof X509Certificate) {
@@ -274,8 +273,7 @@ public class Certification {
                }
        }
        
-       
-       protected void loadCertificateChain() throws CertificationException{
+       protected void loadCertificateChain() throws CertificationException {
                certificationChain = new ArrayList<X509Certificate>();
                try {
                        Certificate[] chain = keyStore.getCertificateChain( privateKeyAlias );
index 38f852b..9c1bd8e 100644 (file)
@@ -88,7 +88,7 @@ public class TizenSigner {
         signer.sign( false );
     }
     
-    public static void authorSign(String targetDir, String authorP12Path, String authorPass, String authorCAPath, String rootCaPath) throws Exception{
+    public static void authorSign(String targetDir, String authorP12Path, String authorPass, String authorCAPath, String rootCaPath) throws Exception {
         checkNullParameters(targetDir, authorP12Path, authorPass);
 //      HashingSigning.AuthorSignature(targetDir, authorP12Path, authorPass, authorCAPath, null);
         
@@ -103,7 +103,7 @@ public class TizenSigner {
         signer.sign( item, SigningProfile.AUTHOR_ORDINAL, new File( targetDir, signatureName ), false );
     }
     
-    public static void distSign(String targetDir, String distP12Path, String distPass, String distCAPath, String distRootPath, int distNumber) throws Exception{
+    public static void distSign(String targetDir, String distP12Path, String distPass, String distCAPath, String distRootPath, int distNumber) throws Exception {
         checkNullParameters(targetDir, distP12Path, distPass);
 //        HashingSigning.DistributorSignature(targetDir, distP12Path, distPass, distCAPath, distRootPath, distNumber);
         
@@ -118,7 +118,7 @@ public class TizenSigner {
         signer.sign( item, distNumber, new File( targetDir, signatureName ), false );
     }
     
-    public static void authorIncrementalSign(String targetDir, String authorP12Path, String authorPass, String authorCAPath, String rootCaPath) throws Exception{
+    public static void authorIncrementalSign(String targetDir, String authorP12Path, String authorPass, String authorCAPath, String rootCaPath) throws Exception {
         checkNullParameters(targetDir, authorP12Path, authorPass);
 //        HashingSigning.AuthorSignatureRDS(targetDir, authorP12Path, authorPass, authorCAPath, null);
         
@@ -133,7 +133,7 @@ public class TizenSigner {
         signer.sign( item, SigningProfile.AUTHOR_ORDINAL, new File( targetDir, signatureName ), true );
     }
     
-    public static void distIncrementalSign(String targetDir, String distP12Path, String distPass, String distCAPath, String distRootPath, int distNumber) throws Exception{
+    public static void distIncrementalSign(String targetDir, String distP12Path, String distPass, String distCAPath, String distRootPath, int distNumber) throws Exception {
         checkNullParameters(targetDir, distP12Path, distPass);
 //        HashingSigning.DistributorSignatureRDS(targetDir, distP12Path, distPass, distCAPath, distRootPath, distNumber);
         
@@ -148,7 +148,7 @@ public class TizenSigner {
         signer.sign( item, distNumber, new File( targetDir, signatureName ), true );
     }
     
-    private static void checkNullParameters(String targetDir, String p12Path, String pass) throws IllegalArgumentException{
+    private static void checkNullParameters(String targetDir, String p12Path, String pass) throws IllegalArgumentException {
         String emptyParameter = null;
         if(StringUtil.isEmpty(targetDir)) {
             emptyParameter = "target directory";
@@ -165,7 +165,7 @@ public class TizenSigner {
         throw new IllegalArgumentException(emptyParameter + " is empty");
     }
     
-    public static void dist2SignWithParameterCheck(String targetDir, String dist2P12Path, String dist2Pass, String dist2CAPath, String dist2RootPath) throws Exception{
+    public static void dist2SignWithParameterCheck(String targetDir, String dist2P12Path, String dist2Pass, String dist2CAPath, String dist2RootPath) throws Exception {
         if(!StringUtil.isEmpty(dist2P12Path) && !StringUtil.isEmpty(dist2Pass)) {
             if(StringUtil.isEmpty(dist2CAPath) || StringUtil.isEmpty(dist2RootPath)) {
                 dist2CAPath = null;
@@ -175,7 +175,7 @@ public class TizenSigner {
         }
     }
     
-    public static void dist2IncrementalSignWithParameterCheck(String targetDir, String dist2P12Path, String dist2Pass, String dist2CAPath, String dist2RootPath) throws Exception{
+    public static void dist2IncrementalSignWithParameterCheck(String targetDir, String dist2P12Path, String dist2Pass, String dist2CAPath, String dist2RootPath) throws Exception {
         if(!StringUtil.isEmpty(dist2P12Path) && !StringUtil.isEmpty(dist2Pass)) {
             if(StringUtil.isEmpty(dist2CAPath) || StringUtil.isEmpty(dist2RootPath)) {
                 dist2CAPath = null;
index 45db15d..1ff6b40 100644 (file)
             pattern="org\.eclipse\.wst\.xml\.ui/org\.eclipse\.wst\.xml\.ui\.XMLExampleProjectCreationWizard">\r
         </activityPatternBinding>\r
 \r
-\r
         <activityPatternBinding\r
             activityId="org.tizen.web.DisableWizardsActivity"\r
             pattern="org\.eclipse\.emf\.ecore\.editor/org\.eclipse\.emf\.ecore\.presentation\.EcoreModelWizardID">\r
             pattern="org\.eclipse\.jdt\.ui/org\.eclipse\.jdt\.ui\.wizards.*">\r
         </activityPatternBinding>\r
 \r
-\r
         <activityPatternBinding\r
             activityId="org.tizen.web.DisableWizardsActivity"\r
             pattern="org\.eclipse\.jdt\.junit/org\.eclipse\.jdt\.junit\.wizards.*">\r
             category="org.tizen.common.properties.tizen"\r
             class="org.tizen.common.rds.ui.preference.RdsPreferencePage"\r
             id="org.tizen.common.properties.rds"\r
-            name="%RDS.name">\r
+            name="%org.tizen.common.preferences.rds.name">\r
           <enabledWhen>\r
              <adapt\r
                    type="org.eclipse.core.resources.IProject">\r
       </page>\r
     </extension>\r
     <!-- activities end -->\r
+\r
+    <!-- RDS Marker -->\r
+    <extension\r
+          id="org.tizen.common.launch.rdsMarker"\r
+          name="RDS Problem"\r
+          point="org.eclipse.core.resources.markers">\r
+      <persistent\r
+            value="false">\r
+      </persistent>\r
+      <super\r
+            type="org.eclipse.core.resources.problemmarker">\r
+      </super>\r
+    </extension>\r
 </plugin>
index 823955b..388a6aa 100755 (executable)
@@ -65,7 +65,7 @@ public class DirectoryCopyHandlingCommand extends FileHandlingCommand<Boolean> {
     
     private static Logger logger = LoggerFactory.getLogger(DirectoryCopyHandlingCommand.class);
     
-    public DirectoryCopyHandlingCommand(List<String> sourcePathList, List<String> targetPathList) throws IllegalArgumentException{
+    public DirectoryCopyHandlingCommand(List<String> sourcePathList, List<String> targetPathList) throws IllegalArgumentException {
         if(sourcePathList.size() != targetPathList.size()) {
             throw new IllegalArgumentException("Lenghs of sourcePathList and target paths are not same");
         }
index 54c73e0..c81876b 100644 (file)
@@ -25,7 +25,7 @@
 
 package org.tizen.common.core.command.prompter;
 
-public abstract class RunnableOption extends ChoiceOption{
+public abstract class RunnableOption extends ChoiceOption {
     
     /**
      * Arguments which will be used in run.
index addff43..3f48137 100644 (file)
@@ -28,6 +28,6 @@ package org.tizen.common.launch;
 import org.tizen.sdblib.IDevice;
 
 
-public interface ITizenNativeLaunchConfiguration extends ITizenLaunchConfiguration{
+public interface ITizenNativeLaunchConfiguration extends ITizenLaunchConfiguration {
     public IDevice getDeviceFromLaunchConfiguration(IDevice[] devices);
 }
index 13383a5..af7cbbb 100644 (file)
@@ -30,5 +30,5 @@ package org.tizen.common.launch;
  * @author hyunsik
  *
  */
-public interface ITizenWebLaunchConfiguration extends ITizenLaunchConfiguration{
+public interface ITizenWebLaunchConfiguration extends ITizenLaunchConfiguration {
 }
index 9f57ea6..ce95b10 100755 (executable)
@@ -85,7 +85,6 @@ public class RdsDeltaDetector {
         }
         Workspace workspace = ((Workspace)project.getWorkspace());
         ElementTreeReader treeReader = new ElementTreeReader(workspace.getSaveManager());
-        
         DataInputStream input = null;
         try {
             input = new DataInputStream(new SafeFileInputStream(strLocalFile, strLocalFile + ".temp", TREE_BUFFER_SIZE));
@@ -117,14 +116,12 @@ public class RdsDeltaDetector {
      * @return String
      */
     private String downloadOldTree( ) {
-        String strLocalFile = null;
-        
         if ( remotePath == null ) {
             return null;
         }
         
         String deltaFileOnRemote = remotePath + STR_TREE_DIRECTORY + STR_TREE_FILE;
-        strLocalFile = project.getLocation().toString();
+        String strLocalFile = project.getLocation().toString();
         try {
             SyncResult result = device.getSyncService().pull(device.getFileEntry( deltaFileOnRemote ), strLocalFile);
             if ( !result.isOk() ) {
@@ -166,7 +163,6 @@ public class RdsDeltaDetector {
         }
         
         IResourceDelta result = ResourceDeltaFactory.computeDelta((Workspace) project.getWorkspace(), oldTree, tree, project.getFullPath(), -1);
-        
         return getDelta(new ArrayList<DeltaResourceInfo>(), result, projectPath);
     }
     
@@ -218,11 +214,8 @@ public class RdsDeltaDetector {
     }
     
     private DeltaResourceInfo addDeltaInfo(List<DeltaResourceInfo> deltaInfoList, String nodeName, String deltaFullPath, String deltaType, int resourceType) {
-        DeltaResourceInfo resourceInfo = null;
-        
-        resourceInfo = new DeltaResourceInfo(nodeName, deltaFullPath, deltaType, resourceType);
+        DeltaResourceInfo resourceInfo = new DeltaResourceInfo(nodeName, deltaFullPath, deltaType, resourceType);
         deltaInfoList.add(resourceInfo);
-        
         return resourceInfo;
     }
     
@@ -243,13 +236,10 @@ public class RdsDeltaDetector {
         }
         
         ElementTreeWriter treeWriter = new ElementTreeWriter(workspace.getSaveManager());
-        
         String strLocalFile = project.getLocation().toString() + "/" + STR_TREE_FILE;
-        
         DataOutputStream output = null;
         try {
             output = new DataOutputStream(new SafeFileOutputStream(strLocalFile, strLocalFile + ".temp"));
-            
             treeWriter.writeTree(tree, subTreePath, ElementTreeWriter.D_INFINITE, output);
         } catch (IOException e) {
             return "";
@@ -258,7 +248,7 @@ public class RdsDeltaDetector {
             try {
                 project.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
             } catch (CoreException e) {
-                logger.error("Could not refresh project resources...", e);
+                logger.error("Failed to refresh project resources", e);
             }
         }
         return strLocalFile;
index 3b6e181..3b43527 100644 (file)
@@ -57,14 +57,15 @@ public class RdsDeltaListFile {
     public void addAddDelta(String addDelta) {
         addList.add(addDelta);
     }
+
     public void addModifyDelta(String addDelta) {
         modifyList.add(addDelta);
     }
+
     public void addDeleteDelta(String addDelta) {
         deleteList.add(addDelta);
     }
     
-    
     /**
      * Makes delta list file.
      * If addList and modifyList and deleteList are empty, This method does not make delta list file and returns null.
@@ -99,9 +100,6 @@ public class RdsDeltaListFile {
             }
             return null;
         }
-        
         return file;
     }
-    
-
 }
index 560ee7a..c999be5 100644 (file)
@@ -32,6 +32,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
@@ -57,13 +58,15 @@ import org.tizen.sdblib.service.SyncResult;
 import org.tizen.sdblib.service.SyncService;
 
 /**
- * This class deploys delta resource of project to target.
+ * Deploys delta resources of project to target.
  * 
  * @author Gun Kim<gune.kim@samsung.com>
  */
 public abstract class RdsDeployer implements Closeable {
     private final Logger logger = LoggerFactory.getLogger(RdsDeployer.class);
 
+    private static final String RDS_MARKER = "org.tizen.common.launch.rdsMarker";
+
     protected IProgressMonitor monitor;
     protected ITizenConsoleManager console;
     protected String pkgType;
@@ -72,11 +75,11 @@ public abstract class RdsDeployer implements Closeable {
     protected IDevice device;
     protected RdsDeltaDetector deltaDetector;
     protected ISdbCommandHelper tizenCommand;
-    // ignoreList has a high priority better than interestList
+    // ignoreList has a high priority better than interestList.
     protected List<DeltaResourceInfo> ignoreList = new ArrayList<DeltaResourceInfo>();
     protected List<DeltaResourceInfo> interestList = new ArrayList<DeltaResourceInfo>();
     private SyncService syncService;
-//    private final static String[] needAppOwnerArray = new String[] {"/data", "/shared/data", "/shared/trusted", "/setting"};
+    //private final static String[] needAppOwnerArray = new String[] {"/data", "/shared/data", "/shared/trusted", "/setting"};
     // deltaInfoList should be set only once.
     private List<DeltaResourceInfo> deltaInfoList = null;
     // strDeltaInfoFile should be set when deltaInfoList is set.
@@ -104,9 +107,9 @@ public abstract class RdsDeployer implements Closeable {
      * 
      * @return If this method returns false, {@link RdsDeployer#deploy()} fails and returns false.
      */
-    protected abstract boolean sign( List<DeltaResourceInfo> deltaInfoList) throws CoreException, IOException, IllegalStateException;
+    protected abstract boolean sign(List<DeltaResourceInfo> deltaInfoList) throws CoreException, IOException, IllegalStateException;
     
-    public RdsDeployer( IProject project, IDevice device, ISdbCommandHelper tizenCommand, ITizenConsoleManager console, String pkgType, IProgressMonitor monitor) {
+    public RdsDeployer(IProject project, IDevice device, ISdbCommandHelper tizenCommand, ITizenConsoleManager console, String pkgType, IProgressMonitor monitor) {
         this.project = project;
         this.device = device;
         this.tizenCommand = tizenCommand;
@@ -125,6 +128,11 @@ public abstract class RdsDeployer implements Closeable {
      * @return If this method returns false, {@link RdsDeployer#deploy()} doesn't execute and returns false.
      */
     protected boolean preDeploy() throws CoreException {
+        project.deleteMarkers(RDS_MARKER, true, IResource.DEPTH_INFINITE);
+        if ( !hasOldResourceInfo() ) {
+            logger.debug(RdsDeployer.makeRdsLog(RdsMessages.CANNOT_FIND_RDS_INFO));
+            return false;
+        }
         return true;
     }
     
@@ -147,7 +155,7 @@ public abstract class RdsDeployer implements Closeable {
             return true;
         }
         
-        final String failToSignMsg = "failed to sign for RDS";
+        final String failToSignMsg = "Failed to sign for RDS";
         try {
             if ( !sign(deltaInfoList) ) {
                 printInfo(failToSignMsg);
@@ -166,21 +174,34 @@ public abstract class RdsDeployer implements Closeable {
             return false;
         }
 
-        if ( deltaInfoList.isEmpty()) {
+        if ( deltaInfoList.isEmpty() ) {
             return true;
         }
         
         try {
             partialInstall(deltaInfoList);
-        }
-        catch ( CoreException e ) {
+        } catch (CoreException e) {
             logger.error(RdsMessages.CANNOT_PARTIALLY_INSTALL, e);
             printInfo(RdsDeployer.makeRdsLog(RdsMessages.CANNOT_PARTIALLY_INSTALL));
+            reportWarning(project, e.getMessage(), false);
             return false;
         }
         return true;
     }
     
+    protected void reportWarning(IResource resource, String msg, boolean persistent) {
+        IMarker m;
+        try {
+            m = resource.createMarker(RDS_MARKER);
+            m.setAttribute(IMarker.MESSAGE, msg);
+            m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
+            m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
+            m.setAttribute(IMarker.TRANSIENT, !persistent);
+        } catch (CoreException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+    
     /**
      * Returns a delta list interested.
      */
@@ -192,21 +213,19 @@ public abstract class RdsDeployer implements Closeable {
             if ( deltaInfoList == null ) {
                 newCoreException(RdsMessages.CANNOT_FIND_DELTA, null);
             }
-            
             deltaInfoList = getInterestDelta(deltaInfoList);
         } catch (CoreException e) {
             printInfo(RdsDeployer.makeRdsLog(RdsMessages.CANNOT_FIND_DELTA));
             return null;
         }
-
         return deltaInfoList;
     }
     
-    public void setInterestList( List<DeltaResourceInfo> list) {
+    public void setInterestList(List<DeltaResourceInfo> list) {
         interestList = list;
     }
     
-    public void setIgnoreList( List<DeltaResourceInfo> list) {
+    public void setIgnoreList(List<DeltaResourceInfo> list) {
         ignoreList = list;
     }
     
@@ -235,25 +254,24 @@ public abstract class RdsDeployer implements Closeable {
                 }
                 // If the file does not exist, a type of delta is DeltaResourceInfo.TYPE_DELETE
                 else {
-                    interestFullPath = interest.getFullPath().substring(0,interest.getFullPath().length()-1 );
-                    interestRemotePath = interest.getRemotePath().substring(0,interest.getRemotePath().length()-1 );
+                    interestFullPath = interest.getFullPath().substring(0, interest.getFullPath().length()-1 );
+                    interestRemotePath = interest.getRemotePath().substring(0, interest.getRemotePath().length()-1 );
                 }
             }
             else {
                 interestFullPath = interest.getFullPath();
                 interestRemotePath = interest.getRemotePath();
             }
-            
             prefix = strProjectPath + interestFullPath;
             strRemotePath = convertToRemotePath(delta.getFullPath(), prefix, interestRemotePath);
         }
         
         if ( strRemotePath == null ) {
-            logger.error(String.format("Cannot make remotePath (host: %s, prefix: %s)", delta.getFullPath(), prefix) );
+            logger.error(String.format("Cannot make remotePath (host: %s, prefix: %s)", delta.getFullPath(), prefix));
             newCoreException(RdsDeployer.makeRdsLog(RdsMessages.CANNOT_FIND_DELTA), null);
         }
         
-        if ( IResource.FOLDER == delta.getResourceType() && !DeltaResourceInfo.TYPE_DELETE.equals(delta.getType())) {
+        if ( IResource.FOLDER == delta.getResourceType() && !DeltaResourceInfo.TYPE_DELETE.equals(delta.getType()) ) {
             if ( !strRemotePath.endsWith("/") ) {
                 strRemotePath = strRemotePath + "/";
             }
@@ -265,22 +283,18 @@ public abstract class RdsDeployer implements Closeable {
     /**
      * Replaces {@code prefix} of {@code hostPath} to the {@code replacement}.<br>
      * If the {@code hostPath} doesn't start the {@code prefix}, returns null.
-     * 
      */
-    private String convertToRemotePath( String hostPath, String prefix, String replacement) {
+    private String convertToRemotePath(String hostPath, String prefix, String replacement) {
         String result = null;
-        
         if ( hostPath.startsWith(prefix) ) {
-            result = replacement + hostPath.substring( prefix.length(), hostPath.length());
+            result = replacement + hostPath.substring( prefix.length(), hostPath.length() );
         }
-
         return result;
     }
     
     /**
      * Checks whether the {@code nodeList} contains the {@code node}.<br>
      * If the {@code nodeList} doesn't contain the {@code node}, returns null.
-     * 
      */
     private DeltaResourceInfo containsNode(DeltaResourceInfo node, List<DeltaResourceInfo> nodeList, String prefix) {
         File file = new File(node.getFullPath());
@@ -300,7 +314,7 @@ public abstract class RdsDeployer implements Closeable {
             }
             // file
             else {
-                if ( node.getFullPath().equals( prefix + tempNode.getFullPath()) ) {
+                if ( node.getFullPath().equals(prefix + tempNode.getFullPath()) ) {
                     return tempNode;
                 }
             }
@@ -311,8 +325,8 @@ public abstract class RdsDeployer implements Closeable {
     protected boolean isDirectory(String path) {
         return path.endsWith("/");
     }
-
-    protected void partialInstall( List<DeltaResourceInfo> deltaInfoList ) throws CoreException {
+    
+    protected void partialInstall(List<DeltaResourceInfo> deltaInfoList) throws CoreException {
         String strRemotePath = null;
         String strProjectPath = project.getLocation().toString();
         String strRemoteAbsolutePath = null;
@@ -336,7 +350,6 @@ public abstract class RdsDeployer implements Closeable {
                 }
                 strRemotePath = getRemotePathOfDelta(interestNode, strProjectPath, node);
                 strRemoteAbsolutePath = strAppInstallPath + "/" + strRemotePath;
-
                 type = node.getType();
                 if ( DeltaResourceInfo.TYPE_MODIFY.equals(type) || DeltaResourceInfo.TYPE_ADD.equals(type) ) {
                     try {
@@ -345,7 +358,7 @@ public abstract class RdsDeployer implements Closeable {
                             tizenCommand.runCommand( String.format(TizenPlatformConstants.RDS_PUSH_DIRECTORY_COMMAND, strRemoteAbsolutePath), true, TizenPlatformConstants.CMD_SUCCESS);
                         }
                         else {
-                            SyncResult result = getSyncService().push(node.getFullPath(), device.getFileEntry( strRemoteAbsolutePath ).getParent() );
+                            SyncResult result = getSyncService().push(node.getFullPath(), device.getFileEntry( strRemoteAbsolutePath ).getParent());
                             if ( !result.isOk() ) {
                                 throw new IOException(command);
                             }
@@ -384,9 +397,8 @@ public abstract class RdsDeployer implements Closeable {
     
     /**
      * Returns interestDelta from the {@code deltaInfoList}.
-     * 
      */
-    public List<DeltaResourceInfo> getInterestDelta( List<DeltaResourceInfo> deltaInfoList ) throws CoreException{
+    public List<DeltaResourceInfo> getInterestDelta(List<DeltaResourceInfo> deltaInfoList) throws CoreException {
         List<DeltaResourceInfo> delta = new ArrayList<DeltaResourceInfo>();
         String strProjectPath = project.getLocation().toString();
         DeltaResourceInfo interestNode = null;
@@ -403,7 +415,6 @@ public abstract class RdsDeployer implements Closeable {
             }
             
             strRemotePath = getRemotePathOfDelta(interestNode, strProjectPath, node);
-            
             node.setRemotePath(strRemotePath);
             delta.add(node);
             getInterestDelta(node.getChildren());
@@ -418,9 +429,9 @@ public abstract class RdsDeployer implements Closeable {
     }
 
     public List<DeltaResourceInfo> getDelta() {
-        if ( deltaInfoList == null) {
+        if ( deltaInfoList == null ) {
             deltaInfoList = deltaDetector.getDelta(null, null);
-            strDeltaInfoFile = deltaDetector.makeDeltaFile(null,null);
+            strDeltaInfoFile = deltaDetector.makeDeltaFile(null, null);
         }
         return deltaInfoList;
     }
@@ -432,15 +443,13 @@ public abstract class RdsDeployer implements Closeable {
     
     protected void postInstall() throws CoreException {
         SdbCommand sdbCommand = new SdbCommand(device, console, new PkgCmdReceiver(console));
-
         int timeout = SdbResponse.SHORT_TIMEOUT;
         try {
             String installCommand = String.format(TizenPlatformConstants.PKG_TOOL_REINSTALL_COMMAND, pkgType.toLowerCase(), getPkgId());
-            //String installCommand = String.format("osp-installer -r %s",  getPkgId());
             // TODO: Timeout is temporary.
             // If "pkgcmd -r" is normal operation, timeout should be removed.
             sdbCommand.runCommand(installCommand, new PkgcmdErrorType(), timeout);
-            sdbCommand.runCommand( String.format(TizenPlatformConstants.REMOVE_FILE_COMMAND, strAppInstallPath));
+            sdbCommand.runCommand(String.format(TizenPlatformConstants.REMOVE_FILE_COMMAND, strAppInstallPath));
         } catch (TimeoutException e) {
             newCoreException(RdsDeployer.makeRdsLog(NLS.bind(org.tizen.common.launch.LaunchMessages.SDB_TIMEOUT_EXCEPTION, timeout)), e);
         } catch (Exception e) {
@@ -461,7 +470,6 @@ public abstract class RdsDeployer implements Closeable {
         getDelta();
         
         String strRemotePath = appInstallPath + RdsDeltaDetector.STR_TREE_DIRECTORY;
-        
         try {
             pushFile(strDeltaInfoFile, strRemotePath);
         } catch (Exception e) {
@@ -469,7 +477,7 @@ public abstract class RdsDeployer implements Closeable {
         }
     }
     
-    public static String makeRdsLog( String log ) {
+    public static String makeRdsLog(String log) {
         return RdsMessages.RDS_MODE_PREFIX + " " + log;
     }
     
@@ -488,7 +496,7 @@ public abstract class RdsDeployer implements Closeable {
      * @param exception a low-level exception, or <code>null</code> if not
      *    applicable
      */
-    public void newCoreException(String message, Throwable exception) throws CoreException {
+    protected void newCoreException(String message, Throwable exception) throws CoreException {
         Status status = new Status(Status.ERROR, CommonPlugin.PLUGIN_ID, message, exception);
         throw new CoreException(status);
     }
@@ -497,7 +505,6 @@ public abstract class RdsDeployer implements Closeable {
         if ( syncService == null ) {
             syncService = device.getSyncService();
         }
-
         return syncService;
     }
     
index 89c5afe..a8d8c02 100644 (file)
@@ -36,12 +36,14 @@ public class RdsMessages {
     public static String RDS_PUSH_LOG;
     public static String RDS_PUSH_ERROR;
     public static String RDS_DELETE_ERROR;
-    public static String CANNOT_INSTALL;
     public static String RDS_RES_INFO_PUSH_ERROR;
-    public static String CANNOT_FIND_RDS_INFO;
-    public static String CANNOT_FIND_DELTA;
-    public static String CANNOT_PARTIALLY_INSTALL;
     public static String RDS_MODE_DISABLED;
     public static String RDS_MODE_ENABLED;
     public static String RDS_MODE_PREFIX;
+
+    public static String CANNOT_FIND_APPLICATION;
+    public static String CANNOT_FIND_RDS_INFO;
+    public static String CANNOT_FIND_DELTA;
+    public static String CANNOT_INSTALL;
+    public static String CANNOT_PARTIALLY_INSTALL;
 }
index d47a5c3..a003707 100644 (file)
@@ -1,11 +1,13 @@
 RDS_PUSH_LOG = Pushing file "{0}" to "{1}" in target...
-RDS_PUSH_ERROR = Failed to push file(s).
-RDS_DELETE_ERROR = Failed to delete file in target.
-CANNOT_INSTALL = Cannot install application.
-RDS_RES_INFO_PUSH_ERROR = Failed to upload resource information for RDS.
-CANNOT_FIND_RDS_INFO = Cannot find information of the latest launch.
-CANNOT_FIND_DELTA = Cannot find information of delta.
-CANNOT_PARTIALLY_INSTALL = Cannot partially upload or reinstall.
+RDS_PUSH_ERROR = Failed to push file(s)
+RDS_DELETE_ERROR = Failed to delete file(s) in target
+RDS_RES_INFO_PUSH_ERROR = Failed to upload resource information for RDS
 RDS_MODE_DISABLED = RDS: Off
 RDS_MODE_ENABLED = RDS: On
 RDS_MODE_PREFIX = [RDS]
+
+CANNOT_INSTALL = Cannot install application
+CANNOT_FIND_APPLICATION = Cannot find installed application. An application might be removed by a user.
+CANNOT_FIND_RDS_INFO = Cannot find information of the latest launch
+CANNOT_FIND_DELTA = Cannot find information of delta
+CANNOT_PARTIALLY_INSTALL = Cannot partially upload or reinstall
index 7c91c3c..5982a65 100644 (file)
@@ -104,8 +104,6 @@ public class RdsPreferencePage extends PropertyAndPreferencePage implements IWor
     protected boolean hasProjectSpecificOptions(IProject project) {
         boolean isSpecificOption = false;
         String specificOption = "";
-
-        
         try {
             specificOption = project.getPersistentProperty(RDS_PROPERTIES_SPECIFIC_OPTION_NAME);
         } catch (CoreException e) {
@@ -157,7 +155,7 @@ public class RdsPreferencePage extends PropertyAndPreferencePage implements IWor
             prefStore.setValue(RDS_OPTION_ID, btnRdsCheck.getSelection());
         }
     }
-    
+
     public boolean getRdsOption() {
         boolean isRdsOption = false;
         IProject project = getProject();
@@ -168,18 +166,11 @@ public class RdsPreferencePage extends PropertyAndPreferencePage implements IWor
             } catch (CoreException e) {
                 isRdsOption = false;
             }
-
-            if ( OPTION_ENABLE.equals(rdsOption) ) {
-                isRdsOption = true;
-            }
-            else {
-                isRdsOption = false;
-            }
+            isRdsOption = OPTION_ENABLE.equals(rdsOption);
         }
         else {
             isRdsOption = prefStore.getBoolean(RDS_OPTION_ID);
         }
-        
         return isRdsOption;
     }
 
@@ -218,35 +209,32 @@ public class RdsPreferencePage extends PropertyAndPreferencePage implements IWor
                         if ( projectType == null || projectType.isReferencedProject() == false ) {
                             continue;
                         }
-                        
                         if ( projectType.isReferencedProject() ) {
                             return false;
                         }
                     }
                 }
             } catch (CoreException e) {
-                logger.error("Failed to read the referenced project list.", e);
+                logger.error("Failed to read the referenced project list", e);
                 return false;
             }
         }
 
-        
         if ( project != null ) {
             try {
                 projectSpecificOption = project.getPersistentProperty(RDS_PROPERTIES_SPECIFIC_OPTION_NAME);
             } catch (CoreException e) {
-                logger.error("Failed to read project specific option.", e);
+                logger.error("Failed to read project specific option", e);
             }
         }
-        if ( OPTION_ENABLE.equals(projectSpecificOption)) {
+        if ( OPTION_ENABLE.equals(projectSpecificOption) ) {
             try {
                 if ( project != null ) {
                     rdsOption = project.getPersistentProperty(RDS_PROPERTIES_RDS_OPTION_NAME);
                 }
             } catch (CoreException e) {
-                logger.error("Failed to read RDS option.", e);
+                logger.error("Failed to read RDS option", e);
             }
-            
             return OPTION_ENABLE.equals(rdsOption);
         }
         else {
@@ -255,7 +243,7 @@ public class RdsPreferencePage extends PropertyAndPreferencePage implements IWor
         }
     }
 
-    // TODO : refactoring this method, this method is temporary, hybrid-app RDS support in webapp
+    // TODO: refactoring this method, this method is temporary, hybrid-app RDS support in webapp
     public static boolean isWebRdsMode( IProject project ) {
         String projectSpecificOption = "";
         String rdsOption = OPTION_DISABLE;
@@ -265,13 +253,12 @@ public class RdsPreferencePage extends PropertyAndPreferencePage implements IWor
         } catch (CoreException e) {
             logger.error("Failed to read project specific option.", e);
         }
-        if ( OPTION_ENABLE.equals(projectSpecificOption)) {
+        if ( OPTION_ENABLE.equals(projectSpecificOption) ) {
             try {
                 rdsOption = project.getPersistentProperty(RDS_PROPERTIES_RDS_OPTION_NAME);
             } catch (CoreException e) {
                 logger.error("Failed to read RDS option.", e);
             }
-            
             return OPTION_ENABLE.equals(rdsOption);
         }
         else {
index 29cadaa..e4d5fd9 100644 (file)
@@ -144,7 +144,7 @@ public class SdbCommand {
         return runCommand(command, messages, defaultTimeout);
     }
 
-    public CommandErrorType runCommand(String command, CommandErrorType errorMessages, int timeout) throws CommandErrorException, TimeoutException, SdbCommandRejectedException, ShellCommandUnresponsiveException, IOException{
+    public CommandErrorType runCommand(String command, CommandErrorType errorMessages, int timeout) throws CommandErrorException, TimeoutException, SdbCommandRejectedException, ShellCommandUnresponsiveException, IOException {
         print("$ " + command);
 
         device.executeShellCommand( makeCommandWithExitcode(command), receiver, timeout);
index d38f859..00bf22d 100644 (file)
 
 package org.tizen.common.sdb.command.message;
 
-public class CommandErrorException extends Exception{
+public class CommandErrorException extends Exception {
 
     private static final long serialVersionUID = 1L;
     
-    
     public CommandErrorException() {
         super();
     }
index 644484e..ccfeef2 100644 (file)
@@ -83,7 +83,7 @@ public class PkgcmdErrorType implements CommandErrorType {
     }
     
     @Override
-    public void makeException() throws CommandErrorException{
+    public void makeException() throws CommandErrorException {
         if (errorType == null ) {
             throw new CommandErrorException(PkgcmdErrorMessages.ERROR_UNKNOWN);
         }
@@ -97,7 +97,7 @@ public class PkgcmdErrorType implements CommandErrorType {
         return getMessage();
     }
     
-    private String parseErrorMessage( ) {
+    private String parseErrorMessage() {
         int startIdx = commandOutput.indexOf(ERROR_MESSAGE_TEMPLATE);
         int endIdx = commandOutput.indexOf(System.getProperty("line.separator"), startIdx);
         
index 31faa13..c2f0561 100755 (executable)
@@ -172,8 +172,7 @@ public class StringUtil
         
         ArrayUtil.iterate(
             ArrayUtil.convertToWrapper( str.toCharArray() ),
-            new IteratingRunner<Character>()
-            {
+            new IteratingRunner<Character>() {
                 public void run( Character arg )
                 {
                     if (Character.isDigit( arg )) {
@@ -194,12 +193,12 @@ public class StringUtil
         }
         return sb.toString();
     }
-    public static String asString(InputStream is) throws IOException{
+
+    public static String asString(InputStream is) throws IOException {
         StringBuffer out = new StringBuffer();
         byte[] b = new byte[4096];
 
-        for (int n; (n = is.read(b)) != -1;)
-        {
+        for (int n; (n = is.read(b)) != -1;) {
             out.append(new String(b,0,n));
         }
         return out.toString();
index 0908e89..5e04bf8 100644 (file)
@@ -44,7 +44,7 @@ import org.tizen.common.ui.view.console.ConsoleManager;
  * @author Ho Namkoong {@literal <ho.namkoong@samsung.com>} (S-Core)
  *
  */
-public class EclipseAppender extends AppenderSkeleton{
+public class EclipseAppender extends AppenderSkeleton {
     
     /**
      * Constructor for {@link EclipseAppender}
index 0815341..3402461 100644 (file)
@@ -60,7 +60,7 @@ public class RootTest {
      * @author Ho Namkoong{@literal <ho.namkoong@samsung.com>} (S-Core) 
      */
     @Test
-    public void test_root_on() throws Exception{
+    public void test_root_on() throws Exception {
         
         String[] serials = getSerialNumber();
         runAndWait(MessageFormat.format("{0} -s {1} {2}", SDB_PATH, serials[0], "root off"));
index e336112..ec3d252 100644 (file)
@@ -51,7 +51,7 @@ public class ShellTest {
      * @author Ho Namkoong{@literal <ho.namkoong@samsung.com>} (S-Core) 
      */
     @Test
-    public void test_shell() throws Exception{
+    public void test_shell() throws Exception {
         String[] serials = getSerialNumber();
         IShell shell = run(String.format("%s -s %s %s", SDB_PATH, serials[0], "shell"));
         shell.write("exit", 1000);
index 9e764c2..d3efd7c 100644 (file)
@@ -53,7 +53,7 @@ public class StatusWindowTest {
      * @author Ho Namkoong{@literal <ho.namkoong@samsung.com>} (S-Core) 
      */
     @Test
-    public void test_status_window() throws Exception{
+    public void test_status_window() throws Exception {
         
         class StatusWindowResult {
             @Pattern(pattern = "State:{0}", index = 0)