diff options
Diffstat (limited to '')
9 files changed, 0 insertions, 531 deletions
diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java b/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java deleted file mode 100644 index 68219de701..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java +++ /dev/null @@ -1,34 +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.resource; - -import java.io.InputStream; - -import org.apache.tuscany.sca.data.collection.Collection; - -/** - * The service interface of resource implementations. This is not an API for application - * developers. Application developers should use the data collection API to invoke - * resource components. - * - * @version $Rev: 548609 $ $Date: 2007-06-18 23:31:03 -0700 (Mon, 18 Jun 2007) $ - */ -public interface Resource extends Collection<String, InputStream> { -} diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java b/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java deleted file mode 100644 index be136ee792..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java +++ /dev/null @@ -1,57 +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.resource; - -import java.net.URL; - -import org.apache.tuscany.sca.assembly.Implementation; - - -/** - * The model representing a resource implementation in an SCA assembly model. - * - * @version $Rev$ $Date$ - */ -public interface ResourceImplementation extends Implementation { - - /** - * The URI of the resource inside its contribution. - * @return the URI of the resource - */ - String getLocation(); - - /** - * Sets the URI of the resource inside its contribution. - * @param location the URI of the resource - */ - void setLocation(String location); - - /** - * Returns the URL of the resource. - * @return the URL of the resource - */ - URL getLocationURL(); - - /** - * Sets the URL of the resource. - * @param url the URL of the resource - */ - void setLocationURL(URL url); - -} diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java b/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java deleted file mode 100644 index 95ac452c66..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java +++ /dev/null @@ -1,35 +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.resource; - -/** - * Factory for the resource implementation model. - * - * @version $Rev$ $Date$ - */ -public interface ResourceImplementationFactory { - - /** - * Creates a new resource implementation. - * @return a new resource implementation - */ - ResourceImplementation createResourceImplementation(); - -} diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java b/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java deleted file mode 100644 index d4db8772e4..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java +++ /dev/null @@ -1,47 +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.resource.impl; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.implementation.resource.ResourceImplementation; -import org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; - -/** - * Factory for the resource implementation model. - * - * @version $Rev$ $Date$ - */ -public class ResourceImplementationFactoryImpl implements ResourceImplementationFactory { - - private AssemblyFactory assemblyFactory; - private JavaInterfaceFactory javaFactory; - - public ResourceImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) { - assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); - } - - public ResourceImplementation createResourceImplementation() { - return new ResourceImplementationImpl(assemblyFactory, javaFactory); - } - -} diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java b/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java deleted file mode 100644 index 9cad0890a3..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java +++ /dev/null @@ -1,130 +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.resource.impl; - -import java.net.URL; -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.implementation.resource.Resource; -import org.apache.tuscany.sca.implementation.resource.ResourceImplementation; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; - - -/** - * The model representing a resource implementation in an SCA assembly model. - * - * @version $Rev$ $Date$ - */ -class ResourceImplementationImpl implements ResourceImplementation { - - private Service resourceService; - - private String location; - private URL url; - private boolean unresolved; - - /** - * Constructs a new resource implementation. - */ - ResourceImplementationImpl(AssemblyFactory assemblyFactory, - JavaInterfaceFactory javaFactory) { - - // Resource implementation always provide a single service exposing - // the Resource interface, and have no references and properties - resourceService = assemblyFactory.createService(); - resourceService.setName("Resource"); - - // Create the Java interface contract for the Resource service - JavaInterface javaInterface; - try { - javaInterface = javaFactory.createJavaInterface(Resource.class); - } catch (InvalidInterfaceException e) { - throw new IllegalArgumentException(e); - } - JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract(); - interfaceContract.setInterface(javaInterface); - resourceService.setInterfaceContract(interfaceContract); - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public URL getLocationURL() { - return url; - } - - public void setLocationURL(URL url) { - this.url = url; - } - - public ConstrainingType getConstrainingType() { - // The resource implementation does not support constrainingTypes - return null; - } - - public List<Property> getProperties() { - // The resource implementation does not support properties - return Collections.emptyList(); - } - - public List<Service> getServices() { - // The resource implementation does not support services - return Collections.singletonList(resourceService); - } - - public List<Reference> getReferences() { - // The resource implementation does not support properties - return Collections.emptyList(); - } - - public String getURI() { - return location; - } - - public void setConstrainingType(ConstrainingType constrainingType) { - // The resource implementation does not support constrainingTypes - } - - public void setURI(String uri) { - this.location = uri; - } - - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean unresolved) { - this.unresolved = unresolved; - } -} diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java b/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java deleted file mode 100644 index 6abef37b1a..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java +++ /dev/null @@ -1,167 +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.resource.impl; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; - -import java.io.IOException; -import java.net.URL; - -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.builder.impl.ProblemImpl; -import org.apache.tuscany.sca.assembly.xml.Constants; -import org.apache.tuscany.sca.contribution.Artifact; -import org.apache.tuscany.sca.contribution.ContributionFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -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; -import org.apache.tuscany.sca.implementation.resource.ResourceImplementation; -import org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; - - -/** - * Implements a StAX artifact processor for resource implementations. - * - * @version $Rev$ $Date$ - */ -public class ResourceImplementationProcessor implements StAXArtifactProcessor<ResourceImplementation> { - private static final QName IMPLEMENTATION_RESOURCE = new QName(Constants.SCA10_TUSCANY_NS, "implementation.resource"); - - private ContributionFactory contributionFactory; - private ResourceImplementationFactory implementationFactory; - private Monitor monitor; - - public ResourceImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - contributionFactory = modelFactories.getFactory(ContributionFactory.class); - implementationFactory = modelFactories.getFactory(ResourceImplementationFactory.class); - this.monitor = monitor; - } - - /** - * Report a exception. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Exception ex) { - if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "impl-resource-validation-messages", Severity.ERROR, model, message, ex); - monitor.problem(problem); - } - } - - /** - * Report a error. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Object... messageParameters) { - if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "impl-resource-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters); - monitor.problem(problem); - } - } - - public QName getArtifactType() { - // Returns the QName of the XML element processed by this processor - return IMPLEMENTATION_RESOURCE; - } - - public Class<ResourceImplementation> getModelType() { - // Returns the type of model processed by this processor - return ResourceImplementation.class; - } - - public ResourceImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - - // Read an <implementation.resource> element - - // Create and initialize the resource implementation model - ResourceImplementation implementation = null; - - // Read the location attribute specifying the location of the resources - String location = reader.getAttributeValue(null, "location"); - if (location != null) { - implementation = implementationFactory.createResourceImplementation(); - implementation.setLocation(location); - implementation.setUnresolved(true); - } else { - error("LocationAttributeMissing", reader); - //throw new ContributionReadException(MSG_LOCATION_MISSING); - } - - // Skip to end element - while (reader.hasNext()) { - if (reader.next() == END_ELEMENT && IMPLEMENTATION_RESOURCE.equals(reader.getName())) { - break; - } - } - - return implementation; - } - - public void resolve(ResourceImplementation implementation, ModelResolver resolver) throws ContributionResolveException { - - if (implementation == null) - return; - - // Resolve the resource directory location - Artifact artifact = contributionFactory.createArtifact(); - artifact.setURI(implementation.getLocation()); - Artifact resolved = resolver.resolveModel(Artifact.class, artifact); - if (resolved.getLocation() != null) { - try { - implementation.setLocationURL(new URL(resolved.getLocation())); - implementation.setUnresolved(false); - } catch (IOException e) { - ContributionResolveException ce = new ContributionResolveException(e); - error("ContributionResolveException", resolver, ce); - //throw ce; - } - } else { - error("CouldNotResolveLocation", resolver, implementation.getLocation()); - //throw new ContributionResolveException("Could not resolve implementation.resource location: " + implementation.getLocation()); - } - } - - public void write(ResourceImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - // Write <implementation.resource> - writer.writeStartElement(IMPLEMENTATION_RESOURCE.getNamespaceURI(), IMPLEMENTATION_RESOURCE.getLocalPart()); - - if (implementation.getLocation() != null) { - writer.writeAttribute("location", implementation.getLocation()); - } - - writer.writeEndElement(); - } -} diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index b5774c5c5b..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,19 +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. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.implementation.resource.impl.ResourceImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.resource,model=org.apache.tuscany.sca.implementation.resource.ResourceImplementation,factory=org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory b/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory deleted file mode 100644 index f77f723c3e..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory +++ /dev/null @@ -1,19 +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. - -# Implementation class for model factory -org.apache.tuscany.sca.implementation.resource.impl.ResourceImplementationFactoryImpl diff --git a/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties b/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties deleted file mode 100644 index 7f619ef036..0000000000 --- a/branches/sca-java-1.5/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties +++ /dev/null @@ -1,23 +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. -# -# -ContributionResolveException = ContributionResolveException occured due to: -LocationAttributeMissing = Reading implementation.resource - location attribute missing -CouldNotResolveLocation = Could not resolve implementation.resource location: {0} |