public ObjectOutput newAMF3Serializer(OutputStream out) { try { return amf3SerializerConstructor.newInstance(new Object[]{out}); } catch (Exception e) { throw new GraniteConfigException("Could not create serializer instance with: " + amf3SerializerConstructor, e); } }
public ObjectInput newAMF3Deserializer(InputStream in) { try { return amf3DeserializerConstructor.newInstance(new Object[]{in}); } catch (Exception e) { throw new GraniteConfigException("Could not create deserializer instance with: " + amf3DeserializerConstructor, e); } }
public Class<? extends ActionScriptClassDescriptor> getInstance(String type, GraniteConfig config) throws GraniteConfigException { try { return TypeUtil.forName(type, ActionScriptClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load ActionScriptClassDescriptor type: " + type, e); } }
public TideComponentInstanceOfMatcher(String type, boolean disabled) { try { parentClass = TypeUtil.forName(type); this.disabled = disabled; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate instanceof matcher parent class: " + type, e); } }
public TideComponentAnnotatedWithMatcher(String type, boolean disabled) { try { annotationClass = TypeUtil.forName(type, Annotation.class); this.disabled = disabled; } catch (Exception e) { throw new GraniteConfigException("Could not instantiate instanceof matcher parent class: " + type, e); } }
public TideComponentMatcher getTypeMatcher(String type, boolean disabled) throws GraniteConfigException { try { return new TideComponentTypeMatcher(type, disabled); } catch (Exception e) { throw new GraniteConfigException("Could not instantiate Tide component matcher for type: " + type, e); } }
public TideComponentMatcher getInstanceOfMatcher(String type, boolean disabled) throws GraniteConfigException { try { return new TideComponentInstanceOfMatcher(type, disabled); } catch (Exception e) { throw new GraniteConfigException("Could not instantiate Tide component matcher for instance of: " + type, e); } }
public TideComponentMatcher getAnnotatedWithMatcher(String type, boolean disabled) throws GraniteConfigException { try { return new TideComponentAnnotatedWithMatcher(type, disabled); } catch (Exception e) { throw new GraniteConfigException("Could not instantiate Tide component matcher for annotated with: " + type, e); } }
public Class<? extends JavaClassDescriptor> getInstance(String type, GraniteConfig config) throws GraniteConfigException { try { return TypeUtil.forName(type, JavaClassDescriptor.class); } catch (Exception e) { throw new GraniteConfigException("Could not load JavaClassDescriptor type: " + type, e); } }
public TideComponentMatcher getNameMatcher(String name, boolean disabled) throws GraniteConfigException { try { return new TideComponentNameMatcher(name, disabled); } catch (Exception e) { throw new GraniteConfigException("Could not instantiate Tide component matcher for name: " + name, e); } }
private void finishCustomConverters(boolean custom) { try { converters = new Converters(converterClasses); } catch (Exception e) { throw new GraniteConfigException("Could not construct new Converters instance", e); } // Cleanup... if (custom) converterClasses = null; }
private Externalizer newInstance(String externalizerType, GraniteConfig config) { Externalizer externalizer = externalizersCache.get(externalizerType); if (externalizer == null) { try { externalizer = TypeUtil.newInstance(externalizerType, Externalizer.class); } catch (Exception e) { throw new GraniteConfigException("Could not instantiate externalizer: " + externalizerType, e); } Externalizer previous = externalizersCache.putIfAbsent(externalizerType, externalizer); if (previous != null) externalizer = previous; else externalizer.configure(config.getExternalizersConfiguration()); } return externalizer; } }
private void loadCustomJMFExtendedCodecs(XMap element, boolean custom) { String jmfExtendedCodecsMode = element.get("jmf-extended-codecs/@mode"); if (jmfExtendedCodecsMode != null) { try { this.jmfExtendedCodecsMode = JMF_EXTENSIONS_MODE.valueOf(jmfExtendedCodecsMode.toLowerCase()); } catch (Exception e) { throw new GraniteConfigException("Illegal JMF extended codecs mode: " + jmfExtendedCodecsMode, e); } } for (XMap codec : element.getAll("jmf-extended-codecs/jmf-extended-codec")) { String codecType = codec.get("@type"); try { jmfExtendedCodecs.add((ExtendedObjectCodec)TypeUtil.newInstance(codecType)); } catch (Exception e) { throw new GraniteConfigException("Could not instantiate JMF extended codec: " + codecType, e); } } }
private void loadCustomJMFDefaultStoredStrings(XMap element, boolean custom) { String jmfDefaultStoredStringsMode = element.get("jmf-default-stored-strings/@mode"); if (jmfDefaultStoredStringsMode != null) { try { this.jmfDefaultStoredStringsMode = JMF_EXTENSIONS_MODE.valueOf(jmfDefaultStoredStringsMode.toLowerCase()); } catch (Exception e) { throw new GraniteConfigException("Illegal JMF default stored strings mode: " + jmfDefaultStoredStringsMode, e); } } for (XMap codec : element.getAll("jmf-default-stored-strings/jmf-default-stored-string")) jmfDefaultStoredStrings.add(codec.get("@value")); }
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 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); } } }
/** * Read custom class exception converters * Converter must have 'type' attribute */ private void loadCustomExceptionConverters(XMap element, boolean custom) { for (XMap exceptionConverter : element.getAll("exception-converters/exception-converter")) { String type = exceptionConverter.get("@type"); ExceptionConverter converter = null; try { converter = (ExceptionConverter)TypeUtil.newInstance(type); exceptionConverters.add(converter); } catch (Exception e) { throw new GraniteConfigException("Could not construct exception converter: " + type, e); } } }
private void loadCustomMessageSelector(XMap element, boolean custom) { XMap selector = element.getOne("message-selector"); if (selector != null) { String type = selector.get("@type"); try { messageSelectorConstructor = TypeUtil.getConstructor(type, new Class<?>[]{ String.class }); } catch (Exception e) { throw new GraniteConfigException("Could not construct message selector: " + type, e); } } }
private void loadCustomDistributedDataFactory(XMap element, boolean custom) { XMap distributedDataFactory = element.getOne("distributed-data-factory"); if (distributedDataFactory != null) { String type = distributedDataFactory.get("@type"); try { this.distributedDataFactory = (DistributedDataFactory)TypeUtil.newInstance(type); } catch (Exception e) { throw new GraniteConfigException("Could not construct build distributed data factory: " + type, e); } } }