Revision: 14654
          http://gate.svn.sourceforge.net/gate/?rev=14654&view=rev
Author:   markagreenwood
Date:     2011-12-04 10:06:09 +0000 (Sun, 04 Dec 2011)
Log Message:
-----------
only use URI for equals in the remote site as we shouldn't allow the same URI 
with two names, also remove the default update site

Modified Paths:
--------------
    gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java
    gate/trunk/src/gate/gui/creole/manager/RemoteUpdateSite.java

Modified: gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java
===================================================================
--- gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java     
2011-12-04 10:01:50 UTC (rev 14653)
+++ gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java     
2011-12-04 10:06:09 UTC (rev 14654)
@@ -145,7 +145,7 @@
   private void saveConfig() {
     Map<String, String> sites = new HashMap<String, String>();
     for(RemoteUpdateSite rus : updateSites) {
-      sites.put((rus.enabled ? "1" : "0") + rus.url.toString(), rus.name);
+      sites.put((rus.enabled ? "1" : "0") + rus.uri.toString(), rus.name);
     }
     OptionsMap userConfig = Gate.getUserConfig();
     userConfig.put(GATE_UPDATE_SITES, sites);
@@ -380,13 +380,13 @@
     }
     
     if(updateSites.size() == 0) {
-      try {
+      /*try {
         // TODO we need to change this to something more sensible
         updateSites.add(new RemoteUpdateSite("Default Test Site", new URI(
             "http://greenwoodma.servehttp.com/gate-plugins/";), true));
       } catch(URISyntaxException e) {
         // this can never happen!
-      }
+      }*/
     }
     
     setTitle("CREOLE Plugin Manager");
@@ -555,7 +555,7 @@
         if(row == -1) return;
         RemoteUpdateSite site = updateSites.get(row);
         txtName.setText(site.name);
-        txtURL.setText(site.url.toString());
+        txtURL.setText(site.uri.toString());
         if(JOptionPane.showConfirmDialog(PluginUpdateManager.this, pnlEdit,
             "Update Site Info", JOptionPane.OK_CANCEL_OPTION,
             JOptionPane.QUESTION_MESSAGE, new UpdateSiteIcon(48, 48)) != 
JOptionPane.OK_OPTION)
@@ -564,8 +564,8 @@
         if(txtURL.getText().trim().equals("")) return;
         try {
           URI url = new URI(txtURL.getText().trim());
-          if(!url.equals(site.url)) {
-            site.url = url;
+          if(!url.equals(site.uri)) {
+            site.uri = url;
             site.plugins = null;
           }
           site.name = txtName.getText().trim();
@@ -863,13 +863,13 @@
       switch(column){
         case 0:
           if(site.valid != null && !site.valid) return icoInvalid;
-          if(site.url.getHost().equals("gate.ac.uk")) return icoGATE;
+          if(site.uri.getHost().equals("gate.ac.uk")) return icoGATE;
           return icoSite;
         case 1:
           return site.enabled;
         case 2:
           return "<html><body>" + site.name
-              + "<br><span style='font-size: 80%;'>" + site.url
+              + "<br><span style='font-size: 80%;'>" + site.uri
               + "</span></body></html>";
         default:
           return null;

Modified: gate/trunk/src/gate/gui/creole/manager/RemoteUpdateSite.java
===================================================================
--- gate/trunk/src/gate/gui/creole/manager/RemoteUpdateSite.java        
2011-12-04 10:01:50 UTC (rev 14653)
+++ gate/trunk/src/gate/gui/creole/manager/RemoteUpdateSite.java        
2011-12-04 10:06:09 UTC (rev 14654)
@@ -24,9 +24,7 @@
 
 public class RemoteUpdateSite {
 
-  // TODO can we do this with URI instead so that we don't block on non-exist
-  // URLs, or ones that are timing out etc.
-  protected URI url;
+  protected URI uri;
 
   protected String name;
   
@@ -36,9 +34,9 @@
 
   protected transient List<CreolePlugin> plugins = null;
 
-  public RemoteUpdateSite(String name, URI url, boolean enabled) {
+  public RemoteUpdateSite(String name, URI uri, boolean enabled) {
     this.name = name;
-    this.url = url;
+    this.uri = uri;
     this.enabled = enabled;
   }
   
@@ -60,7 +58,7 @@
       xs.useAttributeFor(CreolePlugin.class, "gateMin");
       xs.useAttributeFor(CreolePlugin.class, "gateMax");
 
-      URLConnection conn = (new URL(url.toURL(), "site.xml")).openConnection();
+      URLConnection conn = (new URL(uri.toURL(), "site.xml")).openConnection();
       conn.setConnectTimeout(5000);
       conn.setReadTimeout(5000);
 
@@ -78,8 +76,7 @@
   public int hashCode() {
     final int prime = 31;
     int result = 1;
-    result = prime * result + ((name == null) ? 0 : name.hashCode());
-    result = prime * result + ((url == null) ? 0 : url.hashCode());
+    result = prime * result + ((uri == null) ? 0 : uri.hashCode());
     return result;
   }
 
@@ -89,12 +86,9 @@
     if(obj == null) return false;
     if(getClass() != obj.getClass()) return false;
     RemoteUpdateSite other = (RemoteUpdateSite)obj;
-    if(name == null) {
-      if(other.name != null) return false;
-    } else if(!name.equals(other.name)) return false;
-    if(url == null) {
-      if(other.url != null) return false;
-    } else if(!url.equals(other.url)) return false;
+    if(uri == null) {
+      if(other.uri != null) return false;
+    } else if(!uri.equals(other.uri)) return false;
     return true;
   }
 }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to