You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2007/03/06 18:42:30 UTC
svn commit: r515225 - in /incubator/tuscany/java/sca/kernel:
core/src/main/java/org/apache/tuscany/core/wire/
spi/src/main/java/org/apache/tuscany/spi/extension/
spi/src/test/java/org/apache/tuscany/spi/extension/
Author: jmarino
Date: Tue Mar 6 09:42:29 2007
New Revision: 515225
URL: http://svn.apache.org/viewvc?view=rev&rev=515225
Log:
add interceptor builder extension
Added:
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtension.java (with props)
incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtensionTestCase.java (with props)
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java?view=diff&rev=515225&r1=515224&r2=515225
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/NonBlockingInterceptorBuilder.java Tue Mar 6 09:42:29 2007
@@ -23,8 +23,8 @@
import org.osoa.sca.annotations.Reference;
import org.apache.tuscany.spi.builder.BuilderException;
-import org.apache.tuscany.spi.builder.interceptor.InterceptorBuilder;
import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.InterceptorBuilderExtension;
import org.apache.tuscany.spi.model.physical.PhysicalInterceptorDefinition;
import org.apache.tuscany.spi.services.work.WorkScheduler;
import org.apache.tuscany.spi.wire.Interceptor;
@@ -34,7 +34,7 @@
*
* @version $Rev$ $Date$
*/
-public class NonBlockingInterceptorBuilder implements InterceptorBuilder {
+public class NonBlockingInterceptorBuilder extends InterceptorBuilderExtension {
public static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/sca/system/2.0-alpha", "nonblocking");
private WorkContext workContext;
private WorkScheduler scheduler;
@@ -47,5 +47,9 @@
public Interceptor build(PhysicalInterceptorDefinition definition) throws BuilderException {
return new NonBlockingInterceptor(scheduler, workContext);
+ }
+
+ protected QName getName() {
+ return QNAME;
}
}
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtension.java?view=auto&rev=515225
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtension.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtension.java Tue Mar 6 09:42:29 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.spi.extension;
+
+import javax.xml.namespace.QName;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.spi.builder.interceptor.InterceptorBuilder;
+import org.apache.tuscany.spi.builder.interceptor.InterceptorBuilderRegistry;
+
+/**
+ * Abstract class interceptor builders may extend to handle registration with the interceptor builder registry
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public abstract class InterceptorBuilderExtension implements InterceptorBuilder {
+ protected InterceptorBuilderRegistry registry;
+
+ @Reference(required = true)
+ public void setRegistry(InterceptorBuilderRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Init
+ public void init() {
+ registry.register(getName(), this);
+ }
+
+ protected abstract QName getName();
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtension.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtension.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtensionTestCase.java?view=auto&rev=515225
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtensionTestCase.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtensionTestCase.java Tue Mar 6 09:42:29 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+package org.apache.tuscany.spi.extension;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.builder.interceptor.InterceptorBuilder;
+import org.apache.tuscany.spi.builder.interceptor.InterceptorBuilderRegistry;
+import org.apache.tuscany.spi.model.physical.PhysicalInterceptorDefinition;
+import org.apache.tuscany.spi.wire.Interceptor;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InterceptorBuilderExtensionTestCase extends TestCase {
+ private static final QName QNAME = new QName("builder");
+
+ public void testRegistration() {
+ InterceptorBuilderRegistry registry = EasyMock.createMock(InterceptorBuilderRegistry.class);
+ registry.register(EasyMock.eq(QNAME), EasyMock.isA(InterceptorBuilder.class));
+ EasyMock.replay(registry);
+ InterceptorBuilderExtension builder = new InterceptorBuilderExtension() {
+ protected QName getName() {
+ return QNAME;
+ }
+
+ public Interceptor build(PhysicalInterceptorDefinition definition) throws BuilderException {
+ return null;
+ }
+ };
+
+ builder.setRegistry(registry);
+ builder.init();
+ EasyMock.verify(registry);
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtensionTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/InterceptorBuilderExtensionTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org