org.openjump.core.ui.io.file
Class DataSourceFileLayerLoader

java.lang.Object
  extended by org.openjump.core.ui.io.file.AbstractFileLayerLoader
      extended by org.openjump.core.ui.io.file.DataSourceFileLayerLoader
All Implemented Interfaces:
FileLayerLoader

public class DataSourceFileLayerLoader
extends AbstractFileLayerLoader

The DataSourceFileLayerLoader is an implementation of FileLayerLoader that wraps an existing file based DataSource class.

Author:
Paul Austin

Field Summary
 
Fields inherited from interface org.openjump.core.ui.io.file.FileLayerLoader
KEY
 
Constructor Summary
DataSourceFileLayerLoader(WorkbenchContext workbenchContext, java.lang.Class dataSourceClass, java.lang.String description, java.util.List<java.lang.String> extensions)
          Construct a new DataSourceFileLayerLoader.
 
Method Summary
 boolean open(TaskMonitor monitor, java.net.URI uri, java.util.Map<java.lang.String,java.lang.Object> options)
          Open the file specified by the URI with the map of option values.
protected  java.util.Map<java.lang.String,java.lang.Object> toProperties(java.net.URI uri, java.util.Map<java.lang.String,java.lang.Object> options)
          Convert the URI and map of options for the data source.
 
Methods inherited from class org.openjump.core.ui.io.file.AbstractFileLayerLoader
addOption, getDescription, getFileExtensions, getOptionMetadata, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSourceFileLayerLoader

public DataSourceFileLayerLoader(WorkbenchContext workbenchContext,
                                 java.lang.Class dataSourceClass,
                                 java.lang.String description,
                                 java.util.List<java.lang.String> extensions)
Construct a new DataSourceFileLayerLoader.

Parameters:
workbenchContext - The workbench context.
dataSourceClass - The DataSource class.
description - The file format name.
extensions - The list of supported extensions.
Method Detail

open

public boolean open(TaskMonitor monitor,
                    java.net.URI uri,
                    java.util.Map<java.lang.String,java.lang.Object> options)
Open the file specified by the URI with the map of option values.

Parameters:
monitor - The TaskMonitor.
uri - The URI to the file to load.
options - The map of options.
Returns:
True if the file could be loaded false otherwise.

toProperties

protected java.util.Map<java.lang.String,java.lang.Object> toProperties(java.net.URI uri,
                                                                        java.util.Map<java.lang.String,java.lang.Object> options)
Convert the URI and map of options for the data source. If the URI is a ZIP uri the File option will be set to the ZIP file name and the CompressedFile set to the entry in the ZIP file.

Parameters:
uri - The URI to the file.
options - The selected options.
Returns:
The options.