From e753f271ccf0ff4617725130b82dd21ae721b3d2 Mon Sep 17 00:00:00 2001 From: rsivaram Date: Tue, 21 Oct 2008 09:04:28 +0000 Subject: Event prototype: Initial model changes git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@706556 13f79535-47bb-0310-9956-ffa450edef68 --- .../event/EventBindingDefinitionsProvider.java | 73 +++++++ .../event/impl/EventBindingFactoryImpl.java | 40 ++++ .../sca/binding/event/impl/EventBindingImpl.java | 243 +++++++++++++++++++++ .../binding/event/impl/EventBindingInvoker.java | 72 ++++++ .../binding/event/impl/EventBindingProvider.java | 60 +++++ .../event/impl/EventBindingProviderFactory.java | 60 +++++ .../event/impl/EventReferenceBindingProvider.java | 97 ++++++++ .../event/impl/EventServiceBindingProvider.java | 63 ++++++ ...apache.tuscany.sca.assembly.EventBindingFactory | 18 ++ ...che.tuscany.sca.provider.BindingProviderFactory | 19 ++ ...che.tuscany.sca.provider.SCADefinitionsProvider | 19 ++ .../apache/tuscany/sca/binding/sca/definitions.xml | 26 +++ 12 files changed, 790 insertions(+) create mode 100644 sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java create mode 100644 sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java create mode 100644 sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java create mode 100644 sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java create mode 100644 sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java create mode 100644 sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java create mode 100644 sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java create mode 100644 sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java create mode 100644 sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory create mode 100644 sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory create mode 100644 sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider create mode 100644 sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml (limited to 'sandbox/event/modules/binding-event') diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java new file mode 100644 index 0000000000..4ffb4d22d9 --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java @@ -0,0 +1,73 @@ +/* + * 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.sca.binding.event; + +import java.net.URI; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedExceptionAction; + +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.service.ContributionReadException; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.definitions.SCADefinitions; +import org.apache.tuscany.sca.provider.SCADefinitionsProvider; +import org.apache.tuscany.sca.provider.SCADefinitionsProviderException; + +/** + * Provider for Policy Intents and PolicySet definitions for event binding + * + * @version $$ + */ +public class EventBindingDefinitionsProvider implements SCADefinitionsProvider { + private String definitionsFile = "org/apache/tuscany/sca/binding/sca/definitions.xml"; + URLArtifactProcessor urlArtifactProcessor = null; + + public EventBindingDefinitionsProvider(ExtensionPointRegistry registry) { + URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); + urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class); + } + + public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException { + // Allow privileged access to load resource. Requires RuntimePermssion in security policy. + final URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction() { + public URL run() { + return getClass().getClassLoader().getResource(definitionsFile); + } + }); + + SCADefinitions scaDefn = null; + try { + final URI uri = new URI(definitionsFile); + // Allow bindings to read properties. Requires PropertyPermission read in security policy. + scaDefn = AccessController.doPrivileged(new PrivilegedExceptionAction() { + public SCADefinitions run() throws ContributionReadException { + return (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl); + } + }); + } catch (Exception e) { + throw new SCADefinitionsProviderException(e); + } + return scaDefn; + } + +} diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java new file mode 100644 index 0000000000..1b6300aab4 --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java @@ -0,0 +1,40 @@ +/* + * 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.sca.binding.event.impl; + +import org.apache.tuscany.sca.assembly.EventBinding; +import org.apache.tuscany.sca.assembly.EventBindingFactory; + +/** + * A factory for the Event binding model. + * + * @version $$ + */ +public class EventBindingFactoryImpl implements EventBindingFactory { + + public EventBindingFactoryImpl (){ + + } + + public EventBinding createEventBinding() { + return new EventBindingImpl(); + } + +} diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java new file mode 100644 index 0000000000..b07651960f --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java @@ -0,0 +1,243 @@ +/* + * 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.sca.binding.event.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.EventBinding; +import org.apache.tuscany.sca.assembly.Extensible; +import org.apache.tuscany.sca.assembly.OptimizableBinding; +import org.apache.tuscany.sca.assembly.builder.AutomaticBinding; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.IntentAttachPointType; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.PolicySetAttachPoint; + +/** + * The assembly mode object for an Event binding. + * + * @version $$ + */ +public class EventBindingImpl implements EventBinding, Extensible, PolicySetAttachPoint, OptimizableBinding, AutomaticBinding { + private String name; + private String uri; + private Binding baseBinding; + private List extensions = new ArrayList(); + private List requiredIntents = new ArrayList(); + private List policySets = new ArrayList(); + private IntentAttachPointType intentAttachPointType; + + private Component targetComponent; + private ComponentService targetComponentService; + private Binding targetBinding; + private List applicablePolicySets = new ArrayList(); + + private boolean isAutomatic = false; + + public List getApplicablePolicySets() { + return applicablePolicySets; + } + + /** + * Constructs a new SCA binding. + */ + protected EventBindingImpl() { + } + + // Event Binding operations + + /** + * Setters for the binding name. Defaults to the + * name of the service or reference with which the binding is + * associated + * + * @return the binding name + */ + public String getName() { + return name; + } + + /** + * Setter for the binding name + * + * @param name the binding name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Getters for the binding URI. The computed URI for the + * service that the reference is targeting or which the service represents + * depending on whether the biding is associated with a reference or + * service + * + * @return the binding URI + */ + public String getURI() { + return uri; + } + + /** + * Setter for the binding URI + * + * @param uri the binding URI + */ + public void setURI(String uri) { + this.uri = uri; + } + + + /** + * Getter for the base binding + * + * @return base binding + */ + public Binding getBaseBinding() { + return baseBinding; + } + + /** + * Setter for the base binding + * + * @param baseBinding the base binding + */ + public void setBaseBinding(Binding baseBinding) { + this.baseBinding = baseBinding; + } + + /** + * Returns a list of extension objects contained in this model object. + * + * @return a list of extension objects container in this model object + */ + public List getExtensions() { + return extensions; + } + + /** + * Returns true if the model element is unresolved. + * + * @return true if the model element is unresolved. + */ + public boolean isUnresolved() { + if (targetComponentService == null){ + return true; + } else { + return targetComponentService.isUnresolved(); + } + } + + /** + * Sets whether the model element is unresolved. + * + * @param unresolved whether the model element is unresolved + */ + public void setUnresolved(boolean unresolved) { + } + + /** + * @see java.lang.Object#clone() + */ + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public List getPolicySets() { + return policySets; + } + + public List getRequiredIntents() { + return requiredIntents; + } + + public IntentAttachPointType getType() { + return intentAttachPointType; + } + + public void setType(IntentAttachPointType intentAttachPointType) { + this.intentAttachPointType = intentAttachPointType; + } + + // Wireable binding operations + + /** + * @return the targetComponent + */ + public Component getTargetComponent() { + return targetComponent; + } + + /** + * @param targetComponent the targetComponent to set + */ + public void setTargetComponent(Component targetComponent) { + this.targetComponent = targetComponent; + } + + /** + * @return the targetComponentService + */ + public ComponentService getTargetComponentService() { + return targetComponentService; + } + + /** + * @param targetComponentService the targetComponentService to set + */ + public void setTargetComponentService(ComponentService targetComponentService) { + this.targetComponentService = targetComponentService; + } + + /** + * @return the targetBinding + */ + public Binding getTargetBinding() { + return targetBinding; + } + + /** + * @param targetBinding the targetBinding to set + */ + public void setTargetBinding(Binding targetBinding) { + this.targetBinding = targetBinding; + } + + public void setPolicySets(List policySets) { + this.policySets = policySets; + } + + public void setRequiredIntents(List intents) { + this.requiredIntents = intents; + } + + + public void setIsAutomatic(boolean isAutomatic){ + this.isAutomatic = isAutomatic; + } + + public boolean getIsAutomatic(){ + return this.isAutomatic; + } +} diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java new file mode 100644 index 0000000000..481f3b2b0a --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java @@ -0,0 +1,72 @@ +/* + * 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.sca.binding.event.impl; + +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.invocation.DataExchangeSemantics; + +/** + * TODO: Implement event binding invoker + * @version $$ + */ +public class EventBindingInvoker implements Interceptor, DataExchangeSemantics { + private InvocationChain chain; + + /** + * Construct a EventBindingInvoker that delegates to the service invocaiton chain + * @param chain + */ + public EventBindingInvoker(InvocationChain chain) { + super(); + this.chain = chain; + } + + /** + * @see org.apache.tuscany.sca.invocation.Interceptor#getNext() + */ + public Invoker getNext() { + return chain.getHeadInvoker(); + } + + /** + * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker) + */ + public void setNext(Invoker next) { + // NOOP + } + + /** + * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message) + */ + public Message invoke(Message msg) { + return getNext().invoke(msg); + } + + /** + * @see org.apache.tuscany.sca.invocation.DataExchangeSemantics#allowsPassByReference() + */ + public boolean allowsPassByReference() { + return chain.allowsPassByReference(); + } + +} diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java new file mode 100644 index 0000000000..bb176eaaff --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java @@ -0,0 +1,60 @@ +/* + * 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.sca.binding.event.impl; + +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; + +/** + * The Event Binding provider implementation. + * + * @version $$ + */ +public class EventBindingProvider implements ReferenceBindingProvider { + + private RuntimeComponentReference reference; + + public EventBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EventBindingImpl binding) { + this.reference = reference; + } + + public InterfaceContract getBindingInterfaceContract() { + return reference.getInterfaceContract(); + } + + public Invoker createInvoker(Operation operation) { + return null; + } + + public void start() { + } + + public void stop() { + } + + public boolean supportsOneWayInvocation() { + return true; + } + +} diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java new file mode 100644 index 0000000000..7fc12c84b7 --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java @@ -0,0 +1,60 @@ +/* + * 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.sca.binding.event.impl; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.provider.BindingProviderFactory; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * The factory for creating Event Binding providers + * + * @version $$ + */ +public class EventBindingProviderFactory implements BindingProviderFactory { + + private ExtensionPointRegistry extensionPoints; + + public EventBindingProviderFactory(ExtensionPointRegistry extensionPoints) { + this.extensionPoints = extensionPoints; + + } + + public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, + RuntimeComponentReference reference, + EventBindingImpl binding) { + + return new EventReferenceBindingProvider(extensionPoints, component, reference, binding); + } + + public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, + RuntimeComponentService service, + EventBindingImpl binding) { + return new EventServiceBindingProvider(extensionPoints, component, service, binding); + } + + public Class getModelType() { + return EventBindingImpl.class; + } +} diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java new file mode 100644 index 0000000000..bb09fb5b77 --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java @@ -0,0 +1,97 @@ +/* + * 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.sca.binding.event.impl; + +import java.util.logging.Logger; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; + +/** + * Event reference binding provider + * + * @version $$ + */ +public class EventReferenceBindingProvider implements ReferenceBindingProvider { + + @SuppressWarnings("unused") + private static final Logger logger = Logger.getLogger(EventReferenceBindingProvider.class.getName()); + + @SuppressWarnings("unused") + private RuntimeComponent component; + @SuppressWarnings("unused") + private EventBindingImpl binding; + private RuntimeComponentReference reference; + private boolean started = false; + private ReferenceBindingProvider baseBindingProvider; + + + public EventReferenceBindingProvider(ExtensionPointRegistry extensionPoints, + RuntimeComponent component, + RuntimeComponentReference reference, + EventBindingImpl binding) { + this.component = component; + this.reference = reference; + this.binding = binding; + + // TODO: Set baseBindingProvider + } + + + public InterfaceContract getBindingInterfaceContract() { + if (reference.getReference() != null) { + return reference.getReference().getInterfaceContract(); + } else { + return reference.getInterfaceContract(); + } + } + + public boolean supportsOneWayInvocation() { + return true; + } + + + public Invoker createInvoker(Operation operation) { + return baseBindingProvider.createInvoker(operation); + } + + public void start() { + if (started) { + return; + } else { + started = true; + } + } + + public void stop() { + if (!started) { + return; + } else { + started = false; + } + + } + +} diff --git a/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java new file mode 100644 index 0000000000..593795aae0 --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java @@ -0,0 +1,63 @@ +/* + * 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.sca.binding.event.impl; + + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * The event service binding provider + * + * @version $$ + */ +public class EventServiceBindingProvider implements ServiceBindingProvider { + + private RuntimeComponentService service; + + public EventServiceBindingProvider(ExtensionPointRegistry extensionPoints, + RuntimeComponent component, + RuntimeComponentService service, + EventBindingImpl binding) { + this.service = service; + } + + public InterfaceContract getBindingInterfaceContract() { + if (service.getService() != null) { + return service.getService().getInterfaceContract(); + } else { + return service.getInterfaceContract(); + } + } + + public boolean supportsOneWayInvocation() { + return true; + } + + public void start() { + } + + public void stop() { + } + +} diff --git a/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory b/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory new file mode 100644 index 0000000000..b1a0b12c1d --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory @@ -0,0 +1,18 @@ +# 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. + +org.apache.tuscany.sca.binding.event.impl.EventBindingFactoryImpl diff --git a/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory new file mode 100644 index 0000000000..6102e4210e --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory @@ -0,0 +1,19 @@ +# 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. + +# Implementation class for the binding extension +org.apache.tuscany.sca.binding.event.impl.EventBindingProviderFactory;model=org.apache.tuscany.sca.binding.event.impl.EventBindingImpl diff --git a/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider new file mode 100644 index 0000000000..9a923d1828 --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider @@ -0,0 +1,19 @@ +# 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. + +# Implementation class for SCA Definitions Providers +org.apache.tuscany.sca.binding.event.EventBindingDefinitionsProvider \ No newline at end of file diff --git a/sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml b/sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml new file mode 100644 index 0000000000..559994b9f9 --- /dev/null +++ b/sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml @@ -0,0 +1,26 @@ + + + + + + \ No newline at end of file -- cgit v1.2.3