Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.data
Class ImportHandler

java.lang.Object
  extended by cytoscape.data.ImportHandler

public class ImportHandler
extends Object

Central registry for all Cytoscape import classes.

Author:
Cytoscape Development Team.

Field Summary
static String EDGE_NATURE
          Filter Type: EDGE.
static String GRAPH_NATURE
          Filter Type: NETWORK.
static String NODE_NATURE
          Filter Type: NODE.
static String PROPERTIES_NATURE
          Filer Type: PROPERTIES.
 
Constructor Summary
ImportHandler()
          Constructor.
 
Method Summary
 boolean addFilter(CyFileFilter cff)
          Registers a new CyFileFilter.
 boolean addFilter(CyFileFilter[] cff)
          Registers an Array of CyFileFilter Objects.
 File downloadFromURL(URL url, TaskMonitor taskMonitor)
          Download a temporary file from the given URL.
 Collection getAllDescriptions()
          Gets a collection of all registered filter descriptions.
 Collection getAllExtensions()
          Gets a collection of all registered file extensions.
 List getAllFilters()
          Gets a list of all registered filters plus a catch-all super set filter.
 List getAllFilters(String fileNature)
          Gets a list of all registered filters, which are of type: fileNature, plus a catch-all super set filter.
 Collection getAllTypes(String fileNature)
          Gets descriptions for all registered filters, which are of the type: fileNature.
 String getFileType(String fileName)
          Gets the name of the filter which is capable of reading the specified file.
 GraphReader getReader(String fileName)
          Gets the GraphReader that is capable of reading the specified file.
 GraphReader getReader(URL url)
          Gets the GraphReader that is capable of reading URL.
 void resetImportHandler()
          Unregisters all registered File Filters (except default file filters.)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRAPH_NATURE

public static String GRAPH_NATURE
Filter Type: NETWORK.


NODE_NATURE

public static String NODE_NATURE
Filter Type: NODE.


EDGE_NATURE

public static String EDGE_NATURE
Filter Type: EDGE.


PROPERTIES_NATURE

public static String PROPERTIES_NATURE
Filer Type: PROPERTIES.

Constructor Detail

ImportHandler

public ImportHandler()
Constructor.

Method Detail

addFilter

public boolean addFilter(CyFileFilter cff)
Registers a new CyFileFilter.

Parameters:
cff - CyFileFilter.
Returns:
true indicates filter was added successfully.

addFilter

public boolean addFilter(CyFileFilter[] cff)
Registers an Array of CyFileFilter Objects.

Parameters:
cff - Array of CyFileFilter Objects.
Returns:
true indicates all filters were added successfully.

getReader

public GraphReader getReader(String fileName)
Gets the GraphReader that is capable of reading the specified file.

Parameters:
fileName - File name or null if no reader is capable of reading the file.
Returns:
GraphReader capable of reading the specified file.

getReader

public GraphReader getReader(URL url)
Gets the GraphReader that is capable of reading URL.

Parameters:
url - -- the URL string
Returns:
GraphReader capable of reading the specified URL.

getAllTypes

public Collection getAllTypes(String fileNature)
Gets descriptions for all registered filters, which are of the type: fileNature.

Parameters:
fileNature - type: GRAPH_NATURE, NODE_NATURE, EDGE_NATURE, etc.
Returns:
Collection of String descriptions, e.g. "XGMML files"

getAllExtensions

public Collection getAllExtensions()
Gets a collection of all registered file extensions.

Returns:
Collection of Strings, e.g. "xgmml", "sif", etc.

getAllDescriptions

public Collection getAllDescriptions()
Gets a collection of all registered filter descriptions. Descriptions are of the form: "{File Description} ({file extensions})". For example: "GML files (*.gml)"

Returns:
Collection of Strings, e.g. "GML files (*.gml)", etc.

getFileType

public String getFileType(String fileName)
Gets the name of the filter which is capable of reading the specified file.

Parameters:
fileName - File Name.
Returns:
name of filter capable of reading the specified file.

getAllFilters

public List getAllFilters()
Gets a list of all registered filters plus a catch-all super set filter.

Returns:
List of CyFileFilter Objects.

getAllFilters

public List getAllFilters(String fileNature)
Gets a list of all registered filters, which are of type: fileNature, plus a catch-all super set filter.

Parameters:
fileNature - type: GRAPH_NATURE, NODE_NATURE, EDGE_NATURE, etc.
Returns:
List of CyFileFilter Objects.

resetImportHandler

public void resetImportHandler()
Unregisters all registered File Filters (except default file filters.) Resets everything with a clean slate.


downloadFromURL

public File downloadFromURL(URL url,
                            TaskMonitor taskMonitor)
                     throws IOException,
                            FileNotFoundException
Download a temporary file from the given URL. The file will be saved in the temporary directory and will be deleted after Cytoscape exits.

Parameters:
u - -- the URL string, TaskMonitor if any
Returns:
-- a temporary file downloaded from the given URL.
Throws:
IOException
FileNotFoundException

www.cytoscape.org