/** * Checks that the {@link FenixFramework} is not initialized, throws an exception otherwise. * Should be called before any changes are made to {@link DomainMetaClass}es or to {@link DomainConsistencyPredicate}s. * * @throws RuntimeException * if the framework was already initialized **/ protected void checkFrameworkNotInitialized() { if (FenixFramework.isInitialized()) { throw new RuntimeException("Instances of " + getClass().getSimpleName() + " cannot be edited after the FenixFramework has been initialized."); } }
/** * Checks that the {@link FenixFramework} is not initialized, throws an exception otherwise. * Should be called before any changes are made to {@link DomainMetaClass}es or to {@link DomainConsistencyPredicate}s. * * @throws RuntimeException * if the framework was already initialized */ private void checkFrameworkNotInitialized() { if (FenixFramework.isInitialized()) { throw new RuntimeException("Instances of " + getClass().getSimpleName() + " cannot be edited after the FenixFramework has been initialized."); } }
/** * Checks that the {@link FenixFramework} is not initialized, throws an * exception otherwise. Should be called before any changes are made to {@link DomainMetaClass}es or to * {@link DomainConsistencyPredicate}s. * * @throws RuntimeException * if the framework was already initialized */ private void checkFrameworkNotInitialized() { if (FenixFramework.isInitialized()) { throw new RuntimeException("Instances of " + getClass().getSimpleName() + " cannot be edited after the FenixFramework has been initialized."); } }
/** * Commits the current, and starts a new write transaction. */ public static void checkpointTransaction() { if (FenixFramework.isInitialized()) { throw new Error("Cannot checkpoint transactions after the framework is initialized."); } try { TransactionManager txManager = FenixFramework.getTransactionManager(); if (txManager.getTransaction() != null) { txManager.commit(); } txManager.begin(false); } catch (Exception e) { logger.error("An error has ocurred while checkpointing the transaction", e); throw new Error(e); } } }