in provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/FastBinProvider.java [104:172]
public Endpoint exportService(final Object serviceO,
BundleContext serviceContext,
Map<String, Object> effectiveProperties,
Class[] exportedInterfaces) {
// Compute properties
/*
Map<String, Object> properties = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
for (String k : reference.getPropertyKeys()) {
properties.put(k, reference.getProperty(k));
}
// Bail out if there is any intents specified, we don't support any
Set<String> intents = Utils.normalize(properties.get(SERVICE_EXPORTED_INTENTS));
Set<String> extraIntents = Utils.normalize(properties.get(SERVICE_EXPORTED_INTENTS_EXTRA));
if (!intents.isEmpty() || !extraIntents.isEmpty()) {
throw new UnsupportedOperationException();
}
// Bail out if there are any configurations specified, we don't support any
Set<String> configs = Utils.normalize(properties.get(SERVICE_EXPORTED_CONFIGS));
if (configs.isEmpty()) {
configs.add(CONFIG);
} else if (!configs.contains(CONFIG)) {
throw new UnsupportedOperationException();
}
URI connectUri = new URI(this.server.getConnectAddress());
String fabricAddress = connectUri.getScheme() + "://" + exportedAddress + ":" + connectUri.getPort();
properties.remove(SERVICE_EXPORTED_CONFIGS);
properties.put(SERVICE_IMPORTED_CONFIGS, new String[] { CONFIG });
properties.put(ENDPOINT_FRAMEWORK_UUID, this.uuid);
properties.put(FABRIC_ADDRESS, fabricAddress);
String uuid = UuidGenerator.getUUID();
properties.put(ENDPOINT_ID, uuid);
*/
String endpointId = UuidGenerator.getUUID();
effectiveProperties.put(RemoteConstants.ENDPOINT_ID, endpointId);
URI connectUri = URI.create(this.server.getConnectAddress());
String fastbinAddress = connectUri.getScheme() + "://" + exportedAddress + ":" + connectUri.getPort();
effectiveProperties.put(FASTBIN_ADDRESS, fastbinAddress);
effectiveProperties.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, getSupportedTypes());
// Now, export the service
final EndpointDescription description = new EndpointDescription(effectiveProperties);
// Export it
server.registerService(description.getId(), new ServerInvoker.ServiceFactory() {
public Object get() {
return serviceO;
}
public void unget() {
}
}, serviceO.getClass().getClassLoader());
return new Endpoint() {
@Override
public EndpointDescription description() {
return description;
}
@Override
public void close() throws IOException {
server.unregisterService(description.getId());
}
};
}