diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-23 21:21:18 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-23 21:21:18 +0000 |
commit | 75c4045c9663debea932437ed12954e74e7e27bd (patch) | |
tree | b319b764c8368e29242c2f77343a8717375f9c2d /sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer | |
parent | 0b8a310ea6ebded47de92651efbf234b181367e5 (diff) |
Delete obsolete contents
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@670762 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer')
4 files changed, 0 insertions, 422 deletions
diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java deleted file mode 100644 index 8d24047781..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java +++ /dev/null @@ -1,80 +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.deployer; - -import java.net.URI; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.deployer.DeploymentContext; - -/** - * Base class for DeploymentContext implementations. - * - * @version $Rev$ $Date$ - */ -public abstract class AbstractDeploymentContext implements DeploymentContext { - private final URI componentId; - private boolean autowire; - private final ClassLoader classLoader; - private final URL scdlLocation; - private final Map<URI, Component> components = new HashMap<URI, Component>(); - - /** - * Constructor defining properties of this context. - * - * @param classLoader the classloader for loading application resources - * @param scdlLocation the location of the SCDL defining this composite - * @param componentId the id of the component being deployed - * @param autowire if autowire is enabled - */ - protected AbstractDeploymentContext(ClassLoader classLoader, URL scdlLocation, URI componentId, boolean autowire) { - this.classLoader = classLoader; - this.scdlLocation = scdlLocation; - this.componentId = componentId; - this.autowire = autowire; - } - - public ClassLoader getClassLoader() { - return classLoader; - } - - public URL getScdlLocation() { - return scdlLocation; - } - - public URI getComponentId() { - return componentId; - } - - public boolean isAutowire() { - return autowire; - } - - public void setAutowire(boolean autowire) { - this.autowire = autowire; - } - - @Deprecated - public Map<URI, Component> getComponents() { - return components; - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java deleted file mode 100644 index c2f8ae07fc..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.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.deployer; - -import java.net.URI; -import java.net.URL; -import javax.xml.stream.XMLInputFactory; - -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.deployer.DeploymentContext; - -/** - * An holder that can be used during the load process to store information that is not part of the logical assembly - * model. This should be regarded as transient and references to this context should not be stored inside the model. - * - * @version $Rev$ $Date$ - */ -public class ChildDeploymentContext extends AbstractDeploymentContext { - private final DeploymentContext parent; - - /** - * Constructor defining properties of this context. - * - * @param parent the parent of this context - * @param classLoader the classloader for loading application resources - * @param scdlLocation the location of the SCDL defining this composite - * @param componentId the id of the component being deployed - * @param autowire if autowire is enabled - */ - public ChildDeploymentContext(DeploymentContext parent, - ClassLoader classLoader, - URL scdlLocation, - URI componentId, - boolean autowire) { - super(classLoader, scdlLocation, componentId, autowire); - assert parent != null; - this.parent = parent; - } - - public DeploymentContext getParent() { - return parent; - } - - public XMLInputFactory getXmlFactory() { - return parent.getXmlFactory(); - } - - public ScopeContainer getCompositeScope() { - return parent.getCompositeScope(); - } - - public URI getGroupId() { - return parent.getGroupId(); - } -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java deleted file mode 100644 index 18f078e4f6..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java +++ /dev/null @@ -1,197 +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.deployer; - -import java.net.URI; -import java.util.Collection; -import javax.xml.stream.XMLInputFactory; - -import org.osoa.sca.annotations.Reference; - -import org.apache.tuscany.api.annotation.Monitor; -import org.apache.tuscany.core.resolver.AutowireResolver; -import org.apache.tuscany.spi.builder.Builder; -import org.apache.tuscany.spi.builder.BuilderException; -import org.apache.tuscany.spi.builder.BuilderInstantiationException; -import org.apache.tuscany.spi.builder.BuilderRegistry; -import org.apache.tuscany.spi.builder.Connector; -import org.apache.tuscany.spi.component.Component; -import org.apache.tuscany.spi.component.ComponentManager; -import org.apache.tuscany.spi.component.RegistrationException; -import org.apache.tuscany.spi.component.SCAObject; -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.component.ScopeContainerMonitor; -import org.apache.tuscany.spi.component.ScopeRegistry; -import org.apache.tuscany.spi.deployer.Deployer; -import org.apache.tuscany.spi.deployer.DeploymentContext; -import org.apache.tuscany.spi.loader.Loader; -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.Implementation; -import org.apache.tuscany.spi.model.Scope; -import org.apache.tuscany.spi.resolver.ResolutionException; - -/** - * Default implementation of Deployer. - * - * @version $Rev$ $Date$ - */ -public class DeployerImpl implements Deployer { - private XMLInputFactory xmlFactory; - private Loader loader; - private Builder builder; - private ScopeContainerMonitor monitor; - private AutowireResolver resolver; - private Connector connector; - private ComponentManager componentManager; - private ScopeRegistry scopeRegistry; - - - public DeployerImpl(XMLInputFactory xmlFactory, - Loader loader, - Builder builder, - ComponentManager componentManager, - AutowireResolver resolver, - Connector connector) { - this.xmlFactory = xmlFactory; - this.builder = builder; - this.loader = loader; - this.componentManager = componentManager; - this.resolver = resolver; - this.connector = connector; - } - - public DeployerImpl() { - xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader()); - } - - @Reference - public void setBuilder(BuilderRegistry builder) { - this.builder = builder; - } - - @Monitor - public void setMonitor(ScopeContainerMonitor monitor) { - this.monitor = monitor; - } - - @Reference - public void setResolver(AutowireResolver resolver) { - this.resolver = resolver; - } - - @Reference - public void setConnector(Connector connector) { - this.connector = connector; - } - - @Reference - public void setComponentManager(ComponentManager componentManager) { - this.componentManager = componentManager; - } - - @Reference - public void setScopeRegistry(ScopeRegistry scopeRegistry) { - this.scopeRegistry = scopeRegistry; - } - - public <I extends Implementation<?>> Collection<Component> deploy(Component parent, - ComponentDefinition<I> componentDefinition) - throws LoaderException, BuilderException, ResolutionException { - @SuppressWarnings("unchecked") - ScopeContainer<URI> scopeContainer = scopeRegistry.getScopeContainer(Scope.COMPOSITE); - URI groupId = componentDefinition.getUri(); - DeploymentContext deploymentContext = - new RootDeploymentContext(null, null, groupId, xmlFactory, scopeContainer, false); - // load the model - load(parent, componentDefinition, deploymentContext); - // resolve autowires - resolver.resolve(null, componentDefinition); - // build runtime artifacts - build(parent, componentDefinition, deploymentContext); -/* - // create a listener so the scope container is shutdown when the top-level composite stops - RuntimeEventListener listener = new RuntimeEventListener() { - public void onEvent(Event event) { - scopeContainer.onEvent(event); - if (event instanceof ComponentStop) { - scopeContainer.stop(); - } - } - }; - component.addListener(listener); -*/ - - Collection<Component> components = deploymentContext.getComponents().values(); - for (Component toRegister : components) { - try { - componentManager.register(toRegister); - } catch (RegistrationException e) { - throw new BuilderInstantiationException("Error registering component", e); - } - } - connector.connect(componentDefinition); - return components; - } - - /** - * Load the componentDefinition type information for the componentDefinition being deployed. For a typical - * deployment this will result in the SCDL definition being loaded. - * - * @param componentDefinition the componentDefinition being deployed - * @param deploymentContext the current deployment context - */ - protected <I extends Implementation<?>> void load(Component parent, - ComponentDefinition<I> componentDefinition, - DeploymentContext deploymentContext) throws LoaderException { - loader.loadComponentType(componentDefinition.getImplementation(), deploymentContext); - } - - - /** - * Build the runtime context for a loaded componentDefinition. - * - * @param parent the context that will be the parent of the new sub-context - * @param componentDefinition the componentDefinition being deployed - * @param deploymentContext the current deployment context - * @return the new runtime context - */ - protected <I extends Implementation<?>> SCAObject build(Component parent, - ComponentDefinition<I> componentDefinition, - DeploymentContext deploymentContext) - throws BuilderException { - return builder.build(componentDefinition, deploymentContext); - } - - /** - * @return the builder - */ - public Builder getBuilder() { - return builder; - } - - /** - * @return the loader - */ - public Loader getLoader() { - return loader; - } - -} diff --git a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java b/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java deleted file mode 100644 index a523dadbf4..0000000000 --- a/sandbox/rfeng/minicore/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java +++ /dev/null @@ -1,74 +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.deployer; - -import java.net.URI; -import java.net.URL; -import javax.xml.stream.XMLInputFactory; - -import org.apache.tuscany.spi.component.ScopeContainer; -import org.apache.tuscany.spi.deployer.DeploymentContext; - -/** - * A holder that can be used during the load process to store information that is not part of the logical assembly - * model. This should be regarded as transient and references to this context should not be stored inside the model. - * - * @version $Rev$ $Date$ - */ -public class RootDeploymentContext extends AbstractDeploymentContext { - private final XMLInputFactory xmlFactory; - private final ScopeContainer scopeContainer; - - /** - * Constructor defining properties of this context. - * - * @param classLoader the classloader for loading application resources - * @param scdlLocation the location of the SCDL defining this composite - * @param componentId the id of the component being deployed - * @param xmlFactory a factory that can be used to obtain an StAX XMLStreamReader - * @param scopeContainer the scope context representing this deployment's COMPOSITE scope - * @param autowire if autowire is enabled - */ - public RootDeploymentContext(ClassLoader classLoader, - URL scdlLocation, - URI componentId, - XMLInputFactory xmlFactory, - ScopeContainer scopeContainer, - boolean autowire) { - super(classLoader, scdlLocation, componentId, autowire); - this.xmlFactory = xmlFactory; - this.scopeContainer = scopeContainer; - } - - public DeploymentContext getParent() { - return null; - } - - public XMLInputFactory getXmlFactory() { - return xmlFactory; - } - - public ScopeContainer getCompositeScope() { - return scopeContainer; - } - - public URI getGroupId() { - return getComponentId(); - } -} |