Package groovy.lang

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


            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

    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

    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

    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

            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

  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

    }

    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

      // 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

    * @throws IOException if stream can't be parsed or object can't be created
    *         cause to illegal content of stream
    */
   public Object instantiateScript(InputStream stream, String name) throws IOException
   {
      GroovyClassLoader loader;
      if (mapping.size() > 0)
      {
         JarJarClassLoader jarjarLoader = new JarJarClassLoader();
         jarjarLoader.addMapping(mapping);
         loader = jarjarLoader;
      }
      else
      {
         loader = new GroovyClassLoader();
      }
      return instantiateScript(stream, name, loader);
   }
View Full Code Here

TOP

Related Classes of groovy.lang.GroovyClassLoader

Copyright © 2018 www.massapicom. 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.