From 6fd5a4202a7373bacc018d27020e82fb3bf197f5 Mon Sep 17 00:00:00 2001 From: lresende Date: Fri, 23 Oct 2009 17:55:24 +0000 Subject: Straw-man cloud api that abstract different cloud infrastructure services and allow applications to consume these services independently of the cloud environment. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@829147 13f79535-47bb-0310-9956-ffa450edef68 --- .../cloud-api/META-INF/MANIFEST.MF | 19 ++++++++ sandbox/sca-cloud-tutorial/cloud-api/pom.xml | 53 ++++++++++++++++++++++ .../tuscany/sca/cloud/data/DocumentService.java | 33 ++++++++++++++ .../org/apache/tuscany/sca/cloud/user/User.java | 30 ++++++++++++ .../apache/tuscany/sca/cloud/user/UserService.java | 38 ++++++++++++++++ 5 files changed, 173 insertions(+) create mode 100644 sandbox/sca-cloud-tutorial/cloud-api/META-INF/MANIFEST.MF create mode 100644 sandbox/sca-cloud-tutorial/cloud-api/pom.xml create mode 100644 sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/data/DocumentService.java create mode 100644 sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/user/User.java create mode 100644 sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/user/UserService.java diff --git a/sandbox/sca-cloud-tutorial/cloud-api/META-INF/MANIFEST.MF b/sandbox/sca-cloud-tutorial/cloud-api/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..cf5fc0a7ce --- /dev/null +++ b/sandbox/sca-cloud-tutorial/cloud-api/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Export-Package: org.apache.tuscany.sca.cloud.user;version="2.0.0",org. + apache.tuscany.sca.cloud.data;uses:="org.apache.tuscany.sca.data.coll + ection";version="2.0.0" +Tool: Bnd-0.0.357 +Bundle-Name: Apache Tuscany SCA Cloud API +Created-By: 1.6.0_15 (Apple Inc.) +Bundle-Vendor: The Apache Software Foundation +Bundle-Version: 2.0.0 +Bnd-LastModified: 1256186081729 +Bundle-ManifestVersion: 2 +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Bundle-Description: Apache Tuscany SCA Cloud API +Import-Package: org.apache.tuscany.sca.cloud.data;version="2.0",org.ap + ache.tuscany.sca.cloud.user;version="2.0",org.apache.tuscany.sca.data + .collection;version="2.0" +Bundle-SymbolicName: org.apache.tuscany.sca.cloud.api +Bundle-DocURL: http://www.apache.org/ + diff --git a/sandbox/sca-cloud-tutorial/cloud-api/pom.xml b/sandbox/sca-cloud-tutorial/cloud-api/pom.xml new file mode 100644 index 0000000000..6bf4087e6d --- /dev/null +++ b/sandbox/sca-cloud-tutorial/cloud-api/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-modules + 2.0-SNAPSHOT + ../pom.xml + + tuscany-cloud-api + Apache Tuscany SCA Cloud API + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-SNAPSHOT + + + junit + junit + 4.5 + test + + + + + diff --git a/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/data/DocumentService.java b/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/data/DocumentService.java new file mode 100644 index 0000000000..f496c8f280 --- /dev/null +++ b/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/data/DocumentService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.cloud.data; + +import org.apache.tuscany.sca.data.collection.Collection; +import org.apache.tuscany.sca.data.collection.NotFoundException; + +public interface DocumentService extends Collection { + + /** + * Delete multiple items. + * + * @param key + */ + void delete(K... keys) throws NotFoundException; +} diff --git a/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/user/User.java b/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/user/User.java new file mode 100644 index 0000000000..b218716330 --- /dev/null +++ b/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/user/User.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.cloud.user; + +public interface User { + public static enum ROLES { UNDEFINED, USER, ADMIN}; + + String getUserId(); + + String getEmail(); + + String getNickname(); +} diff --git a/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/user/UserService.java b/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/user/UserService.java new file mode 100644 index 0000000000..7696f0d45b --- /dev/null +++ b/sandbox/sca-cloud-tutorial/cloud-api/src/main/java/org/apache/tuscany/sca/cloud/user/UserService.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.cloud.user; + + +public interface UserService { + + public String createLoginURL(String destinationURL, String authDomain); + + public String createLoginURL(String destinationURL); + + public String createLogoutURL(String destinationURL, String authDomain); + + public String createLogoutURL(String destinationURL); + + public User getCurrentUser(); + + public boolean isUserAdmin(); + + public boolean isUserLoggedIn(); +} -- cgit v1.2.3