Friday, 13 October 2017

java - Seeking example or docs for geotk-client-csw package



I need a simple but fast CSW client. CatalogServicesClient is created terribly slow. I was about to write my own pool but suddenly found org.geotoolkit.csw.CSWClientFactory not mentioned in anywhere. It has open() with sematics that makes no sense to me.


Any directions please?



Answer



Diving into the lib source code gives the following solution.


Prepare factory and params (cache into fields assumably):


CSWClientFactory cswClientFactory = new CSWClientFactory();
ParameterValueGroup clientFactoryParams = CSWClientFactory.PARAMETERS.createValue();

clientFactoryParams.parameter(AbstractClientFactory.URL.getName().getCode()).setValue(new URL(serviceURL));

Obtain the client when you need it:


CatalogServicesClient catalogServicesClient = (CatalogServicesClient) cswClientFactory.open(clientFactoryParams);

Subsequent calls are blazingly fast!


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...