Add javadoc, generics and format code. See bug 365072.
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/Activator.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/Activator.java
index 82f3de0..4c22c36 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/Activator.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/Activator.java
@@ -76,7 +76,7 @@
protected ObjectName bundlesStateName;
protected StandardMBean framework;
protected ObjectName frameworkName;
- protected ServiceTracker mbeanServiceTracker;
+ protected ServiceTracker<MBeanServer, ?> mbeanServiceTracker;
protected ObjectName packageStateName;
protected ObjectName serviceStateName;
protected ObjectName configAdminName;
@@ -84,18 +84,11 @@
protected ObjectName provisioningServiceName;
protected ObjectName userAdminName;
protected AtomicBoolean servicesRegistered = new AtomicBoolean(false);
- protected ServiceTracker configAdminTracker;
- protected ServiceTracker permissionAdminTracker;
- protected ServiceTracker provisioningServiceTracker;
- protected ServiceTracker userAdminTracker;
+ protected ServiceTracker<ConfigurationAdmin, ?> configAdminTracker;
+ protected ServiceTracker<PermissionAdmin, ?> permissionAdminTracker;
+ protected ServiceTracker<ProvisioningService, ?> provisioningServiceTracker;
+ protected ServiceTracker<UserAdmin, ?> userAdminTracker;
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
- * )
- */
public void start(BundleContext bundleContext) throws Exception {
this.bundleContext = bundleContext;
frameworkName = new ObjectName(FrameworkMBean.OBJECTNAME);
@@ -104,22 +97,14 @@
packageStateName = new ObjectName(PackageStateMBean.OBJECTNAME);
configAdminName = new ObjectName(ConfigurationAdminMBean.OBJECTNAME);
permissionAdminName = new ObjectName(PermissionAdminMBean.OBJECTNAME);
- provisioningServiceName = new ObjectName(
- ProvisioningServiceMBean.OBJECTNAME);
+ provisioningServiceName = new ObjectName(ProvisioningServiceMBean.OBJECTNAME);
userAdminName = new ObjectName(UserAdminMBean.OBJECTNAME);
- mbeanServiceTracker = new ServiceTracker(bundleContext,
- MBeanServer.class.getCanonicalName(), new MBeanServiceTracker());
+ mbeanServiceTracker = new ServiceTracker<MBeanServer, Object>(bundleContext, MBeanServer.class.getCanonicalName(), new MBeanServiceTracker());
log.fine("Awaiting MBeanServer service registration");
mbeanServiceTracker.open();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
public void stop(BundleContext arg0) throws Exception {
mbeanServiceTracker.close();
for (MBeanServer mbeanServer : mbeanServers) {
@@ -129,6 +114,9 @@
}
/**
+ * Unregister all MBeans from a MBean server
+ *
+ * @param mbeanServer MBean Server to unregister the MBeans from
*/
protected synchronized void deregisterServices(MBeanServer mbeanServer) {
if (!servicesRegistered.get()) {
@@ -147,37 +135,29 @@
try {
mbeanServer.unregisterMBean(bundlesStateName);
} catch (InstanceNotFoundException e) {
- log.log(Level.FINEST,
- "OSGi BundleStateMBean not found on deregistration", e);
+ log.log(Level.FINEST, "OSGi BundleStateMBean not found on deregistration", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.FINE,
- "OSGi BundleStateMBean deregistration problem", e);
+ log.log(Level.FINE, "OSGi BundleStateMBean deregistration problem", e);
}
bundleState = null;
- log.fine("Deregistering services monitor with MBeanServer: "
- + mbeanServer);
+ log.fine("Deregistering services monitor with MBeanServer: " + mbeanServer);
try {
mbeanServer.unregisterMBean(serviceStateName);
} catch (InstanceNotFoundException e) {
- log.log(Level.FINEST,
- "OSGi ServiceStateMBean not found on deregistration", e);
+ log.log(Level.FINEST, "OSGi ServiceStateMBean not found on deregistration", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.FINE,
- "OSGi ServiceStateMBean deregistration problem", e);
+ log.log(Level.FINE, "OSGi ServiceStateMBean deregistration problem", e);
}
serviceState = null;
- log.fine("Deregistering packages monitor with MBeanServer: "
- + mbeanServer);
+ log.fine("Deregistering packages monitor with MBeanServer: " + mbeanServer);
try {
mbeanServer.unregisterMBean(packageStateName);
} catch (InstanceNotFoundException e) {
- log.log(Level.FINEST,
- "OSGi PackageStateMBean not found on deregistration", e);
+ log.log(Level.FINEST, "OSGi PackageStateMBean not found on deregistration", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.FINE,
- "OSGi PackageStateMBean deregistration problem", e);
+ log.log(Level.FINE, "OSGi PackageStateMBean deregistration problem", e);
}
packageState = null;
@@ -186,39 +166,31 @@
try {
mbeanServer.unregisterMBean(configAdminName);
} catch (InstanceNotFoundException e) {
- log.log(Level.FINEST,
- "OSGi ConfigAdminMBean not found on deregistration", e);
+ log.log(Level.FINEST, "OSGi ConfigAdminMBean not found on deregistration", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.FINE,
- "OSGi ConfigAdminMBean deregistration problem", e);
+ log.log(Level.FINE, "OSGi ConfigAdminMBean deregistration problem", e);
}
configAdminTracker = null;
- log.fine("Deregistering permission admin with MBeanServer: "
- + mbeanServer);
+ log.fine("Deregistering permission admin with MBeanServer: " + mbeanServer);
permissionAdminTracker.close();
try {
mbeanServer.unregisterMBean(permissionAdminName);
} catch (InstanceNotFoundException e) {
- log.log(Level.FINEST,
- "OSGi PermissionAdminMBean not found on deregistration", e);
+ log.log(Level.FINEST, "OSGi PermissionAdminMBean not found on deregistration", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.FINE,
- "OSGi PermissionAdminMBean deregistration problem", e);
+ log.log(Level.FINE, "OSGi PermissionAdminMBean deregistration problem", e);
}
permissionAdminTracker = null;
- log.fine("Deregistering provisioning service admin with MBeanServer: "
- + mbeanServer);
+ log.fine("Deregistering provisioning service admin with MBeanServer: " + mbeanServer);
provisioningServiceTracker.close();
try {
mbeanServer.unregisterMBean(provisioningServiceName);
} catch (InstanceNotFoundException e) {
- log.log(Level.FINEST,
- "OSGi ProvisioningServiceMBean not found on deregistration", e);
+ log.log(Level.FINEST, "OSGi ProvisioningServiceMBean not found on deregistration", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.FINE,
- "OSGi ProvisioningServiceMBean deregistration problem", e);
+ log.log(Level.FINE, "OSGi ProvisioningServiceMBean deregistration problem", e);
}
provisioningServiceTracker = null;
@@ -227,8 +199,7 @@
try {
mbeanServer.unregisterMBean(userAdminName);
} catch (InstanceNotFoundException e) {
- log.log(Level.FINEST,
- "OSGi UserAdminMBean not found on deregistration", e);
+ log.log(Level.FINEST, "OSGi UserAdminMBean not found on deregistration", e);
} catch (MBeanRegistrationException e) {
log.log(Level.FINE, "OSGi UserAdminMBean deregistration problem", e);
}
@@ -238,49 +209,39 @@
}
/**
+ * Register all MBeans in a MBean server
+ *
+ * @param mbeanServer MBean Server to register the MBeans in
*/
protected synchronized void registerServices(MBeanServer mbeanServer) {
- PackageAdmin admin = (PackageAdmin) bundleContext
- .getService(bundleContext
- .getServiceReference(PackageAdmin.class
- .getCanonicalName()));
- StartLevel sl = (StartLevel) bundleContext.getService(bundleContext
- .getServiceReference(StartLevel.class.getCanonicalName()));
+ PackageAdmin admin = (PackageAdmin) bundleContext.getService(bundleContext.getServiceReference(PackageAdmin.class.getCanonicalName()));
+ StartLevel sl = (StartLevel) bundleContext.getService(bundleContext.getServiceReference(StartLevel.class.getCanonicalName()));
try {
- framework = new StandardMBean(new Framework(bundleContext, admin,
- sl), FrameworkMBean.class);
+ framework = new StandardMBean(new Framework(bundleContext, admin, sl), FrameworkMBean.class);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Unable to create StandardMBean for Framework", e);
+ log.log(Level.SEVERE, "Unable to create StandardMBean for Framework", e);
return;
}
try {
- bundleState = new StandardMBean(new BundleState(bundleContext, sl,
- admin), CustomBundleStateMBean.class);
+ bundleState = new StandardMBean(new BundleState(bundleContext, sl, admin), CustomBundleStateMBean.class);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Unable to create StandardMBean for BundleState", e);
+ log.log(Level.SEVERE, "Unable to create StandardMBean for BundleState", e);
return;
}
try {
- serviceState = new StandardMBean(new ServiceState(bundleContext),
- ServiceStateMBean.class);
+ serviceState = new StandardMBean(new ServiceState(bundleContext), ServiceStateMBean.class);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Unable to create StandardMBean for ServiceState", e);
+ log.log(Level.SEVERE, "Unable to create StandardMBean for ServiceState", e);
return;
}
try {
- packageState = new StandardMBean(new PackageState(bundleContext,
- admin), PackageStateMBean.class);
+ packageState = new StandardMBean(new PackageState(bundleContext, admin), PackageStateMBean.class);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Unable to create StandardMBean for PackageState", e);
+ log.log(Level.SEVERE, "Unable to create StandardMBean for PackageState", e);
return;
}
- log.fine("Registering Framework with MBeanServer: " + mbeanServer
- + " with name: " + frameworkName);
+ log.fine("Registering Framework with MBeanServer: " + mbeanServer + " with name: " + frameworkName);
try {
mbeanServer.registerMBean(framework, frameworkName);
} catch (InstanceAlreadyExistsException e) {
@@ -303,8 +264,7 @@
log.log(Level.SEVERE, "Cannot register OSGi BundleStateMBean", e);
}
- log.fine("Registering services monitor with MBeanServer: "
- + mbeanServer + " with name: " + serviceStateName);
+ log.fine("Registering services monitor with MBeanServer: " + mbeanServer + " with name: " + serviceStateName);
try {
mbeanServer.registerMBean(serviceState, serviceStateName);
} catch (InstanceAlreadyExistsException e) {
@@ -315,8 +275,7 @@
log.log(Level.SEVERE, "Cannot register OSGi ServiceStateMBean", e);
}
- log.fine("Registering packages monitor with MBeanServer: "
- + mbeanServer + " with name: " + packageStateName);
+ log.fine("Registering packages monitor with MBeanServer: " + mbeanServer + " with name: " + packageStateName);
try {
mbeanServer.registerMBean(packageState, packageStateName);
} catch (InstanceAlreadyExistsException e) {
@@ -327,17 +286,10 @@
log.log(Level.SEVERE, "Cannot register OSGi PackageStateMBean", e);
}
- configAdminTracker = new ServiceTracker(bundleContext,
- "org.osgi.service.cm.ConfigurationAdmin",
- new ConfigAdminTracker());
- permissionAdminTracker = new ServiceTracker(bundleContext,
- "org.osgi.service.permissionadmin.PermissionAdmin",
- new PermissionAdminTracker());
- provisioningServiceTracker = new ServiceTracker(bundleContext,
- "org.osgi.service.provisioning.ProvisioningService",
- new ProvisioningServiceTracker());
- userAdminTracker = new ServiceTracker(bundleContext,
- "org.osgi.service.useradmin.UserAdmin", new UserAdminTracker());
+ configAdminTracker = new ServiceTracker<ConfigurationAdmin, Object>(bundleContext, "org.osgi.service.cm.ConfigurationAdmin", new ConfigAdminTracker());
+ permissionAdminTracker = new ServiceTracker<PermissionAdmin, Object>(bundleContext, "org.osgi.service.permissionadmin.PermissionAdmin", new PermissionAdminTracker());
+ provisioningServiceTracker = new ServiceTracker<ProvisioningService, Object>(bundleContext, "org.osgi.service.provisioning.ProvisioningService", new ProvisioningServiceTracker());
+ userAdminTracker = new ServiceTracker<UserAdmin, Object>(bundleContext, "org.osgi.service.useradmin.UserAdmin", new UserAdminTracker());
configAdminTracker.open();
permissionAdminTracker.open();
provisioningServiceTracker.open();
@@ -345,21 +297,27 @@
servicesRegistered.set(true);
}
- class MBeanServiceTracker implements ServiceTrackerCustomizer {
+ class MBeanServiceTracker implements ServiceTrackerCustomizer<MBeanServer, Object> {
- public Object addingService(ServiceReference servicereference) {
+ /*
+ * (non-Javadoc)
+ *
+ * Register all MBeans in a newly registered MBean server
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
+ */
+ public Object addingService(ServiceReference<MBeanServer> servicereference) {
try {
log.fine("Adding MBeanServer: " + servicereference);
- final MBeanServer mbeanServer = (MBeanServer) bundleContext
- .getService(servicereference);
+ final MBeanServer mbeanServer = bundleContext.getService(servicereference);
mbeanServers.add(mbeanServer);
Runnable registration = new Runnable() {
public void run() {
registerServices(mbeanServer);
}
};
- Thread registrationThread = new Thread(registration,
- "JMX Core MBean Registration");
+
+ Thread registrationThread = new Thread(registration, "JMX Core MBean Registration");
registrationThread.setDaemon(true);
registrationThread.start();
@@ -370,16 +328,21 @@
}
}
- public void modifiedService(ServiceReference servicereference,
- Object obj) {
+ public void modifiedService(ServiceReference<MBeanServer> servicereference, Object obj) {
// no op
}
- public void removedService(ServiceReference servicereference, Object obj) {
+ /*
+ * (non-Javadoc)
+ *
+ * Unregister all MBeans from a MBean server when it gets unregistered
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
+ */
+ public void removedService(ServiceReference<MBeanServer> servicereference, Object obj) {
try {
log.fine("Removing MBeanServer: " + servicereference);
- final MBeanServer mbeanServer = (MBeanServer) bundleContext
- .getService(servicereference);
+ final MBeanServer mbeanServer = bundleContext.getService(servicereference);
mbeanServers.remove(mbeanServer);
Runnable deregister = new Runnable() {
public void run() {
@@ -387,8 +350,7 @@
}
};
- Thread deregisterThread = new Thread(deregister,
- "JMX Core MBean Deregistration");
+ Thread deregisterThread = new Thread(deregister, "JMX Core MBean Deregistration");
deregisterThread.setDaemon(true);
deregisterThread.start();
@@ -398,278 +360,230 @@
}
}
- class ConfigAdminTracker implements ServiceTrackerCustomizer {
+ class ConfigAdminTracker implements ServiceTrackerCustomizer<ConfigurationAdmin, Object> {
StandardMBean manager;
/*
* (non-Javadoc)
*
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.
- * osgi.framework.ServiceReference)
+ * Register a MBean for the ConfigurationAdmin service in all MBean servers
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
*/
- public Object addingService(ServiceReference reference) {
+ public Object addingService(ServiceReference<ConfigurationAdmin> reference) {
ConfigurationAdmin admin;
try {
- admin = (ConfigurationAdmin) bundleContext
- .getService(reference);
+ admin = bundleContext .getService(reference);
} catch (ClassCastException e) {
- log.log(Level.SEVERE,
- "Incompatible class version for the Configuration Admin Manager", e);
+ log.log(Level.SEVERE, "Incompatible class version for the Configuration Admin Manager", e);
return bundleContext.getService(reference);
}
try {
- manager = new StandardMBean(new ConfigAdminManager(admin),
- ConfigurationAdminMBean.class);
+ manager = new StandardMBean(new ConfigAdminManager(admin), ConfigurationAdminMBean.class);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Unable to create Configuration Admin Manager", e);
+ log.log(Level.SEVERE, "Unable to create Configuration Admin Manager", e);
return admin;
}
+
for (MBeanServer mbeanServer : mbeanServers) {
- log.fine("Registering configuration admin with MBeanServer: "
- + mbeanServer + " with name: " + configAdminName);
+ log.fine("Registering configuration admin with MBeanServer: " + mbeanServer + " with name: " + configAdminName);
try {
mbeanServer.registerMBean(manager, configAdminName);
} catch (InstanceAlreadyExistsException e) {
- log.log(Level.FINE,
- "Cannot register Configuration Manager MBean", e);
+ log.log(Level.FINE, "Cannot register Configuration Manager MBean", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.SEVERE,
- "Cannot register Configuration Manager MBean", e);
+ log.log(Level.SEVERE, "Cannot register Configuration Manager MBean", e);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Cannot register Configuration Manager MBean", e);
+ log.log(Level.SEVERE, "Cannot register Configuration Manager MBean", e);
}
}
+
return admin;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org
- * .osgi.framework.ServiceReference, java.lang.Object)
- */
- public void modifiedService(ServiceReference reference, Object service) {
+ public void modifiedService(ServiceReference<ConfigurationAdmin> reference, Object service) {
}
/*
* (non-Javadoc)
*
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org
- * .osgi.framework.ServiceReference, java.lang.Object)
+ * Unregister the MBean for the ConfigurationAdmin service from all MBean servers
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
*/
- public void removedService(ServiceReference reference, Object service) {
+ public void removedService(ServiceReference<ConfigurationAdmin> reference, Object service) {
for (MBeanServer mbeanServer : mbeanServers) {
- log.fine("deregistering configuration admin from: "
- + mbeanServer + " with name: " + configAdminName);
+ log.fine("deregistering configuration admin from: " + mbeanServer + " with name: " + configAdminName);
try {
mbeanServer.unregisterMBean(configAdminName);
} catch (InstanceNotFoundException e) {
log.fine("Configuration Manager MBean was never registered");
} catch (MBeanRegistrationException e) {
- log.log(Level.SEVERE,
- "Cannot deregister Configuration Manager MBean", e);
+ log.log(Level.SEVERE, "Cannot deregister Configuration Manager MBean", e);
}
}
}
}
- class PermissionAdminTracker implements ServiceTrackerCustomizer {
+ class PermissionAdminTracker implements ServiceTrackerCustomizer<PermissionAdmin, Object> {
StandardMBean manager;
/*
* (non-Javadoc)
*
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.
- * osgi.framework.ServiceReference)
+ * Register a MBean for the PermissionAdmin service in all MBean servers
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
*/
- public Object addingService(ServiceReference reference) {
+ public Object addingService(ServiceReference<PermissionAdmin> reference) {
PermissionAdmin admin;
try {
- admin = (PermissionAdmin) bundleContext.getService(reference);
+ admin = bundleContext.getService(reference);
} catch (ClassCastException e) {
- log.log(Level.SEVERE,
- "Incompatible class version for the Permission Admin Manager", e);
+ log.log(Level.SEVERE, "Incompatible class version for the Permission Admin Manager", e);
return bundleContext.getService(reference);
}
try {
- manager = new StandardMBean(new PermissionManager(admin),
- PermissionAdminMBean.class);
+ manager = new StandardMBean(new PermissionManager(admin), PermissionAdminMBean.class);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Unable to create Permission Admin Manager", e);
+ log.log(Level.SEVERE, "Unable to create Permission Admin Manager", e);
return admin;
}
for (MBeanServer mbeanServer : mbeanServers) {
- log.fine("Registering permission admin with MBeanServer: "
- + mbeanServer + " with name: " + permissionAdminName);
+ log.fine("Registering permission admin with MBeanServer: " + mbeanServer + " with name: " + permissionAdminName);
try {
mbeanServer.registerMBean(manager, permissionAdminName);
} catch (InstanceAlreadyExistsException e) {
- log.log(Level.FINE,
- "Cannot register Permission Manager MBean", e);
+ log.log(Level.FINE, "Cannot register Permission Manager MBean", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.SEVERE,
- "Cannot register Permission Manager MBean", e);
+ log.log(Level.SEVERE, "Cannot register Permission Manager MBean", e);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Cannot register Permission Manager MBean", e);
+ log.log(Level.SEVERE, "Cannot register Permission Manager MBean", e);
}
}
return admin;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org
- * .osgi.framework.ServiceReference, java.lang.Object)
- */
- public void modifiedService(ServiceReference reference, Object service) {
+ public void modifiedService(ServiceReference<PermissionAdmin> reference, Object service) {
}
/*
* (non-Javadoc)
*
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org
- * .osgi.framework.ServiceReference, java.lang.Object)
+ * Unregister the MBean for the PermissionAdmin service from all MBean servers
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
*/
- public void removedService(ServiceReference reference, Object service) {
+ public void removedService(ServiceReference<PermissionAdmin> reference, Object service) {
for (MBeanServer mbeanServer : mbeanServers) {
- log.fine("deregistering permission admin with MBeanServer: "
- + mbeanServer + " with name: " + permissionAdminName);
+ log.fine("deregistering permission admin with MBeanServer: " + mbeanServer + " with name: " + permissionAdminName);
try {
mbeanServer.unregisterMBean(permissionAdminName);
} catch (InstanceNotFoundException e) {
log.fine("Permission Manager MBean was never registered");
} catch (MBeanRegistrationException e) {
- log.log(Level.SEVERE,
- "Cannot deregister Permission Manager MBean", e);
+ log.log(Level.SEVERE, "Cannot deregister Permission Manager MBean", e);
}
}
}
}
- class ProvisioningServiceTracker implements ServiceTrackerCustomizer {
+ class ProvisioningServiceTracker implements ServiceTrackerCustomizer<ProvisioningService, Object> {
StandardMBean provisioning;
/*
* (non-Javadoc)
*
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.
- * osgi.framework.ServiceReference)
+ * Register a MBean for the Provisioning service in all MBean servers
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
*/
- public Object addingService(ServiceReference reference) {
+ public Object addingService(ServiceReference<ProvisioningService> reference) {
ProvisioningService service;
+
try {
- service = (ProvisioningService) bundleContext
- .getService(reference);
+ service = bundleContext .getService(reference);
} catch (ClassCastException e) {
- log.log(Level.SEVERE,
- "Incompatible class version for the Provisioning service", e);
+ log.log(Level.SEVERE, "Incompatible class version for the Provisioning service", e);
return bundleContext.getService(reference);
}
+
try {
- provisioning = new StandardMBean(new Provisioning(service),
- ProvisioningServiceMBean.class);
+ provisioning = new StandardMBean(new Provisioning(service), ProvisioningServiceMBean.class);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Unable to create Provisioning Service Manager", e);
+ log.log(Level.SEVERE, "Unable to create Provisioning Service Manager", e);
return service;
}
+
for (MBeanServer mbeanServer : mbeanServers) {
- log.fine("Registering provisioning service with MBeanServer: "
- + mbeanServer + " with name: "
- + provisioningServiceName);
+ log.fine("Registering provisioning service with MBeanServer: " + mbeanServer + " with name: " + provisioningServiceName);
try {
- mbeanServer.registerMBean(provisioning,
- provisioningServiceName);
+ mbeanServer.registerMBean(provisioning, provisioningServiceName);
} catch (InstanceAlreadyExistsException e) {
- log.log(Level.FINE,
- "Cannot register Provisioning Service MBean", e);
+ log.log(Level.FINE, "Cannot register Provisioning Service MBean", e);
} catch (MBeanRegistrationException e) {
- log.log(Level.SEVERE,
- "Cannot register Provisioning Service MBean", e);
+ log.log(Level.SEVERE, "Cannot register Provisioning Service MBean", e);
} catch (NotCompliantMBeanException e) {
- log.log(Level.SEVERE,
- "Cannot register Provisioning Service MBean", e);
+ log.log(Level.SEVERE, "Cannot register Provisioning Service MBean", e);
}
}
return service;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org
- * .osgi.framework.ServiceReference, java.lang.Object)
- */
- public void modifiedService(ServiceReference reference, Object service) {
+ public void modifiedService(ServiceReference<ProvisioningService> reference, Object service) {
}
/*
* (non-Javadoc)
*
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org
- * .osgi.framework.ServiceReference, java.lang.Object)
+ * Unregister the MBean for the Provisioning service from all MBean servers
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
*/
- public void removedService(ServiceReference reference, Object service) {
+ public void removedService(ServiceReference<ProvisioningService> reference, Object service) {
for (MBeanServer mbeanServer : mbeanServers) {
- log.fine("deregistering provisioning service with MBeanServer: "
- + mbeanServer + " with name: " + provisioningServiceName);
+ log.fine("deregistering provisioning service with MBeanServer: " + mbeanServer + " with name: " + provisioningServiceName);
try {
mbeanServer.unregisterMBean(provisioningServiceName);
} catch (InstanceNotFoundException e) {
log.fine("Provisioning Service MBean was never registered");
} catch (MBeanRegistrationException e) {
- log.log(Level.SEVERE,
- "Cannot deregister Provisioning Service MBean", e);
+ log.log(Level.SEVERE, "Cannot deregister Provisioning Service MBean", e);
}
}
}
}
- class UserAdminTracker implements ServiceTrackerCustomizer {
+ class UserAdminTracker implements ServiceTrackerCustomizer<UserAdmin, Object> {
StandardMBean manager;
/*
* (non-Javadoc)
*
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.
- * osgi.framework.ServiceReference)
+ * Register a MBean for the UserAdmin service in all MBean servers
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
*/
- public Object addingService(ServiceReference reference) {
+ public Object addingService(ServiceReference<UserAdmin> reference) {
UserAdmin admin;
try {
- admin = (UserAdmin) bundleContext.getService(reference);
+ admin = bundleContext.getService(reference);
} catch (ClassCastException e) {
- log.log(Level.SEVERE,
- "Incompatible class version for the User Admin manager", e);
+ log.log(Level.SEVERE, "Incompatible class version for the User Admin manager", e);
return bundleContext.getService(reference);
}
+
try {
- manager = new StandardMBean(new UserManager(admin),
- UserAdminMBean.class);
+ manager = new StandardMBean(new UserManager(admin), UserAdminMBean.class);
} catch (NotCompliantMBeanException e1) {
log.log(Level.SEVERE, "Unable to create User Admin Manager");
return admin;
}
+
for (MBeanServer mbeanServer : mbeanServers) {
- log.fine("Registering user admin with MBeanServer: "
- + mbeanServer + " with name: " + userAdminName);
+ log.fine("Registering user admin with MBeanServer: " + mbeanServer + " with name: " + userAdminName);
try {
mbeanServer.registerMBean(manager, userAdminName);
} catch (InstanceAlreadyExistsException e) {
@@ -683,34 +597,25 @@
return admin;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org
- * .osgi.framework.ServiceReference, java.lang.Object)
- */
- public void modifiedService(ServiceReference reference, Object service) {
+ public void modifiedService(ServiceReference<UserAdmin> reference, Object service) {
}
/*
* (non-Javadoc)
*
- * @see
- * org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org
- * .osgi.framework.ServiceReference, java.lang.Object)
+ * Unregister the MBean for the UserAdmin service from all MBean servers
+ *
+ * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
*/
- public void removedService(ServiceReference reference, Object service) {
+ public void removedService(ServiceReference<UserAdmin> reference, Object service) {
for (MBeanServer mbeanServer : mbeanServers) {
- log.fine("Deregistering user admin with MBeanServer: "
- + mbeanServer + " with name: " + userAdminName);
+ log.fine("Deregistering user admin with MBeanServer: " + mbeanServer + " with name: " + userAdminName);
try {
mbeanServer.unregisterMBean(userAdminName);
} catch (InstanceNotFoundException e) {
log.fine("User Manager MBean was never registered");
} catch (MBeanRegistrationException e) {
- log.log(Level.SEVERE,
- "Cannot deregister User Manager MBean", e);
+ log.log(Level.SEVERE, "Cannot deregister User Manager MBean", e);
}
}
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/Monitor.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/Monitor.java
index 8da3874..7ab08ed 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/Monitor.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/Monitor.java
@@ -26,17 +26,29 @@
abstract public class Monitor extends NotificationBroadcasterSupport implements
MBeanRegistration {
+ /**
+ * {@inheritDoc}
+ */
public void postDeregister() {
}
+ /**
+ * {@inheritDoc}
+ */
public void postRegister(Boolean registrationDone) {
addListener();
}
+ /**
+ * {@inheritDoc}
+ */
public void preDeregister() throws Exception {
removeListener();
}
+ /**
+ * {@inheritDoc}
+ */
public ObjectName preRegister(MBeanServer server, ObjectName name)
throws Exception {
objectName = name;
@@ -44,8 +56,14 @@
return name;
}
+ /**
+ * Add a listener for the monitored object
+ */
abstract protected void addListener();
+ /**
+ * Remove the listener for the monitored object
+ */
abstract protected void removeListener();
protected ObjectName objectName;
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/cm/ConfigAdminManager.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/cm/ConfigAdminManager.java
index 06c3330..1bf9ab3 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/cm/ConfigAdminManager.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/cm/ConfigAdminManager.java
@@ -37,22 +37,16 @@
public class ConfigAdminManager implements ConfigurationAdminMBean {
protected ConfigurationAdmin admin;
- private static final Logger log = Logger.getLogger(ConfigAdminManager.class
- .getCanonicalName());
+ private static final Logger log = Logger.getLogger(ConfigAdminManager.class.getCanonicalName());
public ConfigAdminManager(ConfigurationAdmin admin) {
this.admin = admin;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#createFactoryConfiguration
- * (java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public String createFactoryConfiguration(String factoryPid)
- throws IOException {
+ public String createFactoryConfiguration(String factoryPid) throws IOException {
if (factoryPid == null) {
throw new IOException("Factory PID must not be null");
}
@@ -61,16 +55,10 @@
return c.getPid();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#createFactoryConfiguration
- * (java.lang.String, java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public String createFactoryConfigurationForLocation(String factoryPid,
- String location)
- throws IOException {
+ public String createFactoryConfigurationForLocation(String factoryPid, String location) throws IOException {
if (factoryPid == null) {
throw new IOException("Factory PID must not be null");
}
@@ -79,11 +67,8 @@
return c.getPid();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#delete(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public void delete(String pid) throws IOException {
if (pid == null) {
@@ -92,27 +77,18 @@
admin.getConfiguration(pid, null).delete();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#delete(java.lang.String,
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public void deleteForLocation(String pid, String location)
- throws IOException {
+ public void deleteForLocation(String pid, String location) throws IOException {
if (pid == null) {
throw new IOException("PID must not be null");
}
admin.getConfiguration(pid, location).delete();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#deleteConfigurations(
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public void deleteConfigurations(String filter) throws IOException {
Configuration[] confs;
@@ -129,12 +105,8 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#getBundleLocation(java
- * .lang.String)
+ /**
+ * {@inheritDoc}
*/
public String getBundleLocation(String pid) throws IOException {
if (pid == null) {
@@ -143,12 +115,8 @@
return admin.getConfiguration(pid, null).getBundleLocation();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#getFactoryPid(java.lang
- * .String)
+ /**
+ * {@inheritDoc}
*/
public String getFactoryPid(String pid) throws IOException {
if (pid == null) {
@@ -157,12 +125,8 @@
return admin.getConfiguration(pid, null).getFactoryPid();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#getFactoryPid(java.lang
- * .String, java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public String getFactoryPidForLocation(String pid, String location)
throws IOException {
@@ -172,47 +136,31 @@
return admin.getConfiguration(pid, location).getFactoryPid();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#getProperties(java.lang
- * .String)
+ /**
+ * {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
public TabularData getProperties(String pid) throws IOException {
if (pid == null) {
throw new IOException("PID must not be null");
}
- Dictionary properties = admin.getConfiguration(pid, null)
- .getProperties();
+ Dictionary properties = admin.getConfiguration(pid, null).getProperties();
return properties == null ? null : tableFrom(properties);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#getProperties(java.lang
- * .String, java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
public TabularData getPropertiesForLocation(String pid, String location)
throws IOException {
if (pid == null) {
throw new IOException("PID must not be null");
}
- Dictionary properties = admin.getConfiguration(pid, location)
- .getProperties();
+ Dictionary properties = admin.getConfiguration(pid, location).getProperties();
return properties == null ? null : tableFrom(properties);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#listConfigurations(java
- * .lang.String)
+ /**
+ * {@inheritDoc}
*/
public String[][] getConfigurations(String filter) throws IOException {
ArrayList<String[]> pids = new ArrayList<String[]>();
@@ -225,34 +173,24 @@
}
if (configurations != null) {
for (Configuration config : configurations) {
- pids.add(new String[] { config.getPid(),
- config.getBundleLocation() });
+ pids.add(new String[] { config.getPid(), config.getBundleLocation() });
}
}
return pids.toArray(new String[pids.size()][]);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#setBundleLocation(java
- * .lang.String, java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public void setBundleLocation(String pid, String location)
- throws IOException {
+ public void setBundleLocation(String pid, String location) throws IOException {
if (pid == null) {
throw new IOException("PID must not be null");
}
admin.getConfiguration(pid).setBundleLocation(location);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#update(java.lang.String,
- * javax.management.openmbean.TabularData)
+ /**
+ * {@inheritDoc}
*/
public void update(String pid, TabularData table) throws IOException {
if (pid == null) {
@@ -261,15 +199,10 @@
admin.getConfiguration(pid, null).update(propertiesFrom(table));
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ConfigAdminManagerMBean#update(java.lang.String,
- * java.lang.String, javax.management.openmbean.TabularData)
+ /**
+ * {@inheritDoc}
*/
- public void updateForLocation(String pid, String location, TabularData table)
- throws IOException {
+ public void updateForLocation(String pid, String location, TabularData table) throws IOException {
if (pid == null) {
throw new IOException("PID must not be null");
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/codec/OSGiProperties.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/codec/OSGiProperties.java
index 85676d8..2972005 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/codec/OSGiProperties.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/codec/OSGiProperties.java
@@ -112,7 +112,7 @@
* @param ref
* @return the tabular data representing the service reference properties
*/
- public static TabularData tableFrom(ServiceReference ref) {
+ public static TabularData tableFrom(ServiceReference<?> ref) {
Hashtable<String, Object> props = new Hashtable<String, Object>();
for (String key : ref.getPropertyKeys()) {
props.put(key, ref.getProperty(key));
@@ -133,7 +133,7 @@
if (clazz.isArray()) {
return encodeArray(key, value, clazz.getComponentType());
} else if (clazz.equals(Vector.class)) {
- return encodeVector(key, (Vector) value);
+ return encodeVector(key, (Vector<?>) value);
}
return propertyData(key, value.toString(), typeOf(clazz));
}
@@ -150,8 +150,7 @@
return props;
}
for (CompositeData data : (Collection<CompositeData>) table.values()) {
- props.put(data.get(KEY), parse((String) data.get(VALUE),
- (String) data.get(TYPE)));
+ props.put(data.get(KEY), parse((String) data.get(VALUE), (String) data.get(TYPE)));
}
return props;
@@ -165,8 +164,7 @@
* @param componentClazz
* @return the composite data representation
*/
- protected static CompositeData encodeArray(String key, Object value,
- Class<?> componentClazz) {
+ protected static CompositeData encodeArray(String key, Object value, Class<?> componentClazz) {
String type = typeOf(componentClazz);
StringBuffer buf = new StringBuffer();
if (Integer.TYPE.equals(componentClazz)) {
@@ -329,8 +327,7 @@
* @param type
* @return the composite data representation of the key/value pair
*/
- protected static CompositeData propertyData(String key, String value,
- String type) {
+ protected static CompositeData propertyData(String key, String value, String type) {
Object[] itemValues = new Object[PROPERTIES.length];
itemValues[0] = key;
itemValues[1] = value;
@@ -377,16 +374,13 @@
*/
protected static Object parseArray(String value, StringTokenizer tokens) {
if (!tokens.hasMoreTokens()) {
- throw new IllegalArgumentException(
- "Expecting <of> token in Array type");
+ throw new IllegalArgumentException("Expecting <of> token in Array type");
}
if (!"of".equals(tokens.nextToken())) {
- throw new IllegalArgumentException(
- "Expecting <of> token in Array type");
+ throw new IllegalArgumentException("Expecting <of> token in Array type");
}
if (!tokens.hasMoreTokens()) {
- throw new IllegalArgumentException(
- "Expecting <primitive>|<scalar> token in Array type");
+ throw new IllegalArgumentException("Expecting <primitive>|<scalar> token in Array type");
}
String type = tokens.nextToken();
if (SCALAR_TYPES.contains(type)) {
@@ -394,9 +388,7 @@
} else if (PRIMITIVE_TYPES.contains(type)) {
return parsePrimitiveArray(value, type);
} else {
- throw new IllegalArgumentException(
- "Expecting <scalar>|<primitive> type token in Array type: "
- + type);
+ throw new IllegalArgumentException("Expecting <scalar>|<primitive> type token in Array type: " + type);
}
}
@@ -534,23 +526,19 @@
*/
protected static Object parseVector(String value, StringTokenizer tokens) {
if (!tokens.hasMoreTokens()) {
- throw new IllegalArgumentException(
- "Expecting <of> token in Vector type");
+ throw new IllegalArgumentException("Expecting <of> token in Vector type");
}
if (!tokens.nextElement().equals("of")) {
- throw new IllegalArgumentException(
- "Expecting <of> token in Vector type");
+ throw new IllegalArgumentException("Expecting <of> token in Vector type");
}
if (!tokens.hasMoreTokens()) {
- throw new IllegalArgumentException(
- "Expecting <scalar> token in Vector type");
+ throw new IllegalArgumentException("Expecting <scalar> token in Vector type");
}
String type = tokens.nextToken();
StringTokenizer values = new StringTokenizer(value, ",");
Vector<Object> vector = new Vector<Object>();
if (!SCALAR_TYPES.contains(type)) {
- throw new IllegalArgumentException(
- "Expecting <scalar> type token in Vector type: " + type);
+ throw new IllegalArgumentException("Expecting <scalar> type token in Vector type: " + type);
}
while (values.hasMoreTokens()) {
vector.add(parseScalar(values.nextToken().trim(), type));
@@ -559,11 +547,11 @@
}
/**
- * Construct the scalar valre represented by the string
+ * Construct the scalar value represented by the string
*
* @param value
* @param type
- * @return the scalar valre represented by the string
+ * @return the scalar value represented by the string
*/
@SuppressWarnings("boxing")
protected static Object parseScalar(String value, String type) {
@@ -602,11 +590,9 @@
private static TabularType createPropertyTableType() {
try {
- return new TabularType("Properties", "The table of credentials",
- PROPERTY, new String[] { KEY });
+ return new TabularType("Properties", "The table of credentials", PROPERTY, new String[] { KEY });
} catch (OpenDataException e) {
- throw new IllegalStateException(
- "Cannot form services table open data", e);
+ throw new IllegalStateException("Cannot form services table open data", e);
}
}
@@ -624,8 +610,7 @@
itemDescriptions[2] = "The type of the value";
try {
- return new CompositeType("Property", description, itemNames,
- itemDescriptions, itemTypes);
+ return new CompositeType("Property", description, itemNames, itemDescriptions, itemTypes);
} catch (OpenDataException e) {
throw new IllegalStateException("Cannot form property open data", e);
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/codec/Util.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/codec/Util.java
index 22cf853..3153017 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/codec/Util.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/codec/Util.java
@@ -88,16 +88,14 @@
if (importing != null) {
for (Bundle bundle : importing) {
if (bundle == b) {
- dependencies.add(pkg.getExportingBundle()
- .getBundleId());
+ dependencies.add(pkg.getExportingBundle().getBundleId());
break;
}
}
}
}
}
- return longArrayFrom(dependencies
- .toArray(new Long[dependencies.size()]));
+ return longArrayFrom(dependencies.toArray(new Long[dependencies.size()]));
}
/**
@@ -108,8 +106,7 @@
* @param admin
* @return the the bundle ids of the bundles requireing the given bundles
*/
- public static long[] getBundlesRequiring(Bundle b, BundleContext bc,
- PackageAdmin admin) {
+ public static long[] getBundlesRequiring(Bundle b, BundleContext bc, PackageAdmin admin) {
Bundle[] all = bc.getBundles();
ArrayList<Long> requiring = new ArrayList<Long>();
for (Bundle anAll : all) {
@@ -137,8 +134,7 @@
* @param admin
* @return the string representation of the exported packages of the bundle
*/
- public static String[] getBundleExportedPackages(Bundle b,
- PackageAdmin admin) {
+ public static String[] getBundleExportedPackages(Bundle b, PackageAdmin admin) {
ArrayList<String> packages = new ArrayList<String>();
ExportedPackage[] exportedPackages = admin.getExportedPackages(b);
if (exportedPackages == null) {
@@ -193,8 +189,7 @@
* @param admin
* @return the string representation of the packages imported by a bundle
*/
- public static String[] getBundleImportedPackages(Bundle b,
- BundleContext bc, PackageAdmin admin) {
+ public static String[] getBundleImportedPackages(Bundle b, BundleContext bc, PackageAdmin admin) {
ArrayList<String> imported = new ArrayList<String>();
Bundle[] allBundles = bc.getBundles();
for (Bundle bundle : allBundles) {
@@ -256,14 +251,12 @@
* @param admin
* @return the required bundle of a bundle
*/
- public static RequiredBundle getRequiredBundle(Bundle bundle,
- BundleContext bc, PackageAdmin admin) {
+ public static RequiredBundle getRequiredBundle(Bundle bundle, BundleContext bc, PackageAdmin admin) {
Bundle[] all = bc.getBundles();
for (Bundle anAll : all) {
String symbolicName = anAll.getSymbolicName();
if (symbolicName != null) {
- RequiredBundle[] requiring = admin
- .getRequiredBundles(symbolicName);
+ RequiredBundle[] requiring = admin.getRequiredBundles(symbolicName);
if (requiring == null) {
continue;
}
@@ -295,10 +288,8 @@
* @param sl
* @return true if the bundle has been persitently started
*/
- public static boolean isBundlePersistentlyStarted(Bundle bundle,
- StartLevel sl) {
- return bundle.getBundleId() == 0
- || sl.isBundlePersistentlyStarted(bundle);
+ public static boolean isBundlePersistentlyStarted(Bundle bundle, StartLevel sl) {
+ return bundle.getBundleId() == 0 || sl.isBundlePersistentlyStarted(bundle);
}
/**
@@ -309,8 +300,7 @@
* @param admin
* @return true if the bundle is required
*/
- public static boolean isBundleRequired(Bundle bundle, BundleContext bc,
- PackageAdmin admin) {
+ public static boolean isBundleRequired(Bundle bundle, BundleContext bc, PackageAdmin admin) {
return getRequiredBundle(bundle, bc, admin) != null;
}
@@ -322,8 +312,7 @@
* @param admin
* @return true if the bundle is pending removal
*/
- public static boolean isRequiredBundleRemovalPending(Bundle bundle,
- BundleContext bc, PackageAdmin admin) {
+ public static boolean isRequiredBundleRemovalPending(Bundle bundle, BundleContext bc, PackageAdmin admin) {
RequiredBundle r = getRequiredBundle(bundle, bc, admin);
return r != null && r.isRemovalPending();
}
@@ -399,8 +388,7 @@
*/
public static ArrayType STRING_ARRAY_TYPE;
- private static final Logger log = Logger.getLogger(Util.class
- .getCanonicalName());
+ private static final Logger log = Logger.getLogger(Util.class.getCanonicalName());
static {
try {
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleState.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleState.java
index 19d01cd..1de054b 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleState.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/BundleState.java
@@ -46,17 +46,15 @@
this.admin = admin;
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getBundles()
+ /**
+ * {@inheritDoc}
*/
public TabularData listBundles() throws IOException {
return listBundles(CustomBundleStateMBean.DEFAULT);
}
- /* (non-Javadoc)
- * @see org.eclipse.gemini.mgmt.framework.CustomBundleStateMBean#listBundles(int)
+ /**
+ * {@inheritDoc}
*/
public TabularData listBundles(int mask) throws IOException {
if (mask < 1 || mask > 1048575) {
@@ -75,14 +73,11 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getExportedPackages()
+ /**
+ * {@inheritDoc}
*/
public String[] getExportedPackages(long bundleId) throws IOException {
- ExportedPackage[] packages = admin
- .getExportedPackages(bundle(bundleId));
+ ExportedPackage[] packages = admin.getExportedPackages(bundle(bundleId));
if (packages == null) {
return new String[0];
}
@@ -93,28 +88,22 @@
return ep;
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getFragments()
+ /**
+ * {@inheritDoc}
*/
public long[] getFragments(long bundleId) throws IOException {
return Util.getBundleFragments(bundle(bundleId), admin);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getHeaders(long)
+ /**
+ * {@inheritDoc}
*/
public TabularData getHeaders(long bundleId) throws IOException {
return OSGiBundle.headerTable(bundle(bundleId));
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getHosts(long)
+ /**
+ * {@inheritDoc}
*/
public long[] getHosts(long fragment) throws IOException {
Bundle[] hosts = admin.getHosts(bundle(fragment));
@@ -124,126 +113,106 @@
return Util.bundleIds(hosts);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getImportedPackages()
+ /**
+ * {@inheritDoc}
*/
public String[] getImportedPackages(long bundleId) throws IOException {
return Util.getBundleImportedPackages(bundle(bundleId), bc, admin);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getLastModified(long)
+ /**
+ * {@inheritDoc}
*/
public long getLastModified(long bundleId) throws IOException {
return bundle(bundleId).getLastModified();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getRegisteredServices()
+ /**
+ * {@inheritDoc}
*/
public long[] getRegisteredServices(long bundleId) throws IOException {
return Util.serviceIds(bundle(bundleId).getRegisteredServices());
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getRequiringBundles()
+ /**
+ * {@inheritDoc}
*/
public long[] getRequiringBundles(long bundleIdentifier) throws IOException {
return Util.getBundlesRequiring(bundle(bundleIdentifier), bc, admin);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getServicesInUse()
+ /**
+ * {@inheritDoc}
*/
public long[] getServicesInUse(long bundleIdentifier) throws IOException {
return Util.serviceIds(bundle(bundleIdentifier).getServicesInUse());
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getStartLevel(long)
+ /**
+ * {@inheritDoc}
*/
public int getStartLevel(long bundleId) throws IOException {
return sl.getBundleStartLevel(bundle(bundleId));
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getState(long)
+ /**
+ * {@inheritDoc}
*/
public String getState(long bundleId) throws IOException {
return Util.getBundleState(bundle(bundleId));
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getSymbolicName(long)
+ /**
+ * {@inheritDoc}
*/
public String getSymbolicName(long bundleId) throws IOException {
return bundle(bundleId).getSymbolicName();
}
+ /**
+ * {@inheritDoc}
+ */
public String getLocation(long bundleId) throws IOException {
return bundle(bundleId).getLocation();
}
+ /**
+ * {@inheritDoc}
+ */
public long[] getRequiredBundles(long bundleIdentifier) throws IOException {
return Util.getDependencies(bundle(bundleIdentifier), admin);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#getVersion(long)
+ /**
+ * {@inheritDoc}
*/
public String getVersion(long bundleId) throws IOException {
return bundle(bundleId).getVersion().toString();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#isBundlePersistentlyStarted(long)
+ /**
+ * {@inheritDoc}
*/
public boolean isPersistentlyStarted(long bundleId) throws IOException {
return Util.isBundlePersistentlyStarted(bundle(bundleId), sl);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#isFragment(long)
+ /**
+ * {@inheritDoc}
*/
public boolean isFragment(long bundleId) throws IOException {
return Util.isBundleFragment(bundle(bundleId), admin);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#isRemovalPending(long)
+ /**
+ * {@inheritDoc}
*/
public boolean isRemovalPending(long bundleId) throws IOException {
return Util.isRequiredBundleRemovalPending(bundle(bundleId), bc, admin);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.BundleStateMBean#isRequired(long)
+ /**
+ * {@inheritDoc}
*/
public boolean isRequired(long bundleId) throws IOException {
return Util.isBundleRequired(bundle(bundleId), bc, admin);
@@ -252,16 +221,13 @@
private Bundle bundle(long bundleId) throws IOException {
Bundle b = bc.getBundle(bundleId);
if (b == null) {
- throw new IOException("Bundle with id: " + bundleId
- + " does not exist");
+ throw new IOException("Bundle with id: " + bundleId + " does not exist");
}
return b;
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.Monitor#addListener()
+ /**
+ * {@inheritDoc}
*/
@Override
protected void addListener() {
@@ -272,19 +238,15 @@
protected BundleListener getBundleListener() {
return new BundleListener() {
public void bundleChanged(BundleEvent bundleEvent) {
- Notification notification = new Notification(
- BundleStateMBean.EVENT, objectName, sequenceNumber++);
- notification.setUserData(new OSGiBundleEvent(bundleEvent)
- .asCompositeData());
+ Notification notification = new Notification(BundleStateMBean.EVENT, objectName, sequenceNumber++);
+ notification.setUserData(new OSGiBundleEvent(bundleEvent).asCompositeData());
sendNotification(notification);
}
};
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.Monitor#removeListener()
+ /**
+ * {@inheritDoc}
*/
@Override
protected void removeListener() {
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/Framework.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/Framework.java
index c1e9a0e..7c514e4 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/Framework.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/Framework.java
@@ -42,28 +42,22 @@
this.sl = sl;
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#getFrameworkStartLevel()
+ /**
+ * {@inheritDoc}
*/
public int getFrameworkStartLevel() throws IOException {
return sl.getStartLevel();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#getInitialBundleStartLevel()
+ /**
+ * {@inheritDoc}
*/
public int getInitialBundleStartLevel() throws IOException {
return sl.getInitialBundleStartLevel();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#installBundle(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public long installBundle(String location) throws IOException {
try {
@@ -73,14 +67,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#installBundle(java.lang.String,
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public long installBundleFromURL(String location, String url)
- throws IOException {
+ public long installBundleFromURL(String location, String url) throws IOException {
InputStream is = null;
try {
is = new URL(url).openStream();
@@ -97,10 +87,8 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#installBundles(java.lang.String[])
+ /**
+ * {@inheritDoc}
*/
public CompositeData installBundles(String[] locations) throws IOException {
if (locations == null) {
@@ -114,23 +102,17 @@
long[] completed = new long[i];
System.arraycopy(ids, 0, completed, 0, completed.length);
String[] remaining = new String[locations.length - i - 1];
- System.arraycopy(locations, i + 1, remaining, 0,
- remaining.length);
- return new BundleBatchInstallResult(e.toString(), completed,
- locations[i], remaining).asCompositeData();
+ System.arraycopy(locations, i + 1, remaining, 0, remaining.length);
+ return new BundleBatchInstallResult(e.toString(), completed, locations[i], remaining).asCompositeData();
}
}
return new BundleBatchInstallResult(ids).asCompositeData();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#installBundles(java.lang.String[],
- * java.lang.String[])
+ /**
+ * {@inheritDoc}
*/
- public CompositeData installBundlesFromURL(String[] locations, String[] urls)
- throws IOException {
+ public CompositeData installBundlesFromURL(String[] locations, String[] urls) throws IOException {
if (locations == null) {
throw new IOException("locations must not be null");
}
@@ -147,10 +129,8 @@
long[] completed = new long[i];
System.arraycopy(ids, 0, completed, 0, completed.length);
String[] remaining = new String[locations.length - i - 1];
- System.arraycopy(locations, i + 1, remaining, 0,
- remaining.length);
- return new BundleBatchInstallResult(e.toString(), completed,
- locations[i], remaining).asCompositeData();
+ System.arraycopy(locations, i + 1, remaining, 0, remaining.length);
+ return new BundleBatchInstallResult(e.toString(), completed, locations[i], remaining).asCompositeData();
} finally {
if (is != null) {
try {
@@ -163,19 +143,15 @@
return new BundleBatchInstallResult(ids).asCompositeData();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#refreshPackages(long)
+ /**
+ * {@inheritDoc}
*/
public void refreshBundle(long bundleIdentifier) throws IOException {
admin.refreshPackages(new Bundle[] { bundle(bundleIdentifier) });
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#refreshPackages(long[])
+ /**
+ * {@inheritDoc}
*/
public void refreshBundles(long[] bundleIdentifiers) throws IOException {
Bundle[] bundles = null;
@@ -186,8 +162,7 @@
try {
bundles[i] = bundle(bundleIdentifiers[i]);
} catch (Throwable e) {
- IOException iox = new IOException(
- "Unable to refresh packages");
+ IOException iox = new IOException("Unable to refresh packages");
iox.initCause(e);
throw iox;
}
@@ -202,10 +177,8 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#resolveBundle(long)
+ /**
+ * {@inheritDoc}
*/
public boolean resolveBundle(long bundleIdentifier) throws IOException {
return admin.resolveBundles(new Bundle[] { bundle(bundleIdentifier) });
@@ -227,10 +200,8 @@
return admin.resolveBundles(bundles);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#restartFramework()
+ /**
+ * {@inheritDoc}
*/
public void restartFramework() throws IOException {
try {
@@ -240,13 +211,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#setBundleStartLevel(long, int)
+ /**
+ * {@inheritDoc}
*/
- public void setBundleStartLevel(long bundleIdentifier, int newlevel)
- throws IOException {
+ public void setBundleStartLevel(long bundleIdentifier, int newlevel) throws IOException {
try {
sl.setBundleStartLevel(bundle(bundleIdentifier), newlevel);
} catch (Throwable e) {
@@ -256,13 +224,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#setBundleStartLevels(long[], int[])
+ /**
+ * {@inheritDoc}
*/
- public CompositeData setBundleStartLevels(long[] bundleIdentifiers,
- int[] newlevels) throws IOException {
+ public CompositeData setBundleStartLevels(long[] bundleIdentifiers, int[] newlevels) throws IOException {
if (bundleIdentifiers == null) {
throw new IOException("Bundle identifiers must not be null");
}
@@ -271,26 +236,20 @@
}
for (int i = 0; i < bundleIdentifiers.length; i++) {
try {
- sl.setBundleStartLevel(bundle(bundleIdentifiers[i]),
- newlevels[i]);
+ sl.setBundleStartLevel(bundle(bundleIdentifiers[i]), newlevels[i]);
} catch (Throwable e) {
long[] completed = new long[i];
- System.arraycopy(bundleIdentifiers, 0, completed, 0,
- completed.length);
+ System.arraycopy(bundleIdentifiers, 0, completed, 0, completed.length);
long[] remaining = new long[bundleIdentifiers.length - i - 1];
- System.arraycopy(bundleIdentifiers, i + 1, remaining, 0,
- remaining.length);
- return new BundleBatchActionResult(e.toString(), completed,
- bundleIdentifiers[i], remaining).asCompositeData();
+ System.arraycopy(bundleIdentifiers, i + 1, remaining, 0, remaining.length);
+ return new BundleBatchActionResult(e.toString(), completed, bundleIdentifiers[i], remaining).asCompositeData();
}
}
return new BundleBatchActionResult().asCompositeData();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#setFrameworkStartLevel(int)
+ /**
+ * {@inheritDoc}
*/
public void setFrameworkStartLevel(int newlevel) throws IOException {
try {
@@ -302,10 +261,8 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#setInitialBundleStartLevel(int)
+ /**
+ * {@inheritDoc}
*/
public void setInitialBundleStartLevel(int newlevel) throws IOException {
try {
@@ -317,24 +274,19 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#shutdownFramework()
+ /**
+ * {@inheritDoc}
*/
public void shutdownFramework() throws IOException {
try {
bundle(0).stop();
} catch (Throwable be) {
- throw new IOException(
- "Shutting down not implemented in this framework: " + be);
+ throw new IOException("Shutting down not implemented in this framework: " + be);
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#startBundle(long)
+ /**
+ * {@inheritDoc}
*/
public void startBundle(long bundleIdentifier) throws IOException {
try {
@@ -344,13 +296,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#startBundles(long[])
+ /**
+ * {@inheritDoc}
*/
- public CompositeData startBundles(long[] bundleIdentifiers)
- throws IOException {
+ public CompositeData startBundles(long[] bundleIdentifiers) throws IOException {
if (bundleIdentifiers == null) {
throw new IOException("Bundle identifiers must not be null");
}
@@ -359,22 +308,17 @@
bundle(bundleIdentifiers[i]).start();
} catch (Throwable e) {
long[] completed = new long[i];
- System.arraycopy(bundleIdentifiers, 0, completed, 0,
- completed.length);
+ System.arraycopy(bundleIdentifiers, 0, completed, 0, completed.length);
long[] remaining = new long[bundleIdentifiers.length - i - 1];
- System.arraycopy(bundleIdentifiers, i + 1, remaining, 0,
- remaining.length);
- return new BundleBatchActionResult(e.toString(), completed,
- bundleIdentifiers[i], remaining).asCompositeData();
+ System.arraycopy(bundleIdentifiers, i + 1, remaining, 0, remaining.length);
+ return new BundleBatchActionResult(e.toString(), completed, bundleIdentifiers[i], remaining).asCompositeData();
}
}
return new BundleBatchActionResult().asCompositeData();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#stopBundle(long)
+ /**
+ * {@inheritDoc}
*/
public void stopBundle(long bundleIdentifier) throws IOException {
try {
@@ -384,13 +328,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#stopBundles(long[])
+ /**
+ * {@inheritDoc}
*/
- public CompositeData stopBundles(long[] bundleIdentifiers)
- throws IOException {
+ public CompositeData stopBundles(long[] bundleIdentifiers) throws IOException {
if (bundleIdentifiers == null) {
throw new IOException("Bundle identifiers must not be null");
}
@@ -399,22 +340,17 @@
bundle(bundleIdentifiers[i]).stop();
} catch (Throwable e) {
long[] completed = new long[i];
- System.arraycopy(bundleIdentifiers, 0, completed, 0,
- completed.length);
+ System.arraycopy(bundleIdentifiers, 0, completed, 0, completed.length);
long[] remaining = new long[bundleIdentifiers.length - i - 1];
- System.arraycopy(bundleIdentifiers, i + 1, remaining, 0,
- remaining.length);
- return new BundleBatchActionResult(e.toString(), completed,
- bundleIdentifiers[i], remaining).asCompositeData();
+ System.arraycopy(bundleIdentifiers, i + 1, remaining, 0, remaining.length);
+ return new BundleBatchActionResult(e.toString(), completed, bundleIdentifiers[i], remaining).asCompositeData();
}
}
return new BundleBatchActionResult().asCompositeData();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#uninstallBundle(long)
+ /**
+ * {@inheritDoc}
*/
public void uninstallBundle(long bundleIdentifier) throws IOException {
try {
@@ -424,13 +360,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#uninstallBundles(long[])
+ /**
+ * {@inheritDoc}
*/
- public CompositeData uninstallBundles(long[] bundleIdentifiers)
- throws IOException {
+ public CompositeData uninstallBundles(long[] bundleIdentifiers) throws IOException {
if (bundleIdentifiers == null) {
throw new IOException("Bundle identifiers must not be null");
}
@@ -439,22 +372,17 @@
bundle(bundleIdentifiers[i]).uninstall();
} catch (Throwable e) {
long[] completed = new long[i];
- System.arraycopy(bundleIdentifiers, 0, completed, 0,
- completed.length);
+ System.arraycopy(bundleIdentifiers, 0, completed, 0, completed.length);
long[] remaining = new long[bundleIdentifiers.length - i - 1];
- System.arraycopy(bundleIdentifiers, i + 1, remaining, 0,
- remaining.length);
- return new BundleBatchActionResult(e.toString(), completed,
- bundleIdentifiers[i], remaining).asCompositeData();
+ System.arraycopy(bundleIdentifiers, i + 1, remaining, 0, remaining.length);
+ return new BundleBatchActionResult(e.toString(), completed, bundleIdentifiers[i], remaining).asCompositeData();
}
}
return new BundleBatchActionResult().asCompositeData();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#updateBundle(long)
+ /**
+ * {@inheritDoc}
*/
public void updateBundle(long bundleIdentifier) throws IOException {
try {
@@ -464,14 +392,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#updateBundleFromUrl(long,
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public void updateBundleFromURL(long bundleIdentifier, String url)
- throws IOException {
+ public void updateBundleFromURL(long bundleIdentifier, String url) throws IOException {
InputStream is = null;
try {
is = new URL(url).openStream();
@@ -488,13 +412,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#updateBundles(long[])
+ /**
+ * {@inheritDoc}
*/
- public CompositeData updateBundles(long[] bundleIdentifiers)
- throws IOException {
+ public CompositeData updateBundles(long[] bundleIdentifiers) throws IOException {
if (bundleIdentifiers == null) {
throw new IOException("Bundle identifiers must not be null");
}
@@ -503,26 +424,19 @@
bundle(bundleIdentifiers[i]).update();
} catch (Throwable e) {
long[] completed = new long[i];
- System.arraycopy(bundleIdentifiers, 0, completed, 0,
- completed.length);
+ System.arraycopy(bundleIdentifiers, 0, completed, 0, completed.length);
long[] remaining = new long[bundleIdentifiers.length - i - 1];
- System.arraycopy(bundleIdentifiers, i + 1, remaining, 0,
- remaining.length);
- return new BundleBatchActionResult(e.toString(), completed,
- bundleIdentifiers[i], remaining).asCompositeData();
+ System.arraycopy(bundleIdentifiers, i + 1, remaining, 0, remaining.length);
+ return new BundleBatchActionResult(e.toString(), completed, bundleIdentifiers[i], remaining).asCompositeData();
}
}
return new BundleBatchActionResult().asCompositeData();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#updateBundlesFromUrls(long[],
- * java.lang.String[])
+ /**
+ * {@inheritDoc}
*/
- public CompositeData updateBundlesFromURL(long[] bundleIdentifiers,
- String[] urls) throws IOException {
+ public CompositeData updateBundlesFromURL(long[] bundleIdentifiers, String[] urls) throws IOException {
if (bundleIdentifiers == null) {
throw new IOException("Bundle identifiers must not be null");
}
@@ -533,13 +447,10 @@
bundle(bundleIdentifiers[i]).update(is);
} catch (Throwable e) {
long[] completed = new long[i];
- System.arraycopy(bundleIdentifiers, 0, completed, 0,
- completed.length);
+ System.arraycopy(bundleIdentifiers, 0, completed, 0, completed.length);
long[] remaining = new long[bundleIdentifiers.length - i - 1];
- System.arraycopy(bundleIdentifiers, i + 1, remaining, 0,
- remaining.length);
- return new BundleBatchActionResult(e.toString(), completed,
- bundleIdentifiers[i], remaining).asCompositeData();
+ System.arraycopy(bundleIdentifiers, i + 1, remaining, 0, remaining.length);
+ return new BundleBatchActionResult(e.toString(), completed, bundleIdentifiers[i], remaining).asCompositeData();
} finally {
if (is != null) {
try {
@@ -552,10 +463,8 @@
return new BundleBatchActionResult().asCompositeData();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.FrameworkMBean#updateFramework()
+ /**
+ * {@inheritDoc}
*/
public void updateFramework() throws IOException {
try {
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/PackageState.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/PackageState.java
index ac5a37d..5d0ce5d 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/PackageState.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/PackageState.java
@@ -41,15 +41,10 @@
this.admin = admin;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.core.PackageStateMBean#getExportingBundles(java.lang.String,
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public long[] getExportingBundles(String packageName, String version)
- throws IOException {
+ public long[] getExportingBundles(String packageName, String version) throws IOException {
if (packageName == null) {
throw new IOException("Package name cannot be null");
}
@@ -61,8 +56,7 @@
throw new IOException("Invalid package version: " + version);
}
}
- ExportedPackage[] exportedPackages = admin
- .getExportedPackages(packageName);
+ ExportedPackage[] exportedPackages = admin.getExportedPackages(packageName);
if (exportedPackages == null) {
return new long[0];
}
@@ -80,15 +74,10 @@
return bundles;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.core.PackageStateMBean#getImportingBundles(java.lang.String,
- * java.lang.String, long)
+ /**
+ * {@inheritDoc}
*/
- public long[] getImportingBundles(String packageName, String version,
- long exportingBundle) throws IOException {
+ public long[] getImportingBundles(String packageName, String version, long exportingBundle) throws IOException {
if (packageName == null) {
throw new IOException("Package name cannot be null");
}
@@ -100,14 +89,12 @@
throw new IOException("Invalid package version: " + version);
}
}
- ExportedPackage[] exportedPackages = admin
- .getExportedPackages(packageName);
+ ExportedPackage[] exportedPackages = admin.getExportedPackages(packageName);
if (exportedPackages == null) {
return new long[0];
}
for (ExportedPackage pkg : exportedPackages) {
- if (pkg.getVersion().equals(v)
- && pkg.getExportingBundle().getBundleId() == exportingBundle) {
+ if (pkg.getVersion().equals(v) && pkg.getExportingBundle().getBundleId() == exportingBundle) {
Bundle[] bundles = pkg.getImportingBundles();
long[] ids = new long[bundles.length];
for (int i = 0; i < bundles.length; i++) {
@@ -119,10 +106,8 @@
return new long[0];
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.PackageStateMBean#listPackages()
+ /**
+ * {@inheritDoc}
*/
public TabularData listPackages() {
Set<OSGiPackage> packages = new HashSet<OSGiPackage>();
@@ -137,15 +122,10 @@
return OSGiPackage.tableFrom(packages);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.core.PackageStateMBean#isRemovalPending(java.lang.String,
- * java.lang.String, long)
+ /**
+ * {@inheritDoc}
*/
- public boolean isRemovalPending(String packageName, String version,
- long exportingBundle) throws IOException {
+ public boolean isRemovalPending(String packageName, String version, long exportingBundle) throws IOException {
if (packageName == null) {
throw new IOException("Package name cannot be null");
}
@@ -157,14 +137,12 @@
throw new IOException("Invalid package version: " + version);
}
}
- ExportedPackage[] exportedPackages = admin
- .getExportedPackages(packageName);
+ ExportedPackage[] exportedPackages = admin.getExportedPackages(packageName);
if (exportedPackages == null) {
return false;
}
for (ExportedPackage pkg : exportedPackages) {
- if (pkg.getVersion().equals(v)
- && pkg.getExportingBundle().getBundleId() == exportingBundle) {
+ if (pkg.getVersion().equals(v) && pkg.getExportingBundle().getBundleId() == exportingBundle) {
return pkg.isRemovalPending();
}
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/ServiceState.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/ServiceState.java
index cf2c569..656d590 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/ServiceState.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/ServiceState.java
@@ -247,10 +247,8 @@
protected ServiceListener getServiceListener() {
return new AllServiceListener() {
public void serviceChanged(ServiceEvent serviceEvent) {
- Notification notification = new Notification(
- ServiceStateMBean.EVENT, objectName, sequenceNumber++);
- notification.setUserData(new OSGiServiceEvent(serviceEvent)
- .asCompositeData());
+ Notification notification = new Notification(ServiceStateMBean.EVENT, objectName, sequenceNumber++);
+ notification.setUserData(new OSGiServiceEvent(serviceEvent).asCompositeData());
sendNotification(notification);
}
};
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchActionResult.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchActionResult.java
index 51d79c4..73578f7 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchActionResult.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchActionResult.java
@@ -76,12 +76,10 @@
*/
@SuppressWarnings("boxing")
public BundleBatchActionResult(CompositeData compositeData) {
- success = ((Boolean) compositeData.get(FrameworkMBean.SUCCESS))
- .booleanValue();
+ success = ((Boolean) compositeData.get(FrameworkMBean.SUCCESS)).booleanValue();
errorMessage = (String) compositeData.get(FrameworkMBean.ERROR);
Long[] c = (Long[]) compositeData.get(FrameworkMBean.COMPLETED);
- bundleInError = (Long) compositeData
- .get(FrameworkMBean.BUNDLE_IN_ERROR);
+ bundleInError = (Long) compositeData.get(FrameworkMBean.BUNDLE_IN_ERROR);
if (c != null) {
completed = new long[c.length];
for (int i = 0; i < c.length; i++) {
@@ -114,8 +112,7 @@
* @param remaining
* - the list of bundle identifiers which remain unprocessed
*/
- public BundleBatchActionResult(String errorMessage, long[] completed,
- long bundleInError, long[] remaining) {
+ public BundleBatchActionResult(String errorMessage, long[] completed, long bundleInError, long[] remaining) {
success = false;
this.errorMessage = errorMessage;
this.completed = completed;
@@ -138,11 +135,9 @@
items.put(FrameworkMBean.REMAINING, LongArrayFrom(remaining));
try {
- return new CompositeDataSupport(
- FrameworkMBean.BATCH_ACTION_RESULT_TYPE, items);
+ return new CompositeDataSupport( FrameworkMBean.BATCH_ACTION_RESULT_TYPE, items);
} catch (OpenDataException e) {
- throw new IllegalStateException(
- "Cannot form batch result open data", e);
+ throw new IllegalStateException("Cannot form batch result open data", e);
}
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchInstallResult.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchInstallResult.java
index 46b6ae8..51db5cf 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchInstallResult.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchInstallResult.java
@@ -69,8 +69,7 @@
*/
@SuppressWarnings("boxing")
public BundleBatchInstallResult(CompositeData compositeData) {
- success = ((Boolean) compositeData.get(FrameworkMBean.SUCCESS))
- .booleanValue();
+ success = ((Boolean) compositeData.get(FrameworkMBean.SUCCESS)).booleanValue();
errorMessage = (String) compositeData.get(FrameworkMBean.ERROR);
Long[] c = (Long[]) compositeData.get(FrameworkMBean.COMPLETED);
if (c != null) {
@@ -81,8 +80,7 @@
} else {
completed = new long[0];
}
- bundleInError = (String) compositeData
- .get(FrameworkMBean.BUNDLE_IN_ERROR);
+ bundleInError = (String) compositeData.get(FrameworkMBean.BUNDLE_IN_ERROR);
remaining = (String[]) compositeData.get(FrameworkMBean.REMAINING);
}
@@ -111,8 +109,7 @@
* @param remaining
* - the list of bundle identifiers which remain unprocessed
*/
- public BundleBatchInstallResult(String errorMessage, long[] completed,
- String bundleInError, String[] remaining) {
+ public BundleBatchInstallResult(String errorMessage, long[] completed, String bundleInError, String[] remaining) {
success = false;
this.errorMessage = errorMessage;
this.completed = completed;
@@ -136,11 +133,9 @@
items.put(FrameworkMBean.REMAINING, remaining);
try {
- return new CompositeDataSupport(
- FrameworkMBean.BATCH_INSTALL_RESULT_TYPE, items);
+ return new CompositeDataSupport(FrameworkMBean.BATCH_INSTALL_RESULT_TYPE, items);
} catch (OpenDataException e) {
- IOException iox = new IOException(
- "Cannot form batch result open data");
+ IOException iox = new IOException("Cannot form batch result open data");
iox.initCause(e);
throw iox;
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchResult.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchResult.java
index 8c3d142..9e97bf5 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchResult.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/BundleBatchResult.java
@@ -16,6 +16,8 @@
package org.eclipse.gemini.mgmt.framework.codec;
/**
+ * Abstract supertype to represent the result of an operation on multiple bundles.
+ * The bundles are identified by their id.
*/
abstract public class BundleBatchResult {
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiBundle.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiBundle.java
index d2ba834..93bd743 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiBundle.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiBundle.java
@@ -148,11 +148,9 @@
public class OSGiBundle {
private static final String VALUE = "Value";
-
private static final String KEY = "Key";
-
- private static final String[] HEADER_PROPERTY_ITEM_NAMES = new String[] {
- KEY, VALUE };
+ private static final String[] HEADER_PROPERTY_ITEM_NAMES = new String[] {KEY, VALUE };
+
private BundleContext bc;
private PackageAdmin admin;
private StartLevel sl;
@@ -166,30 +164,26 @@
*/
@SuppressWarnings("boxing")
public OSGiBundle(CompositeData data) {
- this((String) data.get(BundleStateMBean.LOCATION), ((Long) data
- .get(BundleStateMBean.IDENTIFIER)).longValue(), (String) data
- .get(BundleStateMBean.SYMBOLIC_NAME), (String) data
- .get(BundleStateMBean.VERSION), ((Integer) data
- .get(BundleStateMBean.START_LEVEL)).intValue(), (String) data
- .get(BundleStateMBean.STATE), ((Long) data
- .get(BundleStateMBean.LAST_MODIFIED)).longValue(),
- (Boolean) data.get(BundleStateMBean.PERSISTENTLY_STARTED),
- (Boolean) data.get(BundleStateMBean.REMOVAL_PENDING),
- (Boolean) data.get(BundleStateMBean.REQUIRED), (Boolean) data
- .get(BundleStateMBean.FRAGMENT),
- longArrayFrom((Long[]) data
- .get(BundleStateMBean.REGISTERED_SERVICES)),
- longArrayFrom((Long[]) data
- .get(BundleStateMBean.SERVICES_IN_USE)),
- mapFrom((TabularData) data.get(BundleStateMBean.HEADERS)),
- (String[]) data.get(BundleStateMBean.EXPORTED_PACKAGES),
- (String[]) data.get(BundleStateMBean.IMPORTED_PACKAGES),
- longArrayFrom((Long[]) data.get(BundleStateMBean.FRAGMENTS)),
- longArrayFrom((Long[]) data.get(BundleStateMBean.HOSTS)),
- longArrayFrom((Long[]) data
- .get(BundleStateMBean.REQUIRED_BUNDLES)),
- longArrayFrom((Long[]) data
- .get(BundleStateMBean.REQUIRING_BUNDLES)));
+ this((String) data.get(BundleStateMBean.LOCATION),
+ ((Long) data.get(BundleStateMBean.IDENTIFIER)).longValue(),
+ (String) data.get(BundleStateMBean.SYMBOLIC_NAME),
+ (String) data.get(BundleStateMBean.VERSION),
+ ((Integer) data.get(BundleStateMBean.START_LEVEL)).intValue(),
+ (String) data.get(BundleStateMBean.STATE),
+ ((Long) data.get(BundleStateMBean.LAST_MODIFIED)).longValue(),
+ (Boolean) data.get(BundleStateMBean.PERSISTENTLY_STARTED),
+ (Boolean) data.get(BundleStateMBean.REMOVAL_PENDING),
+ (Boolean) data.get(BundleStateMBean.REQUIRED),
+ (Boolean) data.get(BundleStateMBean.FRAGMENT),
+ longArrayFrom((Long[]) data.get(BundleStateMBean.REGISTERED_SERVICES)),
+ longArrayFrom((Long[]) data.get(BundleStateMBean.SERVICES_IN_USE)),
+ mapFrom((TabularData) data.get(BundleStateMBean.HEADERS)),
+ (String[]) data.get(BundleStateMBean.EXPORTED_PACKAGES),
+ (String[]) data.get(BundleStateMBean.IMPORTED_PACKAGES),
+ longArrayFrom((Long[]) data.get(BundleStateMBean.FRAGMENTS)),
+ longArrayFrom((Long[]) data.get(BundleStateMBean.HOSTS)),
+ longArrayFrom((Long[]) data.get(BundleStateMBean.REQUIRED_BUNDLES)),
+ longArrayFrom((Long[]) data.get(BundleStateMBean.REQUIRING_BUNDLES)));
}
@@ -205,8 +199,7 @@
* @param b
* - the Bundle to represent
*/
- public OSGiBundle(BundleContext bc, PackageAdmin admin, StartLevel sl,
- Bundle b) {
+ public OSGiBundle(BundleContext bc, PackageAdmin admin, StartLevel sl, Bundle b) {
this.bc = bc;
this.admin = admin;
this.sl = sl;
@@ -278,9 +271,8 @@
* @return the Tabular data which represents the list of bundles
*/
public static TabularData tableFrom(ArrayList<OSGiBundle> bundles, int mask) {
- TabularDataSupport table = new TabularDataSupport(
- Item.tabularType("BUNDLES", "A list of bundles",
- OSGiBundle.computeBundleType(mask), new String[] { BundleStateMBean.IDENTIFIER }));
+ TabularDataSupport table = new TabularDataSupport(Item.tabularType("BUNDLES", "A list of bundles",
+ OSGiBundle.computeBundleType(mask), new String[] { BundleStateMBean.IDENTIFIER }));
for (OSGiBundle bundle : bundles) {
table.put(bundle.asCompositeData(mask));
}
@@ -350,8 +342,7 @@
bundleTypes.add(BundleStateMBean.REQUIRED_BUNDLES_ITEM);
}
- CompositeType currentCompositeType = Item.compositeType("BUNDLE",
- "This type encapsulates OSGi bundles",bundleTypes.toArray(new Item[]{}));
+ CompositeType currentCompositeType = Item.compositeType("BUNDLE", "This type encapsulates OSGi bundles",bundleTypes.toArray(new Item[]{}));
return currentCompositeType;
}
@@ -364,8 +355,7 @@
*/
@SuppressWarnings("unchecked")
public static TabularData headerTable(Bundle b) {
- TabularDataSupport table = new TabularDataSupport(
- BundleStateMBean.HEADERS_TYPE);
+ TabularDataSupport table = new TabularDataSupport(BundleStateMBean.HEADERS_TYPE);
Dictionary map = b.getHeaders();
for (Enumeration headers = map.keys(); headers.hasMoreElements();) {
String key = (String) headers.nextElement();
@@ -381,8 +371,7 @@
* @return the bundle headers
*/
public static TabularData headerTable(Map<String, String> headers) {
- TabularDataSupport table = new TabularDataSupport(
- BundleStateMBean.HEADERS_TYPE);
+ TabularDataSupport table = new TabularDataSupport(BundleStateMBean.HEADERS_TYPE);
for (Map.Entry<String, String> entry : headers.entrySet()) {
table.put(headerData(entry.getKey(), entry.getValue()));
}
@@ -395,11 +384,9 @@
itemValues[1] = value;
try {
- return new CompositeDataSupport(BundleStateMBean.HEADER_TYPE,
- HEADER_PROPERTY_ITEM_NAMES, itemValues);
+ return new CompositeDataSupport(BundleStateMBean.HEADER_TYPE, HEADER_PROPERTY_ITEM_NAMES, itemValues);
} catch (OpenDataException e) {
- throw new IllegalStateException(
- "Cannot form bundle header open data", e);
+ throw new IllegalStateException("Cannot form bundle header open data", e);
}
}
@@ -446,12 +433,10 @@
items.put(BundleStateMBean.FRAGMENT, isFragment());
}
if((mask | CustomBundleStateMBean.REGISTERED_SERVICES) == mask) {
- items.put(BundleStateMBean.REGISTERED_SERVICES,
- LongArrayFrom(getRegisteredServices()));
+ items.put(BundleStateMBean.REGISTERED_SERVICES, LongArrayFrom(getRegisteredServices()));
}
if((mask | CustomBundleStateMBean.SERVICES_IN_USE) == mask) {
- items.put(BundleStateMBean.SERVICES_IN_USE,
- LongArrayFrom(getServicesInUse()));
+ items.put(BundleStateMBean.SERVICES_IN_USE, LongArrayFrom(getServicesInUse()));
}
if((mask | CustomBundleStateMBean.HEADERS) == mask) {
items.put(BundleStateMBean.HEADERS, headerTable(getHeaders()));
@@ -469,12 +454,10 @@
items.put(BundleStateMBean.HOSTS, LongArrayFrom(getHosts()));
}
if((mask | CustomBundleStateMBean.REQUIRING_BUNDLES) == mask) {
- items.put(BundleStateMBean.REQUIRING_BUNDLES,
- LongArrayFrom(getRequiringBundles()));
+ items.put(BundleStateMBean.REQUIRING_BUNDLES, LongArrayFrom(getRequiringBundles()));
}
if((mask | CustomBundleStateMBean.REQUIRED_BUNDLES) == mask) {
- items.put(BundleStateMBean.REQUIRED_BUNDLES,
- LongArrayFrom(getRequiredBundles()));
+ items.put(BundleStateMBean.REQUIRED_BUNDLES, LongArrayFrom(getRequiredBundles()));
}
try {
@@ -693,8 +676,7 @@
Map<String, String> headers = new HashMap<String, String>();
Set<List<?>> keySet = (Set<List<?>>) data.keySet();
for (List<?> key : keySet) {
- headers.put((String) key.get(0), (String) data.get(
- new Object[] { key.get(0) }).get(VALUE));
+ headers.put((String) key.get(0), (String) data.get(new Object[] { key.get(0) }).get(VALUE));
}
return headers;
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiBundleEvent.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiBundleEvent.java
index b90f474..a21b3c2 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiBundleEvent.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiBundleEvent.java
@@ -62,8 +62,7 @@
* - the event to represent
*/
public OSGiBundleEvent(BundleEvent event) {
- this(event.getBundle().getBundleId(), event.getBundle().getLocation(),
- event.getBundle().getSymbolicName(), event.getType());
+ this(event.getBundle().getBundleId(), event.getBundle().getLocation(), event.getBundle().getSymbolicName(), event.getType());
}
/**
@@ -89,8 +88,7 @@
* @param symbolicName
* @param eventType
*/
- public OSGiBundleEvent(long bundleId, String location, String symbolicName,
- int eventType) {
+ public OSGiBundleEvent(long bundleId, String location, String symbolicName, int eventType) {
this.bundleId = bundleId;
this.location = location;
this.symbolicName = symbolicName;
@@ -110,11 +108,9 @@
items.put(BundleStateMBean.SYMBOLIC_NAME, symbolicName);
items.put(BundleStateMBean.EVENT, eventType);
try {
- return new CompositeDataSupport(BundleStateMBean.BUNDLE_EVENT_TYPE,
- items);
+ return new CompositeDataSupport(BundleStateMBean.BUNDLE_EVENT_TYPE, items);
} catch (OpenDataException e) {
- throw new IllegalStateException(
- "Cannot form bundle event open data", e);
+ throw new IllegalStateException("Cannot form bundle event open data", e);
}
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiPackage.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiPackage.java
index 0bfd86e..9c37cc5 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiPackage.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiPackage.java
@@ -74,13 +74,10 @@
*/
@SuppressWarnings("boxing")
public OSGiPackage(CompositeData data) {
- this((String) data.get(PackageStateMBean.NAME), (String) data
- .get(PackageStateMBean.VERSION), (Boolean) data
- .get(PackageStateMBean.REMOVAL_PENDING),
- longArrayFrom((Long[]) data
- .get(PackageStateMBean.EXPORTING_BUNDLES)),
- longArrayFrom((Long[]) data
- .get(PackageStateMBean.IMPORTING_BUNDLES)));
+ this((String) data.get(PackageStateMBean.NAME), (String) data.get(PackageStateMBean.VERSION),
+ (Boolean) data.get(PackageStateMBean.REMOVAL_PENDING),
+ longArrayFrom((Long[]) data.get(PackageStateMBean.EXPORTING_BUNDLES)),
+ longArrayFrom((Long[]) data.get(PackageStateMBean.IMPORTING_BUNDLES)));
}
/**
@@ -90,10 +87,8 @@
* - the <link>ExporetedPackage</link>
*/
public OSGiPackage(ExportedPackage pkg) {
- this(pkg.getName(), pkg.getVersion().toString(),
- pkg.isRemovalPending(), new long[] { pkg.getExportingBundle()
- .getBundleId() }, Util.bundleIds(pkg
- .getImportingBundles()));
+ this(pkg.getName(), pkg.getVersion().toString(), pkg.isRemovalPending(),
+ new long[] { pkg.getExportingBundle().getBundleId() }, Util.bundleIds(pkg.getImportingBundles()));
}
/**
@@ -105,8 +100,7 @@
* @param exportingBundles
* @param importingBundles
*/
- public OSGiPackage(String name, String version, boolean removalPending,
- long[] exportingBundles, long[] importingBundles) {
+ public OSGiPackage(String name, String version, boolean removalPending, long[] exportingBundles, long[] importingBundles) {
this.name = name;
this.version = version;
this.removalPending = removalPending;
@@ -121,8 +115,7 @@
* @return the tabular data representation of the OSGPacakges
*/
public static TabularData tableFrom(Set<OSGiPackage> packages) {
- TabularDataSupport table = new TabularDataSupport(
- PackageStateMBean.PACKAGES_TYPE);
+ TabularDataSupport table = new TabularDataSupport(PackageStateMBean.PACKAGES_TYPE);
for (OSGiPackage pkg : packages) {
table.put(pkg.asCompositeData());
}
@@ -140,14 +133,11 @@
items.put(PackageStateMBean.NAME, name);
items.put(PackageStateMBean.VERSION, version);
items.put(PackageStateMBean.REMOVAL_PENDING, removalPending);
- items.put(PackageStateMBean.EXPORTING_BUNDLES,
- LongArrayFrom(exportingBundles));
- items.put(PackageStateMBean.IMPORTING_BUNDLES,
- LongArrayFrom(importingBundles));
+ items.put(PackageStateMBean.EXPORTING_BUNDLES, LongArrayFrom(exportingBundles));
+ items.put(PackageStateMBean.IMPORTING_BUNDLES, LongArrayFrom(importingBundles));
try {
- return new CompositeDataSupport(PackageStateMBean.PACKAGE_TYPE,
- items);
+ return new CompositeDataSupport(PackageStateMBean.PACKAGE_TYPE, items);
} catch (OpenDataException e) {
throw new IllegalStateException("Cannot form package open data", e);
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiService.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiService.java
index dcb4a57..013f6d8 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiService.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiService.java
@@ -72,9 +72,9 @@
*/
public OSGiService(CompositeData data) {
this((Long) data.get(ServiceStateMBean.IDENTIFIER),
- (String[]) data.get(ServiceStateMBean.OBJECT_CLASS),
- (Long) data.get(ServiceStateMBean.BUNDLE_IDENTIFIER),
- longArrayFrom((Long[]) data.get(ServiceStateMBean.USING_BUNDLES)));
+ (String[]) data.get(ServiceStateMBean.OBJECT_CLASS),
+ (Long) data.get(ServiceStateMBean.BUNDLE_IDENTIFIER),
+ longArrayFrom((Long[]) data.get(ServiceStateMBean.USING_BUNDLES)));
}
/**
@@ -102,10 +102,8 @@
*/
@SuppressWarnings("boxing")
public OSGiService(ServiceReference<?> reference) {
- this((Long) reference.getProperty(SERVICE_ID),
- (String[]) reference.getProperty(OBJECTCLASS),
- reference.getBundle().getBundleId(),
- Util.bundleIds(reference.getUsingBundles()));
+ this((Long) reference.getProperty(SERVICE_ID), (String[]) reference.getProperty(OBJECTCLASS),
+ reference.getBundle().getBundleId(), Util.bundleIds(reference.getUsingBundles()));
}
/**
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiServiceEvent.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiServiceEvent.java
index 645183d..2748848 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiServiceEvent.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/framework/codec/OSGiServiceEvent.java
@@ -72,8 +72,7 @@
serviceId = (Long) data.get(ServiceStateMBean.IDENTIFIER);
bundleId = (Long) data.get(ServiceStateMBean.BUNDLE_IDENTIFIER);
location = (String) data.get(ServiceStateMBean.BUNDLE_LOCATION);
- symbolicName = (String) data
- .get(ServiceStateMBean.BUNDLE_SYMBOLIC_NAME);
+ symbolicName = (String) data.get(ServiceStateMBean.BUNDLE_SYMBOLIC_NAME);
interfaces = (String[]) data.get(ServiceStateMBean.OBJECT_CLASS);
eventType = (Integer) data.get(ServiceStateMBean.EVENT);
}
@@ -88,8 +87,7 @@
* @param interfaces
* @param eventType
*/
- public OSGiServiceEvent(long serviceId, long bundleId, String location,
- String symbolicName, String[] interfaces, int eventType) {
+ public OSGiServiceEvent(long serviceId, long bundleId, String location, String symbolicName, String[] interfaces, int eventType) {
this.serviceId = serviceId;
this.bundleId = bundleId;
this.location = location;
@@ -107,12 +105,11 @@
*/
@SuppressWarnings("boxing")
public OSGiServiceEvent(ServiceEvent event) {
- this((Long) event.getServiceReference().getProperty(
- Constants.SERVICE_ID), event.getServiceReference().getBundle()
- .getBundleId(), event.getServiceReference().getBundle()
- .getLocation(), event.getServiceReference().getBundle()
- .getSymbolicName(), (String[]) event.getServiceReference()
- .getProperty(Constants.OBJECTCLASS), event.getType());
+ this((Long) event.getServiceReference().getProperty(Constants.SERVICE_ID),
+ event.getServiceReference().getBundle().getBundleId(),
+ event.getServiceReference().getBundle().getLocation(),
+ event.getServiceReference().getBundle().getSymbolicName(),
+ (String[]) event.getServiceReference().getProperty(Constants.OBJECTCLASS), event.getType());
}
/**
@@ -132,11 +129,9 @@
items.put(ServiceStateMBean.EVENT, eventType);
try {
- return new CompositeDataSupport(
- ServiceStateMBean.SERVICE_EVENT_TYPE, items);
+ return new CompositeDataSupport(ServiceStateMBean.SERVICE_EVENT_TYPE, items);
} catch (OpenDataException e) {
- throw new IllegalStateException(
- "Cannot form service event open data", e);
+ throw new IllegalStateException("Cannot form service event open data", e);
}
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/permissionadmin/PermissionManager.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/permissionadmin/PermissionManager.java
index c1a7f2e..d5f164c 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/permissionadmin/PermissionManager.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/permissionadmin/PermissionManager.java
@@ -32,21 +32,15 @@
this.admin = admin;
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.PermissionManagerMBean#listLocations()
+ /**
+ * {@inheritDoc}
*/
public String[] listLocations() throws IOException {
return admin.getLocations();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.PermissionManagerMBean#getPermissions(java.lang
- * .String)
+ /**
+ * {@inheritDoc}
*/
public String[] getPermissions(String location) throws IOException {
if (location == null) {
@@ -64,15 +58,10 @@
return encodedPermissions;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.PermissionManagerMBean#setDefaultPermissions(
- * java.lang.String[])
+ /**
+ * {@inheritDoc}
*/
- public void setDefaultPermissions(String[] encodedPermissions)
- throws IOException {
+ public void setDefaultPermissions(String[] encodedPermissions) throws IOException {
if (encodedPermissions == null) {
throw new IOException("Encoded permissions must not be null");
}
@@ -82,8 +71,7 @@
try {
permissions[i] = new PermissionInfo(encodedPermission);
} catch (Throwable e) {
- IOException iox = new IOException(
- "Invalid encoded permission: " + encodedPermission);
+ IOException iox = new IOException("Invalid encoded permission: " + encodedPermission);
iox.initCause(e);
throw iox;
}
@@ -91,11 +79,8 @@
admin.setDefaultPermissions(permissions);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.PermissionManagerMBean#listDefaultPermissions()
+ /**
+ * {@inheritDoc}
*/
public String[] listDefaultPermissions() throws IOException {
PermissionInfo[] permissions = admin.getDefaultPermissions();
@@ -110,15 +95,10 @@
return encodedPermissions;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.PermissionManagerMBean#setPermissions(java.lang
- * .String, java.lang.String[])
+ /**
+ * {@inheritDoc}
*/
- public void setPermissions(String location, String[] encodedPermissions)
- throws IOException {
+ public void setPermissions(String location, String[] encodedPermissions) throws IOException {
if (location == null) {
throw new IOException("Location must not be null");
}
@@ -131,8 +111,7 @@
try {
permissions[i] = new PermissionInfo(encodedPermission);
} catch (Throwable e) {
- IOException iox = new IOException(
- "Invalid encoded permission: " + encodedPermission);
+ IOException iox = new IOException("Invalid encoded permission: " + encodedPermission);
iox.initCause(e);
throw iox;
}
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/provisioning/Provisioning.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/provisioning/Provisioning.java
index c13daaf..1467156 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/provisioning/Provisioning.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/provisioning/Provisioning.java
@@ -37,12 +37,8 @@
this.provisioning = provisioning;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ProvisioningMBean#addInformation(java.lang.String
- * )
+ /**
+ * {@inheritDoc}
*/
public void addInformationFromZip(String zipURL) throws IOException {
InputStream is = new URL(zipURL).openStream();
@@ -54,32 +50,22 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ProvisioningMBean#addInformation(javax.management
- * .openmbean.TabularData)
+ /**
+ * {@inheritDoc}
*/
public void addInformation(TabularData info) throws IOException {
provisioning.addInformation(propertiesFrom(info));
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.ProvisioningMBean#listInformation()
+ /**
+ * {@inheritDoc}
*/
public TabularData listInformation() throws IOException {
return tableFrom(provisioning.getInformation());
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.ProvisioningMBean#setInformation(javax.management
- * .openmbean.TabularData)
+ /**
+ * {@inheritDoc}
*/
public void setInformation(TabularData info) throws IOException {
provisioning.setInformation(propertiesFrom(info));
diff --git a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/useradmin/UserManager.java b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/useradmin/UserManager.java
index 2f2015c..b38d641 100644
--- a/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/useradmin/UserManager.java
+++ b/org.eclipse.gemini.mgmt/src/org/eclipse/gemini/mgmt/useradmin/UserManager.java
@@ -46,16 +46,11 @@
this.admin = admin;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#addCredential(java.lang.String,
- * byte[], java.lang.String)
+ /**
+ * {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public void addCredential(String key, byte[] value, String username)
- throws IOException {
+ public void addCredential(String key, byte[] value, String username) throws IOException {
if (username == null) {
throw new IOException("User name must not be null");
}
@@ -74,16 +69,11 @@
user.getCredentials().put(key, value);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#addCredential(java.lang.String,
- * java.lang.String, java.lang.String)
+ /**
+ * {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public void addCredentialString(String key, String value, String username)
- throws IOException {
+ public void addCredentialString(String key, String value, String username) throws IOException {
if (username == null) {
throw new IOException("User name must not be null");
}
@@ -102,14 +92,10 @@
user.getCredentials().put(key, value);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#addMember(java.lang.String,
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public boolean addMember(String groupname, String rolename)
- throws IOException {
+ public boolean addMember(String groupname, String rolename) throws IOException {
if (groupname == null) {
throw new IOException("Group name must not be null");
}
@@ -127,16 +113,11 @@
return group.getType() == Role.GROUP && ((Group) group).addMember(role);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#addProperty(java.lang.String,
- * byte[], java.lang.String)
+ /**
+ * {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public void addProperty(String key, byte[] value, String rolename)
- throws IOException {
+ public void addProperty(String key, byte[] value, String rolename) throws IOException {
if (rolename == null) {
throw new IOException("Role name must not be null");
}
@@ -150,16 +131,11 @@
role.getProperties().put(key, value);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#addProperty(java.lang.String,
- * java.lang.String, java.lang.String)
+ /**
+ * {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public void addPropertyString(String key, String value, String rolename)
- throws IOException {
+ public void addPropertyString(String key, String value, String rolename) throws IOException {
if (rolename == null) {
throw new IOException("Role name must not be null");
}
@@ -173,15 +149,10 @@
role.getProperties().put(key, value);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#addRequiredMember(java.lang.
- * String, java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public boolean addRequiredMember(String groupname, String rolename)
- throws IOException {
+ public boolean addRequiredMember(String groupname, String rolename) throws IOException {
if (groupname == null) {
throw new IOException("Group name must not be null");
}
@@ -193,15 +164,11 @@
if (role == null) {
throw new IOException("Role does not exist: " + rolename);
}
- return group.getType() == Role.GROUP
- && ((Group) group).addRequiredMember(role);
+ return group.getType() == Role.GROUP && ((Group) group).addRequiredMember(role);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#createGroup(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public void createGroup(String name) throws IOException {
if (name == null) {
@@ -210,11 +177,8 @@
admin.createRole(name, Role.GROUP);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#createUser(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public void createUser(String name) throws IOException {
if (name == null) {
@@ -223,23 +187,15 @@
admin.createRole(name, Role.USER);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#createRole(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public void createRole(String name) throws IOException {
- throw new UnsupportedOperationException(
- "This method is deprecated and does not work");
+ throw new UnsupportedOperationException("This method is deprecated and does not work");
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#getAuthorization(java.lang.String
- * )
+ /**
+ * {@inheritDoc}
*/
public CompositeData getAuthorization(String u) throws IOException {
if (u == null) {
@@ -252,18 +208,14 @@
throw new IOException("Not a user: " + u);
}
try {
- return new OSGiAuthorization(admin.getAuthorization(user))
- .asCompositeData();
+ return new OSGiAuthorization(admin.getAuthorization(user)).asCompositeData();
} catch (OpenDataException e) {
throw new IOException("Unable to create open data type: " + e);
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#getCredentials(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public TabularData getCredentials(String username) throws IOException {
if (username == null) {
@@ -281,10 +233,8 @@
return OSGiProperties.tableFrom(user.getCredentials());
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#getGroup(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public CompositeData getGroup(String groupname) throws IOException {
if (groupname == null) {
@@ -303,18 +253,15 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#listGroups()
+ /**
+ * {@inheritDoc}
*/
public String[] listGroups() throws IOException {
Role[] roles;
try {
roles = admin.getRoles(null);
} catch (InvalidSyntaxException e) {
- throw new IllegalStateException(
- "Cannot use null filter, apparently: " + e);
+ throw new IllegalStateException("Cannot use null filter, apparently: " + e);
}
ArrayList<String> groups = new ArrayList<String>();
for (Role role : roles) {
@@ -325,10 +272,8 @@
return groups.toArray(new String[groups.size()]);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#getGroups(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public String[] getGroups(String filter) throws IOException {
Role[] roles;
@@ -346,12 +291,8 @@
return groups.toArray(new String[groups.size()]);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#getImpliedRoles(java.lang.String
- * )
+ /**
+ * {@inheritDoc}
*/
public String[] getImpliedRoles(String username) throws IOException {
if (username == null) {
@@ -365,11 +306,8 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#getMembers(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public String[] getMembers(String groupname) throws IOException {
if (groupname == null) {
@@ -392,11 +330,8 @@
return names;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#getProperties(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public TabularData getProperties(String rolename) throws IOException {
if (rolename == null) {
@@ -409,12 +344,8 @@
return OSGiProperties.tableFrom(role.getProperties());
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#getRequiredMembers(java.lang
- * .String)
+ /**
+ * {@inheritDoc}
*/
public String[] getRequiredMembers(String groupname) throws IOException {
if (groupname == null) {
@@ -437,10 +368,8 @@
return names;
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#getRole(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public CompositeData getRole(String name) throws IOException {
if (name == null) {
@@ -454,18 +383,15 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#listRoles()
+ /**
+ * {@inheritDoc}
*/
public String[] listRoles() throws IOException {
Role[] roles;
try {
roles = admin.getRoles(null);
} catch (InvalidSyntaxException e) {
- throw new IllegalStateException(
- "Cannot use null filter, apparently: " + e);
+ throw new IllegalStateException("Cannot use null filter, apparently: " + e);
}
String[] result = new String[roles.length];
for (int i = 0; i < roles.length; i++) {
@@ -474,10 +400,8 @@
return result;
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#getRoles(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public String[] getRoles(String filter) throws IOException {
Role[] roles;
@@ -493,10 +417,8 @@
return result;
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#getUser(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public CompositeData getUser(String username) throws IOException {
if (username == null) {
@@ -515,14 +437,10 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#getUser(java.lang.String,
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public String getUserWithProperty(String key, String value)
- throws IOException {
+ public String getUserWithProperty(String key, String value) throws IOException {
if (key == null) {
throw new IOException("Name must not be null");
}
@@ -530,18 +448,15 @@
return user == null ? null : user.getName();
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#listUsers()
+ /**
+ * {@inheritDoc}
*/
public String[] listUsers() throws IOException {
Role[] roles;
try {
roles = admin.getRoles(null);
} catch (InvalidSyntaxException e) {
- throw new IllegalStateException(
- "Cannot use null filter, apparently: " + e);
+ throw new IllegalStateException("Cannot use null filter, apparently: " + e);
}
ArrayList<String> groups = new ArrayList<String>();
for (Role role : roles) {
@@ -552,10 +467,8 @@
return groups.toArray(new String[groups.size()]);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.compendium.UserManagerMBean#getUsers(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public String[] getUsers(String filter) throws IOException {
Role[] roles;
@@ -573,15 +486,10 @@
return groups.toArray(new String[groups.size()]);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#removeCredential(java.lang.String
- * , java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public void removeCredential(String key, String username)
- throws IOException {
+ public void removeCredential(String key, String username) throws IOException {
if (username == null || username.length() == 0) {
throw new IOException("Name must not be null or empty");
}
@@ -600,15 +508,10 @@
user.getCredentials().remove(key);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#removeMember(java.lang.String,
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
- public boolean removeMember(String groupname, String rolename)
- throws IOException {
+ public boolean removeMember(String groupname, String rolename) throws IOException {
if (groupname == null) {
throw new IOException("Group name must not be null");
}
@@ -631,12 +534,8 @@
return group.removeMember(role);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#removeProperty(java.lang.String,
- * java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public void removeProperty(String key, String rolename) throws IOException {
if (rolename == null) {
@@ -649,11 +548,8 @@
role.getProperties().remove(key);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#removeRole(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public boolean removeRole(String name) throws IOException {
if (name == null) {
@@ -662,11 +558,8 @@
return admin.removeRole(name);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#removeUser(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public boolean removeUser(String name) throws IOException {
if (name == null) {
@@ -675,11 +568,8 @@
return admin.removeRole(name);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.osgi.jmx.compendium.UserManagerMBean#removeGroup(java.lang.String)
+ /**
+ * {@inheritDoc}
*/
public boolean removeGroup(String name) throws IOException {
if (name == null) {
@@ -688,26 +578,20 @@
return admin.removeRole(name);
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.Monitor#addListener()
+ /**
+ * {@inheritDoc}
*/
@Override
protected void addListener() {
- // TODO Auto-generated method stub
-
+
}
- /*
- * (non-Javadoc)
- *
- * @see org.osgi.jmx.core.Monitor#removeListener()
+ /**
+ * {@inheritDoc}
*/
@Override
protected void removeListener() {
- // TODO Auto-generated method stub
-
+
}
}