Return-Path: Delivered-To: apmail-incubator-aries-commits-archive@minotaur.apache.org Received: (qmail 58134 invoked from network); 13 Dec 2010 18:27:03 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Dec 2010 18:27:03 -0000 Received: (qmail 46134 invoked by uid 500); 13 Dec 2010 18:27:03 -0000 Delivered-To: apmail-incubator-aries-commits-archive@incubator.apache.org Received: (qmail 46050 invoked by uid 500); 13 Dec 2010 18:27:02 -0000 Mailing-List: contact aries-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: aries-dev@incubator.apache.org Delivered-To: mailing list aries-commits@incubator.apache.org Received: (qmail 46042 invoked by uid 99); 13 Dec 2010 18:27:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Dec 2010 18:27:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Dec 2010 18:26:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C975C2388A6C; Mon, 13 Dec 2010 18:26:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1045274 [5/7] - in /incubator/aries/sandbox/jbohn/interceptor-proto: ./ application/ application/application-api/src/main/java/org/apache/aries/application/ application/application-api/src/main/java/org/apache/aries/application/management/... Date: Mon, 13 Dec 2010 18:26:35 -0000 To: aries-commits@incubator.apache.org From: jbohn@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101213182637.C975C2388A6C@eris.apache.org> Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java Mon Dec 13 18:26:19 2010 @@ -33,7 +33,10 @@ import java.util.concurrent.ConcurrentMa import javax.naming.NamingException; +import org.apache.aries.jndi.url.Activator; import org.apache.aries.jndi.url.OsgiName; +import org.apache.aries.proxy.ProxyManager; +import org.apache.aries.proxy.UnableToProxyException; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; @@ -157,21 +160,33 @@ public final class ServiceHelper private String interfaceName; private String filter; private boolean dynamic; + private int rebindTimeout; public JNDIServiceDamper(BundleContext context, String i, String f, ServicePair service, - boolean d) + boolean d, int timeout) { ctx = context; pair = service; interfaceName = i; filter = f; dynamic = d; + rebindTimeout = timeout; } public Object call() throws NamingException { if (pair == null || pair.ref.getBundle() == null) { if (dynamic) { pair = findService(ctx, interfaceName, filter); + if (pair == null && rebindTimeout > 0) { + long startTime = System.currentTimeMillis(); + try { + while (pair == null && System.currentTimeMillis() - startTime < rebindTimeout) { + Thread.sleep(100); + pair = findService(ctx, interfaceName, filter); + } + } catch (InterruptedException e) { + } + } } else { pair = null; } @@ -194,8 +209,6 @@ public final class ServiceHelper private static final ConcurrentMap> proxyCache = new ConcurrentHashMap>(); private static final CacheClearoutListener cacheClearoutListener = new CacheClearoutListener(proxyCache); - private static ProxyFactory proxyFactory; - public static Object getService(BundleContext ctx, OsgiName lookupName, String id, boolean dynamicRebind, Map env, boolean requireProxy) throws NamingException { @@ -232,7 +245,15 @@ public final class ServiceHelper if (pair != null) { if (requireProxy) { - result = proxy(interfaceName, filter, dynamicRebind, ctx, pair); + Object obj = env.get(org.apache.aries.jndi.api.JNDIConstants.REBIND_TIMEOUT); + int timeout = 0; + if (obj instanceof String) { + timeout = Integer.parseInt((String)obj); + } else if (obj instanceof Integer) { + timeout = (Integer)obj; + } + + result = proxy(interfaceName, filter, dynamicRebind, ctx, pair, timeout); } else { result = pair.service; } @@ -242,7 +263,7 @@ public final class ServiceHelper } private static Object proxy(final String interface1, final String filter, final boolean rebind, - final BundleContext ctx, final ServicePair pair) + final BundleContext ctx, final ServicePair pair, final int timeout) { Object result = null; Bundle owningBundle = ctx.getBundle(); @@ -261,7 +282,7 @@ public final class ServiceHelper result = AccessController.doPrivileged(new PrivilegedAction() { public Object run() { - return proxyPriviledged(interface1, filter, rebind, ctx, pair); + return proxyPriviledged(interface1, filter, rebind, ctx, pair, timeout); } }); @@ -275,7 +296,7 @@ public final class ServiceHelper return result; } - private static Object proxyPriviledged(String interface1, String filter, boolean dynamicRebind, BundleContext ctx, ServicePair pair) + private static Object proxyPriviledged(String interface1, String filter, boolean dynamicRebind, BundleContext ctx, ServicePair pair, int timeout) { String[] interfaces = null; if (interface1 != null) { @@ -311,7 +332,7 @@ public final class ServiceHelper Bundle serviceProviderBundle = pair.ref.getBundle(); Bundle owningBundle = ctx.getBundle(); - ProxyFactory proxyFactory = getProxyFactory(); + ProxyManager proxyManager = Activator.getProxyManager(); for (String interfaceName : interfaces) { try { @@ -327,7 +348,7 @@ public final class ServiceHelper throw new IllegalArgumentException(Arrays.asList(interfaces).toString()); } - Callable ih = new JNDIServiceDamper(ctx, interface1, filter, pair, dynamicRebind); + Callable ih = new JNDIServiceDamper(ctx, interface1, filter, pair, dynamicRebind, timeout); // The ClassLoader needs to be able to load the service interface // classes so it needs to be @@ -335,9 +356,9 @@ public final class ServiceHelper // on this adapter. try { - return proxyFactory.createProxy(serviceProviderBundle, clazz, ih); - } catch (IllegalArgumentException e) { - throw e; + return proxyManager.createProxy(serviceProviderBundle, clazz, ih); + } catch (UnableToProxyException e) { + throw new IllegalArgumentException(e); } catch (RuntimeException e) { throw new IllegalArgumentException("Unable to create proxy for " + pair.ref, e); } @@ -422,24 +443,10 @@ public final class ServiceHelper pair.ref = ref; pair.service = service; - result = proxy(null, null, false, ctx, pair); + result = proxy(null, null, false, ctx, pair, 0); } return result; } - - protected static synchronized ProxyFactory getProxyFactory() { - if (proxyFactory == null) { - try { - // Try load load a cglib class (to make sure it's actually available - // then create the cglib factory - Class.forName("net.sf.cglib.proxy.Enhancer"); - proxyFactory = new CgLibProxyFactory(); - } catch (Throwable t) { - proxyFactory = new JdkProxyFactory(); - } - } - return proxyFactory; - } } Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java Mon Dec 13 18:26:19 2010 @@ -22,23 +22,77 @@ import java.util.Hashtable; import javax.naming.spi.ObjectFactory; +import org.apache.aries.proxy.ProxyManager; +import org.apache.aries.util.SingleServiceTracker; +import org.apache.aries.util.SingleServiceTracker.SingleServiceListener; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.jndi.JNDIConstants; -public class Activator implements BundleActivator { - - private ServiceRegistration reg; - - public void start(BundleContext context) { - Hashtable props = new Hashtable(); - props.put(JNDIConstants.JNDI_URLSCHEME, new String[] { "osgi", "aries" }); - reg = context.registerService(ObjectFactory.class.getName(), new OsgiURLContextServiceFactory(), props); +public class Activator implements BundleActivator, SingleServiceListener +{ + private BundleContext ctx; + private volatile ServiceRegistration osgiUrlReg = null; + private volatile ServiceRegistration blueprintUrlReg = null; + private static SingleServiceTracker proxyManager; + + @Override + public void start(BundleContext context) + { + ctx = context; + proxyManager = new SingleServiceTracker(context, ProxyManager.class, this); + proxyManager.open(); } + @Override public void stop(BundleContext context) { - reg.unregister(); + proxyManager.close(); + if (osgiUrlReg != null) osgiUrlReg.unregister(); + if (blueprintUrlReg != null) blueprintUrlReg.unregister(); + } + + + @Override + public void serviceFound() + { + Hashtable osgiUrlprops = new Hashtable(); + osgiUrlprops.put(JNDIConstants.JNDI_URLSCHEME, new String[] { "osgi", "aries" }); + osgiUrlReg = ctx.registerService(ObjectFactory.class.getName(), + new OsgiURLContextServiceFactory(), osgiUrlprops); + + // Blueprint URL scheme requires access to the BlueprintContainer service. + // We have an optional import + // on org.osgi.service.blueprint.container: only register the blueprint:comp/URL + // scheme if it's present + try { + ctx.getBundle().loadClass("org.osgi.service.blueprint.container.BlueprintContainer"); + Hashtable blueprintURlSchemeProps = new Hashtable(); + blueprintURlSchemeProps.put(JNDIConstants.JNDI_URLSCHEME, new String[] { "blueprint" }); + blueprintUrlReg = ctx.registerService(ObjectFactory.class.getName(), + new BlueprintURLContextServiceFactory(), blueprintURlSchemeProps); + } catch (ClassNotFoundException cnfe) { + // The blueprint packages aren't available, so do nothing. That's fine. } + } -} + @Override + public void serviceLost() + { + if (osgiUrlReg != null) osgiUrlReg.unregister(); + osgiUrlReg = null; + if (blueprintUrlReg != null) blueprintUrlReg.unregister(); + blueprintUrlReg = null; + } + + @Override + public void serviceReplaced() + { + + } + + public static ProxyManager getProxyManager() + { + return proxyManager == null ? null : proxyManager.getService(); + } +} \ No newline at end of file Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiName.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiName.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiName.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/OsgiName.java Mon Dec 13 18:26:19 2010 @@ -18,12 +18,8 @@ */ package org.apache.aries.jndi.url; -import java.util.ArrayList; -import java.util.Collections; import java.util.Enumeration; -import java.util.List; -import javax.naming.CompositeName; import javax.naming.InvalidNameException; import javax.naming.Name; @@ -35,7 +31,7 @@ import javax.naming.Name; * component 1: interface * component 2: filter */ -public final class OsgiName extends CompositeName +public final class OsgiName extends AbstractName { /** The serial version UID */ private static final long serialVersionUID = 6617580228852444656L; @@ -56,33 +52,6 @@ public final class OsgiName extends Comp this(name.toString()); } - private static Enumeration split(String name) - { - List elements = new ArrayList(); - - StringBuilder builder = new StringBuilder(); - - int len = name.length(); - int count = 0; - - for (int i = 0; i < len; i++) { - char c = name.charAt(i); - - if (c == '/' && count == 0) { - elements.add(builder.toString()); - builder = new StringBuilder(); - continue; - } else if (c == '(') count++; - else if (c == ')') count++; - - builder.append(c); - } - - elements.add(builder.toString()); - - return Collections.enumeration(elements); - } - public boolean hasFilter() { return size() == 3; @@ -93,38 +62,6 @@ public final class OsgiName extends Comp return size() > 3; } - public String getScheme() - { - String part0 = get(0); - int index = part0.indexOf(':'); - - String result; - - if (index > 0) { - result = part0.substring(0, index); - } else { - result = null; - } - - return result; - } - - public String getSchemePath() - { - String part0 = get(0); - int index = part0.indexOf(':'); - - String result; - - if (index > 0) { - result = part0.substring(index + 1); - } else { - result = null; - } - - return result; - } - public String getInterface() { return get(1); Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryListContext.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryListContext.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryListContext.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryListContext.java Mon Dec 13 18:26:19 2010 @@ -56,7 +56,7 @@ public class ServiceRegistryListContext private ServiceNamingEnumeration(BundleContext context, ServiceReference[] theRefs, ThingManager manager) { ctx = context; - refs = theRefs; + refs = (theRefs != null) ? theRefs : new ServiceReference[0]; mgr = manager; } Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/ServiceRegistryContextTest.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/ServiceRegistryContextTest.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/ServiceRegistryContextTest.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jndi/jndi-url/src/test/java/org/apache/aries/jndi/url/ServiceRegistryContextTest.java Mon Dec 13 18:26:19 2010 @@ -24,9 +24,15 @@ import static org.junit.Assert.assertNot import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; import java.sql.SQLException; +import java.util.Collection; import java.util.Hashtable; +import java.util.Iterator; import java.util.Properties; +import java.util.concurrent.Callable; import javax.naming.Binding; import javax.naming.Context; @@ -38,9 +44,12 @@ import javax.naming.NamingException; import javax.naming.spi.ObjectFactory; import javax.sql.DataSource; +import org.apache.aries.jndi.api.JNDIConstants; import org.apache.aries.mocks.BundleContextMock; import org.apache.aries.mocks.BundleMock; +import org.apache.aries.proxy.ProxyManager; import org.apache.aries.unittest.mocks.MethodCall; +import org.apache.aries.unittest.mocks.MethodCallHandler; import org.apache.aries.unittest.mocks.Skeleton; import org.junit.After; import org.junit.Before; @@ -77,6 +86,7 @@ public class ServiceRegistryContextTest public void registerService() throws NamingException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { bc = Skeleton.newMock(new BundleContextMock(), BundleContext.class); + registerProxyManager(); new org.apache.aries.jndi.startup.Activator().start(bc); new Activator().start(bc); @@ -85,6 +95,43 @@ public class ServiceRegistryContextTest registerService(service); } + private void registerProxyManager() + { + ProxyManager mgr = Skeleton.newMock(ProxyManager.class); + + // public Object createProxy(Bundle clientBundle, Collection> classes, Callable dispatcher) throws UnableToProxyException; + + Skeleton.getSkeleton(mgr).registerMethodCallHandler(new MethodCall(ProxyManager.class, "createProxy", Bundle.class, Collection.class, Callable.class), + new MethodCallHandler() + { + public Object handle(MethodCall methodCall, Skeleton skeleton) throws Exception + { + @SuppressWarnings("unchecked") + Collection> interfaceClasses = (Collection>) methodCall.getArguments()[1]; + Class[] classes = new Class[interfaceClasses.size()]; + + Iterator> it = interfaceClasses.iterator(); + for (int i = 0; it.hasNext(); i++) { + classes[i] = it.next(); + } + + @SuppressWarnings("unchecked") + final Callable target = (Callable) methodCall.getArguments()[2]; + + return Proxy.newProxyInstance(this.getClass().getClassLoader(), classes, new InvocationHandler() + { + public Object invoke(Object mock, Method method, Object[] arguments) + throws Throwable + { + return method.invoke(target.call(), arguments); + } + }); + } + }); + + bc.registerService(ProxyManager.class.getName(), mgr, null); + } + /** * Register a service in our map. * @@ -134,6 +181,37 @@ public class ServiceRegistryContextTest assertTrue("expected non-proxied service class", r2 == service); } + @Test + public void testLookupWithPause() throws NamingException + { + BundleMock mock = new BundleMock("scooby.doo", new Properties()); + + Thread.currentThread().setContextClassLoader(mock.getClassLoader()); + + Hashtable env = new Hashtable(); + env.put(JNDIConstants.REBIND_TIMEOUT, 1000); + + InitialContext ctx = new InitialContext(env); + + Context ctx2 = (Context) ctx.lookup("osgi:service"); + + Runnable r1 = (Runnable) ctx2.lookup("java.lang.Runnable"); + + reg.unregister(); + + long startTime = System.currentTimeMillis(); + + try { + r1.run(); + fail("Should have received an exception"); + } catch (ServiceException e) { + long endTime = System.currentTimeMillis(); + long diff = endTime - startTime; + + assertTrue("The run method did not fail in the expected time (1s): " + diff, diff >= 1000); + } + } + /** * This test checks that we correctly register and deregister the url context * object factory in the service registry. Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jndi/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jndi/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jndi/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jndi/pom.xml Mon Dec 13 18:26:19 2010 @@ -22,6 +22,7 @@ org.apache.aries java5-parent 0.3-incubating-SNAPSHOT + ../parent/default-parent/java5-parent/pom.xml 4.0.0 @@ -61,6 +62,11 @@ org.apache.aries.jndi + org.apache.aries.jndi.rmi + ${version} + + + org.apache.aries.jndi org.apache.aries.jndi ${version} @@ -75,13 +81,11 @@ org.apache.aries.util 0.3-incubating-SNAPSHOT - - - org.apache.servicemix.bundles - org.apache.servicemix.bundles.cglib - 2.1_3_4 - + + org.apache.aries.proxy + org.apache.aries.proxy.api + 0.3-incubating-SNAPSHOT + @@ -97,7 +101,9 @@ jndi-api jndi-core jndi-url + jndi-rmi jndi-bundle + jndi-legacy-support Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/PersistenceContextManager.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/PersistenceContextManager.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/PersistenceContextManager.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/PersistenceContextManager.java Mon Dec 13 18:26:19 2010 @@ -26,8 +26,8 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Map.Entry; +import java.util.Set; import javax.persistence.EntityManagerFactory; import javax.persistence.PersistenceContextType; @@ -434,12 +434,21 @@ public class PersistenceContextManager e //Find the ManagedFactories for the persistence unit List factoriesToQuiesce = new ArrayList(); synchronized (this) { - for(String name : units) { - ServiceRegistration reg = entityManagerRegistrations.get(name); + Iterator it = units.iterator(); + while(it.hasNext()) { + ServiceRegistration reg = entityManagerRegistrations.get(it.next()); + //If there's no managed factory then we don't need to quiesce this unit + boolean needsQuiesce = false; if(reg != null) { ManagedPersistenceContextFactory fact = (ManagedPersistenceContextFactory) bundleToQuiesce.getBundleContext().getService(reg.getReference()); - if(fact != null) + if(fact != null) { factoriesToQuiesce.add(fact); + needsQuiesce = true; + } + } + //If the unit doesn't need quiescing then remove it from our check + if(!!!needsQuiesce) { + it.remove(); } } } Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java Mon Dec 13 18:26:19 2010 @@ -21,14 +21,9 @@ import static org.ops4j.pax.exam.CoreOpt import static org.ops4j.pax.exam.CoreOptions.wrappedBundle; import static org.ops4j.pax.exam.OptionUtils.combine; -import java.util.Hashtable; - import javax.persistence.EntityManagerFactory; -import javax.persistence.spi.PersistenceProvider; import org.apache.aries.jpa.container.PersistenceUnitConstants; -import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.CoreOptions; @@ -44,7 +39,6 @@ import org.osgi.framework.Filter; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.Version; -import org.osgi.service.packageadmin.PackageAdmin; import org.osgi.util.tracker.ServiceTracker; @RunWith(JUnit4TestRunner.class) @@ -58,6 +52,23 @@ public class JPAContainerTest { public void findEntityManagerFactory() throws Exception { EntityManagerFactory emf = getOsgiService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))", DEFAULT_TIMEOUT); } + + @Test + public void findEntityManagerFactory2() throws Exception { + EntityManagerFactory emf = getOsgiService(EntityManagerFactory.class, "(&(osgi.unit.name=bp-test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))", DEFAULT_TIMEOUT); + } + + @Test + public void findEntityManager() throws Exception { + EntityManagerFactory emf = getOsgiService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))", DEFAULT_TIMEOUT); + emf.createEntityManager(); + } + + @Test + public void findEntityManager2() throws Exception { + EntityManagerFactory emf = getOsgiService(EntityManagerFactory.class, "(&(osgi.unit.name=bp-test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))", DEFAULT_TIMEOUT); + emf.createEntityManager(); + } @org.ops4j.pax.exam.junit.Configuration public static Option[] configuration() { @@ -77,18 +88,27 @@ public class JPAContainerTest { systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"), // Bundles - mavenBundle("org.osgi", "org.osgi.compendium"), + mavenBundle("commons-lang", "commons-lang"), + mavenBundle("commons-collections", "commons-collections"), + mavenBundle("commons-pool", "commons-pool"), mavenBundle("org.apache.aries", "org.apache.aries.util"), - mavenBundle("org.apache.geronimo.specs", "geronimo-jpa_2.0_spec"), + mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"), + mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.api"), + mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.core"), + mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url"), mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.api"), mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container"), + mavenBundle("org.apache.derby", "derby"), mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"), - mavenBundle("commons-lang", "commons-lang"), - mavenBundle("commons-collections", "commons-collections"), - mavenBundle("commons-pool", "commons-pool"), - mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.serp"), + mavenBundle("org.apache.geronimo.specs", "geronimo-jpa_2.0_spec"), mavenBundle("org.apache.openjpa", "openjpa"), + mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.serp"), + mavenBundle("org.osgi", "org.osgi.compendium"), + //vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"), + //waitForFrameworkStartup(), + + // mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.jpa"), // mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.core"), // mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.asm"), Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/JPAContextTest.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/JPAContextTest.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/JPAContextTest.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/context/itest/JPAContextTest.java Mon Dec 13 18:26:19 2010 @@ -25,7 +25,6 @@ import static org.ops4j.pax.exam.CoreOpt import static org.ops4j.pax.exam.OptionUtils.combine; import java.util.HashMap; -import java.util.Map; import javax.persistence.EntityManagerFactory; import javax.persistence.PersistenceContextType; @@ -105,10 +104,13 @@ public class JPAContextTest { // Bundles mavenBundle("org.osgi", "org.osgi.compendium"), mavenBundle("org.apache.aries", "org.apache.aries.util"), + // Adding blueprint to the runtime is a hack to placate the maven bundle plugin. + mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"), mavenBundle("org.apache.geronimo.specs", "geronimo-jpa_2.0_spec"), mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.api"), mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container"), mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container.context"), + mavenBundle("org.apache.derby", "derby"), mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"), mavenBundle("commons-lang", "commons-lang"), mavenBundle("commons-collections", "commons-collections"), Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/quiesce/itest/QuiesceJPATest.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/quiesce/itest/QuiesceJPATest.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/quiesce/itest/QuiesceJPATest.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-itest/src/test/java/org/apache/aries/jpa/quiesce/itest/QuiesceJPATest.java Mon Dec 13 18:26:19 2010 @@ -651,6 +651,8 @@ public class QuiesceJPATest { // Bundles mavenBundle("org.osgi", "org.osgi.compendium"), mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.cglib"), + mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy.api"), + mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy.impl"), mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.api"), mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.core"), mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url"), Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-testbundle/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-testbundle/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-testbundle/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-testbundle/pom.xml Mon Dec 13 18:26:19 2010 @@ -55,6 +55,7 @@ org.apache.aries.jpa.container.itest.entities;version="${pom.version}", + org.apache.aries.jpa.container.itest <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@))) <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Bundle-DocURL META-INF/persistence.xml Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml Mon Dec 13 18:26:19 2010 @@ -32,4 +32,12 @@ + + + Test persistence unit for the JPA Container and Context iTests + blueprint:comp/jta + blueprint:comp/nonjta + org.apache.aries.jpa.container.itest.entities.Car + true + Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/DelayedLookupDataSource.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/DelayedLookupDataSource.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/DelayedLookupDataSource.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/DelayedLookupDataSource.java Mon Dec 13 18:26:19 2010 @@ -21,11 +21,14 @@ package org.apache.aries.jpa.container.u import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; +import java.util.Hashtable; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,7 +42,16 @@ public class DelayedLookupDataSource imp private DataSource getDs() { if(ds == null) { try { - InitialContext ctx = new InitialContext(); + + Hashtable props = new Hashtable(); + + BundleContext bCtx = persistenceBundle.getBundleContext(); + if(bCtx == null) + throw new IllegalStateException("The bundle " + + persistenceBundle.getSymbolicName() + "_" + persistenceBundle.getVersion() + + " is not started."); + props.put("osgi.service.jndi.bundleContext", bCtx); + InitialContext ctx = new InitialContext(props); ds = (DataSource) ctx.lookup(jndiName); } catch (NamingException e) { _logger.error("No JTA datasource could be located using the JNDI name " + jndiName, @@ -51,9 +63,11 @@ public class DelayedLookupDataSource imp } private final String jndiName; + private final Bundle persistenceBundle; - public DelayedLookupDataSource (String jndi) { + public DelayedLookupDataSource (String jndi, Bundle persistenceBundle) { jndiName = jndi; + this.persistenceBundle = persistenceBundle; } public Connection getConnection() throws SQLException { Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/PersistenceUnitInfoImpl.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/PersistenceUnitInfoImpl.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/PersistenceUnitInfoImpl.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/unit/impl/PersistenceUnitInfoImpl.java Mon Dec 13 18:26:19 2010 @@ -94,7 +94,7 @@ public class PersistenceUnitInfoImpl imp String jndiString = (String) unit.getPersistenceXmlMetadata().get(ParsedPersistenceUnit.JTA_DATASOURCE); DataSource toReturn = null; if(jndiString != null) { - toReturn = new DelayedLookupDataSource(jndiString); + toReturn = new DelayedLookupDataSource(jndiString, bundle); } return toReturn; } @@ -126,7 +126,7 @@ public class PersistenceUnitInfoImpl imp String jndiString = (String) unit.getPersistenceXmlMetadata().get(ParsedPersistenceUnit.NON_JTA_DATASOURCE); DataSource toReturn = null; if(jndiString != null) { - toReturn = new DelayedLookupDataSource(jndiString); + toReturn = new DelayedLookupDataSource(jndiString, bundle); } return toReturn; } Modified: incubator/aries/sandbox/jbohn/interceptor-proto/jpa/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/jpa/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/jpa/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/jpa/pom.xml Mon Dec 13 18:26:19 2010 @@ -22,6 +22,7 @@ java5-parent org.apache.aries 0.3-incubating-SNAPSHOT + ../parent/default-parent/java5-parent/pom.xml 4.0.0 org.apache.aries.jpa Modified: incubator/aries/sandbox/jbohn/interceptor-proto/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/pom.xml Mon Dec 13 18:26:19 2010 @@ -51,6 +51,7 @@ jpa spi-fly samples + proxy Modified: incubator/aries/sandbox/jbohn/interceptor-proto/proxy/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/proxy/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/proxy/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/proxy/pom.xml Mon Dec 13 18:26:19 2010 @@ -22,6 +22,7 @@ org.apache.aries java5-parent 0.3-incubating-SNAPSHOT + ../parent/default-parent/java5-parent/pom.xml 4.0.0 @@ -50,6 +51,11 @@ asm-all 3.2 + + org.apache.aries + org.apache.aries.util + ${project.version} + Modified: incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-api/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-api/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-api/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-api/pom.xml Mon Dec 13 18:26:19 2010 @@ -19,8 +19,8 @@ 4.0.0 - org.apache.aries - java5-parent + org.apache.aries.proxy + proxy 0.3-incubating-SNAPSHOT Modified: incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-api/src/main/java/org/apache/aries/proxy/ProxyManager.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-api/src/main/java/org/apache/aries/proxy/ProxyManager.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-api/src/main/java/org/apache/aries/proxy/ProxyManager.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-api/src/main/java/org/apache/aries/proxy/ProxyManager.java Mon Dec 13 18:26:19 2010 @@ -18,9 +18,30 @@ */ package org.apache.aries.proxy; +import java.util.Collection; +import java.util.concurrent.Callable; + +import org.osgi.framework.Bundle; + +/** + * The proxy manager service allows clients to generate and manage proxies. + */ public interface ProxyManager { - public ProxyFactory createProxyFactory(); - public ProxyFactory createProxyFactory(boolean interfaceProxyingOnly); - public Object unwrap(Object proxy); + public Object createProxy(Bundle clientBundle, Collection> classes, Callable dispatcher) throws UnableToProxyException; + public Object createProxy(Bundle clientBundle, Collection> classes, Callable dispatcher, InvocationHandlerWrapper wrapper) throws UnableToProxyException; + /** + * This method unwraps the provided proxy returning the target object. + * + * @param proxy the proxy to unwrap. + * @return the target object. + */ + public Callable unwrap(Object proxy); + /** + * Returns true if and only if the specified object was generated by a ProxyFactory returned by + * a call to {@link ProxyManager#createProxyFactory(boolean)}. + * @param proxy The proxy object to test + * @return true if it is a proxy, false otherwise. + */ + public boolean isProxy(Object proxy); } \ No newline at end of file Modified: incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-bundle/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-bundle/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-bundle/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-bundle/pom.xml Mon Dec 13 18:26:19 2010 @@ -19,8 +19,8 @@ 4.0.0 - org.apache.aries - java5-parent + org.apache.aries.proxy + proxy 0.3-incubating-SNAPSHOT @@ -39,14 +39,22 @@ + + org.apache.aries.proxy.impl.ProxyManagerActivator + org.apache.aries.proxy; + org.eclipse.*;resolution:=optional, + org.objectweb.asm;resolution:=optional, + org.objectweb.asm.commons;resolution:=optional, * - org.apache.aries.proxy.impl + org.apache.aries.util*, + org.objectweb.asm*, + org.apache.aries.proxy.impl* @@ -77,6 +85,16 @@ junit test + + org.apache.aries.proxy + org.apache.aries.proxy.api + ${project.version} + + + org.apache.aries.proxy + org.apache.aries.proxy.impl + ${project.version} + Modified: incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-impl/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-impl/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-impl/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/proxy/proxy-impl/pom.xml Mon Dec 13 18:26:19 2010 @@ -19,8 +19,8 @@ 4.0.0 - org.apache.aries - java5-parent + org.apache.aries.proxy + proxy 0.3-incubating-SNAPSHOT @@ -39,18 +39,36 @@ - - + + + org.apache.aries.proxy.impl.ProxyManagerActivator + + org.objectweb.asm;resolution:=optional, + org.objectweb.asm.commons;resolution:=optional, * - org.apache.aries.proxy.impl + org.apache.aries.proxy.impl* + asm + asm-all + true + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + test + + org.osgi org.osgi.core provided @@ -77,12 +95,17 @@ test - org.apache.aries + org.apache.aries.proxy org.apache.aries.proxy.api 0.3-incubating-SNAPSHOT bundle compile + + org.apache.aries + org.apache.aries.util + compile + Modified: incubator/aries/sandbox/jbohn/interceptor-proto/quiesce/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/quiesce/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/quiesce/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/quiesce/pom.xml Mon Dec 13 18:26:19 2010 @@ -20,6 +20,7 @@ org.apache.aries java5-parent 0.3-incubating-SNAPSHOT + ../parent/default-parent/java5-parent/pom.xml 4.0.0 Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-assembly/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-assembly/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-assembly/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-assembly/pom.xml Mon Dec 13 18:26:19 2010 @@ -169,6 +169,21 @@ cxf-dosgi-ri-singlebundle-distribution 1.2 + + org.apache.aries.samples.dgoat.cxf-api + cxf-api + 0.3-incubating-SNAPSHOT + + + org.apache.aries.samples.dgoat.cxf-client + cxf-client + 0.3-incubating-SNAPSHOT + + + org.apache.aries.samples.dgoat.cxf-server + cxf-server + 0.3-incubating-SNAPSHOT + Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-assembly/src/main/filtered-resources/clientConfigCXF/config.ini URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-assembly/src/main/filtered-resources/clientConfigCXF/config.ini?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-assembly/src/main/filtered-resources/clientConfigCXF/config.ini (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-assembly/src/main/filtered-resources/clientConfigCXF/config.ini Mon Dec 13 18:26:19 2010 @@ -23,11 +23,8 @@ osgi.bundles=\ pax-web-jsp-0.7.2.jar@start,\ cxf-dosgi-ri-singlebundle-distribution-1.2.jar@start, \ org.apache.aries.blueprint-0.3-incubating-SNAPSHOT.jar@start,\ - org.apache.aries.samples.dgoat.api-0.3-incubating-SNAPSHOT@start,\ + org.apache.aries.samples.dgoat.api-0.3-incubating-SNAPSHOT.jar@start,\ org.apache.aries.samples.dgoat.web-0.3-incubating-SNAPSHOT.jar@start,\ - org.apache.aries.samples.dgoat.dummy-0.3-incubating-SNAPSHOT.jar@start,\ - org.apache.aries.samples.dgoat.dummy2-0.3-incubating-SNAPSHOT.jar@start,\ - org.apache.aries.samples.dgoat.info.enhancer-0.3-incubating-SNAPSHOT.jar@start eclipse.ignoreApp=true org.osgi.service.http.port=6666 org.ops4j.pax.logging.DefaultServiceLog.level=DEBUG Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-bundlecontext-modelprovider/src/main/resources/OSGI-INF/blueprint/blueprint.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-bundlecontext-modelprovider/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-bundlecontext-modelprovider/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-bundlecontext-modelprovider/src/main/resources/OSGI-INF/blueprint/blueprint.xml Mon Dec 13 18:26:19 2010 @@ -27,9 +27,8 @@ - - + Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-info-enhancer/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-info-enhancer/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-info-enhancer/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-info-enhancer/pom.xml Mon Dec 13 18:26:19 2010 @@ -32,6 +32,17 @@ ${pom.groupId} org.apache.aries.samples.dgoat.web + + org.apache.felix + org.apache.felix.framework + 3.0.3 + + + org.apache.felix + org.osgi.foundation + + + @@ -50,9 +61,10 @@ ${pom.artifactId} - OSGI-INF/remote-service + OSGI-INF/remote-service/remote-services.xml org.apache.aries.samples.goat.enhancer.* !org.apache.aries.samples.goat.enhancer.* + org.apache.cxf.dosgi.dsw.qos,org.apache.cxf Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-web/src/main/java/org/apache/aries/samples/goat/web/ServerSideClass.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-web/src/main/java/org/apache/aries/samples/goat/web/ServerSideClass.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-web/src/main/java/org/apache/aries/samples/goat/web/ServerSideClass.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/dgoat-web/src/main/java/org/apache/aries/samples/goat/web/ServerSideClass.java Mon Dec 13 18:26:19 2010 @@ -42,16 +42,22 @@ import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; +import org.osgi.util.tracker.ServiceTracker; public class ServerSideClass { private String modelInfoServiceHint = ""; private ModelInfoService ModelInfoService = null; + + private ModelInfoService blah; private Map clisteners = new HashMap(); private Map rlisteners = new HashMap(); + public ServerSideClass(ModelInfoService blah) { + this.blah = blah; + } private class ComponentInfoListenerImpl implements ComponentInfoProvider.ComponentInfoListener { String server; @@ -155,6 +161,7 @@ public class ServerSideClass { ModelInfoService.class.getName(), "(displayName=" + this.modelInfoServiceHint + ")"); + if (sr != null) { System.err.println("Getting bcip"); this.ModelInfoService = (ModelInfoService) b_ctx @@ -263,6 +270,11 @@ public class ServerSideClass { String name = (String.valueOf(sr .getProperty("displayName"))); + + Long bid = sr.getBundle().getBundleId(); + + System.err.println("ZZZZ Name: " + name); + System.err.println("ZZZZ Bundle Id: " + bid); result.add(name); } Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples-sandbox/dgoat/pom.xml Mon Dec 13 18:26:19 2010 @@ -66,6 +66,21 @@ org.apache.aries.samples.dgoat.info.enhancer ${version} + + org.apache.aries.samples.dgoat.cxf-api + cxf-api + ${version} + + + org.apache.aries.samples.dgoat.cxf-client + cxf-client + ${version} + + + org.apache.aries.samples.dgoat.cxf-server + cxf-server + ${version} + @@ -79,6 +94,9 @@ dgoat-eba dgoat-bundlecontext-modelprovider dgoat-info-enhancer + dgoat-cxf-sample-api + dgoat-cxf-sample-cli + dgoat-cxf-sample-server Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/JdbcBlogSampleWithEbaTest.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/JdbcBlogSampleWithEbaTest.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/JdbcBlogSampleWithEbaTest.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/JdbcBlogSampleWithEbaTest.java Mon Dec 13 18:26:19 2010 @@ -137,6 +137,7 @@ public class JdbcBlogSampleWithEbaTest e mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint" ), mavenBundle("org.apache.aries", "org.apache.aries.util" ), mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi" ), + mavenBundle("org.apache.felix", "org.apache.felix.fileinstall" ), mavenBundle("org.apache.aries.application", "org.apache.aries.application.install" ), mavenBundle("org.apache.aries.application", "org.apache.aries.application.api" ), mavenBundle("org.apache.aries.application", "org.apache.aries.application.management" ), @@ -149,7 +150,6 @@ public class JdbcBlogSampleWithEbaTest e mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"), mavenBundle("org.apache.aries.application", "org.apache.aries.application.modeller"), mavenBundle("org.apache.aries.application", "org.apache.aries.application.deployment.management"), - mavenBundle("org.apache.felix", "org.apache.felix.fileinstall" ), mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.api" ), mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container" ), mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.blueprint.aries" ), Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/JpaBlogSampleWithEbaTest.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/JpaBlogSampleWithEbaTest.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/JpaBlogSampleWithEbaTest.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/JpaBlogSampleWithEbaTest.java Mon Dec 13 18:26:19 2010 @@ -156,6 +156,7 @@ bootDelegationPackages("javax.transactio mavenBundle("org.apache.aries", "org.apache.aries.util" ), mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi" ), mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"), + mavenBundle("org.apache.felix", "org.apache.felix.fileinstall" ), mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"), mavenBundle("org.apache.aries.application", "org.apache.aries.application.install" ), mavenBundle("org.apache.aries.application", "org.apache.aries.application.api" ), Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/QuiesceBlogSampleWithEbaTest.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/QuiesceBlogSampleWithEbaTest.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/QuiesceBlogSampleWithEbaTest.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/QuiesceBlogSampleWithEbaTest.java Mon Dec 13 18:26:19 2010 @@ -218,6 +218,7 @@ bootDelegationPackages("javax.transactio mavenBundle("org.apache.aries", "org.apache.aries.util" ), mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi" ), mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"), + mavenBundle("org.apache.felix", "org.apache.felix.fileinstall" ), mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"), mavenBundle("org.apache.aries.application", "org.apache.aries.application.install" ), mavenBundle("org.apache.aries.application", "org.apache.aries.application.api" ), Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/goat-api/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/goat-assembly/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/goat-bundlecontext-modelprovider/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/goat-dummy-provider/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/goat-dummy2-provider/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/goat-eba/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/goat-info-enhancer/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/samples/goat/goat-web/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,5 @@ +target +.classpath +.project +.settings + Modified: incubator/aries/sandbox/jbohn/interceptor-proto/samples/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/samples/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/samples/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/samples/pom.xml Mon Dec 13 18:26:19 2010 @@ -21,6 +21,7 @@ org.apache.aries java5-parent 0.3-incubating-SNAPSHOT + ../parent/default-parent/java5-parent/pom.xml 4.0.0 Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/contrib/pilot_using_weavinghook/Extender/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1 @@ +.settings Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/contrib/pilot_using_weavinghook/MyServiceImpl/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1,2 @@ +.settings +bin Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/contrib/pilot_using_weavinghook/MyServiceSPI/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1 @@ +bin Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/contrib/pilot_using_weavinghook/MyTestBundle/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1 @@ +.settings Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/contrib/pilot_using_weavinghook/MyTestBundleModifications/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1 @@ +.settings Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/contrib/pilot_using_weavinghook/ServiceLoaderAPI/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1 @@ +bin Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/contrib/pilot_using_weavinghook/SpiFly/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 13 18:26:19 2010 @@ -0,0 +1 @@ +.settings Modified: incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/spi-fly/pom.xml Mon Dec 13 18:26:19 2010 @@ -26,6 +26,7 @@ org.apache.aries java5-parent 0.3-incubating-SNAPSHOT + ../parent/default-parent/java5-parent/pom.xml org.apache.aries.spifly Modified: incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/pom.xml URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/pom.xml?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/pom.xml (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/pom.xml Mon Dec 13 18:26:19 2010 @@ -51,6 +51,16 @@ ${version} + org.apache.aries.subsystem + org.apache.aries.subsystem.scope.api + ${version} + + + org.apache.aries.subsystem + org.apache.aries.subsystem.scope.impl + ${version} + + org.apache.aries.testsupport org.apache.aries.testsupport.unit ${version} @@ -121,13 +131,16 @@ - + subsystem-api subsystem-core + subsystem-scope-api + subsystem-scope-impl subsystem-obr subsystem-executor subsystem-install + subsystem-example subsystem-itests - + Modified: incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/readme.txt URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/readme.txt?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/readme.txt (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/readme.txt Mon Dec 13 18:26:19 2010 @@ -1,9 +1,10 @@ -The Subsystems subproject uses RFC 138 which has not been published by the OSGi alliance yet. -The binaries are available from the OSGi repo if you are an OSGi alliance member. +The Subsystems subproject uses RFC 138(Framework hooks). You need to download the implementation jar at: - https://www.osgi.org/members/svn/build/trunk/licensed/repo/org.eclipse.osgi.v43prototype + http://download.eclipse.org/equinox/ You need to copy it in your local m2 repository: - ~/.m2/repository/org/eclipse/osgi/v43prototype-3.6.0.201003231329/osgi-v43prototype-3.6.0.201003231329.jar + ~/.m2/repository/org/eclipse/osgi/3.7.0.v20100910/osgi-3.7.0.v20100910.jar + +I tested using the 3.7M2 stable builds. Also, you need to run the following command to index your local m2 repo to ~/.m2/repository/repository.xml file. Propchange: incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/ ('svn:ignore' removed) Modified: incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/Subsystem.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/Subsystem.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/Subsystem.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/Subsystem.java Mon Dec 13 18:26:19 2010 @@ -193,6 +193,16 @@ public interface Subsystem { * * @return the content of this subsystem. */ - Collection getConstituents(); + Collection getBundles(); + //long getParentId(); + + public void updateHeaders(Map headers); + + /** + * return the subsystem managed by the subsystem + * @return + */ + Collection getChildrenSubsystems(); + } Modified: incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/SubsystemAdmin.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/SubsystemAdmin.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/SubsystemAdmin.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/SubsystemAdmin.java Mon Dec 13 18:26:19 2010 @@ -15,7 +15,6 @@ package org.apache.aries.subsystem; import java.io.InputStream; import java.util.Collection; -import java.util.concurrent.Future; import org.osgi.framework.Version; @@ -66,22 +65,16 @@ public interface SubsystemAdmin { */ Subsystem getSubsystem(String symbolicName, Version version); - /** - * Install a new subsystem from the specified location identifier. - * - * This method performs the same function as calling - * {@link #install(String, InputStream)} with the specified location - * identifier and a null InputStream. - * - * @param location - * @return a Future for the subsystem to be installed. - * @throws SecurityException - * If the caller does not have the appropriate - * AdminPermission[installed subsystem,LIFECYCLE], and the Java - * Runtime Environment supports permissions. - * + /** + * Install a new subsystem from the specified location identifier. + * + * This method performs the same function as calling {@link #install(String, InputStream)} with the specified + * location identifier and a null InputStream. + * + * @param location + * @return */ - Future install(String location); + Subsystem install(String location) throws SubsystemException; /** * Install a new subsystem from the specified InputStream @@ -100,32 +93,22 @@ public interface SubsystemAdmin { * * The following steps are required to install a subsystem: * - * A Future is returned. If there is a subsystem containing the - * same location identifier then the Subsystem will be immediately available - * from the Future. If there is already an install in progress for a - * subsystem with the same location identifier, then the Future returned is - * the same as the Future returned for the first install and a new install - * is not started. If this is a new install, then a new Future - * is returned with the installation process started. - * - * A Future returned performs the following installation steps: - * *
    - *
  1. The subsystem's content is read from the input stream. If this fails - * a SubsystemException is set on the Future.
  2. - *
  3. The empty subsystem object is created and assigned a unique id which - * is higher than any previous bundle of subsystem identifier.
  4. - *
  5. The subsystem's associated resources are located.
  6. - *
  7. The subsystem's state is set to INSTALLED
  8. - *
  9. The subsystem event of type INSTALLED is fired.
  10. - *
  11. Installation of subsystem content is started.
  12. - *
  13. The subsystem object for the newly installed subsystem is made - * available from the Future.
  14. + *
  15. If a subsystem containing the same location identifier is already + * installed, the Subsystem object for that subsystem is + * returned.
  16. + *
  17. The subsystem's content is read from the input stream. If + * this fails, a SubsystemException is thrown.
  18. + *
  19. The empty subsystem object is created and assigned a unique id + * which is higher than any previous bundle of subsystem identifier.
  20. + *
  21. The subsystem's associated resources are located.
  22. + *
  23. The subsystem's state is set to INSTALLED
  24. + *
  25. The subsystem event of type INSTALLED is fired.
  26. + *
  27. Installation of subsystem content is started.
  28. + *
  29. The subsystem object for the newly installed subsystem is returned.
  30. *
* - * TODO: discuss the above steps. Should we change to have the individual - * bundle installs also happen synchronously? At the moment you can get the - * Subsystem back and it's empty. This was a pain with the itests. + * TODO: discuss the above steps. * * @param location * The location identifier of the subsystem to be installed. @@ -133,26 +116,27 @@ public interface SubsystemAdmin { * The InputStream from where the subsystem is to be * installed or null if the location is to be used * to create the InputStream. - * @return a Future for the subsystem to be installed. + * @return the installed subsystem. + * @throws SubsystemException + * If the InputStream cannot be read or the + * installation fails. This exception is not thrown in the event + * of the subsystems contents failing to install. * @throws SecurityException * If the caller does not have the appropriate * AdminPermission[installed subsystem,LIFECYCLE], and the Java * Runtime Environment supports permissions. */ - Future install(String location, InputStream content); + Subsystem install(String location, InputStream content) throws SubsystemException; /** * Update the given subsystem. + * + * This method performs the same function as calling {@link #update(Subsystem, InputStream)} + * with the specified subsystem and a null InputStream. * - * This method performs the same function as calling - * {@link #update(Subsystem, InputStream)} with the specified subsystem and - * a null InputStream. - * - * @param subsystem - * The subsystem to be updated. - * @return a Future for the subsystem being updated. + * @param subsystem The subsystem to be updated. */ - Future update(Subsystem subsystem) throws SubsystemException; + void update(Subsystem subsystem) throws SubsystemException; /** * Update the given subsystem from an InputStream. @@ -170,7 +154,9 @@ public interface SubsystemAdmin { * subsystem or null if the * {@link SubsystemConstants#SUBSYSTEM_UPDATELOCATION * Subsystem-UpdateLocation} or original location are to be used. - * @return a Future for the subsystem being updated. + * @throws SubsystemException + * If the InputStream cannot be read of the update + * fails. * @throws IllegalStateException * If the subsystem is in the UNINSTALLED state. * @throws SecurityException @@ -179,7 +165,7 @@ public interface SubsystemAdmin { * subsystem and the updated subsystem and the Java Runtime * Environment supports permissions. */ - Future update(Subsystem subsystem, InputStream content) throws SubsystemException; + void update(Subsystem subsystem, InputStream content) throws SubsystemException; /** * Uninstall the given subsystem. @@ -220,5 +206,33 @@ public interface SubsystemAdmin { */ void uninstall(Subsystem subsystem) throws SubsystemException; + /** + * Cancel the current operation. + * + * The installing thread must throw a SubsystemException if the + * operation has actually been cancelled and rolled back before completion. + * + * @return true if an operation was ongoing and requested to be + * cancelled, false if there was no ongoing operation. + * + * TODO: discuss this. Why is it necessary? + */ + boolean cancel(); + + /** + * Gets the corresponding subsystem of the subsystemAdmin service. + * + * @return + */ + Subsystem getSubsystem(); + + /** + * Gets the parent subsystem of the subsystem that is managed by the + * subsystem admin. + * + * @return + */ + Subsystem getParentSubsystem(); + } \ No newline at end of file Modified: incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/SubsystemEvent.java URL: http://svn.apache.org/viewvc/incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/SubsystemEvent.java?rev=1045274&r1=1045273&r2=1045274&view=diff ============================================================================== --- incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/SubsystemEvent.java (original) +++ incubator/aries/sandbox/jbohn/interceptor-proto/subsystem/subsystem-api/src/main/java/org/apache/aries/subsystem/SubsystemEvent.java Mon Dec 13 18:26:19 2010 @@ -14,7 +14,6 @@ package org.apache.aries.subsystem; import java.io.InputStream; -import java.net.URL; /** * Event sent to listeners when an operation has been performed on a subsystem. @@ -66,25 +65,13 @@ public class SubsystemEvent { /** * Event type used to indicate a subsystem is stopping. */ - STOPPING, - - /** - * Event type used to indicate that the operation failed (e.g. an exception was thrown during installation). - */ - FAILED, - - /** - * Event type used to indicate that the operations was cancelled (e.g. an install was cancelled). - */ - CANCELLED + STOPPING } private final Type type; private final long timestamp; private final Subsystem subsystem; - - private final String location; /** * Constructs a new subsystem event. @@ -97,21 +84,6 @@ public class SubsystemEvent { this.type = type; this.timestamp = timestamp; this.subsystem = subsystem; - this.location = subsystem.getLocation(); - } - - /** - * Constructs a new subsystem event. - * - * @param type The type of the event. For example, INSTALLED. See {@link SubsystemEvent.Type} for the list of event types. - * @param timestamp The timestamp for the event. - * @param location The location of the subsystem for failure/cancellation cases. - */ - public SubsystemEvent(Type type, long timestamp, String location) { - this.type = type; - this.timestamp = timestamp; - this.location = location; - this.subsystem = null; } /** @@ -140,13 +112,4 @@ public class SubsystemEvent { return subsystem; } - /** - * Gets the location for the subsystem. - * - * @return the location of the subsystem. - */ - public String getLocation() { - return location; - } - }