Source:
<code>private void finishCreatingInstance(String id, ConnectorDescription description, DomainProvider domainProvider, ConnectorInstanceFactory factory) { Connector serviceInstance = factory.createNewInstance(id.toString()); if (serviceInstance == null) { throw new IllegalStateException("Factory cannot create a new service for instance id " + id.toString()); } factory.applyAttributes(serviceInstance, description.getAttributes()); if (!description.getAttributes().containsKey(Constants.SKIP_SET_DOMAIN_TYPE)) { serviceInstance.setDomainId(description.getDomainType()); serviceInstance.setConnectorId(description.getConnectorType()); } Class<?>[] clazzes = new Class<?>[]{ OpenEngSBService.class, Connector.class, Domain.class, domainProvider.getDomainInterface(), }; String[] clazznames = new String[clazzes.length]; for (int i = 0; i < clazzes.length; i++) { clazznames[i] = clazzes[i].getName(); } <START> ProxyFactory pfactory = new ProxyFactory(); <END> pfactory.setInterfaces(clazzes); if (INTERCEPTOR_BLACKLIST.contains(description.getDomainType())) { LOGGER.info("not proxying service because domain is blacklisted: ", serviceInstance); } else if (securityInterceptor == null) { LOGGER.warn("security interceptor is not available yet"); } else { pfactory.addAdvice(securityInterceptor); attributeStore.replaceAttributes(serviceInstance, new SecurityAttributeEntry("name", id)); } Object transformingInstance = serviceInstance; if(!(domainProvider.getDomainInterface().isAssignableFrom(serviceInstance.getClass()))) { LOGGER.info("creating transforming proxy for connector-service", id); transformingInstance = (Connector) Proxy.newProxyInstance(domainProvider.getDomainInterface().getClassLoader(), clazzes, new TransformingConnectorHandler(transformationEngine, serviceInstance)); } pfactory.setTarget(transformingInstance); Object secureInstance = pfactory.getProxy(this.getClass().getClassLoader()); Map<String, Object> properties = populatePropertiesWithRequiredAttributes(description.getProperties(), id, description); ServiceRegistration serviceRegistration = bundleContext.registerService(clazznames, secureInstance, MapAsDictionary.wrap(properties)); registrations.put(id, serviceRegistration); instances.put(id, serviceInstance); }</code><technical_language>naming proxyFactory</technical_language>

Target:
private void finishCreatingInstance(String id, ConnectorDescription description, DomainProvider domainProvider, ConnectorInstanceFactory factory) { Connector serviceInstance = factory.createNewInstance(id.toString()); if (serviceInstance == null) { throw new IllegalStateException("Factory cannot create a new service for instance id " + id.toString()); } factory.applyAttributes(serviceInstance, description.getAttributes()); if (!description.getAttributes().containsKey(Constants.SKIP_SET_DOMAIN_TYPE)) { serviceInstance.setDomainId(description.getDomainType()); serviceInstance.setConnectorId(description.getConnectorType()); } Class<?>[] clazzes = getClassesForDomainProvider(domainProvider); serviceInstance = proxyForTransformation(serviceInstance, domainProvider.getDomainInterface(), clazzes); serviceInstance = proxyForSecurity(id, description, serviceInstance, clazzes); Map<String, Object> properties = populatePropertiesWithRequiredAttributes(description.getProperties(), id, description); ServiceRegistration serviceRegistration = bundleContext.registerService(convertClassesToNames(clazzes), serviceInstance, MapAsDictionary.wrap(properties)); registrations.put(id, serviceRegistration); instances.put(id, serviceInstance); }