@Override
  public SensorMetadataResponse getSensorMetadata(final TimeseriesProperties tsProperties)
      throws Exception {
    try {
      LOG.debug("Request -> GetSensorMetadata");
      JavaHelper.cleanUpDir(
          ConfigurationContext.XSL_DIR, ConfigurationContext.FILE_KEEPING_TIME, "xml");

      SosTimeseries timeseries = tsProperties.getTimeseries();
      SOSMetadata sosMetadata = getSOSMetadata(timeseries.getServiceUrl());
      MetadataHandler metadataHandler = createSosMetadataHandler(sosMetadata);
      metadataHandler.assembleTimeseriesMetadata(tsProperties);

      String procedureId = timeseries.getProcedureId();
      TimeseriesParametersLookup lookup = sosMetadata.getTimeseriesParametersLookup();
      Procedure procedure = lookup.getProcedure(procedureId);
      procedure.addAllRefValues(tsProperties.getRefvalues());

      SensorMetadataResponse response = new SensorMetadataResponse(tsProperties);
      if (LOG.isDebugEnabled()) {
        LOG.debug("Parsed SensorMetadata: {}", response.toDebugString());
      }

      return response;
    } catch (Exception e) {
      LOG.error("Exception occured on server side.", e);
      throw e; // last chance to log on server side
    }
  }
 @Override
 public GetProcedureDetailsUrlResponse getProcedureDetailsUrl(SosTimeseries timeseries)
     throws Exception {
   try {
     LOG.debug("Request -> getProcedureDetailsUrl");
     TimeseriesProperties properties = new TimeseriesProperties(timeseries, null, -1, -1);
     SOSMetadata metadata = ConfigurationContext.getSOSMetadata(timeseries.getServiceUrl());
     MetadataHandler metadataHandler = createSosMetadataHandler(metadata);
     metadataHandler.assembleTimeseriesMetadata(properties);
     return new GetProcedureDetailsUrlResponse(properties.getMetadataUrl());
   } catch (Exception e) {
     LOG.error("Exception occured on server side.", e);
     throw e; // last chance to log on server side
   }
 }