protected void addAnnotationsConfigBuilderIfPresent(List<ConfigurationBuilder> builders) throws Exception { // If the annotations module is on the classpath, add the annotations config builder to // the list. This will enable annotations config for this instance. if (ClassUtils.isClassOnPath(MuleServer.CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, getClass())) { Object configBuilder = ClassUtils.instanciateClass( MuleServer.CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, ClassUtils.NO_ARGS, getClass()); builders.add((ConfigurationBuilder) configBuilder); } }
public PayloadTypeFilter(String expectedType) throws ClassNotFoundException { this(ClassUtils.loadClass(expectedType, PayloadTypeFilter.class)); }
/** * Looks for the {@link #ORACLE_XMLTYPE_CLASS} class in the classpath and returns a reference to it * * @return the {@link #ORACLE_XMLTYPE_CLASS} class object * @throws java.lang.ClassNotFoundException if there required class in not in the classpath */ public static Class<?> getXmlTypeClass() throws ClassNotFoundException { return ClassUtils.getClass(ORACLE_XMLTYPE_CLASS); } }
public static Object instanciateClass(String name, Object[] constructorArgs, Class<?> callingClass) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Class<?> clazz = loadClass(name, callingClass); return instanciateClass(clazz, constructorArgs); }
@Override protected BPMS createBpms() throws Exception { return (BPMS) ClassUtils.instanciateClass(BpmNamespaceHandler.JBPM_WRAPPER_CLASS, configurationResource, processDefinitions); }
private static Component newJaxRsComponentWrapper(MuleContext muleContext, Component component) { try { Component jrc = (Component) ClassUtils.instanciateClass("org.mule.module.jersey.JerseyResourcesComponent"); Method setComponentsMethod = ClassUtils.getMethod(jrc.getClass(), "setComponents", new Class<?>[]{List.class}); setComponentsMethod.invoke(jrc, Collections.singletonList(component)); ((MuleContextAware) jrc).setMuleContext(muleContext); return jrc; } catch (Exception e) { throw new MuleRuntimeException( MessageFactory.createStaticMessage("Failed to configure the required web service infrastructure: are you missing the Mule Jersey Module?"), e); } }
Properties props = loadProperties(getResource("configuration-builders.properties", this.getClass()).openStream()); if (className == null || !ClassUtils.isClassOnPath(className, this.getClass())) ConfigurationBuilder cb = (ConfigurationBuilder) ClassUtils.instanciateClass(className, new Object[] {constructorArg}); if (domainContext != null && cb instanceof DomainMuleContextAwareConfigurationBuilder)
Enumeration<?> e = ClassUtils.getResources(SERVICE_PATH + CORE_EXTENSION_PROPERTIES, getClass()); List<Properties> extensions = new LinkedList<Properties>(); try MuleCoreExtension extension = (MuleCoreExtension) ClassUtils.instanciateClass(extClass); result.add(extension);
protected void printResult(DOMResult result) { // Since mule-module-xml isn't (and can't be) a dependency of mule-core, we don't know // whether we have it on the classpath or not. try { Class xmlUtils = ClassUtils.loadClass(XML_UTILS_CLASS, getClass()); Method toXml = ClassUtils.getMethod(xmlUtils, "toXml", new Class[]{Document.class}); String xml = (String) toXml.invoke(null, new Object[]{result.getNode()}); logger.debug("Transformed document is:\n" + xml); } catch (ClassNotFoundException e) { logger.debug("Unable to print out transformed document because XMLUtils is not on the classpath."); } catch (Exception e) { logger.warn("Unable to dynamically invoke the XMLUtils.toXml() method", e); } }
Enumeration<URL> urls = ClassUtils.getResources(CUSTOM_PROPERTY_EDITOR_RESOURCE_NAME, getClass()); while (urls.hasMoreElements()) Class<?> requiredType = ClassUtils.loadClass(target, getClass()); Class<PropertyEditor> propertyEditorClass = ClassUtils.loadClass(editor, getClass()); customPropertyEditorsCache.put(requiredType, propertyEditorClass);
protected static boolean equal(Object a, Object b) { return ClassUtils.equal(a, b); }
@Override public int hashCode() { return ClassUtils.hash(new Object[]{listener, subscription, nullSubscription}); }
/** * Is JMX 1.2 and up available for use? * @return false if only JMX 1.1 can be used */ protected boolean isModernSpecAvailable () { Class<ObjectName> clazz = ObjectName.class; // method escape() is available since JMX 1.2 Method method = ClassUtils.getMethod(clazz, "quote", new Class[]{String.class}); return method != null; }
protected Properties loadOverrides() throws MuleException { Properties props = new Properties(); Enumeration e = ClassUtils.getResources(CHANNEL_OVERRIDES_FILE, getClass()); while (e.hasMoreElements()) { URL url = (URL) e.nextElement(); try { props.load(url.openStream()); } catch (IOException e1) { throw new DefaultMuleException("failed to read channel overrides from URL: " + url.toExternalForm()); } } return props; } }
Class<?>[] classTypes = ClassUtils.getClassTypes(payload); Method method = null; for (Iterator<String> iterator = methods.iterator(); iterator.hasNext();) method = ClassUtils.getMethod(component.getClass(), methodName, classTypes, true); if (ClassUtils.compare(parameterTypes, classTypes, false, true))
Class<?>[] classTypes = ClassUtils.getClassTypes(payload); method = ClassUtils.getMethod(component.getClass(), methodName, classTypes);
method = ClassUtils.getMethod(component.getClass(), methodName, getMethodArgumentTypes(payload)); List<Method> methods = ClassUtils.getSatisfiableMethods(component.getClass(), argTypes, isAcceptVoidMethods(), false, getIgnoredMethods(), filter);
public static Object createInstance(String className) { Object factory; try { factory = ClassUtils.instanciateClass(className, ClassUtils.NO_ARGS, XMLUtils.class); } catch (Exception e) { throw new RuntimeException(e); } return factory; }
public static Object instanciateClass(String name, Object[] constructorArgs, ClassLoader classLoader) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Class<?> clazz; if (classLoader != null) { clazz = loadClass(name, classLoader); } else { clazz = loadClass(name, ClassUtils.class); } if (clazz == null) { throw new ClassNotFoundException(name); } return instanciateClass(clazz, constructorArgs); }
private static MessageProcessor newJaxWsComponentMessageProcessor(MuleContext muleContext, Class<?> componentClass) { try { MessageProcessorBuilder wsmpb = (MessageProcessorBuilder) ClassUtils.instanciateClass("org.mule.module.cxf.builder.WebServiceMessageProcessorBuilder"); Method setServiceClassMethod = ClassUtils.getMethod(wsmpb.getClass(), "setServiceClass", new Class<?>[]{Class.class}); setServiceClassMethod.invoke(wsmpb, componentClass); Method setFrontendMethod = ClassUtils.getMethod(wsmpb.getClass(), "setFrontend", new Class<?>[]{String.class}); setFrontendMethod.invoke(wsmpb, "jaxws"); ((MuleContextAware) wsmpb).setMuleContext(muleContext); return wsmpb.build(); } catch (Exception e) { throw new MuleRuntimeException( MessageFactory.createStaticMessage("Failed to configure the required web service infrastructure: are you missing the Mule CXF Module?"), e); } }