use of org.geosdi.geoplatform.connector.GPCatalogConnectorStore in project geo-platform by geosdi.
the class CSWGetRecordsEsriTest method testFullRecordEsri.
@Ignore(value = "Serve id Down")
@Test(expected = Exception.class)
public void testFullRecordEsri() throws Exception {
URL url = new URL("http://www.geoportale.isprambiente.it/geoportale" + "/csw/discovery");
GPCatalogConnectorStore serverConnector = GPCSWConnectorBuilder.newConnector().withServerUrl(url).build();
CatalogFinderBean finderBean = new CatalogFinderBean();
finderBean.setTextInfo(new TextInfo() {
private static final long serialVersionUID = 1L;
{
super.setText("scuole");
super.setSearchTitle(Boolean.TRUE);
super.setSearchSubjects(Boolean.FALSE);
super.setSearchAbstract(Boolean.FALSE);
}
});
CatalogGetRecordsRequest<GetRecordsResponseType> request = serverConnector.createGetRecordsRequest();
request.setTypeName(TypeName.RECORD_V202);
request.setOutputSchema(OutputSchema.CSW_V202);
request.setElementSetName(ElementSetType.FULL.value());
request.setResultType(ResultType.RESULTS.value());
request.setConstraintLanguage(ConstraintLanguage.FILTER);
request.setConstraintLanguageVersion(ConstraintLanguageVersion.V110);
request.setCatalogFinder(finderBean);
request.setStartPosition(BigInteger.ONE);
request.setMaxRecords(BigInteger.valueOf(25));
logger.debug("\n\n#####################RESPONSE AS STRING : {}\n\n", request.getResponseAsString());
GetRecordsResponseType response = request.getResponse();
SearchResultsType result = response.getSearchResults();
List<JAXBElement<? extends AbstractRecordType>> records = result.getAbstractRecord();
logger.debug("\n*** Record list size: {} ***", records.size());
processFirstResult((RecordType) records.get(1).getValue());
}
use of org.geosdi.geoplatform.connector.GPCatalogConnectorStore in project geo-platform by geosdi.
the class CSWServiceDelegate method createGetRecordsRequest.
private CatalogGetRecordsRequest<GetRecordsResponseType> createGetRecordsRequest(String serverUrl) throws Exception {
GPCatalogConnectorStore serverConnector = null;
try {
URL url = new URL(serverUrl);
GPCSWConnectorBuilder builder = GPCSWConnectorBuilder.newConnector().withServerUrl(url).withProxyConfiguration(cswProxyConfiguration);
if (serverUrl.contains("snipc.protezionecivile.it")) {
GPSecurityConnector securityConnector = new BasicPreemptiveSecurityConnector(snipcProvider.getSnipcUsername(), snipcProvider.getSnipcPassword());
builder.withClientSecurity(securityConnector);
}
serverConnector = builder.build();
} catch (MalformedURLException ex) {
logger.error("### MalformedURLException: {}", ex.getMessage());
throw new IllegalParameterFault("Malformed URL");
}
CatalogGetRecordsRequest<GetRecordsResponseType> request = serverConnector.createGetRecordsRequest();
return request;
}
use of org.geosdi.geoplatform.connector.GPCatalogConnectorStore in project geo-platform by geosdi.
the class GPCSWConnectorFactory method create.
/**
* @param key
* @return {@link GPCatalogConnectorStore}
* @throws Exception
*/
@Override
public GPCatalogConnectorStore create(GPPoolConnectorKey key) throws Exception {
checkNotNull(key, "The GPPoolConnectorKey must not be null");
GPCatalogVersion v = GPCatalogVersion.fromString(key.getVersion());
GPCatalogConnectorStore cswConnector = key.getProxyConfiguration() != null ? new GPCatalogConnectorStore(key.getServerUrl(), key.getPooledConnectorConfig(), key.getSecurityConnector(), key.getProxyConfiguration(), v) : new GPCatalogConnectorStore(key.getServerUrl(), key.getPooledConnectorConfig(), key.getSecurityConnector(), v);
return cswConnector;
}
use of org.geosdi.geoplatform.connector.GPCatalogConnectorStore in project geo-platform by geosdi.
the class CSWGetRecordsEsriTest method testFullRecordGeoSDI.
@Test
public void testFullRecordGeoSDI() throws Exception {
URL url = new URL("http://catalog.geosdi.org:80/geonetwork/srv/eng/csw");
GPCatalogConnectorStore serverConnector = GPCSWConnectorBuilder.newConnector().withServerUrl(url).build();
CatalogGetRecordsRequest<GetRecordsResponseType> request = serverConnector.createGetRecordsRequest();
request.setTypeName(TypeName.METADATA);
request.setOutputSchema(OutputSchema.CSW_V202);
request.setElementSetName(ElementSetType.FULL.toString());
request.setResultType(ResultType.RESULTS.toString());
request.setStartPosition(BigInteger.ONE);
request.setMaxRecords(BigInteger.valueOf(25));
logger.debug("\n\n#####################RESPONSE AS STRING : {}\n\n", request.getResponseAsString());
GetRecordsResponseType response = request.getResponse();
SearchResultsType result = response.getSearchResults();
List<JAXBElement<? extends AbstractRecordType>> metadata = result.getAbstractRecord();
Assert.assertEquals("The Result not contains 25 elements", 25, metadata.size());
processFirstResult((RecordType) metadata.get(0).getValue());
}
use of org.geosdi.geoplatform.connector.GPCatalogConnectorStore in project geo-platform by geosdi.
the class CSWServiceDelegate method getRecordById.
@Override
public String getRecordById(Long serverID, String identifier) throws Exception {
logger.trace("\n*** GetRecordById ***\n");
GeoPlatformServer server = this.getCSWServerByID(serverID);
GPCatalogConnectorStore serverConnector = this.createServerConnector(server.getServerUrl());
OutputSchema outputSchema = this.gpCSWOutputSchemaFinder.retrieveBestOutputSchemaForRequest(serverConnector, GET_RECORD_BY_ID.toString());
CatalogGetRecordByIdRequest<GetRecordByIdResponseType> request = serverConnector.createGetRecordByIdRequest();
request.setId(identifier);
request.setElementSetType(ElementSetType.FULL.value());
request.setOutputSchema(outputSchema);
String response = this.createGetRecordByIdResponseAsString(request);
String responseXSL = this.insertStylesheet(response);
return responseXSL;
}
Aggregations