diff options
author | Ade Lee <alee@redhat.com> | 2012-10-19 01:35:04 -0400 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-10-22 12:03:39 -0400 |
commit | 1c45197227a0d54b525d4b40f66aa96aeb4f2e6a (patch) | |
tree | 82d3a166d5353c0ec43845be448c0a7d16342187 /base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java | |
parent | 40bcc2cc6e4b6f9f9bd36c56fc63f20902486188 (diff) | |
download | pki-1c45197227a0d54b525d4b40f66aa96aeb4f2e6a.tar.gz pki-1c45197227a0d54b525d4b40f66aa96aeb4f2e6a.tar.xz pki-1c45197227a0d54b525d4b40f66aa96aeb4f2e6a.zip |
Provide option to install, rather than replicate schema in a clone
Diffstat (limited to 'base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java')
-rw-r--r-- | base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java index c5804f2d4..2a2c3b3ab 100644 --- a/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java +++ b/base/common/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java @@ -1254,11 +1254,18 @@ public class ConfigurationUtils { try { String select = cs.getString("preop.subsystem.select", ""); if (select.equals("clone")) { - // if this is clone, add index before replication - // don't put in the schema or bad things will happen + // in most cases, we want to replicate the schema and therefore + // NOT add it here. We provide this option though in case the + // clone already has schema and we want to replicate back to the + // master. + boolean replicateSchema = cs.getBoolean("preop.internaldb.replicateSchema", true); + if (! replicateSchema) { + importLDIFS("preop.internaldb.schema.ldif", conn); + } importLDIFS("preop.internaldb.ldif", conn); + + // add the index before replication, add VLV indexes afterwards importLDIFS("preop.internaldb.index_ldif", conn); - importLDIFS("preop.internaldb.manager_ldif", conn); } else { // data will be replicated from the master to the clone // so clone does not need the data @@ -1266,7 +1273,6 @@ public class ConfigurationUtils { importLDIFS("preop.internaldb.ldif", conn); importLDIFS("preop.internaldb.data_ldif", conn); importLDIFS("preop.internaldb.index_ldif", conn); - importLDIFS("preop.internaldb.manager_ldif", conn); } } catch (Exception e) { e.printStackTrace(); @@ -1506,6 +1512,25 @@ public class ConfigurationUtils { return dir.delete(); } + public static void populateDBManager() throws Exception { + CMS.debug("populateDBManager(): start"); + IConfigStore cs = CMS.getConfigStore(); + + IConfigStore dbCfg = cs.getSubStore("internaldb"); + ILdapConnFactory dbFactory = CMS.getLdapBoundConnFactory(); + dbFactory.init(dbCfg); + LDAPConnection conn = dbFactory.getConn(); + + try { + importLDIFS("preop.internaldb.manager_ldif", conn); + } catch (Exception e) { + CMS.debug("populateDBManager(): Exception thrown: " + e); + throw e; + } finally { + releaseConnection(conn); + } + } + public static void populateVLVIndexes() throws Exception { CMS.debug("populateVLVIndexes(): start"); IConfigStore cs = CMS.getConfigStore(); |