Package org.jberet.spi

Examples of org.jberet.spi.BatchEnvironment


    public BatchEnvironment getBatchEnvironment() {
        return getBatchEnvironment(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
    }

    public BatchEnvironment getBatchEnvironment(final ClassLoader cl) {
        BatchEnvironment result = environments.get(cl);
        if (result == null) {
            result = INVALID_BATCH_ENV;
        }
        return result;
    }
View Full Code Here


    }

    @Override
    public synchronized void start(final StartContext context) throws StartException {
        WildFlyBatchLogger.LOGGER.debugf("Creating batch environment; %s", classLoader);
        final BatchEnvironment batchEnvironment = new WildFlyBatchEnvironment(beanManagerInjector.getOptionalValue(),
                executorServiceInjector.getValue(), transactionManagerInjector.getOptionalValue());
        // Add the service to the factory
        BatchEnvironmentFactory.getInstance().add(classLoader, batchEnvironment);
        this.batchEnvironment = batchEnvironment;
    }
View Full Code Here

    final JobRepository repository;
    private final BatchEnvironment batchEnvironment;
    private final ArtifactFactory artifactFactory;

    public JobOperatorImpl() throws BatchRuntimeException {
        final BatchEnvironment batchEnvironment;
        if (WildFlySecurityManager.isChecking()) {
            batchEnvironment = WildFlySecurityManager.doUnchecked(loaderAction);
        } else {
            batchEnvironment = loaderAction.run();
        }

        if (batchEnvironment == null) {
            throw BatchMessages.MESSAGES.batchEnvironmentNotFound();
        }
        this.batchEnvironment = batchEnvironment;
        artifactFactory = new ArtifactFactoryWrapper(batchEnvironment.getArtifactFactory());
        repository = batchEnvironment.getJobRepository();
        if (repository == null) {
            throw BatchMessages.MESSAGES.jobRepositoryRequired();
        }
    }
View Full Code Here

    final JobRepository repository;
    private final BatchEnvironment batchEnvironment;
    private final ArtifactFactory artifactFactory;

    public JobOperatorImpl() throws BatchRuntimeException {
        final BatchEnvironment batchEnvironment;
        if (System.getSecurityManager() == null) {
            batchEnvironment = loaderAction.run();
        } else {
            batchEnvironment = AccessController.doPrivileged(loaderAction);
        }

        if (batchEnvironment == null) {
            throw BatchMessages.MESSAGES.batchEnvironmentNotFound();
        }
        this.batchEnvironment = batchEnvironment;
        artifactFactory = new ArtifactFactoryWrapper(batchEnvironment.getArtifactFactory());
        repository = batchEnvironment.getJobRepository();
        if (repository == null) {
            throw BatchMessages.MESSAGES.jobRepositoryRequired();
        }
    }
View Full Code Here

    private static JobRepository repo;

    @BeforeClass
    public static void beforeClass() throws Exception {
        final BatchEnvironment batchEnvironment = new BatchEnvironment() {
            @Override
            public ClassLoader getClassLoader() {
                return Thread.currentThread().getContextClassLoader();
            }

            @Override
            public ArtifactFactory getArtifactFactory() {
                return null;
            }

            @Override
            public Future<?> submitTask(final Runnable task) {
                return null;
            }

            @Override
            public <T> Future<T> submitTask(final Runnable task, final T result) {
                return null;
            }

            @Override
            public <T> Future<T> submitTask(final Callable<T> task) {
                return null;
            }

            @Override
            public TransactionManager getTransactionManager() {
                return new TransactionManager() {
                    @Override
                    public void begin() throws NotSupportedException, SystemException {
                    }

                    @Override
                    public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException {
                    }

                    @Override
                    public void rollback() throws IllegalStateException, SecurityException, SystemException {
                    }

                    @Override
                    public void setRollbackOnly() throws IllegalStateException, SystemException {
                    }

                    @Override
                    public int getStatus() throws SystemException {
                        return 0;
                    }

                    @Override
                    public Transaction getTransaction() throws SystemException {
                        return NO_OP_TRANSACTION;
                    }

                    @Override
                    public void setTransactionTimeout(final int seconds) throws SystemException {
                    }

                    @Override
                    public Transaction suspend() throws SystemException {
                        return NO_OP_TRANSACTION;
                    }

                    @Override
                    public void resume(final Transaction tobj) throws InvalidTransactionException, IllegalStateException, SystemException {
                    }
                };
            }

            @Override
            public JobRepository getJobRepository() {
                return InMemoryRepository.getInstance();
            }

            @Override
            public Properties getBatchConfigurationProperties() {
                final Properties props = new Properties();
                //props.setProperty(JobRepositoryFactory.JOB_REPOSITORY_TYPE_KEY, JobRepositoryFactory.REPOSITORY_TYPE_JDBC);
                return props;
            }
        };
        repo = batchEnvironment.getJobRepository();
    }
View Full Code Here

    final JobRepository repository;
    private final BatchEnvironment batchEnvironment;
    private final ArtifactFactory artifactFactory;

    public JobOperatorImpl() throws BatchRuntimeException {
        final BatchEnvironment batchEnvironment;
        if (WildFlySecurityManager.isChecking()) {
            batchEnvironment = WildFlySecurityManager.doUnchecked(loaderAction);
        } else {
            batchEnvironment = loaderAction.run();
        }

        if (batchEnvironment == null) {
            throw BatchMessages.MESSAGES.batchEnvironmentNotFound();
        }
        this.batchEnvironment = batchEnvironment;
        artifactFactory = new ArtifactFactoryWrapper(batchEnvironment.getArtifactFactory());
        repository = batchEnvironment.getJobRepository();
        if (repository == null) {
            throw BatchMessages.MESSAGES.jobRepositoryRequired();
        }
    }
View Full Code Here

TOP

Related Classes of org.jberet.spi.BatchEnvironment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.