Author: pwang
Date: 2010-08-17 17:20:04 -0700 (Tue, 17 Aug 2010)
New Revision: 21435
Removed:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/AbstractNetworkReader.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/CyReaderFactoryImpl.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/CyReaderManagerImpl.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/ssf/SSFReader.java
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java
Log:
Deleted:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/AbstractNetworkReader.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/AbstractNetworkReader.java
2010-08-18 00:18:19 UTC (rev 21434)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/AbstractNetworkReader.java
2010-08-18 00:20:04 UTC (rev 21435)
@@ -1,62 +0,0 @@
-package org.cytoscape.io.internal.read;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.cytoscape.io.read.CyReader;
-import org.cytoscape.view.layout.CyLayouts;
-import org.cytoscape.model.CyNetworkFactory;
-import org.cytoscape.view.model.CyNetworkViewFactory;
-
-abstract public class AbstractNetworkReader implements CyReader {
-
- protected static final String NODE_NAME_ATTR_LABEL = "name";
-
- protected boolean cancel = false;
- protected InputStream inputStream;
- protected CyNetworkFactory cyNetworkFactory;
- protected CyNetworkViewFactory cyNetworkViewFactory;
-
- protected CyLayouts layouts;
-
- protected Map<Class<?>, Object> readObjects;
-
- public AbstractNetworkReader() {
- this.readObjects = new HashMap<Class<?>, Object>();
- }
-
- public void setCyNetworkFactory(CyNetworkFactory cyNetworkFactory) {
- this.cyNetworkFactory = cyNetworkFactory;
- }
-
- public void setCyNetworkViewFactory(CyNetworkViewFactory
cyNetworkViewFactory) {
- this.cyNetworkViewFactory = cyNetworkViewFactory;
- }
-
- public void setLayouts(CyLayouts layouts) {
- this.layouts = layouts;
- }
-
- public void setInputStream(InputStream is) {
- if (is == null)
- throw new NullPointerException("Input stream is null");
- inputStream = is;
- cancel = false;
- }
-
- public void cancel()
- {
- if (cancel)
- throw new IllegalStateException("AbstractNetworkReader
has already been cancelled");
-
- cancel = true;
- try
- {
- inputStream.close();
- }
- catch (IOException e) {}
- inputStream = null;
- }
-}
Deleted:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/CyReaderFactoryImpl.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/CyReaderFactoryImpl.java
2010-08-18 00:18:19 UTC (rev 21434)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/CyReaderFactoryImpl.java
2010-08-18 00:20:04 UTC (rev 21435)
@@ -1,61 +0,0 @@
-package org.cytoscape.io.internal.read;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.Proxy;
-import java.net.URI;
-
-import org.cytoscape.io.CyFileFilter;
-import org.cytoscape.io.read.CyReader;
-import org.cytoscape.io.read.CyReaderFactory;
-import org.cytoscape.io.util.StreamUtil;
-
-public class CyReaderFactoryImpl implements CyReaderFactory {
-
- private CyFileFilter filter;
- private CyReader reader;
- private StreamUtil streamUtil;
-
- // This should be an OSGi service.
- private Proxy proxy;
-
- public CyReaderFactoryImpl(CyFileFilter filter, CyReader reader,
StreamUtil streamUtil)
- throws IllegalArgumentException {
- this.filter = filter;
- this.reader = reader;
-
- if (this.reader == null) {
- throw new IllegalArgumentException("Reader cannot be
null.");
- } else if (this.reader == null) {
- throw new IllegalArgumentException("CyFileFilter cannot
be null.");
- }
- this.streamUtil = streamUtil;
- }
-
- public void setProxy(Proxy proxy) {
- this.proxy = proxy;
- }
-
- /**
- * Gets Graph Reader.
- *
- * @param fileName
- * File name.
- * @return GraphReader Object.
- * @throws IOException
- */
- public CyReader getReader(URI uri) throws IOException {
- InputStream is = streamUtil.getInputStream(uri.toURL());
- return getReader(is);
- }
-
- public CyReader getReader(InputStream stream) throws IOException {
- reader.setInputStream(stream);
- return reader;
- }
-
- public CyFileFilter getCyFileFilter() {
- return filter;
- }
-
-}
Deleted:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/CyReaderManagerImpl.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/CyReaderManagerImpl.java
2010-08-18 00:18:19 UTC (rev 21434)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/CyReaderManagerImpl.java
2010-08-18 00:20:04 UTC (rev 21435)
@@ -1,161 +0,0 @@
-/*
- 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 org.cytoscape.io.internal.read;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.cytoscape.io.CyFileFilter;
-import org.cytoscape.io.DataCategory;
-import org.cytoscape.io.read.CyReader;
-import org.cytoscape.io.read.CyReaderFactory;
-import org.cytoscape.io.read.CyReaderManager;
-
-/**
- * Central registry for all Cytoscape import classes.
- */
-public class CyReaderManagerImpl implements CyReaderManager {
-
- private Set<CyReaderFactory> factories;
-
- /**
- * Constructor.
- */
- public CyReaderManagerImpl() {
- factories = new HashSet<CyReaderFactory>();
- }
-
- /**
- * Listener for OSGi service
- *
- * @param factory
- * @param props
- */
- @SuppressWarnings("unchecked")
- public void addReaderFactory(CyReaderFactory factory, Map props) {
- factories.add(factory);
- }
-
- /**
- * Listener for OSGi service
- *
- * @param factory
- * @param props
- */
- @SuppressWarnings("unchecked")
- public void removeReaderFactory(CyReaderFactory factory, Map props) {
- factories.remove(factory);
- }
-
- /**
- * Gets the GraphReader that is capable of reading the specified file.
- *
- * @param fileName
- * File name or null if no reader is capable of reading the
file.
- * @return GraphReader capable of reading the specified file.
- */
- public CyReader getReader(URI fileLocation, DataCategory category)
- throws IllegalArgumentException {
- return getReader(fileLocation, null, category);
- }
-
- public CyReader getReader(InputStream stream, DataCategory category)
- throws IllegalArgumentException {
- return getReader(null, stream, category);
- }
-
- private CyReader getReader(URI uri, InputStream stream,
- DataCategory category) {
-
- CyFileFilter cff;
- CyReader reader = null;
-
-
- for (CyReaderFactory factory : factories) {
-
- System.out.println("Checking factory #################
" + factory.getCyFileFilter().getDescription());
-
-
- cff = factory.getCyFileFilter();
-
- if (uri != null) {
-
- boolean accept = false;
- try
- {
- accept = cff.accept(uri, category);
- }
- catch (IOException e)
- {
- throw new
IllegalArgumentException("Failed to check file's contents: " + uri.toString(),
e);
- }
- if (accept)
- {
- try
- {
- reader = factory.getReader(uri);
- }
- catch (IOException e)
- {
- throw new
IllegalArgumentException("Could not get proper reader for the file.", e);
- }
- }
- } else {
- System.out.println("################# " +
cff.getClass());
- //if (cff.accept(stream, category))
- try
- {
- reader = factory.getReader(stream);
- }
- catch (IOException e)
- {
- throw new
IllegalArgumentException("Could not get proper reader for the file.", e);
- }
- }
- }
-
- if (reader == null) {
- throw new IllegalArgumentException("File type is not
supported.");
- }
-
- return reader;
-
- }
-
-}
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java
2010-08-18 00:18:19 UTC (rev 21434)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java
2010-08-18 00:20:04 UTC (rev 21435)
@@ -15,6 +15,7 @@
import org.cytoscape.model.GraphObject;
import org.cytoscape.model.CyTableManager;
import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
import static org.cytoscape.model.GraphObject.*;
@@ -42,7 +43,12 @@
this.tableMgr = tableMgr;
}
- public Map<Class<?>, Object> read() throws IOException {
+
+ public void run(TaskMonitor tm) throws IOException {
+
+ }
+ /*
+ public void read() throws IOException {
network = manager.getCurrentNetwork();
if( network == null)
@@ -71,15 +77,13 @@
System.out.println("Attr for " + node.getSUID() + "
=========> " + node.attrs().toString());
}
- readObjects.put(CyDataTable.class, table);
+ //readObjects.put(CyDataTable.class, table);
+ //this.cyDataTables = ??;
-
if (inputStream != null) {
inputStream.close();
inputStream = null;
}
-
- return readObjects;
}
private void createColumns(CyDataTable table, String line) {
@@ -130,5 +134,5 @@
}
}
}
-
+*/
}
Deleted:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/ssf/SSFReader.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/ssf/SSFReader.java
2010-08-18 00:18:19 UTC (rev 21434)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/ssf/SSFReader.java
2010-08-18 00:20:04 UTC (rev 21435)
@@ -1,58 +0,0 @@
-package org.cytoscape.io.internal.read.ssf;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.cytoscape.io.internal.read.AbstractNetworkReader;
-import org.cytoscape.model.CyNetwork;
-import org.cytoscape.model.subnetwork.CyRootNetwork;
-import org.cytoscape.model.subnetwork.CyRootNetworkFactory;
-
-public class SSFReader extends AbstractNetworkReader {
-
-
-
- private final SSFParser parser;
-
- private final CyRootNetworkFactory rnFactory;
-
- public SSFReader(CyRootNetworkFactory rnFactory) {
- super();
- this.rnFactory = rnFactory;
- parser = new SSFParser();
- }
-
- public Map<Class<?>, Object> read() throws IOException {
- Map<Class<?>, Object> result = new HashMap<Class<?>, Object>();
-
- // Create buffered reader from given InputStream
- final BufferedReader in = new BufferedReader(new
InputStreamReader(
- inputStream));
-
- final CyNetwork network = cyNetworkFactory.getInstance();
- final CyRootNetwork rootNet = rnFactory.convert(network);
-
- String line = null;
- try {
-
- while ((line = in.readLine()) != null) {
- parser.parse(rootNet, line);
- }
-
- } finally {
- try {
- in.close();
- } catch (IOException e) {
- throw e;
- }
- }
-
- result.put(CyRootNetwork.class, rootNet);
- parser.flush();
- return result;
- }
-
-}
--
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.