Search in sources :

Example 6 with BrokerPoolServiceException

use of org.exist.storage.BrokerPoolServiceException in project exist by eXist-db.

the class SecurityManagerImpl method prepare.

@Override
public void prepare(final BrokerPool brokerPool) throws BrokerPoolServiceException {
    try {
        this.defaultRealm = new RealmImpl(null, this, null);
        realms.add(defaultRealm);
        this.systemSubject = new AtomicLazyVal<>(() -> new SubjectAccreditedImpl(defaultRealm.ACCOUNT_SYSTEM, this));
        this.guestSubject = new AtomicLazyVal<>(() -> new SubjectAccreditedImpl((AccountImpl) defaultRealm.getAccount(SecurityManager.GUEST_USER), this));
    } catch (final EXistException e) {
        throw new BrokerPoolServiceException(e);
    }
}
Also used : BrokerPoolServiceException(org.exist.storage.BrokerPoolServiceException) EXistException(org.exist.EXistException)

Example 7 with BrokerPoolServiceException

use of org.exist.storage.BrokerPoolServiceException in project exist by eXist-db.

the class ExistRepository method prepare.

@Override
public void prepare(final BrokerPool brokerPool) throws BrokerPoolServiceException {
    if (!Files.exists(expathDir)) {
        moveOldRepo(brokerPool.getConfiguration().getExistHome(), expathDir);
    }
    try {
        Files.createDirectories(expathDir);
    } catch (final IOException e) {
        throw new BrokerPoolServiceException("Unable to access EXPath repository", e);
    }
    LOG.info("Using directory {} for expath package repository", expathDir.toAbsolutePath().toString());
    try {
        final FileSystemStorage storage = new FileSystemStorage(expathDir);
        storage.setErrorIfNoContentDir(false);
        this.myParent = new Repository(storage);
        myParent.registerExtension(new ExistPkgExtension());
    } catch (final PackageException e) {
        throw new BrokerPoolServiceException("Unable to prepare EXPath Package Repository: " + expathDir.toAbsolutePath().toString(), e);
    }
}
Also used : BrokerPoolServiceException(org.exist.storage.BrokerPoolServiceException) IOException(java.io.IOException)

Example 8 with BrokerPoolServiceException

use of org.exist.storage.BrokerPoolServiceException in project exist by eXist-db.

the class QuartzSchedulerImpl method prepare.

@Override
public void prepare(final BrokerPool brokerPool) throws BrokerPoolServiceException {
    // NOTE: we create the scheduler in a separate thread with its own thread-group so that the thread group is used by Quartz
    final ThreadGroup instanceQuartzThreadGroup = newInstanceSubThreadGroup(brokerPool, "scheduler.quartz-simple-thread-pool");
    final QuartzSchedulerCreator creator = new QuartzSchedulerCreator(getQuartzProperties());
    final Thread schedulerCreatorThread = new Thread(instanceQuartzThreadGroup, creator, nameInstanceThread(brokerPool, "prepare-quartz-scheduler"));
    schedulerCreatorThread.start();
    try {
        schedulerCreatorThread.join();
        this.scheduler = creator.getScheduler().valueOrThrow(e -> new BrokerPoolServiceException("Unable to create Scheduler: " + e.getMessage(), e));
    } catch (final InterruptedException e) {
        // restore interrupted state
        Thread.currentThread().interrupt();
        throw new BrokerPoolServiceException("Unable to create Scheduler: " + e.getMessage(), e);
    }
}
Also used : java.util(java.util) BrokerPool(org.exist.storage.BrokerPool) JobDescription(org.exist.scheduler.JobDescription) Job(org.quartz.Job) org.exist.scheduler(org.exist.scheduler) ThreadUtils.nameInstanceThread(org.exist.util.ThreadUtils.nameInstanceThread) Calendar(java.util.Calendar) ThreadUtils.newInstanceSubThreadGroup(org.exist.util.ThreadUtils.newInstanceSubThreadGroup) Subject(org.exist.security.Subject) BrokerPoolServiceException(org.exist.storage.BrokerPoolServiceException) Path(java.nio.file.Path) org.quartz(org.quartz) Nullable(javax.annotation.Nullable) ThreadUtils.nameInstanceSchedulerThread(org.exist.util.ThreadUtils.nameInstanceSchedulerThread) SimpleScheduleBuilder.simpleSchedule(org.quartz.SimpleScheduleBuilder.simpleSchedule) Files(java.nio.file.Files) StdSchedulerFactory(org.quartz.impl.StdSchedulerFactory) JobBuilder.newJob(org.quartz.JobBuilder.newJob) BrokerPoolService(org.exist.storage.BrokerPoolService) IOException(java.io.IOException) SystemTask(org.exist.storage.SystemTask) Collectors(java.util.stream.Collectors) TriggerBuilder.newTrigger(org.quartz.TriggerBuilder.newTrigger) ConfigurationHelper(org.exist.util.ConfigurationHelper) CronScheduleBuilder.cronSchedule(org.quartz.CronScheduleBuilder.cronSchedule) Either(com.evolvedbinary.j8fu.Either) Scheduler(org.exist.scheduler.Scheduler) Logger(org.apache.logging.log4j.Logger) Configuration(org.exist.util.Configuration) LogManager(org.apache.logging.log4j.LogManager) GroupMatcher(org.quartz.impl.matchers.GroupMatcher) InputStream(java.io.InputStream) BrokerPoolServiceException(org.exist.storage.BrokerPoolServiceException) ThreadUtils.newInstanceSubThreadGroup(org.exist.util.ThreadUtils.newInstanceSubThreadGroup) ThreadUtils.nameInstanceThread(org.exist.util.ThreadUtils.nameInstanceThread) ThreadUtils.nameInstanceSchedulerThread(org.exist.util.ThreadUtils.nameInstanceSchedulerThread)

Aggregations

BrokerPoolServiceException (org.exist.storage.BrokerPoolServiceException)8 IOException (java.io.IOException)4 EXistException (org.exist.EXistException)3 Configuration (org.exist.util.Configuration)2 ReadOnlyException (org.exist.util.ReadOnlyException)2 Either (com.evolvedbinary.j8fu.Either)1 InputStream (java.io.InputStream)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 java.util (java.util)1 Calendar (java.util.Calendar)1 Collectors (java.util.stream.Collectors)1 Nullable (javax.annotation.Nullable)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 org.exist.scheduler (org.exist.scheduler)1 JobDescription (org.exist.scheduler.JobDescription)1 Scheduler (org.exist.scheduler.Scheduler)1 Subject (org.exist.security.Subject)1 BrokerPool (org.exist.storage.BrokerPool)1