if (properties == null) { throw new IllegalArgumentException("properties cannot be null."); }   String cacheConfigPropertyName = "no.feide.moria.store.cachestoreconf"; String cacheConfigProperty = properties.getProperty(cacheConfigPropertyName);  if (cacheConfigProperty == null) { throw new MoriaStoreConfigurationException(cacheConfigPropertyName + " must be set."); }   FileInputStream cacheConfigFile;  try { cacheConfigFile = new FileInputStream(cacheConfigProperty); } catch (FileNotFoundException fnnf) { String message = "The configuration file for the store was not found."; throw new MoriaStoreConfigurationException(message, fnnf); }   PropertyConfigurator configurator = new PropertyConfigurator();  try { configurator.configure(store, cacheConfigFile); } catch (Exception e) { String message = "Unable to configure the cache."; throw new MoriaStoreConfigurationException(message, e); }   loginTicketTTL = new Long(300);  serviceTicketTTL = new Long(300);  ssoTicketTTL = new Long(28800);  tgTicketTTL = new Long(7200);  proxyTicketTTL = new Long(300);    try { store.start(); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new MoriaStoreConfigurationException("Unable to start the cache", e); }   isConfigured = true;
    public void setConfig(final Properties properties) {        /* Return if this cache instance has already been configured once. */        if (isConfigured) {            messageLogger.logWarn("setConfig() called on already configured instance.");            return;        }        /* Throw exception if argument is null. */        if (properties == null) {            throw new IllegalArgumentException("properties cannot be null.");        }        /* Read the the file name from the properties. */        String cacheConfigPropertyName = "no.feide.moria.store.cachestoreconf";        String cacheConfigProperty = properties.getProperty(cacheConfigPropertyName);        if (cacheConfigProperty == null) {            throw new MoriaStoreConfigurationException(cacheConfigPropertyName + " must be set.");        }        /* Open the file. */        FileInputStream cacheConfigFile;        try {            cacheConfigFile = new FileInputStream(cacheConfigProperty);        } catch (FileNotFoundException fnnf) {            String message = "The configuration file for the store was not found.";            throw new MoriaStoreConfigurationException(message, fnnf);        }        /* Configure the cache. */        PropertyConfigurator configurator = new PropertyConfigurator();        try {            configurator.configure(store, cacheConfigFile);        } catch (Exception e) {            String message = "Unable to configure the cache.";            throw new MoriaStoreConfigurationException(message, e);        }        // TODO: Get values from config        loginTicketTTL = new Long(300); /* 5 min */        serviceTicketTTL = new Long(300); /* 5 min */        ssoTicketTTL = new Long(28800); /* 8 hours */        tgTicketTTL = new Long(7200); /* 2 hours */        proxyTicketTTL = new Long(300); /* 5 min */        /* Start the configured cache. */        try {            store.start();        } catch (RuntimeException re) {            throw re;        } catch (Exception e) {            throw new MoriaStoreConfigurationException("Unable to start the cache", e);        }        /* Set the configuration state of this instance to true. */        isConfigured = true;    }