diff options
Diffstat (limited to 'branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification')
9 files changed, 0 insertions, 618 deletions
diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java deleted file mode 100644 index 22d567b5ac..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.implementation.notification; - - -/** - * A default factory for the Notification implementation model. - * - * @version $Rev$ $Date$ - */ -public class DefaultNotificationImplementationFactory implements NotificationImplementationFactory { - - public NotificationImplementationImpl createNotificationImplementation() { - return new NotificationImplementationImpl(); - } - -} diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java deleted file mode 100644 index 96d33143c8..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.implementation.notification; - -import java.util.Map; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.runtime.EndpointReference; -import org.apache.tuscany.sca.runtime.RuntimeWire; - -/** - * @version $Rev$ $Date$ - */ -public class ImmutableMessage implements Message { - - public <T> T getBody() { - return null; - } - - public EndpointReference getFrom() { - return null; - } - - public Object getMessageID() { - return null; - } - - public EndpointReference getTo() { - return null; - } - - public RuntimeWire getWire() { - return null; - } - - public boolean isFault() { - return false; - } - - public <T> void setBody(T arg0) { - throw new UnsupportedOperationException(); - } - - public <T> void setFaultBody(T arg0) { - throw new UnsupportedOperationException(); - } - - public void setFrom(EndpointReference arg0) { - throw new UnsupportedOperationException(); - } - - public void setMessageID(Object arg0) { - throw new UnsupportedOperationException(); - } - - public void setTo(EndpointReference arg0) { - throw new UnsupportedOperationException(); - } - - public Operation getOperation() { - return null; - } - - public void setOperation(Operation op) { - throw new UnsupportedOperationException(); - } - - /** - * @see org.apache.tuscany.sca.invocation.Message#getReplyTo() - */ - public EndpointReference getReplyTo() { - return null; - } - - public Map<String, Object> getQoSContext() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java deleted file mode 100644 index e804d14d23..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.implementation.notification; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.interfacedef.Operation; -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.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeWire; - -/** - * Turns invoke into remote message fan-out - * - * @version $Rev$ $Date$ - */ -public class NotificationComponentInvoker implements Invoker { - - private static final Message RESPONSE = new ImmutableMessage(); - private List<InvocationChain> subscriberInvocationChains; - private Operation operation; - private RuntimeComponent component; - - public NotificationComponentInvoker(Operation operation, RuntimeComponent component) { - this.subscriberInvocationChains = null; - this.operation = operation; - this.component = component; - } - - public Message invoke(Message msg) { - addSubscriberInvocationChains(); - - // REVIEW Should this be done in separate thread(s)? - // REVIEW Should separate copies of message be used? - Object msgBody = msg.getBody(); - - for (InvocationChain subscriberInvocationChain : subscriberInvocationChains) { - Invoker chainInvoker = subscriberInvocationChain.getHeadInvoker(); - msg.setBody(msgBody); - chainInvoker.invoke(msg); - } - - return RESPONSE; - } - - private void addSubscriberInvocationChains() { - if (subscriberInvocationChains == null) { - subscriberInvocationChains = new ArrayList<InvocationChain>(); - for (ComponentReference reference : component.getReferences()) { - if (reference.getName().indexOf("$self$") >= 0) { - continue; - } - RuntimeComponentReference rtCompRef = null; - if (reference instanceof RuntimeComponentReference) { - rtCompRef = (RuntimeComponentReference)reference; - } - else { - throw new RuntimeException("Need a runtime component reference"); - } - for(RuntimeWire wire : rtCompRef.getRuntimeWires()) { - // This is much less efficient now !! - List<InvocationChain> chains = wire.getInvocationChains(); - InvocationChain chain = getInvocationChain(chains, operation); - subscriberInvocationChains.add(chain); - } - } - } - } - - private InvocationChain getInvocationChain(List<InvocationChain> chains, Operation operation) { - InvocationChain chain = null; - for (InvocationChain ch : chains) { - if (ch.getTargetOperation().equals(operation)) { - chain = ch; - break; - } - } - if (chain == null) { - for (InvocationChain ch : chains) { - if (ch.getTargetOperation().getName().equals(operation.getName())) { - chain = ch; - break; - } - } - if (chain == null) { - throw new RuntimeException("Can't find a compatible chain"); - } - } - return chain; - } -} diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java deleted file mode 100644 index 0cca36855e..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.implementation.notification; - -/** - * @version $Rev$ $Date$ - */ -public interface NotificationImplementationFactory { - - NotificationImplementationImpl createNotificationImplementation(); -} diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java deleted file mode 100644 index c8540ae7c1..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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.implementation.notification; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; - - -/** - * Model object for a Notification implementation. - * - * @version $Rev$ $Date$ - */ -public class NotificationImplementationImpl extends ImplementationImpl implements Implementation { - - private String componentTypeName; - private String implementationType; - private ComponentType componentType; - - - public NotificationImplementationImpl() { - // Without this, the loader's resolve is not called - setUnresolved(true); - } - - public String getComponentTypeName() { - return componentTypeName; - } - - public void setComponentTypeName(String componentTypeName) { - this.componentTypeName = componentTypeName; - } - - public String getImplementationType() { - return implementationType; - } - - public void setImplementationType(String implementationType) { - this.implementationType = implementationType; - } - - public ComponentType getComponentType() { - return componentType; - } - - public void setComponentType(ComponentType componentType) { - this.componentType = componentType; - } - - @Override - public List<Service> getServices() { - return componentType.getServices(); - } - - @Override - public List<Reference> getReferences() { - return componentType.getReferences(); - } - - @Override - public int hashCode() { - return String.valueOf(getComponentTypeName()).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) - return true; - else if (obj instanceof NotificationImplementationImpl && - getComponentTypeName().equals(((NotificationImplementationImpl)obj).getComponentTypeName())) - return true; - else - return false; - } -} diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java deleted file mode 100644 index e2f2496091..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.implementation.notification; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; - -/** - * Loader for handling Notification <implementation.notification> elements. - * - * @version $Rev$ $Date$ - */ -public class NotificationImplementationProcessor implements StAXArtifactProcessor<NotificationImplementationImpl> { - - protected static final QName IMPLEMENTATION_NOTIFICATION = - new QName(Constants.SCA10_TUSCANY_NS, "implementation.notification"); - - private NotificationImplementationFactory implementationFactory; - - public NotificationImplementationProcessor(NotificationImplementationFactory implementationFactory) { - this.implementationFactory = implementationFactory; - } - - public QName getArtifactType() { - return IMPLEMENTATION_NOTIFICATION; - } - - public Class<NotificationImplementationImpl> getModelType() { - return NotificationImplementationImpl.class; - } - - public NotificationImplementationImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - assert IMPLEMENTATION_NOTIFICATION.equals(reader.getName()); - String componentTypeName = reader.getAttributeValue(null, "name"); - String implementationType = reader.getAttributeValue(null, "type"); - - NotificationImplementationImpl implementation = implementationFactory.createNotificationImplementation(); - implementation.setComponentTypeName(componentTypeName); - implementation.setImplementationType(implementationType); - // Skip to end element - while (reader.hasNext()) { - if (reader.next() == END_ELEMENT && IMPLEMENTATION_NOTIFICATION.equals(reader.getName())) { - break; - } - } - - ComponentType componentType = new DefaultAssemblyFactory().createComponentType(); - componentType.setURI(componentTypeName + ".componentType"); - componentType.setUnresolved(true); - implementation.setComponentType(componentType); - - return implementation; - } - - public void resolve(NotificationImplementationImpl impl, ModelResolver resolver) throws ContributionResolveException { - ComponentType componentType = resolver.resolveModel(ComponentType.class, impl.getComponentType()); - - if (componentType.isUnresolved()) { - throw new ContributionResolveException("ComponentType still unresolved"); - } - impl.setComponentType(componentType); - impl.setUnresolved(false); - } - - public void write(NotificationImplementationImpl model, XMLStreamWriter outputSource) - throws ContributionWriteException, XMLStreamException { - - //FIXME Implement this method - } -} diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java deleted file mode 100644 index acb77eadd7..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.implementation.notification; - -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * @version $Rev$ $Date$ - */ -public class NotificationImplementationProvider implements ImplementationProvider { - - private RuntimeComponent component; - - /** - * Constructs a new Notification implementation provider. - */ - public NotificationImplementationProvider(RuntimeComponent component, NotificationImplementationImpl implementation) { - this.component = component; - } - - public Invoker createInvoker(RuntimeComponentService service, Operation operation) { - NotificationComponentInvoker invoker = new NotificationComponentInvoker(operation, component); - return invoker; - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - for (ComponentService service : component.getServices()) { - if (service.getService() != null) { - InterfaceContract interfaceContract = service.getService().getInterfaceContract(); - if (interfaceContract instanceof WSDLInterfaceContract) { - interfaceContract.getInterface().resetDataBinding("org.apache.axiom.om.OMElement"); - } - } - } - } - - public void stop() { - } - -} diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java deleted file mode 100644 index b439492bde..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.implementation.notification; - -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * @version $Rev$ $Date$ - */ -public class NotificationImplementationProviderFactory implements ImplementationProviderFactory<NotificationImplementationImpl> { - - public ImplementationProvider createImplementationProvider(RuntimeComponent component, - NotificationImplementationImpl implementation) { - return new NotificationImplementationProvider(component, implementation); - } - - public Class<NotificationImplementationImpl> getModelType() { - return NotificationImplementationImpl.class; - } -} diff --git a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java b/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java deleted file mode 100644 index 818cd923c0..0000000000 --- a/branches/sca-java-1.2/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.implementation.notification; - -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; -import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; - -/** - * @version $Rev$ $Date$ - */ -public class NotificationModuleActivator implements ModuleActivator { - - private NotificationImplementationProcessor implementationLoader; - - public void start(ExtensionPointRegistry registry) { - StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - - implementationLoader = new NotificationImplementationProcessor(new DefaultNotificationImplementationFactory()); - processors.addArtifactProcessor(implementationLoader); - - ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class); - providerFactories.addProviderFactory(new NotificationImplementationProviderFactory()); - } - - public void stop(ExtensionPointRegistry registry) { - StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - - processors.removeArtifactProcessor(implementationLoader); - } - -} |