Search in sources :

Example 26 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer 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;
}
Also used : GPCatalogConnectorStore(org.geosdi.geoplatform.connector.GPCatalogConnectorStore) OutputSchema(org.geosdi.geoplatform.xml.csw.OutputSchema) GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer)

Example 27 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class CSWServiceDelegate method getRecordsCount.

@Override
public int getRecordsCount(CatalogFinderBean catalogFinder) throws Exception {
    logger.trace("########################## getRecordsCount {}\n", catalogFinder);
    GeoPlatformServer server = this.getCSWServerByID(catalogFinder.getServerID());
    CatalogGetRecordsRequest<GetRecordsResponseType> request = this.createGetRecordsRequest(server.getServerUrl());
    request.setTypeName(TypeName.RECORD_V202);
    request.setOutputSchema(OutputSchema.CSW_V202);
    request.setElementSetName(ElementSetType.BRIEF.value());
    request.setResultType(ResultType.HITS.value());
    request.setConstraintLanguage(ConstraintLanguage.FILTER);
    request.setConstraintLanguageVersion(ConstraintLanguageVersion.V110);
    request.setCatalogFinder(catalogFinder);
    GetRecordsResponseType response = this.createGetRecordsResponse(request);
    logger.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@RESPONSE : {}\n\n\n", request);
    return response.getSearchResults().getNumberOfRecordsMatched().intValue();
}
Also used : GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer)

Example 28 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class CSWServiceDelegate method getServerDetailCSWByUrl.

/**
 * @see GeoPlatformCSWService#getServerDetailCSWByUrl(java.lang.String)
 */
@Override
public GeoPlatformServer getServerDetailCSWByUrl(String serverUrl) throws ResourceNotFoundFault {
    GeoPlatformServer server = serverDao.findByServerUrl(serverUrl);
    if (server == null) {
        throw new ResourceNotFoundFault("Server not found " + serverUrl);
    }
    // TODO assert
    CSWEntityCorrectness.checkCSWServerLog(server);
    return server;
}
Also used : GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault)

Example 29 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class GPWMSDelegateImpl method getCapabilitiesAuth.

/**
 * @param serverUrl
 * @param request
 * @param token
 * @param authkey
 * @param headers
 * @return {@link ServerDTO}
 * @throws Exception
 */
@Override
public ServerDTO getCapabilitiesAuth(String serverUrl, RequestByID request, String token, String authkey, List<WMSHeaderParam> headers) throws ResourceNotFoundFault {
    ServerDTO serverDTO;
    String userName = null;
    String password = null;
    if (request.getId() != null) {
        GeoPlatformServer server = serverDao.find(request.getId());
        if (server == null) {
            throw new ResourceNotFoundFault("Server has been deleted", request.getId());
        }
        serverDTO = new ServerDTO(server);
        if (server.isProtected()) {
            userName = server.getAuthServer().getUsername();
            password = this.pooledPBEStringEncryptorDecorator.decrypt(server.getAuthServer().getPassword());
        }
    } else {
        serverDTO = new ServerDTO();
        serverDTO.setServerUrl(serverUrl);
    }
    List<RasterLayerDTO> layers = this.wmsCapabilitiesBuilder.loadWMSCapabilitiesAuth(serverUrl, token, authkey, headers, userName, password);
    serverDTO.setLayerList(layers);
    return serverDTO;
}
Also used : ServerDTO(org.geosdi.geoplatform.response.ServerDTO) GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) RasterLayerDTO(org.geosdi.geoplatform.response.RasterLayerDTO)

Example 30 with GeoPlatformServer

use of org.geosdi.geoplatform.core.model.GeoPlatformServer in project geo-platform by geosdi.

the class GPWMSDelegateImpl method getCapabilities.

/**
 * @param serverUrl
 * @param request
 * @param token
 * @param authkey
 * @return {@link ServerDTO}
 * @throws Exception
 */
@Override
public ServerDTO getCapabilities(String serverUrl, RequestByID request, String token, String authkey) throws ResourceNotFoundFault {
    ServerDTO serverDTO;
    String userName = null;
    String password = null;
    if (request.getId() != null) {
        GeoPlatformServer server = serverDao.find(request.getId());
        if (server == null) {
            throw new ResourceNotFoundFault("Server has been deleted", request.getId());
        }
        serverDTO = new ServerDTO(server);
        if (server.isProtected()) {
            userName = server.getAuthServer().getUsername();
            password = server.getAuthServer().getPassword();
        }
    } else {
        serverDTO = new ServerDTO();
        serverDTO.setServerUrl(serverUrl);
    }
    List<RasterLayerDTO> layers = this.wmsCapabilitiesBuilder.loadWMSCapabilities(serverUrl, token, authkey, userName, password);
    serverDTO.setLayerList(layers);
    return serverDTO;
}
Also used : ServerDTO(org.geosdi.geoplatform.response.ServerDTO) GeoPlatformServer(org.geosdi.geoplatform.core.model.GeoPlatformServer) ResourceNotFoundFault(org.geosdi.geoplatform.exception.ResourceNotFoundFault) RasterLayerDTO(org.geosdi.geoplatform.response.RasterLayerDTO)

Aggregations

GeoPlatformServer (org.geosdi.geoplatform.core.model.GeoPlatformServer)40 Test (org.junit.Test)15 ResourceNotFoundFault (org.geosdi.geoplatform.exception.ResourceNotFoundFault)9 ServerDTO (org.geosdi.geoplatform.response.ServerDTO)8 GPOrganization (org.geosdi.geoplatform.core.model.GPOrganization)6 GPDAOException (org.geosdi.geoplatform.persistence.dao.exception.GPDAOException)6 ServerCSWDTO (org.geosdi.geoplatform.responce.ServerCSWDTO)3 Ignore (org.junit.Ignore)3 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2 JAXBElement (javax.xml.bind.JAXBElement)2 IllegalParameterFault (org.geosdi.geoplatform.exception.IllegalParameterFault)2 ServerInternalFault (org.geosdi.geoplatform.exception.ServerInternalFault)2 PaginatedSearchRequest (org.geosdi.geoplatform.request.PaginatedSearchRequest)2 WSSaveServerRequest (org.geosdi.geoplatform.request.server.WSSaveServerRequest)2 RasterLayerDTO (org.geosdi.geoplatform.response.RasterLayerDTO)2 IOException (java.io.IOException)1 URL (java.net.URL)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1