private void addJAXBInterceptor(JmsWireSource source, PhysicalWireTarget target, PhysicalOperation op, InvocationChain chain) { ClassLoader sourceClassLoader = source.getClassLoader(); ClassLoader targetClassLoader = target.getClassLoader(); List<DataType> jaxTypes = DataTypeHelper.createTypes(op); Interceptor jaxbInterceptor = interceptorFactory.createInterceptor(op, DataTypeHelper.JAXB_TYPES, jaxTypes, targetClassLoader, sourceClassLoader); chain.addInterceptor(jaxbInterceptor); }
/** * Returns a key for a map-style reference or null if there is no key associated with the reference. * * @param source the source metadata * @param target the target metadata * @return the key * @throws Fabric3Exception if there is an error instantiating the key */ @SuppressWarnings("unchecked") protected Object getKey(PojoWireSource source, PhysicalWireTarget target) throws Fabric3Exception { if (!source.isKeyed()) { return null; } String key = source.getKey(); // The target classloader must be used since the key class may not be visible to the source classloader, for example, when subclasses are used as keys ClassLoader targetClassLoader = target.getClassLoader(); Class<?> keyType = ClassLoading.loadClass(targetClassLoader, source.getKeyClassName()); if (String.class.equals(keyType)) { // short-circuit the transformation and return the string return key; } else if (Enum.class.isAssignableFrom(keyType)) { // enum, instantiate it directly Class<Enum> enumClass = (Class<Enum>) keyType; return Enum.valueOf(enumClass, key); } JavaType targetType = new JavaType(keyType); return createKey(targetType, key, targetClassLoader); }
/** * Returns a key for a map-style reference or null if there is no key associated with the reference. * * @param source the source metadata * @param target the target metadata * @return the key * @throws Fabric3Exception if there is an error instantiating the key */ @SuppressWarnings("unchecked") protected Object getKey(PojoWireSource source, PhysicalWireTarget target) throws Fabric3Exception { if (!source.isKeyed()) { return null; } String key = source.getKey(); // The target classloader must be used since the key class may not be visible to the source classloader, for example, when subclasses are used as keys ClassLoader targetClassLoader = target.getClassLoader(); Class<?> keyType = ClassLoading.loadClass(targetClassLoader, source.getKeyClassName()); if (String.class.equals(keyType)) { // short-circuit the transformation and return the string return key; } else if (Enum.class.isAssignableFrom(keyType)) { // enum, instantiate it directly Class<Enum> enumClass = (Class<Enum>) keyType; return Enum.valueOf(enumClass, key); } JavaType targetType = new JavaType(keyType); return createKey(targetType, key, targetClassLoader); }
public void attach(ZeroMQWireSource source, PhysicalWireTarget target, Wire wire) { URI uri = source.getCallbackUri() != null ? source.getCallbackUri() : target.getUri(); ClassLoader loader = target.getClassLoader(); List<InvocationChain> chains = ZeroMQAttacherHelper.sortChains(wire); ZeroMQMetadata metadata = source.getMetadata(); broker.connectToReceiver(uri, chains, metadata, loader); }