felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r773517 - in /felix/trunk/karaf/gshell/gshell-features/src/main: java/org/apache/felix/karaf/gshell/features/management/ resources/META-INF/spring/
Date Mon, 11 May 2009 10:01:22 GMT
Author: gnodet
Date: Mon May 11 10:01:21 2009
New Revision: 773517

URL: http://svn.apache.org/viewvc?rev=773517&view=rev
Log:
FELIX-1132: remove dependency from gshell-features on spring jmx

Added:
    felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeatureMBean.java
    felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistryMBean.java
    felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepositoryMBean.java
Modified:
    felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeature.java
    felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
    felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepository.java
    felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagementAgent.java
    felix/trunk/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml

Modified: felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeature.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeature.java?rev=773517&r1=773516&r2=773517&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeature.java
(original)
+++ felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeature.java
Mon May 11 10:01:21 2009
@@ -20,15 +20,11 @@
 
 import org.apache.felix.karaf.gshell.features.Feature;
 import org.apache.felix.karaf.gshell.features.FeaturesService;
-import org.springframework.jmx.export.annotation.ManagedAttribute;
-import org.springframework.jmx.export.annotation.ManagedOperation;
-import org.springframework.jmx.export.annotation.ManagedResource;
 
 /**
  * Managed Repository MBean
  */
-@ManagedResource(description = "Feature")
-public class ManagedFeature {
+public class ManagedFeature implements ManagedFeatureMBean {
     private Feature feature;
     private FeaturesService featuresService;
     private String id;
@@ -39,40 +35,33 @@
         this.featuresService = featuresService;
     }
 
-    @ManagedAttribute
     public String getId() {
         return id;    
     }
 
-    @ManagedAttribute
     public String getName() {
         return feature.getName();
     }
 
-    @ManagedAttribute
     public String getVersion() {
         return feature.getVersion();
     }
 
-    @ManagedAttribute
     public List<Feature> getDependencies() {
         return feature.getDependencies();
     }
 
-    @ManagedAttribute
     public List<String> getBundles() {
         return feature.getBundles();
     }
 
-    @ManagedOperation
-    public void uninstallFeature() throws Exception {
-        featuresService.uninstallFeature(feature.getName(), feature.getVersion());
-    }
-
-    @ManagedOperation
     public void installFeature() throws Exception {
         featuresService.installFeature(feature.getName(), feature.getVersion());
     }
 
+    public void uninstallFeature() throws Exception {
+        featuresService.uninstallFeature(feature.getName(), feature.getVersion());
+    }
+
 }
 

Added: felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeatureMBean.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeatureMBean.java?rev=773517&view=auto
==============================================================================
--- felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeatureMBean.java
(added)
+++ felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeatureMBean.java
Mon May 11 10:01:21 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.karaf.gshell.features.management;
+
+import java.util.List;
+
+import org.apache.felix.karaf.gshell.features.Feature;
+
+public interface ManagedFeatureMBean {
+
+    String getId();
+
+    String getName();
+
+    String getVersion();
+
+    List<Feature> getDependencies();
+
+    List<String> getBundles();
+
+    void installFeature() throws Exception;
+
+    void uninstallFeature() throws Exception;
+
+}

Modified: felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java?rev=773517&r1=773516&r2=773517&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
(original)
+++ felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistry.java
Mon May 11 10:01:21 2009
@@ -28,16 +28,12 @@
 import org.apache.felix.karaf.gshell.features.FeaturesRegistry;
 import org.apache.felix.karaf.gshell.features.FeaturesService;
 import org.apache.felix.karaf.gshell.features.Repository;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.jmx.export.annotation.ManagedOperation;
-import org.springframework.jmx.export.annotation.ManagedResource;
 
 /**
  * The FeaturesServiceRegistry maintains the managed Features and Repositories
  * for JMX management.
  */
-@ManagedResource(description = "Features Service Registry and Management")
-public class ManagedFeaturesRegistry implements FeaturesRegistry {
+public class ManagedFeaturesRegistry implements FeaturesRegistry, ManagedFeaturesRegistryMBean
{
 
     private static final transient Log LOG = LogFactory.getLog(ManagedFeaturesRegistry.class);
 
@@ -50,17 +46,14 @@
     private FeaturesService featuresService;
     private MBeanServer mbeanServer;
 
-    @ManagedOperation
     public void installFeature(String name) throws Exception {
         featuresService.installFeature(name);
     }
 
-    @ManagedOperation
     public void installFeature(String name, String version) throws Exception {
         featuresService.installFeature(name, version);
     }
 
-    @ManagedOperation
     public void installRepository(String repositoryUri) throws Exception {
         featuresService.addRepository(new URI(repositoryUri));
     }

Added: felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistryMBean.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistryMBean.java?rev=773517&view=auto
==============================================================================
--- felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistryMBean.java
(added)
+++ felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedFeaturesRegistryMBean.java
Mon May 11 10:01:21 2009
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.karaf.gshell.features.management;
+
+public interface ManagedFeaturesRegistryMBean {
+
+    void installFeature(String name) throws Exception;
+
+    void installFeature(String name, String version) throws Exception;
+
+    void installRepository(String repositoryUri) throws Exception;
+
+}

Modified: felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepository.java?rev=773517&r1=773516&r2=773517&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepository.java
(original)
+++ felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepository.java
Mon May 11 10:01:21 2009
@@ -21,12 +21,9 @@
 import org.apache.felix.karaf.gshell.features.Feature;
 import org.apache.felix.karaf.gshell.features.FeaturesService;
 import org.apache.felix.karaf.gshell.features.Repository;
-import org.springframework.jmx.export.annotation.ManagedAttribute;
-import org.springframework.jmx.export.annotation.ManagedOperation;
-import org.springframework.jmx.export.annotation.ManagedResource;
 
-@ManagedResource(description = "Features Repository")
-public class ManagedRepository {
+public class ManagedRepository implements ManagedRepositoryMBean {
+
     private Repository repository;
     private FeaturesService featuresService;
 
@@ -35,22 +32,18 @@
         this.featuresService = featuresService;
     }
 
-    @ManagedAttribute
     public URI getUri() {
         return repository.getURI();
     }
 
-    @ManagedAttribute
     public URI[] getRepositories() throws Exception {
         return repository.getRepositories();
     }
 
-    @ManagedAttribute
     public Feature[] getFeatures() throws Exception {
         return repository.getFeatures();
     }
 
-    @ManagedOperation
     public void removeRepository() throws Exception {
         featuresService.removeRepository(repository.getURI());
     }

Added: felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepositoryMBean.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepositoryMBean.java?rev=773517&view=auto
==============================================================================
--- felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepositoryMBean.java
(added)
+++ felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagedRepositoryMBean.java
Mon May 11 10:01:21 2009
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.karaf.gshell.features.management;
+
+import java.net.URI;
+
+import org.apache.felix.karaf.gshell.features.Feature;
+
+public interface ManagedRepositoryMBean {
+
+    URI getUri();
+
+    URI[] getRepositories() throws Exception;
+
+    Feature[] getFeatures() throws Exception;
+
+    void removeRepository() throws Exception;
+
+}

Modified: felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagementAgent.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagementAgent.java?rev=773517&r1=773516&r2=773517&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagementAgent.java
(original)
+++ felix/trunk/karaf/gshell/gshell-features/src/main/java/org/apache/felix/karaf/gshell/features/management/ManagementAgent.java
Mon May 11 10:01:21 2009
@@ -25,30 +25,21 @@
 import javax.management.NotCompliantMBeanException;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-import javax.management.modelmbean.InvalidTargetObjectTypeException;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.RequiredModelMBean;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource;
-import org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler;
 
 /**
  * Management Agent that registers MBeans with JMX MBeanServer.
  */
-public class ManagementAgent implements DisposableBean {
+public class ManagementAgent {
 
     private static final transient Log LOG = LogFactory.getLog(ManagementAgent.class);
 
     private MBeanServer mbeanServer;
-    private MetadataMBeanInfoAssembler assembler;
     private Set<ObjectName> mbeans = new HashSet<ObjectName>();
 
     public ManagementAgent() {
-        assembler = new MetadataMBeanInfoAssembler();
-        assembler.setAttributeSource(new AnnotationJmxAttributeSource());
     }
 
     public MBeanServer getMbeanServer() {
@@ -85,6 +76,7 @@
     }
 
     public void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException
{
+        /*
         try {
             registerMBeanWithServer(obj, name, forceRegistration);
         } catch (NotCompliantMBeanException e) {
@@ -100,6 +92,8 @@
             }
             registerMBeanWithServer(mbean, name, forceRegistration);
         }
+        */
+        registerMBeanWithServer(obj, name, forceRegistration);
     }
 
     public synchronized void unregister(ObjectName name) throws JMException {

Modified: felix/trunk/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml?rev=773517&r1=773516&r2=773517&view=diff
==============================================================================
--- felix/trunk/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml
(original)
+++ felix/trunk/karaf/gshell/gshell-features/src/main/resources/META-INF/spring/gshell-features.xml
Mon May 11 10:01:21 2009
@@ -39,7 +39,14 @@
   http://servicemix.apache.org/schema/servicemix-gshell/servicemix-gshell.xsd">
 
     <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
-      <property name="location" value="file:${karaf.home}/etc/org.apache.felix.karaf.features.cfg"/>
+        <property name="location" value="file:${karaf.home}/etc/org.apache.felix.karaf.features.cfg"/>
+        <property name="ignoreResourceNotFound" value="true"/>
+        <property name="properties">
+            <props>
+                <prop key="featuresRepositories"></prop>
+                <prop key="featuresBoot"></prop>
+            </props>
+        </property>
     </bean>
 
     <gshell:command-bundle>
@@ -97,38 +104,12 @@
         <property name="featuresServiceRegistry" ref="featureServiceRegistry" />
     </bean>
 
-    <bean id="namingStrategy" class="org.apache.felix.karaf.gshell.features.management.DefaultNamingStrategy">
-        <property name="jmxDomainName" value="org.apache.servicemix" />
-    </bean>
-
-    <bean id="managementAgent" class="org.apache.felix.karaf.gshell.features.management.ManagementAgent">
-        <property name="mbeanServer" ref="mbeanServer" />
-    </bean>
-
-    <bean id="featureServiceRegistry" class="org.apache.felix.karaf.gshell.features.management.ManagedFeaturesRegistry"
init-method="init">
-        <property name="managementAgent" ref="managementAgent" />
-        <property name="namingStrategy" ref="namingStrategy" />
-    </bean>
-
     <osgi:reference id="configAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"
/>
 
     <osgi:reference id="preferences" interface="org.osgi.service.prefs.PreferencesService"
cardinality="0..1" />
 
     <osgi:service ref="featuresService" interface="org.apache.felix.karaf.gshell.features.FeaturesService"
/>
 
-    <osgix:cm-properties id="cmProps" persistent-id="org.apache.felix.karaf.features">
-        <prop key="featuresRepositories"></prop>
-        <prop key="featuresBoot"></prop>
-    </osgix:cm-properties>
-
-    <!-- <ctx:property-placeholder properties-ref="cmProps" /> -->
-
-    <osgi:reference id="mbeanServer"
-                    interface="javax.management.MBeanServer"
-                    cardinality="0..1" >
-        <osgi:listener ref="featureServiceRegistry" bind-method="registerMBeanServer"
/>
-    </osgi:reference>
-
     <bean id="installFeatureCompleter" class="org.apache.felix.karaf.gshell.features.completers.AvailableFeatureCompleter">
         <property name="featuresRegistry" ref="featureServiceRegistry" />
     </bean>
@@ -141,4 +122,26 @@
         <property name="featuresRegistry" ref="featureServiceRegistry" />
     </bean>
 
+    <!-- Management -->
+
+    <bean id="namingStrategy" class="org.apache.felix.karaf.gshell.features.management.DefaultNamingStrategy">
+        <property name="jmxDomainName" value="org.apache.felix.karaf" />
+    </bean>
+
+    <bean id="managementAgent" class="org.apache.felix.karaf.gshell.features.management.ManagementAgent"
destroy-method="destroy">
+        <property name="mbeanServer" ref="mbeanServer" />
+    </bean>
+
+    <bean id="featureServiceRegistry" class="org.apache.felix.karaf.gshell.features.management.ManagedFeaturesRegistry"
init-method="init">
+        <property name="managementAgent" ref="managementAgent" />
+        <property name="namingStrategy" ref="namingStrategy" />
+    </bean>
+
+    <osgi:reference id="mbeanServer"
+                    interface="javax.management.MBeanServer"
+                    cardinality="0..1" >
+        <osgi:listener ref="featureServiceRegistry" bind-method="registerMBeanServer"/>
+    </osgi:reference>
+
+
 </beans>



Mime
View raw message