this.initialContextInitializer = initialContextInitializer;
if (rpcService != null)
{
// register commands
reserveRepositoryName = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.ext.repository.creation.RepositoryCreationServiceImpl-reserveRepositoryName";
}
public Serializable execute(Serializable[] args) throws Throwable
{
String repositoryName = (String)args[0];
return reserveRepositoryNameLocally(repositoryName);
}
});
createRepository = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.ext.repository.creation.RepositoryCreationServiceImpl-createRepository";
}
public Serializable execute(Serializable[] args) throws Throwable
{
String backupId = (String)args[0];
String stringRepositoryEntry = (String)args[1];
String rToken = (String)args[2];
DBCreationProperties creationProps = (DBCreationProperties)args[3];
try
{
RepositoryEntry rEntry =
(RepositoryEntry)(getObject(RepositoryEntry.class,
stringRepositoryEntry.getBytes(Constants.DEFAULT_ENCODING)));
createRepositoryLocally(backupId, rEntry, rToken, creationProps);
return null;
}
finally
{
// release tokens
pendingRepositories.remove(rToken);
}
}
});
startRepository = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.ext.repository.creation.RepositoryCreationServiceImpl-startRepository";
}
public Serializable execute(Serializable[] args) throws Throwable
{
// must not be executed on coordinator node, since coordinator node already created the repository
if (!rpcService.isCoordinator())
{
//RepositoryEntry (as String) rEntry
String stringRepositoryEntry = (String)args[0];
RepositoryEntry rEntry =
(RepositoryEntry)(getObject(RepositoryEntry.class,
stringRepositoryEntry.getBytes(Constants.DEFAULT_ENCODING)));
DBCreationProperties creationProps = (DBCreationProperties)args[1];
startRepository(rEntry, creationProps);
}
return null;
}
});
removeRepository = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.ext.repository.creation.RepositoryCreationServiceImpl-removeRepository";
}
public Serializable execute(Serializable[] args) throws Throwable
{
String repositoryName = (String)args[0];
removeRepositoryLocally(repositoryName);
return null;
}
});
canRemoveRepository = rpcService.registerCommand(new RemoteCommand()
{
public String getId()
{
return "org.exoplatform.services.jcr.ext.repository.creation.RepositoryCreationServiceImpl-checkRepositoryInUse";
}