You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ke...@apache.org on 2004/12/07 23:27:29 UTC
svn commit: r111155 - /incubator/beehive/trunk/controls/build.xml /incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/Interceptor.java /incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/InterceptorAnnotation.java
Author: kentam
Date: Tue Dec 7 14:27:28 2004
New Revision: 111155
URL: http://svn.apache.org/viewcvs?view=rev&rev=111155
Log:
Add Interceptor SPI per spec (http://wiki.apache.org/beehive/Controls/AnnotationBasedFeatures)
Added:
incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/Interceptor.java (contents, props changed)
incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/InterceptorAnnotation.java (contents, props changed)
Modified:
incubator/beehive/trunk/controls/build.xml
Modified: incubator/beehive/trunk/controls/build.xml
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/build.xml?view=diff&rev=111155&p1=incubator/beehive/trunk/controls/build.xml&r1=111154&p2=incubator/beehive/trunk/controls/build.xml&r2=111155
==============================================================================
--- incubator/beehive/trunk/controls/build.xml (original)
+++ incubator/beehive/trunk/controls/build.xml Tue Dec 7 14:27:28 2004
@@ -36,6 +36,7 @@
<path id="api.classpath">
</path>
<path id="spi.classpath">
+ <pathelement location="${api.classes}"/>
</path>
<path id="runtime.classpath">
<pathelement location="${ant.jar}"/>
Added: incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/Interceptor.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/Interceptor.java?view=auto&rev=111155
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/Interceptor.java Tue Dec 7 14:27:28 2004
@@ -0,0 +1,52 @@
+package org.apache.beehive.controls.spi.svc;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ * $Header:$
+ */
+
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+
+import java.lang.reflect.Method;
+
+/**
+ * The controls implementation architecture has a interceptor model for
+ * adding annotation-based features. This model provides the ability to
+ * associate a JavaBeans service interface with an annotation to define
+ * its runtime feature behaviour. Such interfaces must extend this
+ * Interceptor interface, which defines the contract that the controls runtime
+ * has with interceptors.
+ *
+ * The controls runtime will automatically instantiate and execute
+ * implementations of interceptors at the appropriate execution points
+ * (pre/post invocation of a control operation, etc).
+ *
+ * A return value of "true" from each Interceptor method indicates to the runtime
+ * that it should continue execution through the normal flow of control (ie, subsequent
+ * interceptors and operation/event execution). "false" indicates that the interceptor
+ * has fully processed the operation and the runtime should "pivot" out.
+ */
+public interface Interceptor
+{
+ /** Called before a control operation is invoked */
+ public boolean preInvoke( Method m, Object [] args, ControlBeanContext cbc );
+ /** Called after a control operation is invoked */
+ public boolean postInvoke( Method m, Object [] args, ControlBeanContext cbc );
+
+ /** Called before a control event is fired (through a client proxy) */
+ public boolean preEvent( Class eventSet, Method m, Object [] args, ControlBeanContext cbc );
+ /** Called after a control event is fired (through a client proxy) */
+ public boolean postEvent( Class eventSet, Method m, Object [] args, ControlBeanContext cbc );
+}
Added: incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/InterceptorAnnotation.java
Url: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/InterceptorAnnotation.java?view=auto&rev=111155
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/controls/src/spi/org/apache/beehive/controls/spi/svc/InterceptorAnnotation.java Tue Dec 7 14:27:28 2004
@@ -0,0 +1,34 @@
+package org.apache.beehive.controls.spi.svc;
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * 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.
+ *
+ * $Header:$
+ */
+
+import java.lang.annotation.*;
+
+/**
+ * InterceptorAnnotation is the meta-annotation used to identify annotations
+ * that are interceptor-based, and bind an interceptor service interface to
+ * those annotations.
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface InterceptorAnnotation
+{
+ /** The Interceptor-based JavaBeans service interface associated with the annotated annotation */
+ Class<? extends Interceptor> service();
+}