geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r910676 - in /geronimo/server/trunk/framework/modules: geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/ geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/ geronimo-system/src/main/java/org/apache/geronimo/system...
Date Tue, 16 Feb 2010 20:29:02 GMT
Author: djencks
Date: Tue Feb 16 20:29:01 2010
New Revision: 910676

URL: http://svn.apache.org/viewvc?rev=910676&view=rev
Log:
genericize a few kernel classes a bit more

Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanAttribute.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicKernel.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelMBeanServer.java

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanAttribute.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanAttribute.java?rev=910676&r1=910675&r2=910676&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanAttribute.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanAttribute.java
Tue Feb 16 20:29:01 2010
@@ -250,6 +250,8 @@
                     }
                 } catch (NoSuchMethodException e) {
                     throw new InvalidConfigurationException("Getter method not found " +
getDescription(), e);
+                } catch (NoClassDefFoundError e) {
+                    throw new InvalidConfigurationException("Getter method not found " +
getDescription(), e);
                 }
             } else {
                 getInvoker = null;

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicKernel.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicKernel.java?rev=910676&r1=910675&r2=910676&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicKernel.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicKernel.java
Tue Feb 16 20:29:01 2010
@@ -129,7 +129,7 @@
      * Construct a Kernel with the specified name.
      *
      * @param kernelName the name of the kernel
-     * @param bundleContext
+     * @param bundleContext bundle context kernel is configured in.
      */
     public BasicKernel(String kernelName, BundleContext bundleContext) {
         if (kernelName.indexOf(':') >= 0 || kernelName.indexOf('*') >= 0 || kernelName.indexOf('?')
>= 0) {
@@ -288,6 +288,7 @@
         return getGBean(null, type);
     }
 
+    @SuppressWarnings("unchecked")
     public <T> T getGBean(String shortName, Class<T> type) throws GBeanNotFoundException,
InternalKernelException, IllegalStateException {
         GBeanInstance gbeanInstance = registry.getGBeanInstance(shortName, type);
         if (gbeanInstance.getState() != State.RUNNING_INDEX) {
@@ -549,6 +550,7 @@
                     }
                 }
             } catch (GBeanNotFoundException e) {
+                //ignore
             }
         }
         return gbeans;

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java?rev=910676&r1=910675&r2=910676&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicRegistry.java
Tue Feb 16 20:29:01 2010
@@ -20,11 +20,11 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.IdentityHashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import javax.management.ObjectName;
+
 import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -38,9 +38,9 @@
  * @version $Rev$ $Date$
  */
 public class BasicRegistry implements InstanceRegistry {
-    private final Map objectNameRegistry = new HashMap();
-    private final Map infoRegistry = new HashMap();
-    private final IdentityHashMap instanceRegistry = new IdentityHashMap();
+    private final Map<ObjectName, GBeanInstance> objectNameRegistry = new HashMap<ObjectName,
GBeanInstance>();
+    private final Map<AbstractName, GBeanInstance> infoRegistry = new HashMap<AbstractName,
GBeanInstance>();
+    private final IdentityHashMap<Object, GBeanInstance> instanceRegistry = new IdentityHashMap<Object,
GBeanInstance>();
     private String kernelName = "";
 
     /**
@@ -93,7 +93,7 @@
     }
 
     public synchronized void unregister(AbstractName abstractName) throws GBeanNotFoundException
{
-        GBeanInstance gbeanInstance = (GBeanInstance) infoRegistry.remove(abstractName);
+        GBeanInstance gbeanInstance = infoRegistry.remove(abstractName);
         if (gbeanInstance == null) {
             throw new GBeanNotFoundException(abstractName);
         }
@@ -109,7 +109,7 @@
     }
 
     public synchronized GBeanInstance getGBeanInstanceByInstance(Object instance) {
-        return (GBeanInstance) instanceRegistry.get(instance);
+        return instanceRegistry.get(instance);
     }
 
     /**
@@ -120,7 +120,7 @@
      * @throws GBeanNotFoundException if there is no GBean registered with the supplied name
      */
     public synchronized GBeanInstance getGBeanInstance(ObjectName name) throws GBeanNotFoundException
{
-        GBeanInstance instance = (GBeanInstance) objectNameRegistry.get(normalizeObjectName(name));
+        GBeanInstance instance = objectNameRegistry.get(normalizeObjectName(name));
         if (instance == null) {
             throw new GBeanNotFoundException(name);
         }
@@ -128,7 +128,7 @@
     }
 
     public synchronized GBeanInstance getGBeanInstance(AbstractName abstractName) throws
GBeanNotFoundException {
-        GBeanInstance instance = (GBeanInstance) infoRegistry.get(abstractName);
+        GBeanInstance instance = infoRegistry.get(abstractName);
         if (instance == null) {
             throw new GBeanNotFoundException(abstractName);
         }
@@ -147,7 +147,7 @@
         } else {
             nameQuery = new AbstractNameQuery(null, Collections.singletonMap("name", shortName),
type.getName());
         }
-        Set instances = listGBeans(nameQuery);
+        Set<GBeanInstance> instances = listGBeans(nameQuery);
 
         if (instances.size() == 0) {
             throw new GBeanNotFoundException("No GBeans found", Collections.singleton(nameQuery),
null);
@@ -163,7 +163,7 @@
             throw new GBeanNotFoundException("More then one GBean was found with shortName
'" + shortName + "' and type '" + type.getName() + "'", Collections.singleton(nameQuery),
mapToNames(instances));
         }
 
-        return (GBeanInstance) instances.iterator().next();
+        return instances.iterator().next();
     }
 
     private Set<AbstractName> mapToNames(Set<GBeanInstance> instances) {
@@ -181,18 +181,17 @@
      * @param pattern the object name pattern to search for
      * @return an unordered Set<GBeanInstance> of GBeans that matched the pattern
      */
-    public Set listGBeans(ObjectName pattern) {
+    public Set<GBeanInstance> listGBeans(ObjectName pattern) {
         pattern = normalizeObjectName(pattern);
 
         // fairly dumb implementation that iterates the list of all registered GBeans
-        Map clone;
+        Map<ObjectName, GBeanInstance> clone;
         synchronized (this) {
-            clone = new HashMap(objectNameRegistry);
+            clone = new HashMap<ObjectName, GBeanInstance>(objectNameRegistry);
         }
-        Set result = new HashSet(clone.size());
-        for (Iterator i = clone.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            ObjectName name = (ObjectName) entry.getKey();
+        Set<GBeanInstance> result = new HashSet<GBeanInstance>(clone.size());
+        for (Map.Entry<ObjectName, GBeanInstance> entry : clone.entrySet()) {
+            ObjectName name = entry.getKey();
             if (pattern == null || pattern.apply(name)) {
                 result.add(entry.getValue());
             }
@@ -200,16 +199,15 @@
         return result;
     }
 
-    public Set listGBeans(AbstractNameQuery query) {
-        Map clone;
+    public Set<GBeanInstance> listGBeans(AbstractNameQuery query) {
+        Map<AbstractName, GBeanInstance> clone;
         synchronized (this) {
-            clone = new HashMap(infoRegistry);
+            clone = new HashMap<AbstractName, GBeanInstance>(infoRegistry);
         }
-        Set result = new HashSet(clone.size());
-        for (Iterator i = clone.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            AbstractName abstractName = (AbstractName) entry.getKey();
-            GBeanInstance gbeanData = (GBeanInstance) entry.getValue();
+        Set<GBeanInstance> result = new HashSet<GBeanInstance>(clone.size());
+        for (Map.Entry<AbstractName, GBeanInstance> entry : clone.entrySet()) {
+            AbstractName abstractName = entry.getKey();
+            GBeanInstance gbeanData = entry.getValue();
             if (query == null || query.matches(abstractName, gbeanData.getGBeanInfo().getInterfaces()))
{
                 result.add(gbeanData);
             }

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java?rev=910676&r1=910675&r2=910676&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelDelegate.java
Tue Feb 16 20:29:01 2010
@@ -66,6 +66,7 @@
         return (Naming) getKernelAttribute("naming");
     }
 
+    @Deprecated
     public Object getGBean(ObjectName name) throws GBeanNotFoundException, InternalKernelException,
IllegalStateException {
         try {
             return invokeKernel("getGBean", new Object[] {name}, new String[] {ObjectName.class.getName()});
@@ -110,9 +111,10 @@
         throw new GBeanNotFoundException("No implementation found for type " + type.getName(),
null, set);
     }
 
+    @SuppressWarnings("unchecked")
     public <T> T getGBean(String shortName, Class<T> type) throws GBeanNotFoundException,
InternalKernelException, IllegalStateException {
         try {
-            return (T)invokeKernel("getGBean", new Object[] {shortName, type}, new String[]
{String.class.getName(), Class.class.getName()});
+            return (T) invokeKernel("getGBean", new Object[] {shortName, type}, new String[]
{String.class.getName(), Class.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -232,7 +234,7 @@
 
     public boolean isRunning(AbstractName name) {
         try {
-            return ((Boolean) invokeKernel("isRunning", new Object[]{name}, new String[]{AbstractName.class.getName()})).booleanValue();
+            return (Boolean) invokeKernel("isRunning", new Object[]{name}, new String[]{AbstractName.class.getName()});
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -242,7 +244,7 @@
 
     public boolean isRunning(String shortName) {
         try {
-            return ((Boolean) invokeKernel("isRunning", new Object[]{shortName}, new String[]{String.class.getName()})).booleanValue();
+            return (Boolean) invokeKernel("isRunning", new Object[]{shortName}, new String[]{String.class.getName()});
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -252,7 +254,7 @@
 
     public boolean isRunning(Class type) {
         try {
-            return ((Boolean) invokeKernel("isRunning", new Object[]{type}, new String[]{Class.class.getName()})).booleanValue();
+            return (Boolean) invokeKernel("isRunning", new Object[]{type}, new String[]{Class.class.getName()});
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -262,7 +264,7 @@
 
     public boolean isRunning(String shortName, Class type) {
         try {
-            return ((Boolean) invokeKernel("isRunning", new Object[]{shortName, type}, new
String[]{String.class.getName(), Class.class.getName()})).booleanValue();
+            return (Boolean) invokeKernel("isRunning", new Object[]{shortName, type}, new
String[]{String.class.getName(), Class.class.getName()});
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -367,9 +369,10 @@
         }
     }
 
+    @Deprecated
     public int getGBeanState(ObjectName name) throws GBeanNotFoundException {
         try {
-            return ((Integer) invokeKernel("getGBeanState", new Object[]{name}, new String[]{ObjectName.class.getName()})).intValue();
+            return (Integer) invokeKernel("getGBeanState", new Object[]{name}, new String[]{ObjectName.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -381,7 +384,7 @@
 
     public int getGBeanState(AbstractName name) throws GBeanNotFoundException {
         try {
-            return ((Integer) invokeKernel("getGBeanState", new Object[]{name}, new String[]{AbstractName.class.getName()})).intValue();
+            return (Integer) invokeKernel("getGBeanState", new Object[]{name}, new String[]{AbstractName.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -393,7 +396,7 @@
 
     public int getGBeanState(String shortName) throws GBeanNotFoundException {
         try {
-            return ((Integer) invokeKernel("getGBeanState", new Object[]{shortName}, new
String[]{String.class.getName()})).intValue();
+            return (Integer) invokeKernel("getGBeanState", new Object[]{shortName}, new String[]{String.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -405,7 +408,7 @@
 
     public int getGBeanState(Class type) throws GBeanNotFoundException {
         try {
-            return ((Integer) invokeKernel("getGBeanState", new Object[]{type}, new String[]{Class.class.getName()})).intValue();
+            return (Integer) invokeKernel("getGBeanState", new Object[]{type}, new String[]{Class.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -417,7 +420,7 @@
 
     public int getGBeanState(String shortName, Class type) throws GBeanNotFoundException
{
         try {
-            return ((Integer) invokeKernel("getGBeanState", new Object[]{shortName, type},
new String[]{String.class.getName(), Class.class.getName()})).intValue();
+            return (Integer) invokeKernel("getGBeanState", new Object[]{shortName, type},
new String[]{String.class.getName(), Class.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -429,7 +432,7 @@
 
     public long getGBeanStartTime(AbstractName name) throws GBeanNotFoundException {
         try {
-            return ((Long) invokeKernel("getGBeanStartTime", new Object[]{name}, new String[]{AbstractName.class.getName()})).longValue();
+            return (Long) invokeKernel("getGBeanStartTime", new Object[]{name}, new String[]{AbstractName.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -441,7 +444,7 @@
 
     public long getGBeanStartTime(String shortName) throws GBeanNotFoundException {
         try {
-            return ((Long) invokeKernel("getGBeanStartTime", new Object[]{shortName}, new
String[]{String.class.getName()})).longValue();
+            return (Long) invokeKernel("getGBeanStartTime", new Object[]{shortName}, new
String[]{String.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -453,7 +456,7 @@
 
     public long getGBeanStartTime(Class type) throws GBeanNotFoundException {
         try {
-            return ((Long) invokeKernel("getGBeanStartTime", new Object[]{type}, new String[]{Class.class.getName()})).longValue();
+            return (Long) invokeKernel("getGBeanStartTime", new Object[]{type}, new String[]{Class.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -465,7 +468,7 @@
 
     public long getGBeanStartTime(String shortName, Class type) throws GBeanNotFoundException
{
         try {
-            return ((Long) invokeKernel("getGBeanStartTime", new Object[]{shortName, type},
new String[]{String.class.getName(), Class.class.getName()})).longValue();
+            return (Long) invokeKernel("getGBeanStartTime", new Object[]{shortName, type},
new String[]{String.class.getName(), Class.class.getName()});
         } catch (GBeanNotFoundException e) {
             throw e;
         } catch (RuntimeException e) {
@@ -475,6 +478,7 @@
         }
     }
 
+    @Deprecated
     public Object getAttribute(ObjectName objectName, String attributeName) throws Exception
{
         return invokeKernel("getAttribute", new Object[]{objectName, attributeName}, new
String[]{ObjectName.class.getName(), String.class.getName()});
     }
@@ -511,6 +515,7 @@
         invokeKernel("setAttribute", new Object[]{shortName, type, attributeName, attributeValue},
new String[]{String.class.getName(), Class.class.getName(), String.class.getName(), Object.class.getName()});
     }
 
+    @Deprecated
     public Object invoke(ObjectName objectName, String methodName) throws Exception {
         return invokeKernel("invoke", new Object[]{objectName, methodName}, new String[]{ObjectName.class.getName(),
String.class.getName()});
     }
@@ -531,6 +536,7 @@
         return invokeKernel("invoke", new Object[]{shortName, type, methodName}, new String[]{String.class.getName(),
Class.class.getName(), String.class.getName()});
     }
 
+    @Deprecated
     public Object invoke(ObjectName objectName, String methodName, Object[] args, String[]
types) throws Exception {
         return invokeKernel("invoke", new Object[]{objectName, methodName, args, types},
new String[]{ObjectName.class.getName(), String.class.getName(), Object[].class.getName(),
String[].class.getName()});
     }
@@ -563,7 +569,7 @@
 
     public boolean isLoaded(AbstractName name) {
         try {
-            return ((Boolean) invokeKernel("isLoaded", new Object[]{name}, new String[]{AbstractName.class.getName()})).booleanValue();
+            return (Boolean) invokeKernel("isLoaded", new Object[]{name}, new String[]{AbstractName.class.getName()});
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -573,7 +579,7 @@
 
     public boolean isLoaded(String shortName) {
         try {
-            return ((Boolean) invokeKernel("isLoaded", new Object[]{shortName}, new String[]{String.class.getName()})).booleanValue();
+            return (Boolean) invokeKernel("isLoaded", new Object[]{shortName}, new String[]{String.class.getName()});
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -583,7 +589,7 @@
 
     public boolean isLoaded(Class type) {
         try {
-            return ((Boolean) invokeKernel("isLoaded", new Object[]{type}, new String[]{Class.class.getName()})).booleanValue();
+            return (Boolean) invokeKernel("isLoaded", new Object[]{type}, new String[]{Class.class.getName()});
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -593,7 +599,7 @@
 
     public boolean isLoaded(String shortName, Class type) {
         try {
-            return ((Boolean) invokeKernel("isLoaded", new Object[]{shortName, type}, new
String[]{String.class.getName(), Class.class.getName()})).booleanValue();
+            return (Boolean) invokeKernel("isLoaded", new Object[]{shortName, type}, new
String[]{String.class.getName(), Class.class.getName()});
         } catch (RuntimeException e) {
             throw e;
         } catch (Exception e) {
@@ -601,6 +607,7 @@
         }
     }
 
+    @Deprecated
     public GBeanInfo getGBeanInfo(ObjectName name) throws GBeanNotFoundException {
         try {
             return (GBeanInfo) invokeKernel("getGBeanInfo", new Object[] {name}, new String[]
{ObjectName.class.getName()});
@@ -661,6 +668,8 @@
         }
     }
 
+    @Deprecated
+    @SuppressWarnings("unchecked")
     public Set<AbstractName> listGBeans(ObjectName pattern) {
         try {
             return (Set<AbstractName>) invokeKernel("listGBeans", new Object[] {pattern},
new String[] {ObjectName.class.getName()});
@@ -671,6 +680,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public Set<AbstractName> listGBeans(Set patterns) {
         try {
             return (Set<AbstractName>) invokeKernel("listGBeans", new Object[] {patterns},
new String[] {Set.class.getName()});

Modified: geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelMBeanServer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelMBeanServer.java?rev=910676&r1=910675&r2=910676&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelMBeanServer.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/jmx/KernelMBeanServer.java
Tue Feb 16 20:29:01 2010
@@ -157,7 +157,7 @@
     }
 
     public Integer getMBeanCount() {
-        return new Integer(kernel.listGBeans((AbstractNameQuery)null).size());
+        return kernel.listGBeans((AbstractNameQuery) null).size();
     }
 
     public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, ReflectionException
{
@@ -199,7 +199,7 @@
         return kernel.isLoaded(abstractName);
     }
 
-    public Set queryNames(ObjectName pattern, QueryExp query) {
+    public Set<ObjectName> queryNames(ObjectName pattern, QueryExp query) {
         // normalize the name
         if (pattern != null && pattern.getDomain().length() == 0) {
             try {
@@ -209,15 +209,14 @@
             }
         }
 
-        Set names;
+        Set<ObjectName> names;
         synchronized (this) {
-            names = new LinkedHashSet(objetNameToAbstractName.keySet());
+            names = new LinkedHashSet<ObjectName>(objetNameToAbstractName.keySet());
         }
 
         // fairly dumb implementation that iterates the list of all registered GBeans
-        Set result = new HashSet(names.size());
-        for (Iterator iterator = names.iterator(); iterator.hasNext();) {
-            ObjectName name = (ObjectName) iterator.next();
+        Set<ObjectName> result = new HashSet<ObjectName>(names.size());
+        for (ObjectName name : names) {
             if (pattern == null || pattern.apply(name)) {
                 if (query != null) {
                     query.setMBeanServer(this);
@@ -238,11 +237,10 @@
         return result;
     }
 
-    public Set queryMBeans(ObjectName pattern, QueryExp query) {
-        Set names = queryNames(pattern, query);
-        Set objectInstances = new HashSet(names.size());
-        for (Iterator iterator = names.iterator(); iterator.hasNext();) {
-            ObjectName name = (ObjectName) iterator.next();
+    public Set<ObjectInstance> queryMBeans(ObjectName pattern, QueryExp query) {
+        Set<ObjectName> names = queryNames(pattern, query);
+        Set<ObjectInstance> objectInstances = new HashSet<ObjectInstance>(names.size());
+        for (ObjectName name : names) {
             try {
                 objectInstances.add(getObjectInstance(name));
             } catch (InstanceNotFoundException e) {
@@ -293,13 +291,14 @@
     }
 
     public String[] getDomains() {
-        Set domains = new HashSet();
-        Set names = kernel.listGBeans((AbstractNameQuery)null);
-        for (Iterator iterator = names.iterator(); iterator.hasNext();) {
-            ObjectName objectName = (ObjectName) iterator.next();
-            domains.add(objectName.getDomain());
-        }
-        return (String[]) domains.toArray(new String[domains.size()]);
+        throw new SecurityException("Operation not allowed");
+//        Set<String> domains = new HashSet<String>();
+//        Set<AbstractName> names = kernel.listGBeans((AbstractNameQuery)null);
+//        for (Iterator iterator = names.iterator(); iterator.hasNext();) {
+//            ObjectName objectName = (ObjectName) iterator.next();
+//            domains.add(objectName.getDomain());
+//        }
+//        return domains.toArray(new String[domains.size()]);
     }
 
     public ObjectInstance getObjectInstance(ObjectName objectName) throws InstanceNotFoundException
{
@@ -398,14 +397,17 @@
         throw new SecurityException("Operation not allowed");
     }
 
+    @Deprecated
     public ObjectInputStream deserialize(String s, ObjectName objectName, byte[] bytes) throws
InstanceNotFoundException, OperationsException, ReflectionException {
         throw new SecurityException("Operation not allowed");
     }
 
+    @Deprecated
     public ObjectInputStream deserialize(String s, byte[] bytes) throws OperationsException,
ReflectionException {
         throw new SecurityException("Operation not allowed");
     }
 
+    @Deprecated
     public ObjectInputStream deserialize(ObjectName objectName, byte[] bytes) throws InstanceNotFoundException,
OperationsException {
         throw new SecurityException("Operation not allowed");
     }



Mime
View raw message