Examples of GroovyClassLoader


Examples of groovy.lang.GroovyClassLoader

    * @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

Examples of groovy.lang.GroovyClassLoader

    */
   public Object instantiateScript(InputStream stream, String name, GroovyClassLoader loader) throws IOException
   {
      if (loader == null)
      {
         loader = new GroovyClassLoader();
      }
      Class<?> clazz = null;
      try
      {
         if (name != null && name.length() > 0)
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

    */
   public Object instantiateScript(GroovyCodeSource codeSource, GroovyClassLoader loader)
   {
      if (loader == null)
      {
         loader = new GroovyClassLoader();
      }
      Class<?> clazz = null;
      clazz = loader.parseClass(codeSource);
      try
      {
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

     * process the route configuration defined in Groovy class
     */
    private Response parseGroovy(String route) {
        try {
            // load the definition class into a RouteBuilder instance
            GroovyClassLoader classLoader = new GroovyClassLoader();
            Class<?> clazz = classLoader.parseClass(route);
            RouteBuilder builder = (RouteBuilder)clazz.newInstance();
            LOG.info("Loaded builder: " + builder);

            postRoutes(builder);

View Full Code Here

Examples of groovy.lang.GroovyClassLoader

     * process the route configuration defined in Groovy class
     */
    private Response parseGroovy(String route) {
        try {
            // load the definition class into a RouteBuilder instance
            GroovyClassLoader classLoader = new GroovyClassLoader();
            Class<?> clazz = classLoader.parseClass(route);
            RouteBuilder builder = (RouteBuilder)clazz.newInstance();
            LOG.info("Loaded builder: " + builder);
            // add the route builder
            getCamelContext().addRoutes(builder);
            return Response.seeOther(new URI("/routes")).build();
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

    }

    private CachedRule loadGroovy(File file) {
        CachedRule entry = null;
        try {
            GroovyClassLoader gcl = new GroovyClassLoader();
            Class<?> clazz = gcl.parseClass(file);
            Rule rule = (Rule) clazz.newInstance();
            rule.setFactory(this);
            entry = new CachedRule(file.lastModified(), rule);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

   @Override
   public ClassLoader getClassLoader()
   {
      if (classLoader == null && super.getClassLoader() != null)
      {
         this.classLoader = new GroovyClassLoader(super.getClassLoader());
      }
      return classLoader;
   }
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

   @Consumes({"script/groovy"})
   @Path("validate{name:.*}")
   public Response validateScript(@PathParam("name") String name, InputStream script)
   {

      GroovyClassLoader groovyClassLoader = groovyPublisher.getGroovyClassLoader();
      if (name == null || name.length() == 0)
      {
         name = groovyClassLoader.generateScriptName();
      }
      else if (name.startsWith("/"))
      {
         name = name.substring(1);
      }

      try
      {
         groovyClassLoader.parseClass(script, name);
         return Response.status(Response.Status.OK).build();
      }
      catch (Exception e)
      {
         LOG.error(e.getMessage(), e);
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

 
  protected final List<String> imports = new ArrayList<String>();
 
  protected final GroovyClassLoader compiler;
 
  public GroovyCLI() { this(new GroovyClassLoader(), new EntryPointConsole(), null); }
View Full Code Here

Examples of groovy.lang.GroovyClassLoader

    this.addArgument("script...", String.class, "All arguments will be taken to form the script");
  }

  public Object execute(GroovyCLIContext ctx, CommandLineArgumentsStandard arguments) {
    if (original.getParent() != Thread.currentThread().getContextClassLoader())
      this.compiler = new GroovyClassLoader();
    else
      this.compiler = this.original;
   
    List<String> commandInfo = new ArrayList<String>();
    for (int i=0; i<arguments.getRawArgumentCount(); i++) {
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.