From 54c2799f45256fef4a981fa2a6a7c97a9708ac8b Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 26 Jul 2007 12:01:44 +0000
Subject: [PATCH] Partial fix for issue 1831 - dsconfig interactive mode.

---
 opends/src/server/org/opends/server/admin/server/ServerManagedObject.java |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/opends/src/server/org/opends/server/admin/server/ServerManagedObject.java b/opends/src/server/org/opends/server/admin/server/ServerManagedObject.java
index ed9e19a..ff01987 100644
--- a/opends/src/server/org/opends/server/admin/server/ServerManagedObject.java
+++ b/opends/src/server/org/opends/server/admin/server/ServerManagedObject.java
@@ -128,7 +128,7 @@
      *           If the default values could not be retrieved or
      *           decoded properly.
      */
-    public static <T> Collection<T> getDefaultValues(ManagedObjectPath p,
+    public static <T> Collection<T> getDefaultValues(ManagedObjectPath<?, ?> p,
         PropertyDefinition<T> pd, ConfigEntry newConfigEntry)
         throws DefaultBehaviorException {
       DefaultValueFinder<T> v = new DefaultValueFinder<T>(newConfigEntry);
@@ -140,7 +140,7 @@
     private DefaultBehaviorException exception = null;
 
     // The path of the managed object containing the next property.
-    private ManagedObjectPath nextPath = null;
+    private ManagedObjectPath<?, ?> nextPath = null;
 
     // The next property whose default values were required.
     private PropertyDefinition<T> nextProperty = null;
@@ -232,8 +232,8 @@
 
 
     // Find the default values for the next path/property.
-    private Collection<T> find(ManagedObjectPath p, PropertyDefinition<T> pd)
-        throws DefaultBehaviorException {
+    private Collection<T> find(ManagedObjectPath<?, ?> p,
+        PropertyDefinition<T> pd) throws DefaultBehaviorException {
       nextPath = p;
       nextProperty = pd;
 
@@ -393,7 +393,8 @@
    *           not be decoded.
    */
   static <S extends Configuration> ServerManagedObject<? extends S> decode(
-      ManagedObjectPath path, AbstractManagedObjectDefinition<?, S> definition,
+      ManagedObjectPath<?, ?> path,
+      AbstractManagedObjectDefinition<?, S> definition,
       ConfigEntry configEntry) throws DefinitionDecodingException,
       ServerManagedObjectDecodingException {
     return decode(path, definition, configEntry, null);
@@ -427,7 +428,8 @@
    *           not be decoded.
    */
   static <S extends Configuration> ServerManagedObject<? extends S> decode(
-      ManagedObjectPath path, AbstractManagedObjectDefinition<?, S> definition,
+      ManagedObjectPath<?, ?> path,
+      AbstractManagedObjectDefinition<?, S> definition,
       ConfigEntry configEntry, ConfigEntry newConfigEntry)
       throws DefinitionDecodingException, ServerManagedObjectDecodingException {
     // First determine the correct definition to use for the entry.
@@ -476,7 +478,7 @@
 
   // Decode helper method required to avoid generics warning.
   private static <S extends Configuration> ServerManagedObject<S> decodeAux(
-      ManagedObjectPath path, ManagedObjectDefinition<?, S> d,
+      ManagedObjectPath<?, ?> path, ManagedObjectDefinition<?, S> d,
       Map<PropertyDefinition<?>, SortedSet<?>> properties,
       ConfigEntry configEntry) {
     return new ServerManagedObject<S>(path, d, properties, configEntry);
@@ -487,7 +489,7 @@
   // Create a property using the provided string values.
   private static <T> void decodeProperty(
       Map<PropertyDefinition<?>, SortedSet<?>> properties,
-      ManagedObjectPath path, PropertyDefinition<T> pd,
+      ManagedObjectPath<?, ?> path, PropertyDefinition<T> pd,
       List<String> stringValues, ConfigEntry newConfigEntry)
       throws PropertyException {
     PropertyException exception = null;
@@ -611,7 +613,7 @@
 
 
   // Create an new server side managed object.
-  private ServerManagedObject(ManagedObjectPath path,
+  private ServerManagedObject(ManagedObjectPath<?, ?> path,
       ManagedObjectDefinition<?, S> d,
       Map<PropertyDefinition<?>, SortedSet<?>> properties,
       ConfigEntry configEntry) {
@@ -681,7 +683,8 @@
       ConfigurationChangeListener<? super S> listener) {
     for (ConfigChangeListener l : configEntry.getChangeListeners()) {
       if (l instanceof ConfigChangeListenerAdaptor) {
-        ConfigChangeListenerAdaptor adaptor = (ConfigChangeListenerAdaptor) l;
+        ConfigChangeListenerAdaptor<?> adaptor =
+          (ConfigChangeListenerAdaptor<?>) l;
         if (adaptor.getConfigurationChangeListener() == listener) {
           configEntry.deregisterChangeListener(adaptor);
         }
@@ -761,7 +764,7 @@
       InstantiableRelationDefinition<?, M> d, String name)
       throws IllegalArgumentException, ConfigException {
     validateRelationDefinition(d);
-    ManagedObjectPath childPath = path.child(d, name);
+    ManagedObjectPath<?, ?> childPath = path.child(d, name);
     return getChild(childPath, d);
   }
 
@@ -787,7 +790,7 @@
       OptionalRelationDefinition<?, M> d) throws IllegalArgumentException,
       ConfigException {
     validateRelationDefinition(d);
-    ManagedObjectPath childPath = path.child(d);
+    ManagedObjectPath<?, ?> childPath = path.child(d);
     return getChild(childPath, d);
   }
 
@@ -813,7 +816,7 @@
       SingletonRelationDefinition<?, M> d) throws IllegalArgumentException,
       ConfigException {
     validateRelationDefinition(d);
-    ManagedObjectPath childPath = path.child(d);
+    ManagedObjectPath<?, ?> childPath = path.child(d);
     return getChild(childPath, d);
   }
 
@@ -866,7 +869,7 @@
    *
    * @return Returns the path of this server managed object.
    */
-  public ManagedObjectPath getManagedObjectPath() {
+  public ManagedObjectPath<?, ?> getManagedObjectPath() {
     return path;
   }
 
@@ -1159,7 +1162,8 @@
       if (configEntry != null) {
         for (ConfigAddListener l : configEntry.getAddListeners()) {
           if (l instanceof ConfigAddListenerAdaptor) {
-            ConfigAddListenerAdaptor adaptor = (ConfigAddListenerAdaptor) l;
+            ConfigAddListenerAdaptor<?> adaptor =
+              (ConfigAddListenerAdaptor<?>) l;
             if (adaptor.getConfigurationAddListener() == listener) {
               configEntry.deregisterAddListener(adaptor);
             }
@@ -1184,8 +1188,8 @@
       if (configEntry != null) {
         for (ConfigDeleteListener l : configEntry.getDeleteListeners()) {
           if (l instanceof ConfigDeleteListenerAdaptor) {
-            ConfigDeleteListenerAdaptor adaptor =
-              (ConfigDeleteListenerAdaptor) l;
+            ConfigDeleteListenerAdaptor<?> adaptor =
+              (ConfigDeleteListenerAdaptor<?>) l;
             if (adaptor.getConfigurationDeleteListener() == listener) {
               configEntry.deregisterDeleteListener(adaptor);
             }
@@ -1204,7 +1208,7 @@
 
   // Get a child managed object.
   private <M extends Configuration> ServerManagedObject<? extends M> getChild(
-      ManagedObjectPath childPath, RelationDefinition<?, M> d)
+      ManagedObjectPath<?, ?> childPath, RelationDefinition<?, M> d)
       throws ConfigException {
     // Get the configuration entry.
     DN targetDN = DNBuilder.create(childPath);
@@ -1310,7 +1314,8 @@
   // object.
   private void validateRelationDefinition(RelationDefinition<?, ?> rd)
       throws IllegalArgumentException {
-    RelationDefinition tmp = definition.getRelationDefinition(rd.getName());
+    RelationDefinition<?, ?> tmp =
+      definition.getRelationDefinition(rd.getName());
     if (tmp != rd) {
       throw new IllegalArgumentException("The relation " + rd.getName()
           + " is not associated with a " + definition.getName());

--
Gitblit v1.10.0