* COMMON NAMES
*/
String NODE = "node";
- String EGO = "ego";
- String HOME = "home";
- String SRV = "srv";
- String GUESTS = "guests";
- String PUBLIC = "public";
+
+ /*
+ * JCR CONVENTIONS
+ */
+ String NODE_REPOSITORY = NODE;
+ String EGO_REPOSITORY = "ego";
+ String HOME_WORKSPACE = "home";
+ String SRV_WORKSPACE = "srv";
+ String GUESTS_WORKSPACE = "guests";
+ String PUBLIC_WORKSPACE = "public";
/*
* BASE DNs
private static void checkUserWorkspace(Session session, String username) {
String workspaceName = session.getWorkspace().getName();
- if (!NodeConstants.HOME.equals(workspaceName))
+ if (!NodeConstants.HOME_WORKSPACE.equals(workspaceName))
throw new IllegalArgumentException(workspaceName + " is not the home workspace for user " + username);
}
private static void checkGroupWorkspace(Session session, String groupname) {
String workspaceName = session.getWorkspace().getName();
- if (!NodeConstants.SRV.equals(workspaceName))
+ if (!NodeConstants.SRV_WORKSPACE.equals(workspaceName))
throw new IllegalArgumentException(workspaceName + " is not the group workspace for group " + groupname);
}
top.setLayout(CmsUiUtils.noSpaceGridLayout());
try {
- this.userSession = this.nodeRepository.login(NodeConstants.HOME);
+ this.userSession = this.nodeRepository.login(NodeConstants.HOME_WORKSPACE);
} catch (RepositoryException e) {
throw new CmsException("Cannot open user session", e);
}
@Override
protected void createUi(Composite parent) {
try {
- groupsSession = repository.login(NodeConstants.SRV);
+ groupsSession = repository.login(NodeConstants.SRV_WORKSPACE);
} catch (RepositoryException e) {
throw new CmsException("Cannot retrieve session", e);
}
if (homeNode != null)
homeNode.dispose();
homeNode = new SingleJcrNodeElem(null, userHome,
- userSession.getUserID(), NodeConstants.NODE);
+ userSession.getUserID(), NodeConstants.EGO_REPOSITORY);
}
}
if (repositoryRegister != null) {
/** A path in the node repository */
public static String getDataPath(Node node) throws RepositoryException {
- return getDataPath(NodeConstants.NODE, node);
+ return getDataPath(NodeConstants.EGO_REPOSITORY, node);
}
public static String getDataPath(String cn, Node node) throws RepositoryException {
@Override
public Session run() throws Exception {
Collection<ServiceReference<Repository>> srs = bc.getServiceReferences(Repository.class,
- "(" + NodeConstants.CN + "=" + NodeConstants.NODE + ")");
+ "(" + NodeConstants.CN + "=" + NodeConstants.EGO_REPOSITORY + ")");
Repository repository = bc.getService(srs.iterator().next());
return repository.login();
}
private String getDataUrl(Node node, HttpServletRequest request) throws RepositoryException {
try {
StringBuilder buf = getServerBaseUrl(request);
- buf.append(NodeUtils.getDataPath(NodeConstants.NODE, node));
+ buf.append(NodeUtils.getDataPath(NodeConstants.EGO_REPOSITORY, node));
return new URL(buf.toString()).toString();
} catch (MalformedURLException e) {
throw new CmsException("Cannot build data URL for " + node, e);
}
// home
- prepareDataModel(NodeConstants.NODE, deployedNodeRepository);
+ prepareDataModel(NodeConstants.NODE_REPOSITORY, deployedNodeRepository);
}
private void prepareHomeRepository(RepositoryImpl deployedRepository) {
// Publish home with the highest service ranking
Hashtable<String, Object> regProps = new Hashtable<>();
- regProps.put(NodeConstants.CN, NodeConstants.EGO);
+ regProps.put(NodeConstants.CN, NodeConstants.EGO_REPOSITORY);
regProps.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
Repository egoRepository = new EgoRepository(deployedRepository, false);
bc.registerService(Repository.class, egoRepository, regProps);
BundleWiring wiring = bundle.adapt(BundleWiring.class);
if (wiring == null)
continue bundles;
- if (NodeConstants.NODE.equals(cn))// process all data models
+ if (NodeConstants.NODE_REPOSITORY.equals(cn))// process all data models
processWiring(cn, adminSession, wiring, processed, false);
else {
List<BundleCapability> capabilities = wiring.getCapabilities(CMS_DATA_MODEL_NAMESPACE);
boolean publishLocalRepo;
if (isStandalone && name.equals(cn))// includes the node itself
publishLocalRepo = true;
- else if (!isStandalone && cn.equals(NodeConstants.NODE))
+ else if (!isStandalone && cn.equals(NodeConstants.NODE_REPOSITORY))
publishLocalRepo = true;
else
publishLocalRepo = false;
RepositoryContext repoContext = bc.getService(reference);
String cn = (String) reference.getProperty(NodeConstants.CN);
if (cn != null) {
- if (cn.equals(NodeConstants.NODE)) {
+ if (cn.equals(NodeConstants.NODE_REPOSITORY)) {
prepareNodeRepository(repoContext.getRepository());
// TODO separate home repository
prepareHomeRepository(repoContext.getRepository());
return fileSystem;
} else {
Repository repository = bc.getService(
- bc.getServiceReferences(Repository.class, "(cn=" + NodeConstants.EGO + ")").iterator().next());
+ bc.getServiceReferences(Repository.class, "(cn=" + NodeConstants.EGO_REPOSITORY + ")").iterator().next());
// Session session = repository.login();
CmsFileSystem fileSystem = new CmsFileSystem(this, repository);
fileSystems.put(username, fileSystem);
public Node getUserHome(Repository repository) {
try {
- Session session = repository.login(NodeConstants.HOME);
+ Session session = repository.login(NodeConstants.HOME_WORKSPACE);
return NodeUtils.getUserHome(session);
} catch (RepositoryException e) {
throw new IllegalStateException("Cannot get user home", e);
@Override
public Repository addingService(ServiceReference<Repository> reference) {
Object cn = reference.getProperty(NodeConstants.CN);
- if (cn != null && cn.equals(NodeConstants.EGO)) {
+ if (cn != null && cn.equals(NodeConstants.EGO_REPOSITORY)) {
egoRepository = (EgoRepository) bc.getService(reference);
if (log.isTraceEnabled())
log.trace("Home repository is available");
// additional repositories
dataModels: for (DataModels.DataModel dataModel : dataModels.getNonAbstractDataModels()) {
- if (NodeConstants.NODE.equals(dataModel.getName()))
+ if (NodeConstants.NODE_REPOSITORY.equals(dataModel.getName()))
continue dataModels;
Dictionary<String, Object> config = InitUtils.getRepositoryConfig(dataModel.getName(),
getProps(NodeConstants.NODE_REPOS_FACTORY_PID, dataModel.getName()));
private SimpleDateFormat usersDatePath = new SimpleDateFormat("YYYY/MM");
- private String defaultHomeWorkspace = NodeConstants.HOME;
- private String defaultGroupsWorkspace = NodeConstants.SRV;
-// private String defaultGuestsWorkspace = NodeConstants.GUESTS;
+ private String defaultHomeWorkspace = NodeConstants.HOME_WORKSPACE;
+ private String defaultGroupsWorkspace = NodeConstants.SRV_WORKSPACE;
+// private String defaultGuestsWorkspace = NodeConstants.GUESTS_WORKSPACE;
private final boolean remote;
public EgoRepository(Repository repository, boolean remote) {
super(repository);
this.remote = remote;
- putDescriptor(NodeConstants.CN, NodeConstants.EGO);
+ putDescriptor(NodeConstants.CN, NodeConstants.EGO_REPOSITORY);
if (!remote) {
LoginContext lc;
try {
if (value != null)
props.put(repoConf.name(), value);
}
- props.put(NodeConstants.CN, NodeConstants.NODE);
+ props.put(NodeConstants.CN, NodeConstants.NODE_REPOSITORY);
return props;
}
static Dictionary<String, Object> getRepositoryConfig(String dataModelName, Dictionary<String, Object> provided) {
- if (dataModelName.equals(NodeConstants.NODE) || dataModelName.equals(NodeConstants.EGO))
+ if (dataModelName.equals(NodeConstants.NODE_REPOSITORY) || dataModelName.equals(NodeConstants.EGO_REPOSITORY))
throw new IllegalArgumentException("Data model '" + dataModelName + "' is reserved.");
Dictionary<String, Object> props = provided != null ? provided : new Hashtable<String, Object>();
for (RepoConf repoConf : RepoConf.values()) {
private void addMonitor(String realWorkspaceName) {
if (realWorkspaceName.equals(SECURITY_WORKSPACE))
return;
- if (!NodeConstants.NODE.equals(getCn()))
+ if (!NodeConstants.NODE_REPOSITORY.equals(getCn()))
return;
if (!workspaceMonitors.containsKey(realWorkspaceName)) {
try {
registerWebdavServlet(httpService, alias, repository);
registerRemotingServlet(httpService, alias, repository);
- if (NodeConstants.EGO.equals(alias))
+ if (NodeConstants.EGO_REPOSITORY.equals(alias))
registerFilesServlet(httpService, alias, repository);
if (log.isTraceEnabled())
log.trace("Registered servlets for repository '" + alias + "'");
try {
httpService.unregister(webdavPath(alias));
httpService.unregister(remotingPath(alias));
- if (NodeConstants.EGO.equals(alias))
+ if (NodeConstants.EGO_REPOSITORY.equals(alias))
httpService.unregister(filesPath(alias));
if (log.isTraceEnabled())
log.trace("Unregistered servlets for repository '" + alias + "'");
bc.registerService(Repository.class, repository, props);
// home
- if (cn.equals(NodeConstants.NODE)) {
- Dictionary<String, Object> homeProps = LangUtils.dico(NodeConstants.CN, NodeConstants.EGO);
+ if (cn.equals(NodeConstants.NODE_REPOSITORY)) {
+ Dictionary<String, Object> homeProps = LangUtils.dico(NodeConstants.CN, NodeConstants.EGO_REPOSITORY);
EgoRepository homeRepository = new EgoRepository(repository, true);
bc.registerService(Repository.class, homeRepository, homeProps);
}
private Session login() {
try {
- return repository.login(NodeConstants.HOME);
+ return repository.login(NodeConstants.HOME_WORKSPACE);
} catch (RepositoryException e) {
throw new CmsException("Cannot login key ring session", e);
}