/**
 * ﻿Copyright (C) 2013 52°North Initiative for Geospatial Open Source Software GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.n52.supervisor.checks.ows;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Daniel Nüst
 * 
 */
public class SosCapabilitiesCheckRunner extends OwsCapabilitiesCheckRunner {

    private static Logger log = LoggerFactory.getLogger(SosCapabilitiesCheckRunner.class);

    private static final String SOS_SERVICE = "SOS";

    public SosCapabilitiesCheckRunner(OwsCapabilitiesCheck check) {
        super(check);

        if ( !check.getServiceType().equals(SOS_SERVICE))
            log.warn("Checking non-SOS {} with SOS runner: {}", check, this);
    }

    @Override
    public boolean check() {
        log.debug("Checking SOS Capabilities for " + this.c.getServiceUrl());
        return runGetRequestParseDocCheck();
    }

}

@@ -1039,16 +1039,22 @@
 kRunner(
+final 
 OwsCapab
@@ -1159,21 +1159,14 @@
 CE))
-%0A            
+ %7B%0A%09%09%09
 log.
@@ -1227,16 +1227,20 @@
  this);%0A
+%09%09%7D%0A
     %7D%0A%0A 
@@ -1338,13 +1338,8 @@
 %22 + 
-this.
 c.ge
@@ -1404,12 +1404,314 @@
 );%0A    %7D
+%0A    %0A    @Override%0A    protected String buildGetRequest() %7B%0A    %09final String kvpRequest = super.buildGetRequest();%0A    %09// the parameter 'serviceVersion' is not supported by 52North implementation but 'AcceptVersions' is!%0A    %09return kvpRequest.replaceFirst(%22serviceVersion%22, %22AcceptVersions%22);%0A    %7D
 %0A%0A%7D%0A

fix problem with 52north sos implementation: optional kvp parameter 'serviceVersion' is not supported but 'AcceptVersions'