public Transport newRemotingTransport() { try { return TypeUtil.newInstance("org.granite.client.messaging.transport.apache.ApacheAsyncTransport", Transport.class); } catch (Exception e) { throw new RuntimeException("Could not create Apache transport"); } }
public Configuration newConfiguration() { try { return TypeUtil.newInstance("org.granite.client.configuration.SimpleConfiguration", Configuration.class); } catch (Throwable t) { throw new RuntimeException("Could not create simple configuration", t); } }
public Transport newRemotingTransport() { try { return TypeUtil.newInstance("org.granite.client.messaging.transport.apache.ApacheAsyncTransport", Transport.class); } catch (Exception e) { throw new RuntimeException("Could not create Apache transport"); } }
public Configuration newConfiguration() { try { return TypeUtil.newInstance("org.granite.client.configuration.SimpleConfiguration", Configuration.class); } catch (Throwable t) { throw new RuntimeException("Could not create simple configuration", t); } }
public RemotingChannel buildRemotingChannel(Class<? extends RemotingChannel> channelClass, String id, URI uri, int maxConcurrentRequests, Transport transport, MessagingCodec<AMF0Message> codec) { try { return TypeUtil.newInstance(channelClass, new Class<?>[] { Transport.class, MessagingCodec.class, String.class, URI.class, int.class }, new Object[] { transport, codec, id, uri, maxConcurrentRequests }); } catch (Exception e) { throw new RuntimeException("Could not build remoting channel for class " + channelClass, e); } }
public RemotingChannel buildRemotingChannel(Class<? extends RemotingChannel> channelClass, String id, URI uri, int maxConcurrentRequests, Transport transport, MessagingCodec<AMF0Message> codec) { try { return TypeUtil.newInstance(channelClass, new Class<?>[] { Transport.class, MessagingCodec.class, String.class, URI.class, int.class }, new Object[] { transport, codec, id, uri, maxConcurrentRequests }); } catch (Exception e) { throw new RuntimeException("Could not build remoting channel for class " + channelClass, e); } }
@Override public Object newJavaInstance() { if (type.length() == 0) return new HashMap<String, Object>(); String className = (instantiator != null ? instantiator : type); try { return TypeUtil.newInstance(className); } catch (Exception e) { throw new RuntimeException("Could not create instance of: " + className, e); } } }
private void handleClass(Class<?> clazz) { if (clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers())) return; if (Externalizer.class.isAssignableFrom(clazz)) { try { scannedExternalizers.add(TypeUtil.newInstance(clazz, Externalizer.class)); } catch (Exception e) { log.error(e, "Could not create new instance of: %s", clazz); } } }
public void setFilterClass(Class<F> filterClass) throws IllegalAccessException, InstantiationException { if (Map.class.isAssignableFrom(filterClass)) { setFilter(null); return; } this.filterClass = filterClass; setFilter(TypeUtil.newInstance(filterClass, filterClass)); }
public void configure(XMap adapterProperties, XMap destinationProperties) throws ServiceException { String securityPolicy = adapterProperties.get("security-policy"); if (securityPolicy != null) { try { this.securityPolicy = TypeUtil.newInstance(securityPolicy, SecurityPolicy.class); } catch (Exception e) { log.error(e, "Could not create instance of %s (using default security policy)", securityPolicy); } } }
public PersistentCollection clone(boolean uninitialize) { try { @SuppressWarnings("unchecked") AbstractPersistentCollection<C> collection = TypeUtil.newInstance(getClass(), AbstractPersistentCollection.class); if (wasInitialized() && !uninitialize) collection.init(getCollection(), getDetachedState(), isDirty()); return collection; } catch (Exception e) { throw new RuntimeException("Could not clone collection " + this.getClass().getName(), e); } }
public PersistentCollection<C> clone(boolean uninitialize) { try { @SuppressWarnings("unchecked") AbstractPersistentCollection<C> collection = TypeUtil.newInstance(getClass(), AbstractPersistentCollection.class); if (wasInitialized() && !uninitialize) collection.init(getCollection(), getDetachedState(), isDirty()); return collection; } catch (Exception e) { throw new RuntimeException("Could not clone collection " + this.getClass().getName(), e); } }
private void loadCustomMethodMatcher(XMap element, boolean custom) { XMap methodMatcher = element.getOne("method-matcher"); if (methodMatcher != null) { String type = methodMatcher.get("@type"); try { this.methodMatcher = (MethodMatcher)TypeUtil.newInstance(type); } catch (Exception e) { throw new GraniteConfigException("Could not construct method matcher: " + type, e); } } }
private void loadCustomClassGetter(XMap element, boolean custom) { XMap classGetter = element.getOne("class-getter"); if (classGetter != null) { String type = classGetter.get("@type"); try { this.classGetter = (ClassGetter)TypeUtil.newInstance(type); classGetterSet = true; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate ClassGetter: " + type, e); } } }
private void loadCustomClassGetter(XMap element, boolean custom) { XMap classGetter = element.getOne("class-getter"); if (classGetter != null) { String type = classGetter.get("@type"); try { this.classGetter = (ClassGetter)TypeUtil.newInstance(type); classGetterSet = true; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate ClassGetter: " + type, e); } } }
private void loadCustomInvocationListener(XMap element, boolean custom) { XMap invocationListener = element.getOne("invocation-listener"); if (invocationListener != null) { String type = invocationListener.get("@type"); try { this.invocationListener = (ServiceInvocationListener)TypeUtil.newInstance(type); } catch (Exception e) { throw new GraniteConfigException("Could not instantiate ServiceInvocationListener: " + type, e); } } }
private void loadCustomAMF3MessageInterceptor(XMap element, boolean custom) { XMap interceptor = element.getOne("amf3-message-interceptor"); if (interceptor != null) { String type = interceptor.get("@type"); try { amf3MessageInterceptor = (AMF3MessageInterceptor)TypeUtil.newInstance(type); } catch (Exception e) { throw new GraniteConfigException("Could not construct amf3 message interceptor: " + type, e); } } }
private void loadCustomInvocationListener(XMap element, boolean custom) { XMap invocationListener = element.getOne("invocation-listener"); if (invocationListener != null) { String type = invocationListener.get("@type"); try { this.invocationListener = (ServiceInvocationListener)TypeUtil.newInstance(type); } catch (Exception e) { throw new GraniteConfigException("Could not instantiate ServiceInvocationListener: " + type, e); } } }
private void loadCustomClassGetter(XMap element, boolean custom) { XMap classGetter = element.getOne("class-getter"); if (classGetter != null) { String type = classGetter.get("@type"); try { this.classGetter = (ClassGetter)TypeUtil.newInstance(type); classGetterSet = true; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate ClassGetter: " + type, e); } } }
private void loadCustomClassGetter(XMap element, boolean custom) { XMap classGetter = element.getOne("class-getter"); if (classGetter != null) { String type = classGetter.get("@type"); try { this.classGetter = (ClassGetter)TypeUtil.newInstance(type); classGetterSet = true; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate ClassGetter: " + type, e); } } }