# Path: dapbench/thredds/lib/configuration.py
# class Configuration(object):
#     """Checker configuration.
#     """
#     def __init__(self, key_file, cert_file, debug, recurse=False, listonly=False, quiet=False,
#                  services_to_test="", service_extensions=None, public_service_extensions=None,
#                  forbidden_service_extensions=None, required_container_properties=None,
#                  required_file_properties=None):
#         """
#         @param key_file - file containing the user's private key
#         @param cert_file - file containing the user's certificate
#         @param services_to_test - list of service types for which to test access
#         @param debug - if True, output debugging information
#         @param recurse - if True, recurse into linked catalogs
#         @param listonly - if True, only list datasets, otherwise check access
#         @param quiet - if True, produce minimal output
#         @param service_extensions - extensions for services that can have multiple extensions
#         @param public_service_extensions - service types and extensions for which public access is
#             expected
#         @param forbidden_service_extensions - service types and extensions for which no access is
#             expected
#         @param required_container_properties - dataset properties required for container datasets
#         @param required_file_properties - dataset properties required for file datasets
#         """
#         self.key_file = key_file
#         self.cert_file = cert_file
#         self.services_to_test = (
#             [s.strip() for s in services_to_test.split(',')] if services_to_test else [])
#         self.debug = debug
#         self.recurse = recurse
#         self.listonly = listonly
#         self.quiet = quiet
#         self.service_extensions = self.parse_dict_of_lists(service_extensions)
#         self.public_service_extensions = self.parse_dict_of_lists(public_service_extensions)
#         self.forbidden_service_extensions = self.parse_dict_of_lists(forbidden_service_extensions)
#         self.required_container_properties = (
#             [p.strip() for p in required_container_properties.split(',')]
#             if required_container_properties else [])
#         self.required_file_properties = (
#             [p.strip() for p in required_file_properties.split(',')]
#             if required_file_properties else [])
# 
#     @staticmethod
#     def parse_dict_of_lists(in_str):
#         """Parses a string in the format key1:item11,item12,...;key2:item21,item22...;...
#         into a dict with keys key1, key2, ... and values lists [item11, item12] and so on.
#         @param in_str - string to parse
#         @return dict of lists of items
#         """
#         result = {}
#         if in_str is not None:
#             outer_list = in_str.split(';')
#             for item in outer_list:
#                 (key, sep, inner_str) = item.partition(':')
#                 inner_list = inner_str.split(',')
#                 result[key] = inner_list
#         return result
# 
# Path: dapbench/thredds/lib/service_config.py
# class Service(object):
#     # Extensions to be appended to URLs for particular services to access different types of data.
#     _default_extensions = {
#         'OPENDAP': [".html", ".dds", ".das", ".asc", ".ascii", ".dods"],
#         'HTTPServer': None
#     }
# 
#     _default_public_extensions = {
#         'OPENDAP': [".html"]
#     }
# 
#     def __init__(self, name, service_type, base_url, suffix, extensions, public_extensions=None,
#                  forbidden_extensions=None):
#         """
#         @param name - name attribute
#         @param service_type - serviceType attribute
#         @param base_url - base attribute
#         @param suffix - suffix attribute
#         @param extensions - extensions to be appended to URLs to override defaults
#         @param public_extensions - extensions for which public access is to be assumed
#         @param forbidden_extensions - extensions for which no access is to be assumed
#         """
#         self.name = name
#         self.service_type = service_type
#         self.base_url = base_url
#         self.suffix = suffix
#         self.extensions = (extensions if extensions is not None
#                            else self._default_extensions.get(service_type, None))
#         self.public_extensions = (public_extensions if public_extensions is not None
#                                   else self._default_public_extensions.get(service_type, None))
#         self.forbidden_extensions = (forbidden_extensions if forbidden_extensions is not None
#                                      else None)
#         self.children = []
# 
#     def is_public(self, extension):
#         if self.public_extensions is not None:
#             if extension in self.public_extensions:
#                 return True
#         return False
# 
#     def is_forbidden(self, extension):
#         if self.forbidden_extensions is not None:
#             if extension in self.forbidden_extensions:
#                 return True
#         return False
# 
#     def __str__(self):
#         return ("'%s'  '%s'  '%s'  '%s'  '%s'  '%s'" % (self.name, self.service_type, self.base_url,
#                                                         self.suffix, self.extensions.__str__(),
#                 [s.name for s in self.children]))


from optparse import OptionParser
from dapbench.thredds.lib.configuration import Configuration
from dapbench.thredds.lib.service_config import Service
import os
import dapbench.thredds.lib.httpget as httpget
# BSD Licence
# Copyright (c) 2012, Science & Technology Facilities Council (STFC)
# All rights reserved.
#
# See the LICENSE file in the source distribution of this software for
# the full license text.

'''
Created on 26 Sep 2011

@author: rwilkinson
'''

def configure_services():
    services = [

# Path: dapbench/thredds/lib/configuration.py
# class Configuration(object):
#     """Checker configuration.
#     """
#     def __init__(self, key_file, cert_file, debug, recurse=False, listonly=False, quiet=False,
#                  services_to_test="", service_extensions=None, public_service_extensions=None,
#                  forbidden_service_extensions=None, required_container_properties=None,
#                  required_file_properties=None):
#         """
#         @param key_file - file containing the user's private key
#         @param cert_file - file containing the user's certificate
#         @param services_to_test - list of service types for which to test access
#         @param debug - if True, output debugging information
#         @param recurse - if True, recurse into linked catalogs
#         @param listonly - if True, only list datasets, otherwise check access
#         @param quiet - if True, produce minimal output
#         @param service_extensions - extensions for services that can have multiple extensions
#         @param public_service_extensions - service types and extensions for which public access is
#             expected
#         @param forbidden_service_extensions - service types and extensions for which no access is
#             expected
#         @param required_container_properties - dataset properties required for container datasets
#         @param required_file_properties - dataset properties required for file datasets
#         """
#         self.key_file = key_file
#         self.cert_file = cert_file
#         self.services_to_test = (
#             [s.strip() for s in services_to_test.split(',')] if services_to_test else [])
#         self.debug = debug
#         self.recurse = recurse
#         self.listonly = listonly
#         self.quiet = quiet
#         self.service_extensions = self.parse_dict_of_lists(service_extensions)
#         self.public_service_extensions = self.parse_dict_of_lists(public_service_extensions)
#         self.forbidden_service_extensions = self.parse_dict_of_lists(forbidden_service_extensions)
#         self.required_container_properties = (
#             [p.strip() for p in required_container_properties.split(',')]
#             if required_container_properties else [])
#         self.required_file_properties = (
#             [p.strip() for p in required_file_properties.split(',')]
#             if required_file_properties else [])
# 
#     @staticmethod
#     def parse_dict_of_lists(in_str):
#         """Parses a string in the format key1:item11,item12,...;key2:item21,item22...;...
#         into a dict with keys key1, key2, ... and values lists [item11, item12] and so on.
#         @param in_str - string to parse
#         @return dict of lists of items
#         """
#         result = {}
#         if in_str is not None:
#             outer_list = in_str.split(';')
#             for item in outer_list:
#                 (key, sep, inner_str) = item.partition(':')
#                 inner_list = inner_str.split(',')
#                 result[key] = inner_list
#         return result
# 
# Path: dapbench/thredds/lib/service_config.py
# class Service(object):
#     # Extensions to be appended to URLs for particular services to access different types of data.
#     _default_extensions = {
#         'OPENDAP': [".html", ".dds", ".das", ".asc", ".ascii", ".dods"],
#         'HTTPServer': None
#     }
# 
#     _default_public_extensions = {
#         'OPENDAP': [".html"]
#     }
# 
#     def __init__(self, name, service_type, base_url, suffix, extensions, public_extensions=None,
#                  forbidden_extensions=None):
#         """
#         @param name - name attribute
#         @param service_type - serviceType attribute
#         @param base_url - base attribute
#         @param suffix - suffix attribute
#         @param extensions - extensions to be appended to URLs to override defaults
#         @param public_extensions - extensions for which public access is to be assumed
#         @param forbidden_extensions - extensions for which no access is to be assumed
#         """
#         self.name = name
#         self.service_type = service_type
#         self.base_url = base_url
#         self.suffix = suffix
#         self.extensions = (extensions if extensions is not None
#                            else self._default_extensions.get(service_type, None))
#         self.public_extensions = (public_extensions if public_extensions is not None
#                                   else self._default_public_extensions.get(service_type, None))
#         self.forbidden_extensions = (forbidden_extensions if forbidden_extensions is not None
#                                      else None)
#         self.children = []
# 
#     def is_public(self, extension):
#         if self.public_extensions is not None:
#             if extension in self.public_extensions:
#                 return True
#         return False
# 
#     def is_forbidden(self, extension):
#         if self.forbidden_extensions is not None:
#             if extension in self.forbidden_extensions:
#                 return True
#         return False
# 
#     def __str__(self):
#         return ("'%s'  '%s'  '%s'  '%s'  '%s'  '%s'" % (self.name, self.service_type, self.base_url,
#                                                         self.suffix, self.extensions.__str__(),
#                 [s.name for s in self.children]))


# Path: dapbench/thredds/lib/dataset_access.py
from optparse import OptionParser
from dapbench.thredds.lib.configuration import Configuration
from dapbench.thredds.lib.service_config import Service
import os
import dapbench.thredds.lib.httpget as httpget

# BSD Licence
# Copyright (c) 2012, Science & Technology Facilities Council (STFC)
# All rights reserved.
#
# See the LICENSE file in the source distribution of this software for
# the full license text.

'''
Created on 26 Sep 2011

@author: rwilkinson
'''

def configure_services():
    services = [

        Service("odap", "OPENDAP", "/thredds/dodsC/", "", [".html", ".dds", ".das", ".asc", ".dods"]),