r26562 - in core3: api/trunk/application-api/src/main/java/org/cytoscape/application api/trunk/property-api/src/main/java/org/cytoscape/property impl/trunk/application-impl/src/main/java/org/cytoscape/application/internal impl/trunk/application-impl/src/main/resources/META-INF/spring impl/trunk/core-task-impl impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource impl/trunk/core-task-impl/src/main/resources/META-INF/spring impl/trunk/core-task-impl/src/test/java/org/cytoscape/task/internal/quickstart/remote impl/trunk/ding-impl/ding-customgraphics-manager-impl impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/java/org/cytoscape/ding/impl/customgraphics impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring impl/trunk/io-impl/src/main/java/org/cytoscape/io/internal/util impl/trunk/io-impl/src/main/resources/META-INF/spring impl/trunk/linkout-impl/src/main/java/org/cytoscape/linkout/inte! rnal impl/trunk/linkout-impl/src/main/resources/META-INF/spring impl/trunk/plugin-impl impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/shutdown impl/trunk/swing-application-impl/src/main/resources/META-INF/spring impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring

Mon, 15 Aug 2011 16:36:25 -0700

Author: kono
Date: 2011-08-15 16:36:16 -0700 (Mon, 15 Aug 2011)
New Revision: 26562

Added:
   
core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationConfiguration.java
   
core3/impl/trunk/application-impl/src/main/java/org/cytoscape/application/internal/CyApplicationConfigurationImpl.java
Modified:
   
core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationManager.java
   
core3/api/trunk/property-api/src/main/java/org/cytoscape/property/CyProperty.java
   
core3/impl/trunk/application-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/impl/trunk/application-impl/src/main/resources/META-INF/spring/bundle-context.xml
   core3/impl/trunk/core-task-impl/pom.xml
   
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource/AbstractFilePreprocessor.java
   
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource/BioGridPreprocessor.java
   
core3/impl/trunk/core-task-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/impl/trunk/core-task-impl/src/main/resources/META-INF/spring/bundle-context.xml
   
core3/impl/trunk/core-task-impl/src/test/java/org/cytoscape/task/internal/quickstart/remote/BioGridPreprocessorTest.java
   core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/pom.xml
   
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/java/org/cytoscape/ding/impl/customgraphics/CustomGraphicsManagerImpl.java
   
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring/bundle-context.xml
   
core3/impl/trunk/io-impl/src/main/java/org/cytoscape/io/internal/util/RecentlyOpenedTrackerImpl.java
   
core3/impl/trunk/io-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/impl/trunk/io-impl/src/main/resources/META-INF/spring/bundle-context.xml
   
core3/impl/trunk/linkout-impl/src/main/java/org/cytoscape/linkout/internal/LinkOut.java
   
core3/impl/trunk/linkout-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/impl/trunk/linkout-impl/src/main/resources/META-INF/spring/bundle-context.xml
   core3/impl/trunk/plugin-impl/pom.xml
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/PluginManager.java
   
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
   
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyOperatingContextImpl.java
   
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/shutdown/ConfigDirPropertyWriter.java
   
core3/impl/trunk/swing-application-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/impl/trunk/swing-application-impl/src/main/resources/META-INF/spring/bundle-context.xml
   
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTask.java
   
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTaskFactory.java
   
core3/impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
   
core3/impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
Log:
CyApplicationConfiguration Interface and its implementation had been added.  
Configuration directory (.cytoscape) will be provided here.  Current 
implementation only supports get method, and it always returns 
USER_HOME_DIRECTORY/.cytoscape as the config dir.

Added: 
core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationConfiguration.java
===================================================================
--- 
core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationConfiguration.java
                             (rev 0)
+++ 
core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationConfiguration.java
     2011-08-15 23:36:16 UTC (rev 26562)
@@ -0,0 +1,23 @@
+package org.cytoscape.application;
+
+import java.io.File;
+
+/**
+ * Application-wide setting will be accessible through this interface.
+ *
+ */
+public interface CyApplicationConfiguration {
+       
+       public static final String DEFAULT_CONFIG_DIR = ".cytoscape";
+
+       /**
+        * Returns absolute path to .cytoscape location.
+        * By default, this is user's home directory.
+        * 
+        * @return location of .cytoscape setting directory.
+        * 
+        * TODO: How can we set this location?
+        */
+       File getSettingLocation();
+
+}

Modified: 
core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationManager.java
===================================================================
--- 
core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationManager.java
   2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/api/trunk/application-api/src/main/java/org/cytoscape/application/CyApplicationManager.java
   2011-08-15 23:36:16 UTC (rev 26562)
@@ -30,7 +30,10 @@
 package org.cytoscape.application;
 
 
+import java.io.File;
+import java.net.URL;
 import java.util.List;
+import java.util.Set;
 
 import org.cytoscape.model.CyNetwork;
 import org.cytoscape.model.CyTable;
@@ -43,6 +46,7 @@
  * views and rendering engines in an instance of Cytoscape.
  */
 public interface CyApplicationManager {
+       
        /**
         * Provides access to the current network.
         * @return the current network or null if there is no current network
@@ -117,4 +121,6 @@
         * @param table The table that should be made current.
         */
        public void setCurrentTable(CyTable table);
+       
+       
 }

Modified: 
core3/api/trunk/property-api/src/main/java/org/cytoscape/property/CyProperty.java
===================================================================
--- 
core3/api/trunk/property-api/src/main/java/org/cytoscape/property/CyProperty.java
   2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/api/trunk/property-api/src/main/java/org/cytoscape/property/CyProperty.java
   2011-08-15 23:36:16 UTC (rev 26562)
@@ -10,7 +10,6 @@
  * property objects of other types to be registered in this way as well.
  */
 public interface CyProperty<P> {
-       public static final String DEFAULT_CONFIG_DIR = ".cytoscape";
 
        enum SavePolicy {
                /** These properties are preset by Cytoscape to some default 
value and

Added: 
core3/impl/trunk/application-impl/src/main/java/org/cytoscape/application/internal/CyApplicationConfigurationImpl.java
===================================================================
--- 
core3/impl/trunk/application-impl/src/main/java/org/cytoscape/application/internal/CyApplicationConfigurationImpl.java
                              (rev 0)
+++ 
core3/impl/trunk/application-impl/src/main/java/org/cytoscape/application/internal/CyApplicationConfigurationImpl.java
      2011-08-15 23:36:16 UTC (rev 26562)
@@ -0,0 +1,34 @@
+package org.cytoscape.application.internal;
+
+import java.io.File;
+
+import org.cytoscape.application.CyApplicationConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CyApplicationConfigurationImpl implements 
CyApplicationConfiguration {
+       
+       private static final Logger logger = 
LoggerFactory.getLogger(CyApplicationConfigurationImpl.class);
+       
+       private static final String DEF_USER_DIR = 
System.getProperty("user.home");
+       
+       private final File configFileLocation;
+       
+       public CyApplicationConfigurationImpl() {
+               configFileLocation = new File(DEF_USER_DIR, DEFAULT_CONFIG_DIR);
+               
+               if(configFileLocation.exists() == false) {
+                       configFileLocation.mkdir();
+                       logger.warn(".cytoscape directory was not available.  
New directory created.");
+               } else {
+                       logger.info("Setting file directory = " + 
configFileLocation.getAbsolutePath());
+               }
+               
+       }
+
+       @Override
+       public File getSettingLocation() {
+               return configFileLocation;      
+       }
+
+}

Modified: 
core3/impl/trunk/application-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/impl/trunk/application-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
        2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/application-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
        2011-08-15 23:36:16 UTC (rev 26562)
@@ -17,6 +17,7 @@
 
        <osgi:service id="cytoscapeShutdownService" ref="cytoscapeShutdown" 
auto-export="interfaces" />
        <osgi:service id="cytoscapeVersionService" ref="cytoscapeVersion" 
auto-export="interfaces" />
+       <osgi:service id="cyApplicationConfigurationService" 
ref="cyApplicationConfiguration" auto-export="interfaces" />
 
        <osgi:reference id="cyEventHelperServiceRef" 
interface="org.cytoscape.event.CyEventHelper" />
        <osgi:reference id="cyNetworkManagerServiceRef"

Modified: 
core3/impl/trunk/application-impl/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/impl/trunk/application-impl/src/main/resources/META-INF/spring/bundle-context.xml
     2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/application-impl/src/main/resources/META-INF/spring/bundle-context.xml
     2011-08-15 23:36:16 UTC (rev 26562)
@@ -39,5 +39,7 @@
        <bean name="cytoscapeShutdown" 
class="org.cytoscape.application.internal.ShutdownHandler">
                <constructor-arg ref="cyEventHelperServiceRef" />
        </bean>
+       
+       <bean id="cyApplicationConfiguration" 
class="org.cytoscape.application.internal.CyApplicationConfigurationImpl" />
 
 </beans>

Modified: core3/impl/trunk/core-task-impl/pom.xml
===================================================================
--- core3/impl/trunk/core-task-impl/pom.xml     2011-08-15 19:26:46 UTC (rev 
26561)
+++ core3/impl/trunk/core-task-impl/pom.xml     2011-08-15 23:36:16 UTC (rev 
26562)
@@ -121,6 +121,10 @@
                        <groupId>org.cytoscape</groupId>
                        <artifactId>layout-api</artifactId>
                </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>application-api</artifactId>
+               </dependency>
 
 
                <!-- Test Dependencies -->

Modified: 
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource/AbstractFilePreprocessor.java
===================================================================
--- 
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource/AbstractFilePreprocessor.java
       2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource/AbstractFilePreprocessor.java
       2011-08-15 23:36:16 UTC (rev 26562)
@@ -13,6 +13,7 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.property.CyProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -22,7 +23,6 @@
        private static final Logger logger = 
LoggerFactory.getLogger(AbstractFilePreprocessor.class);
        
        private static final String INTERACTION_DIR_NAME = "interactions";
-       private static final String DEF_USER_DIR = 
System.getProperty("user.home");
        
        protected final Map<String, URL> sourceMap;
        protected LineProcessor processor;
@@ -30,7 +30,7 @@
        protected final File dataFileDirectory;
 
        
-       public AbstractFilePreprocessor(final CyProperty<Properties> 
properties) {
+       public AbstractFilePreprocessor(final CyProperty<Properties> 
properties, final CyApplicationConfiguration config) {
                if (properties == null)
                        throw new NullPointerException("Property service is 
null.");
 
@@ -39,12 +39,7 @@
                if (props == null)
                        throw new NullPointerException("Property is missing.");
 
-               String configDirectory = 
props.getProperty(CyProperty.DEFAULT_CONFIG_DIR);
-               if (configDirectory == null || configDirectory.trim().length() 
== 0)
-                       configDirectory = DEF_USER_DIR;
-
-               final File configFileLocation = new File(configDirectory, 
CyProperty.DEFAULT_CONFIG_DIR);
-               this.dataFileDirectory = new File(configFileLocation, 
INTERACTION_DIR_NAME);
+               this.dataFileDirectory = new File(config.getSettingLocation(), 
INTERACTION_DIR_NAME);
                if (!dataFileDirectory.exists())
                        dataFileDirectory.mkdir();
                

Modified: 
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource/BioGridPreprocessor.java
===================================================================
--- 
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource/BioGridPreprocessor.java
    2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/quickstart/datasource/BioGridPreprocessor.java
    2011-08-15 23:36:16 UTC (rev 26562)
@@ -9,6 +9,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.property.CyProperty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -23,8 +24,8 @@
 
        private boolean isLatest;
 
-       public BioGridPreprocessor(final CyProperty<Properties> properties) {
-               super(properties);
+       public BioGridPreprocessor(final CyProperty<Properties> properties, 
final CyApplicationConfiguration config) {
+               super(properties, config);
                
                this.isLatest = false;
 

Modified: 
core3/impl/trunk/core-task-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/impl/trunk/core-task-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
  2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/core-task-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
  2011-08-15 23:36:16 UTC (rev 26562)
@@ -7,6 +7,7 @@
 
        <!-- collect necessary services -->
        <osgi:reference id="cyEventHelperRef" 
interface="org.cytoscape.event.CyEventHelper" />
+       <osgi:reference id="cyApplicationConfigurationServiceRef" 
interface="org.cytoscape.application.CyApplicationConfiguration" />
        
        <osgi:reference id="recentlyOpenedTrackerServiceRef" 
interface="org.cytoscape.io.util.RecentlyOpenedTracker" />
 

Modified: 
core3/impl/trunk/core-task-impl/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/impl/trunk/core-task-impl/src/main/resources/META-INF/spring/bundle-context.xml
       2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/core-task-impl/src/main/resources/META-INF/spring/bundle-context.xml
       2011-08-15 23:36:16 UTC (rev 26562)
@@ -426,6 +426,7 @@
        <bean id="bioGridPreprocessor"
                
class="org.cytoscape.task.internal.quickstart.datasource.BioGridPreprocessor">
                <constructor-arg ref="cyPropertyServiceRef" />
+               <constructor-arg ref="cyApplicationConfigurationServiceRef" />
        </bean>
 
 

Modified: 
core3/impl/trunk/core-task-impl/src/test/java/org/cytoscape/task/internal/quickstart/remote/BioGridPreprocessorTest.java
===================================================================
--- 
core3/impl/trunk/core-task-impl/src/test/java/org/cytoscape/task/internal/quickstart/remote/BioGridPreprocessorTest.java
    2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/core-task-impl/src/test/java/org/cytoscape/task/internal/quickstart/remote/BioGridPreprocessorTest.java
    2011-08-15 23:36:16 UTC (rev 26562)
@@ -5,6 +5,7 @@
 import java.io.File;
 import java.util.Properties;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.property.CyProperty;
 import org.cytoscape.task.internal.quickstart.datasource.BioGridPreprocessor;
 import org.junit.After;
@@ -17,6 +18,9 @@
 
        @Mock
        CyProperty<Properties> properties;
+       
+       @Mock
+       CyApplicationConfiguration config;
 
        @Before
        public void setUp() throws Exception {
@@ -33,7 +37,7 @@
        @Test
        public void bioGridPreprocessorTest() throws Exception {
                final File file = new 
File("src/test/resources/BIOGRID-ORGANISM-3.1.74.mitab.zip");
-               final BioGridPreprocessor processor = new 
BioGridPreprocessor(properties);
+               final BioGridPreprocessor processor = new 
BioGridPreprocessor(properties, config);
 
                processor.setSource(file.toURI().toURL());
                processor.processFile();

Modified: core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/pom.xml
===================================================================
--- core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/pom.xml 
2011-08-15 19:26:46 UTC (rev 26561)
+++ core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/pom.xml 
2011-08-15 23:36:16 UTC (rev 26562)
@@ -13,7 +13,6 @@
        </properties>
 
        <modelVersion>4.0.0</modelVersion>
-       <groupId>org.cytoscape</groupId>
        <artifactId>ding-customgraphics-manager-impl</artifactId>
 
        <name>${bundle.symbolicName}</name>

Modified: 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/java/org/cytoscape/ding/impl/customgraphics/CustomGraphicsManagerImpl.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/java/org/cytoscape/ding/impl/customgraphics/CustomGraphicsManagerImpl.java
     2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/java/org/cytoscape/ding/impl/customgraphics/CustomGraphicsManagerImpl.java
     2011-08-15 23:36:16 UTC (rev 26562)
@@ -10,6 +10,7 @@
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.application.events.CytoscapeShutdownEvent;
 import org.cytoscape.application.events.CytoscapeShutdownListener;
 import org.cytoscape.ding.customgraphics.CustomGraphicsManager;
@@ -48,7 +49,7 @@
         * Creates an image pool object and restore existing images from user
         * resource directory.
         */
-       public CustomGraphicsManagerImpl(final CyProperty<Properties> 
properties, final TaskManager taskManager) {
+       public CustomGraphicsManagerImpl(final CyProperty<Properties> 
properties, final TaskManager taskManager, final CyApplicationConfiguration 
config) {
                
                this.taskManager = taskManager;
                this.isUsedCustomGraphics = new HashMap<CyCustomGraphics, 
Boolean>();
@@ -61,13 +62,8 @@
                if(props == null)
                        throw new NullPointerException("Property is missing.");
                
-               String configDirectory = 
props.getProperty(CyProperty.DEFAULT_CONFIG_DIR);
-               if(configDirectory == null || configDirectory.trim().length() 
== 0)
-                       configDirectory = System.getProperty("user.home");
+               this.imageHomeDirectory = new File(config.getSettingLocation(), 
IMAGE_DIR_NAME);
                
-               final File configFileLocation = new File(configDirectory, 
CyProperty.DEFAULT_CONFIG_DIR);
-               this.imageHomeDirectory = new File(configFileLocation, 
IMAGE_DIR_NAME);
-               
                logger.debug("\n!!!!!!!!!!!!!!!!! Cytoscape image directory: " 
+ imageHomeDirectory.toString());
 
                graphicsMap.put(NULL.getIdentifier(), NULL);

Modified: 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
      2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
      2011-08-15 23:36:16 UTC (rev 26562)
@@ -19,4 +19,7 @@
        
        <osgi:service id="customGraphicsManagerActionService" 
ref="customGraphicsManagerAction"
                interface="org.cytoscape.application.swing.CyAction" />
+               
+       <osgi:reference id="cyApplicationConfigurationServiceRef" 
interface="org.cytoscape.application.CyApplicationConfiguration" />
+       
 </beans>
\ No newline at end of file

Modified: 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring/bundle-context.xml
   2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/ding-impl/ding-customgraphics-manager-impl/src/main/resources/META-INF/spring/bundle-context.xml
   2011-08-15 23:36:16 UTC (rev 26562)
@@ -8,6 +8,7 @@
                
class="org.cytoscape.ding.impl.customgraphics.CustomGraphicsManagerImpl">
                <constructor-arg ref="coreCyPropertyServiceRef" />
                <constructor-arg ref="guiTaskManagerServiceRef" />
+               <constructor-arg ref="cyApplicationConfigurationServiceRef" />
        </bean>
        
        <bean id="customGraphicsManagerAction" 
class="org.cytoscape.ding.impl.customgraphics.action.CustomGraphicsManagerAction">

Modified: 
core3/impl/trunk/io-impl/src/main/java/org/cytoscape/io/internal/util/RecentlyOpenedTrackerImpl.java
===================================================================
--- 
core3/impl/trunk/io-impl/src/main/java/org/cytoscape/io/internal/util/RecentlyOpenedTrackerImpl.java
        2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/io-impl/src/main/java/org/cytoscape/io/internal/util/RecentlyOpenedTrackerImpl.java
        2011-08-15 23:36:16 UTC (rev 26562)
@@ -11,6 +11,7 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.io.util.RecentlyOpenedTracker;
 import org.cytoscape.property.CyProperty;
 
@@ -23,9 +24,8 @@
        private final String trackerFileName;
        private final LinkedList<URL> trackerURLs;
        
-       // TODO: Where should we manage this property directory?
-       private final String PROP_DIR = USER_HOME_DIR + 
System.getProperty("file.separator") + CyProperty.DEFAULT_CONFIG_DIR;
-
+       private final File propDir;
+       
        /**
         * Creates a "recently opened" file tracker.
         * 
@@ -33,11 +33,12 @@
         *            the name of the file in the Cytoscape config directory to 
read
         *            saved file names from.
         */
-       public RecentlyOpenedTrackerImpl(final String trackerFileName) throws 
IOException {
+       public RecentlyOpenedTrackerImpl(final String trackerFileName, final 
CyApplicationConfiguration config) throws IOException {
                this.trackerFileName = trackerFileName;
+               this.propDir = config.getSettingLocation();
                trackerURLs = new LinkedList<URL>();
 
-               final File input = new File(PROP_DIR, trackerFileName);
+               final File input = new File(propDir, trackerFileName);
                if (!input.exists())
                        input.createNewFile();
 
@@ -75,7 +76,7 @@
         */
        @Override
        public void writeOut() throws FileNotFoundException {
-               final PrintWriter writer = new PrintWriter(new File(PROP_DIR, 
trackerFileName));
+               final PrintWriter writer = new PrintWriter(new File(propDir, 
trackerFileName));
                for (final URL trackerURL : trackerURLs)
                        writer.println(trackerURL.toString());
                writer.close();

Modified: 
core3/impl/trunk/io-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/impl/trunk/io-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
 2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/io-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
 2011-08-15 23:36:16 UTC (rev 26562)
@@ -8,6 +8,7 @@
 
        <!-- Import services -->
        <osgi:reference id="compilerServiceRef" 
interface="org.cytoscape.equations.EquationCompiler" />
+       <osgi:reference id="cyApplicationConfigurationServiceRef" 
interface="org.cytoscape.application.CyApplicationConfiguration" />
 
        <osgi:reference id="cyEventHelperRef" 
interface="org.cytoscape.event.CyEventHelper" />
        

Modified: 
core3/impl/trunk/io-impl/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/impl/trunk/io-impl/src/main/resources/META-INF/spring/bundle-context.xml  
    2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/io-impl/src/main/resources/META-INF/spring/bundle-context.xml  
    2011-08-15 23:36:16 UTC (rev 26562)
@@ -663,6 +663,7 @@
        <!-- For recent session files -->
        <bean id="recentlyOpenedTracker" 
class="org.cytoscape.io.internal.util.RecentlyOpenedTrackerImpl" 
scope="singleton">
                <constructor-arg value="tracker.recent.sessions" />
+               <constructor-arg ref="cyApplicationConfigurationServiceRef" />
        </bean>
 
 </beans>

Modified: 
core3/impl/trunk/linkout-impl/src/main/java/org/cytoscape/linkout/internal/LinkOut.java
===================================================================
--- 
core3/impl/trunk/linkout-impl/src/main/java/org/cytoscape/linkout/internal/LinkOut.java
     2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/linkout-impl/src/main/java/org/cytoscape/linkout/internal/LinkOut.java
     2011-08-15 23:36:16 UTC (rev 26562)
@@ -9,6 +9,7 @@
 import java.util.Hashtable;
 import java.util.Properties;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.model.CyNode;
 import org.cytoscape.property.CyProperty;
 import org.cytoscape.service.util.CyServiceRegistrar;
@@ -65,18 +66,16 @@
        CyServiceRegistrar registrar;
        OpenBrowser browser;
 
-       // null constractor
-       /**
-        * Creates a new LinkOut object.
-        */
-       public LinkOut() {
-       }
+       private final File propertyFile;
 
-       public LinkOut(CyProperty<Properties> props, CyServiceRegistrar 
registrar,
-                       OpenBrowser browser) {
+       public LinkOut(CyProperty<Properties> props, CyServiceRegistrar 
registrar, OpenBrowser browser,
+                       final CyApplicationConfiguration config) {
                this.props = props.getProperties();
                this.registrar = registrar;
                this.browser = browser;
+               
+               propertyFile = new File(config.getSettingLocation(), 
File.separator + "linkout.props");
+               
                readProperties();
                // now link through properties
                addLinksFromProperties();
@@ -96,16 +95,13 @@
         */
 
        private void readProperties() {
-               final String inputFileName =
-                       System.getProperty("user.home") + "/" + 
CyProperty.DEFAULT_CONFIG_DIR + "/linkout.props";
-
+               
                try {
-                       final File inputFile = new File(inputFileName);
-                       if (inputFile.canRead())
-                               props.load(new FileInputStream(inputFile));
+                       if (propertyFile.canRead())
+                               props.load(new FileInputStream(propertyFile));
                } catch (Exception e) {
                        System.err.println("Couldn't load linkout props from \""
-                                          + inputFileName + "\"!");
+                                          + propertyFile.getAbsolutePath() + 
"\"!");
                }
        }
 

Modified: 
core3/impl/trunk/linkout-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/impl/trunk/linkout-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
    2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/linkout-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
    2011-08-15 23:36:16 UTC (rev 26562)
@@ -19,6 +19,8 @@
                interface="org.cytoscape.util.swing.OpenBrowser"/>
                
        <osgi:reference id="cyServiceRegistrarServiceRef" 
-               interface="org.cytoscape.service.util.CyServiceRegistrar"/>     
+               interface="org.cytoscape.service.util.CyServiceRegistrar"/>
+       
+       <osgi:reference id="cyApplicationConfigurationServiceRef" 
interface="org.cytoscape.application.CyApplicationConfiguration" />
 
 </beans>

Modified: 
core3/impl/trunk/linkout-impl/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/impl/trunk/linkout-impl/src/main/resources/META-INF/spring/bundle-context.xml
 2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/linkout-impl/src/main/resources/META-INF/spring/bundle-context.xml
 2011-08-15 23:36:16 UTC (rev 26562)
@@ -39,6 +39,7 @@
                <constructor-arg ref="linkoutProps" />
                <constructor-arg ref="cyServiceRegistrarServiceRef" />
                <constructor-arg ref="openBrowserServiceRef" />
+               <constructor-arg ref="cyApplicationConfigurationServiceRef" />
        </bean>
 
 </beans>

Modified: core3/impl/trunk/plugin-impl/pom.xml
===================================================================
--- core3/impl/trunk/plugin-impl/pom.xml        2011-08-15 19:26:46 UTC (rev 
26561)
+++ core3/impl/trunk/plugin-impl/pom.xml        2011-08-15 23:36:16 UTC (rev 
26562)
@@ -107,6 +107,10 @@
                        <groupId>org.cytoscape</groupId>
                        <artifactId>plugin-api</artifactId>
                </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>application-api</artifactId>
+               </dependency>
 
                <!-- dependencies needed for plugin manager -->
                <dependency>

Modified: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/PluginManager.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/PluginManager.java
 2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/PluginManager.java
 2011-08-15 23:36:16 UTC (rev 26562)
@@ -36,6 +36,7 @@
 
 package org.cytoscape.plugin.internal;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.plugin.CyPlugin;
 import org.cytoscape.plugin.CyPluginAdapter;
 import org.cytoscape.plugin.internal.action.PluginManagerAction;
@@ -178,7 +179,7 @@
         */
        public static PluginManager getPluginManager() {
                if (pluginMgr == null) {
-                       pluginMgr = new PluginManager(null);
+                       pluginMgr = new PluginManager(null, null);
                }
                return pluginMgr;
        }
@@ -228,9 +229,9 @@
         * @param Tracker
         * @return
         */
-       protected static PluginManager getPluginManager(PluginTracker Tracker) {
+       protected static PluginManager getPluginManager(PluginTracker Tracker, 
final CyApplicationConfiguration config) {
                if (pluginMgr == null) {
-                       pluginMgr = new PluginManager(Tracker);
+                       pluginMgr = new PluginManager(Tracker, config);
                }
                return pluginMgr;
        }
@@ -248,8 +249,13 @@
                }
        }
 
+       
+       private PluginManager() {
+               
+       }
+       
        // create plugin manager
-       private PluginManager(PluginTracker tracker) {
+       private PluginManager(PluginTracker tracker, final 
CyApplicationConfiguration config) {
 
                CytoscapeVersion cytoscapeVersion = new CytoscapeVersion();
                
@@ -261,12 +267,11 @@
                setWebstart();
                String trackerFileName = "track_plugins.xml";
 
-               String cyConfigDir = PluginManagerAction.cyConfigDir; 
                String cyConfigVerDir = PluginManagerAction.cyConfigVerDir;
                
                if (tempDir == null) {
                        if (usingWebstartManager()) {
-                               tempDir = new File(cyConfigDir,
+                               tempDir = new File(config.getSettingLocation(),
                                                "webstart" + File.separator
                                                                + (new 
CytoscapeVersion()).getMajorVersion()
                                                                + 
File.separator + "plugins");

Modified: 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
===================================================================
--- 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
    2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/plugin-impl/src/main/java/org/cytoscape/plugin/internal/action/PluginManagerAction.java
    2011-08-15 23:36:16 UTC (rev 26562)
@@ -43,27 +43,31 @@
 package org.cytoscape.plugin.internal.action;
 
 import java.awt.event.ActionEvent;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 
 import org.cytoscape.application.CyApplicationManager;
 import org.cytoscape.application.CytoscapeVersion;
 import org.cytoscape.application.swing.AbstractCyAction;
 import org.cytoscape.application.swing.CySwingApplication;
 import org.cytoscape.plugin.CyPluginAdapter;
+import org.cytoscape.plugin.internal.DownloadableInfo;
+import org.cytoscape.plugin.internal.ManagerException;
+import org.cytoscape.plugin.internal.ManagerUtil;
+import org.cytoscape.plugin.internal.PluginInquireAction;
+import org.cytoscape.plugin.internal.PluginManager;
+import org.cytoscape.plugin.internal.PluginManagerInquireTask;
+import org.cytoscape.plugin.internal.PluginManagerInquireTaskFactory;
+import org.cytoscape.plugin.internal.PluginStatus;
 import org.cytoscape.plugin.internal.ui.PluginManageDialog;
 import org.cytoscape.property.CyProperty;
 import org.cytoscape.property.bookmark.Bookmarks;
 import org.cytoscape.property.bookmark.BookmarksUtil;
+import org.cytoscape.work.Task;
+import org.cytoscape.work.TaskFactory;
 import org.cytoscape.work.swing.GUITaskManager;
-//import java.util.Properties;
-import org.cytoscape.plugin.internal.*;
-//import org.cytoscape.plugin.internal.ui.*;
-import org.cytoscape.work.TaskFactory;
 
-import java.util.List;
-import java.util.Map;
-import org.cytoscape.work.Task;
-import java.util.Properties;
-
 /**
  *
  */
@@ -77,7 +81,6 @@
        private TaskFactory pluginLoaderTaskFactory;
 
        public static String cyConfigVerDir;
-       public static String cyConfigDir = CyProperty.DEFAULT_CONFIG_DIR; 
//".cytoscape";
        public static String DefaultPluginUrl = null;
        
        /**
@@ -85,7 +88,7 @@
         */
        public PluginManagerAction(CySwingApplication desktop, 
CyApplicationManager appMgr, CytoscapeVersion version,
                        CyProperty<Bookmarks> bookmarksProp, BookmarksUtil 
bookmarksUtil, GUITaskManager guiTaskManagerServiceRef
-                       , CyProperty cytoscapePropertiesServiceRef, 
CyPluginAdapter adapter, TaskFactory pluginLoaderTaskFactory) {
+                       , CyProperty<Properties> cytoscapePropertiesServiceRef, 
CyPluginAdapter adapter, TaskFactory pluginLoaderTaskFactory) {
                                
                super("Plugin Manager", appMgr);
 
@@ -100,7 +103,7 @@
                // Note: We need pass cyConfigDir = ".cytoscape" and 
cyConfigVerDir to PluginManager.java
                this.cytoscapePropertiesServiceRef = 
cytoscapePropertiesServiceRef;
                                
-               DefaultPluginUrl = 
((Properties)cytoscapePropertiesServiceRef.getProperties()).getProperty("defaultPluginDownloadUrl");
+               DefaultPluginUrl = 
cytoscapePropertiesServiceRef.getProperties().getProperty("defaultPluginDownloadUrl");
                
                // initialize version
                org.cytoscape.plugin.internal.util.CytoscapeVersion.version = 
version.getVersion();

Modified: 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyOperatingContextImpl.java
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyOperatingContextImpl.java
    2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/CyOperatingContextImpl.java
    2011-08-15 23:36:16 UTC (rev 26562)
@@ -35,6 +35,7 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.property.CyProperty;
 
 import org.slf4j.Logger;
@@ -53,12 +54,16 @@
        private static final Logger logger = 
LoggerFactory.getLogger(CyOperatingContextImpl.class);
 
        private CyProperty<Properties> props;
+       private final CyApplicationConfiguration config;
 
-       public CyOperatingContextImpl(CyProperty<Properties> props) {
+       public CyOperatingContextImpl(CyProperty<Properties> props, final 
CyApplicationConfiguration config) {
                if ( props == null )
                        throw new NullPointerException("Cytoscape Properties is 
null");
+               if(config == null)
+                       throw new NullPointerException("Application Config is 
missing.");
 
                this.props = props;
+               this.config = config;
 
                loadLocalProps();
        }
@@ -70,7 +75,7 @@
                        if (vmp != null)
                                props.getProperties().load(new 
FileInputStream(vmp));
                        else
-                               logger.warn("couldn't read " + PROPS + " from " 
+ CyProperty.DEFAULT_CONFIG_DIR);
+                               logger.warn("couldn't read " + PROPS + " from " 
+ config.getSettingLocation());
                } catch (IOException ioe) {
                        ioe.printStackTrace();
                }
@@ -85,32 +90,13 @@
                return props.getProperties();
        }
 
-       /**
-        * Returns a {@link File} pointing to the config directory.
-        */
-       public File getConfigDirectory() {
-               try {
-                       String dirName = 
props.getProperties().getProperty("alternative.config.dir", 
System.getProperty("user.home"));
-                       File parent_dir = new File(dirName, 
CyProperty.DEFAULT_CONFIG_DIR);
 
-                       if (parent_dir.mkdir())
-                               logger.warn("Parent_Dir: " + parent_dir + " 
created.");
-
-                       return parent_dir;
-               } catch (Exception e) {
-                       logger.warn("error getting config directory");
-               }
-
-               return null;
-       }
-
        /**
         * Returns the specified file if it's found in the config directory. 
         */
        public File getConfigFile(String file_name) {
                try {
-                       File parent_dir = getConfigDirectory();
-                       File file = new File(parent_dir, file_name);
+                       File file = new File(config.getSettingLocation(), 
file_name);
 
                        if (file.createNewFile())
                                logger.warn("Config file: " + file + " 
created.");

Modified: 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/shutdown/ConfigDirPropertyWriter.java
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/shutdown/ConfigDirPropertyWriter.java
  2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/swing-application-impl/src/main/java/org/cytoscape/internal/shutdown/ConfigDirPropertyWriter.java
  2011-08-15 23:36:16 UTC (rev 26562)
@@ -7,6 +7,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.application.events.CytoscapeShutdownEvent;
 import org.cytoscape.application.events.CytoscapeShutdownListener;
 import org.cytoscape.property.CyProperty;
@@ -20,12 +21,14 @@
        private final TaskManager taskManager;
        private final CyPropertyWriterManager propertyWriterManager;
        private final Map<CyProperty, Map> configDirProperties;
+       private final CyApplicationConfiguration config;
 
        ConfigDirPropertyWriter(final TaskManager taskManager,
-                               final CyPropertyWriterManager 
propertyWriterManager)
+                               final CyPropertyWriterManager 
propertyWriterManager, final CyApplicationConfiguration config)
        {
                this.taskManager = taskManager;
                this.propertyWriterManager = propertyWriterManager;
+               this.config = config;
                configDirProperties = new HashMap<CyProperty, Map>();
        }
 
@@ -41,11 +44,8 @@
                        throw new IllegalStateException("could not find a 
properties CyFileFilter!");
 
                for (final Map.Entry<CyProperty, Map> keyAndValue : 
configDirProperties.entrySet()) {
-                       final String propertyName = 
(String)keyAndValue.getValue().get("cyPropertyName");
-                       final String outputFileName =
-                               System.getProperty("user.home") + "/" + 
CyProperty.DEFAULT_CONFIG_DIR
-                               + "/" + propertyName + ".props";
-                       final File outputFile = new File(outputFileName);
+                       final String propertyName = 
(String)keyAndValue.getValue().get("cyPropertyName");                           
    
+                       final File outputFile = new 
File(config.getSettingLocation(), propertyName + ".props");
                        final PropertyWriterFactory taskFactory =
                                new 
PropertyWriterFactory(propertyWriterManager, keyAndValue.getKey(),
                                                          matchingFileFilter, 
outputFile);

Modified: 
core3/impl/trunk/swing-application-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
  2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/swing-application-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml
  2011-08-15 23:36:16 UTC (rev 26562)
@@ -7,6 +7,8 @@
 
        <!-- Import OSGi services -->
        <osgi:reference id="cytoscapeShutdownServiceRef" 
interface="org.cytoscape.application.CytoscapeShutdown" />
+       <osgi:reference id="cyApplicationConfigurationServiceRef" 
interface="org.cytoscape.application.CyApplicationConfiguration" />
+       
 
        <osgi:reference id="streamUtilServiceRef" 
interface="org.cytoscape.io.util.StreamUtil" />
        

Modified: 
core3/impl/trunk/swing-application-impl/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/impl/trunk/swing-application-impl/src/main/resources/META-INF/spring/bundle-context.xml
       2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/swing-application-impl/src/main/resources/META-INF/spring/bundle-context.xml
       2011-08-15 23:36:16 UTC (rev 26562)
@@ -26,12 +26,14 @@
        <bean name="configDirPropertyWriter" 
class="org.cytoscape.internal.shutdown.ConfigDirPropertyWriter">
                <constructor-arg ref="taskManagerServiceRef" />
                <constructor-arg ref="propertyWriterManagerRef" />
+               <constructor-arg ref="cyApplicationConfigurationServiceRef" />
        </bean>
 
        <!-- Various Utilities -->
 
        <bean name="cyOperatingContext" 
class="org.cytoscape.internal.CyOperatingContextImpl">
                <constructor-arg ref="cytoscapePropertiesServiceRef" />
+               <constructor-arg ref="cyApplicationConfigurationServiceRef" />
        </bean>
        
        <bean name="cyHelpBroker" 
class="org.cytoscape.internal.view.CyHelpBrokerImpl">

Modified: 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTask.java
===================================================================
--- 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTask.java
     2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTask.java
     2011-08-15 23:36:16 UTC (rev 26562)
@@ -4,6 +4,7 @@
 import java.net.URL;
 import java.util.Set;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.io.read.VizmapReader;
 import org.cytoscape.io.read.VizmapReaderManager;
 import org.cytoscape.property.CyProperty;
@@ -17,25 +18,21 @@
 public class ImportDefaultVizmapTask extends AbstractTask {
        
        private static final Logger logger = 
LoggerFactory.getLogger(ImportDefaultVizmapTask.class);
-       
-       private static final String SEPARATOR = File.separator;
-       private static final String USER_HOME = System.getProperty("user.home");
-       private static final String CONFIG_DIR = USER_HOME + SEPARATOR + 
CyProperty.DEFAULT_CONFIG_DIR;
        private static final String PRESET_VIZMAP_FILE = "default_vizmap.xml";
 
        private final VisualMappingManager vmm;
        private final VizmapReaderManager vizmapReaderMgr;
+       
+       private final File vizmapFile;
 
-       public ImportDefaultVizmapTask(final VizmapReaderManager 
vizmapReaderMgr, final VisualMappingManager vmm) {
+       public ImportDefaultVizmapTask(final VizmapReaderManager 
vizmapReaderMgr, final VisualMappingManager vmm, final 
CyApplicationConfiguration config) {
                this.vizmapReaderMgr = vizmapReaderMgr;
                this.vmm = vmm;
+               this.vizmapFile = new File(config.getSettingLocation(), 
PRESET_VIZMAP_FILE);
        }
 
        @Override
-       public void run(final TaskMonitor taskMonitor) throws Exception {       
-               // First, try user's .cytoscape directory
-               File vizmapFile = new File(CONFIG_DIR + SEPARATOR + 
PRESET_VIZMAP_FILE);
-               
+       public void run(final TaskMonitor taskMonitor) throws Exception {       
                
                final VizmapReader reader;
                
                if(vizmapFile.exists() == false) {

Modified: 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTaskFactory.java
===================================================================
--- 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTaskFactory.java
      2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/task/ImportDefaultVizmapTaskFactory.java
      2011-08-15 23:36:16 UTC (rev 26562)
@@ -1,5 +1,6 @@
 package org.cytoscape.view.vizmap.gui.internal.task;
 
+import org.cytoscape.application.CyApplicationConfiguration;
 import org.cytoscape.io.read.VizmapReaderManager;
 import org.cytoscape.view.vizmap.VisualMappingManager;
 import org.cytoscape.work.TaskFactory;
@@ -9,14 +10,16 @@
 
        private final VizmapReaderManager vizmapReaderMgr;
        private final VisualMappingManager vmm;
+       private final CyApplicationConfiguration config;
 
-       public ImportDefaultVizmapTaskFactory(VizmapReaderManager 
vizmapReaderMgr, VisualMappingManager vmm) {
+       public ImportDefaultVizmapTaskFactory(VizmapReaderManager 
vizmapReaderMgr, VisualMappingManager vmm, final CyApplicationConfiguration 
config) {
                this.vizmapReaderMgr = vizmapReaderMgr;
                this.vmm = vmm;
+               this.config = config;
        }
 
        @Override
        public TaskIterator getTaskIterator() {
-               return new TaskIterator(new 
ImportDefaultVizmapTask(vizmapReaderMgr, vmm));
+               return new TaskIterator(new 
ImportDefaultVizmapTask(vizmapReaderMgr, vmm, config));
        }
 }

Modified: 
core3/impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
===================================================================
--- 
core3/impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
       2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring/bundle-context-osgi-vizmapper.xml
       2011-08-15 23:36:16 UTC (rev 26562)
@@ -47,6 +47,8 @@
                auto-export="interfaces" />
 
 
+       <osgi:reference id="cyApplicationConfigurationServiceRef" 
interface="org.cytoscape.application.CyApplicationConfiguration" />
+
        <osgi:reference id="taskManagerServiceRef" 
interface="org.cytoscape.work.swing.GUITaskManager" />
        
        <osgi:reference id="visualStyleFactoryServiceRef"

Modified: 
core3/impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
===================================================================
--- 
core3/impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
    2011-08-15 19:26:46 UTC (rev 26561)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/resources/META-INF/spring/bundle-context-vizmapper.xml
    2011-08-15 23:36:16 UTC (rev 26562)
@@ -358,6 +358,7 @@
        <bean id="importDefaultVizmapTaskFactory" 
class="org.cytoscape.view.vizmap.gui.internal.task.ImportDefaultVizmapTaskFactory">
                <constructor-arg ref="vizmapReaderManagerServiceRef"/>
                <constructor-arg ref="vmmServiceRef"/>
+               <constructor-arg ref="cyApplicationConfigurationServiceRef" />
        </bean>
        
        

-- 
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