Search in sources :

Example 1 with SQLStore

use of edu.uiuc.ncsa.security.storage.sql.SQLStore in project OA4MP by ncsa.

the class EnvServlet method processStoreCheck.

public void processStoreCheck(Store store) throws SQLException {
    if (store instanceof SQLStore) {
        SQLStore sqlStore = (SQLStore) store;
        sqlStore.checkTable();
        sqlStore.checkColumns();
    }
}
Also used : SQLStore(edu.uiuc.ncsa.security.storage.sql.SQLStore)

Example 2 with SQLStore

use of edu.uiuc.ncsa.security.storage.sql.SQLStore in project OA4MP by ncsa.

the class ClientServletInitializer method init.

@Override
public void init() throws ServletException {
    if (hasRun)
        return;
    // run it once and only once.
    hasRun = true;
    MyLoggingFacade logger = getEnvironment().getMyLogger();
    ClientEnvironment ce = (ClientEnvironment) getEnvironment();
    // This next bit is a
    if (ce.hasAssetStore()) {
        if (ce.getAssetStore() instanceof SQLStore) {
            SQLStore sqlStore = (SQLStore) ce.getAssetStore();
            try {
                sqlStore.checkTable();
                sqlStore.checkColumns();
            } catch (SQLException sqlX) {
                logger.warn("Could not update store table:" + sqlX.getMessage());
            }
        }
        Cleanup<Identifier, Asset> assetCleanup = ClientServlet.assetCleanup;
        if (ce.isEnableAssetCleanup() && assetCleanup == null) {
            assetCleanup = new Cleanup<Identifier, Asset>(logger);
            assetCleanup.setStopThread(false);
            assetCleanup.setMap(ce.getAssetStore());
            assetCleanup.addRetentionPolicy(new ValidTimestampPolicy(ce.getMaxAssetLifetime()));
            logger.info("Starting asset cleanup thread");
            assetCleanup.start();
            ClientServlet.assetCleanup = assetCleanup;
        }
    } else {
        logger.info("No assets store, so no cleanup possible.");
    }
}
Also used : MyLoggingFacade(edu.uiuc.ncsa.security.core.util.MyLoggingFacade) SQLStore(edu.uiuc.ncsa.security.storage.sql.SQLStore) Identifier(edu.uiuc.ncsa.security.core.Identifier) SQLException(java.sql.SQLException) Asset(edu.uiuc.ncsa.myproxy.oa4mp.client.Asset) ClientEnvironment(edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment) ValidTimestampPolicy(edu.uiuc.ncsa.security.core.cache.ValidTimestampPolicy)

Aggregations

SQLStore (edu.uiuc.ncsa.security.storage.sql.SQLStore)2 Asset (edu.uiuc.ncsa.myproxy.oa4mp.client.Asset)1 ClientEnvironment (edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment)1 Identifier (edu.uiuc.ncsa.security.core.Identifier)1 ValidTimestampPolicy (edu.uiuc.ncsa.security.core.cache.ValidTimestampPolicy)1 MyLoggingFacade (edu.uiuc.ncsa.security.core.util.MyLoggingFacade)1 SQLException (java.sql.SQLException)1