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/07/28 03:26:57 UTC
svn commit: r560435 [1/2] - in
/incubator/tuscany/java/sca/modules/contribution-impl: ./
src/main/java/org/apache/tuscany/sca/contribution/impl/
src/main/java/org/apache/tuscany/sca/contribution/processor/impl/
src/main/java/org/apache/tuscany/sca/cont...
Author: lresende
Date: Fri Jul 27 18:26:55 2007
New Revision: 560435
URL: http://svn.apache.org/viewvc?view=rev&rev=560435
Log:
svn prop updates
Modified:
incubator/tuscany/java/sca/modules/contribution-impl/pom.xml (props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java (props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionException.java (props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionURIException.java (props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java (props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataDocumentProcessorImpl.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataProcessor.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/ConcurrentHashList.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java (props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java (props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleArtifactResolverTestCase.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java (contents, props changed)
incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java (props changed)
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java Fri Jul 27 18:26:55 2007
@@ -1,71 +1,71 @@
-/*
- * 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.contribution.impl;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-
-
-/**
- * Base Artifact interface to accomodate common properties between Contribution and Deployed Artifact
- *
- * @version $Rev$ $Date$
- */
-public abstract class ArtifactImpl implements Artifact {
- private String uri;
- private String location;
-
- protected ArtifactImpl() {
- }
-
- public String getLocation() {
- return this.location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getURI() {
- return this.uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- @Override
- public int hashCode() {
- return uri.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else {
- if (obj instanceof Artifact) {
- return uri.equals(((Artifact)obj).getURI());
- } else {
- return false;
- }
- }
- }
-
-}
+/*
+ * 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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+
+
+/**
+ * Base Artifact interface to accomodate common properties between Contribution and Deployed Artifact
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ArtifactImpl implements Artifact {
+ private String uri;
+ private String location;
+
+ protected ArtifactImpl() {
+ }
+
+ public String getLocation() {
+ return this.location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getURI() {
+ return this.uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ @Override
+ public int hashCode() {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof Artifact) {
+ return uri.equals(((Artifact)obj).getURI());
+ } else {
+ return false;
+ }
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java Fri Jul 27 18:26:55 2007
@@ -1,74 +1,74 @@
-/*
- * 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.contribution.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.DeployedArtifact;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of a deployed contribution
- *
- * @version $Rev: 531146 $ $Date: 2007-04-21 22:40:50 -0700 (Sat, 21 Apr 2007) $
- */
-public class ContributionImpl extends ArtifactImpl implements Contribution {
- private List<Export> exports = new ArrayList<Export>();
- private List<Import> imports = new ArrayList<Import>();
- private List<Composite> deployables = new ArrayList<Composite>();
- private ModelResolver modelResolver;
-
- /**
- * A list of artifacts in the contribution
- */
- private List<DeployedArtifact> artifacts = new ArrayList<DeployedArtifact>();
-
- protected ContributionImpl() {
- }
-
- public List<Export> getExports() {
- return exports;
- }
-
- public List<Import> getImports() {
- return imports;
- }
-
- public List<Composite> getDeployables() {
- return deployables;
- }
-
- public List<DeployedArtifact> getArtifacts() {
- return artifacts;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-}
+/*
+ * 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.contribution.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of a deployed contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionImpl extends ArtifactImpl implements Contribution {
+ private List<Export> exports = new ArrayList<Export>();
+ private List<Import> imports = new ArrayList<Import>();
+ private List<Composite> deployables = new ArrayList<Composite>();
+ private ModelResolver modelResolver;
+
+ /**
+ * A list of artifacts in the contribution
+ */
+ private List<DeployedArtifact> artifacts = new ArrayList<DeployedArtifact>();
+
+ protected ContributionImpl() {
+ }
+
+ public List<Export> getExports() {
+ return exports;
+ }
+
+ public List<Import> getImports() {
+ return imports;
+ }
+
+ public List<Composite> getDeployables() {
+ return deployables;
+ }
+
+ public List<DeployedArtifact> getArtifacts() {
+ return artifacts;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java Fri Jul 27 18:26:55 2007
@@ -1,43 +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.sca.contribution.impl;
-
-import org.apache.tuscany.sca.contribution.DeployedArtifact;
-
-/**
- * Representation of a deployed artifact
- *
- * @version $Rev: 527398 $ $Date: 2007-04-10 23:43:31 -0700 (Tue, 10 Apr 2007) $
- */
-public class DeployedArtifactImpl extends ArtifactImpl implements DeployedArtifact {
- private Object modelObject;
-
- protected DeployedArtifactImpl() {
- super();
- }
-
- public Object getModel() {
- return modelObject;
- }
-
- public void setModel(Object modelObject) {
- this.modelObject = modelObject;
- }
-}
+/*
+ * 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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+
+/**
+ * Representation of a deployed artifact
+ *
+ * @version $Rev$ $Date$
+ */
+public class DeployedArtifactImpl extends ArtifactImpl implements DeployedArtifact {
+ private Object modelObject;
+
+ protected DeployedArtifactImpl() {
+ super();
+ }
+
+ public Object getModel() {
+ return modelObject;
+ }
+
+ public void setModel(Object modelObject) {
+ this.modelObject = modelObject;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java Fri Jul 27 18:26:55 2007
@@ -1,62 +1,62 @@
-/*
- * 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.contribution.impl;
-
-import org.apache.tuscany.sca.contribution.ContributionImport;
-import org.apache.tuscany.sca.contribution.NamespaceImport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of an import for the contribution
- *
- * @version $Rev: 527398 $ $Date: 2007-04-10 23:43:31 -0700 (Tue, 10 Apr 2007) $
- */
-public class NamespaceImportImpl implements NamespaceImport, ContributionImport {
- private String namespace; // The namespace to be imported
- private String location; // Optional location to hint the where it should be imported
- private ModelResolver modelResolver;
-
- protected NamespaceImportImpl() {
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-}
+/*
+ * 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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.ContributionImport;
+import org.apache.tuscany.sca.contribution.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an import for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportImpl implements NamespaceImport, ContributionImport {
+ private String namespace; // The namespace to be imported
+ private String location; // Optional location to hint the where it should be imported
+ private ModelResolver modelResolver;
+
+ protected NamespaceImportImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/NamespaceImportImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionURIException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java Fri Jul 27 18:26:55 2007
@@ -1,89 +1,89 @@
-/*
- * 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.contribution.resolver.impl;
-
-import java.util.Collection;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.NamespaceExport;
-import org.apache.tuscany.sca.contribution.NamespaceImport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A model resolver implementation that considers Exports in any available contribution
- *
- * @version $Rev: 548560 $ $Date: 2007-06-18 19:25:19 -0700 (Mon, 18 Jun 2007) $
- */
-public class NamespaceImportAllModelResolverImpl implements ModelResolver {
-
- private NamespaceImport namespaceImport;
- private Collection<Contribution> contributions;
-
- public NamespaceImportAllModelResolverImpl(NamespaceImport namespaceImport, Collection<Contribution> contributions) {
- this.namespaceImport = namespaceImport;
- this.contributions = contributions;
- }
-
- public void addModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public Object removeModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- //TODO optimize and cache results of the resolution later
-
- // Go over all available contributions
- for (Contribution contribution : contributions) {
-
- // Go over all exports in the contribution
- for (Export export : contribution.getExports()) {
- if (export instanceof NamespaceExport) {
- NamespaceExport namespaceExport = (NamespaceExport)export;
-
- // If the export matches our namespace, try to the resolve the model object
- if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) {
- Object resolved = namespaceExport.getModelResolver().resolveModel(modelClass, unresolved);
-
- // Return the resolved model object
- if (resolved instanceof org.apache.tuscany.sca.interfacedef.Base) {
- if (!((org.apache.tuscany.sca.interfacedef.Base)resolved).isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- else if (resolved instanceof org.apache.tuscany.sca.assembly.Base) {
- if (!((org.apache.tuscany.sca.assembly.Base)resolved).isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- }
- }
- }
-
- // Model object was not resolved
- return unresolved;
- }
-
-}
+/*
+ * 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.contribution.resolver.impl;
+
+import java.util.Collection;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.NamespaceExport;
+import org.apache.tuscany.sca.contribution.NamespaceImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A model resolver implementation that considers Exports in any available contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamespaceImportAllModelResolverImpl implements ModelResolver {
+
+ private NamespaceImport namespaceImport;
+ private Collection<Contribution> contributions;
+
+ public NamespaceImportAllModelResolverImpl(NamespaceImport namespaceImport, Collection<Contribution> contributions) {
+ this.namespaceImport = namespaceImport;
+ this.contributions = contributions;
+ }
+
+ public void addModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public Object removeModel(Object resolved) {
+ throw new IllegalStateException();
+ }
+
+ public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+
+ //TODO optimize and cache results of the resolution later
+
+ // Go over all available contributions
+ for (Contribution contribution : contributions) {
+
+ // Go over all exports in the contribution
+ for (Export export : contribution.getExports()) {
+ if (export instanceof NamespaceExport) {
+ NamespaceExport namespaceExport = (NamespaceExport)export;
+
+ // If the export matches our namespace, try to the resolve the model object
+ if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) {
+ Object resolved = namespaceExport.getModelResolver().resolveModel(modelClass, unresolved);
+
+ // Return the resolved model object
+ if (resolved instanceof org.apache.tuscany.sca.interfacedef.Base) {
+ if (!((org.apache.tuscany.sca.interfacedef.Base)resolved).isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ else if (resolved instanceof org.apache.tuscany.sca.assembly.Base) {
+ if (!((org.apache.tuscany.sca.assembly.Base)resolved).isUnresolved()) {
+ return modelClass.cast(resolved);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Model object was not resolved
+ return unresolved;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/NamespaceImportAllModelResolverImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java Fri Jul 27 18:26:55 2007
@@ -1,106 +1,106 @@
-/*
- * 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.contribution.service.impl;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.ContentType;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.service.TypeDescriber;
-import org.apache.tuscany.sca.contribution.service.util.FileHelper;
-
-/**
- * Implementation of the content describer for files
- *
- * @version $Rev$ $Date$
- */
-public class ArtifactTypeDescriberImpl implements TypeDescriber {
- private final Map<String, String> contentTypeRegistry = new HashMap<String, String>();
-
- public ArtifactTypeDescriberImpl() {
- super();
- init();
- }
-
- /**
- * Initialize contentType registry with know types based on known file extensions
- */
- private void init() {
- contentTypeRegistry.put("COMPOSITE", ContentType.COMPOSITE);
- contentTypeRegistry.put("SCDL", ContentType.COMPOSITE);
- contentTypeRegistry.put("WSDL", ContentType.WSDL);
- contentTypeRegistry.put("JAR", ContentType.JAR);
- }
-
- protected String resolveContentyTypeByExtension(URL resourceURL) {
- String artifactExtension = FileHelper.getExtension(resourceURL.getPath());
- if (artifactExtension == null) {
- return null;
- }
- return contentTypeRegistry.get(artifactExtension.toUpperCase());
- }
-
- /**
- * Build contentType for a specific resource. We first check if the file is
- * a supported one (looking into our registry based on resource extension)
- * If not found, we try to check file contentType Or we return
- * defaultContentType provided
- *
- * @param resourceURL The artifact url
- * @param defaultContentType The default content type if we can't find the correc one
- * @return The content type
- */
- public String getType(URL resourceURL, String defaultContentType) {
- URLConnection connection = null;
- String contentType = defaultContentType;
-
- if (resourceURL.getProtocol().equals("file") && FileHelper.toFile(resourceURL).isDirectory()) {
- // Special case : contribution is a folder
- contentType = ContentType.FOLDER;
- } else if (resourceURL.toExternalForm().endsWith(Contribution.SCA_CONTRIBUTION_META)
- || resourceURL.toExternalForm().endsWith(Contribution.SCA_CONTRIBUTION_GENERATED_META)) {
- // Special case : contribution metadata
- contentType = ContentType.CONTRIBUTION_METADATA;
- } else {
- contentType = resolveContentyTypeByExtension(resourceURL);
- if (contentType == null) {
- try {
- connection = resourceURL.openConnection();
- contentType = connection.getContentType();
-
- if (contentType == null || contentType.equals("content/unknown")) {
- // here we couldn't figure out from our registry or from URL and it's not a special file
- // return defaultContentType if provided
- contentType = defaultContentType;
- }
- } catch (IOException io) {
- // could not access artifact, just ignore and we will return
- // null contentType
- }
- }
- }
- return contentType == null ? defaultContentType : contentType;
- }
-
-}
+/*
+ * 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.contribution.service.impl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+
+/**
+ * Implementation of the content describer for files
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArtifactTypeDescriberImpl implements TypeDescriber {
+ private final Map<String, String> contentTypeRegistry = new HashMap<String, String>();
+
+ public ArtifactTypeDescriberImpl() {
+ super();
+ init();
+ }
+
+ /**
+ * Initialize contentType registry with know types based on known file extensions
+ */
+ private void init() {
+ contentTypeRegistry.put("COMPOSITE", ContentType.COMPOSITE);
+ contentTypeRegistry.put("SCDL", ContentType.COMPOSITE);
+ contentTypeRegistry.put("WSDL", ContentType.WSDL);
+ contentTypeRegistry.put("JAR", ContentType.JAR);
+ }
+
+ protected String resolveContentyTypeByExtension(URL resourceURL) {
+ String artifactExtension = FileHelper.getExtension(resourceURL.getPath());
+ if (artifactExtension == null) {
+ return null;
+ }
+ return contentTypeRegistry.get(artifactExtension.toUpperCase());
+ }
+
+ /**
+ * Build contentType for a specific resource. We first check if the file is
+ * a supported one (looking into our registry based on resource extension)
+ * If not found, we try to check file contentType Or we return
+ * defaultContentType provided
+ *
+ * @param resourceURL The artifact url
+ * @param defaultContentType The default content type if we can't find the correc one
+ * @return The content type
+ */
+ public String getType(URL resourceURL, String defaultContentType) {
+ URLConnection connection = null;
+ String contentType = defaultContentType;
+
+ if (resourceURL.getProtocol().equals("file") && FileHelper.toFile(resourceURL).isDirectory()) {
+ // Special case : contribution is a folder
+ contentType = ContentType.FOLDER;
+ } else if (resourceURL.toExternalForm().endsWith(Contribution.SCA_CONTRIBUTION_META)
+ || resourceURL.toExternalForm().endsWith(Contribution.SCA_CONTRIBUTION_GENERATED_META)) {
+ // Special case : contribution metadata
+ contentType = ContentType.CONTRIBUTION_METADATA;
+ } else {
+ contentType = resolveContentyTypeByExtension(resourceURL);
+ if (contentType == null) {
+ try {
+ connection = resourceURL.openConnection();
+ contentType = connection.getContentType();
+
+ if (contentType == null || contentType.equals("content/unknown")) {
+ // here we couldn't figure out from our registry or from URL and it's not a special file
+ // return defaultContentType if provided
+ contentType = defaultContentType;
+ }
+ } catch (IOException io) {
+ // could not access artifact, just ignore and we will return
+ // null contentType
+ }
+ }
+ }
+ return contentType == null ? defaultContentType : contentType;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataDocumentProcessorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataDocumentProcessorImpl.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataDocumentProcessorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataDocumentProcessorImpl.java Fri Jul 27 18:26:55 2007
@@ -1,109 +1,109 @@
-/*
- * 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.contribution.service.impl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionMetadataDocumentProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-/**
- * Loader that handles contribution metadata files
- *
- * @version $Rev: 515261 $ $Date: 2007-03-06 11:22:46 -0800 (Tue, 06 Mar 2007) $
- */
-public class ContributionMetadataDocumentProcessorImpl implements ContributionMetadataDocumentProcessor {
- protected final URLClassLoader classLoader;
- protected final StAXArtifactProcessor staxProcessor;
- protected final AssemblyFactory assemblyFactory;
- protected final ContributionFactory contributionFactory;
- protected final XMLInputFactory inputFactory;
-
- public ContributionMetadataDocumentProcessorImpl(URLClassLoader classLoader, StAXArtifactProcessor staxProcessor, AssemblyFactory assemblyFactory, ContributionFactory contributionFactory, XMLInputFactory inputFactory) {
- super();
- this.classLoader = classLoader;
- this.staxProcessor = staxProcessor;
- this.assemblyFactory = assemblyFactory;
- this.contributionFactory = contributionFactory;
- this.inputFactory = inputFactory;
- }
-
- private Contribution mergeContributionMetadata(Contribution contrib1, Contribution contrib2 ) {
- contrib1.getDeployables().addAll(contrib2.getDeployables());
- contrib1.getImports().addAll(contrib2.getImports());
- contrib1.getExports().addAll(contrib2.getExports());
-
- return contrib1;
- }
-
- public void read(Contribution contribution) throws XMLStreamException, ContributionReadException {
- List<URL> artifactList = new ArrayList<URL>(2);
- //set generated first, as the user created one ovverrides generated information
- artifactList.add(this.classLoader.getResource(Contribution.SCA_CONTRIBUTION_GENERATED_META));
- artifactList.add(this.classLoader.getResource(Contribution.SCA_CONTRIBUTION_META));
-
- URL artifactURL = null;
- InputStream artifactStream = null;
- Iterator artifactIterator = artifactList.iterator();
- while( artifactIterator.hasNext() ){
-
- try {
- artifactURL = (URL) artifactIterator.next();
- if( artifactURL != null) {
- artifactStream = artifactURL.openStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(artifactStream);
- reader.nextTag();
-
- Contribution contributionMetadata = (Contribution) staxProcessor.read(reader);
- if (contributionMetadata != null) {
- this.mergeContributionMetadata(contribution, contributionMetadata);
- }
- }
-
- } catch (XMLStreamException e) {
- throw new ContributionReadException(e);
- } catch (IOException e) {
- throw new ContributionReadException(e);
- } finally {
- try {
- if (artifactStream != null) {
- artifactStream.close();
- artifactStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
- }
-}
+/*
+ * 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.contribution.service.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionMetadataDocumentProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Loader that handles contribution metadata files
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataDocumentProcessorImpl implements ContributionMetadataDocumentProcessor {
+ protected final URLClassLoader classLoader;
+ protected final StAXArtifactProcessor staxProcessor;
+ protected final AssemblyFactory assemblyFactory;
+ protected final ContributionFactory contributionFactory;
+ protected final XMLInputFactory inputFactory;
+
+ public ContributionMetadataDocumentProcessorImpl(URLClassLoader classLoader, StAXArtifactProcessor staxProcessor, AssemblyFactory assemblyFactory, ContributionFactory contributionFactory, XMLInputFactory inputFactory) {
+ super();
+ this.classLoader = classLoader;
+ this.staxProcessor = staxProcessor;
+ this.assemblyFactory = assemblyFactory;
+ this.contributionFactory = contributionFactory;
+ this.inputFactory = inputFactory;
+ }
+
+ private Contribution mergeContributionMetadata(Contribution contrib1, Contribution contrib2 ) {
+ contrib1.getDeployables().addAll(contrib2.getDeployables());
+ contrib1.getImports().addAll(contrib2.getImports());
+ contrib1.getExports().addAll(contrib2.getExports());
+
+ return contrib1;
+ }
+
+ public void read(Contribution contribution) throws XMLStreamException, ContributionReadException {
+ List<URL> artifactList = new ArrayList<URL>(2);
+ //set generated first, as the user created one ovverrides generated information
+ artifactList.add(this.classLoader.getResource(Contribution.SCA_CONTRIBUTION_GENERATED_META));
+ artifactList.add(this.classLoader.getResource(Contribution.SCA_CONTRIBUTION_META));
+
+ URL artifactURL = null;
+ InputStream artifactStream = null;
+ Iterator artifactIterator = artifactList.iterator();
+ while( artifactIterator.hasNext() ){
+
+ try {
+ artifactURL = (URL) artifactIterator.next();
+ if( artifactURL != null) {
+ artifactStream = artifactURL.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(artifactStream);
+ reader.nextTag();
+
+ Contribution contributionMetadata = (Contribution) staxProcessor.read(reader);
+ if (contributionMetadata != null) {
+ this.mergeContributionMetadata(contribution, contributionMetadata);
+ }
+ }
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ } finally {
+ try {
+ if (artifactStream != null) {
+ artifactStream.close();
+ artifactStream = null;
+ }
+ } catch (IOException ioe) {
+ //ignore
+ }
+ }
+ }
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataDocumentProcessorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataDocumentProcessorImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataProcessor.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataProcessor.java Fri Jul 27 18:26:55 2007
@@ -1,161 +1,161 @@
-/*
- * 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.contribution.service.impl;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.NamespaceExport;
-import org.apache.tuscany.sca.contribution.NamespaceImport;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-
-/**
- * Loader that handles contribution metadata files
- *
- * @version $Rev: 515261 $ $Date: 2007-03-06 11:22:46 -0800 (Tue, 06 Mar 2007) $
- */
-public class ContributionMetadataProcessor implements StAXArtifactProcessor<Contribution> {
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- private static final String TARGET_NAMESPACE = "targetNamespace";
-
- private static final QName CONTRIBUTION = new QName(SCA10_NS, "contribution");
- private static final QName DEPLOYABLE = new QName(SCA10_NS, "deployable");
- private static final QName IMPORT = new QName(SCA10_NS, "import");
- private static final QName EXPORT = new QName(SCA10_NS, "export");
-
- private final AssemblyFactory assemblyFactory;
- private final ContributionFactory contributionFactory;
-
- public ContributionMetadataProcessor(AssemblyFactory assemblyFactory, ContributionFactory contributionFactory) {
- super();
- this.assemblyFactory = assemblyFactory;
- this.contributionFactory = contributionFactory;
- }
-
-
- public QName getArtifactType() {
- return CONTRIBUTION;
- }
-
- public Class<Contribution> getModelType() {
- return Contribution.class;
- }
-
- public Contribution read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Contribution contribution = this.contributionFactory.createContribution();
- String targetNameSpaceURI = null;
- QName element = null;
-
-
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- element = reader.getName();
-
- if (CONTRIBUTION.equals(element)) {
- targetNameSpaceURI = reader.getAttributeValue(null, TARGET_NAMESPACE);
- } else if (DEPLOYABLE.equals(element)) {
- String name = reader.getAttributeValue(null, "composite");
- if (name == null) {
- throw new ContributionReadException("Attribute 'composite' is missing");
- }
- QName compositeName = null;
-
- int index = name.indexOf(':');
- if (index != -1) {
- String prefix = name.substring(0, index);
- String localPart = name.substring(index + 1);
- String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
- if (ns == null) {
- throw new ContributionReadException("Invalid prefix: " + prefix);
- }
- compositeName = new QName(targetNameSpaceURI, localPart, prefix);
- } else {
- String prefix = "";
- String localPart = name;
- compositeName = new QName(targetNameSpaceURI, localPart, prefix);
- }
-
- Composite composite = assemblyFactory.createComposite();
- composite.setName(compositeName);
- composite.setUnresolved(true);
-
- contribution.getDeployables().add(composite);
- } else if (IMPORT.equals(element)) {
- String ns = reader.getAttributeValue(null, "namespace");
- if (ns == null) {
- throw new ContributionReadException("Attribute 'namespace' is missing");
- }
- String location = reader.getAttributeValue(null, "location");
- NamespaceImport namespaceImport = this.contributionFactory.createNamespaceImport();
- if (location != null) {
- namespaceImport.setLocation(location);
- }
- namespaceImport.setNamespace(ns);
- contribution.getImports().add(namespaceImport);
- } else if (EXPORT.equals(element)) {
- String ns = reader.getAttributeValue(null, "namespace");
- if (ns == null) {
- throw new ContributionReadException("Attribute 'namespace' is missing");
- }
- NamespaceExport namespaceExport = this.contributionFactory.createNamespaceExport();
- namespaceExport.setNamespace(ns);
- contribution.getExports().add(namespaceExport);
- }
- break;
- case XMLStreamConstants.END_ELEMENT:
- if (CONTRIBUTION.equals(reader.getName())) {
- return contribution;
- }
- break;
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return contribution;
- }
-
- public void write(Contribution model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
- // TODO Auto-generated method stub
-
- }
-
- public void resolve(Contribution model, ModelResolver resolver) throws ContributionResolveException {
- // TODO Auto-generated method stub
-
- }
-}
+/*
+ * 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.contribution.service.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.NamespaceExport;
+import org.apache.tuscany.sca.contribution.NamespaceImport;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * Loader that handles contribution metadata files
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataProcessor implements StAXArtifactProcessor<Contribution> {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ private static final String TARGET_NAMESPACE = "targetNamespace";
+
+ private static final QName CONTRIBUTION = new QName(SCA10_NS, "contribution");
+ private static final QName DEPLOYABLE = new QName(SCA10_NS, "deployable");
+ private static final QName IMPORT = new QName(SCA10_NS, "import");
+ private static final QName EXPORT = new QName(SCA10_NS, "export");
+
+ private final AssemblyFactory assemblyFactory;
+ private final ContributionFactory contributionFactory;
+
+ public ContributionMetadataProcessor(AssemblyFactory assemblyFactory, ContributionFactory contributionFactory) {
+ super();
+ this.assemblyFactory = assemblyFactory;
+ this.contributionFactory = contributionFactory;
+ }
+
+
+ public QName getArtifactType() {
+ return CONTRIBUTION;
+ }
+
+ public Class<Contribution> getModelType() {
+ return Contribution.class;
+ }
+
+ public Contribution read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Contribution contribution = this.contributionFactory.createContribution();
+ String targetNameSpaceURI = null;
+ QName element = null;
+
+
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ element = reader.getName();
+
+ if (CONTRIBUTION.equals(element)) {
+ targetNameSpaceURI = reader.getAttributeValue(null, TARGET_NAMESPACE);
+ } else if (DEPLOYABLE.equals(element)) {
+ String name = reader.getAttributeValue(null, "composite");
+ if (name == null) {
+ throw new ContributionReadException("Attribute 'composite' is missing");
+ }
+ QName compositeName = null;
+
+ int index = name.indexOf(':');
+ if (index != -1) {
+ String prefix = name.substring(0, index);
+ String localPart = name.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ throw new ContributionReadException("Invalid prefix: " + prefix);
+ }
+ compositeName = new QName(targetNameSpaceURI, localPart, prefix);
+ } else {
+ String prefix = "";
+ String localPart = name;
+ compositeName = new QName(targetNameSpaceURI, localPart, prefix);
+ }
+
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(compositeName);
+ composite.setUnresolved(true);
+
+ contribution.getDeployables().add(composite);
+ } else if (IMPORT.equals(element)) {
+ String ns = reader.getAttributeValue(null, "namespace");
+ if (ns == null) {
+ throw new ContributionReadException("Attribute 'namespace' is missing");
+ }
+ String location = reader.getAttributeValue(null, "location");
+ NamespaceImport namespaceImport = this.contributionFactory.createNamespaceImport();
+ if (location != null) {
+ namespaceImport.setLocation(location);
+ }
+ namespaceImport.setNamespace(ns);
+ contribution.getImports().add(namespaceImport);
+ } else if (EXPORT.equals(element)) {
+ String ns = reader.getAttributeValue(null, "namespace");
+ if (ns == null) {
+ throw new ContributionReadException("Attribute 'namespace' is missing");
+ }
+ NamespaceExport namespaceExport = this.contributionFactory.createNamespaceExport();
+ namespaceExport.setNamespace(ns);
+ contribution.getExports().add(namespaceExport);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (CONTRIBUTION.equals(reader.getName())) {
+ return contribution;
+ }
+ break;
+ }
+
+ //Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ return contribution;
+ }
+
+ public void write(Contribution model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void resolve(Contribution model, ModelResolver resolver) throws ContributionResolveException {
+ // TODO Auto-generated method stub
+
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org