Return-Path: X-Original-To: apmail-onami-commits-archive@minotaur.apache.org Delivered-To: apmail-onami-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D93FD313 for ; Fri, 7 Dec 2012 20:54:08 +0000 (UTC) Received: (qmail 75692 invoked by uid 500); 7 Dec 2012 20:54:08 -0000 Delivered-To: apmail-onami-commits-archive@onami.apache.org Received: (qmail 75666 invoked by uid 500); 7 Dec 2012 20:54:08 -0000 Mailing-List: contact commits-help@onami.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@onami.incubator.apache.org Delivered-To: mailing list commits@onami.incubator.apache.org Received: (qmail 75657 invoked by uid 99); 7 Dec 2012 20:54:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Dec 2012 20:54:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Dec 2012 20:54:03 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 769DF2388A91; Fri, 7 Dec 2012 20:53:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1418469 - in /incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami: ./ autobind/ autobind/aop/ autobind/aop/feature/ Date: Fri, 07 Dec 2012 20:53:41 -0000 To: commits@onami.incubator.apache.org From: danielmanzke@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121207205341.769DF2388A91@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: danielmanzke Date: Fri Dec 7 20:53:39 2012 New Revision: 1418469 URL: http://svn.apache.org/viewvc?rev=1418469&view=rev Log: [ONAMI-23] reenable configuration of autobind - added missing files Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/ (with props) incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/ (with props) incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/ (with props) incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/ClassMatcher.java incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/GuiceMethodInterceptor.java incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Intercept.java incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Invoke.java incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/MethodMatcher.java incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/ (with props) incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/InterceptorFeature.java incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/package-info.java incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/package-info.java Propchange: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/ ------------------------------------------------------------------------------ bugtraq:number = true Propchange: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/ ------------------------------------------------------------------------------ bugtraq:number = true Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/ClassMatcher.java URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/ClassMatcher.java?rev=1418469&view=auto ============================================================================== --- incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/ClassMatcher.java (added) +++ incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/ClassMatcher.java Fri Dec 7 20:53:39 2012 @@ -0,0 +1,45 @@ +package org.apache.onami.autobind.aop; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import org.aopalliance.intercept.MethodInterceptor; + +/** + * This Annotation marks a Method, which returns an Object of Type + * {@link Matcher}. This Matcher is used by Guice, to decide if a + * {@link MethodInterceptor} should be invoked for that {@link Class}. + * + *
@ClassMatcher
+ * public Matcher> getClassMatcher()
+ * {
+ *     return Matchers.any();
+ * }
+ */ +@Documented +@Retention( RUNTIME ) +@Target( { METHOD } ) +public @interface ClassMatcher +{ +} Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/GuiceMethodInterceptor.java URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/GuiceMethodInterceptor.java?rev=1418469&view=auto ============================================================================== --- incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/GuiceMethodInterceptor.java (added) +++ incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/GuiceMethodInterceptor.java Fri Dec 7 20:53:39 2012 @@ -0,0 +1,59 @@ +package org.apache.onami.autobind.aop; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +import java.lang.reflect.Method; +import java.lang.reflect.Type; + +import org.aopalliance.intercept.MethodInterceptor; + +import com.google.inject.matcher.Matcher; + +/** + * If you don't want to use the {@link Invoke}, {@link MethodMatcher} and + * {@link ClassMatcher} Annotation, your {@link MethodInterceptor} could inherit + * of this class. + */ +public abstract class GuiceMethodInterceptor + implements MethodInterceptor +{ + + public static Type CLASS_MATCHER_TYPE; + + public static Type METHOD_MATCHER_TYPE; + + static + { + try + { + CLASS_MATCHER_TYPE = + GuiceMethodInterceptor.class.getMethod( "getClassMatcher", new Class[0] ).getGenericReturnType(); + METHOD_MATCHER_TYPE = + GuiceMethodInterceptor.class.getMethod( "getMethodMatcher", new Class[0] ).getGenericReturnType(); + } + catch ( Exception e ) + { + // ignore + } + } + + public abstract Matcher> getClassMatcher(); + + public abstract Matcher getMethodMatcher(); + +} Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Intercept.java URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Intercept.java?rev=1418469&view=auto ============================================================================== --- incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Intercept.java (added) +++ incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Intercept.java Fri Dec 7 20:53:39 2012 @@ -0,0 +1,44 @@ +package org.apache.onami.autobind.aop; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import org.aopalliance.intercept.MethodInterceptor; + +/** + * This is an Annotation, which can be used to create a {@link MethodMatcher}, + * so an {@link MethodInterceptor} knows which Method to monitor. + * + *
@Intercept
+ * public String sayHello()
+ * {
+ *     return "yeahhh!!!";
+ * }
+ */ +@Documented +@Retention( RUNTIME ) +@Target( { METHOD } ) +public @interface Intercept +{ +} Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Invoke.java URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Invoke.java?rev=1418469&view=auto ============================================================================== --- incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Invoke.java (added) +++ incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/Invoke.java Fri Dec 7 20:53:39 2012 @@ -0,0 +1,43 @@ +package org.apache.onami.autobind.aop; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * This Annotation marks a Method, which should be invoked for each Method, + * which is matching the Criterias of this Interceptor. + * + *
@Invoke
+ * public Object invoke( MethodInvocation invocation )
+ *     throws Throwable
+ * {
+ *     return invocation.proceed();
+ * }
+ */ +@Documented +@Retention( RUNTIME ) +@Target( { METHOD } ) +public @interface Invoke +{ +} Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/MethodMatcher.java URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/MethodMatcher.java?rev=1418469&view=auto ============================================================================== --- incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/MethodMatcher.java (added) +++ incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/MethodMatcher.java Fri Dec 7 20:53:39 2012 @@ -0,0 +1,46 @@ +package org.apache.onami.autobind.aop; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.lang.reflect.Method; + +import org.aopalliance.intercept.MethodInterceptor; + +/** + * This Annotation marks a Method, which returns an Object of Type + * {@link Matcher}. This Matcher is used by Guice, to decide if a + * {@link MethodInterceptor} should be invoked for that {@link Method}. + * + *
@MethodMatcher
+ * public Matcher getMethodMatcher()
+ * {
+ *     return Matchers.annotatedWith( Intercept.class );
+ * }
+ */
+@Documented
+@Retention( RUNTIME )
+@Target( { METHOD } )
+public @interface MethodMatcher
+{
+}

Propchange: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/InterceptorFeature.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/InterceptorFeature.java?rev=1418469&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/InterceptorFeature.java (added)
+++ incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/InterceptorFeature.java Fri Dec  7 20:53:39 2012
@@ -0,0 +1,166 @@
+package org.apache.onami.autobind.aop.feature;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.inject.Singleton;
+import javax.interceptor.Interceptor;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+import org.apache.onami.autobind.aop.ClassMatcher;
+import org.apache.onami.autobind.aop.GuiceMethodInterceptor;
+import org.apache.onami.autobind.aop.Invoke;
+import org.apache.onami.autobind.aop.MethodMatcher;
+import org.apache.onami.autobind.install.BindingStage;
+import org.apache.onami.autobind.scanner.features.BindingScannerFeature;
+
+import com.google.inject.matcher.Matcher;
+import com.google.inject.matcher.Matchers;
+
+
+@Singleton
+public class InterceptorFeature extends BindingScannerFeature {
+	private Logger _logger = Logger.getLogger(InterceptorFeature.class.getName());
+
+	@Override
+	public BindingStage accept(Class annotatedClass, Map annotations) {
+		if (annotations.containsKey(Interceptor.class.getName())) {
+			return BindingStage.BOOT;
+		}
+		return BindingStage.IGNORE;
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public void process(Class annotatedClass, Map annotations) {
+		MethodInterceptor interceptor;
+		final Object possibleInterceptor = injector.getInstance(annotatedClass);
+
+		Matcher> classMatcher = null;
+		Matcher methodMatcher = null;
+		if (possibleInterceptor instanceof GuiceMethodInterceptor) {
+			interceptor = (MethodInterceptor) possibleInterceptor;
+			GuiceMethodInterceptor guiceInterceptor = (GuiceMethodInterceptor) interceptor;
+			classMatcher = guiceInterceptor.getClassMatcher();
+			methodMatcher = guiceInterceptor.getMethodMatcher();
+		} else {
+			Method[] declaredMethods = annotatedClass.getDeclaredMethods();
+			Map, Method> methods = new HashMap, Method>();
+
+			for (Method method : declaredMethods) {
+				Annotation[] methodAnnotations = method.getAnnotations();
+				for (Annotation methodAnnotation : methodAnnotations) {
+					methods.put(methodAnnotation.annotationType(), method);
+				}
+			}
+			try {
+				if (methods.containsKey(ClassMatcher.class)) {
+					Method method = methods.get(ClassMatcher.class);
+					Type genericReturnType = method.getGenericReturnType();
+					if (GuiceMethodInterceptor.CLASS_MATCHER_TYPE.equals(genericReturnType)) {
+						classMatcher = (Matcher>) method.invoke(
+							possibleInterceptor, new Object[0]);
+					} else {
+						_logger.log(Level.WARNING,
+							"Return Type of the annotated @ClassMatcher-Method, does not return: "
+									+ GuiceMethodInterceptor.CLASS_MATCHER_TYPE
+									+ " instead it returns " + genericReturnType);
+					}
+				}
+
+				if (methods.containsKey(MethodMatcher.class)) {
+					Method method = methods.get(MethodMatcher.class);
+					Type genericReturnType = method.getGenericReturnType();
+					if (GuiceMethodInterceptor.METHOD_MATCHER_TYPE.equals(genericReturnType)) {
+						methodMatcher = (Matcher) method.invoke(
+							possibleInterceptor, new Object[0]);
+					} else {
+						_logger.log(Level.WARNING,
+							"Return Type of the annotated @MethodMatcher-Method, does not return: "
+									+ GuiceMethodInterceptor.METHOD_MATCHER_TYPE
+									+ " instead it returns " + genericReturnType);
+					}
+				}
+			} catch (Exception e) {
+				_logger
+					.log(
+						Level.WARNING,
+						"Skipping process(..) of \""
+								+ annotatedClass
+								+ "\", because an Exception occured while trying to invoke a Method of the found Intercepter.",
+						e);
+				return;
+			}
+
+			if (possibleInterceptor instanceof MethodInterceptor) {
+				interceptor = (MethodInterceptor) possibleInterceptor;
+			} else {
+				if (methods.containsKey(Invoke.class)) {
+					final Method method = methods.get(Invoke.class);
+					Class[] parameterTypes = method.getParameterTypes();
+					if (parameterTypes != null && parameterTypes.length == 1
+							&& parameterTypes[0] == MethodInvocation.class) {
+						interceptor = new MethodInterceptor() {
+							@Override
+							public Object invoke(MethodInvocation invocation) throws Throwable {
+								return method.invoke(possibleInterceptor, invocation);
+							}
+						};
+					} else {
+						_logger
+							.log(
+								Level.WARNING,
+								"Skipping \""
+										+ annotatedClass
+										+ "\", because the Parameter of the with @Invoke annotated Method \""
+										+ method.getName()
+										+ "\" doesn't match the expected one. "
+										+ method.getName() + "(MethodInvocation invocation)");
+						return;
+					}
+				} else {
+					_logger.log(Level.WARNING, "Skipping \"" + annotatedClass
+							+ "\" is either Child of \""
+							+ GuiceMethodInterceptor.class.getName() + "\" / \""
+							+ MethodInterceptor.class.getName()
+							+ "\" nor has a Method annotated with \"" + Invoke.class.getName()
+							+ "\"");
+					return;
+				}
+			}
+		}
+
+		if (classMatcher == null) {
+			classMatcher = Matchers.any();
+		}
+
+		if (methodMatcher == null) {
+			methodMatcher = Matchers.any();
+		}
+
+		_binder.bindInterceptor(classMatcher, methodMatcher, interceptor);
+	}
+}
\ No newline at end of file

Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/package-info.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/package-info.java?rev=1418469&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/package-info.java (added)
+++ incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/feature/package-info.java Fri Dec  7 20:53:39 2012
@@ -0,0 +1,21 @@
+/**
+ * TODO fill me
+ */
+package org.apache.onami.autobind.aop.feature;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */

Added: incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/package-info.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/package-info.java?rev=1418469&view=auto
==============================================================================
--- incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/package-info.java (added)
+++ incubator/onami/trunk/autobind/aop/src/main/java/org/apache/onami/autobind/aop/package-info.java Fri Dec  7 20:53:39 2012
@@ -0,0 +1,21 @@
+/**
+ * TODO fill me
+ */
+package org.apache.onami.autobind.aop;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */