Author: davidb
Date: Fri Dec 2 20:03:21 2011
New Revision: 1209675
URL: http://svn.apache.org/viewvc?rev=1209675&view=rev
Log:
Refactor part 5
Added:
aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleWiringStateMBean.java
(contents, props changed)
- copied, changed from r1209655,
aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleRevisionsStateMBean.java
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringState.java
(contents, props changed)
- copied, changed from r1209659,
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsState.java
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanHandler.java
(contents, props changed)
- copied, changed from r1209661,
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsStateMBeanHandler.java
Removed:
aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleRevisionsStateMBean.java
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsState.java
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsStateMBeanHandler.java
Modified:
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java
aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleRevisionsStateMBeanTest.java
Copied:
aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleWiringStateMBean.java
(from r1209655,
aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleRevisionsStateMBean.java)
URL:
http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleWiringStateMBean.java?p2=aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleWiringStateMBean.java&p1=aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleRevisionsStateMBean.java&r1=1209655&r2=1209675&rev=1209675&view=diff
==============================================================================
---
aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleRevisionsStateMBean.java
(original)
+++
aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleWiringStateMBean.java
Fri Dec 2 20:03:21 2011
@@ -35,7 +35,7 @@ import org.osgi.jmx.JmxConstants;
* Particularly, the limitations are:
* - Cannot retrieve references to resources (e.g. class) of a particular
bundle wiring.
*/
-public interface BundleRevisionsStateMBean {
+public interface BundleWiringStateMBean {
/*
* The Object Name for a Bundle Revisions MBean.
*/
@@ -202,8 +202,8 @@ public interface BundleRevisionsStateMBe
TabularType BUNDLE_WIRING_CLOSURE_TYPE =
Item.tabularType("BUNDLE_WIRING_CLOSURE",
"A table of bundle wirings describing a full wiring closure",
- BundleRevisionsStateMBean.BUNDLE_WIRING_TYPE,
- BundleRevisionsStateMBean.BUNDLE_ID,
BundleRevisionsStateMBean.BUNDLE_REVISION_ID);
+ BundleWiringStateMBean.BUNDLE_WIRING_TYPE,
+ BundleWiringStateMBean.BUNDLE_ID,
BundleWiringStateMBean.BUNDLE_REVISION_ID);
/**
* Returns the requirements for the current bundle revision.
Propchange:
aries/trunk/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/wiring/BundleWiringStateMBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
URL:
http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java?rev=1209675&r1=1209674&r2=1209675&view=diff
==============================================================================
---
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
(original)
+++
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/agent/JMXAgentImpl.java
Fri Dec 2 20:03:21 2011
@@ -39,7 +39,7 @@ import org.apache.aries.jmx.framework.Bu
import org.apache.aries.jmx.framework.FrameworkMBeanHandler;
import org.apache.aries.jmx.framework.PackageStateMBeanHandler;
import org.apache.aries.jmx.framework.ServiceStateMBeanHandler;
-import org.apache.aries.jmx.framework.wiring.BundleRevisionsStateMBeanHandler;
+import org.apache.aries.jmx.framework.wiring.BundleWiringStateMBeanHandler;
import org.apache.aries.jmx.permissionadmin.PermissionAdminMBeanHandler;
import org.apache.aries.jmx.provisioning.ProvisioningServiceMBeanHandler;
import org.apache.aries.jmx.useradmin.UserAdminMBeanHandler;
@@ -94,7 +94,7 @@ public class JMXAgentImpl implements JMX
MBeanHandler bundleStateHandler = new BundleStateMBeanHandler(bc,
logger);
bundleStateHandler.open();
mbeansHandlers.add(bundleStateHandler);
- MBeanHandler revisionsStateHandler = new
BundleRevisionsStateMBeanHandler(bc, logger);
+ MBeanHandler revisionsStateHandler = new
BundleWiringStateMBeanHandler(bc, logger);
revisionsStateHandler.open();
mbeansHandlers.add(revisionsStateHandler);
MBeanHandler serviceStateHandler = new ServiceStateMBeanHandler(bc,
logger);
Modified:
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java
URL:
http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java?rev=1209675&r1=1209674&r2=1209675&view=diff
==============================================================================
---
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java
(original)
+++
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java
Fri Dec 2 20:03:21 2011
@@ -32,7 +32,7 @@ import org.osgi.framework.wiring.BundleC
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWire;
-import org.osgi.jmx.framework.wiring.BundleRevisionsStateMBean;
+import org.osgi.jmx.framework.wiring.BundleWiringStateMBean;
public class BundleWiringData {
private final long bundleId;
@@ -57,15 +57,15 @@ public class BundleWiringData {
public CompositeData toCompositeData() {
try {
Map<String, Object> items = new HashMap<String, Object>();
- items.put(BundleRevisionsStateMBean.BUNDLE_ID, bundleId);
- items.put(BundleRevisionsStateMBean.BUNDLE_REVISION_ID,
revisionId);
+ items.put(BundleWiringStateMBean.BUNDLE_ID, bundleId);
+ items.put(BundleWiringStateMBean.BUNDLE_REVISION_ID, revisionId);
- items.put(BundleRevisionsStateMBean.REQUIREMENTS,
getRequirements());
- items.put(BundleRevisionsStateMBean.CAPABILITIES,
getCapabilities());
- items.put(BundleRevisionsStateMBean.REQUIRED_WIRES,
getRequiredWires());
- items.put(BundleRevisionsStateMBean.PROVIDED_WIRES,
getProvidedWires());
+ items.put(BundleWiringStateMBean.REQUIREMENTS, getRequirements());
+ items.put(BundleWiringStateMBean.CAPABILITIES, getCapabilities());
+ items.put(BundleWiringStateMBean.REQUIRED_WIRES,
getRequiredWires());
+ items.put(BundleWiringStateMBean.PROVIDED_WIRES,
getProvidedWires());
- return new
CompositeDataSupport(BundleRevisionsStateMBean.BUNDLE_WIRING_TYPE, items);
+ return new
CompositeDataSupport(BundleWiringStateMBean.BUNDLE_WIRING_TYPE, items);
} catch (OpenDataException e) {
throw new IllegalStateException("Can't create CompositeData", e);
}
@@ -75,7 +75,7 @@ public class BundleWiringData {
CompositeData[] capData = new CompositeData[capabilities.size()];
for (int i=0; i < capabilities.size(); i++) {
BundleCapability capability = capabilities.get(i);
- capData[i] =
getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_CAPABILITY_TYPE,
+ capData[i] =
getCapReqCompositeData(BundleWiringStateMBean.BUNDLE_CAPABILITY_TYPE,
capability.getNamespace(),
capability.getAttributes().entrySet(), capability.getDirectives().entrySet());
}
return capData;
@@ -85,7 +85,7 @@ public class BundleWiringData {
CompositeData [] reqData = new CompositeData[requirements.size()];
for (int i=0; i < requirements.size(); i++) {
BundleRequirement requirement = requirements.get(i);
- reqData[i] =
getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT_TYPE,
+ reqData[i] =
getCapReqCompositeData(BundleWiringStateMBean.BUNDLE_REQUIREMENT_TYPE,
requirement.getNamespace(),
requirement.getAttributes().entrySet(), requirement.getDirectives().entrySet());
}
return reqData;
@@ -98,7 +98,7 @@ public class BundleWiringData {
for (int i=0; i < bundleCapabilities.size(); i++) {
BundleCapability requirement = bundleCapabilities.get(i);
- CompositeData cd =
BundleWiringData.getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_CAPABILITY_TYPE,
+ CompositeData cd =
BundleWiringData.getCapReqCompositeData(BundleWiringStateMBean.BUNDLE_CAPABILITY_TYPE,
requirement.getNamespace(),
requirement.getAttributes().entrySet(), requirement.getDirectives().entrySet());
data[i] = cd;
}
@@ -116,7 +116,7 @@ public class BundleWiringData {
for (int i=0; i < bundleRequirements.size(); i++) {
BundleRequirement requirement = bundleRequirements.get(i);
- CompositeData cd =
BundleWiringData.getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT_TYPE,
+ CompositeData cd =
BundleWiringData.getCapReqCompositeData(BundleWiringStateMBean.BUNDLE_REQUIREMENT_TYPE,
requirement.getNamespace(),
requirement.getAttributes().entrySet(), requirement.getDirectives().entrySet());
data[i] = cd;
}
@@ -130,22 +130,22 @@ public class BundleWiringData {
private static CompositeData getCapReqCompositeData(CompositeType type,
String namespace, Set<Map.Entry<String,Object>> attributeSet,
Set<Map.Entry<String,String>> directiveSet) throws OpenDataException {
Map<String, Object> reqItems = new HashMap<String, Object>();
- TabularData attributes = new
TabularDataSupport(BundleRevisionsStateMBean.ATTRIBUTES_TYPE);
+ TabularData attributes = new
TabularDataSupport(BundleWiringStateMBean.ATTRIBUTES_TYPE);
for (Map.Entry<String, Object> entry : attributeSet) {
PropertyData<?> pd = PropertyData.newInstance(entry.getKey(),
entry.getValue());
attributes.put(pd.toCompositeData());
}
- reqItems.put(BundleRevisionsStateMBean.ATTRIBUTES, attributes);
+ reqItems.put(BundleWiringStateMBean.ATTRIBUTES, attributes);
- TabularData directives = new
TabularDataSupport(BundleRevisionsStateMBean.DIRECTIVES_TYPE);
+ TabularData directives = new
TabularDataSupport(BundleWiringStateMBean.DIRECTIVES_TYPE);
for (Map.Entry<String, String> entry : directiveSet) {
- CompositeData directive = new
CompositeDataSupport(BundleRevisionsStateMBean.DIRECTIVE_TYPE,
- new String[] { BundleRevisionsStateMBean.KEY,
BundleRevisionsStateMBean.VALUE },
+ CompositeData directive = new
CompositeDataSupport(BundleWiringStateMBean.DIRECTIVE_TYPE,
+ new String[] { BundleWiringStateMBean.KEY,
BundleWiringStateMBean.VALUE },
new Object[] { entry.getKey(), entry.getValue() });
directives.put(directive);
}
- reqItems.put(BundleRevisionsStateMBean.DIRECTIVES, directives);
- reqItems.put(BundleRevisionsStateMBean.NAMESPACE, namespace);
+ reqItems.put(BundleWiringStateMBean.DIRECTIVES, directives);
+ reqItems.put(BundleWiringStateMBean.NAMESPACE, namespace);
CompositeData req = new CompositeDataSupport(type, reqItems);
return req;
@@ -166,21 +166,21 @@ public class BundleWiringData {
Map<String, Object> wireItems = new HashMap<String, Object>();
BundleCapability capability = requiredWire.getCapability();
- wireItems.put(BundleRevisionsStateMBean.PROVIDER_BUNDLE_ID,
capability.getRevision().getBundle().getBundleId());
-
wireItems.put(BundleRevisionsStateMBean.PROVIDER_BUNDLE_REVISION_ID,
revisionIDMap.get(capability.getRevision()));
- wireItems.put(BundleRevisionsStateMBean.BUNDLE_CAPABILITY,
-
getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_CAPABILITY_TYPE,
+ wireItems.put(BundleWiringStateMBean.PROVIDER_BUNDLE_ID,
capability.getRevision().getBundle().getBundleId());
+ wireItems.put(BundleWiringStateMBean.PROVIDER_BUNDLE_REVISION_ID,
revisionIDMap.get(capability.getRevision()));
+ wireItems.put(BundleWiringStateMBean.BUNDLE_CAPABILITY,
+
getCapReqCompositeData(BundleWiringStateMBean.BUNDLE_CAPABILITY_TYPE,
capability.getNamespace(),
capability.getAttributes().entrySet(), capability.getDirectives().entrySet()));
BundleRequirement requirement = requiredWire.getRequirement();
- wireItems.put(BundleRevisionsStateMBean.REQUIRER_BUNDLE_ID,
requirement.getRevision().getBundle().getBundleId());
-
wireItems.put(BundleRevisionsStateMBean.REQUIRER_BUNDLE_REVISION_ID,
revisionIDMap.get(requirement.getRevision()));
+ wireItems.put(BundleWiringStateMBean.REQUIRER_BUNDLE_ID,
requirement.getRevision().getBundle().getBundleId());
+ wireItems.put(BundleWiringStateMBean.REQUIRER_BUNDLE_REVISION_ID,
revisionIDMap.get(requirement.getRevision()));
- wireItems.put(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT,
-
getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT_TYPE,
+ wireItems.put(BundleWiringStateMBean.BUNDLE_REQUIREMENT,
+
getCapReqCompositeData(BundleWiringStateMBean.BUNDLE_REQUIREMENT_TYPE,
requirement.getNamespace(),
requirement.getAttributes().entrySet(),
requirement.getDirectives().entrySet()));
- CompositeData wireData = new
CompositeDataSupport(BundleRevisionsStateMBean.BUNDLE_WIRE_TYPE, wireItems);
+ CompositeData wireData = new
CompositeDataSupport(BundleWiringStateMBean.BUNDLE_WIRE_TYPE, wireItems);
reqWiresData[i] = wireData;
}
return reqWiresData;
Copied:
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringState.java
(from r1209659,
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsState.java)
URL:
http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringState.java?p2=aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringState.java&p1=aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsState.java&r1=1209659&r2=1209675&rev=1209675&view=diff
==============================================================================
---
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsState.java
(original)
+++
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringState.java
Fri Dec 2 20:03:21 2011
@@ -37,14 +37,14 @@ import org.osgi.framework.wiring.BundleR
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.jmx.framework.wiring.BundleRevisionsStateMBean;
+import org.osgi.jmx.framework.wiring.BundleWiringStateMBean;
-public class BundleRevisionsState implements BundleRevisionsStateMBean {
+public class BundleWiringState implements BundleWiringStateMBean {
private final BundleContext bundleContext;
private final Logger logger;
- public BundleRevisionsState(BundleContext bundleContext, Logger logger) {
+ public BundleWiringState(BundleContext bundleContext, Logger logger) {
this.bundleContext = bundleContext;
this.logger = logger;
}
@@ -83,7 +83,7 @@ public class BundleRevisionsState implem
public TabularData getCurrentWiringClosure(long rootBundleId, String
namespace) throws IOException {
Map<BundleRevision, Integer> revisionIDMap =
getCurrentRevisionTransitiveRevisionsClosure(rootBundleId, namespace);
- TabularData td = new
TabularDataSupport(BundleRevisionsStateMBean.BUNDLE_WIRING_CLOSURE_TYPE);
+ TabularData td = new
TabularDataSupport(BundleWiringStateMBean.BUNDLE_WIRING_CLOSURE_TYPE);
for (Map.Entry<BundleRevision, Integer> entry :
revisionIDMap.entrySet()) {
td.put(getRevisionWiring(entry.getKey(), entry.getValue(),
namespace, revisionIDMap));
}
Propchange:
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringState.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied:
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanHandler.java
(from r1209661,
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsStateMBeanHandler.java)
URL:
http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanHandler.java?p2=aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanHandler.java&p1=aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsStateMBeanHandler.java&r1=1209661&r2=1209675&rev=1209675&view=diff
==============================================================================
---
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleRevisionsStateMBeanHandler.java
(original)
+++
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanHandler.java
Fri Dec 2 20:03:21 2011
@@ -23,32 +23,32 @@ import org.apache.aries.jmx.Logger;
import org.apache.aries.jmx.MBeanHandler;
import org.apache.aries.jmx.util.shared.RegistrableStandardEmitterMBean;
import org.osgi.framework.BundleContext;
-import org.osgi.jmx.framework.wiring.BundleRevisionsStateMBean;
+import org.osgi.jmx.framework.wiring.BundleWiringStateMBean;
import org.osgi.service.log.LogService;
-public class BundleRevisionsStateMBeanHandler implements MBeanHandler {
+public class BundleWiringStateMBeanHandler implements MBeanHandler {
private final String name;
private final BundleContext bundleContext;
private final Logger logger;
private StandardMBean mbean;
- private BundleRevisionsState revisionsStateMBean;
+ private BundleWiringState revisionsStateMBean;
- public BundleRevisionsStateMBeanHandler(BundleContext bundleContext,
Logger logger) {
+ public BundleWiringStateMBeanHandler(BundleContext bundleContext, Logger
logger) {
this.bundleContext = bundleContext;
this.logger = logger;
- this.name = BundleRevisionsStateMBean.OBJECTNAME;
+ this.name = BundleWiringStateMBean.OBJECTNAME;
}
/* (non-Javadoc)
* @see org.apache.aries.jmx.MBeanHandler#open()
*/
public void open() {
- revisionsStateMBean = new BundleRevisionsState(bundleContext, logger);
+ revisionsStateMBean = new BundleWiringState(bundleContext, logger);
try {
- mbean = new RegistrableStandardEmitterMBean(revisionsStateMBean,
BundleRevisionsStateMBean.class);
+ mbean = new RegistrableStandardEmitterMBean(revisionsStateMBean,
BundleWiringStateMBean.class);
} catch (NotCompliantMBeanException e) {
- logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for
" + BundleRevisionsStateMBean.class.getName(), e);
+ logger.log(LogService.LOG_ERROR, "Failed to instantiate MBean for
" + BundleWiringStateMBean.class.getName(), e);
}
}
Propchange:
aries/trunk/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/wiring/BundleWiringStateMBeanHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleRevisionsStateMBeanTest.java
URL:
http://svn.apache.org/viewvc/aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleRevisionsStateMBeanTest.java?rev=1209675&r1=1209674&r2=1209675&view=diff
==============================================================================
---
aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleRevisionsStateMBeanTest.java
(original)
+++
aries/trunk/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleRevisionsStateMBeanTest.java
Fri Dec 2 20:03:21 2011
@@ -52,7 +52,7 @@ import org.osgi.framework.wiring.BundleR
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
import org.osgi.jmx.framework.PackageStateMBean;
-import org.osgi.jmx.framework.wiring.BundleRevisionsStateMBean;
+import org.osgi.jmx.framework.wiring.BundleWiringStateMBean;
public class BundleRevisionsStateMBeanTest extends AbstractIntegrationTest {
@Configuration
@@ -119,33 +119,33 @@ public class BundleRevisionsStateMBeanTe
@Test
public void testGetCurrentRevisionDeclaredRequirements() throws
IOException {
- BundleRevisionsStateMBean brsMBean =
getMBean(BundleRevisionsStateMBean.OBJECTNAME, BundleRevisionsStateMBean.class);
+ BundleWiringStateMBean brsMBean =
getMBean(BundleWiringStateMBean.OBJECTNAME, BundleWiringStateMBean.class);
Bundle a =
context().getBundleByName("org.apache.aries.jmx.test.bundlea");
BundleRevision br = a.adapt(BundleRevision.class);
List<BundleRequirement> requirements =
br.getDeclaredRequirements(BundleRevision.PACKAGE_NAMESPACE);
- CompositeData[] jmxRequirements =
brsMBean.getCurrentRevisionDeclaredRequirements(a.getBundleId(),
BundleRevisionsStateMBean.PACKAGE_NAMESPACE);
+ CompositeData[] jmxRequirements =
brsMBean.getCurrentRevisionDeclaredRequirements(a.getBundleId(),
BundleWiringStateMBean.PACKAGE_NAMESPACE);
Assert.assertEquals(requirements.size(), jmxRequirements.length);
// TODO more test content
}
@Test
public void testGetCurrentWiring() throws IOException {
- BundleRevisionsStateMBean brsMBean =
getMBean(BundleRevisionsStateMBean.OBJECTNAME, BundleRevisionsStateMBean.class);
+ BundleWiringStateMBean brsMBean =
getMBean(BundleWiringStateMBean.OBJECTNAME, BundleWiringStateMBean.class);
Bundle a =
context().getBundleByName("org.apache.aries.jmx.test.bundlea");
- CompositeData jmxWiring = brsMBean.getCurrentWiring(a.getBundleId(),
BundleRevisionsStateMBean.PACKAGE_NAMESPACE);
+ CompositeData jmxWiring = brsMBean.getCurrentWiring(a.getBundleId(),
BundleWiringStateMBean.PACKAGE_NAMESPACE);
- Assert.assertEquals(BundleRevisionsStateMBean.BUNDLE_WIRING_TYPE,
jmxWiring.getCompositeType());
- Assert.assertEquals(a.getBundleId(),
jmxWiring.get(BundleRevisionsStateMBean.BUNDLE_ID));
+ Assert.assertEquals(BundleWiringStateMBean.BUNDLE_WIRING_TYPE,
jmxWiring.getCompositeType());
+ Assert.assertEquals(a.getBundleId(),
jmxWiring.get(BundleWiringStateMBean.BUNDLE_ID));
BundleWiring bw = a.adapt(BundleWiring.class);
assertBundleWiring(bw, jmxWiring);
}
private void assertBundleWiring(BundleWiring bundleWiring, CompositeData
jmxWiring) {
- CompositeData[] jmxCapabilities = (CompositeData[])
jmxWiring.get(BundleRevisionsStateMBean.CAPABILITIES);
+ CompositeData[] jmxCapabilities = (CompositeData[])
jmxWiring.get(BundleWiringStateMBean.CAPABILITIES);
List<BundleCapability> capabilities =
bundleWiring.getCapabilities(BundleRevision.PACKAGE_NAMESPACE);
Assert.assertEquals(capabilities.size(), jmxCapabilities.length);
@@ -153,7 +153,7 @@ public class BundleRevisionsStateMBeanTe
Map<Map<String, Object>, Map<String, String>> actualCapabilities =
jmxCapReqToMap(jmxCapabilities);
Assert.assertEquals(expectedCapabilities, actualCapabilities);
- CompositeData[] jmxRequirements = (CompositeData[])
jmxWiring.get(BundleRevisionsStateMBean.REQUIREMENTS);
+ CompositeData[] jmxRequirements = (CompositeData[])
jmxWiring.get(BundleWiringStateMBean.REQUIREMENTS);
List<BundleRequirement> requirements =
bundleWiring.getRequirements(BundleRevision.PACKAGE_NAMESPACE);
Assert.assertEquals(requirements.size(), jmxRequirements.length);
@@ -162,7 +162,7 @@ public class BundleRevisionsStateMBeanTe
Assert.assertEquals(expectedRequirements, actualRequirements);
List<BundleWire> requiredWires =
bundleWiring.getRequiredWires(BundleRevision.PACKAGE_NAMESPACE);
- CompositeData[] jmxRequiredWires = (CompositeData[])
jmxWiring.get(BundleRevisionsStateMBean.REQUIRED_WIRES);
+ CompositeData[] jmxRequiredWires = (CompositeData[])
jmxWiring.get(BundleWiringStateMBean.REQUIRED_WIRES);
Assert.assertEquals(requiredWires.size(), jmxRequiredWires.length);
Set<List<Object>> expectedRequiredWires = new HashSet<List<Object>>();
@@ -181,19 +181,19 @@ public class BundleRevisionsStateMBeanTe
Set<List<Object>> actualRequiredWires = new HashSet<List<Object>>();
for (CompositeData wire : jmxRequiredWires) {
List<Object> data = new ArrayList<Object>();
- data.add(wire.get(BundleRevisionsStateMBean.PROVIDER_BUNDLE_ID));
+ data.add(wire.get(BundleWiringStateMBean.PROVIDER_BUNDLE_ID));
// TODO bundle revision id
- data.add(getJmxAttributes((CompositeData)
wire.get(BundleRevisionsStateMBean.BUNDLE_CAPABILITY)));
- data.add(getJmxDirectives((CompositeData)
wire.get(BundleRevisionsStateMBean.BUNDLE_CAPABILITY)));
- data.add(wire.get(BundleRevisionsStateMBean.REQUIRER_BUNDLE_ID));
- data.add(getJmxAttributes((CompositeData)
wire.get(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT)));
- data.add(getJmxDirectives((CompositeData)
wire.get(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT)));
+ data.add(getJmxAttributes((CompositeData)
wire.get(BundleWiringStateMBean.BUNDLE_CAPABILITY)));
+ data.add(getJmxDirectives((CompositeData)
wire.get(BundleWiringStateMBean.BUNDLE_CAPABILITY)));
+ data.add(wire.get(BundleWiringStateMBean.REQUIRER_BUNDLE_ID));
+ data.add(getJmxAttributes((CompositeData)
wire.get(BundleWiringStateMBean.BUNDLE_REQUIREMENT)));
+ data.add(getJmxDirectives((CompositeData)
wire.get(BundleWiringStateMBean.BUNDLE_REQUIREMENT)));
actualRequiredWires.add(data);
}
Assert.assertEquals(expectedRequiredWires, actualRequiredWires);
List<BundleWire> providedWires =
bundleWiring.getProvidedWires(BundleRevision.PACKAGE_NAMESPACE);
- CompositeData[] jmxProvidedWires = (CompositeData [])
jmxWiring.get(BundleRevisionsStateMBean.PROVIDED_WIRES);
+ CompositeData[] jmxProvidedWires = (CompositeData [])
jmxWiring.get(BundleWiringStateMBean.PROVIDED_WIRES);
Assert.assertEquals(providedWires.size(), jmxProvidedWires.length);
HashSet<List<Object>> expectedProvidedWires = new
HashSet<List<Object>>();
@@ -211,12 +211,12 @@ public class BundleRevisionsStateMBeanTe
Set<List<Object>> actualProvidedWires = new HashSet<List<Object>>();
for (CompositeData wire : jmxProvidedWires) {
List<Object> data = new ArrayList<Object>();
- data.add(wire.get(BundleRevisionsStateMBean.PROVIDER_BUNDLE_ID));
- data.add(getJmxAttributes((CompositeData)
wire.get(BundleRevisionsStateMBean.BUNDLE_CAPABILITY)));
- data.add(getJmxDirectives((CompositeData)
wire.get(BundleRevisionsStateMBean.BUNDLE_CAPABILITY)));
- data.add(wire.get(BundleRevisionsStateMBean.REQUIRER_BUNDLE_ID));
- data.add(getJmxAttributes((CompositeData)
wire.get(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT)));
- data.add(getJmxDirectives((CompositeData)
wire.get(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT)));
+ data.add(wire.get(BundleWiringStateMBean.PROVIDER_BUNDLE_ID));
+ data.add(getJmxAttributes((CompositeData)
wire.get(BundleWiringStateMBean.BUNDLE_CAPABILITY)));
+ data.add(getJmxDirectives((CompositeData)
wire.get(BundleWiringStateMBean.BUNDLE_CAPABILITY)));
+ data.add(wire.get(BundleWiringStateMBean.REQUIRER_BUNDLE_ID));
+ data.add(getJmxAttributes((CompositeData)
wire.get(BundleWiringStateMBean.BUNDLE_REQUIREMENT)));
+ data.add(getJmxDirectives((CompositeData)
wire.get(BundleWiringStateMBean.BUNDLE_REQUIREMENT)));
actualProvidedWires.add(data);
}
Assert.assertEquals(expectedProvidedWires, actualProvidedWires);
@@ -224,10 +224,10 @@ public class BundleRevisionsStateMBeanTe
@Test
public void testCurrentWiringClosure() throws Exception {
- BundleRevisionsStateMBean brsMBean =
getMBean(BundleRevisionsStateMBean.OBJECTNAME, BundleRevisionsStateMBean.class);
+ BundleWiringStateMBean brsMBean =
getMBean(BundleWiringStateMBean.OBJECTNAME, BundleWiringStateMBean.class);
Bundle a =
context().getBundleByName("org.apache.aries.jmx.test.bundlea");
- TabularData jmxWiringClosure =
brsMBean.getCurrentWiringClosure(a.getBundleId(),
BundleRevisionsStateMBean.PACKAGE_NAMESPACE);
+ TabularData jmxWiringClosure =
brsMBean.getCurrentWiringClosure(a.getBundleId(),
BundleWiringStateMBean.PACKAGE_NAMESPACE);
CompositeData jmxWiringA = jmxWiringClosure.get(new Object []
{a.getBundleId(), 0});
assertBundleWiring(a.adapt(BundleWiring.class), jmxWiringA);
@@ -249,10 +249,10 @@ public class BundleRevisionsStateMBeanTe
}
private int findRevisionID(CompositeData jmxWiring, Bundle bundle) {
- CompositeData[] requiredWires = (CompositeData [])
jmxWiring.get(BundleRevisionsStateMBean.REQUIRED_WIRES);
+ CompositeData[] requiredWires = (CompositeData [])
jmxWiring.get(BundleWiringStateMBean.REQUIRED_WIRES);
for (CompositeData req : requiredWires) {
- if (new
Long(bundle.getBundleId()).equals(req.get(BundleRevisionsStateMBean.PROVIDER_BUNDLE_ID)))
{
- return (Integer)
req.get(BundleRevisionsStateMBean.PROVIDER_BUNDLE_REVISION_ID);
+ if (new
Long(bundle.getBundleId()).equals(req.get(BundleWiringStateMBean.PROVIDER_BUNDLE_ID)))
{
+ return (Integer)
req.get(BundleWiringStateMBean.PROVIDER_BUNDLE_REVISION_ID);
}
}
return -1;
@@ -286,7 +286,7 @@ public class BundleRevisionsStateMBeanTe
@SuppressWarnings("unchecked")
private Map<String, Object> getJmxAttributes(CompositeData jmxCapReq) {
- TabularData jmxAttributes = (TabularData)
jmxCapReq.get(BundleRevisionsStateMBean.ATTRIBUTES);
+ TabularData jmxAttributes = (TabularData)
jmxCapReq.get(BundleWiringStateMBean.ATTRIBUTES);
Map<String, Object> aMap = new HashMap<String, Object>();
for (CompositeData jmxAttr : (Collection<CompositeData>)
jmxAttributes.values()) {
PropertyData<Object> pd = PropertyData.from(jmxAttr);
@@ -297,10 +297,10 @@ public class BundleRevisionsStateMBeanTe
@SuppressWarnings("unchecked")
private Map<String, String> getJmxDirectives(CompositeData jmxCapReq) {
- TabularData jmxDirectives = (TabularData)
jmxCapReq.get(BundleRevisionsStateMBean.DIRECTIVES);
+ TabularData jmxDirectives = (TabularData)
jmxCapReq.get(BundleWiringStateMBean.DIRECTIVES);
Map<String, String> dMap = new HashMap<String, String>();
for (CompositeData jmxDir : (Collection<CompositeData>)
jmxDirectives.values()) {
- dMap.put((String) jmxDir.get(BundleRevisionsStateMBean.KEY),
(String) jmxDir.get(BundleRevisionsStateMBean.VALUE));
+ dMap.put((String) jmxDir.get(BundleWiringStateMBean.KEY), (String)
jmxDir.get(BundleWiringStateMBean.VALUE));
}
return dMap;
}