private static JvstmOJBConfig getConfig() { return FenixFramework.<JvstmOJBConfig> getConfig(); }
private void removeFromDeleted(DomainObject obj) { if (objsToDelete != null) { if (objsToDelete.remove(obj)) { if (FenixFramework.<JvstmOJBConfig> getConfig().isErrorIfChangingDeletedObject()) { throw new Error("Changing object after it was deleted: " + obj); } else { logger.error("WARNING: Changing object after it was deleted: " + obj); } } } }
public static boolean canCreateDomainMetaObjects() { return FenixFramework.<ConsistencyPredicatesConfig> getConfig().getCanCreateDomainMetaObjects(); }
public static JvstmDataGridBackEnd getInstance() { return (JvstmDataGridBackEnd) FenixFramework.getConfig().getBackEnd(); }
public static String getAppName() { return FenixFramework.getConfig().getAppName(); }
public static JvstmClusterBackEnd getInstance() { return (JvstmClusterBackEnd) FenixFramework.getConfig().getBackEnd(); }
public static JVSTMBackEnd getInstance() { return (JVSTMBackEnd) FenixFramework.getConfig().getBackEnd(); }
public static String getAppName() { return FenixFramework.getConfig().getAppName(); }
public static JvstmLockFreeBackEnd getInstance() { return (JvstmLockFreeBackEnd) FenixFramework.getConfig().getBackEnd(); }
public static JvstmIspnBackEnd getInstance() { return (JvstmIspnBackEnd) FenixFramework.getConfig().getBackEnd(); }
public static <T extends DomainObject> T readDomainObject(ResultSet rs, String columnName) throws SQLException { long oid = rs.getLong(columnName); return (T) ((oid == 0) ? null : FenixFramework.getConfig().getBackEnd().fromOid(oid)); }
/** * Always gets a well-known singleton instance of {@link DomainRoot}. The intended use of this * instance is to provide a single entry point to the graph of {@link DomainObject}s. The user * of the framework may connect (via DML) any {@link DomainObject} to this class. */ public static DomainRoot getDomainRoot() { return getConfig().getBackEnd().getDomainRoot(); }
/** * Determines whether a given {@link DomainObject} is valid, meaning that its properties can be safely accessed. * * @param object * The object to verify * @return * {@code true} if the provided object is valid, {@code false} otherwise. */ public static boolean isDomainObjectValid(DomainObject object) { return getConfig().getBackEnd().isDomainObjectValid(object); }
private static synchronized NodeBarrier getNodeBarrier() throws Exception { if (barrier == null) { barrier = new NodeBarrier(getConfig().getJGroupsConfigFile()); } return barrier; }
/** * Returns whether the current Fenix Framework instance is a newly created one. * * The goal of this method is to allow applications to perform application-specific initialization, * such as presenting a configuration wizard. * * @return * {@code true} if this is a new Fenix Framework instance, {@code false} otherwise. */ public static boolean isNewInstance() { return getConfig().getBackEnd().isNewInstance(); }
public static TransactionManager getTransactionManager() { return getConfig().getBackEnd().getTransactionManager(); }
/** * Get any {@link DomainObject} given its external identifier. * * The external identifier must have been obtained by a previous invocation to {@link DomainObject#getExternalId}. If the * external identifier is tampered with (in which case a * valid {@link DomainObject} cannot be found), the result of calling this method is undefined. * * @param externalId The external identifier of the domain object to get * @return The domain object requested * */ public static <T extends DomainObject> T getDomainObject(String externalId) { return getConfig().getBackEnd().getDomainObject(externalId); }
public static AbstractDomainObject readObjectFromRs(ResultSet rs) { // this method tries to load the object from its OID // see whether the OID column in the resultSet is already filled try { long objectOid = rs.getLong("OID"); if (objectOid != 0) { // if it is, then we may get the object by its OID and skip all the old stuff AbstractDomainObject materializedObject = FenixFramework.getConfig().getBackEnd().fromOid(objectOid); materializedObject.readFromResultSet(rs); return materializedObject; } } catch (SQLException sqle) { // we may have an SQLException if, for example, there is no OID column // in that case, simply ignore this and continue with the old code sqle.printStackTrace(); } // null means that something failed return null; } }
@Override protected void deleteDomainObject() { this.invokeDeletionListeners(); try { Field cacheField = SharedIdentityMap.class.getDeclaredField("cache"); cacheField.setAccessible(true); ConcurrentHashMap<Object, ?> cache = (ConcurrentHashMap<Object, ?>) cacheField.get(SharedIdentityMap.getCache()); cache.remove(this.getOid()); ((InMemDomainObjectValidBackEnd) FenixFramework.getConfig().getBackEnd()) .deleteObject(this.getOid()); } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); } } }
/** * Inform the framework components that the application intends to shutdown. This allows for an * orderly termination of any running components. The default implementation delegates to the * backend the task of shutting down the framework. After invoking this method there is no * guarantee that the Fenix Framework is able to provide any more services. */ public static synchronized void shutdown() { logger.info("Shutting down..."); synchronized (INIT_LOCK) { initialized = false; if (barrier != null) { barrier.shutdown(); } getConfig().shutdown(); SharedIdentityMap.getCache().shutdown(); } logger.info("Shutdown complete."); }