Author: ruschein
Date: 2011-03-30 16:01:22 -0700 (Wed, 30 Mar 2011)
New Revision: 24632
Modified:
core3/ding-customgraphics-manager-impl/trunk/pom.xml
core3/gui-distribution/trunk/startlevel-3/pom.xml
core3/io-impl/trunk/pom.xml
core3/linkout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
core3/plugin-api/trunk/pom.xml
core3/property-api/trunk/src/main/java/org/cytoscape/property/BasicCyProperty.java
core3/property-api/trunk/src/main/java/org/cytoscape/property/CyProperty.java
core3/property-api/trunk/src/test/java/org/cytoscape/property/BasicCyPropertyTest.java
core3/property-impl/trunk/pom.xml
core3/property-impl/trunk/src/main/java/org/cytoscape/property/internal/PropsReader.java
core3/property-impl/trunk/src/main/java/org/cytoscape/property/internal/bookmark/BookmarkReader.java
core3/session-api/trunk/pom.xml
core3/swing-util/trunk/pom.xml
core3/work-swing-api/trunk/pom.xml
core3/work-swing-impl/trunk/pom.xml
Log:
Added a SavePolicy enum to CyProperty.
Modified: core3/ding-customgraphics-manager-impl/trunk/pom.xml
===================================================================
--- core3/ding-customgraphics-manager-impl/trunk/pom.xml 2011-03-30
22:55:21 UTC (rev 24631)
+++ core3/ding-customgraphics-manager-impl/trunk/pom.xml 2011-03-30
23:01:22 UTC (rev 24632)
@@ -111,7 +111,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha2</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
</dependency>
<dependency>
Modified: core3/gui-distribution/trunk/startlevel-3/pom.xml
===================================================================
--- core3/gui-distribution/trunk/startlevel-3/pom.xml 2011-03-30 22:55:21 UTC
(rev 24631)
+++ core3/gui-distribution/trunk/startlevel-3/pom.xml 2011-03-30 23:01:22 UTC
(rev 24632)
@@ -187,7 +187,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha2</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.cytoscape</groupId>
@@ -386,7 +386,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>linkout-impl</artifactId>
- <version>3.0.0-alpha1</version>
+ <version>3.0.0-alpha2-SNAPSHOT</version>
</dependency>
<!-- PSI-MI -->
Modified: core3/io-impl/trunk/pom.xml
===================================================================
--- core3/io-impl/trunk/pom.xml 2011-03-30 22:55:21 UTC (rev 24631)
+++ core3/io-impl/trunk/pom.xml 2011-03-30 23:01:22 UTC (rev 24632)
@@ -114,7 +114,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha2</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.cytoscape</groupId>
Modified:
core3/linkout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/linkout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-03-30 22:55:21 UTC (rev 24631)
+++
core3/linkout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-03-30 23:01:22 UTC (rev 24632)
@@ -32,6 +32,7 @@
<!-- Build CyProperty Object by using default implementation -->
<bean id="linkoutProps" class="org.cytoscape.property.BasicCyProperty">
<constructor-arg ref="linkoutProperties" />
+ <constructor-arg value="CONFIG_DIR" />
</bean>
<bean id="linkout" class="org.cytoscape.linkout.internal.LinkOut">
Modified: core3/plugin-api/trunk/pom.xml
===================================================================
--- core3/plugin-api/trunk/pom.xml 2011-03-30 22:55:21 UTC (rev 24631)
+++ core3/plugin-api/trunk/pom.xml 2011-03-30 23:01:22 UTC (rev 24632)
@@ -185,7 +185,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha3</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
</dependency>
<!--
Modified:
core3/property-api/trunk/src/main/java/org/cytoscape/property/BasicCyProperty.java
===================================================================
---
core3/property-api/trunk/src/main/java/org/cytoscape/property/BasicCyProperty.java
2011-03-30 22:55:21 UTC (rev 24631)
+++
core3/property-api/trunk/src/main/java/org/cytoscape/property/BasicCyProperty.java
2011-03-30 23:01:22 UTC (rev 24632)
@@ -1,15 +1,16 @@
-
package org.cytoscape.property;
+
import java.util.Properties;
+
/**
* A simple implementation of CyProperty<Properties> suitable for
* general purpose use.
*/
public final class BasicCyProperty implements CyProperty<Properties> {
-
private final Properties properties;
+ private final CyProperty.SavePolicy savePolicy;
/**
* Properties is a non-null Properties object that this CyProperty
object
@@ -17,10 +18,14 @@
* @param properties The non-null Properties object this CyProperty
object
* should encapsulate. Throws NullPointerException if Properties is
null.
*/
- public BasicCyProperty(final Properties properties) {
- if ( properties == null )
- throw new NullPointerException("properties object is
null");
+ public BasicCyProperty(final Properties properties, final
CyProperty.SavePolicy savePolicy) {
+ if (properties == null)
+ throw new NullPointerException("\"properties\"
parameter is null!");
+ if (savePolicy == null)
+ throw new NullPointerException("\"savePolicy\"
parameter is null!");
+
this.properties = properties;
+ this.savePolicy = savePolicy;
}
/**
@@ -29,4 +34,11 @@
public Properties getProperties() {
return properties;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public CyProperty.SavePolicy getSavePolicy() {
+ return savePolicy;
+ }
}
Modified:
core3/property-api/trunk/src/main/java/org/cytoscape/property/CyProperty.java
===================================================================
---
core3/property-api/trunk/src/main/java/org/cytoscape/property/CyProperty.java
2011-03-30 22:55:21 UTC (rev 24631)
+++
core3/property-api/trunk/src/main/java/org/cytoscape/property/CyProperty.java
2011-03-30 23:01:22 UTC (rev 24632)
@@ -1,5 +1,6 @@
package org.cytoscape.property;
+
/**
* A general property service interface for providing access to different types
* of property objects as OSGi services. The type P is generally one of three
types:
@@ -9,12 +10,26 @@
* 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";
- public static final String DEFAULT_CONFIG_DIR = ".cytoscape";
-
+ enum SavePolicy {
+ /** These properties are preset by Cytoscape to some default
value and
+ * are never written out. */
+ DO_NOT_SAVE,
+
+ /** These properties are loaded from and written to the default
config
+ * directory and are user defaults. */
+ CONFIG_DIR,
+
+ /** This properties will be loaded from and saved to session
files. */
+ SESSION_FILE,
+ }
+
/**
* Return a property object
* @return A property object of type P.
*/
P getProperties();
+
+ SavePolicy getSavePolicy();
}
Modified:
core3/property-api/trunk/src/test/java/org/cytoscape/property/BasicCyPropertyTest.java
===================================================================
---
core3/property-api/trunk/src/test/java/org/cytoscape/property/BasicCyPropertyTest.java
2011-03-30 22:55:21 UTC (rev 24631)
+++
core3/property-api/trunk/src/test/java/org/cytoscape/property/BasicCyPropertyTest.java
2011-03-30 23:01:22 UTC (rev 24632)
@@ -1,20 +1,35 @@
package org.cytoscape.property;
+
import static org.junit.Assert.assertTrue;
import java.util.Properties;
import org.junit.Test;
-public class BasicCyPropertyTest {
+public class BasicCyPropertyTest {
+
@Test(expected=NullPointerException.class)
public void testNullProp() throws Exception {
- BasicCyProperty p = new BasicCyProperty(null);
+ BasicCyProperty p = new BasicCyProperty(null,
CyProperty.SavePolicy.DO_NOT_SAVE);
}
-
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSavePol() throws Exception {
+ Properties props = new Properties();
+ BasicCyProperty p = new BasicCyProperty(props, null);
+ }
+
@Test
public void testGetProp(){
Properties props = new Properties();
- BasicCyProperty p = new BasicCyProperty(props);
+ BasicCyProperty p = new BasicCyProperty(props,
CyProperty.SavePolicy.DO_NOT_SAVE);
assertTrue(p.getProperties() != null);
- }
+ }
+
+ @Test
+ public void testGetSavePol(){
+ Properties props = new Properties();
+ BasicCyProperty p = new BasicCyProperty(props,
CyProperty.SavePolicy.DO_NOT_SAVE);
+ assertTrue(p.getSavePolicy() ==
CyProperty.SavePolicy.DO_NOT_SAVE);
+ }
}
Modified: core3/property-impl/trunk/pom.xml
===================================================================
--- core3/property-impl/trunk/pom.xml 2011-03-30 22:55:21 UTC (rev 24631)
+++ core3/property-impl/trunk/pom.xml 2011-03-30 23:01:22 UTC (rev 24632)
@@ -90,7 +90,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha1</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.cytoscape</groupId>
Modified:
core3/property-impl/trunk/src/main/java/org/cytoscape/property/internal/PropsReader.java
===================================================================
---
core3/property-impl/trunk/src/main/java/org/cytoscape/property/internal/PropsReader.java
2011-03-30 22:55:21 UTC (rev 24631)
+++
core3/property-impl/trunk/src/main/java/org/cytoscape/property/internal/PropsReader.java
2011-03-30 23:01:22 UTC (rev 24632)
@@ -1,5 +1,6 @@
package org.cytoscape.property.internal;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
@@ -11,21 +12,19 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
public class PropsReader implements CyProperty<Properties>,
SessionLoadedListener {
-
private static final Logger logger =
LoggerFactory.getLogger(PropsReader.class);
-
private Properties props;
/**
- * Creates a new BookmarkReader object.
+ * Creates a new PropsReader object.
*/
public PropsReader(String resourceLocation) {
-
InputStream is = null;
try {
- if ( resourceLocation == null )
+ if (resourceLocation == null)
throw new
NullPointerException("resourceLocation is null");
is =
this.getClass().getClassLoader().getResourceAsStream(resourceLocation);
@@ -44,6 +43,12 @@
}
}
+ @Override
+ public CyProperty.SavePolicy getSavePolicy() {
+ return CyProperty.SavePolicy.DO_NOT_SAVE;
+ }
+
+ @Override
public Properties getProperties() {
return props;
}
Modified:
core3/property-impl/trunk/src/main/java/org/cytoscape/property/internal/bookmark/BookmarkReader.java
===================================================================
---
core3/property-impl/trunk/src/main/java/org/cytoscape/property/internal/bookmark/BookmarkReader.java
2011-03-30 22:55:21 UTC (rev 24631)
+++
core3/property-impl/trunk/src/main/java/org/cytoscape/property/internal/bookmark/BookmarkReader.java
2011-03-30 23:01:22 UTC (rev 24632)
@@ -1,5 +1,6 @@
package org.cytoscape.property.internal.bookmark;
+
import java.io.IOException;
import java.io.InputStream;
@@ -14,8 +15,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class BookmarkReader implements CyProperty<Bookmarks>,
SessionLoadedListener {
+public final class BookmarkReader implements CyProperty<Bookmarks>,
SessionLoadedListener {
private static final String BOOKMARK_PACKAGE =
Bookmarks.class.getPackage().getName();
private static final Logger logger =
LoggerFactory.getLogger(BookmarkReader.class);
@@ -53,11 +54,17 @@
}
}
+ @Override
public Bookmarks getProperties() {
return bookmarks;
}
@Override
+ public CyProperty.SavePolicy getSavePolicy() {
+ return CyProperty.SavePolicy.SESSION_FILE;
+ }
+
+ @Override
public void handleEvent(SessionLoadedEvent e) {
logger.debug("Updating bookmarks from loaded session...");
Modified: core3/session-api/trunk/pom.xml
===================================================================
--- core3/session-api/trunk/pom.xml 2011-03-30 22:55:21 UTC (rev 24631)
+++ core3/session-api/trunk/pom.xml 2011-03-30 23:01:22 UTC (rev 24632)
@@ -124,7 +124,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha2</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
</dependency>
<!-- for testing -->
Modified: core3/swing-util/trunk/pom.xml
===================================================================
--- core3/swing-util/trunk/pom.xml 2011-03-30 22:55:21 UTC (rev 24631)
+++ core3/swing-util/trunk/pom.xml 2011-03-30 23:01:22 UTC (rev 24632)
@@ -101,7 +101,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha1</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
</dependency>
</dependencies>
Modified: core3/work-swing-api/trunk/pom.xml
===================================================================
--- core3/work-swing-api/trunk/pom.xml 2011-03-30 22:55:21 UTC (rev 24631)
+++ core3/work-swing-api/trunk/pom.xml 2011-03-30 23:01:22 UTC (rev 24632)
@@ -139,7 +139,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha1</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Modified: core3/work-swing-impl/trunk/pom.xml
===================================================================
--- core3/work-swing-impl/trunk/pom.xml 2011-03-30 22:55:21 UTC (rev 24631)
+++ core3/work-swing-impl/trunk/pom.xml 2011-03-30 23:01:22 UTC (rev 24632)
@@ -93,7 +93,7 @@
<dependency>
<groupId>org.cytoscape</groupId>
<artifactId>property-api</artifactId>
- <version>3.0.0-alpha1</version>
+ <version>3.0.0-alpha4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
--
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.