コード例 #1
0
    def __call__(self, fcrepo, args):
        self.long = args.long

        resources = ResourceList(repository=fcrepo, uri_list=args.uris)

        resources.process(method=self.list_item,
                          traverse=parse_predicate_list(args.recursive),
                          use_transaction=False)
コード例 #2
0
    def __call__(self, fcrepo, args):
        self.repository = fcrepo
        self.repository.test_connection()
        self.dry_run = args.dry_run

        if self.dry_run:
            logger.info('Dry run enabled, no actual deletions will take place')

        self.resources = ResourceList(repository=self.repository,
                                      uri_list=args.uris,
                                      file=args.file,
                                      completed_file=args.completed)
        self.resources.process(method=self.delete_item,
                               traverse=parse_predicate_list(args.recursive),
                               use_transaction=args.use_transactions)
コード例 #3
0
    def __call__(self, repo, args):
        self.broker.connect()
        self.reindexing_queue = self.broker.destination('reindexing'),
        self.username = args.delegated_user or 'plastron'
        resources = ResourceList(
            repository=self.repo,
            uri_list=args.uris
        )

        resources.process(
            method=self.reindex_item,
            traverse=parse_predicate_list(args.recursive),
            use_transaction=False
        )
        self.broker.disconnect()
コード例 #4
0
ファイル: update.py プロジェクト: umd-lib/plastron
    def execute(self, fcrepo, args):
        self.repository = fcrepo
        self.repository.test_connection()
        self.dry_run = args.dry_run
        self.validate = args.validate
        self.model = args.model
        self.stats = {
            'updated': [],
            'invalid': defaultdict(list),
            'errors': defaultdict(list)
        }

        if self.validate and not self.model:
            raise FailureException(
                "Model must be provided when performing validation")

        self.sparql_update = args.update_file.read().encode('utf-8')

        logger.debug(f'SPARQL Update query:\n'
                     f'====BEGIN====\n'
                     f'{self.sparql_update.decode()}\n'
                     f'=====END=====')

        if self.dry_run:
            logger.info('Dry run enabled, no actual updates will take place')

        self.resources = ResourceList(repository=self.repository,
                                      uri_list=args.uris,
                                      file=args.file,
                                      completed_file=args.completed)
        self.resources.process(method=self.update_item,
                               traverse=parse_predicate_list(args.recursive),
                               use_transaction=args.use_transactions)
        if len(self.stats['errors']) == 0 and len(self.stats['invalid']) == 0:
            state = 'update_complete'
        else:
            state = 'update_incomplete'

        self.result = {'type': state, 'stats': self.stats}
        logger.debug(self.stats)
コード例 #5
0
    def __call__(self, fcrepo, args):
        self.repository = fcrepo
        self.repository.test_connection()
        self.dry_run = args.dry_run

        with open(args.update_file, 'r') as update_file:
            self.sparql_update = update_file.read().encode('utf-8')
        logger.debug(f'SPARQL Update query:\n'
                     f'====BEGIN====\n'
                     f'{self.sparql_update.decode()}\n'
                     f'=====END=====')

        if self.dry_run:
            logger.info('Dry run enabled, no actual updates will take place')

        self.resources = ResourceList(repository=self.repository,
                                      uri_list=args.uris,
                                      file=args.file,
                                      completed_file=args.completed)
        self.resources.process(method=self.update_item,
                               traverse=parse_predicate_list(args.recursive),
                               use_transaction=args.use_transactions)