| opends/resource/admin/admin-cli.xsd | ●●●●● patch | view | raw | blame | history | |
| opends/resource/admin/cliMOProfile.xsl | ●●●●● patch | view | raw | blame | history | |
| opends/src/server/org/opends/server/tools/dsconfig/CLIProfile.java | ●●●●● patch | view | raw | blame | history | |
| opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java | ●●●●● patch | view | raw | blame | history |
opends/resource/admin/admin-cli.xsd
@@ -69,6 +69,20 @@ </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name="naming-argument-override" type="adm:name-type" use="optional"> <xsd:annotation> <xsd:documentation> A command-line argument name which should be used to override the default argument name used to identify managed objects referenced by this relation. By default the command-line argument name is derived by taking the last word in the relation name and appending "-name". For example, the relation "certificate-mapper" becomes "mapper-name". </xsd:documentation> </xsd:annotation> </xsd:attribute> </xsd:complexType> </xsd:element> </xsd:schema> opends/resource/admin/cliMOProfile.xsl
@@ -52,6 +52,14 @@ <xsl:for-each select="$this-all-relations"> <xsl:sort select="@name" /> <!-- Generate the naming argument override if present --> <xsl:value-of select="concat('relation.', @name, '.naming-argument-override=', adm:profile[@name='cli']/cli:relation/@naming-argument-override, '
')" /> <!-- Generate list of properties which should be displayed by default in list-xxx operations. --> <xsl:value-of opends/src/server/org/opends/server/tools/dsconfig/CLIProfile.java
@@ -34,6 +34,7 @@ import java.util.Set; import org.opends.server.admin.AbstractManagedObjectDefinition; import org.opends.server.admin.InstantiableRelationDefinition; import org.opends.server.admin.ManagedObjectDefinitionResource; import org.opends.server.admin.RelationDefinition; @@ -42,7 +43,7 @@ /** * This class is used to access CLI profile annotations. */ class CLIProfile { final class CLIProfile { // The singleton instance. private static final CLIProfile INSTANCE = new CLIProfile(); @@ -88,6 +89,39 @@ /** * Gets the naming argument which should be used for a relation * definition. * * @param r * The relation definition. * @return Returns the naming argument which should be used for a * relation definition. */ public String getNamingArgument(InstantiableRelationDefinition<?, ?> r) { String s = resource.getString(r.getParentDefinition(), "relation." + r.getName() + ".naming-argument-override").trim(); if (s.length() == 0) { // Use the last word in the managed object name as the argument // prefix. StringBuilder builder = new StringBuilder(); s = r.getChildDefinition().getName(); int i = s.lastIndexOf('-'); if (i < 0 || i == (s.length() - 1)) { builder.append(s); } else { builder.append(s.substring(i + 1)); } builder.append("-name"); s = builder.toString(); } return s; } /** * Determines if instances of the specified managed object * definition are to be used for customization. * opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
@@ -455,19 +455,7 @@ AbstractManagedObjectDefinition<C, S> d, String name) { sz--; // Use the last word in the managed object name as the argument // prefix. StringBuilder builder = new StringBuilder(); String s = d.getName(); int i = s.lastIndexOf('-'); if (i < 0 || i == (s.length() - 1)) { builder.append(s); } else { builder.append(s.substring(i + 1)); } builder.append("-name"); String argName = builder.toString(); String argName = CLIProfile.getInstance().getNamingArgument(r); StringArgument arg; try {