Hi Deepal:

There are quite a few missing or extra spaces in this commit.

When calling methods, it should look like this:

  method(arg1, arg2, arg3)  NOT method( arg1 , arg2,arg3)

Operators always have spaces around them, so

  "this == correct" NOT "this==not"

If statements have a space after "if", so

  if (this == correct) {   NOT
  if(this==wrong){

Can we please follow the coding conventions?

Thanks,
--G

[EMAIL PROTECTED] wrote:
Author: deepal
Date: Tue Jun 19 14:03:21 2007
New Revision: 548855

URL: http://svn.apache.org/viewvc?view=rev&rev=548855
Log:
fixing hot update and hot deployment issues
 - Test both hot update and hot deployment with POJO deployer
and server deployer

Modified:
    
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
    
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java
    
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java

Modified: 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java?view=diff&rev=548855&r1=548854&r2=548855
==============================================================================
--- 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/RepositoryListener.java
 Tue Jun 19 14:03:21 2007
@@ -19,6 +19,7 @@
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
 import org.apache.axis2.deployment.repository.util.WSInfoList;
+import org.apache.axis2.deployment.repository.util.WSInfo;
 import org.apache.axis2.util.Loader;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -79,11 +80,11 @@
                 }
                 if (!file.isDirectory()) {
                     if 
(DeploymentFileData.isModuleArchiveFile(file.getName())) {
-                        addFileToDeploy(file, 
deploymentEngine.getModuleDeployer());
+                        addFileToDeploy(file, 
deploymentEngine.getModuleDeployer() , WSInfo.TYPE_MODULE);
                     }
                 } else {
                     if (!"lib".equalsIgnoreCase(file.getName())) {
-                        addFileToDeploy(file, 
deploymentEngine.getModuleDeployer());
+                        addFileToDeploy(file, 
deploymentEngine.getModuleDeployer() ,WSInfo.TYPE_MODULE);
                     }
                 }
             }
@@ -115,7 +116,7 @@
                 String fileName = url.toString();
                 fileName = fileName.substring(0, 
fileName.lastIndexOf("/META-INF/module.xml"));
                 File f = new File(new URI(fileName));
-                addFileToDeploy(f, deployer);
+                addFileToDeploy(f, deployer ,WSInfo.TYPE_MODULE);
             }
         } catch (Exception e) {
             // Oh well, log the problem
@@ -140,7 +141,7 @@
                 if (!file.isDirectory()) {
                     if 
(DeploymentFileData.isModuleArchiveFile(file.getName())) {
                         //adding modules in the class path
-                        addFileToDeploy(file, deployer);
+                        addFileToDeploy(file, deployer,WSInfo.TYPE_MODULE);
                     }
                 }
             }
@@ -165,7 +166,7 @@
                     if (file.isFile()) {
                         if 
(DeploymentFileData.isModuleArchiveFile(file.getName())) {
                             //adding modules in the class path
-                            addFileToDeploy(file, deployer);
+                            addFileToDeploy(file, deployer,WSInfo.TYPE_MODULE);
                         }
                     }
                 }
@@ -247,7 +248,7 @@
                         if (!file.isDirectory() && extension.equals(
                                 
DeploymentFileData.getFileExtension(file.getName()))) {
                             addFileToDeploy(file,
-                                            
deploymentEngine.getDeployerForExtension(extension));
+                                            
deploymentEngine.getDeployerForExtension(extension),WSInfo.TYPE_CUSTOM);
                         }
                     }
                 }
@@ -270,19 +271,19 @@
                 }
                 if (!file.isDirectory()) {
                     if 
(DeploymentFileData.isServiceArchiveFile(file.getName())) {
-                        addFileToDeploy(file, 
deploymentEngine.getServiceDeployer());
+                        addFileToDeploy(file, 
deploymentEngine.getServiceDeployer(),WSInfo.TYPE_SERVICE);
                     } else {
                         String ext = 
DeploymentFileData.getFileExtension(file.getName());
                         Deployer deployer = 
deploymentEngine.getDeployerForExtension(ext);
                         // If we found a deployer for this type of file, use 
it.  Otherwise
                         // ignore the file.
                         if (deployer != null) {
-                            addFileToDeploy(file, deployer);
+                            addFileToDeploy(file, 
deployer,WSInfo.TYPE_SERVICE);
                         }
                     }
                 } else {
                     if (!"lib".equalsIgnoreCase(file.getName())) {
-                        addFileToDeploy(file, 
deploymentEngine.getServiceDeployer());
+                        addFileToDeploy(file, 
deploymentEngine.getServiceDeployer(),WSInfo.TYPE_CUSTOM);
                     }
                 }
             }
@@ -292,7 +293,7 @@
     /** Method invoked from the scheduler to start the listener. */
     public void startListener() {
         checkServices();
-        update();
+//        update();
     }
/** Updates WSInfoList object. */
@@ -305,7 +306,7 @@
         update();
     }
- public void addFileToDeploy(File file, Deployer deployer) {
-        wsInfoList.addWSInfoItem(file, deployer);
+    public void addFileToDeploy(File file, Deployer deployer , int type) {
+        wsInfoList.addWSInfoItem(file, deployer ,type);
     }
 }

Modified: 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java?view=diff&rev=548855&r1=548854&r2=548855
==============================================================================
--- 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfo.java
 Tue Jun 19 14:03:21 2007
@@ -26,7 +26,7 @@
public static final int TYPE_SERVICE = 0;
     public static final int TYPE_MODULE = 1;
-    public static final int TYPE_CUSTOM_DEPLOYER_SERVICE = 2;
+    public static final int TYPE_CUSTOM = 2;
/**
      * To check whether the file is a module or a service
@@ -35,26 +35,11 @@
private Deployer deployer; - public WSInfo(String filename, long lastmodifieddate) {
-        this.fileName = filename;
-        this.lastModifiedDate = lastmodifieddate;
-    }
-
-
-    public WSInfo(String fileName, long lastModifiedDate, int type) {
-        this.fileName = fileName;
-        this.lastModifiedDate = lastModifiedDate;
-        this.type = type;
-    }
-
-    public WSInfo(String fileName, long lastModifiedDate, Deployer deployer) {
+    public WSInfo(String fileName, long lastModifiedDate, Deployer deployer 
,int type) {
         this.fileName = fileName;
         this.lastModifiedDate = lastModifiedDate;
         this.deployer = deployer;
-        //TODO: This is a temporary fix for the hot update in custom deployers
-        if (!(deployer instanceof ServiceDeployer)) {
-           this.type=TYPE_CUSTOM_DEPLOYER_SERVICE;
-        }
+        this.type = type;
     }
public String getFileName() {

Modified: 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java?view=diff&rev=548855&r1=548854&r2=548855
==============================================================================
--- 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
 Tue Jun 19 14:03:21 2007
@@ -22,11 +22,7 @@
 import org.apache.axis2.deployment.Deployer;
import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
+import java.util.*;
public class WSInfoList implements DeploymentConstants { @@ -38,14 +34,14 @@
     /**
      * All the currently updated jars
      */
-    public Set currentJars = new HashSet();
+    public Map currentJars = new HashMap();
/**
      * Reference to DeploymentEngine to make update
      */
-    private final DeploymentEngine deploymentEngine;
- private boolean check;
+    private boolean locked = false;
+    private final DeploymentEngine deploymentEngine;
public WSInfoList(DeploymentEngine deploy_engine) {
         deploymentEngine = deploy_engine;
@@ -64,20 +60,16 @@
      *
      * @param file actual jar files for either Module or service
      */
-    public synchronized void addWSInfoItem(File file, Deployer deployer) {
-        WSInfo info = getFileItem(file.getName());
-        if (info == null) {
-            info = new WSInfo(file.getName(), file.lastModified(), deployer);
-            jarList.add(info);
-            DeploymentFileData fileData = new DeploymentFileData(file, 
deployer);
-            deploymentEngine.addWSToDeploy(fileData);
-        } else if (deploymentEngine.isHotUpdate() && isModified(file, info)) {
+    public synchronized void addWSInfoItem(File file, Deployer deployer , int 
type) {
+        WSInfo info = getFileItem(file,deployer,type);
+        if (deploymentEngine.isHotUpdate() && isModified(file, info)) {
             info.setLastModifiedDate(file.lastModified());
-            WSInfo wsInfo = new WSInfo(info.getFileName(), 
info.getLastModifiedDate(), deployer);
+            WSInfo wsInfo = new WSInfo(info.getFileName(), 
info.getLastModifiedDate(), deployer,type);
             deploymentEngine.addWSToUndeploy(wsInfo);           // add entry 
to undeploy list
             DeploymentFileData deploymentFileData = new 
DeploymentFileData(file, deployer);
             deploymentEngine.addWSToDeploy(deploymentFileData);    // add 
entry to deploylist
         }
+        jarList.add(info.getFileName());
     }
/**
@@ -87,33 +79,40 @@
      * and that is hot undeployment.
      */
     private synchronized void checkForUndeployedServices() {
-        if (!check) {
+        if(!locked) {
+            locked = true;
+        } else{
             return;
-        } else {
-            check = false;
         }
-
-        Iterator iter = jarList.listIterator();
-        List tempvector = new ArrayList();
-
-        while (iter.hasNext()) {
-            WSInfo fileitem = (WSInfo) iter.next();
-            if (fileitem.getType() == WSInfo.TYPE_MODULE) {
+        Iterator infoItems = currentJars.keySet().iterator();
+        List tobeRemoved = new ArrayList();
+        while (infoItems.hasNext()) {
+            String  fileName = (String) infoItems.next();
+            WSInfo infoItem = (WSInfo) currentJars.get(fileName);
+            if (infoItem.getType() == WSInfo.TYPE_MODULE) {
                 continue;
             }
-            String itemName = fileitem.getFileName();
-            if (!currentJars.contains(itemName)) {
-                tempvector.add(fileitem);
-                WSInfo wsInfo = new WSInfo(fileitem.getFileName(), 
fileitem.getLastModifiedDate());
- deploymentEngine.addWSToUndeploy(wsInfo); + //seems like someone has deleted the file , so need to undeploy
+            boolean found = false;
+            for (int i = 0; i < jarList.size(); i++) {
+                String s = (String) jarList.get(i);
+                if(fileName.equals(s)){
+                    found = true;
+                }
+            }
+            if(!found){
+                tobeRemoved.add(fileName);
+                deploymentEngine.addWSToUndeploy(infoItem);
             }
         }
-        for (int i = 0; i < tempvector.size(); i++) {
-            WSInfo fileItem = (WSInfo) tempvector.get(i);
-            jarList.remove(fileItem);
+
+        for (int i = 0; i < tobeRemoved.size(); i++) {
+            String fileName = (String) tobeRemoved.get(i);
+            currentJars.remove(fileName);
         }
-        tempvector.clear();
-        currentJars.clear();
+        tobeRemoved.clear();
+        jarList.clear();
+        locked = false;
     }
/**
@@ -137,18 +136,17 @@
     /**
      * Gets the WSInfo object related to a file if it exists, null otherwise.
      *
-     * @param filename
      */
-    private WSInfo getFileItem(String filename) {
-        int sise = jarList.size();
-        for (int i = 0; i < sise; i++) {
-            WSInfo wsInfo = (WSInfo) jarList.get(i);
-
-            if (wsInfo.getFileName().equals(filename)) {
-                return wsInfo;
-            }
+    private WSInfo getFileItem(File file , Deployer deployer , int type) {
+        String fileName = file.getName();
+        WSInfo info = (WSInfo) currentJars.get(fileName);
+        if(info==null){
+            info = new WSInfo(file.getName(), file.lastModified(), deployer 
,type);
+            currentJars.put(file.getName(),info);
+            DeploymentFileData fileData = new DeploymentFileData(file, 
deployer);
+            deploymentEngine.addWSToDeploy(fileData);
         }
-        return null;
+        return info;
     }
/**



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to