diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-13 01:42:27 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-13 01:42:27 +0000 |
commit | 3c7c4a749baafcf375f4785a7668d3a25c9063e3 (patch) | |
tree | a66b8b031c5dc6c7744f44b44b6bcd371bd0b8df /sca-java-1.x/trunk/modules/data-api/src | |
parent | eb03ff672236cddf65533f39b83ddd5e2984a2bb (diff) |
Moving 1.x trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835700 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/modules/data-api/src')
12 files changed, 605 insertions, 0 deletions
diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Collection.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Collection.java new file mode 100644 index 0000000000..f559d5d914 --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Collection.java @@ -0,0 +1,78 @@ +/* + * 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.data.collection; + +import org.osoa.sca.annotations.Remotable; + +/** + * Provides access to a collection of data items. + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface Collection <K, D> { + + /** + * Get the whole collection. + * + * @return the whole collection. + */ + Entry<K, D>[] getAll(); + + /** + * Returns a collection resulting from a query. + * + * @return the collection. + */ + Entry<K, D>[] query(String queryString); + + /** + * Creates a new item. + * + * @param key + * @param item + * @return + */ + K post(K key, D item); + + /** + * Retrieves an item. + * + * @param key + * @return + */ + D get(K key) throws NotFoundException; + + /** + * Updates an item. + * + * @param key + * @param item + * @return + */ + void put(K key, D item) throws NotFoundException; + + /** + * Delete an item. + * + * @param key + */ + void delete(K key) throws NotFoundException; + +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Entry.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Entry.java new file mode 100644 index 0000000000..5903fd95a4 --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Entry.java @@ -0,0 +1,85 @@ +/* + * 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.data.collection; + + +/** + * Represents a key/data pair in a data collection. + * + * @version $Rev$ $Date$ + */ +public class Entry <K, D> { + + private K key; + private D data; + + /** + * Constructs a new entry. + */ + public Entry() { + } + + /** + * Constructs a new entry. + * @param key the entry key + * @param data the entry data + */ + public Entry(K key, D data) { + this.key = key; + this.data = data; + } + + /** + * Returns the entry key. + * @return the key + */ + public K getKey() { + return key; + } + + /** + * Sets the entry key. + * @param key the key + */ + public void setKey(K key) { + this.key = key; + } + + /** + * Returns the entry data. + * @return the entry data + */ + public D getData() { + return data; + } + + /** + * Sets the entry data + * @param data the entry data + */ + public void setData(D data) { + this.data = data; + } + + //FIXME Temporary methods to make JAXB register the Item + // class when the Entry class is registered in a JAXB context + public void setDummy(Item item) {} + public Item getDummy() { return null; } + +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Item.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Item.java new file mode 100644 index 0000000000..37042c0895 --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Item.java @@ -0,0 +1,159 @@ +/* + * 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.data.collection; + +import java.util.Date; + + +/** + * Represents a data item. + * + * @version $Rev$ $Date$ + */ +public class Item { + + private String title; + private String contents; + private String link; + private String related; + private String alternate; + private Date date; + + /** + * Constructs a new item. + */ + public Item() { + } + + /** + * Constructs a new item. + * @param title the item title + * @param contents the item contents + * @param link the item link to a web resource + * @param related the item link to a related web resource + * @param date the item date + */ + public Item(String title, String contents, String link, String related, Date date) { + this.title = title; + this.contents = contents; + this.link = link; + this.related = related; + this.date = date; + } + + /** + * Returns the item title. + * @return the item title + */ + public String getTitle() { + return title; + } + + /** + * Sets the item title. + * @param title the item title + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Returns the item contents + * @return the item contents + */ + public String getContents() { + return contents; + } + + /** + * Sets the item contents + * @param contents the item contents + */ + public void setContents(String contents) { + this.contents = contents; + } + + /** + * Returns the item link to a web resource + * @return the item link to a web resource + */ + public String getLink() { + return link; + } + + /** + * Sets the item link to a web resource + * @param link the item link to a web resource + */ + public void setLink(String link) { + this.link = link; + } + + /** + * Returns the item link to a related web resource + * @return the item link to a related web resource + */ + public String getRelated() { + return related; + } + + /** + * Sets the item link to a related web resource. + * + * @param related the item link to a related web resource + */ + public void setRelated(String related) { + this.related = related; + } + + /** + * Returns the item link to an alternate web resource + * @return the item link to an alternate web resource + */ + public String getAlternate() { + return alternate; + } + + /** + * Sets the item link to an alternate web resource. + * + * @param alternate the item link to an alternate web resource + */ + public void setAlternate(String alternate) { + this.alternate = alternate; + } + + /** + * Returns the item date + * @return the item date + */ + public Date getDate() { + return date; + } + + /** + * Sets the item date + * @param date the item date + */ + public void setDate(Date date) { + this.date = date; + } + + +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/ItemCollection.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/ItemCollection.java new file mode 100644 index 0000000000..c30bbc771a --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/ItemCollection.java @@ -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.sca.data.collection; + +import org.osoa.sca.annotations.Remotable; + +/** + * Provides access to a collection of data items. + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface ItemCollection extends Collection<String, Item> { +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/LocalItemCollection.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/LocalItemCollection.java new file mode 100644 index 0000000000..69512058b7 --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/LocalItemCollection.java @@ -0,0 +1,28 @@ +/* + * 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.data.collection; + + +/** + * Provides access to a collection of data items. + * + * @version $Rev$ $Date$ + */ +public interface LocalItemCollection extends Collection<String, Item> { +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/NotFoundException.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/NotFoundException.java new file mode 100644 index 0000000000..7f13db5228 --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/NotFoundException.java @@ -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.sca.data.collection; + +/** + * Indicates that an item could not be found in a collection. + * + * @version $Rev$ $Date$ + */ +public class NotFoundException extends Exception { + private static final long serialVersionUID = 6792367409396084646L; + + public NotFoundException() { + } + + public NotFoundException(String message) { + super(message); + } + + public NotFoundException(Throwable cause) { + super(cause); + } + + public NotFoundException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java new file mode 100644 index 0000000000..c2332ae2c9 --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java @@ -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.sca.implementation.data.collection; + +import org.osoa.sca.annotations.Remotable; + +/** + * Provides access to a collection of data items. + * + * @version $Rev$ $Date$ + */ +@Remotable +@Deprecated +public interface Collection <K, D> extends org.apache.tuscany.sca.data.collection.Collection<K, D> { +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java new file mode 100644 index 0000000000..a0d232a201 --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.implementation.data.collection; + + +/** + * Represents a key/data pair in a data collection. + * + * @version $Rev$ $Date$ + */ +@Deprecated +public class Entry <K, D> extends org.apache.tuscany.sca.data.collection.Entry<K, D> { +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java new file mode 100644 index 0000000000..77d8173521 --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java @@ -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.sca.implementation.data.collection; + + + +/** + * Represents a data item. + * + * @version $Rev$ $Date$ + */ +@Deprecated +public class Item extends org.apache.tuscany.sca.data.collection.Item { +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java new file mode 100644 index 0000000000..757152725d --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java @@ -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.sca.implementation.data.collection; + +import org.osoa.sca.annotations.Remotable; + +/** + * Provides access to a collection of data items. + * + * @version $Rev$ $Date$ + */ +@Remotable +@Deprecated +public interface ItemCollection extends Collection<String, Item> { +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java new file mode 100644 index 0000000000..047ab8829e --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.implementation.data.collection; + + +/** + * Provides access to a collection of data items. + * + * @version $Rev$ $Date$ + */ +@Deprecated +public interface LocalItemCollection extends Collection<String, Item> { +} diff --git a/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java new file mode 100644 index 0000000000..ed71471d9e --- /dev/null +++ b/sca-java-1.x/trunk/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java @@ -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.sca.implementation.data.collection; + +/** + * Indicates that an item could not be found in a collection. + * + * @version $Rev$ $Date$ + */ +@Deprecated +public class NotFoundException extends org.apache.tuscany.sca.data.collection.NotFoundException { + private static final long serialVersionUID = 2812975065056330240L; +} |