You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/04/14 00:33:31 UTC
svn commit: r528689 [2/3] - in /incubator/tuscany/java/sca:
itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/
modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/
modules/assembly-xml/src/test/java/org/apache/tus...
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/AbstractContributionException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/AbstractContributionException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/AbstractContributionException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/AbstractContributionException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,124 @@
+/*
+ * 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.contribution.service;
+
+import java.io.PrintWriter;
+
+/**
+ * The root checked exception for the Contribution Service.
+ *
+ * @version $Rev: 508877 $ $Date: 2007-02-17 22:22:48 -0800 (Sat, 17 Feb 2007) $
+ */
+public abstract class AbstractContributionException extends Exception {
+ private static final long serialVersionUID = -7847121698339635268L;
+ private final String identifier;
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @see Exception
+ */
+ public AbstractContributionException() {
+ super();
+ this.identifier = null;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param message passed to Exception
+ * @see Exception
+ */
+ public AbstractContributionException(String message) {
+ super(message);
+ this.identifier = null;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param message passed to Exception
+ * @param identifier additional error information referred to in the error message
+ * @see Exception
+ */
+ public AbstractContributionException(String message, String identifier) {
+ super(message);
+ this.identifier = identifier;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param message passed to Exception
+ * @param cause passed to Exception
+ * @see Exception
+ */
+ public AbstractContributionException(String message, Throwable cause) {
+ super(message, cause);
+ this.identifier = null;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param message passed to Exception
+ * @param identifier additional error information referred to in the error message
+ * @param cause passed to Exception
+ * @see Exception
+ */
+ public AbstractContributionException(String message, String identifier, Throwable cause) {
+ super(message, cause);
+ this.identifier = identifier;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param cause passed to Exception
+ * @see Exception
+ */
+ public AbstractContributionException(Throwable cause) {
+ super(cause);
+ this.identifier = null;
+ }
+
+ /**
+ * Returns a string representing additional error information referred to in the error message.
+ *
+ * @return additional error information
+ */
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public PrintWriter appendBaseMessage(PrintWriter writer) {
+ if (identifier == null) {
+ if (super.getMessage() == null) {
+ return writer;
+ }
+ return writer.append(super.getMessage());
+ }
+ if (super.getMessage() != null) {
+ writer.append(super.getMessage());
+ }
+ writer.append(" [").append(identifier).append(']');
+ return writer;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/AbstractContributionException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.contribution.service;
+
+
+/**
+ * Base class for exceptions raised by contribution services.
+ *
+ * @version $Rev: 519710 $ $Date: 2007-03-18 15:19:16 -0700 (Sun, 18 Mar 2007) $
+ */
+public class ContributionException extends AbstractContributionException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4432880414927652578L;
+
+ protected ContributionException() {
+ super();
+ }
+
+ protected ContributionException(String message) {
+ super(message);
+ }
+
+ protected ContributionException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected ContributionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected ContributionException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public ContributionException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionReadException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionReadException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionReadException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionReadException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,95 @@
+/*
+ * 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.contribution.service;
+
+
+/**
+ * Denotes an exception while reading artifacts inside an SCA contribution.
+ *
+ * @version $Rev: 526268 $ $Date: 2007-04-06 13:13:26 -0700 (Fri, 06 Apr 2007) $
+ */
+public class ContributionReadException extends ContributionException {
+ public static final int UNDEFINED = -1;
+ private static final long serialVersionUID = -7459051598906813461L;
+ private String resourceURI;
+ private int line = UNDEFINED;
+ private int column = UNDEFINED;
+
+ public ContributionReadException(String message) {
+ super(message);
+ }
+
+ public ContributionReadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionReadException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the location of the resource that was being read.
+ *
+ * @return the location of the resource that was being read
+ */
+ public String getResourceURI() {
+ return resourceURI;
+ }
+
+ /**
+ * Sets the location of the resource that was being read.
+ *
+ * @param resourceURI the location of the resource that was being read
+ */
+ public void setResourceURI(String resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+ /**
+ * Returns the line inside the resource that was being read.
+ * @return the line inside the resource that was being read
+ */
+ public int getLine() {
+ return line;
+ }
+
+ /**
+ * Sets the line inside the resource that was being read.
+ * @param line the line inside the resource that was being read
+ */
+ public void setLine(int line) {
+ this.line = line;
+ }
+
+ /**
+ * Returns the column inside the resource that was being read.
+ * @return the column inside the resource that was being read
+ */
+ public int getColumn() {
+ return column;
+ }
+
+ /**
+ * Sets the column inside the resource that was being read.
+ * @param column the column inside the resource that was being read
+ */
+ public void setColumn(int column) {
+ this.column = column;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionReadException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRepository.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRepository.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRepository.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRepository.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,77 @@
+/*
+ * 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.contribution.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+public interface ContributionRepository {
+ /**
+ * Get the URI of the SCA domain
+ *
+ * @return
+ */
+ URI getDomain();
+
+ /**
+ * Copies a contribution to the repository.
+ *
+ * @param contribution A URl pointing to the contribution being copied to
+ * the repository
+ * @param contributionStream InputStream with the content of the
+ * distribution
+ */
+ URL store(URI contribution, InputStream contributionStream) throws IOException;
+ /**
+ * Copy a contribution from the source URL to the repository
+ * @param contribution
+ * @param sourceURL
+ * @return
+ * @throws IOException
+ */
+ URL store(URI contribution, URL sourceURL) throws IOException;
+
+ /**
+ * Look up the contribution by URI
+ *
+ * @param contribution The URI of the contribution
+ * @return A URL pointing to the content of the contribution in the
+ * repository, it will be null if the contribution cannot be found
+ * in the repository
+ */
+ URL find(URI contribution);
+
+ /**
+ * Remove a contribution from the repository
+ *
+ * @param contribution The URI of the contribution to be removed
+ */
+ void remove(URI contribution);
+
+ /**
+ * Get list of URIs for all the contributions in the repository
+ *
+ * @return A list of contribution URIs
+ */
+ List<URI> list();
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRepository.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionResolveException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionResolveException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionResolveException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionResolveException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.contribution.service;
+
+
+/**
+ * Denotes a problem while resolving models inside an SCA contribution.
+ *
+ * @version $Rev: 526268 $ $Date: 2007-04-06 13:13:26 -0700 (Fri, 06 Apr 2007) $
+ */
+public class ContributionResolveException extends ContributionException {
+ private static final long serialVersionUID = -7459051598906813461L;
+
+ public ContributionResolveException(String message) {
+ super(message);
+ }
+
+ public ContributionResolveException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionResolveException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionResolveException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRuntimeException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRuntimeException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRuntimeException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRuntimeException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.contribution.service;
+
+
+/**
+ * Base class for runtime exceptions raised by contribution services.
+ *
+ * @version $Rev: 526837 $ $Date: 2007-04-09 10:10:18 -0700 (Mon, 09 Apr 2007) $
+ */
+public class ContributionRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = 7711215366287498896L;
+
+ protected ContributionRuntimeException() {
+ super();
+ }
+
+ protected ContributionRuntimeException(String message) {
+ super(message);
+ }
+
+ protected ContributionRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionRuntimeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionService.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionService.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionService.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,104 @@
+/*
+ * 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.contribution.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.tuscany.contribution.Contribution;
+
+
+/**
+ * Service interface that manages artifacts contributed to a Tuscany runtime.
+ *
+ * @version $Rev: 527398 $ $Date: 2007-04-10 23:43:31 -0700 (Tue, 10 Apr 2007) $
+ */
+public interface ContributionService {
+ /**
+ * Contribute an artifact to the SCA Domain. The type of the contribution is
+ * determined by the Content-Type of the resource or, if that is undefined,
+ * by some implementation-specific means (such as mapping an extension in
+ * the URL's path).
+ *
+ * @param contributionURI The URI that is used as the contribution unique ID.
+ * @param sourceURL the location of the resource containing the artifact
+ * @param storeInRepository flag that identifies if you want to copy the
+ * contribution to the repository
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the resource
+ */
+ void contribute(URI contributionURI, URL sourceURL, boolean storeInRepository) throws ContributionException,
+ IOException;
+
+ /**
+ * Contribute an artifact to the SCA Domain.
+ *
+ * @param contributionURI The URI that is used as the contribution unique ID.
+ * @param contributionContent a stream containing the resource being
+ * contributed; the stream will not be closed but the read
+ * position after the call is undefined
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the stream
+ */
+ void contribute(URI contributionURI, InputStream contributionContent)
+ throws ContributionException, IOException;
+
+ /**
+ * Get the model for an installed contribution
+ *
+ * @param contribution The URI of an installed contribution
+ * @return The model for the contribution or null if there is no such
+ * contribution
+ */
+ Contribution getContribution(URI contribution);
+
+ /**
+ * Adds or updates a deployment composite using a supplied composite
+ * ("composite by value" � a data structure, not an existing resource in the
+ * domain) to the contribution identified by a supplied contribution URI.
+ * The added or updated deployment composite is given a relative URI that
+ * matches the "name" attribute of the composite, with a ".composite"
+ * suffix.
+ */
+ void addDeploymentComposite(URI contribution, Object composite);
+
+ /**
+ * Remove a contribution from the SCA domain
+ *
+ * @param contribution The URI of the contribution
+ * @throws DeploymentException
+ */
+ void remove(URI contribution) throws ContributionException;
+
+ /**
+ * Resolve an artifact by QName within the contribution
+ *
+ * @param <T> The java type of the artifact such as javax.wsdl.Definition
+ * @param contribution The URI of the contribution
+ * @param definitionType The java type of the artifact
+ * @param namespace The namespace of the artifact
+ * @param name The name of the artifact
+ * @return The resolved artifact
+ */
+ <M> M resolve(Class modelClass, Class<M> elementClass, Object modelKey, Object elementKey, Map<String, Object> attributes);
+
+}
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWireException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWireException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWireException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWireException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.contribution.service;
+
+
+/**
+ * Denotes a problem while wiring models inside an SCA contribution.
+ *
+ * @version $Rev: 526268 $ $Date: 2007-04-06 13:13:26 -0700 (Fri, 06 Apr 2007) $
+ */
+public class ContributionWireException extends ContributionException {
+ private static final long serialVersionUID = -7459051598906813461L;
+
+ public ContributionWireException(String message) {
+ super(message);
+ }
+
+ public ContributionWireException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionWireException(Throwable cause) {
+ super(cause);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWireException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWriteException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWriteException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWriteException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWriteException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.contribution.service;
+
+
+/**
+ * Denotes an exception while writing artifacts inside an SCA contribution.
+ *
+ * @version $Rev: 526268 $ $Date: 2007-04-06 13:13:26 -0700 (Fri, 06 Apr 2007) $
+ */
+public class ContributionWriteException extends ContributionException {
+ private static final long serialVersionUID = -7459051598906813461L;
+ private String resourceURI;
+
+ public ContributionWriteException(String message) {
+ super(message);
+ }
+
+ public ContributionWriteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionWriteException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the location of the resource that was being written.
+ *
+ * @return the location of the resource that was being written
+ */
+ public String getResourceURI() {
+ return resourceURI;
+ }
+
+ /**
+ * Sets the location of the resource that was being written.
+ *
+ * @param resourceURI the location of the resource that was being written
+ */
+ public void setResourceURI(String resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/ContributionWriteException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/InvalidConfigurationException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/InvalidConfigurationException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/InvalidConfigurationException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/InvalidConfigurationException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.contribution.service;
+
+/**
+ * Denotes an invalid configuration artifact
+ *
+ * @version $Rev: 525638 $ $Date: 2007-04-04 16:36:03 -0700 (Wed, 04 Apr 2007) $
+ */
+public class InvalidConfigurationException extends ContributionReadException {
+ private static final long serialVersionUID = -4312958640212000366L;
+
+ public InvalidConfigurationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/InvalidConfigurationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/TypeDescriber.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/TypeDescriber.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/TypeDescriber.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/TypeDescriber.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.contribution.service;
+
+import java.net.URL;
+
+/**
+ * Provide content type for a given resource
+ *
+ * @version $Rev: 526079 $ $Date: 2007-04-06 00:17:44 -0700 (Fri, 06 Apr 2007) $
+ */
+public interface TypeDescriber {
+ /**
+ * @param resourceURL the resource url
+ * @param defaultType the default content type
+ * @return the content type
+ */
+ String getType(URL resourceURL, String defaultType);
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/TypeDescriber.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnrecognizedElementException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnrecognizedElementException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnrecognizedElementException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnrecognizedElementException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.contribution.service;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Exception that indicates an element was encountered that could not be handled.
+ *
+ * @version $Rev: 525638 $ $Date: 2007-04-04 16:36:03 -0700 (Wed, 04 Apr 2007) $
+ */
+public class UnrecognizedElementException extends ContributionReadException {
+ private static final long serialVersionUID = 2549543622209829032L;
+ private final QName element;
+
+ /**
+ * Constructor that indicates which element could not be handled.
+ * @param element the element that could not be handled
+ */
+ public UnrecognizedElementException(QName element) {
+ super("Unrecognized element: " + element.toString());
+ this.element = element;
+ }
+
+ /**
+ * Returns the element that could not be handled.
+ * @return the element that could not be handled.
+ */
+ public QName getElement() {
+ return element;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnrecognizedElementException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnsupportedContentTypeException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnsupportedContentTypeException.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnsupportedContentTypeException.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnsupportedContentTypeException.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.contribution.service;
+
+/**
+ * Exception thrown to indicate that a Content-Type is not supported by this SCA Domain.
+ * The Content-Type value supplied will be returned as the message text for this exception.
+ *
+ * @version $Rev: 522653 $ $Date: 2007-03-26 15:30:21 -0700 (Mon, 26 Mar 2007) $
+ */
+public class UnsupportedContentTypeException extends ContributionException {
+ private static final long serialVersionUID = -1831797280021355672L;
+
+ /**
+ * Constructor specifying the Content-Type value that is not supported.
+ *
+ * @param contentType the type that is not supported
+ */
+ public UnsupportedContentTypeException(String contentType) {
+ super(contentType);
+ }
+
+ /**
+ * Constructor specifying the Content-Type value that is not supported
+ * and an identifier to use with this exception (typically the resource being processed).
+ *
+ * @param contentType the type that is not supported
+ * @param identifier an identifier for this exception
+ */
+ public UnsupportedContentTypeException(String contentType, String identifier) {
+ super(contentType, identifier);
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/UnsupportedContentTypeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessor.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessor.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.contribution.service.processor;
+
+import org.apache.tuscany.contribution.service.ContributionResolveException;
+import org.apache.tuscany.contribution.service.ContributionWireException;
+import org.apache.tuscany.contribution.service.resolver.ArtifactResolver;
+
+
+
+/**
+ * Interface for extensions that can process contributions.
+ *
+ * @version $Rev: 522653 $ $Date: 2007-03-26 15:30:21 -0700 (Mon, 26 Mar 2007) $
+ */
+public interface ArtifactProcessor <M> {
+
+ /**
+ * Resolve references from this model to other models. For example references
+ * from a composite to another one, or references from a composite to a WSDL
+ * model.
+ * @param model the model to resolve
+ * @param the resolver to use to resolve referenced models
+ */
+ void resolve(M model, ArtifactResolver resolver) throws ContributionResolveException;
+
+ /**
+ * Wire and optimize a model for consumption by an SCA runtime. In addition to wiring references
+ * to services, this can include applying policies at different levels, or determining the configuration
+ * of services, references and properties in nested compositions for example.
+ * @param model the model to optimize
+ */
+ void wire(M model) throws ContributionWireException;
+
+ /**
+ * Returns the type of model handled by this artifact processor.
+ * @return the type of model handled by this artifact processor
+ */
+ Class<M> getModelType();
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessorRegistry.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessorRegistry.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.contribution.service.processor;
+
+
+
+/**
+ * A registry for artifact processors.
+ *
+ * @version $Rev: 527804 $ $Date: 2007-04-12 00:17:42 -0700 (Thu, 12 Apr 2007) $
+ */
+public interface ArtifactProcessorRegistry<P> {
+
+ /**
+ * Add an artifact processor.
+ * @param artifactProcessor the artifact processor to add
+ */
+ void addArtifactProcessor(P artifactProcessor);
+
+ /**
+ * Remove an artifact processor.
+ * @param artifactProcessor the artifact processor to remove
+ */
+
+ void removeArtifactProcessor(P artifactProcessor);
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ArtifactProcessorRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessor.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessor.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.contribution.service.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.contribution.service.ContributionException;
+
+/**
+ * Interface for services that can process contributions.
+ *
+ * @version $Rev: 522653 $ $Date: 2007-03-26 15:30:21 -0700 (Mon, 26 Mar 2007) $
+ */
+public interface ContributionPackageProcessor {
+ // /**
+ // * Returns the type of package handled by this package processor.
+ // * @return the type of package handled by this package processor
+ // */
+ // String getPackageType();
+
+ /**
+ * Retrieve a list of artifacts for the specific package type
+ *
+ * @param packageSourceURL location of the artifact
+ * @param inputStream optional content of the package
+ * @return
+ * @throws ContributionException
+ * @throws IOException
+ */
+ List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException, IOException;
+
+ /**
+ * Return the URL for an artifact in the package
+ *
+ * @param packageSourceURL The package URL
+ * @param artifact The relative URI for the artifact
+ * @return
+ */
+ URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException;
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessorRegistry.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessorRegistry.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.contribution.service.processor;
+
+/**
+ * @version $Rev: 526079 $ $Date: 2007-04-06 00:17:44 -0700 (Fri, 06 Apr 2007) $
+ */
+public interface ContributionPackageProcessorRegistry extends ContributionPackageProcessor {
+ /**
+ * Register a ContributionPackageProcessor using the package type as the key
+ * @param processor
+ */
+ void register(String packageType, ContributionPackageProcessor processor);
+
+ /**
+ * Unregister a ContributionProcessor by package type
+ * @param packageType
+ */
+ void unregister(String packageType);
+}
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPackageProcessorRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessor.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessor.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,31 @@
+/*
+ * 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.contribution.service.processor;
+
+import org.apache.tuscany.contribution.Contribution;
+
+/**
+ * A processor invoked after the contribution is loaded
+ *
+ * @version $Rev: 528640 $ $Date: 2007-04-13 13:12:12 -0700 (Fri, 13 Apr 2007) $
+ */
+public interface ContributionPostProcessor {
+ void visit(Contribution contribution);
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessorRegistry.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessorRegistry.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,38 @@
+/*
+ * 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.contribution.service.processor;
+
+/**
+ * The registry to host all the contribution post processors
+ *
+ * @version $Rev: 528640 $ $Date: 2007-04-13 13:12:12 -0700 (Fri, 13 Apr 2007) $
+ */
+public interface ContributionPostProcessorRegistry {
+ /**
+ * Add a ContributionPostProcessor
+ * @param processor
+ */
+ void register(ContributionPostProcessor processor);
+ /**
+ * Remove a ContributionPostProcessor
+ * @param processor
+ */
+ void unregister(ContributionPostProcessor processor);
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/ContributionPostProcessorRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultArtifactProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultArtifactProcessorRegistry.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultArtifactProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultArtifactProcessorRegistry.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.contribution.service.processor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * The default implementation of an artifact processor registry.
+ *
+ * @version $Rev: 527510 $ $Date: 2007-04-11 07:50:25 -0700 (Wed, 11 Apr 2007) $
+ */
+abstract class DefaultArtifactProcessorRegistry {
+ protected final Map<Object, ArtifactProcessor> processorsByArtifactType = new HashMap<Object, ArtifactProcessor>();
+ protected final Map<Class<?>, ArtifactProcessor> processorsByModelType = new HashMap<Class<?>, ArtifactProcessor>();
+
+ /**
+ * Constructs a new loader registry.
+ */
+ public DefaultArtifactProcessorRegistry() {
+ }
+
+ /**
+ * Returns the processor associated with the given artifact type.
+ * @param artifactType an artifact type
+ * @return the processor associated with the given artifact type
+ */
+ protected ArtifactProcessor getProcessor(Object artifactType) {
+ return processorsByArtifactType.get(artifactType);
+ }
+
+ /**
+ * Returns the processor associated with the given model type.
+ * @param modelType a model type
+ * @return the processor associated with the given model type
+ */
+ protected ArtifactProcessor getProcessor(Class<?> modelType) {
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c: classes) {
+ ArtifactProcessor processor = processorsByModelType.get(c);
+ if (processor != null)
+ return processor;
+ }
+ return processorsByModelType.get(modelType);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultArtifactProcessorRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultStAXArtifactProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultStAXArtifactProcessorRegistry.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultStAXArtifactProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultStAXArtifactProcessorRegistry.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,194 @@
+/*
+ * 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.contribution.service.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.contribution.service.ContributionReadException;
+import org.apache.tuscany.contribution.service.ContributionResolveException;
+import org.apache.tuscany.contribution.service.ContributionWireException;
+import org.apache.tuscany.contribution.service.ContributionWriteException;
+import org.apache.tuscany.contribution.service.UnrecognizedElementException;
+import org.apache.tuscany.contribution.service.resolver.ArtifactResolver;
+
+/**
+ * The default implementation of a StAX artifact processor registry.
+ *
+ * @version $Rev: 527804 $ $Date: 2007-04-12 00:17:42 -0700 (Thu, 12 Apr 2007) $
+ */
+public class DefaultStAXArtifactProcessorRegistry
+ extends DefaultArtifactProcessorRegistry
+ implements StAXArtifactProcessorRegistry, StAXArtifactProcessor<Object> {
+
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+
+ /**
+ * Constructs a new loader registry.
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param inputFactory
+ */
+ public DefaultStAXArtifactProcessorRegistry(XMLInputFactory inputFactory, XMLOutputFactory outputFactory) {
+ super();
+ this.inputFactory = inputFactory;
+ this.outputFactory = outputFactory;
+ this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces",Boolean.TRUE);
+ }
+
+ public DefaultStAXArtifactProcessorRegistry() {
+ this(XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ }
+
+ public Object read(XMLStreamReader source) throws ContributionReadException {
+
+ // Delegate to the processor associated with the element qname
+ QName name = source.getName();
+ StAXArtifactProcessor<?> processor = (StAXArtifactProcessor<?>)this.getProcessor(name);
+ if (processor == null) {
+ return null;
+ }
+ return processor.read(source);
+ }
+
+ public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXArtifactProcessor<Object> processor = (StAXArtifactProcessor<Object>)this.getProcessor((Class<Object>)model.getClass());
+ if (processor != null) {
+ processor.write(model, outputSource);
+ }
+ }
+ }
+
+ public void resolve(Object model, ArtifactResolver resolver) throws ContributionResolveException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXArtifactProcessor<Object> processor = (StAXArtifactProcessor<Object>)this.getProcessor((Class<Object>)model.getClass());
+ if (processor != null) {
+ processor.resolve(model, resolver);
+ }
+ }
+ }
+
+ public void wire(Object model) throws ContributionWireException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXArtifactProcessor<Object> processor = (StAXArtifactProcessor<Object>)this.getProcessor((Class<Object>)model.getClass());
+ if (processor != null) {
+ processor.wire(model);
+ }
+ }
+ }
+
+ /**
+ * Read a model from an input stream.
+ * @param is
+ * @param type
+ * @return
+ * @throws ContributionReadException
+ */
+ public <MO> MO read(InputStream is, Class<MO> type) throws ContributionReadException {
+ try {
+ XMLStreamReader reader;
+ try {
+ reader = inputFactory.createXMLStreamReader(is);
+ try {
+ reader.nextTag();
+ QName name = reader.getName();
+ Object mo = read(reader);
+ if (type.isInstance(mo)) {
+ return type.cast(mo);
+ } else {
+ UnrecognizedElementException e = new UnrecognizedElementException(name);
+ throw e;
+ }
+ } catch (ContributionReadException e) {
+ Location location = reader.getLocation();
+ e.setLine(location.getLineNumber());
+ e.setColumn(location.getColumnNumber());
+ throw e;
+ } finally {
+ try {
+ reader.close();
+ } catch (XMLStreamException e) {
+ // ignore
+ }
+ }
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ } catch (XMLStreamException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ throw ce;
+ }
+ }
+
+ /**
+ * Write a model to an ouput stream.
+ * @param model
+ * @param os
+ * @throws ContributionWriteException
+ */
+ public void write(Object model, OutputStream os) throws ContributionWriteException {
+ try {
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(os);
+ write(model, writer);
+ writer.flush();
+ writer.close();
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public void addArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+
+ public void removeArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+
+ public QName getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultStAXArtifactProcessorRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultURLArtifactProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultURLArtifactProcessorRegistry.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultURLArtifactProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultURLArtifactProcessorRegistry.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,129 @@
+/*
+ * 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.contribution.service.processor;
+
+import java.net.URL;
+
+import org.apache.tuscany.contribution.service.ContributionReadException;
+import org.apache.tuscany.contribution.service.ContributionResolveException;
+import org.apache.tuscany.contribution.service.ContributionWireException;
+import org.apache.tuscany.contribution.service.ContributionWriteException;
+import org.apache.tuscany.contribution.service.UnrecognizedElementException;
+import org.apache.tuscany.contribution.service.resolver.ArtifactResolver;
+
+/**
+ * The default implementation of a StAX artifact processor registry.
+ *
+ * @version $Rev: 527804 $ $Date: 2007-04-12 00:17:42 -0700 (Thu, 12 Apr 2007) $
+ */
+public class DefaultURLArtifactProcessorRegistry
+ extends DefaultArtifactProcessorRegistry
+ implements URLArtifactProcessorRegistry, URLArtifactProcessor<Object> {
+
+ /**
+ * Constructs a new loader registry.
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param factory
+ */
+ public DefaultURLArtifactProcessorRegistry() {
+ }
+
+ public Object read(URL source) throws ContributionReadException {
+ URLArtifactProcessor<Object> processor = null;
+
+ // Delegate to the processor associated with file extension
+ String extension = source.getFile();
+ int extensionStart = extension.lastIndexOf('.');
+ //handle files without extension (e.g NOTICE)
+ if(extensionStart > 0){
+ extension = extension.substring(extensionStart);
+ processor = (URLArtifactProcessor<Object>)this.getProcessor(extension);
+ }
+ if (processor == null) {
+ return null;
+ }
+ return processor.read(source);
+ }
+
+ public void write(Object model, URL outputSource) throws ContributionWriteException {
+
+ // Delegate to the processor associated with the particular model type
+ if (model != null) {
+ URLArtifactProcessor<Object> processor = (URLArtifactProcessor<Object>)this.getProcessor((Class<Object>)model.getClass());
+ if (processor != null) {
+ processor.write(model, outputSource);
+ }
+ }
+ }
+
+
+
+ public void resolve(Object model, ArtifactResolver resolver) throws ContributionResolveException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ URLArtifactProcessor<Object> processor = (URLArtifactProcessor<Object>)this.getProcessor((Class<Object>)model.getClass());
+ if (processor != null) {
+ processor.resolve(model, resolver);
+ }
+ }
+ }
+
+ public void wire(Object model) throws ContributionWireException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ URLArtifactProcessor<Object> processor = (URLArtifactProcessor<Object>)this.getProcessor((Class<Object>)model.getClass());
+ if (processor != null) {
+ processor.wire(model);
+ }
+ }
+ }
+
+ public <MO> MO read(URL url, Class<MO> type) throws ContributionReadException {
+ Object mo = read(url);
+ if (type.isInstance(mo)) {
+ return type.cast(mo);
+ } else {
+ UnrecognizedElementException e = new UnrecognizedElementException(null);
+ e.setResourceURI(url.toString());
+ throw e;
+ }
+ }
+
+ public void addArtifactProcessor(URLArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+
+ public void removeArtifactProcessor(URLArtifactProcessor<Object> artifactProcessor) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+
+ public String getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/DefaultURLArtifactProcessorRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessor.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessor.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,58 @@
+/*
+ * 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.contribution.service.processor;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.contribution.service.ContributionReadException;
+import org.apache.tuscany.contribution.service.ContributionWriteException;
+
+/**
+ * An artifact processor that can read models from a StAX XMLStreamReader.
+ *
+ * @version $Rev: 522653 $ $Date: 2007-03-26 15:30:21 -0700 (Mon, 26 Mar 2007) $
+ */
+public interface StAXArtifactProcessor<M> extends ArtifactProcessor<M> {
+
+ /**
+ * Reads a model from an input source. Examples of input sources are: a URI, a
+ * DOM node, an XML reader.
+ * @param source
+ * @return a model representation of the input.
+ */
+ M read(XMLStreamReader inputSource) throws ContributionReadException;
+
+ /**
+ * Writes a model to an ouput source. Examples of output sources are: a URI, a
+ * DOM node, an XML writer.
+ * @param source
+ * @return a model representation of the source.
+ */
+ void write(M model, XMLStreamWriter outputSource) throws ContributionWriteException;
+
+ /**
+ * Returns the type of artifact handled by this artifact processor.
+ * @return the type of artifact handled by this artifact processor
+ */
+ QName getArtifactType();
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessorRegistry.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessorRegistry.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.contribution.service.processor;
+
+
+
+/**
+ * A registry for DOM artifact processors.
+ *
+ * @version $Rev: 526321 $ $Date: 2007-04-06 16:42:35 -0700 (Fri, 06 Apr 2007) $
+ */
+public interface StAXArtifactProcessorRegistry extends ArtifactProcessorRegistry<StAXArtifactProcessor> {
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/StAXArtifactProcessorRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessor.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessor.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.contribution.service.processor;
+
+import java.net.URL;
+
+import org.apache.tuscany.contribution.service.ContributionReadException;
+import org.apache.tuscany.contribution.service.ContributionWriteException;
+
+/**
+ * An artifact processor that can read models from an InputStream.
+ *
+ * @version $Rev: 522653 $ $Date: 2007-03-26 15:30:21 -0700 (Mon, 26 Mar 2007) $
+ */
+public interface URLArtifactProcessor<M> extends ArtifactProcessor<M> {
+
+ /**
+ * Reads a model from an input source. Examples of input sources are: a URI, a
+ * DOM node, an XML reader.
+ * @param source
+ * @return a model representation of the input.
+ */
+ M read(URL inputSource) throws ContributionReadException;
+
+ /**
+ * Writes a model to an ouput source. Examples of output sources are: a URI, a
+ * DOM node, an XML writer.
+ * @param source
+ * @return a model representation of the source.
+ */
+ void write(M model, URL outputSource) throws ContributionWriteException;
+
+ /**
+ * Returns the type of artifact handled by this artifact processor.
+ * @return the type of artifact handled by this artifact processor
+ */
+ String getArtifactType();
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessorRegistry.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessorRegistry.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,31 @@
+/*
+ * 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.contribution.service.processor;
+
+
+
+/**
+ * A registry for Stream artifact processors.
+ *
+ * @version $Rev: 525638 $ $Date: 2007-04-04 16:36:03 -0700 (Wed, 04 Apr 2007) $
+ */
+public interface URLArtifactProcessorRegistry extends
+ ArtifactProcessorRegistry<URLArtifactProcessor<Object>> {
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/processor/URLArtifactProcessorRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/resolver/ArtifactResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/resolver/ArtifactResolver.java?view=auto&rev=528689
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/resolver/ArtifactResolver.java (added)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/contribution/service/resolver/ArtifactResolver.java Fri Apr 13 15:33:21 2007
@@ -0,0 +1,65 @@
+/*
+ * 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.contribution.service.resolver;
+
+
+
+/**
+ * SCA Assemblies reference many artifacts of a wide variety of types. These
+ * include:
+ * <ul>
+ * <li> Reference from one SCA composite to another SCA composite
+ * <li> Reference to PolicySet files
+ * <li> Reference to interface definition files, either WSDL or Java interfaces
+ * <li> Reference to XSD files
+ * <li> Reference to any of a wide variety of implementation artifact files,
+ * including Java classes, BPEL scripts, C++ DLLs and classes, PHP scripts
+ * </ul>
+ * In the SCA assemblies, these various artifacts are referenced using either
+ * QNames or URIs that do not point to a specific entity. Resolution of these
+ * references to concrete artifacts is necessary as part of the operation of the
+ * SCA domain.
+ *
+ * @version $Rev: 526837 $ $Date: 2007-04-09 10:10:18 -0700 (Mon, 09 Apr 2007) $
+ */
+public interface ArtifactResolver {
+
+ /**
+ * Resolve an artifact.
+ * @param modelClass the type of artifact
+ * @param unresolved the unresolved artifact
+ * @return the resolved artifact
+ */
+ <T> T resolve(Class<T> modelClass, T unresolved);
+
+ /**
+ * Add a resolved artifact.
+ * @param resolved
+ */
+ void add(Object resolved);
+
+ /**
+ * Remove a resolved artifact.
+ * @param resolved
+ * @return the removed artifact, or null if the artifact was not removed
+ */
+ Object remove(Object resolved);
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org