001 /* 002 * Copyright (C) 2006-2007 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.codehaus.gmaven.runtime.v1_6; 018 019 import org.codehaus.gmaven.feature.Feature; 020 import org.codehaus.gmaven.feature.Version; 021 import org.codehaus.gmaven.feature.support.ProviderSupport; 022 import org.codehaus.groovy.runtime.InvokerHelper; 023 024 import java.util.LinkedHashMap; 025 import java.util.Map; 026 027 /** 028 * Provides support for Groovy 1.6. 029 * 030 * @version $Id: ProviderImpl.java 92 2010-07-05 21:06:20Z user57 $ 031 * @author <a href="mailto:jason@planet57.com">Jason Dillon</a> 032 */ 033 public class ProviderImpl 034 extends ProviderSupport 035 { 036 public static final String KEY = "1.6"; 037 038 public ProviderImpl() { 039 super(KEY); 040 } 041 042 @Override 043 protected Map detectFeatures() { 044 Feature[] features = { 045 new ClassFactoryFeature(), 046 new ScriptExecutorFeature(), 047 new ClassCompilerFeature(), 048 new StubCompilerFeature(), 049 new ConsoleFeature(), 050 new ShellFeature(), 051 new TraceSanitizerFeature(), 052 }; 053 054 Map<String,Feature> map = new LinkedHashMap<String,Feature>(); 055 056 for (Feature feature : features) { 057 map.put(feature.key(), feature); 058 } 059 060 return map; 061 } 062 063 @Override 064 protected Version detectVersion() { 065 return new Version(1, 6, 9); 066 } 067 068 @Override 069 public String name() { 070 return "Groovy v" + InvokerHelper.getVersion(); 071 } 072 }