Removed Utilities.getRDNString()
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the DN in the configuration for a given backend. |
| | | * @param backend the backend. |
| | | * @return the backend configuration entry DN. |
| | | */ |
| | | private String getDN(BackendDescriptor backend) |
| | | { |
| | | return Utilities.getRDNString("ds-cfg-backend-id", |
| | | backend.getBackendID())+",cn=Backends,cn=config"; |
| | | } |
| | | |
| | | /** |
| | | * Deletes a set of base DNs. The code assumes that the server is not running |
| | | * and that the configuration file can be edited. |
| | | * @param baseDNs the list of base DNs. |
| | |
| | | newBaseDNs.removeAll(dnsToRemove); |
| | | |
| | | String backendName = backend.getBackendID(); |
| | | String dn = Utilities.getRDNString("ds-cfg-backend-id", backendName)+ |
| | | ",cn=Backends,cn=config"; |
| | | ConfigEntry configEntry = |
| | | DirectoryServer.getConfigHandler().getConfigEntry(DN.valueOf(dn)); |
| | | DN dn = DN.valueOf("ds-cfg-backend-id" + "=" + backendName + ",cn=Backends,cn=config"); |
| | | ConfigEntry configEntry = DirectoryServer.getConfigHandler().getConfigEntry(dn); |
| | | |
| | | DNConfigAttribute baseDNAttr = |
| | | new DNConfigAttribute( |
| | |
| | | */ |
| | | private void deleteBackend(BackendDescriptor backend) throws OpenDsException, ConfigException |
| | | { |
| | | String dn = getDN(backend); |
| | | Utilities.deleteConfigSubtree( |
| | | DirectoryServer.getConfigHandler(), DN.valueOf(dn)); |
| | | DN dn = DN.valueOf("ds-cfg-backend-id" + "=" + backend.getBackendID() + ",cn=Backends,cn=config"); |
| | | Utilities.deleteConfigSubtree(DirectoryServer.getConfigHandler(), dn); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.controlpanel.task; |
| | | |
| | |
| | | */ |
| | | private void deleteIndex(AbstractIndexDescriptor index) throws OpenDsException |
| | | { |
| | | final String backendId = Utilities.getRDNString("ds-cfg-backend-id", index.getBackend().getBackendID()); |
| | | final String backendId = "ds-cfg-backend-id" + "=" + index.getBackend().getBackendID(); |
| | | String dn; |
| | | if (isVLVIndex(index)) |
| | | { |
| | | dn = getRDNString("ds-cfg-name", index.getName()) + ",cn=VLV Index," + backendId + ",cn=Backends,cn=config"; |
| | | dn = "ds-cfg-name" + "=" + index.getName() + ",cn=VLV Index," + backendId + ",cn=Backends,cn=config"; |
| | | } |
| | | else |
| | | { |
| | | dn = getRDNString("ds-cfg-attribute", index.getName()) + ",cn=Index," + backendId + ",cn=Backends,cn=config"; |
| | | dn = "ds-cfg-attribute" + "=" + index.getName() + ",cn=Index," + backendId + ",cn=Backends,cn=config"; |
| | | } |
| | | DirectoryServer.getConfigHandler().deleteEntry(DN.valueOf(dn), null); |
| | | } |
| | |
| | | // If it takes time to read the entry, the rdnAttribute might not be initialized yet. Don't try to use it then. |
| | | if (value.length() > 0 && rdnAttribute != null) |
| | | { |
| | | String rdn = Utilities.getRDNString(rdnAttribute, value); |
| | | dn.setText(rdn+","+parentDN.getText().trim()); |
| | | dn.setText(rdnAttribute + "=" + value + "," + parentDN.getText().trim()); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import javax.swing.JLabel; |
| | | import javax.swing.JTextField; |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The panel to create a domain. |
| | | * |
| | | */ |
| | | /** The panel to create a domain. */ |
| | | public class NewDomainPanel extends NewOrganizationPanel |
| | | { |
| | | private static final long serialVersionUID = -595396547491445219L; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected void updateDNValue() |
| | | { |
| | | String value = name.getText().trim(); |
| | | if (value.length() > 0) |
| | | { |
| | | String rdn = Utilities.getRDNString("dc", value); |
| | | dn.setText(rdn+","+parentNode.getDN()); |
| | | dn.setText("dc" + "=" + value + "," + parentNode.getDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getLDIF() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | String value = name.getText().trim(); |
| | | if (value.length() > 0) |
| | | { |
| | | String rdn = Utilities.getRDNString("cn", value); |
| | | dn.setText(rdn+","+parentNode.getDN()); |
| | | dn.setText("cn" + "=" + value + "," + parentNode.getDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | |
| | | /* |
| | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | /** |
| | | * The panel used to create a new organization. |
| | | * |
| | | */ |
| | | /** The panel used to create a new organization. */ |
| | | public class NewOrganizationPanel extends AbstractNewEntryPanel |
| | | { |
| | | private static final long serialVersionUID = 6560126551083160773L; |
| | |
| | | String value = name.getText().trim(); |
| | | if (value.length() > 0) |
| | | { |
| | | String rdn = Utilities.getRDNString("o", value); |
| | | dn.setText(rdn+","+parentNode.getDN()); |
| | | dn.setText("o" + "=" + value + "," + parentNode.getDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Returns the LDIF representing the new entry. |
| | | * @return the LDIF representing the new entry. |
| | | */ |
| | | @Override |
| | | protected String getLDIF() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * The panel used to create a new organizational unit. |
| | | * |
| | | */ |
| | | /** The panel used to create a new organizational unit. */ |
| | | public class NewOrganizationalUnitPanel extends AbstractNewEntryPanel |
| | | { |
| | | private static final long serialVersionUID = -7145648120019856161L; |
| | |
| | | String value = name.getText().trim(); |
| | | if (value.length() > 0) |
| | | { |
| | | String rdn = Utilities.getRDNString("ou", value); |
| | | dn.setText(rdn+","+parentNode.getDN()); |
| | | dn.setText("ou" + "=" + value + "," + parentNode.getDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getLDIF() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.types.OpenDsException; |
| | | |
| | | /** |
| | | * The panel used to create a new user. |
| | | * |
| | | */ |
| | | /** The panel used to create a new user. */ |
| | | public class NewUserPanel extends AbstractNewEntryPanel |
| | | { |
| | | private static final long serialVersionUID = -2450090053404111892L; |
| | |
| | | if (attr.equalsIgnoreCase(NAMING_ATTRIBUTES[i])) |
| | | { |
| | | String value = NAMING_ATTRIBUTE_TEXTFIELDS[i].getText().trim(); |
| | | String rdn = Utilities.getRDNString(attr, value); |
| | | dn.setText(rdn+","+parentNode.getDN()); |
| | | dn.setText(attr + "=" + value + "," + parentNode.getDN()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String getLDIF() |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.ConfigurationFramework; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.opends.guitools.controlpanel.ControlPanel; |
| | |
| | | import org.opends.server.admin.ClassLoaderProvider; |
| | | import org.opends.server.api.ConfigHandler; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.LockFileManager; |
| | | import org.opends.server.schema.SchemaConstants; |
| | | import org.opends.server.schema.SomeSchemaElement; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.OpenDsException; |
| | | import org.opends.server.types.RDN; |
| | | import org.opends.server.types.Schema; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.util.StaticUtils; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Gets the RDN string for a given attribute name and value. |
| | | * @param attrName the attribute name. |
| | | * @param attrValue the attribute value. |
| | | * @return the RDN string for the attribute name and value. |
| | | */ |
| | | public static String getRDNString(String attrName, String attrValue) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | RDN rdn = new RDN(attrType, attrName, ByteString.valueOfUtf8(attrValue)); |
| | | return rdn.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Returns the attribute name with no options (or subtypes). |
| | | * @param attrName the complete attribute name. |
| | | * @return the attribute name with no options (or subtypes). |
| | | */ |
| | | |
| | | public static String getAttributeNameWithoutOptions(String attrName) |
| | | { |
| | | int index = attrName.indexOf(";"); |
| | |
| | | try |
| | | { |
| | | // Read the configuration file. |
| | | String dn = Utilities.getRDNString("ds-cfg-backend-id", |
| | | backendName)+",cn=Backends,cn=config"; |
| | | Utilities.deleteConfigSubtree( |
| | | DirectoryServer.getConfigHandler(), DN.valueOf(dn)); |
| | | DN dn = DN.valueOf("ds-cfg-backend-id" + "=" + backendName + ",cn=Backends,cn=config"); |
| | | Utilities.deleteConfigSubtree(DirectoryServer.getConfigHandler(), dn); |
| | | } |
| | | catch (OpenDsException | ConfigException ode) |
| | | { |