Examples of GroovyClassLoader


Examples of groovy.lang.GroovyClassLoader

    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext answer = super.createCamelContext();

        GroovyClassLoader classLoader = new GroovyClassLoader();
        Class<?> type = classLoader.loadClass(groovyBuilderClass);
        Object object = answer.getInjector().newInstance(type);
        RouteBuilder builder = assertIsInstanceOf(RouteBuilder.class, object);

        log.info("Loaded builder: " + builder);
        answer.addRoutes(builder);
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

        ClassLoader cl = contribution.getClassLoader();
        if (!(cl instanceof GroovyClassLoader)) {
            // replace the contribution class loader with a Groovy one
          // If the contribution does not have a classloader, use this classloader as parent
          if (cl == null) cl = this.getClass().getClassLoader();           
            cl = new GroovyClassLoader(cl);
            contribution.setClassLoader(cl);
        }
        try {

            ((GroovyClassLoader)cl).parseClass(((GroovyArtifact)model).getArtifactURL().openStream());
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

            throw new GeneralException("Error loading Groovy script at [" + location + "]: ", e);
        }
    }

    public static Class<?> loadClass(String path) throws ClassNotFoundException {
        return new GroovyClassLoader().loadClass(path);
    }
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

    public static Class<?> loadClass(String path) throws ClassNotFoundException {
        return new GroovyClassLoader().loadClass(path);
    }

    public static Class<?> parseClass(InputStream in, String location) throws IOException {
        return new GroovyClassLoader().parseClass(UtilIO.readString(in), location);
    }
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

    public static Class<?> parseClass(InputStream in, String location, GroovyClassLoader groovyClassLoader) throws IOException {
        return groovyClassLoader.parseClass(UtilIO.readString(in), location);
    }

    public static Class<?> parseClass(String text) {
        return new GroovyClassLoader().parseClass(text);
    }
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

    public static Class<?> parseClass(String text) {
        return new GroovyClassLoader().parseClass(text);
    }

    public static Class<?> parseClass(String text, String location) {
        return new GroovyClassLoader().parseClass(text, location);
    }
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

            final JavaCompilerSettings pSettings
            ) {

        final CompilerConfiguration configuration = ((GroovyJavaCompilerSettings) pSettings).getCompilerConfiguration();
        final ErrorCollector collector = new ErrorCollector(configuration);
        final GroovyClassLoader groovyClassLoader = new GroovyClassLoader(pClassLoader);
        final CompilationUnit unit = new CompilationUnit(configuration, null, groovyClassLoader);
        final SourceUnit[] source = new SourceUnit[pResourceNames.length];
        for (int i = 0; i < source.length; i++) {
            final String resourceName = pResourceNames[i];
            source[i] = new SourceUnit(
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

  class ClasspathAddition {
    private static final Logger LOG = Logger.getInstance(ClasspathAddition.class);

    public static ClassLoader createClassLoaderWithDependencies(List<String> pathsToAdd, String mainScriptUrl, String pluginId, ErrorReporter errorReporter) {
      GroovyClassLoader classLoader = new GroovyClassLoader(PluginRunner.class.getClassLoader());
      try {

        for (String path : pathsToAdd) {
          if (path.startsWith("file:/")) {
            URL url = new URL(path);
            classLoader.addURL(url);
            classLoader.addClasspath(url.getFile());
          } else {
            classLoader.addURL(new URL("file:///" + path));
            classLoader.addClasspath(path);
          }
        }

      } catch (IOException e) {
        errorReporter.addLoadingError(pluginId, "Error while looking for dependencies in '" + mainScriptUrl + "'. " + e.getMessage());
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

    }

    private Application loadApplication(ZipEntry zipentry, ZipInputStream zipinputstream, String name) throws IOException, IllegalAccessException, InstantiationException {
        String groovyString = new String(ByteStreams.toByteArray(zipinputstream), "UTF-8");

        GroovyClassLoader gcl = new GroovyClassLoader();
        Class clazz = gcl.parseClass(groovyString);

        Object aScript = clazz.newInstance();
        Application application = (Application) aScript;

        applicationContext.getAutowireCapableBeanFactory().autowireBean(application);
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

      // Add script from configuration files to JCR.
      addScripts();

      ClassLoader cl = getClass().getClassLoader();
      groovyClassLoader = new GroovyClassLoader(cl);
      if (addRepoPlugins != null && addRepoPlugins.size() > 0)
      {
         try
         {
            Set<URL> repos = new HashSet<URL>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.