public Boolean getCachedAuthorizationResult(DSpaceObject dspaceObject, int action, EPerson eperson) { if (isReadOnly()) { return readOnlyCache.getCachedAuthorizationResult(dspaceObject, action, eperson); } else { return null; } }
/** * The Session used to manipulate entities of this type. * * @param context current DSpace context. * @return the current Session. * @throws SQLException */ protected Session getHibernateSession(Context context) throws SQLException { return ((Session) context.getDBConnection().getSession()); }
/** * Returns the size of the cache of all object that have been read from the database so far. A larger number * means that more memory is consumed by the cache. This also has a negative impact on the query performance. In * that case you should consider uncaching entities when they are no longer needed (see * {@link Context#uncacheEntity(ReloadableEntity)} () uncacheEntity}). * * @throws SQLException When connecting to the active cache fails. */ public long getCacheSize() throws SQLException { return this.getDBConnection().getCacheSize(); }
private static Context getAnonContext() { if (anonContext == null) { anonContext = new Context(); } return anonContext; }
public static String buildIdentifier(String handle) { if (_prefix == null) { _prefix = ConfigurationManager.getProperty("oai", "identifier.prefix"); } return "oai:" + _prefix + ":" + handle; }
/** * Is tag cloud enabled * * @return true or false */ public boolean isTagCloudEnabled() { return ConfigurationManager.getBooleanProperty("webui.browse.index.tagcloud." + number); } }
/** * Get the i18n message string for a given key and context * * @param key String - name of the key to get the message for * @param c Context having the desired Locale * @return message * String of the message */ public static String getMessage(String key, Context c) { return getMessage(key.trim(), c.getCurrentLocale()); }
public void cacheAllMemberGroupsSet(EPerson ePerson, Set<Group> groups) { if (isReadOnly()) { readOnlyCache.cacheAllMemberGroupsSet(ePerson, groups); } }
public Boolean getCachedGroupMembership(Group group, EPerson eperson) { if (isReadOnly()) { return readOnlyCache.getCachedGroupMembership(group, eperson); } else { return null; } }
public Set<Group> getCachedAllMemberGroupsSet(EPerson ePerson) { if (isReadOnly()) { return readOnlyCache.getCachedAllMemberGroupsSet(ePerson); } else { return null; } }
public void cacheGroupMembership(Group group, EPerson eperson, Boolean isMember) { if (isReadOnly()) { readOnlyCache.cacheGroupMembership(group, eperson, isMember); } }
/** * Return an MD5 checksum for data in hex format. * * @param data The data to checksum. * @return MD5 checksum for the data in hex format. */ public static String getMD5(byte[] data) { return toHex(getMD5Bytes(data)); }
/** * Generate a unique key. The key is a 32-character long sequence of hex * digits. * * @return A unique key as a long sequence of hex digits. */ public static String generateHexKey() { return toHex(generateBytesKey()); }
protected Context(EventService eventService, DBConnection dbConnection) { this.mode = Mode.READ_WRITE; this.eventService = eventService; this.dbConnection = dbConnection; init(); }
/** * Return an identifier unique to this asset store instance * * @return a unique ID */ public String generateId() { return Utils.generateKey(); }
private void reloadRequiredEntities() throws SQLException { //Reload our objects in our cache targetCollection = ourContext.reloadEntity(targetCollection); harvestRow = ourContext.reloadEntity(harvestRow); }
@Override public void setConnectionMode(final boolean batchOptimized, final boolean readOnlyOptimized) throws SQLException { this.batchModeEnabled = batchOptimized; this.readOnlyEnabled = readOnlyOptimized; configureDatabaseMode(); }
private static String getBaseDir() { if (baseDir == null) { String dir = ConfigurationManager.getProperty("oai", "cache.dir") + REQUEST_DIR; baseDir = dir; } return baseDir; }
/** * Construct a new context object with the given mode enabled. A database connection is opened. * No user is authenticated. * * @param mode The mode to use when opening the context. */ public Context(Mode mode) { this.mode = mode; init(); }