示例#1
0
from ally.api.error import InputError

# --------------------------------------------------------------------

log = logging.getLogger(__name__)

asPattern = lambda rootURI: '^%s(?:/|(?=\\.)|$)(.*)' % re.escape(rootURI)
# Make the root URI into a gateway pattern.

# --------------------------------------------------------------------

registerDatabaseGateway = gatewayMethodMerge = registerMethodOverride = support.notCreated  # Just to avoid errors

SERVICES = 'gateway.api.**.I*Service'

bind.bindToEntities('gateway.impl.**.*Alchemy', 'gateway.core.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('gateway.impl.**.*', 'gateway.core.impl.**.*')
support.listenToEntities(SERVICES, listeners=registerService)
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------

@ioc.entity
def assemblyAnonymousGateways() -> Assembly:
    ''' The assembly used for generating anonymous gateways'''
    return Assembly('Anonymous gateways')

# --------------------------------------------------------------------

@ioc.entity
def defaultGateways() -> list: return []
示例#2
0
'''
Created on Jan 9, 2012

@package: security
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor

Contains the services for security.
'''
    
from ..plugin.registry import addService
from .db_security import bindSecuritySession, bindSecurityValidations
from ally.container import support, ioc, bind
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'security.api.**.I*Service', 'security.**.api.**.I*Service'
@ioc.entity
def binders(): return [bindSecuritySession]
@ioc.entity
def bindersService(): return list(chain((bindSecurityValidations,), binders()))

bind.bindToEntities('security.impl.**.*Alchemy', 'security.**.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('security.impl.**.*', 'security.**.impl.**.*')
support.listenToEntities(*SERVICES, listeners=addService(bindersService))
support.loadAllEntities(*SERVICES)
示例#3
0
Contains the services for superdesk.
'''

from ..plugin.registry import addService
from .db_superdesk import bindSuperdeskSession, bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'superdesk.*.api.**.I*Service'


@ioc.entity
def binders():
    return [bindSuperdeskSession]


@ioc.entity
def bindersService():
    return list(chain((bindSuperdeskValidations, ), binders()))


bind.bindToEntities('superdesk.*.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('superdesk.*.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------
示例#4
0
# --------------------------------------------------------------------

log = logging.getLogger(__name__)

asPattern = lambda rootURI: '^%s(?:/|(?=\\.)|$)(.*)' % re.escape(rootURI)
# Make the root URI into a gateway pattern.

# --------------------------------------------------------------------

registerDatabaseGateway = gatewayMethodMerge = registerMethodOverride = support.notCreated  # Just to avoid errors

SERVICES = 'gateway.api.**.I*Service'

bind.bindToEntities('gateway.impl.**.*Alchemy',
                    'gateway.core.impl.**.*Alchemy',
                    binders=binders)
support.createEntitySetup('gateway.impl.**.*', 'gateway.core.impl.**.*')
support.listenToEntities(SERVICES, listeners=registerService)
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------


@ioc.entity
def assemblyAnonymousGateways() -> Assembly:
    ''' The assembly used for generating anonymous gateways'''
    return Assembly('Anonymous gateways')


# --------------------------------------------------------------------
示例#5
0
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Ioan v. Pocol

Contains the service setups.
'''

from ally.container import support, ioc, bind
from __plugin__.superdesk.db_superdesk import bindSuperdeskSession,\
    bindSuperdeskValidations
from itertools import chain    
from __plugin__.plugin.registry import addService


# --------------------------------------------------------------------

@ioc.entity
def binders(): return [bindSuperdeskSession]

@ioc.entity
def bindersService(): return list(chain((bindSuperdeskValidations,), binders()))

SERVICES = 'support_testing.api.**.I*Service'
bind.bindToEntities('support_testing.impl.**.*Service', binders=binders)
support.createEntitySetup('support_testing.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)




示例#6
0
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'example.*.api.**.I*Service'


# this provides the (start/rollback/commit) session processing
@ioc.entity
def binders():
    return [bindExampleSession]


# this provides validation of input data against database structure and content
@ioc.entity
def bindersService():
    return list(chain((bindExampleValidations, ), binders()))


# inner binding; for implementation services together with alchemy database classes
bind.bindToEntities('example.*.impl.**.*Alchemy', binders=binders)
# inner binding; for implementation services
support.createEntitySetup('example.*.impl.**.*')
# outer binding; for API registering
support.listenToEntities(SERVICES, listeners=addService(bindersService))
# outer binding; assuring that all APIs are registered
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------
示例#7
0
'''
Created on Jan 9, 2012

@package: superdesk
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor

Contains the services for superdesk.
'''

from ..plugin.registry import addService
from .db_superdesk import bindSuperdeskSession, bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'superdesk.*.api.**.I*Service'
@ioc.entity
def binders(): return [bindSuperdeskSession]
@ioc.entity
def bindersService(): return list(chain((bindSuperdeskValidations,), binders()))

bind.bindToEntities('superdesk.*.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('superdesk.*.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------
示例#8
0
from superdesk.media_archive.impl.meta_data import IMetaDataHandler

# --------------------------------------------------------------------


def addMetaDataHandler(handler):
    if not isinstance(handler, IMetaDataService):
        metaDataHandlers().append(handler)


@ioc.entity
def binders():
    return [bindSuperdeskSession]


bind.bindToEntities('superdesk.media_archive.core.impl.**.*Alchemy',
                    binders=binders)
support.createEntitySetup('superdesk.media_archive.core.impl.**.*')
support.listenToEntities(IMetaDataHandler,
                         listeners=addMetaDataHandler,
                         beforeBinding=False,
                         module=service)
support.loadAllEntities(IMetaDataHandler, module=service)

# --------------------------------------------------------------------


@ioc.config
def use_solr_search():
    ''' If true then the media archive search is made using solr'''
    return False
示例#9
0
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor

Contains the setup user services.
'''

from ..plugin.registry import registerService
from .database import binders
from ally.container import support, bind, ioc
from ally.cdm.spec import ICDM
from ally.cdm.support import ExtendPathCDM
from __plugin__.cdm.service import contentDeliveryManager

# --------------------------------------------------------------------

SERVICES = 'hr.user.api.**.I*Service'

bind.bindToEntities('hr.user.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('hr.user.impl.**.*')
support.listenToEntities(SERVICES, listeners=registerService)
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------

@ioc.entity
def cdmAvatar() -> ICDM:
    '''
    The content delivery manager (CDM) for the avatars.
    '''
    return ExtendPathCDM(contentDeliveryManager(), 'avatar/%s')
示例#10
0
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Mugur Rus

Contains the services for content packager.
'''

from ..plugin.registry import addService
from ..superdesk.db_superdesk import bindSuperdeskSession, bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'content.packager.api.**.I*Service'


@ioc.entity
def binders():
    return [bindSuperdeskSession]


@ioc.entity
def bindersService():
    return list(chain((bindSuperdeskValidations, ), binders()))


bind.bindToEntities('content.packager.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('content.packager.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)
示例#11
0
# --------------------------------------------------------------------

SERVICES = 'content.article.api.**.I*Service'


@ioc.entity
def binders():
    return [bindSuperdeskSession]


@ioc.entity
def bindersService():
    return list(chain((bindSuperdeskValidations, ), binders()))


bind.bindToEntities('content.article.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('content.article.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)


@ioc.config
def article_search_provider():
    ''' Specify the search provider that will be used for articles. The possible values are db for database provider and solr for solr provider'''
    return 'db'


# --------------------------------------------------------------------


@ioc.entity
示例#12
0
    ThumbnailProcessorFfmpeg
from superdesk.media_archive.core.impl.thumbnail_processor_gm import \
    ThumbnailProcessorGM
from superdesk.media_archive.core.spec import IThumbnailManager, QueryIndexer, \
    IQueryIndexer, IThumbnailProcessor
from superdesk.media_archive.impl.meta_data import IMetaDataHandler

# --------------------------------------------------------------------

def addMetaDataHandler(handler):
    if not isinstance(handler, IMetaDataService): metaDataHandlers().append(handler)

@ioc.entity
def binders(): return [bindSuperdeskSession]

bind.bindToEntities('superdesk.media_archive.core.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('superdesk.media_archive.core.impl.**.*')
support.listenToEntities(IMetaDataHandler, listeners=addMetaDataHandler, beforeBinding=False, module=service)
support.loadAllEntities(IMetaDataHandler, module=service)

# --------------------------------------------------------------------

@ioc.config
def use_solr_search():
    ''' If true then the media archive search is made using solr'''
    return False

# --------------------------------------------------------------------

@ioc.entity
def searchProvider() -> ISearchProvider:
示例#13
0
Contains the services for frontline.
'''

from ..plugin.registry import addService
from ..superdesk.db_superdesk import bindSuperdeskSession, \
    bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'frontline.*.api.**.I*Service'


@ioc.entity
def binders():
    return [bindSuperdeskSession]


@ioc.entity
def bindersService():
    return list(chain((bindSuperdeskValidations, ), binders()))


bind.bindToEntities('frontline.*.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('frontline.*.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------
示例#14
0
    RegisterCompensatePermissionHandler
from acl.core.impl.processor.gateway.root_uri import RootURIHandler
from ally.container import ioc, support, bind
from ally.container.support import entityFor
from ally.design.processor.assembly import Assembly
from ally.design.processor.handler import Handler

# --------------------------------------------------------------------

# The gateway processors
anonymousGroup = registerPermissionGateway = support.notCreated  # Just to avoid errors

SERVICES = 'acl.api.**.I*Service'

bind.bindToEntities('acl.impl.**.*Alchemy',
                    'acl.core.impl.processor.gateway.**.*Alchemy',
                    binders=binders)
support.createEntitySetup('acl.impl.**.*',
                          'acl.core.impl.processor.gateway.**.*')
support.listenToEntities(SERVICES, listeners=registerService)
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------


@ioc.config
def root_uri_acl():
    '''
    The prefix used for appending to the Gateway paths.
    '''
    return 'resources'
示例#15
0
from ..superdesk.db_superdesk import bindSuperdeskSession, bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain
from content.article.api.search_provider import IArticleSearchProvider
from content.article.impl.db_search import SqlArticleSearchProvider


# --------------------------------------------------------------------

SERVICES = 'content.article.api.**.I*Service'
@ioc.entity
def binders(): return [bindSuperdeskSession]
@ioc.entity
def bindersService(): return list(chain((bindSuperdeskValidations,), binders()))

bind.bindToEntities('content.article.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('content.article.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)

@ioc.config
def article_search_provider():
    ''' Specify the search provider that will be used for articles. The possible values are db for database provider and solr for solr provider'''
    return 'db'

# --------------------------------------------------------------------

@ioc.entity
def articleSearchProvider() -> IArticleSearchProvider:

    if article_search_provider() == 'solr':
示例#16
0
'''
Created on Mar 11, 2013

@package: content packager
@copyright: 2013 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Mugur Rus

Contains the services for content packager.
'''

from ..plugin.registry import addService
from ..superdesk.db_superdesk import bindSuperdeskSession, bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'content.packager.api.**.I*Service'
@ioc.entity
def binders(): return [bindSuperdeskSession]
@ioc.entity
def bindersService(): return list(chain((bindSuperdeskValidations,), binders()))

bind.bindToEntities('content.packager.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('content.packager.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)
示例#17
0
SERVICES = 'livedesk.api.**.I*Service'


@ioc.entity
def binders():
    return [bindSuperdeskSession]


@ioc.entity
def bindersService():
    return list(chain((bindSuperdeskValidations, ), binders()))


bind.bindToEntities('livedesk.impl.**.*Alchemy',
                    IBlogCollaboratorGroupCleanupService,
                    binders=binders)
support.createEntitySetup('livedesk.impl.**.*')

support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------


@ioc.entity
def blogThemeCDM() -> ICDM:
    return contentDeliveryManager()

# --------------------------------------------------------------------
示例#18
0
Created on April 29, 2013

@package: frontline
@copyright: 2013 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Martin Saturka

Contains the services for frontline.
'''

from ..plugin.registry import addService
from ..superdesk.db_superdesk import bindSuperdeskSession, \
    bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'frontline.*.api.**.I*Service'
@ioc.entity
def binders(): return [bindSuperdeskSession]
@ioc.entity
def bindersService(): return list(chain((bindSuperdeskValidations,), binders()))

bind.bindToEntities('frontline.*.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('frontline.*.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------
示例#19
0
from acl.core.impl.processor.gateway.compensate import \
    RegisterCompensatePermissionHandler
from acl.core.impl.processor.gateway.root_uri import RootURIHandler
from ally.container import ioc, support, bind
from ally.container.support import entityFor
from ally.design.processor.assembly import Assembly
from ally.design.processor.handler import Handler

# --------------------------------------------------------------------

# The gateway processors
anonymousGroup = registerPermissionGateway = support.notCreated  # Just to avoid errors

SERVICES = 'acl.api.**.I*Service'

bind.bindToEntities('acl.impl.**.*Alchemy', 'acl.core.impl.processor.gateway.**.*Alchemy', binders=binders)
support.createEntitySetup('acl.impl.**.*', 'acl.core.impl.processor.gateway.**.*')
support.listenToEntities(SERVICES, listeners=registerService)
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------

@ioc.config
def root_uri_acl():
    '''
    The prefix used for appending to the Gateway paths.
    '''
    return 'resources'

# --------------------------------------------------------------------
示例#20
0
'''
Created on Jan 9, 2012

@package: security
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor

Contains the services for security.
'''
    
from ..plugin.registry import registerService
from .database import binders
from ally.container import support, bind, ioc

# --------------------------------------------------------------------

SERVICES = 'security.api.**.I*Service', 'security.**.api.**.I*Service'

bind.bindToEntities('security.impl.**.*Alchemy', 'security.**.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('security.impl.**.*', 'security.**.impl.**.*')
support.listenToEntities(*SERVICES, listeners=registerService)
support.loadAllEntities(*SERVICES)

# --------------------------------------------------------------------

@ioc.entity
def signaturesRight() -> dict:
    ''' The right signatures that can be injected'''
    return {}
示例#21
0
'''

from ..cdm import contentDeliveryManager
from ..plugin.registry import addService
from .db_internationalization import bindInternationalizationSession, \
    bindInternationalizationValidations
from ally.cdm.spec import ICDM
from ally.cdm.support import ExtendPathCDM
from ally.container import support, ioc, bind
from internationalization.scanner import Scanner

# --------------------------------------------------------------------

SERVICES = 'internationalization.api.**.I*Service'
@ioc.entity
def binders(): return [bindInternationalizationSession]

bind.bindToEntities('internationalization.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('internationalization.impl.**.*', 'internationalization.*.impl.**.*', Scanner)
support.listenToEntities(SERVICES, listeners=addService(bindInternationalizationValidations), beforeBinding=False)
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------

@ioc.entity
def cdmLocale() -> ICDM:
    '''
    The content delivery manager (CDM) for the locale files.
    '''
    return ExtendPathCDM(contentDeliveryManager(), 'cache/locale/%s')
示例#22
0
'''
Created on Feb 23, 2012

@package: ally actions gui 
@copyright: 2011 Sourcefabric o.p.s.
@license:  http://www.gnu.org/licenses/gpl-3.0.txt
@author: Mihai Balaceanu

Provides the services setup.
'''

from ..plugin.registry import registerService
from .database import binders
from ally.container import support, bind

# --------------------------------------------------------------------

SERVICES = 'gui.action.api.**.I*Service'

bind.bindToEntities('gui.action.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('gui.action.impl.**.*')
support.listenToEntities(SERVICES, listeners=registerService)
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------

示例#23
0
@copyright: 2013 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Mugur Rus

Contains the services for content publisher.
'''

from ..plugin.registry import addService
from ..superdesk.db_superdesk import bindSuperdeskSession, bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'content.publisher.api.**.I*Service'


@ioc.entity
def binders():
    return [bindSuperdeskSession]


@ioc.entity
def bindersService():
    return list(chain((bindSuperdeskValidations, ), binders()))


bind.bindToEntities('content.publisher.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('content.publisher.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)
示例#24
0
Contains the services for superdesk.
'''

from ..plugin.registry import addService
from .db_example import bindExampleSession, bindExampleValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'example.*.api.**.I*Service'

# this provides the (start/rollback/commit) session processing
@ioc.entity
def binders(): return [bindExampleSession]

# this provides validation of input data against database structure and content
@ioc.entity
def bindersService(): return list(chain((bindExampleValidations,), binders()))

# inner binding; for implementation services together with alchemy database classes
bind.bindToEntities('example.*.impl.**.*Alchemy', binders=binders)
# inner binding; for implementation services
support.createEntitySetup('example.*.impl.**.*')
# outer binding; for API registering
support.listenToEntities(SERVICES, listeners=addService(bindersService))
# outer binding; assuring that all APIs are registered
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------
示例#25
0
# --------------------------------------------------------------------

SERVICES = "livedesk.api.**.I*Service"


@ioc.entity
def binders():
    return [bindSuperdeskSession]


@ioc.entity
def bindersService():
    return list(chain((bindSuperdeskValidations,), binders()))


bind.bindToEntities("livedesk.impl.**.*Alchemy", IBlogCollaboratorGroupCleanupService, binders=binders)
support.createEntitySetup("livedesk.impl.**.*")

bind.bindToEntities("general_setting.impl.**.*Alchemy", binders=binders)
support.createEntitySetup("general_setting.impl.**.*")

support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------


@ioc.entity
def blogThemeCDM() -> ICDM:
    return contentDeliveryManager()
示例#26
0
from itertools import chain
from livedesk.core.spec import IBlogCollaboratorGroupCleanupService
from livedesk.impl.blog_collaborator import CollaboratorSpecification
from sched import scheduler
from threading import Thread
import time

# --------------------------------------------------------------------

SERVICES = 'livedesk.api.**.I*Service'
@ioc.entity
def binders(): return [bindSuperdeskSession]
@ioc.entity
def bindersService(): return list(chain((bindSuperdeskValidations,), binders()))

bind.bindToEntities('livedesk.impl.**.*Alchemy', IBlogCollaboratorGroupCleanupService, binders=binders)
support.createEntitySetup('livedesk.impl.**.*')

support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------

@ioc.entity
def blogThemeCDM() -> ICDM: return contentDeliveryManager()

# --------------------------------------------------------------------

@ioc.entity
def versionCDM() -> ICDM: return contentDeliveryManager()
示例#27
0
'''
Created on Mar 14, 2013

@package: content publisher
@copyright: 2013 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Mugur Rus

Contains the services for content publisher.
'''

from ..plugin.registry import addService
from ..superdesk.db_superdesk import bindSuperdeskSession, bindSuperdeskValidations
from ally.container import support, bind, ioc
from itertools import chain

# --------------------------------------------------------------------

SERVICES = 'content.publisher.api.**.I*Service'
@ioc.entity
def binders(): return [bindSuperdeskSession]
@ioc.entity
def bindersService(): return list(chain((bindSuperdeskValidations,), binders()))

bind.bindToEntities('content.publisher.impl.**.*Alchemy', binders=binders)
support.createEntitySetup('content.publisher.impl.**.*')
support.listenToEntities(SERVICES, listeners=addService(bindersService))
support.loadAllEntities(SERVICES)