private Boolean autocreateWorkspaces = false;
private Executor systemExecutor;
+ private Credentials adminCredentials;
public void afterPropertiesSet() throws Exception {
// remote repository
else
repository = RepositoryImpl.create(config);
- importNodeTypeDefinitions(repository);
+ if (cndFiles != null && cndFiles.size() > 0)
+ importNodeTypeDefinitions(repository);
log.info("Initialized Jackrabbit repository " + repository + " in "
+ homeDirectory + " with config " + configuration);
* will be thrown.
*/
protected void importNodeTypeDefinitions(final Repository repository) {
+ final Credentials credentialsToUse;
if (systemExecutor == null) {
- log.warn("No system executor found");
- return;
+ if (adminCredentials == null)
+ throw new ArgeoException(
+ "No system executor or admin credentials found");
+ credentialsToUse = adminCredentials;
+ } else {
+ credentialsToUse = null;
}
- systemExecutor.execute(new Runnable() {
+ Runnable action = new Runnable() {
public void run() {
Reader reader = null;
Session session = null;
try {
- session = repository.login();
+ session = repository.login(credentialsToUse);
// Load cnds as resources
for (String resUrl : cndFiles) {
Resource res = resourceLoader.getResource(resUrl);
JcrUtils.logoutQuietly(session);
}
}
- });
+ };
+ if (systemExecutor != null)
+ systemExecutor.execute(action);
+ else
+ action.run();
}
public void destroy() throws Exception {
this.systemExecutor = systemExecutor;
}
+ public void setAdminCredentials(Credentials adminCredentials) {
+ this.adminCredentials = adminCredentials;
+ }
+
}