I should not forget to take a look at DataSourceFileLayerLoader which
already provides a similar functionality.

But it needs to split up in serveral independent methods. i.e. split
DataSourceFileLayerLoader.open() into toDataSourceQuery(),
toFeatureCollection() and toLayer().

--Benjamin

2010/5/28 Benjamin Gudehus <hasteb...@googlemail.com>

> What I forgot to mention: I've written it in Groovy. My unit tests /
> specifications depend on Groovy and Spock. Once finished I'll
> rewrite/convert the non-test code to Java.
>
> 2010/5/28 Benjamin Gudehus <hasteb...@googlemail.com>
>
> I pushed a working draft of DataSourceTools to
>> http://bitbucket.org/hastebrot/openjump-groovy-addons/src/653c99258dea/src/org/openjump/groovy/DataSourceTools.groovy
>> .
>>
>> Here an outline:
>>
>> class DataSourceTools {
>>
>>     static DataSourceQuery toDataSourceQuery(File file, Class
>> dataSourceClass,
>>             CoordinateSystem coordinateSystem)
>>     static FeatureCollection toFeatureCollection(DataSourceQuery
>> dataSourceQuery)
>>     static DataSource toDataSource(Class dataSourceClass)
>>
>> }
>>
>> class InternalLoadDatasetPlugIn extends AbstractPlugIn {
>>
>>     void initialize(PlugInContext context)
>>     boolean execute(PlugInContext context)
>>
>>     void setFilepath(File filepath)
>>
>>     // optional -- automatically recognized using file extension
>>     void setFormat(String format)
>>
>>     // optional -- use CoordinateSystem.UNSPECIFIED
>>     void setCoordinateSystem()
>>
>>     // optional -- use StandardCategoryNames.WORKING
>>     void setCategory()
>>
>>     // optional -- use filename without extension.
>>     void setLayerName()
>> }
>>
>> 2010/5/28 Larry Becker <becker.la...@gmail.com>
>>
>> Thanks for volunteering to do this Benjamin.  We probably need to make a
>>> new page on the wiki that documents it called something like "how to load
>>> layers in a plugin".  A snippet of BeanShell would be nice too.  :-]
>>>
>>> regards,
>>> Larry
>>>
>>> On Fri, May 28, 2010 at 3:26 AM, Benjamin Gudehus <
>>> hasteb...@googlemail.com> wrote:
>>>
>>>> how about not splitting the class (i.e. avoiding to break anything), but
>>>>> just add the second class for programmatical access? Maybe this could
>>>>> even go into the core.apitools package.
>>>>
>>>>
>>>>  yes, important to make no backward incompatible changes to
>>>> LoadDatasetPlugIn.
>>>>
>>>>
>>>> If you feel like creating such a class, I can add it.
>>>>>
>>>>
>>>> good chance to me to contribute some code ;)
>>>>
>>>>
>>>> First step is to extract dataset loading with DataSource from
>>>> LoadDatasetPlugIn into a
>>>> new class called DataSourceTools (or so) in org.openjump.core.apitools.
>>>>
>>>> --Benjamin
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Jump-pilot-devel mailing list
>>>> Jump-pilot-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> Jump-pilot-devel mailing list
>>> Jump-pilot-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>
>>>
>>
>
------------------------------------------------------------------------------

_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to