summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/contribution/src/main
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-04-10 00:11:48 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-04-10 00:11:48 +0000
commitf08e6ec68c6709018ad71d0e4140b9d4161ff10b (patch)
treeb387037f660ec615071b162ac47e9e7c688349f6 /java/sca/modules/contribution/src/main
parent58a8ca68a790cce2f3653ba2121d4e49a70d0228 (diff)
Remove deprecated classes and use generic type for getModel
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@763837 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/contribution/src/main')
-rw-r--r--java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java34
-rw-r--r--java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java32
-rw-r--r--java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java29
-rw-r--r--java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java30
-rw-r--r--java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java27
-rw-r--r--java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java40
6 files changed, 74 insertions, 118 deletions
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java
index 7400501d85..6b44dc40c6 100644
--- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java
+++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.contribution;
@@ -24,50 +24,50 @@ import org.apache.tuscany.sca.assembly.Base;
/**
* Represents an artifact in an SCA contribution.
- *
+ *
* @version $Rev$ $Date$
*/
public interface Artifact extends Base {
-
+
/**
* Returns the URI that unique identifies the artifact inside the contribution.
- *
+ *
* @return The artifact URI
*/
String getURI();
-
+
/**
* Sets the URI that uniquely identifies the artifact inside the contribution.
- *
+ *
* @param uri The artifact URI
*/
void setURI(String uri);
/**
* Returns the location of the artifact.
- *
+ *
* @return The artifact location
*/
String getLocation();
-
+
/**
* Set the location of the artifact.
- *
+ *
* @param location The artifact location
*/
void setLocation(String location);
-
+
/**
* Returns the in-memory model representing the artifact.
- *
+ *
* @return The model object
*/
- Object getModel();
-
+ <T> T getModel();
+
/**
* Sets the in-memory model representing the artifact.
- *
+ *
* @param model The model object
*/
void setModel(Object model);
@@ -77,7 +77,7 @@ public interface Artifact extends Base {
* @return the contents of the artifact
*/
byte[] getContents();
-
+
/**
* Sets the contents of the artifact.
* @param contents the contents of the artifact
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
index 67c9a05a0b..cba867cb80 100644
--- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
+++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.contribution;
@@ -22,52 +22,44 @@ package org.apache.tuscany.sca.contribution;
/**
* A factory for the contribution model.
- *
+ *
* @version $Rev$ $Date$
*/
public interface ContributionFactory {
-
+
/**
* Create a contribution model object
- *
+ *
* @return The new contribution model object
*/
Contribution createContribution();
-
+
/**
* Create a contribution metadata model object
- *
+ *
* @return The new contribution metadata model object
*/
ContributionMetadata createContributionMetadata();
-
- /**
- * Create a deployedArtifact model object
- *
- * @return The new deployedArtifact model object
- */
- @Deprecated
- DeployedArtifact createDeployedArtifact();
/**
* Create an artifact model object
- *
+ *
* @return The new artifact model object
*/
Artifact createArtifact();
/**
* Create a default import model object.
- *
+ *
* @return the new default import model object
*/
DefaultImport createDefaultImport();
/**
* Create a default export model object.
- *
+ *
* @return the new default export model object
*/
DefaultExport createDefaultExport();
-
+
} \ No newline at end of file
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java
deleted file mode 100644
index ffe190132c..0000000000
--- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-/**
- * Representation of a deployed artifact
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public interface DeployedArtifact extends Artifact {
-}
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
index 881987f622..cb7d34593f 100644
--- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
+++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.contribution.impl;
@@ -24,7 +24,7 @@ import org.apache.tuscany.sca.contribution.Artifact;
/**
* The model representing an artifact in a contribution.
- *
+ *
* @version $Rev$ $Date$
*/
class ArtifactImpl implements Artifact {
@@ -36,7 +36,7 @@ class ArtifactImpl implements Artifact {
ArtifactImpl() {
}
-
+
public String getLocation() {
return location;
}
@@ -44,19 +44,19 @@ class ArtifactImpl implements Artifact {
public void setLocation(String location) {
this.location = location;
}
-
+
public String getURI() {
return uri;
}
-
+
public void setURI(String uri) {
this.uri = uri;
}
-
- public Object getModel() {
- return model;
+
+ public <T> T getModel() {
+ return (T) model;
}
-
+
public void setModel(Object model) {
this.model = model;
}
@@ -64,15 +64,15 @@ class ArtifactImpl implements Artifact {
public byte[] getContents() {
return contents;
}
-
+
public void setContents(byte[] contents) {
this.contents = contents;
}
-
+
public boolean isUnresolved() {
return unresolved;
}
-
+
public void setUnresolved(boolean unresolved) {
this.unresolved = unresolved;
}
@@ -81,7 +81,7 @@ class ArtifactImpl implements Artifact {
public int hashCode() {
return uri.hashCode();
}
-
+
@Override
public boolean equals(Object obj) {
if (obj == this) {
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java
index c678c2eaef..64bfb20bed 100644
--- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java
+++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.contribution.impl;
@@ -25,23 +25,22 @@ import org.apache.tuscany.sca.contribution.ContributionFactory;
import org.apache.tuscany.sca.contribution.ContributionMetadata;
import org.apache.tuscany.sca.contribution.DefaultExport;
import org.apache.tuscany.sca.contribution.DefaultImport;
-import org.apache.tuscany.sca.contribution.DeployedArtifact;
/**
* Default implementation of a contribution model factory.
- *
+ *
* @version $Rev$ $Date$
*/
public class ContributionFactoryImpl implements ContributionFactory {
-
+
protected ContributionFactoryImpl() {
}
-
+
public Contribution createContribution() {
return new ContributionImpl();
}
-
+
public ContributionMetadata createContributionMetadata() {
return new ContributionMetadataImpl();
}
@@ -49,19 +48,13 @@ public class ContributionFactoryImpl implements ContributionFactory {
public Artifact createArtifact() {
return new ArtifactImpl();
}
-
+
public DefaultExport createDefaultExport() {
return new DefaultExportImpl();
}
-
+
public DefaultImport createDefaultImport() {
return new DefaultImportImpl();
}
-
- @Deprecated
- public DeployedArtifact createDeployedArtifact() {
- class DeployedArtifactImpl extends ArtifactImpl implements DeployedArtifact {
- }
- return new DeployedArtifactImpl();
- }
+
}
diff --git a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
index 0b41016caa..3a5d20d5e7 100644
--- a/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
+++ b/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
@@ -6,15 +6,15 @@
* 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.
+ * under the License.
*/
package org.apache.tuscany.sca.contribution.impl;
@@ -46,13 +46,13 @@ class ContributionImpl implements Contribution {
private List<Artifact> artifacts = new ArrayList<Artifact>();
private List<Contribution> dependencies = new ArrayList<Contribution>();
private ModelResolver modelResolver;
-
+
// FIXME remove this dependency on Java ClassLoaders
private ClassLoader classLoader;
ContributionImpl() {
}
-
+
public String getLocation() {
return this.location;
}
@@ -65,45 +65,45 @@ class ContributionImpl implements Contribution {
public ClassLoader getClassLoader() {
return classLoader;
}
-
+
//FIXME Remove dependency on Java ClassLoaders
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
-
-
+
+
public String getURI() {
return this.uri;
}
-
+
public void setURI(String uri) {
this.uri = uri;
}
- public Object getModel() {
- return model;
+ public <T> T getModel() {
+ return (T) model;
}
-
+
public void setModel(Object model) {
this.model = model;
}
-
+
public byte[] getContents() {
return contents;
}
-
+
public void setContents(byte[] contents) {
this.contents = contents;
}
-
+
public boolean isUnresolved() {
return unresolved;
}
-
+
public void setUnresolved(boolean unresolved) {
this.unresolved = unresolved;
}
-
+
public ModelResolver getModelResolver() {
return modelResolver;
}
@@ -111,11 +111,11 @@ class ContributionImpl implements Contribution {
public void setModelResolver(ModelResolver modelResolver) {
this.modelResolver = modelResolver;
}
-
+
public List<Contribution> getDependencies() {
return dependencies;
}
-
+
public List<Export> getExports() {
return exports;
}
@@ -136,7 +136,7 @@ class ContributionImpl implements Contribution {
public int hashCode() {
return uri.hashCode();
}
-
+
@Override
public boolean equals(Object obj) {
if (obj == this) {