// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
//   interface WindowHandle
//   {
//     void close();
// 
//     void await() throws InterruptedException;
//   }
// 
//   WindowHandle open(ClassLoader classLoader,
//                     ResourceLoader resourceLoader,
//                     Map<String, Object> context,
//                     @Nullable Map<String, Object> options)
//       throws Exception;
// }
// 
// 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;
// }


import java.util.EventObject;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.ui.Console;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
/*
 * 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 ConsoleWindow} implementation.
 *
 * @since 2.0
 */
public class ConsoleWindowImpl
    implements ConsoleWindow
{
  private final Logger log = LoggerFactory.getLogger(getClass());

  private final GroovyRuntimeImpl runtime;

  private final Object lock = new Object();

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

  @Override
  public WindowHandle open(final ClassLoader classLoader,
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
//   interface WindowHandle
//   {
//     void close();
// 
//     void await() throws InterruptedException;
//   }
// 
//   WindowHandle open(ClassLoader classLoader,
//                     ResourceLoader resourceLoader,
//                     Map<String, Object> context,
//                     @Nullable Map<String, Object> options)
//       throws Exception;
// }
// 
// 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-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ConsoleWindowImpl.java
import java.util.EventObject;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.ui.Console;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;

/*
 * 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 ConsoleWindow} implementation.
 *
 * @since 2.0
 */
public class ConsoleWindowImpl
    implements ConsoleWindow
{
  private final Logger log = LoggerFactory.getLogger(getClass());

  private final GroovyRuntimeImpl runtime;

  private final Object lock = new Object();

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

  @Override
  public WindowHandle open(final ClassLoader classLoader,
                           final ResourceLoader resourceLoader,