From 75c4045c9663debea932437ed12954e74e7e27bd Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 23 Jun 2008 21:21:18 +0000 Subject: Delete obsolete contents git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@670762 13f79535-47bb-0310-9956-ffa450edef68 --- .../composite/AbstractCompositeBuilder.java | 69 ------- .../composite/ComponentTimeoutException.java | 33 --- .../implementation/composite/CompositeBuilder.java | 51 ----- .../composite/CompositeComponentImpl.java | 121 ----------- .../composite/CompositeComponentTypeLoader.java | 65 ------ .../implementation/composite/CompositeLoader.java | 224 --------------------- .../composite/ManagedRequestContext.java | 58 ------ .../implementation/composite/ReferenceImpl.java | 71 ------- .../core/implementation/composite/ServiceImpl.java | 81 -------- 9 files changed, 773 deletions(-) delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java delete mode 100644 sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java (limited to 'sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite') diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java deleted file mode 100644 index d12b407ea7..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeBuilder.java +++ /dev/null @@ -1,69 +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.core.implementation.composite; - -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.builder.BuilderInstantiationException; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.RegistrationException; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.ComponentBuilderExtension; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ServiceDefinition; - -/** - * Abstract builder for composites - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractCompositeBuilder> - extends ComponentBuilderExtension { - - public Component build( - Component component, - CompositeComponentType componentType, - DeploymentContext deploymentContext) throws BuilderException { - for (ComponentDefinition> definition : componentType.getComponents().values()) { - builderRegistry.build(definition, deploymentContext); - } - for (ServiceDefinition definition : componentType.getServices().values()) { - try { - Service service = builderRegistry.build(definition, deploymentContext); - component.register(service); - } catch (RegistrationException e) { - throw new BuilderInstantiationException("Error registering service", e); - } - } - for (ReferenceDefinition definition : componentType.getReferences().values()) { - try { - Reference reference = builderRegistry.build(definition, deploymentContext); - component.register(reference); - } catch (RegistrationException e) { - throw new BuilderInstantiationException("Error registering reference", e); - } - } - return component; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.java deleted file mode 100644 index ed64cb1236..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ComponentTimeoutException.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.core.implementation.composite; - -import org.apache.tuscany.spi.component.ComponentRuntimeException; - -/** - * Denotes a condition where a component times out waiting to perform an operation - * - * @version $Rev$ $Date$ - */ -public class ComponentTimeoutException extends ComponentRuntimeException { - - public ComponentTimeoutException(String message) { - super(message); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java deleted file mode 100644 index 51d360ec39..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java +++ /dev/null @@ -1,51 +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.core.implementation.composite; - -import java.net.URI; - -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.CompositeImplementation; - -/** - * Instantiates a composite component from an assembly definition - * - * @version $Rev$ $Date$ - */ -public class CompositeBuilder extends AbstractCompositeBuilder { - - public Component build(ComponentDefinition componentDefinition, - DeploymentContext deploymentContext) throws BuilderException { - - CompositeImplementation implementation = componentDefinition.getImplementation(); - CompositeComponentType componentType = implementation.getComponentType(); - URI name = componentDefinition.getUri(); - CompositeComponentImpl component = new CompositeComponentImpl(name); - - return build(component, componentType, deploymentContext); - } - - protected Class getImplementationType() { - return CompositeImplementation.class; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java deleted file mode 100644 index 8df05048c8..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java +++ /dev/null @@ -1,121 +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.core.implementation.composite; - -import java.net.URI; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.apache.tuscany.spi.event.Event; -import org.apache.tuscany.spi.extension.CompositeComponentExtension; -import org.apache.tuscany.spi.wire.Wire; - -import org.apache.tuscany.core.component.event.ComponentStop; - -/** - * The standard implementation of a composite component. Autowiring is performed by delegating to the parent composite. - * - * @version $Rev$ $Date$ - */ -public class CompositeComponentImpl extends CompositeComponentExtension { - public static final int DEFAULT_WAIT = 1000 * 60; - // Blocking latch to ensure the composite is initialized exactly once prior to servicing requests - protected CountDownLatch initializeLatch = new CountDownLatch(1); - protected final Object lock = new Object(); - // Indicates whether the composite context has been initialized - protected boolean initialized; - - /** - * Constructor - * - * @param name the name of this Component - */ - public CompositeComponentImpl(URI name) { - super(name); - } - - public void attachWire(Wire wire) { - throw new UnsupportedOperationException(); - } - - public void attachWires(List wires) { - throw new UnsupportedOperationException(); - } - - public List getWires(String name) { - throw new UnsupportedOperationException(); - } - - public void attachCallbackWire(Wire wire) { - throw new UnsupportedOperationException(); - } - - public void start() { - synchronized (lock) { - if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) { - throw new IllegalStateException("Composite not in UNINITIALIZED state"); - } - initializeLatch.countDown(); - initialized = true; - lifecycleState = INITIALIZED; - } - } - - public void stop() { - if (lifecycleState == STOPPED) { - return; - } - - publish(new ComponentStop(this, getUri())); - // need to block a start until reset is complete - initializeLatch = new CountDownLatch(2); - lifecycleState = STOPPING; - initialized = false; - // allow initialized to be called - initializeLatch.countDown(); - lifecycleState = STOPPED; - } - - public void publish(Event event) { - if (lifecycleState == STOPPED) { - return; - } - checkInit(); - super.publish(event); - } - - /** - * Blocks until the composite context has been initialized - */ - protected void checkInit() throws ComponentTimeoutException { - if (!initialized) { - try { - /* block until the composite has initialized */ - boolean success = initializeLatch.await(DEFAULT_WAIT, TimeUnit.MILLISECONDS); - if (!success) { - throw new ComponentTimeoutException("Timeout waiting for context to initialize"); - } - } catch (InterruptedException e) { // should not happen - } - } - - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java deleted file mode 100644 index 6cb31a8e20..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentTypeLoader.java +++ /dev/null @@ -1,65 +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.core.implementation.composite; - -import java.net.URI; -import java.net.URL; - -import org.apache.tuscany.spi.deployer.CompositeClassLoader; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.CompositeImplementation; - -import org.apache.tuscany.core.deployer.ChildDeploymentContext; - -/** - * Loads a composite component type - * - * @version $Rev$ $Date$ - */ -public class CompositeComponentTypeLoader extends ComponentTypeLoaderExtension { - public CompositeComponentTypeLoader() { - } - - public CompositeComponentTypeLoader(LoaderRegistry loaderRegistry) { - super(loaderRegistry); - } - - protected Class getImplementationClass() { - return CompositeImplementation.class; - } - - public void load(CompositeImplementation implementation, DeploymentContext context) throws LoaderException { - URL scdlLocation = implementation.getScdlLocation(); - ClassLoader cl = new CompositeClassLoader(null, implementation.getClassLoader()); - URI componentId = URI.create(context.getComponentId().toString() + '/'); - DeploymentContext childContext = - new ChildDeploymentContext(context, cl, scdlLocation, componentId, context.isAutowire()); - CompositeComponentType componentType = loadFromSidefile(scdlLocation, childContext); - implementation.setComponentType(componentType); - } - - protected CompositeComponentType loadFromSidefile(URL url, DeploymentContext deploymentContext) - throws LoaderException { - return loaderRegistry.load(null, url, CompositeComponentType.class, deploymentContext); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java deleted file mode 100644 index 008ee59de8..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeLoader.java +++ /dev/null @@ -1,224 +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.core.implementation.composite; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; -import static org.osoa.sca.Constants.SCA_NS; - -import java.net.URI; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.extension.LoaderExtension; -import org.apache.tuscany.spi.loader.InvalidServiceException; -import org.apache.tuscany.spi.loader.InvalidWireException; -import org.apache.tuscany.spi.loader.LoaderException; -import org.apache.tuscany.spi.loader.LoaderRegistry; -import org.apache.tuscany.spi.model.ComponentDefinition; -import org.apache.tuscany.spi.model.ComponentType; -import org.apache.tuscany.spi.model.CompositeComponentType; -import org.apache.tuscany.spi.model.Implementation; -import org.apache.tuscany.spi.model.Include; -import org.apache.tuscany.spi.model.ModelObject; -import org.apache.tuscany.spi.model.Property; -import org.apache.tuscany.spi.model.ReferenceDefinition; -import org.apache.tuscany.spi.model.ReferenceTarget; -import org.apache.tuscany.spi.model.ServiceDefinition; -import org.apache.tuscany.spi.model.WireDefinition; -import org.apache.tuscany.spi.services.artifact.ArtifactRepository; -import org.osoa.sca.annotations.Reference; - -/** - * Loads a composite component definition from an XML-based assembly file - * - * @version $Rev$ $Date$ - */ -public class CompositeLoader extends LoaderExtension { - public static final QName COMPOSITE = new QName(SCA_NS, "composite"); - public static final String URI_DELIMITER = "/"; - - private final ArtifactRepository artifactRepository; - - public CompositeLoader(@Reference - LoaderRegistry registry, @Reference - ArtifactRepository artifactRepository) { - super(registry); - this.artifactRepository = artifactRepository; - } - - public QName getXMLType() { - return COMPOSITE; - } - - public CompositeComponentType load(ModelObject object, XMLStreamReader reader, DeploymentContext deploymentContext) - throws XMLStreamException, LoaderException { - - String name = reader.getAttributeValue(null, "name"); - String targetNamespace = reader.getAttributeValue(null, "targetNamespace"); - boolean autowire = Boolean.parseBoolean(reader.getAttributeValue(null, "autowire")); - - CompositeComponentType> type = new CompositeComponentType>( - new QName( - targetNamespace, - name)); - type.setAutowire(autowire); - boolean done = false; - while (!done) { - switch (reader.next()) { - case START_ELEMENT: - boolean oldAutowire = deploymentContext.isAutowire(); - deploymentContext.setAutowire(autowire); - ModelObject o = registry.load(type, reader, deploymentContext); - deploymentContext.setAutowire(oldAutowire); - if (o instanceof ServiceDefinition) { - type.add((ServiceDefinition)o); - } else if (o instanceof ReferenceDefinition) { - type.add((ReferenceDefinition)o); - } else if (o instanceof Property) { - type.add((Property)o); - } else if (o instanceof ComponentDefinition) { - type.add((ComponentDefinition)o); - } else if (o instanceof Include) { - type.add((Include)o); - } else if (o instanceof WireDefinition) { - type.add((WireDefinition)o); - } else { - // add as an unknown model extension - if (o != null) { - type.getExtensions().put(o.getClass(), o); - } - } - reader.next(); - break; - case END_ELEMENT: - if (COMPOSITE.equals(reader.getName())) { - // if there are wire defintions then link them up to the - // relevant components - resolveWires(type); - verifyCompositeCompleteness(type); - done = true; - break; - } - } - } - for (ComponentDefinition> c : type.getComponents().values()) { - // PropertyHelper.processProperties(type, c, deploymentContext); - } - return type; - } - - protected void resolveWires(CompositeComponentType> composite) - throws InvalidWireException { - ComponentDefinition componentDefinition; - ServiceDefinition serviceDefinition; - List wireDefns = composite.getDeclaredWires(); - for (WireDefinition wire : wireDefns) { - URI targetUri = wire.getTarget(); - // validate the target before finding the source - validateTarget(targetUri, composite); - - String sourceName = wire.getSource().getPath(); // new - // QualifiedName(wire.getSource().getPath()); - serviceDefinition = composite.getDeclaredServices().get(sourceName); - if (serviceDefinition != null) { - serviceDefinition.setTarget(wire.getTarget()); - } else { - componentDefinition = composite.getDeclaredComponents().get(sourceName); - if (componentDefinition != null) { - if (wire.getSource().getFragment() == null) { - throw new InvalidWireException("Source reference not specified", sourceName); - } - URI referenceName = URI.create(wire.getSource().getFragment()); - ReferenceTarget referenceTarget = createReferenceTarget(referenceName, - targetUri, - componentDefinition); - componentDefinition.add(referenceTarget); - } else { - throw new InvalidWireException("Source not found", sourceName); - } - } - } - } - - private ReferenceTarget createReferenceTarget(URI componentReferenceName, - URI target, - ComponentDefinition componentDefn) throws InvalidWireException { - ComponentType componentType = componentDefn.getImplementation().getComponentType(); - if (componentReferenceName == null) { - // if there is ambiguity in determining the source of the wire or - // there is no reference to be wired - if (componentType.getReferences().size() > 1 || componentType.getReferences().isEmpty()) { - throw new InvalidWireException("Unable to determine unique source reference"); - } else { - Map references = componentType.getReferences(); - ReferenceDefinition definition = (ReferenceDefinition)references.values().iterator().next(); - componentReferenceName = definition.getUri(); - } - } - - ReferenceTarget referenceTarget = new ReferenceTarget(); - referenceTarget.setReferenceName(componentReferenceName); - referenceTarget.addTarget(target); - return referenceTarget; - } - - protected void verifyCompositeCompleteness(CompositeComponentType> composite) - throws InvalidServiceException { - // check if all of the composite services have been wired - for (ServiceDefinition svcDefn : composite.getDeclaredServices().values()) { - if (svcDefn.getTarget() == null) { - String identifier = svcDefn.getUri().toString(); - throw new InvalidServiceException("Composite service not wired to a target", identifier); - } - } - } - - private void validateTarget(URI target, - CompositeComponentType> composite) - throws InvalidWireException { - // if target is not a reference of the composite - String targetName = target.getPath(); - if (composite.getReferences().get(targetName) == null) { - ComponentDefinition targetDefinition = composite.getDeclaredComponents().get(targetName); - // if a target component exists in this composite - if (targetDefinition != null) { - Implementation implementation = targetDefinition.getImplementation(); - ComponentType componentType = implementation.getComponentType(); - Map services = componentType.getServices(); - if (target.getFragment() == null) { - if (services.size() > 1 || services.isEmpty()) { - throw new InvalidWireException("Ambiguous target", target.toString()); - } - } else { - if (services.get(target.getFragment()) == null) { - throw new InvalidWireException("Invalid target service", target.toString()); - } - } - } else { - throw new InvalidWireException("Target not found", target.toString()); - } - } - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java deleted file mode 100644 index f2a8109ee3..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java +++ /dev/null @@ -1,58 +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.core.implementation.composite; - -import javax.security.auth.Subject; - -import org.osoa.sca.RequestContext; -import org.osoa.sca.ServiceReference; -import org.osoa.sca.CallableReference; - -import org.apache.tuscany.spi.component.WorkContext; - -/** - * @version $Rev$ $Date$ - */ -public class ManagedRequestContext implements RequestContext { - private WorkContext workContext; - - public ManagedRequestContext(WorkContext workContext) { - this.workContext = workContext; - } - - public Subject getSecuritySubject() { - throw new UnsupportedOperationException(); - } - - public String getServiceName() { - return workContext.getCurrentServiceName(); - } - - public ServiceReference getServiceReference() { - throw new UnsupportedOperationException(); - } - - public CB getCallback() { - throw new UnsupportedOperationException(); - } - - public CallableReference getCallbackReference() { - throw new UnsupportedOperationException(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java deleted file mode 100644 index f824980f29..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java +++ /dev/null @@ -1,71 +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.core.implementation.composite; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.spi.component.AbstractSCAObject; -import org.apache.tuscany.spi.component.Reference; -import org.apache.tuscany.spi.component.ReferenceBinding; -import org.apache.tuscany.spi.model.ServiceContract; - -/** - * The default implementation of a {@link org.apache.tuscany.spi.component.Reference} - * - * @version $Rev$ $Date$ - */ -public class ReferenceImpl extends AbstractSCAObject implements Reference { - private ServiceContract serviceContract; - private List bindings = new ArrayList(); - - public ReferenceImpl(URI name, ServiceContract contract) { - super(name); - this.serviceContract = contract; - } - - public ServiceContract getServiceContract() { - return serviceContract; - } - - public List getReferenceBindings() { - return Collections.unmodifiableList(bindings); - } - - public void addReferenceBinding(ReferenceBinding binding) { - bindings.add(binding); - } - - public void start() { - super.start(); - for (ReferenceBinding binding : bindings) { - binding.start(); - } - } - - public void stop() { - super.stop(); - for (ReferenceBinding binding : bindings) { - binding.stop(); - } - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java deleted file mode 100644 index b8b9b00b49..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java +++ /dev/null @@ -1,81 +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.core.implementation.composite; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.spi.component.AbstractSCAObject; -import org.apache.tuscany.spi.component.Service; -import org.apache.tuscany.spi.component.ServiceBinding; -import org.apache.tuscany.spi.model.ServiceContract; - -/** - * The default implementation of a {@link Service} - * - * @version $Rev$ $Date$ - */ -public class ServiceImpl extends AbstractSCAObject implements Service { - private ServiceContract serviceContract; - private List bindings = new ArrayList(); - private URI targetUri; - - public ServiceImpl(URI name, ServiceContract contract) { - this(name, contract, null); - } - - public ServiceImpl(URI name, ServiceContract contract, URI targetUri) { - super(name); - this.serviceContract = contract; - this.targetUri = targetUri; - } - - public ServiceContract getServiceContract() { - return serviceContract; - } - - public URI getTargetUri() { - return targetUri; - } - - public List getServiceBindings() { - return Collections.unmodifiableList(bindings); - } - - public void addServiceBinding(ServiceBinding binding) { - bindings.add(binding); - } - - public void start() { - super.start(); - for (ServiceBinding binding : bindings) { - binding.start(); - } - } - - public void stop() { - super.stop(); - for (ServiceBinding binding : bindings) { - binding.stop(); - } - } - -} -- cgit v1.2.3