argList[0] = cacheConfigInputStream;
IdentityStoreCacheProvider cacheSupport = (IdentityStoreCacheProvider)ct.newInstance(argList);
defaultIdentityStore = new JBossCacheIdentityStoreWrapper(defaultIdentityStore, cacheSupport);
}
catch (Exception e)
{
throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);
}
}
}
for (IdentityStoreMappingMetaData identityStoreMappingMetaData : configurationMD.getIdentityStoreToIdentityObjectTypeMappings())
{
String storeId = identityStoreMappingMetaData.getIdentityStoreId();
List<String> identityObjectTypeMappings = identityStoreMappingMetaData.getIdentityObjectTypeMappings();
IdentityStore store = bootstrappedIdentityStores.get(storeId);
String cacheOption = identityStoreMappingMetaData.getOptionSingleValue(CACHE_OPTION);
if (cacheOption != null && cacheOption.equalsIgnoreCase("true"))
{
String cacheConfig = identityStoreMappingMetaData.getOptionSingleValue(CACHE_CONFIG_FILE_OPTION);
String cacheSupportClass = identityStoreMappingMetaData.getOptionSingleValue(CACHE_PROVIDER_CLASS_OPTION);
if (cacheConfig == null)
{
throw new IdentityException(CACHE_CONFIG_FILE_OPTION + " is missing in the repository identity-store-mapping configuration");
}
if (cacheSupportClass == null)
{
throw new IdentityException(CACHE_PROVIDER_CLASS_OPTION + " is missing in the repository configuration");
}
ClassLoader classLoader = SecurityActions.getContextClassLoader();
InputStream cacheConfigInputStream = classLoader.getResourceAsStream(cacheConfig);
if (cacheConfigInputStream == null)
{
throw new IdentityException("JBoss Cache config file specified in option \"" + CACHE_CONFIG_FILE_OPTION +
"\" doesn't exist: " + cacheConfig);
}
try
{
Class cacheClass = null;
cacheClass = Class.forName(cacheSupportClass);
Class partypes[] = new Class[1];
partypes[0] = InputStream.class;
Constructor ct = cacheClass.getConstructor(partypes);
Object argList[] = new Object[1];
argList[0] = cacheConfigInputStream;
IdentityStoreCacheProvider cacheSupport = (IdentityStoreCacheProvider)ct.newInstance(argList);
store = new JBossCacheIdentityStoreWrapper(store, cacheSupport);
}
catch (Exception e)
{
throw new IdentityException("Cannot instantiate cache provider:" + cacheSupportClass, e);