projects
/
lgpl
/
argeo-commons.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Massive Argeo APIs refactoring
[lgpl/argeo-commons.git]
/
org.argeo.cms
/
src
/
org
/
argeo
/
cms
/
internal
/
kernel
/
DeployConfig.java
diff --git
a/org.argeo.cms/src/org/argeo/cms/internal/kernel/DeployConfig.java
b/org.argeo.cms/src/org/argeo/cms/internal/kernel/DeployConfig.java
index 2f60b73374035c6f6e6b8243179c286eaea33796..4a88dd1b499e4fd3e15c67d64512108d846d34a3 100644
(file)
--- a/
org.argeo.cms/src/org/argeo/cms/internal/kernel/DeployConfig.java
+++ b/
org.argeo.cms/src/org/argeo/cms/internal/kernel/DeployConfig.java
@@
-18,13
+18,12
@@
import javax.naming.directory.BasicAttributes;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.api.NodeConstants;
-import org.argeo.naming.AttributesDictionary;
-import org.argeo.naming.LdifParser;
-import org.argeo.naming.LdifWriter;
+import org.argeo.api.cms.CmsConstants;
+import org.argeo.api.cms.CmsLog;
import org.argeo.osgi.useradmin.UserAdminConf;
import org.argeo.osgi.useradmin.UserAdminConf;
+import org.argeo.util.naming.AttributesDictionary;
+import org.argeo.util.naming.LdifParser;
+import org.argeo.util.naming.LdifWriter;
import org.eclipse.equinox.http.jetty.JettyConfigurator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.eclipse.equinox.http.jetty.JettyConfigurator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
@@
-35,7
+34,7
@@
import org.osgi.service.cm.ConfigurationListener;
/** Manages the LDIF-based deployment configuration. */
class DeployConfig implements ConfigurationListener {
/** Manages the LDIF-based deployment configuration. */
class DeployConfig implements ConfigurationListener {
- private final
Log log = LogFactory
.getLog(getClass());
+ private final
CmsLog log = CmsLog
.getLog(getClass());
private final BundleContext bc = FrameworkUtil.getBundle(getClass()).getBundleContext();
private static Path deployConfigPath = KernelUtils.getOsgiInstancePath(KernelConstants.DEPLOY_CONFIG_PATH);
private final BundleContext bc = FrameworkUtil.getBundle(getClass()).getBundleContext();
private static Path deployConfigPath = KernelUtils.getOsgiInstancePath(KernelConstants.DEPLOY_CONFIG_PATH);
@@
-92,16
+91,16
@@
class DeployConfig implements ConfigurationListener {
Dictionary<String, Object> userDirectoryConfig = userDirectoryConfigs.get(i);
String baseDn = (String) userDirectoryConfig.get(UserAdminConf.baseDn.name());
String cn;
Dictionary<String, Object> userDirectoryConfig = userDirectoryConfigs.get(i);
String baseDn = (String) userDirectoryConfig.get(UserAdminConf.baseDn.name());
String cn;
- if (
Node
Constants.ROLES_BASEDN.equals(baseDn))
+ if (
Cms
Constants.ROLES_BASEDN.equals(baseDn))
cn = ROLES;
else
cn = UserAdminConf.baseDnHash(userDirectoryConfig);
activeCns.add(cn);
cn = ROLES;
else
cn = UserAdminConf.baseDnHash(userDirectoryConfig);
activeCns.add(cn);
- userDirectoryConfig.put(
Node
Constants.CN, cn);
- putFactoryDeployConfig(
Node
Constants.NODE_USER_ADMIN_PID, userDirectoryConfig);
+ userDirectoryConfig.put(
Cms
Constants.CN, cn);
+ putFactoryDeployConfig(
Cms
Constants.NODE_USER_ADMIN_PID, userDirectoryConfig);
}
// disable others
}
// disable others
- LdapName userAdminFactoryName = serviceFactoryDn(
Node
Constants.NODE_USER_ADMIN_PID);
+ LdapName userAdminFactoryName = serviceFactoryDn(
Cms
Constants.NODE_USER_ADMIN_PID);
for (LdapName name : deployConfigs.keySet()) {
if (name.startsWith(userAdminFactoryName) && !name.equals(userAdminFactoryName)) {
// try {
for (LdapName name : deployConfigs.keySet()) {
if (name.startsWith(userAdminFactoryName) && !name.equals(userAdminFactoryName)) {
// try {
@@
-125,7
+124,7
@@
class DeployConfig implements ConfigurationListener {
// webServerConfig.put("customizer.class", "org.argeo.equinox.jetty.CmsJettyCustomizer");
// putFactoryDeployConfig(KernelConstants.JETTY_FACTORY_PID, webServerConfig);
// }
// webServerConfig.put("customizer.class", "org.argeo.equinox.jetty.CmsJettyCustomizer");
// putFactoryDeployConfig(KernelConstants.JETTY_FACTORY_PID, webServerConfig);
// }
- LdapName defaultHttpServiceDn = serviceDn(KernelConstants.JETTY_FACTORY_PID,
Node
Constants.DEFAULT);
+ LdapName defaultHttpServiceDn = serviceDn(KernelConstants.JETTY_FACTORY_PID,
Cms
Constants.DEFAULT);
if (deployConfigs.containsKey(defaultHttpServiceDn)) {
// remove old default configs since we have now to start Jetty servlet bridge
// indirectly
if (deployConfigs.containsKey(defaultHttpServiceDn)) {
// remove old default configs since we have now to start Jetty servlet bridge
// indirectly
@@
-139,7
+138,7
@@
class DeployConfig implements ConfigurationListener {
// Explicitly configures Jetty so that the default server is not started by the
// activator of the Equinox Jetty bundle.
Dictionary<String, Object> webServerConfig = InitUtils
// Explicitly configures Jetty so that the default server is not started by the
// activator of the Equinox Jetty bundle.
Dictionary<String, Object> webServerConfig = InitUtils
- .getHttpServerConfig(getProps(KernelConstants.JETTY_FACTORY_PID,
Node
Constants.DEFAULT));
+ .getHttpServerConfig(getProps(KernelConstants.JETTY_FACTORY_PID,
Cms
Constants.DEFAULT));
// if (!webServerConfig.isEmpty()) {
// webServerConfig.put("customizer.class", KernelConstants.CMS_JETTY_CUSTOMIZER_CLASS);
//
// if (!webServerConfig.isEmpty()) {
// webServerConfig.put("customizer.class", KernelConstants.CMS_JETTY_CUSTOMIZER_CLASS);
//
@@
-203,8
+202,8
@@
class DeployConfig implements ConfigurationListener {
deployConfigs: for (LdapName dn : deployConfigs.keySet()) {
Rdn lastRdn = dn.getRdn(dn.size() - 1);
LdapName prefix = (LdapName) dn.getPrefix(dn.size() - 1);
deployConfigs: for (LdapName dn : deployConfigs.keySet()) {
Rdn lastRdn = dn.getRdn(dn.size() - 1);
LdapName prefix = (LdapName) dn.getPrefix(dn.size() - 1);
- if (prefix.toString().equals(
Node
Constants.DEPLOY_BASEDN)) {
- if (lastRdn.getType().equals(
Node
Constants.CN)) {
+ if (prefix.toString().equals(
Cms
Constants.DEPLOY_BASEDN)) {
+ if (lastRdn.getType().equals(
Cms
Constants.CN)) {
// service
String pid = lastRdn.getValue().toString();
Configuration conf = configurationAdmin.getConfiguration(pid);
// service
String pid = lastRdn.getValue().toString();
Configuration conf = configurationAdmin.getConfiguration(pid);
@@
-220,7
+219,7
@@
class DeployConfig implements ConfigurationListener {
continue deployConfigs;
// service factory service
Rdn beforeLastRdn = dn.getRdn(dn.size() - 2);
continue deployConfigs;
// service factory service
Rdn beforeLastRdn = dn.getRdn(dn.size() - 2);
- assert beforeLastRdn.getType().equals(
Node
Constants.OU);
+ assert beforeLastRdn.getType().equals(
Cms
Constants.OU);
String factoryPid = beforeLastRdn.getValue().toString();
Configuration conf = configurationAdmin.createFactoryConfiguration(factoryPid.toString(), null);
if (systemRolesDn.equals(dn)) {
String factoryPid = beforeLastRdn.getValue().toString();
Configuration conf = configurationAdmin.createFactoryConfiguration(factoryPid.toString(), null);
if (systemRolesDn.equals(dn)) {
@@
-253,7
+252,7
@@
class DeployConfig implements ConfigurationListener {
for (LdapName dn : deployConfigs.keySet()) {
if (dn.startsWith(serviceFactoryDn)) {
Rdn lastRdn = dn.getRdn(dn.size() - 1);
for (LdapName dn : deployConfigs.keySet()) {
if (dn.startsWith(serviceFactoryDn)) {
Rdn lastRdn = dn.getRdn(dn.size() - 1);
- assert lastRdn.getType().equals(
Node
Constants.CN);
+ assert lastRdn.getType().equals(
Cms
Constants.CN);
Object value = conf.getProperties().get(lastRdn.getType());
assert value != null;
if (value.equals(lastRdn.getValue())) {
Object value = conf.getProperties().get(lastRdn.getType());
assert value != null;
if (value.equals(lastRdn.getValue())) {
@@
-263,7
+262,7
@@
class DeployConfig implements ConfigurationListener {
}
}
}
}
- Object cn = conf.getProperties().get(
Node
Constants.CN);
+ Object cn = conf.getProperties().get(
Cms
Constants.CN);
if (cn == null)
throw new IllegalArgumentException("Properties must contain cn");
if (serviceDn == null) {
if (cn == null)
throw new IllegalArgumentException("Properties must contain cn");
if (serviceDn == null) {
@@
-299,12
+298,12
@@
class DeployConfig implements ConfigurationListener {
}
void putFactoryDeployConfig(String factoryPid, Dictionary<String, Object> props) {
}
void putFactoryDeployConfig(String factoryPid, Dictionary<String, Object> props) {
- Object cn = props.get(
Node
Constants.CN);
+ Object cn = props.get(
Cms
Constants.CN);
if (cn == null)
throw new IllegalArgumentException("cn must be set in properties");
LdapName serviceFactoryDn = serviceFactoryDn(factoryPid);
if (!deployConfigs.containsKey(serviceFactoryDn))
if (cn == null)
throw new IllegalArgumentException("cn must be set in properties");
LdapName serviceFactoryDn = serviceFactoryDn(factoryPid);
if (!deployConfigs.containsKey(serviceFactoryDn))
- deployConfigs.put(serviceFactoryDn, new BasicAttributes(
Node
Constants.OU, factoryPid));
+ deployConfigs.put(serviceFactoryDn, new BasicAttributes(
Cms
Constants.OU, factoryPid));
LdapName serviceDn = serviceDn(factoryPid, cn.toString());
Attributes attrs = new BasicAttributes();
AttributesDictionary.copy(props, attrs);
LdapName serviceDn = serviceDn(factoryPid, cn.toString());
Attributes attrs = new BasicAttributes();
AttributesDictionary.copy(props, attrs);
@@
-313,7
+312,7
@@
class DeployConfig implements ConfigurationListener {
void putDeployConfig(String servicePid, Dictionary<String, Object> props) {
LdapName serviceDn = serviceDn(servicePid);
void putDeployConfig(String servicePid, Dictionary<String, Object> props) {
LdapName serviceDn = serviceDn(servicePid);
- Attributes attrs = new BasicAttributes(
Node
Constants.CN, servicePid);
+ Attributes attrs = new BasicAttributes(
Cms
Constants.CN, servicePid);
AttributesDictionary.copy(props, attrs);
deployConfigs.put(serviceDn, attrs);
}
AttributesDictionary.copy(props, attrs);
deployConfigs.put(serviceDn, attrs);
}
@@
-332,7
+331,7
@@
class DeployConfig implements ConfigurationListener {
*/
private LdapName serviceFactoryDn(String factoryPid) {
try {
*/
private LdapName serviceFactoryDn(String factoryPid) {
try {
- return new LdapName(
NodeConstants.OU + "=" + factoryPid + "," + Node
Constants.DEPLOY_BASEDN);
+ return new LdapName(
CmsConstants.OU + "=" + factoryPid + "," + Cms
Constants.DEPLOY_BASEDN);
} catch (InvalidNameException e) {
throw new IllegalArgumentException("Cannot generate DN from " + factoryPid, e);
}
} catch (InvalidNameException e) {
throw new IllegalArgumentException("Cannot generate DN from " + factoryPid, e);
}
@@
-340,7
+339,7
@@
class DeployConfig implements ConfigurationListener {
private LdapName serviceDn(String servicePid) {
try {
private LdapName serviceDn(String servicePid) {
try {
- return new LdapName(
NodeConstants.CN + "=" + servicePid + "," + Node
Constants.DEPLOY_BASEDN);
+ return new LdapName(
CmsConstants.CN + "=" + servicePid + "," + Cms
Constants.DEPLOY_BASEDN);
} catch (InvalidNameException e) {
throw new IllegalArgumentException("Cannot generate DN from " + servicePid, e);
}
} catch (InvalidNameException e) {
throw new IllegalArgumentException("Cannot generate DN from " + servicePid, e);
}
@@
-348,7
+347,7
@@
class DeployConfig implements ConfigurationListener {
private LdapName serviceDn(String factoryPid, String cn) {
try {
private LdapName serviceDn(String factoryPid, String cn) {
try {
- return (LdapName) serviceFactoryDn(factoryPid).add(new Rdn(
Node
Constants.CN, cn));
+ return (LdapName) serviceFactoryDn(factoryPid).add(new Rdn(
Cms
Constants.CN, cn));
} catch (InvalidNameException e) {
throw new IllegalArgumentException("Cannot generate DN from " + factoryPid + " and " + cn, e);
}
} catch (InvalidNameException e) {
throw new IllegalArgumentException("Cannot generate DN from " + factoryPid + " and " + cn, e);
}