Author: jgao
Date: 2011-11-08 06:28:26 -0800 (Tue, 08 Nov 2011)
New Revision: 27429

Added:
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImpl.java
Modified:
   csplugins/trunk/soc/jgao/IDMapping/resources/plugin.props
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/CyThesaurusPlugin.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClient.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImplTunables.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientManager.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/IDMappingServiceSuppport.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/FileIDMappingClientConfigDialog.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/IDMappingSourceConfigDialog.form
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/IDMappingSourceConfigDialog.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/RDBIDMappingClientConfigDialog.java
   
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/WebserviceIDMappingClientConfigDialog.java
Log:
cythesaurus: disable session property

Modified: csplugins/trunk/soc/jgao/IDMapping/resources/plugin.props
===================================================================
--- csplugins/trunk/soc/jgao/IDMapping/resources/plugin.props   2011-11-08 
01:33:05 UTC (rev 27428)
+++ csplugins/trunk/soc/jgao/IDMapping/resources/plugin.props   2011-11-08 
14:28:26 UTC (rev 27429)
@@ -13,7 +13,7 @@
 pluginDescription=Provides utilities for mapping attributes of source ID types 
to new attributes of destination ID types. <a 
href="http://www.cytoscape.org/cgi-bin/moin.cgi/CyThesaurus_Plugin";>Click for 
more information</a>.
 
 # Plugin version number, this must be two numbers separated by a decimlal.  
Ex. 0.2, 14.03
-pluginVersion=1.30
+pluginVersion=1.31
 
 # Compatible Cytoscape version. If there are more than one version, seperate 
by ",".
 cytoscapeVersion=2.8

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/CyThesaurusPlugin.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/CyThesaurusPlugin.java
  2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/CyThesaurusPlugin.java
  2011-11-08 14:28:26 UTC (rev 27429)
@@ -65,7 +65,7 @@
  */
 public final class CyThesaurusPlugin extends CytoscapePlugin {
     public static Map mapSrcAttrIDTypes = null;
-    public static double VERSION = 1.20;
+    public static double VERSION = 1.31;
 
     public CyThesaurusPlugin() {
         try {
@@ -136,39 +136,39 @@
             }
         });
 
-        pcs.addPropertyChangeListener(Cytoscape.SESSION_SAVED,
-                new PropertyChangeListener() {
-            public void propertyChange(PropertyChangeEvent evt) {
-                // remove the old client but not the session properties
-                IDMapperClientManager.removeAllClients(false);
+//        pcs.addPropertyChangeListener(Cytoscape.SESSION_SAVED,
+//                new PropertyChangeListener() {
+//            public void propertyChange(PropertyChangeEvent evt) {
+//                // remove the old client but not the session properties
+//                IDMapperClientManager.removeAllClients(false);
+//
+//                // reload the clients for this session (change the prop 
prefix)
+//                IDMapperClientManager.reloadFromCytoscapeSessionProperties();
+//                IDMapperClientManager.reCache();
+//            }
+//        });
 
-                // reload the clients for this session (change the prop prefix)
-                IDMapperClientManager.reloadFromCytoscapeSessionProperties();
-                IDMapperClientManager.reCache();
-            }
-        });
+//        pcs.addPropertyChangeListener(Cytoscape.SESSION_LOADED,
+//                new PropertyChangeListener() {
+//            public void propertyChange(PropertyChangeEvent evt) {
+//                // remove the old client include session properties
+//                IDMapperClientManager.removeAllClients(true);
+//
+//                // reload the clients for this session
+//                IDMapperClientManager.reloadFromCytoscapeSessionProperties();
+//
+//                if (IDMapperClientManager.countClients()==0) {
+//                    // load the default clients if no client
+////                    
IDMapperClientManager.reloadFromCytoscapeGlobalProperties();
+//                    registerDefaultClients();
+//                }
+//
+//                IDMapperClientManager.reCache();
+//
+//                mapSrcAttrIDTypes = null;
+//            }
+//        });
 
-        pcs.addPropertyChangeListener(Cytoscape.SESSION_LOADED,
-                new PropertyChangeListener() {
-            public void propertyChange(PropertyChangeEvent evt) {
-                // remove the old client include session properties
-                IDMapperClientManager.removeAllClients(true);
-
-                // reload the clients for this session
-                IDMapperClientManager.reloadFromCytoscapeSessionProperties();
-
-                if (IDMapperClientManager.countClients()==0) {
-                    // load the default clients if no client
-//                    
IDMapperClientManager.reloadFromCytoscapeGlobalProperties();
-                    registerDefaultClients();
-                }
-
-                IDMapperClientManager.reCache();
-
-                mapSrcAttrIDTypes = null;
-            }
-        });
-
 //        pcs.addPropertyChangeListener(Cytoscape.PREFERENCE_MODIFIED,
 //                new PropertyChangeListener() {
 //            public void propertyChange(PropertyChangeEvent evt) {
@@ -183,9 +183,6 @@
 
     private void registerDefaultClients() {
         IDMapperClientManager.reloadFromCytoscapeGlobalProperties();
-//        if (IDMapperClientManager.countClients()==0) {
-//            IDMapperClientManager.registerDefaultClient();
-//        }
     }
 
     class IDMappingAction extends CytoscapeAction {

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClient.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClient.java 
    2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClient.java 
    2011-11-08 14:28:26 UTC (rev 27429)
@@ -81,7 +81,7 @@
 
     public ClientType getClientType();
 
-//    boolean isSelected();
-//
-//    void setSelected(boolean selected);
+    boolean isSelected();
+
+    void setSelected(boolean selected);
 }

Copied: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImpl.java
 (from rev 27337, 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImplTunables.java)
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImpl.java
                         (rev 0)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImpl.java
 2011-11-08 14:28:26 UTC (rev 27429)
@@ -0,0 +1,243 @@
+/*
+ Copyright (c) 2006, 2007, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications.  In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage.  See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package csplugins.id.mapping;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.bridgedb.BridgeDb;
+import org.bridgedb.DataSource;
+import org.bridgedb.IDMapper;
+import org.bridgedb.IDMapperCapabilities;
+import org.bridgedb.IDMapperException;
+
+/**
+ *
+ * @author gjj
+ */
+public class IDMapperClientImpl implements IDMapperClient {
+    protected IDMapper mapper = null;
+
+    protected String connectionString;
+    protected final String classString;
+    protected final String id;
+    protected final String displayName;
+    protected boolean selected;
+    protected final ClientType clientType;
+
+    protected static int clientNo = 0;
+
+    protected static final String CLIENT_ID = "id";
+    protected static final String CLIENT_DISPLAYNAME = "display-name";
+    protected static final String CLASS_STRING = "class-name";
+    protected static final String CONNECTION_STRING = "connection-string";
+    protected static final String SELECTED = "selected";
+    protected static final String CLIENT_TYPE = "client-type";
+
+    public static class Builder {
+        private String connectionString;
+        private String classString;
+
+        // optional parameters
+        private String displayName = null;
+        private String id = null;
+        private boolean selected = true;
+        private ClientType clientType = null;
+
+        public Builder(String connectionString, String classString) {
+            if (connectionString==null || classString==null) {
+                throw new IllegalArgumentException();
+            }
+            this.connectionString = connectionString;
+            this.classString = classString;
+        }
+
+        public Builder displayName(String displayName) {
+            this.displayName = displayName;
+            return this;
+        }
+
+        public Builder id(String id) {
+            this.id = id;
+            return this;
+        }
+
+        public Builder selected(boolean selected) {
+            this.selected = selected;
+            return this;
+        }
+
+        public Builder clientType(ClientType clientType) {
+            this.clientType = clientType;
+            return this;
+        }
+
+        public IDMapperClientImpl build()
+            throws IDMapperException, ClassNotFoundException {
+            return new IDMapperClientImpl(this);
+        }
+    }
+
+    private IDMapperClientImpl(Builder builder) 
+            throws IDMapperException, ClassNotFoundException {
+
+        //Class.forName(classString);
+        //mapper = BridgeDb.connect(connectionString);
+
+        String defId = builder.id==null?""+clientNo+"-"
+                +System.currentTimeMillis():builder.id;
+
+        ClientType defClientType = builder.clientType;
+        if (defClientType==null) {
+            Class.forName(builder.classString);
+            mapper = BridgeDb.connect(builder.connectionString);
+            defClientType = ClientType.getClientType(mapper);
+        }
+
+        this.id = defId;
+        this.displayName = builder.displayName;
+        this.classString = builder.classString;
+        this.connectionString = builder.connectionString;
+        this.selected= builder.selected;
+        this.clientType = defClientType;
+        
+        clientNo++;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public ClientType getClientType() {
+        return clientType;
+    }
+
+    public IDMapper getIDMapper() {
+        if (mapper==null) {
+            try {
+                Class.forName(getClassString());
+
+                ExecutorService executor = Executors.newSingleThreadExecutor();
+                executor.execute(new Runnable() {
+                    public void run() {
+                        try {
+                            mapper = BridgeDb.connect(getConnectionString());
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+
+                //TODO: how to set waiting time?
+                if (executor.awaitTermination(5, TimeUnit.SECONDS)) {
+                    executor.shutdown();
+                }
+
+                if (mapper == null) {
+                    System.err.println("Failed to connect to " + 
this.toString());
+                    return null;
+                }
+
+                preprocess(mapper);
+            } catch (Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+        }
+        return mapper;
+    }
+
+    /**
+     * set fullname of datasource as syscode if it is null
+     * in this plugin, fullname represents the datasource
+     * @param mapper
+     */
+    private static void preprocess(final IDMapper mapper) {
+        if (mapper==null)
+            return;
+
+        IDMapperCapabilities caps = mapper.getCapabilities();
+        Set<DataSource> dss = new HashSet();
+        try {
+            dss.addAll(caps.getSupportedSrcDataSources());
+            dss.addAll(caps.getSupportedTgtDataSources());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return;
+        }
+
+//        for (DataSource ds : dss) {
+//            if (ds.getFullName()==null) {
+//                String sysCode = ds.getSystemCode();
+//                DataSource.register(sysCode, sysCode);
+//            }
+//        }
+    }
+    
+    public String getConnectionString() {
+        return connectionString;
+    }
+
+    public void setConnectionString(String connectionString)
+            throws IDMapperException {
+        this.connectionString = connectionString;
+        mapper = null;
+    }
+    
+    public String getClassString() {
+        return classString;
+    }
+
+    @Override
+    public String toString() {
+        return this.getDisplayName();
+    }
+
+    public boolean isSelected() {
+        return selected;
+    }
+
+    public void setSelected(boolean selected) {
+        this.selected = selected;
+    }
+}

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImplTunables.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImplTunables.java
 2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientImplTunables.java
 2011-11-08 14:28:26 UTC (rev 27429)
@@ -303,11 +303,11 @@
         return props;
     }
 
-    boolean isSelected() {
+    public boolean isSelected() {
         return (Boolean)selected.getValue();
     }
 
-    void setSelected(boolean selected) {
+    public void setSelected(boolean selected) {
         this.selected.setValue(selected);
         props.saveProperties(this.selected);
     }

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientManager.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientManager.java
      2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientManager.java
      2011-11-08 14:28:26 UTC (rev 27429)
@@ -111,7 +111,7 @@
 
     private static ExecutorService executor = null;
 
-    private static int waitSeconds = 1;
+    private static int waitSeconds = 5;
 
     static {
 //        new IDMapperClientManager();
@@ -216,7 +216,7 @@
                 } else if (line.compareTo(CLIENT_END)==0) {
                     if (classStr!=null && connStr!=null) {
                         try {
-                            IDMapperClient client = new 
IDMapperClientImplTunables
+                            IDMapperClient client = new IDMapperClientImpl
                                     .Builder(connStr, classStr)
                                     .displayName(display)
                                     .id(clientId)
@@ -285,7 +285,7 @@
         String connStr = 
"idmapper-bridgerest:"+BridgeRestUtil.defaultBaseUrl+"/"+newDefaultSpecies;
         IDMapperClient client;
         try {
-            client = new IDMapperClientImplTunables
+            client = new IDMapperClientImpl
                                 .Builder(connStr, classPath)
                                 
.displayName("BridgeDb("+BridgeRestUtil.defaultBaseUrl+"/"+newDefaultSpecies+")")
                                 .selected(true)
@@ -455,9 +455,7 @@
             changed = selectedClients.remove(client);
 
         if (changed) {
-            if (client instanceof IDMapperClientImplTunables) {
-                ((IDMapperClientImplTunables)client).setSelected(select);
-            }
+            client.setSelected(select);
             fireIDMapperChange();
         }
     }
@@ -521,127 +519,134 @@
     }
 
     public static void cache() {
-        if (cacheStatus == CacheStatus.CACHED)
-            return;
+        synchronized(cacheStatus) {
+            if (cacheStatus == CacheStatus.CACHED)
+                return;
 
-        if (cacheStatus == CacheStatus.CACHING) {
-            if (executor.isTerminated()) {
-                cacheStatus = CacheStatus.CACHED;
+            if (cacheStatus == CacheStatus.CACHING) {
+                if (executor.isTerminated()) {
+                    cacheStatus = CacheStatus.CACHED;
+                }
+                return;
             }
-            return;
+
+            cacheStatus = CacheStatus.CACHING;
         }
 
-        cacheStatus = CacheStatus.CACHING;
-
         selectedIDMapperStack = new IDMapperStack();
         srcTypes = Collections.synchronizedSet(new 
HashSet<DataSourceWrapper>());
         tgtTypes = Collections.synchronizedSet(new 
HashSet<DataSourceWrapper>());
         supportedMapping = Collections.synchronizedSet(new 
HashSet<List<DataSourceWrapper>>());
 
-        executor = Executors.newCachedThreadPool();
+        try {
+            executor = Executors.newCachedThreadPool();
 
-        for (IDMapperClient client : selectedClients()) {
-            final IDMapper idMapper = client.getIDMapper();
-            if (idMapper==null)
-                continue;
+            for (IDMapperClient client : selectedClients()) {
+                final IDMapper idMapper = client.getIDMapper();
+                if (idMapper==null)
+                    continue;
 
-            //selectedIDMapperStack
-            selectedIDMapperStack.addIDMapper(idMapper);
+                //selectedIDMapperStack
+                selectedIDMapperStack.addIDMapper(idMapper);
 
-            executor.execute(new Runnable() {
-                public void run() {
-                    IDMapperCapabilities caps = idMapper.getCapabilities();
+                executor.execute(new Runnable() {
+                    public void run() {
+                        IDMapperCapabilities caps = idMapper.getCapabilities();
 
-                    Set<DataSource> srcs, tgts;
-                    try {
-                        srcs = caps.getSupportedSrcDataSources();
-                        tgts = caps.getSupportedTgtDataSources();
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                        return;
-                    }
+                        Set<DataSource> srcs, tgts;
+                        try {
+                            srcs = caps.getSupportedSrcDataSources();
+                            tgts = caps.getSupportedTgtDataSources();
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            return;
+                        }
 
-                    // srcTypes
-                    if (srcs!=null) {
-                        for (DataSource ds : srcs) {
-                            srcTypes.add(DataSourceWrapper.getInstance(
-                                    DataSourceUtil.getName(ds), 
DataSourceWrapper.DsAttr.DATASOURCE));
+                        // srcTypes
+                        if (srcs!=null) {
+                            for (DataSource ds : srcs) {
+                                srcTypes.add(DataSourceWrapper.getInstance(
+                                        DataSourceUtil.getName(ds), 
DataSourceWrapper.DsAttr.DATASOURCE));
+                            }
                         }
-                    }
 
-                    // tgtTypes
-                    if (tgts!=null) {
-                        for (DataSource ds : tgts) {
-                            tgtTypes.add(DataSourceWrapper.getInstance(
-                                    DataSourceUtil.getName(ds), 
DataSourceWrapper.DsAttr.DATASOURCE));
+                        // tgtTypes
+                        if (tgts!=null) {
+                            for (DataSource ds : tgts) {
+                                tgtTypes.add(DataSourceWrapper.getInstance(
+                                        DataSourceUtil.getName(ds), 
DataSourceWrapper.DsAttr.DATASOURCE));
+                            }
                         }
-                    }
 
-                    // mapping from type to type
-                    if (srcs!=null && tgts!=null) {
-                        for (DataSource src : srcs) {
-                            for (DataSource tgt : tgts) {
-                                boolean spt = false;
-                                try {
-                                    spt = caps.isMappingSupported(src, tgt);
-                                } catch (Exception e) {
-                                    e.printStackTrace();
+                        // mapping from type to type
+                        if (srcs!=null && tgts!=null) {
+                            for (DataSource src : srcs) {
+                                for (DataSource tgt : tgts) {
+                                    boolean spt = false;
+                                    try {
+                                        spt = caps.isMappingSupported(src, 
tgt);
+                                    } catch (Exception e) {
+                                        e.printStackTrace();
+                                    }
+                                    if (spt) {
+                                        List<DataSourceWrapper> dsws = new 
ArrayList<DataSourceWrapper>(2);
+                                        dsws.add(DataSourceWrapper.getInstance(
+                                            DataSourceUtil.getName(src), 
DataSourceWrapper.DsAttr.DATASOURCE));
+                                        dsws.add(DataSourceWrapper.getInstance(
+                                            DataSourceUtil.getName(tgt), 
DataSourceWrapper.DsAttr.DATASOURCE));
+                                        supportedMapping.add(dsws);
+                                    }
                                 }
-                                if (spt) {
-                                    List<DataSourceWrapper> dsws = new 
ArrayList<DataSourceWrapper>(2);
-                                    dsws.add(DataSourceWrapper.getInstance(
-                                        DataSourceUtil.getName(src), 
DataSourceWrapper.DsAttr.DATASOURCE));
-                                    dsws.add(DataSourceWrapper.getInstance(
-                                        DataSourceUtil.getName(tgt), 
DataSourceWrapper.DsAttr.DATASOURCE));
-                                    supportedMapping.add(dsws);
-                                }
                             }
                         }
-                    }
 
-                    // AttributeMapper
-                    if (!(idMapper instanceof AttributeMapper))
-                        return;
+                        // AttributeMapper
+                        if (!(idMapper instanceof AttributeMapper))
+                            return;
 
-                    AttributeMapper attrMapper = (AttributeMapper)idMapper;
-                    Set<String> attrs = null;
-                    try {
-                        attrs = attrMapper.getAttributeSet();
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
+                        AttributeMapper attrMapper = (AttributeMapper)idMapper;
+                        Set<String> attrs = null;
+                        try {
+                            attrs = attrMapper.getAttributeSet();
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
 
-                    if (attrs==null)
-                        return;
-                    
-                    for (String attr : attrs) {
-                        DataSourceWrapper dsw = 
DataSourceWrapper.getInstance(attr, DataSourceWrapper.DsAttr.ATTRIBUTE);
-                        if (attrMapper.isFreeAttributeSearchSupported()) {
-                            srcTypes.add(dsw);
-                            if (tgts!=null) {
-                                for (DataSource tgt : tgts) {
+                        if (attrs==null)
+                            return;
+
+                        for (String attr : attrs) {
+                            DataSourceWrapper dsw = 
DataSourceWrapper.getInstance(attr, DataSourceWrapper.DsAttr.ATTRIBUTE);
+                            if (attrMapper.isFreeAttributeSearchSupported()) {
+                                srcTypes.add(dsw);
+                                if (tgts!=null) {
+                                    for (DataSource tgt : tgts) {
+                                        List<DataSourceWrapper> dsws = new 
ArrayList<DataSourceWrapper>(2);
+                                        dsws.add(dsw);
+                                        dsws.add(DataSourceWrapper.getInstance(
+                                            tgt.getFullName(), 
DataSourceWrapper.DsAttr.DATASOURCE));
+                                        supportedMapping.add(dsws);
+                                    }
+                                }
+                            }
+
+                            tgtTypes.add(dsw);
+                            if (srcs!=null) {
+                                for (DataSource src : srcs) {
                                     List<DataSourceWrapper> dsws = new 
ArrayList<DataSourceWrapper>(2);
+                                    dsws.add(DataSourceWrapper.getInstance(
+                                        src.getFullName(), 
DataSourceWrapper.DsAttr.DATASOURCE));
                                     dsws.add(dsw);
-                                    dsws.add(DataSourceWrapper.getInstance(
-                                        tgt.getFullName(), 
DataSourceWrapper.DsAttr.DATASOURCE));
                                     supportedMapping.add(dsws);
                                 }
                             }
                         }
-
-                        tgtTypes.add(dsw);
-                        if (srcs!=null) {
-                            for (DataSource src : srcs) {
-                                List<DataSourceWrapper> dsws = new 
ArrayList<DataSourceWrapper>(2);
-                                dsws.add(DataSourceWrapper.getInstance(
-                                    src.getFullName(), 
DataSourceWrapper.DsAttr.DATASOURCE));
-                                dsws.add(dsw);
-                                supportedMapping.add(dsws);
-                            }
-                        }
                     }
-                }
-            });
+                });
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            cacheStatus = CacheStatus.UNCACHED;
         }
     }
 }

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
       2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
       2011-11-08 14:28:26 UTC (rev 27429)
@@ -33,7 +33,7 @@
 
 import csplugins.id.mapping.CyThesaurusPlugin;
 import csplugins.id.mapping.IDMapperClient;
-import csplugins.id.mapping.IDMapperClientImplTunables;
+import csplugins.id.mapping.IDMapperClientImpl;
 import csplugins.id.mapping.IDMapperClientManager;
 import csplugins.id.mapping.ui.IDMappingSourceConfigDialog;
 import csplugins.id.mapping.ui.CyThesaurusDialog;
@@ -292,7 +292,7 @@
             displayName = connString;
 
         try {
-            IDMapperClient client = new IDMapperClientImplTunables
+            IDMapperClient client = new IDMapperClientImpl
                             .Builder(connString, classPath)
                             .displayName(displayName)
                             .build();

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/IDMappingServiceSuppport.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/IDMappingServiceSuppport.java
   2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/IDMappingServiceSuppport.java
   2011-11-08 14:28:26 UTC (rev 27429)
@@ -39,7 +39,7 @@
 import csplugins.id.mapping.CyThesaurusPlugin;
 import csplugins.id.mapping.FinalStaticValues;
 import csplugins.id.mapping.IDMapperClient;
-import csplugins.id.mapping.IDMapperClientImplTunables;
+import csplugins.id.mapping.IDMapperClientImpl;
 import csplugins.id.mapping.IDMapperClientManager;
 import csplugins.id.mapping.util.DataSourceUtil;
 import csplugins.id.mapping.util.DataSourceWrapper;
@@ -265,7 +265,7 @@
         } else {
             IDMapperClient client = null;
             try {
-                client = new IDMapperClientImplTunables
+                client = new IDMapperClientImpl
                                 .Builder(connStr, classPath)
                                 .displayName(display)
                                 .build();

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/FileIDMappingClientConfigDialog.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/FileIDMappingClientConfigDialog.java
 2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/FileIDMappingClientConfigDialog.java
 2011-11-08 14:28:26 UTC (rev 27429)
@@ -36,7 +36,7 @@
 package csplugins.id.mapping.ui;
 
 import csplugins.id.mapping.IDMapperClient;
-import csplugins.id.mapping.IDMapperClientImplTunables;
+import csplugins.id.mapping.IDMapperClientImpl;
 
 import cytoscape.util.CyFileFilter;
 import cytoscape.util.FileUtil;
@@ -836,7 +836,7 @@
             throws IDMapperException, ClassNotFoundException {
         String url = textFileTextField.getText();
 
-        return new IDMapperClientImplTunables
+        return new IDMapperClientImpl
                         .Builder(getConnectionString(), 
"org.bridgedb.file.IDMapperText")
                         .displayName(url)
                         .build();

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/IDMappingSourceConfigDialog.form
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/IDMappingSourceConfigDialog.form
     2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/IDMappingSourceConfigDialog.form
     2011-11-08 14:28:26 UTC (rev 27429)
@@ -123,6 +123,7 @@
     </Container>
     <Container class="javax.swing.JPanel" name="defaultPanel">
       <AuxValues>
+        <AuxValue name="JavaCodeGenerator_InitCodePre" type="java.lang.String" 
value="defaultPanel.setVisible(false);"/>
         <AuxValue name="JavaCodeGenerator_VariableLocal" 
type="java.lang.Boolean" value="true"/>
         <AuxValue name="JavaCodeGenerator_VariableModifier" 
type="java.lang.Integer" value="0"/>
       </AuxValues>

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/IDMappingSourceConfigDialog.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/IDMappingSourceConfigDialog.java
     2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/IDMappingSourceConfigDialog.java
     2011-11-08 14:28:26 UTC (rev 27429)
@@ -193,6 +193,8 @@
         gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
         getContentPane().add(sourceConfPanel, gridBagConstraints);
 
+        defaultPanel.setVisible(false);
+
         loadDefaultButton.setText("Load default resources");
         loadDefaultButton.addActionListener(new 
java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -241,6 +243,13 @@
     private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) 
{//GEN-FIRST:event_closeButtonActionPerformed
         setVisible(false);
         this.dispose();
+        try {
+            if (srcTree.isModified())
+                IDMapperClientManager.saveCurrentToCytoscapeGlobalProperties();
+        } catch (Exception e) {
+            e.printStackTrace();
+            JOptionPane.showMessageDialog(this, "Failed to save the current 
resources.");
+        }
 }//GEN-LAST:event_closeButtonActionPerformed
 
     private void saveAsDefaultButtonActionPerformed(java.awt.event.ActionEvent 
evt) {//GEN-FIRST:event_saveAsDefaultButtonActionPerformed

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/RDBIDMappingClientConfigDialog.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/RDBIDMappingClientConfigDialog.java
  2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/RDBIDMappingClientConfigDialog.java
  2011-11-08 14:28:26 UTC (rev 27429)
@@ -36,7 +36,7 @@
 package csplugins.id.mapping.ui;
 
 import csplugins.id.mapping.IDMapperClient;
-import csplugins.id.mapping.IDMapperClientImplTunables;
+import csplugins.id.mapping.IDMapperClientImpl;
 
 import org.bridgedb.IDMapperException;
 import org.bridgedb.rdb.IDMapperRdb;
@@ -218,7 +218,7 @@
         String className = strs[1];
         String displayName = strs[2];
 
-        return new IDMapperClientImplTunables
+        return new IDMapperClientImpl
                         .Builder(connStr, className)
                         .displayName(displayName)
                         .build();        

Modified: 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/WebserviceIDMappingClientConfigDialog.java
===================================================================
--- 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/WebserviceIDMappingClientConfigDialog.java
   2011-11-08 01:33:05 UTC (rev 27428)
+++ 
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/ui/WebserviceIDMappingClientConfigDialog.java
   2011-11-08 14:28:26 UTC (rev 27429)
@@ -36,7 +36,7 @@
 package csplugins.id.mapping.ui;
 
 import csplugins.id.mapping.IDMapperClient;
-import csplugins.id.mapping.IDMapperClientImplTunables;
+import csplugins.id.mapping.IDMapperClientImpl;
 import csplugins.id.mapping.util.BridgeRestUtil;
 
 import cytoscape.task.Task;
@@ -979,7 +979,7 @@
         String className = strs[1];
         String displayName = strs[2];
 
-        return new IDMapperClientImplTunables
+        return new IDMapperClientImpl
                         .Builder(connStr, className)
                         .displayName(displayName)
                         .build();

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to