# Path: txcas/interface.py
# class IServiceManager(Interface):
# 
#     def getMatchingService(service):
#         """
#         Return the entry for the first matching service or None.
#         """
# 
#     def isValidService(service):
#         """
#         Returns True if the service is valid; False otherwise.
#         """
# 
#     def isSSOService(service):
#         """
#         Returns True if the service participates in SSO.
#         Returns False if the service will only accept primary credentials.
#         """
# 
# class IServiceManagerFactory(Interface):
# 
#     tag = Attribute('String used to identify the plugin factory.')
#     opt_help = Attribute('String description of the plugin.')
#     opt_usage = Attribute('String describes how to provide arguments for factory.')
# 
#     def generateServiceManager(argstring=""):
#         """
#         Create an object that implements txcas.IServiceManager
#         """


import cgi
import itertools
import json
import sys
import urlparse
import txcas.settings
from textwrap import dedent
from txcas.interface import IServiceManager, IServiceManagerFactory
from twisted.internet import reactor
from twisted.plugin import IPlugin
from twisted.python import log
from twisted.python.filepath import FilePath
from zope.interface import implements
                "Missing the following settings: %s" % ', '.join(missing))
            sys.stderr.write('\n')
            sys.exit(1)

        txcas.utils.filter_args(JSONServiceManager.__init__, config, ['self'])
        buf = ["[CONFIG][JSONServiceManager] Settings:"]
        for k in sorted(config.keys()):
            v = config[k]
            buf.append(" - %s: %s" % (k, v))
        sys.stderr.write('\n'.join(buf))
        sys.stderr.write('\n')
        return JSONServiceManager(config["path"])

class JSONServiceManager(object):
    """
    Basic structure::
    
    [
        {
            'name': 'Service Name',
            'scheme': 'http|https(default)|*',
            'netloc': 'host[:port]',
            'path': '/some/resource',
            'child_paths': true|false(default),
            'required_params': None(default) or {param: [value, value, ...]},
            'SSO': true(default)|false
        },
        ...
    ]
    """

# Path: txcas/interface.py
# class IServiceManager(Interface):
# 
#     def getMatchingService(service):
#         """
#         Return the entry for the first matching service or None.
#         """
# 
#     def isValidService(service):
#         """
#         Returns True if the service is valid; False otherwise.
#         """
# 
#     def isSSOService(service):
#         """
#         Returns True if the service participates in SSO.
#         Returns False if the service will only accept primary credentials.
#         """
# 
# class IServiceManagerFactory(Interface):
# 
#     tag = Attribute('String used to identify the plugin factory.')
#     opt_help = Attribute('String description of the plugin.')
#     opt_usage = Attribute('String describes how to provide arguments for factory.')
# 
#     def generateServiceManager(argstring=""):
#         """
#         Create an object that implements txcas.IServiceManager
#         """


# Path: txcas/json_service_manager.py
import cgi
import itertools
import json
import sys
import urlparse
import txcas.settings
from textwrap import dedent
from txcas.interface import IServiceManager, IServiceManagerFactory
from twisted.internet import reactor
from twisted.plugin import IPlugin
from twisted.python import log
from twisted.python.filepath import FilePath
from zope.interface import implements

                "Missing the following settings: %s" % ', '.join(missing))
            sys.stderr.write('\n')
            sys.exit(1)

        txcas.utils.filter_args(JSONServiceManager.__init__, config, ['self'])
        buf = ["[CONFIG][JSONServiceManager] Settings:"]
        for k in sorted(config.keys()):
            v = config[k]
            buf.append(" - %s: %s" % (k, v))
        sys.stderr.write('\n'.join(buf))
        sys.stderr.write('\n')
        return JSONServiceManager(config["path"])

class JSONServiceManager(object):
    """
    Basic structure::
    
    [
        {
            'name': 'Service Name',
            'scheme': 'http|https(default)|*',
            'netloc': 'host[:port]',
            'path': '/some/resource',
            'child_paths': true|false(default),
            'required_params': None(default) or {param: [value, value, ...]},
            'SSO': true(default)|false
        },
        ...
    ]
    """

    implements(IServiceManager)