예제 #1
0
'''
Created on Jan 9, 2012

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

Contains the services for livedesk.
'''

from ..plugin.registry import addService
from ally.container import support
from ..superdesk.db_superdesk import bindSuperdeskSession, bindSuperdeskValidations

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

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

support.createEntitySetup('livedesk.impl.**.*')
support.bindToEntities('livedesk.impl.**.*Alchemy',
                       binders=bindSuperdeskSession)
support.listenToEntities(SERVICES,
                         listeners=addService(bindSuperdeskSession,
                                              bindSuperdeskValidations))
support.loadAllEntities(SERVICES)

# --------------------------------------------------------------------
예제 #2
0
from ..acl import gui
from ..gui_action.service import addAction
from ..gui_core.gui_core import publishedURI
from ..media_archive.actions import modulesAction as mediaArchiveAction
from ally.container import ioc, support
from gui.action.api.action import Action
from superdesk.media_archive.api.video_data import IVideoDataService
from superdesk.media_archive.api.video_info import IVideoInfoService
from ally.internationalization import NC_
from acl.right_action import RightAction

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

support.listenToEntities(Action, listeners=addAction)
support.loadAllEntities(Action)

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


@ioc.entity
def modulesAction() -> Action:
    """
    register image plugin on media archive actions
    """
    return Action(
        "video", Parent=mediaArchiveAction(), Script=publishedURI("media-archive-video/scripts/js/media-archive/")
    )


# --------------------------------------------------------------------
예제 #3
0
from ..acl import gui
from ..gui_action import defaults
from ..gui_action.service import addAction
from ..gui_core.gui_core import publishedURI
from acl.right_action import RightAction
from admin.introspection.api.component import IComponentService
from admin.introspection.api.plugin import IPluginService
from admin.introspection.api.request import IRequestService
from ally.container import ioc, support
from ally.internationalization import NC_
from gui.action.api.action import Action

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

support.listenToEntities(Action, listeners=addAction)
support.loadAllEntities(Action)

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


@ioc.entity
def menuAction() -> Action:
    return Action('request',
                  NC_('menu', 'Request'),
                  Parent=defaults.menuAction(),
                  NavBar='/api-requests',
                  Script=publishedURI('superdesk/request/scripts/js/menu.js'))


@ioc.entity
def modulesAction() -> Action:
예제 #4
0
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()

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

@ioc.entity
def collaboratorSpecification() -> CollaboratorSpecification:
예제 #5
0
log = logging.getLogger(__name__)

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

try:
    from __setup__ import ally_core  # @UnusedImport
except ImportError: log.info('No ally core component available, cannot register the introspection')
else:
    from __setup__.ally_core.resources import injectorAssembly
    from admin.introspection.core.impl.processor.index_model import IndexModelHandler
    from admin.introspection.core.impl.processor.introspect import IntrospectHandler
    from admin.introspection.impl.model import ModelService

    support.listenToEntities(IModelService, listeners=registerService)
    support.loadAllEntities(IModelService)

    # --------------------------------------------------------------------
    
    @ioc.entity
    def assemblyIntrospection() -> Assembly:
        ''' The assembly used for generating the introspection models'''
        return Assembly('Introspection')
        
    # ----------------------------------------------------------------
    
    @ioc.entity
    def introspectContexts(): return []
        
    @ioc.entity
    def introspectProcessing() -> Processing:
예제 #6
0
# --------------------------------------------------------------------

try:
    from __setup__ import ally_core  # @UnusedImport
except ImportError:
    log.info(
        'No ally core component available, cannot register the introspection')
else:
    from __setup__.ally_core.resources import injectorAssembly
    from admin.introspection.core.impl.processor.index_model import IndexModelHandler
    from admin.introspection.core.impl.processor.introspect import IntrospectHandler
    from admin.introspection.impl.model import ModelService

    support.listenToEntities(IModelService, listeners=registerService)
    support.loadAllEntities(IModelService)

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

    @ioc.entity
    def assemblyIntrospection() -> Assembly:
        ''' The assembly used for generating the introspection models'''
        return Assembly('Introspection')

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

    @ioc.entity
    def introspectContexts():
        return []

    @ioc.entity
예제 #7
0
        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:
예제 #8
0
'''
Created on Jan 9, 2012

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

Contains the services for livedesk.
'''

from ..plugin.registry import addService
from ally.container import support
from ..superdesk.db_superdesk import bindSuperdeskSession, bindSuperdeskValidations

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

API, IMPL = 'livedesk.api.**.I*Service', 'livedesk.impl.**.*'

support.createEntitySetup(API, IMPL)
support.bindToEntities(IMPL, binders=bindSuperdeskSession)
support.listenToEntities(IMPL, listeners=addService(bindSuperdeskSession, bindSuperdeskValidations))
support.loadAllEntities(API)

# --------------------------------------------------------------------
예제 #9
0
from superdesk.media_archive.impl.query_criteria import QueryCriteriaService
import logging

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

log = logging.getLogger(__name__)

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

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

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

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

@ioc.entity
def delivery() -> IDelivery:
    d = HTTPDelivery()
    d.serverURI = server_uri()
    d.repositoryPath = repository_path()
    return d

@ioc.entity
def contentDeliveryManager() -> ICDM:
    cdm = LocalFileSystemCDM();
    cdm.delivery = delivery()
    return cdm
예제 #10
0
'''
Created on Mar 29, 2012

@package: simple plugin sample
@copyright: 2011 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor

Contains the services setups.
'''

from __plugin__.plugin.registry import addService
from __plugin__.sample_plugin.db_sample import alchemySessionCreator
from ally.container import support
from ally.support.sqlalchemy.session import bindSession

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

API, IMPL = 'sample_plugin.api.**.I*Service', 'sample_plugin.impl.**.*'

support.createEntitySetup(API, IMPL)


def bindSampleSession(proxy):
    bindSession(proxy, alchemySessionCreator())


support.listenToEntities(IMPL, listeners=addService(bindSampleSession, ))

support.loadAllEntities(API)