m_invokeStep = new Ensure();
// Create our original "S" service.
Dictionary props = new Hashtable();
props.put("foo", "bar");
Component s = m.createComponent()
.setImplementation(new SImpl())
.setInterface(S.class.getName(), props);
// Create some "S" aspects
Component[] aspects = new Component[ASPECTS];
for (int rank = 1; rank <= ASPECTS; rank ++) {
aspects[rank-1] = m.createAspectService(S.class, null, rank, "add", "change", "remove", "swap")
.setImplementation(new A("A" + rank, rank));
props = new Hashtable();
props.put("a" + rank, "v" + rank);
aspects[rank-1].setServiceProperties(props);
}
// Create S2 adapter (which adapts S1 to S2 interface)
Component adapter = m.createAdapterService(S.class, null, "add", "change", "remove", "swap")
.setInterface(S2.class.getName(), null)
.setImplementation(new S2Impl());
// Create Client2, which depends on "S2" service.
Client2 client2Impl;
Component client2 = m.createComponent()
.setImplementation((client2Impl = new Client2()))
.add(m.createServiceDependency()
.setService(S2.class)
.setRequired(true)
.setDebug("client")