Author: ruschein
Date: 2011-04-05 09:23:59 -0700 (Tue, 05 Apr 2011)
New Revision: 24671
Modified:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/shutdown/ConfigDirPropertyWriter.java
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/shutdown/PropertyWriter.java
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
Work in progress.
Modified:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/shutdown/ConfigDirPropertyWriter.java
===================================================================
---
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/shutdown/ConfigDirPropertyWriter.java
2011-04-05 02:50:58 UTC (rev 24670)
+++
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/shutdown/ConfigDirPropertyWriter.java
2011-04-05 16:23:59 UTC (rev 24671)
@@ -10,52 +10,38 @@
import org.cytoscape.application.swing.events.CytoscapeShutdownEvent;
import org.cytoscape.application.swing.events.CytoscapeShutdownListener;
import org.cytoscape.property.CyProperty;
-import org.cytoscape.io.CyFileFilter;
-import org.cytoscape.io.write.CyPropertyWriterFactory;
import org.cytoscape.io.write.CyPropertyWriterManager;
import org.cytoscape.io.write.CyWriter;
-import org.cytoscape.work.SequentialTaskFactory;
+//import org.cytoscape.work.SequentialTaskFactory;
+import org.cytoscape.work.TaskManager;
public class ConfigDirPropertyWriter implements CytoscapeShutdownListener {
+ private final TaskManager taskManager;
private final CyPropertyWriterManager propertyWriterManager;
private final Map<CyProperty, Map> configDirProperties;
- private final Set<CyPropertyWriterFactory> propertyWriterFactories;
- private final SequentialTaskFactory sequentialTaskFactory;
+// private final SequentialTaskFactory sequentialTaskFactory;
- ConfigDirPropertyWriter(final CyPropertyWriterManager
propertyWriterManager)
+ ConfigDirPropertyWriter(final TaskManager taskManager,
+ final CyPropertyWriterManager
propertyWriterManager)
{
+ this.taskManager = taskManager;
this.propertyWriterManager = propertyWriterManager;
configDirProperties = new HashMap<CyProperty, Map>();
- propertyWriterFactories = new
HashSet<CyPropertyWriterFactory>();
- sequentialTaskFactory = new SequentialTaskFactory();
}
public void handleEvent(final CytoscapeShutdownEvent event) {
+System.err.println("+++++++++++++++ Entering
ConfigDirPropertyWriter.handleEvent()");
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);
- boolean foundCorrectFileFiler = false;
- for (final CyPropertyWriterFactory
propertyWriterFactory : propertyWriterFactories) {
- final CyFileFilter fileFilter =
propertyWriterFactory.getCyFileFilter();
-System.err.println("+++++++++++++ trying "+fileFilter);
- try {
- final CyWriter writer =
-
propertyWriterManager.getWriter(keyAndValue.getKey(), fileFilter,
-
outputFile);
- sequentialTaskFactory.addTask(writer);
- foundCorrectFileFiler = true;
-System.err.println("+++++++++++++ SUCCESS!");
- break;
- } catch (final Exception e) {
- }
- }
- if (!foundCorrectFileFiler)
- System.err.println("+++ Failed create a
CyWriter for \""
- + outputFileName + "\"!");
+ final PropertyWriterFactory taskFactory =
+ new
PropertyWriterFactory(propertyWriterManager, keyAndValue.getKey(), outputFile);
+System.err.println("+++++++++++++++ About to execute task factory!");
+ taskManager.execute(taskFactory);
}
}
@@ -69,16 +55,4 @@
configDirProperties.remove(oldCyProperty);
}
-
- public void addCyPropertyFileWriterFactory(final
CyPropertyWriterFactory newCyPropertyWriterFactory,
- final Map properties)
- {
- propertyWriterFactories.add(newCyPropertyWriterFactory);
- }
-
- public void removeCyPropertyFileWriterFactory(final
CyPropertyWriterFactory oldCyPropertyWriterFactory,
- final Map properties)
- {
- propertyWriterFactories.remove(oldCyPropertyWriterFactory);
- }
}
\ No newline at end of file
Modified:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/shutdown/PropertyWriter.java
===================================================================
---
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/shutdown/PropertyWriter.java
2011-04-05 02:50:58 UTC (rev 24670)
+++
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/shutdown/PropertyWriter.java
2011-04-05 16:23:59 UTC (rev 24671)
@@ -18,24 +18,29 @@
private final CyProperty property;
/**
- * @param writerManager The {@link
org.cytoscape.io.write.PresentationWriterManager} used to determine which type
of
+ * @param writerManager The {@link
org.cytoscape.io.write.CyPropertyWriterManager} used to determine which type of
* file should be written.
- * @param view The View object to be written to the specified file.
- * @param re The RenderingEngine used to generate the image to be
written to the file.
+ * @param property The {@link org.cytoscape.property.CyProperty}
that should be serialised.
+ * @param outputFile Where to write the serialised data to.
*/
- public PropertyWriter(final CyPropertyWriterManager writerManager,
final CyProperty property) {
+ public PropertyWriter(final CyPropertyWriterManager writerManager,
final CyProperty property,
+ final File outputFile)
+ {
super(writerManager);
this.property = property;
+ setOutputFile(outputFile);
}
protected String getExportFileFormat() {
- return "props";
+System.err.println("++++++++++++ in PropertyWriter.getExportFileFormat()");
+ return "Java Properties files (*.props, *.properties)";
}
/**
* {@inheritDoc}
*/
protected CyWriter getWriter(final CyFileFilter filter, final File
file) throws Exception {
+System.err.println("++++++++++++ Entering PropertyWriter.getWriter()");
return writerManager.getWriter(property, filter, file);
}
}
Modified:
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2011-04-05 02:50:58 UTC (rev 24670)
+++
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2011-04-05 16:23:59 UTC (rev 24671)
@@ -343,10 +343,4 @@
<osgi:listener bind-method="addCyProperty"
unbind-method="removeCyProperty"
ref="configDirPropertyWriter" />
</osgi:set>
-
- <osgi:set id="propertyFileFilterSet"
interface="org.cytoscape.io.write.CyPropertyWriterFactory"
- cardinality="0..N">
- <osgi:listener bind-method="addCyPropertyFileWriterFactory"
unbind-method="removeCyPropertyFileWriterFactory"
- ref="configDirPropertyWriter" />
- </osgi:set>
</beans>
Modified:
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-04-05 02:50:58 UTC (rev 24670)
+++
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-04-05 16:23:59 UTC (rev 24671)
@@ -33,6 +33,7 @@
<constructor-arg ref="cyEventHelperServiceRef" />
</bean>
<bean name="configDirPropertyWriter"
class="org.cytoscape.internal.shutdown.ConfigDirPropertyWriter">
+ <constructor-arg ref="taskManagerServiceRef" />
<constructor-arg ref="propertyWriterManagerRef" />
</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.