// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
//   URL getUrl();
// 
//   File getFile();
// 
//   interface Inline
//   {
//     String getName();
// 
//     String getCodeBase();
// 
//     Reader getInput();
//   }
// 
//   Inline getInline();
// }
// 
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
//   @Nullable
//   URL loadResource(String name) throws MalformedURLException;
// }
// 
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
//   @Nullable
//   Object execute(ClassSource classSource,
//                  ClassLoader classLoader,
//                  ResourceLoader resourceLoader,
//                  Map<String, Object> context,
//                  @Nullable Map<String, Object> options)
//       throws Exception;
// }


import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyShell;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
 * Copyright (c) 2006-present the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.codehaus.gmaven.adapter.impl;





/**
 * Default {@link ScriptExecutor} implementation.
 *
 * @since 2.0
 */
public class ScriptExecutorImpl
    implements ScriptExecutor
{
  private final Logger log = LoggerFactory.getLogger(getClass());

  private final GroovyRuntimeImpl runtime;

  ScriptExecutorImpl(final GroovyRuntimeImpl runtime) {
    this.runtime = checkNotNull(runtime);
  }

  @Override
  @Nullable
  public Object execute(final ClassSource classSource,
                        final ClassLoader classLoader,
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
//   URL getUrl();
// 
//   File getFile();
// 
//   interface Inline
//   {
//     String getName();
// 
//     String getCodeBase();
// 
//     Reader getInput();
//   }
// 
//   Inline getInline();
// }
// 
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
//   @Nullable
//   URL loadResource(String name) throws MalformedURLException;
// }
// 
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
//   @Nullable
//   Object execute(ClassSource classSource,
//                  ClassLoader classLoader,
//                  ResourceLoader resourceLoader,
//                  Map<String, Object> context,
//                  @Nullable Map<String, Object> options)
//       throws Exception;
// }


// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ScriptExecutorImpl.java
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyShell;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/*
 * Copyright (c) 2006-present the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.codehaus.gmaven.adapter.impl;





/**
 * Default {@link ScriptExecutor} implementation.
 *
 * @since 2.0
 */
public class ScriptExecutorImpl
    implements ScriptExecutor
{
  private final Logger log = LoggerFactory.getLogger(getClass());

  private final GroovyRuntimeImpl runtime;

  ScriptExecutorImpl(final GroovyRuntimeImpl runtime) {
    this.runtime = checkNotNull(runtime);
  }

  @Override
  @Nullable
  public Object execute(final ClassSource classSource,
                        final ClassLoader classLoader,
                        final ResourceLoader resourceLoader,