.getComponentInstanceOfType(WorkspaceDataContainer.class)));
}
}
catch (ClassNotFoundException e)
{
throw new RepositoryConfigurationException("Class not found for workspace data container "
+ wsConfig.getUniqueName() + " : " + e);
}
// cache type
try
{
String className = wsConfig.getCache().getType();
if (className != null && className.length() > 0)
{
workspaceContainer.registerComponentImplementation(Class.forName(className));
}
else
workspaceContainer.registerComponentImplementation(LinkedWorkspaceStorageCacheImpl.class);
}
catch (ClassNotFoundException e)
{
log.warn("Workspace cache class not found " + wsConfig.getCache().getType()
+ ", will use default. Error : " + e);
workspaceContainer.registerComponentImplementation(LinkedWorkspaceStorageCacheImpl.class);
}
workspaceContainer.registerComponentImplementation(CacheableWorkspaceDataManager.class);
workspaceContainer.registerComponentImplementation(LocalWorkspaceDataManagerStub.class);
workspaceContainer.registerComponentImplementation(ObservationManagerRegistry.class);
// Lock manager and Lock persister is a optional parameters
if (wsConfig.getLockManager() != null && wsConfig.getLockManager().getPersister() != null)
{
try
{
Class<?> lockPersister = Class.forName(wsConfig.getLockManager().getPersister().getType());
workspaceContainer.registerComponentImplementation(lockPersister);
}
catch (ClassNotFoundException e)
{
throw new RepositoryConfigurationException("Class not found for workspace lock persister "
+ wsConfig.getLockManager().getPersister().getType() + ", container " + wsConfig.getUniqueName()
+ " : " + e);
}
}
if (wsConfig.getLockManager() != null && wsConfig.getLockManager().getType() != null)
{
try
{
Class<?> lockManagerType = Class.forName(wsConfig.getLockManager().getType());
workspaceContainer.registerComponentImplementation(lockManagerType);
}
catch (ClassNotFoundException e)
{
throw new RepositoryConfigurationException("Class not found for workspace lock manager "
+ wsConfig.getLockManager().getType() + ", container " + wsConfig.getUniqueName() + " : " + e);
}
}
else
{
workspaceContainer.registerComponentImplementation(LockManagerImpl.class);
}
// Query handler
if (wsConfig.getQueryHandler() != null)
{
workspaceContainer.registerComponentImplementation(SearchManager.class);
workspaceContainer.registerComponentImplementation(QueryManager.class);
workspaceContainer.registerComponentImplementation(QueryManagerFactory.class);
workspaceContainer.registerComponentInstance(wsConfig.getQueryHandler());
if (isSystem)
{
workspaceContainer.registerComponentImplementation(SystemSearchManager.class);
}
}
// access manager
if (wsConfig.getAccessManager() != null && wsConfig.getAccessManager().getType() != null)
{
try
{
Class<?> am = Class.forName(wsConfig.getAccessManager().getType());
workspaceContainer.registerComponentImplementation(am);
}
catch (ClassNotFoundException e)
{
throw new RepositoryConfigurationException("Class not found for workspace access manager "
+ wsConfig.getAccessManager().getType() + ", container " + wsConfig.getUniqueName() + " : " + e);
}
}
// initializer
Class<?> initilizerType;
if (wsConfig.getInitializer() != null && wsConfig.getInitializer().getType() != null)
{
// use user defined
try
{
initilizerType = Class.forName(wsConfig.getInitializer().getType());
}
catch (ClassNotFoundException e)
{
throw new RepositoryConfigurationException("Class not found for workspace initializer "
+ wsConfig.getInitializer().getType() + ", container " + wsConfig.getUniqueName() + " : " + e);
}
}
else
{
// use default
initilizerType = ScratchWorkspaceInitializer.class;
}
workspaceContainer.registerComponentImplementation(initilizerType);
workspaceContainer.registerComponentImplementation(SessionFactory.class);
LocalWorkspaceDataManagerStub wsDataManager =
(LocalWorkspaceDataManagerStub)workspaceContainer
.getComponentInstanceOfType(LocalWorkspaceDataManagerStub.class);
if (isSystem)
{
// system workspace
systemDataManager = wsDataManager;
registerComponentInstance(systemDataManager);
}
wsDataManager.setSystemDataManager(systemDataManager);
if (!config.getWorkspaceEntries().contains(wsConfig))
config.getWorkspaceEntries().add(wsConfig);
}
catch (RuntimeException e)
{
int depth = 0;
Throwable retval = e;
while (retval.getCause() != null && depth < 100)
{
retval = retval.getCause();
if (retval instanceof RepositoryException)
{
throw new RepositoryException(retval.getMessage(), e);
}
else if (retval instanceof RepositoryConfigurationException)
{
throw new RepositoryConfigurationException(retval.getMessage(), e);
}
else if (retval instanceof NameNotFoundException)
{
throw new RepositoryException(retval.getMessage(), e);
}