You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2015/12/01 13:54:18 UTC

svn commit: r1717413 - in /qpid/java/branches/6.0.x: ./ broker-core/src/main/java/org/apache/qpid/server/model/ broker-core/src/main/java/org/apache/qpid/server/security/ broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/ brok...

Author: orudyy
Date: Tue Dec  1 12:54:18 2015
New Revision: 1717413

URL: http://svn.apache.org/viewvc?rev=1717413&view=rev
Log:
QPID-6918 : Make auto generated self signed certs work for JDK 8; fix model so non available types are not visible in meta data
------------------------------------------------------------------------
Merged from trunk with command:
svn merge -c r1717269 https://svn.apache.org/repos/asf/qpid/java/trunk

Added:
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/ModelRoot.java
      - copied unchanged from r1717269, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ModelRoot.java
Modified:
    qpid/java/branches/6.0.x/   (props changed)
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/security/AutoGeneratedSelfSignedKeyStoreImpl.java
    qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestModel.java
    qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/lifecycle/TestConfiguredObject.java
    qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/TestModel.java
    qpid/java/branches/6.0.x/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js

Propchange: qpid/java/branches/6.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  1 12:54:18 2015
@@ -9,5 +9,5 @@
 /qpid/branches/java-broker-vhost-refactor/java:1493674-1494547
 /qpid/branches/java-network-refactor/qpid/java:805429-821809
 /qpid/branches/qpid-2935/qpid/java:1061302-1072333
-/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636
+/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269
 /qpid/trunk/qpid:796646-796653

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java?rev=1717413&r1=1717412&r2=1717413&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java Tue Dec  1 12:54:18 2015
@@ -116,7 +116,8 @@ public final class BrokerModel extends M
         addRelationship(Session.class, Publisher.class);
 
         _objectFactory = new ConfiguredObjectFactoryImpl(this);
-        _typeRegistry = new ConfiguredObjectTypeRegistry((new QpidServiceLoader()).instancesOf(ConfiguredObjectRegistration.class), getSupportedCategories());
+        _typeRegistry = new ConfiguredObjectTypeRegistry((new QpidServiceLoader()).instancesOf(ConfiguredObjectRegistration.class), getSupportedCategories(),
+                                                         _objectFactory);
     }
 
     public final ConfiguredObjectTypeRegistry getTypeRegistry()

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java?rev=1717413&r1=1717412&r2=1717413&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java Tue Dec  1 12:54:18 2015
@@ -49,6 +49,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.qpid.server.plugin.ConfiguredObjectRegistration;
+import org.apache.qpid.server.plugin.ConfiguredObjectTypeFactory;
 import org.apache.qpid.server.util.Action;
 import org.apache.qpid.server.util.ServerScopedRuntimeException;
 import org.apache.qpid.util.Strings;
@@ -195,12 +196,17 @@ public class ConfiguredObjectTypeRegistr
     private final Map<Class<? extends ConfiguredObject>, Map<String, Collection<String>>> _validChildTypes =
             Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Map<String, Collection<String>>>());
 
-    public ConfiguredObjectTypeRegistry(Iterable<ConfiguredObjectRegistration> configuredObjectRegistrations, Collection<Class<? extends ConfiguredObject>> categoriesRestriction)
-    {
+    private final ConfiguredObjectFactory _objectFactory;
 
+    public ConfiguredObjectTypeRegistry(Iterable<ConfiguredObjectRegistration> configuredObjectRegistrations,
+                                        Collection<Class<? extends ConfiguredObject>> categoriesRestriction,
+                                        final ConfiguredObjectFactory objectFactory)
+    {
+        _objectFactory = objectFactory;
         Set<Class<? extends ConfiguredObject>> categories = new HashSet<>();
         Set<Class<? extends ConfiguredObject>> types = new HashSet<>();
 
+
         for (ConfiguredObjectRegistration registration : configuredObjectRegistrations)
         {
             for (Class<? extends ConfiguredObject> configuredObjectClass : registration.getConfiguredObjectClasses())
@@ -249,7 +255,12 @@ public class ConfiguredObjectTypeRegistr
             {
                 if (categoryClass.isAssignableFrom(typeClass))
                 {
-                    _knownTypes.get(categoryClass).add(typeClass);
+                    ManagedObject annotation = typeClass.getAnnotation(ManagedObject.class);
+                    String annotationType = annotation.type();
+                    if(ModelRoot.class.isAssignableFrom(categoryClass) || factoryExists(categoryClass, annotationType))
+                    {
+                        _knownTypes.get(categoryClass).add(typeClass);
+                    }
                 }
             }
         }
@@ -308,6 +319,14 @@ public class ConfiguredObjectTypeRegistr
         }
     }
 
+    private boolean factoryExists(final Class<? extends ConfiguredObject> categoryClass, final String type)
+    {
+        final ConfiguredObjectTypeFactory factory =
+                _objectFactory.getConfiguredObjectTypeFactory(categoryClass.getSimpleName(), type);
+
+        return factory != null && factory.getType().equals(type);
+    }
+
     private static Method getValidChildTypesFunction(final String validValue, final Class<? extends ConfiguredObject> clazz)
     {
         if (validValue.matches("([\\w][\\w\\d_]+\\.)+[\\w][\\w\\d_\\$]*#[\\w\\d_]+\\s*\\(\\s*\\)"))

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java?rev=1717413&r1=1717412&r2=1717413&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/SystemConfig.java Tue Dec  1 12:54:18 2015
@@ -25,7 +25,7 @@ import org.apache.qpid.server.logging.Ev
 import org.apache.qpid.server.store.DurableConfigurationStore;
 
 @ManagedObject (creatable = false)
-public interface SystemConfig<X extends SystemConfig<X>> extends ConfiguredObject<X>
+public interface SystemConfig<X extends SystemConfig<X>> extends ConfiguredObject<X>, ModelRoot
 {
     String MANAGEMENT_MODE = "managementMode";
     

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/security/AutoGeneratedSelfSignedKeyStoreImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/security/AutoGeneratedSelfSignedKeyStoreImpl.java?rev=1717413&r1=1717412&r2=1717413&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/security/AutoGeneratedSelfSignedKeyStoreImpl.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/security/AutoGeneratedSelfSignedKeyStoreImpl.java Tue Dec  1 12:54:18 2015
@@ -383,13 +383,23 @@ public class AutoGeneratedSelfSignedKeyS
     {
         try
         {
-            final Class<?> certAndKeyGenClass = Class.forName("sun.security.x509.CertAndKeyGen");
+            Class<?> certAndKeyGenClass;
+            try
+            {
+                certAndKeyGenClass = Class.forName("sun.security.x509.CertAndKeyGen");
+            }
+            catch (ClassNotFoundException e)
+            {
+                certAndKeyGenClass = Class.forName("sun.security.tools.keytool.CertAndKeyGen");
+            }
+
             final Class<?> x500NameClass = Class.forName("sun.security.x509.X500Name");
             final Class<?> certificateExtensionsClass = Class.forName("sun.security.x509.CertificateExtensions");
             final Class<?> generalNamesClass = Class.forName("sun.security.x509.GeneralNames");
             final Class<?> generalNameClass = Class.forName("sun.security.x509.GeneralName");
             final Class<?> extensionClass = Class.forName("sun.security.x509.SubjectAlternativeNameExtension");
 
+
             CONSTRUCTOR = certAndKeyGenClass.getConstructor(String.class, String.class);
             GENERATE_METHOD = certAndKeyGenClass.getMethod("generate", Integer.TYPE);
             GET_PRIVATE_KEY_METHOD = certAndKeyGenClass.getMethod("getPrivateKey");

Modified: qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestModel.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestModel.java?rev=1717413&r1=1717412&r2=1717413&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestModel.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestModel.java Tue Dec  1 12:54:18 2015
@@ -54,7 +54,7 @@ public class TestModel extends Model
 
         ConfiguredObjectRegistration configuredObjectRegistration = new ConfiguredObjectRegistrationImpl();
 
-        _registry = new ConfiguredObjectTypeRegistry(Collections.singletonList(configuredObjectRegistration), Collections.EMPTY_LIST);
+        _registry = new ConfiguredObjectTypeRegistry(Collections.singletonList(configuredObjectRegistration), Collections.EMPTY_LIST, _objectFactory);
     }
 
 

Modified: qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/lifecycle/TestConfiguredObject.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/lifecycle/TestConfiguredObject.java?rev=1717413&r1=1717412&r2=1717413&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/lifecycle/TestConfiguredObject.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/lifecycle/TestConfiguredObject.java Tue Dec  1 12:54:18 2015
@@ -219,7 +219,8 @@ public class TestConfiguredObject extend
                     return TestConfiguredObjectModel.class.getSimpleName();
                 }
             };
-            _configuredObjectTypeRegistry = new ConfiguredObjectTypeRegistry(Arrays.asList(configuredObjectRegistration), CATEGORIES);
+            _configuredObjectTypeRegistry = new ConfiguredObjectTypeRegistry(Arrays.asList(configuredObjectRegistration), CATEGORIES,
+                                                                             _configuredObjectFactory);
         }
 
         @Override

Modified: qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/TestModel.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/TestModel.java?rev=1717413&r1=1717412&r2=1717413&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/TestModel.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/singleton/TestModel.java Tue Dec  1 12:54:18 2015
@@ -62,7 +62,7 @@ public class TestModel extends Model
                 return "org.apache.qpid.server.model.testmodels.attribute";
             }
         };
-        _registry = new ConfiguredObjectTypeRegistry(Arrays.asList(configuredObjectRegistration), getSupportedCategories());
+        _registry = new ConfiguredObjectTypeRegistry(Arrays.asList(configuredObjectRegistration), getSupportedCategories(), _objectFactory);
     }
 
 

Modified: qpid/java/branches/6.0.x/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js?rev=1717413&r1=1717412&r2=1717413&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js (original)
+++ qpid/java/branches/6.0.x/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js Tue Dec  1 12:54:18 2015
@@ -126,19 +126,25 @@ define(["dojo/_base/lang",
             {
                 if (this.storeForm.validate())
                 {
-                    var success = false,failureReason=null;
+                    var that = this;
+
+                    function disableButtons(disabled) {
+                        that.addButton.set("disabled", disabled);
+                        that.cancelButton.set("disabled", disabled);
+                    }
+
+                    disableButtons(true);
 
                     var storeData = util.getFormWidgetValues(this.storeForm, this.initialData);
-                    var that = this;
 
                     if (this.effectiveData)
                     {
                         // update request
-                        this.management.update(this.modelObj, storeData).then(function(x){that.dialog.hide();});
+                        this.management.update(this.modelObj, storeData).then(function(x){ disableButtons(false); that.dialog.hide();}, function(err) { disableButtons(false); that.management.errorHandler(err); });
                     }
                     else
                     {
-                        this.management.create(this.category, this.modelObj, storeData).then(function(x){that.dialog.hide();});
+                        this.management.create(this.category, this.modelObj, storeData).then(function(x){ disableButtons(false); that.dialog.hide();}, function(err) { disableButtons(false); that.management.errorHandler(err); });
                     }
                 }
                 else



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org