You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by da...@apache.org on 2010/12/04 15:10:34 UTC
svn commit: r1042187 - in
/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly: ./
META-INF/ src/org/apache/aries/spifly/ src/org/apache/aries/spifly/api/
Author: davidb
Date: Sat Dec 4 14:10:33 2010
New Revision: 1042187
URL: http://svn.apache.org/viewvc?rev=1042187&view=rev
Log:
Adding Bundle Tracker that registers the SPI impl as a service.
Added:
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/SPIBundleTrackerCustomizer.java
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SPIClassloaderAdviceService.java
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SpiFlyConstants.java
Modified:
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/Configurations.txt
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/META-INF/MANIFEST.MF
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java
incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/TCCLSetterVisitor.java
Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/Configurations.txt
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/Configurations.txt?rev=1042187&r1=1042186&r2=1042187&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/Configurations.txt (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/Configurations.txt Sat Dec 4 14:10:33 2010
@@ -1,3 +1,6 @@
SPI-Provider: true
+register service in registry
+register classloader with advice service
+
SPI-Consumer: true
\ No newline at end of file
Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/META-INF/MANIFEST.MF?rev=1042187&r1=1042186&r2=1042187&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/META-INF/MANIFEST.MF (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/META-INF/MANIFEST.MF Sat Dec 4 14:10:33 2010
@@ -7,5 +7,8 @@ Bundle-Activator: org.apache.aries.spifl
Import-Package: org.objectweb.asm;version="[3.2.0,4.0.0)",
org.osgi.framework;version="[1.3.0,2.0.0)",
org.osgi.framework.hooks.weaving;version="[1.0.0,2.0.0)",
- org.osgi.framework.wiring;version="[1.0.0,2.0.0)"
-Export-Package: org.apache.aries.spifly
+ org.osgi.framework.wiring;version="[1.0.0,2.0.0)",
+ org.osgi.service.log;version="[1.3.0,2.0.0)",
+ org.osgi.util.tracker;version="[1.5.0,2.0.0)"
+Export-Package: org.apache.aries.spifly,
+ org.apache.aries.spifly.api
Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java?rev=1042187&r1=1042186&r2=1042187&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/Activator.java Sat Dec 4 14:10:33 2010
@@ -18,20 +18,75 @@
*/
package org.apache.aries.spifly;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.weaving.WeavingHook;
+import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.BundleTracker;
+import org.osgi.util.tracker.ServiceTracker;
public class Activator implements BundleActivator {
- private ServiceRegistration<WeavingHook> weavingHookService;
+ private ServiceRegistration<WeavingHook> weavingHookService;
+ private LogServiceTracker lst;
+ private List<LogService> logServices = new CopyOnWriteArrayList<LogService>();
+ private BundleTracker<List<ServiceRegistration<?>>> bt;
+
+ public synchronized void start(BundleContext context) throws Exception {
+ lst = new LogServiceTracker(context);
+ lst.open();
+
+ WeavingHook wh = new MyWeavingHook();
+ weavingHookService = context.registerService(WeavingHook.class, wh,
+ null);
+
+ bt = new BundleTracker<List<ServiceRegistration<?>>>(context,
+ Bundle.ACTIVE, new SPIBundleTrackerCustomizer(this, context.getBundle()));
+ bt.open();
+ }
+
+ public synchronized void stop(BundleContext context) throws Exception {
+ bt.close();
+ weavingHookService.unregister();
+ lst.close();
+ }
+
+ void log(int level, String message) {
+ synchronized (logServices) {
+ for (LogService log : logServices) {
+ log.log(level, message);
+ }
+ }
+ }
+
+ void log(int level, String message, Throwable th) {
+ synchronized (logServices) {
+ for (LogService log : logServices) {
+ log.log(level, message, th);
+ }
+ }
+ }
+
+ private class LogServiceTracker extends ServiceTracker<LogService, LogService> {
+ public LogServiceTracker(BundleContext context) {
+ super(context, LogService.class, null);
+ }
+
+ public LogService addingService(ServiceReference<LogService> reference) {
+ LogService svc = super.addingService(reference);
+ if (svc != null)
+ logServices.add(svc);
+ return svc;
+ }
- public synchronized void start(BundleContext context) throws Exception {
- WeavingHook wh = new MyWeavingHook();
- weavingHookService = context.registerService(WeavingHook.class, wh, null);
- }
-
- public synchronized void stop(BundleContext context) throws Exception {
- weavingHookService.unregister();
- }
+ @Override
+ public void removedService(ServiceReference<LogService> reference, LogService service) {
+ logServices.remove(service);
+ }
+ }
}
Added: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java?rev=1042187&view=auto
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java (added)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/HeaderParser.java Sat Dec 4 14:10:33 2010
@@ -0,0 +1,114 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.spifly;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Utility class to parse a standard OSGi header with paths.
+ *
+ * Stolen from Aries Blueprint Core (blueprint.utils). Need to give it back!
+ */
+public class HeaderParser {
+
+ /**
+ * Parse a given OSGi header into a list of paths
+ *
+ * @param header the OSGi header to parse
+ * @return the list of paths extracted from this header
+ */
+ public static List<PathElement> parseHeader(String header) {
+ List<PathElement> elements = new ArrayList<PathElement>();
+ if (header == null || header.trim().length() == 0) {
+ return elements;
+ }
+ String[] clauses = header.split(",");
+ for (String clause : clauses) {
+ String[] tokens = clause.split(";");
+ if (tokens.length < 1) {
+ throw new IllegalArgumentException("Invalid header clause: " + clause);
+ }
+ PathElement elem = new PathElement(tokens[0].trim());
+ elements.add(elem);
+ for (int i = 1; i < tokens.length; i++) {
+ int pos = tokens[i].indexOf('=');
+ if (pos != -1) {
+ if (pos > 0 && tokens[i].charAt(pos - 1) == ':') {
+ String name = tokens[i].substring(0, pos - 1).trim();
+ String value = tokens[i].substring(pos + 1).trim();
+ elem.addDirective(name, value);
+ } else {
+ String name = tokens[i].substring(0, pos).trim();
+ String value = tokens[i].substring(pos + 1).trim();
+ elem.addAttribute(name, value);
+ }
+ } else {
+ elem = new PathElement(tokens[i].trim());
+ elements.add(elem);
+ }
+ }
+ }
+ return elements;
+ }
+
+ public static class PathElement {
+
+ private String path;
+ private Map<String, String> attributes;
+ private Map<String, String> directives;
+
+ public PathElement(String path) {
+ this.path = path;
+ this.attributes = new HashMap<String, String>();
+ this.directives = new HashMap<String, String>();
+ }
+
+ public String getName() {
+ return this.path;
+ }
+
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
+
+ public String getAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ public void addAttribute(String name, String value) {
+ attributes.put(name, value);
+ }
+
+ public Map<String, String> getDirectives() {
+ return directives;
+ }
+
+ public String getDirective(String name) {
+ return directives.get(name);
+ }
+
+ public void addDirective(String name, String value) {
+ directives.put(name, value);
+ }
+
+ }
+}
Added: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/SPIBundleTrackerCustomizer.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/SPIBundleTrackerCustomizer.java?rev=1042187&view=auto
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/SPIBundleTrackerCustomizer.java (added)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/SPIBundleTrackerCustomizer.java Sat Dec 4 14:10:33 2010
@@ -0,0 +1,222 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.spifly;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.aries.spifly.HeaderParser.PathElement;
+import org.apache.aries.spifly.api.SPIClassloaderAdviceService;
+import org.apache.aries.spifly.api.SpiFlyConstants;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.BundleTrackerCustomizer;
+
+public class SPIBundleTrackerCustomizer implements BundleTrackerCustomizer<List<ServiceRegistration<?>>> {
+ final Activator activator;
+ final Bundle spiBundle;
+
+ public SPIBundleTrackerCustomizer(Activator a, Bundle b) {
+ activator = a;
+ spiBundle = b;
+ }
+
+ public List<ServiceRegistration<?>> addingBundle(Bundle bundle, BundleEvent event) {
+ log(LogService.LOG_INFO, "Bundle Considered for SPI providers: "
+ + bundle.getSymbolicName());
+
+ if (bundle.equals(spiBundle)) {
+ return null;
+ }
+
+ if (bundle.getHeaders().get(SpiFlyConstants.SPI_PROVIDER_HEADER) == null) {
+ log(LogService.LOG_INFO, "No '"
+ + SpiFlyConstants.SPI_PROVIDER_HEADER
+ + "' Manifest header. Skipping bundle: "
+ + bundle.getSymbolicName());
+ return null;
+ } else {
+ log(LogService.LOG_INFO, "Examining bundle for SPI provider: "
+ + bundle.getSymbolicName());
+ }
+
+ Enumeration<?> entries = bundle.findEntries("META-INF/services", "*", false);
+ if (entries == null) {
+ return null;
+ }
+
+ List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
+ while (entries.hasMoreElements()) {
+ URL url = (URL) entries.nextElement();
+ log(LogService.LOG_INFO, "Found SPI resource: " + url);
+
+ try {
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(url.openStream()));
+ String className = reader.readLine();
+ // TODO need to read more than one class name!
+
+ Class<?> cls = bundle.loadClass(className);
+ Object o = cls.newInstance();
+ log(LogService.LOG_INFO, "Instantiated SPI provider: " + o);
+
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ props.put(SpiFlyConstants.SPI_PROVIDER_URL, url);
+
+ String s = url.toExternalForm();
+ int idx = s.lastIndexOf('/');
+ String registrationClassName = className;
+ if (s.length() > idx) {
+ registrationClassName = s.substring(idx + 1);
+ }
+
+ ServiceRegistration<?> reg = bundle.getBundleContext()
+ .registerService(registrationClassName, o, props);
+ registrations.add(reg);
+ log(LogService.LOG_INFO, "Registered service: " + reg);
+ } catch (Exception e) {
+ log(LogService.LOG_WARNING,
+ "Could not load SPI implementation referred from " + url, e);
+ }
+ }
+
+ /*
+ // the new approach - services are being registered based on contents of
+ // the SPI-Provider header
+ if (bundleClassloader == null) {
+ log(LogService.LOG_INFO, "Unable to identify classloader. "
+ + "Skipping SPIClassloaderAdviceService(s) registeration.");
+ } else {
+
+ // Register SPIClassloaderAdviceService services for APIs mentioned
+ // in the header
+ String spiProviderHeader = (String) bundle.getHeaders().get(
+ SpiFlyConstants.SPI_PROVIDER_HEADER);
+ List<PathElement> parsedHeader = HeaderParser
+ .parseHeader(spiProviderHeader);
+ for (PathElement pe : parsedHeader) {
+
+ // Format of each path element:
+ // api1Name;provider-name="myimpl2";service-ids="myserviceId"
+
+ // An example below.
+ // Please note:
+ // 1. The service-ids attribute holds a list of ids that will be
+ // used when searching META-INF/services/. In other words
+ // this will be the name of the class that will be passed to
+ // ServiceLoader.load().
+ // 2. A single bundle can provide implementations for many APIs
+ // - there might be many api names in a single SPI-Provider
+ // header.
+
+ // Sample:
+ // jaxb;provider-name="xerces123";service-ids="javax.xml.bind.JAXBContext"
+
+ // the clause begins with a name of the API for which this
+ // bundle provides an impl
+ String apiName = pe.getName();
+ // unique name of the provider
+ String providerName = pe
+ .getAttribute(SpiFlyConstants.PROVIDER_NAME_ATTRIBUTE);
+ providerName = trimQuotes(providerName);
+
+ //
+ String serviceIds = pe
+ .getAttribute(SpiFlyConstants.SERVICE_IDS_ATTRIBUTE);
+ serviceIds = trimQuotes(serviceIds);
+
+ if (apiName == null || providerName == null
+ || serviceIds == null) {
+ log(LogService.LOG_INFO, "Skipping: " + apiName + " "
+ + providerName + " " + serviceIds
+ + ". Null values are not allowed.");
+ }
+
+ StringTokenizer tokenizer = new StringTokenizer(serviceIds, ",");
+ while (tokenizer.hasMoreTokens()) {
+ String serviceId = tokenizer.nextToken().trim();
+ SPIClassloaderAdviceServiceImpl service = new SPIClassloaderAdviceServiceImpl(
+ bundleClassloader);
+ Hashtable<String, Object> props = new Hashtable<String, Object>();
+ props.put(SpiFlyConstants.API_NAME_SERVICE_ATTRIBUTE,
+ apiName);
+ props.put(SpiFlyConstants.PROVIDER_NAME_SERVICE_ATTRIBUTE,
+ providerName);
+ props.put(SpiFlyConstants.SERVICE_ID_SERVICE_ATTRIBUTE,
+ serviceId);
+ ServiceRegistration reg = bundle
+ .getBundleContext()
+ .registerService(
+ SPIClassloaderAdviceService.class.getName(),
+ service, props);
+ registrations.add(reg);
+ log(LogService.LOG_INFO, "Registered service: " + reg);
+ }
+ }
+
+ } */
+
+ return registrations;
+ }
+
+ public void modifiedBundle(Bundle bundle, BundleEvent event, List<ServiceRegistration<?>> registrations) {
+ // nothing to do here
+ }
+
+ public void removedBundle(Bundle bundle, BundleEvent event, List<ServiceRegistration<?>> registrations) {
+ if (registrations == null)
+ return;
+
+ for (ServiceRegistration<?> reg : registrations) {
+ reg.unregister();
+ log(LogService.LOG_INFO, "Unregistered: " + reg);
+ }
+ }
+
+ private String trimQuotes(String input) {
+ if (input == null) {
+ return input;
+ }
+ if (input.startsWith("\"")) {
+ input = input.substring(1);
+ }
+
+ if (input.endsWith("\"")) {
+ input = input.substring(0, input.length() - 1);
+ }
+
+ return input;
+ }
+
+ private void log(int level, String message) {
+ activator.log(level, message);
+ }
+
+ private void log(int level, String message, Throwable th) {
+ activator.log(level, message, th);
+ }
+}
Modified: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/TCCLSetterVisitor.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/TCCLSetterVisitor.java?rev=1042187&r1=1042186&r2=1042187&view=diff
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/TCCLSetterVisitor.java (original)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/TCCLSetterVisitor.java Sat Dec 4 14:10:33 2010
@@ -27,6 +27,8 @@ import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class TCCLSetterVisitor extends ClassAdapter implements ClassVisitor, Opcodes {
+ private static final String UTIL_CLASS = Util.class.getName().replace('.', '/');
+ private static final String VOID_RETURN_TYPE = "()V";
public TCCLSetterVisitor(ClassVisitor cv) {
super(cv);
@@ -56,16 +58,16 @@ public class TCCLSetterVisitor extends C
"java/util/ServiceLoader".equals(owner) &&
"load".equals(name)) {
System.out.println("+++ Gotcha!");
-
- mv.visitMethodInsn(INVOKESTATIC, "testweavinghook/Util",
- "storeContextClassloader", "()V");
- mv.visitMethodInsn(INVOKESTATIC, "testweavinghook/Util",
- "fixContextClassloader", "()V");
+
+ mv.visitMethodInsn(INVOKESTATIC, UTIL_CLASS,
+ "storeContextClassloader", VOID_RETURN_TYPE);
+ mv.visitMethodInsn(INVOKESTATIC, UTIL_CLASS,
+ "fixContextClassloader", VOID_RETURN_TYPE);
super.visitMethodInsn(opcode, owner, name, desc);
- mv.visitMethodInsn(INVOKESTATIC, "testweavinghook/Util",
- "restoreContextClassloader", "()V");
+ mv.visitMethodInsn(INVOKESTATIC, UTIL_CLASS,
+ "restoreContextClassloader", VOID_RETURN_TYPE);
} else {
super.visitMethodInsn(opcode, owner, name, desc);
}
Added: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SPIClassloaderAdviceService.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SPIClassloaderAdviceService.java?rev=1042187&view=auto
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SPIClassloaderAdviceService.java (added)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SPIClassloaderAdviceService.java Sat Dec 4 14:10:33 2010
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.spifly.api;
+
+public interface SPIClassloaderAdviceService {
+ ClassLoader getServiceClassLoader(Class<?> cls);
+}
Added: incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SpiFlyConstants.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SpiFlyConstants.java?rev=1042187&view=auto
==============================================================================
--- incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SpiFlyConstants.java (added)
+++ incubator/aries/trunk/spi-fly/contrib/pilot_using_weavinghook/SpiFly/src/org/apache/aries/spifly/api/SpiFlyConstants.java Sat Dec 4 14:10:33 2010
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.spifly.api;
+
+public interface SpiFlyConstants {
+
+ /*
+ * Header names
+ */
+
+ String SPI_CONSUMER_HEADER = "SPI-Consumer";
+
+ String SPI_PROVIDER_HEADER = "SPI-Provider";
+
+ /*
+ * Attributes to be used with the SPI-Provider and SPI-Consumer headers
+ */
+
+ String PROVIDER_NAME_ATTRIBUTE = "provider-name";
+
+ String SERVICE_IDS_ATTRIBUTE = "service-ids";
+
+ /*
+ * Attributes to be used with services created using the 'old' approach
+ */
+
+ String SPI_PROVIDER_URL = "spi.provider.url";
+
+ /*
+ * Attributes to be used with services created using the 'new' approach
+ */
+
+ String SERVICE_ID_SERVICE_ATTRIBUTE = "ServiceId";
+
+ String PROVIDER_NAME_SERVICE_ATTRIBUTE = "ProviderName";
+
+ String API_NAME_SERVICE_ATTRIBUTE = "ApiName";
+
+}