Examples of ReplicationSynchronizationProviderCfgClient


Examples of org.nasutekds.server.admin.std.client.ReplicationSynchronizationProviderCfgClient

    try
    {
      ManagementContext mCtx = LDAPManagementContext.createFromContext(
          JNDIDirContextAdaptor.adapt(ctx));
      RootCfgClient root = mCtx.getRootConfiguration();
      ReplicationSynchronizationProviderCfgClient sync =
        (ReplicationSynchronizationProviderCfgClient)
        root.getSynchronizationProvider("Multimaster Synchronization");
      if (sync.hasReplicationServer())
      {
        ReplicationServerCfgClient replicationServer =
          sync.getReplicationServer();
        Set<String> replServers = replicationServer.getReplicationServer();
        if (replServers != null)
        {
          String replServer = null;
          for (String o : replServers)
          {
            if (getUninstallUserData().getReplicationServer().equalsIgnoreCase(
                o))
            {
              replServer = o;
              break;
            }
          }
          if (replServer != null)
          {
            LOG.log(Level.INFO, "Updating references in replication server on "+
                serverDisplay+".");
            replServers.remove(replServer);
            if (replServers.size() > 0)
            {
              replicationServer.setReplicationServer(replServers);
              replicationServer.commit();
            }
            else
            {
              sync.removeReplicationServer();
              sync.commit();
            }
          }
        }
      }
      String[] domainNames = sync.listReplicationDomains();
      if (domainNames != null)
      {
        for (int i=0; i<domainNames.length; i++)
        {
          ReplicationDomainCfgClient domain =
            sync.getReplicationDomain(domainNames[i]);
          Set<String> replServers = domain.getReplicationServer();
          if (replServers != null)
          {
            String replServer = null;
            for (String o : replServers)
            {
              if (getUninstallUserData().getReplicationServer().
                  equalsIgnoreCase(o))
              {
                replServer = o;
                break;
              }
            }
            if (replServer != null)
            {
              LOG.log(Level.INFO, "Updating references in domain " +
                  domain.getBaseDN()+" on " + serverDisplay + ".");
              replServers.remove(replServer);
              if (replServers.size() > 0)
              {
                domain.setReplicationServer(replServers);
                domain.commit();
              }
              else
              {
                sync.removeReplicationDomain(domainNames[i]);
                sync.commit();
              }
            }
          }
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.