Author: ruschein
Date: 2011-06-21 15:33:52 -0700 (Tue, 21 Jun 2011)
New Revision: 25843
Modified:
core3/linkout-impl/trunk/pom.xml
core3/linkout-impl/trunk/src/main/java/org/cytoscape/linkout/internal/LinkOut.java
Log:
Closed Redmine Bug #14.
Modified: core3/linkout-impl/trunk/pom.xml
===================================================================
--- core3/linkout-impl/trunk/pom.xml 2011-06-21 22:32:18 UTC (rev 25842)
+++ core3/linkout-impl/trunk/pom.xml 2011-06-21 22:33:52 UTC (rev 25843)
@@ -20,38 +20,38 @@
<packaging>bundle</packaging>
- <scm>
-
<connection>scm:svn:http://chianti.ucsd.edu/svn/core3/linkout-impl/trunk</connection>
-
<developerConnection>scm:svn:svn+ssh://grenache.ucsd.edu/cellar/common/svn/core3/linkout-impl/trunk</developerConnection>
- <url>http://chianti.ucsd.edu/svn/core3/linkout-impl/trunk</url>
- </scm>
+ <scm>
+
<connection>scm:svn:http://chianti.ucsd.edu/svn/core3/linkout-impl/trunk</connection>
+
<developerConnection>scm:svn:svn+ssh://grenache.ucsd.edu/cellar/common/svn/core3/linkout-impl/trunk</developerConnection>
+ <url>http://chianti.ucsd.edu/svn/core3/linkout-impl/trunk</url>
+ </scm>
- <repositories>
- <!-- bootstrap for cytoscape dependencies, namely the parent POM
snapshots -->
- <repository>
- <id>cytoscape_snapshots</id>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- <name>Cytoscape Snapshots</name>
-
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url>
- </repository>
- <!-- bootstrap for cytoscape dependencies, namely the parent POM
releases -->
- <repository>
- <id>cytoscape_releases</id>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- <name>Cytoscape Releases</name>
-
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/releases/</url>
- </repository>
- </repositories>
+ <repositories>
+ <!-- bootstrap for cytoscape dependencies, namely the parent
POM snapshots -->
+ <repository>
+ <id>cytoscape_snapshots</id>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <name>Cytoscape Snapshots</name>
+
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url>
+ </repository>
+ <!-- bootstrap for cytoscape dependencies, namely the parent
POM releases -->
+ <repository>
+ <id>cytoscape_releases</id>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <name>Cytoscape Releases</name>
+
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/releases/</url>
+ </repository>
+ </repositories>
<build>
<plugins>
@@ -85,6 +85,11 @@
<dependencies>
<dependency>
<groupId>org.cytoscape</groupId>
+ <artifactId>property-api</artifactId>
+ <version>3.0.0-alpha5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
<artifactId>core-task-api</artifactId>
<version>3.0.0-alpha3</version>
</dependency>
Modified:
core3/linkout-impl/trunk/src/main/java/org/cytoscape/linkout/internal/LinkOut.java
===================================================================
---
core3/linkout-impl/trunk/src/main/java/org/cytoscape/linkout/internal/LinkOut.java
2011-06-21 22:32:18 UTC (rev 25842)
+++
core3/linkout-impl/trunk/src/main/java/org/cytoscape/linkout/internal/LinkOut.java
2011-06-21 22:33:52 UTC (rev 25843)
@@ -2,6 +2,8 @@
import java.awt.Font;
+import java.io.File;
+import java.io.FileInputStream;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -94,56 +96,17 @@
*/
private void readProperties() {
- // Set the properties to be Cytoscape's properties.
- // This allows the linkout properties to be edited in
- // the preferences editor.
- // System.out.println(CytoscapeInit.getPropertiesLocation());
- // props = CytoscapeInit.getProperties();
+ final String inputFileName =
+ System.getProperty("user.home") + "/" +
CyProperty.DEFAULT_CONFIG_DIR + "/linkout.props";
-
-
- // Loop over the default props and see if any
- // linkout urls have been specified. We don't want to
- // override or even supplement what was set from the
- // command line. Only use the defaults if nothing
- // else can be found.
- boolean linkoutFound = false;
- boolean externalLinkNameFound = false;
-
- Enumeration names = props.propertyNames();
-
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- if (name.compareToIgnoreCase(linkMarker) == 0) {
- externalLinkNameFound = true;
- externalLinksAttribute =
props.getProperty(linkMarker);
- continue;
- }
- int p = name.lastIndexOf(nodeMarker);
- int q = name.lastIndexOf(edgeMarker);
-
- if (p != -1 || q != -1) {
- linkoutFound = true;
-
- break;
- }
+ try {
+ final File inputFile = new File(inputFileName);
+ if (inputFile.canRead())
+ props.load(new FileInputStream(inputFile));
+ } catch (Exception e) {
+ System.err.println("Couldn't load linkout props from \""
+ + inputFileName + "\"!");
}
-
- // If we don't have any linkout properties, load the defaults.
- if (!linkoutFound) {
- try {
- System.out.println("loading defaults");
-
- ClassLoader cl = LinkOut.class.getClassLoader();
-
props.load(cl.getResource("linkout.props").openStream());
- if (!externalLinkNameFound) {
- externalLinksAttribute =
props.getProperty(linkMarker);
- }
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Couldn't load default
linkout props");
- }
- }
}
public void addLinksFromProperties() {
--
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.