/** * Returns the class object for the given name using the engine classloader. * * @param className * The class name to lookup. * @return The class object or null if the class was not found. * @see #getClassLoader() */ public static Class<?> loadClass(String className) throws ClassNotFoundException { return getInstance().getClassLoader().loadClass(className); }
/** * Returns the classloader resource for a given name/path. * * @param name * The name/path to lookup. * @return The resource URL. */ public static java.net.URL getResource(String name) { return getInstance().getClassLoader().getResource(name); }
/** * Registers a list of helpers. * * @param descriptorPath * Classpath to the descriptor file. * @param helpers * The list of helpers to update. * @param constructorClass * The constructor parameter class to look for. * @throws IOException */ public void registerHelpers(String descriptorPath, List<?> helpers, Class<?> constructorClass) throws IOException { ClassLoader classLoader = getClassLoader(); Enumeration<java.net.URL> configUrls = classLoader .getResources(descriptorPath); if (configUrls != null) { for (Enumeration<java.net.URL> configEnum = configUrls; configEnum .hasMoreElements();) { registerHelpers(classLoader, configEnum.nextElement(), helpers, constructorClass); } } }
/** * Wraps the client resource to proxy calls to the given Java interface into * Restlet method calls. Use the {@link org.restlet.engine.Engine} * classloader in order to generate the proxy. * * @param <T> * @param resourceInterface * The annotated resource interface class to proxy. * @return The proxy instance. */ public <T> T wrap(Class<? extends T> resourceInterface) { return wrap(resourceInterface, org.restlet.engine.Engine.getInstance() .getClassLoader()); }
/** * Wraps the client resource to proxy calls to the given Java interface into * Restlet method calls. * * @param <T> * @param resourceInterface * The annotated resource interface class to proxy. * @return The proxy instance. */ @SuppressWarnings("unchecked") public <T> T wrap(Class<? extends T> resourceInterface) { T result = null; // Create the client resource proxy java.lang.reflect.InvocationHandler h = new org.restlet.ext.jaxrs.internal.client.JaxRsClientInvocationHandler<T>( this, resourceInterface); // Instantiate our dynamic proxy result = (T) java.lang.reflect.Proxy.newProxyInstance( org.restlet.engine.Engine.getInstance().getClassLoader(), new Class<?>[] { ClientProxy.class, resourceInterface }, h); return result; } }
"org.restlet.engine.log.LoggerFacade"); try { this.loggerFacade = (LoggerFacade) getClassLoader().loadClass( loggerFacadeClass).newInstance(); } catch (Exception e) {