use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit by apache.
the class SimpleSecurityManagerTest method setUp.
@Override
public void setUp() throws RepositoryException {
String file = "src/test/resources/org/apache/jackrabbit/core/security/simple/simple_repository.xml";
RepositoryConfig config = RepositoryConfig.create(file, "target/simple_repository");
repository = RepositoryImpl.create(config);
}
use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit by apache.
the class StartJackrabbit method execute.
/**
* {@inheritDoc}
*/
public boolean execute(Context ctx) throws Exception {
String config = (String) ctx.get(this.configKey);
String home = (String) ctx.get(this.homeKey);
if (log.isDebugEnabled()) {
log.debug("starting jackrabbit. config=" + config + " home=" + home);
}
RepositoryConfig conf = RepositoryConfig.create(config, home);
Repository repo = RepositoryImpl.create(conf);
CommandHelper.setRepository(ctx, repo, "local " + home);
return false;
}
use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit by apache.
the class StartJackrabbitSingleton method execute.
/**
* {@inheritDoc}
*/
public boolean execute(Context ctx) throws Exception {
String config = (String) ctx.get(this.configKey);
String home = (String) ctx.get(this.homeKey);
if (log.isDebugEnabled()) {
log.debug("starting jackrabbit. config=" + config + " home=" + home);
}
try {
synchronized (cache) {
String key = config + "@" + home;
Repository repo = (Repository) cache.get(key);
if (repo == null) {
String msg = "Starting Jakrabbit instance";
log.info(msg);
RepositoryConfig conf = RepositoryConfig.create(config, home);
repo = RepositoryImpl.create(conf);
cache.put(key, repo);
}
CommandHelper.setRepository(ctx, repo, "local singleton " + home);
}
} catch (Exception e) {
log.error("Unable to start jackrabbit", e);
throw e;
}
return false;
}
use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit-oak by apache.
the class JackrabbitRepositoryFixture method setUpCluster.
@Override
public Repository[] setUpCluster(int n) throws Exception {
if (n == 1) {
String name = "Jackrabbit-" + System.currentTimeMillis();
File directory = new File(base, name);
Properties variables = new Properties(System.getProperties());
variables.setProperty(REPOSITORY_HOME_VARIABLE, directory.getPath());
variables.setProperty("bundleCacheSize", Integer.toString(bundleCacheSize));
InputStream xml = getClass().getResourceAsStream("repository.xml");
RepositoryConfig config = RepositoryConfig.create(new InputSource(xml), variables);
// Prevent Derby from polluting the current directory
System.setProperty("derby.stream.error.file", new File(directory, "derby.log").getPath());
RepositoryImpl repository = RepositoryImpl.create(config);
this.cluster = new RepositoryImpl[] { repository };
return new Repository[] { repository };
} else {
throw new UnsupportedOperationException("TODO");
}
}
use of org.apache.jackrabbit.core.config.RepositoryConfig in project jackrabbit by apache.
the class MembershipCachePerfTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
FileUtils.deleteDirectory(new File(REPO_HOME));
RepositoryConfig config = RepositoryConfig.create(getClass().getResourceAsStream("repository-membersplit.xml"), REPO_HOME);
repo = RepositoryImpl.create(config);
session = createSession();
userMgr = session.getUserManager();
cache = ((UserManagerImpl) userMgr).getMembershipCache();
boolean autoSave = userMgr.isAutoSave();
userMgr.autoSave(false);
// create test users and groups
System.out.printf("Creating %d users...\n", NUM_USERS);
List<User> users = new ArrayList<User>();
for (int i = 0; i < NUM_USERS; i++) {
users.add(userMgr.createUser(TEST_USER_PREFIX + i, "secret"));
}
System.out.printf("Creating %d groups...\n", NUM_GROUPS);
for (int i = 0; i < NUM_GROUPS; i++) {
Group g = userMgr.createGroup(TEST_GROUP_PREFIX + i);
for (int j = 0; j < NUM_USERS_PER_GROUP; j++) {
g.addMember(users.get(j));
}
session.save();
System.out.printf(".").flush();
}
userMgr.autoSave(autoSave);
logger.info("Initial cache size: " + cache.getSize());
}
Aggregations