git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@981151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
lresende 2010-08-01 04:53:59 +00:00
parent 1940c0a0f1
commit b85cc12a99
71 changed files with 0 additions and 4185 deletions

View file

@ -1,19 +0,0 @@
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.0",org.ap
ache.tuscany.sca.cloud.user;version="2.0.0",org.apache.tuscany.sca.data
.collection;version="2.0.0"
Bundle-SymbolicName: org.apache.tuscany.sca.cloud.api
Bundle-DocURL: http://www.apache.org/

View file

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-modules</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-cloud-api</artifactId>
<name>Apache Tuscany SCA Cloud API</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-data-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -1,33 +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.cloud.data;
import org.apache.tuscany.sca.data.collection.Collection;
import org.apache.tuscany.sca.data.collection.NotFoundException;
public interface DocumentService<K, D> extends Collection <K, D>{
/**
* Delete multiple items.
*
* @param key
*/
void delete(K... keys) throws NotFoundException;
}

View file

@ -1,48 +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.cloud.user;
public class User {
public static enum ROLES { UNDEFINED, USER, ADMIN};
protected String userId;
protected String nickName;
protected String email;
public User(String userId, String nickName, String email) {
this.userId = userId;
this.nickName = nickName;
this.email = email;
}
public String getUserId() {
return this.userId;
}
public String getNickname() {
return this.nickName;
}
public String getEmail() {
return this.email;
}
}

View file

@ -1,52 +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.cloud.user;
public class UserContext extends User {
protected String loginUrl;
protected String logoutUrl;
protected boolean isUserLoggedIn;
public UserContext(String userId, String nickName, String email, boolean isUserLoggedIn, String loginUrl, String logoutUrl) {
super(userId, nickName, email);
this.isUserLoggedIn = isUserLoggedIn;
this.loginUrl = loginUrl;
this.logoutUrl = logoutUrl;
}
public UserContext(User user, boolean isUserLoggedIn, String loginUrl, String logoutUrl) {
super(user.getUserId(), user.getNickname(), user.getEmail());
this.isUserLoggedIn = isUserLoggedIn;
this.loginUrl = loginUrl;
this.logoutUrl = logoutUrl;
}
public boolean isUserLoggedIn() {
return this.isUserLoggedIn;
}
public String getLoginUrl() {
return this.loginUrl;
}
public String getLogoutUrl() {
return this.logoutUrl;
}
}

View file

@ -1,40 +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.cloud.user;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface UserService {
public User getCurrentUser();
public boolean isUserAdmin();
public boolean isUserLoggedIn();
public UserContext getUserContext(String destinationURL, String authDomain);
public String createLoginURL(String destinationURL, String authDomain);
public String createLogoutURL(String destinationURL, String authDomain);
}

View file

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project name="AppEngineSDKInstaller">
<property name="appengine.version" value="1.2.6"/>
<property name="appengine.distribution.location" value="http://googleappengine.googlecode.com/files/appengine-java-sdk-${appengine.version}.zip" />
<property name="unpack.location" value="${basedir}/target/appengine-java-sdk-${appengine.version}"/>
<property name="appengine.tools.api" value="${basedir}/target/appengine-java-sdk-${appengine.version}/lib/appengine-tools-api.jar"/>
<property name="appengine.api" value="${basedir}/target/appengine-java-sdk-${appengine.version}/lib/impl/appengine-api.jar"/>
<property name="appengine.local.runtime.shared" value="${basedir}/target/appengine-java-sdk-${appengine.version}/lib/shared/appengine-local-runtime-shared.jar"/>
<property name="localRepository" value="${user.home}/.m2/repository"/>
<target name="check-installed">
<condition property="already.installed" >
<available file="${localRepository}/com/google/appengine-java-sdk/${appengine.version}/appengine-java-sdk-${appengine.version}.zip"/>
</condition>
<condition property="maven.suffix" value="">
<os family="unix"/>
</condition>
<condition property="maven.suffix" value=".bat">
<os family="windows"/>
</condition>
</target>
<target name="check-unpacked">
<condition property="already.unpacked" >
<available file="${unpack.location}"/>
</condition>
</target>
<target name="install" depends="check-installed" unless="already.installed">
<mkdir dir="${basedir}/target/appengine-download/"/>
<get src="${appengine.distribution.location}"
dest="${basedir}/target/appengine-download/appengine-java-sdk-${appengine.version}.zip"
verbose="true"
usetimestamp="true"/>
<exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
<arg line="install:install-file -DgroupId=com.google -DartifactId=appengine-java-sdk -Dversion=${appengine.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/appengine-download/appengine-java-sdk-${appengine.version}.zip"/>
</exec>
<antcall target="unpack-appengine-sdk"/>
<exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
<arg line="install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-tools -Dversion=${appengine.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${appengine.tools.api}"/>
</exec>
<exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
<arg line="install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-api -Dversion=${appengine.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${appengine.api}"/>
</exec>
<exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
<arg line="install:install-file -DgroupId=com.google.appengine -DartifactId=appengine-local-runtime-shared -Dversion=${appengine.version} -Dpackaging=jar -DgeneratePom=true -Dfile=${appengine.local.runtime.shared}"/>
</exec>
</target>
<target name="unpack-appengine-sdk" depends="check-installed, check-unpacked" unless="already.unpacked">
<fail message="AppEngine SDK zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
<mkdir dir="${basedir}/target/appengine-unpack-temp/"/>
<unzip src="${localRepository}/com/google/appengine-java-sdk/${appengine.version}/appengine-java-sdk-${appengine.version}.zip"
dest="${basedir}/target/appengine-unpack-temp/"
overwrite="false">
</unzip>
<move todir="${unpack.location}">
<fileset dir="${basedir}/target/appengine-unpack-temp/appengine-java-sdk-${appengine.version}"/>
</move>
<delete dir="${basedir}/target/appengine-unpack-temp/"/>
</target>
<target name="clean-appengine-files">
<delete dir="${unpack.location}"/>
</target>
</project>

View file

@ -1,84 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-modules</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-cloud-appengine-sdk</artifactId>
<packaging>pom</packaging>
<name>Apache Tuscany SCA Cloud API Google AppEngine SDK</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<!-- version>1.1</version -->
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>install-appengine</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-appengine.xml" target="install">
<property name="localRepository" value="${settings.localRepository}"/>
</ant>
</tasks>
</configuration>
</execution>
<execution>
<id>clean-appengine-files</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-appengine.xml" target="clean-appengine-files">
<property name="localRepository" value="${settings.localRepository}"/>
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,18 +0,0 @@
Manifest-Version: 1.0
Export-Package: org.apache.tuscany.sca.cloud.data.impl,
org.apache.tuscany.sca.cloud.user.impl
Tool: Bnd-0.0.357
Bundle-Name: Apache Tuscany SCA Cloud API - Google Implementation
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.0",org.ap
ache.tuscany.sca.cloud.user;version="2.0.0",org.apache.tuscany.sca.data
.collection;version="2.0.0"
Bundle-SymbolicName: org.apache.tuscany.sca.cloud.google
Bundle-DocURL: http://www.apache.org/

View file

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-modules</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-cloud-google</artifactId>
<name>Apache Tuscany SCA Cloud API Google AppEngine Implementation</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-cloud-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-cloud-appengine-sdk</artifactId>
<version>2.0-SNAPSHOT</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api</artifactId>
<version>1.2.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-node-impl</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<excludes>
<exclude>com.google.appengine:appengine-tools</exclude>
<exclude>com.google.appengine:appengine-api</exclude>
<exclude>com.google.appengine:appengine-local-runtime-shared</exclude>
</excludes>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,92 +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.cloud.data.impl;
import java.util.UUID;
import org.apache.tuscany.sca.cloud.data.DocumentService;
import org.apache.tuscany.sca.data.collection.Entry;
import org.apache.tuscany.sca.data.collection.NotFoundException;
import org.oasisopen.sca.annotation.Init;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.EntityNotFoundException;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
public class DatastoreDocumentServiceImpl implements DocumentService<Key, Entity> {
private DatastoreService googleDataStoreService;
@Init
public void init() {
googleDataStoreService = DatastoreServiceFactory.getDatastoreService();
}
public Entry<Key, Entity>[] getAll() {
throw new UnsupportedOperationException();
}
public Entity get(Key key) throws NotFoundException {
Entity entity = null;
try {
entity = googleDataStoreService.get(key);
} catch(EntityNotFoundException nf) {
throw new NotFoundException(nf);
}
return entity;
}
public Key post(Key key, Entity entity) {
if( key == null ) {
key = KeyFactory.createKey("key", UUID.randomUUID().toString());
}
return googleDataStoreService.put(entity);
}
public void put(Key key, Entity entity) throws NotFoundException {
if( get(key) == null) {
throw new NotFoundException("Could not find entity with key '" + key.toString() +"'");
}
googleDataStoreService.put(entity);
}
public void delete(Key key) throws NotFoundException {
googleDataStoreService.delete(key);
}
public void delete(Key... keys) throws NotFoundException {
googleDataStoreService.delete(keys);
}
public Entry<Key, Entity>[] query(String query) {
throw new UnsupportedOperationException();
}
}

View file

@ -1,90 +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.cloud.data.impl;
import java.util.UUID;
import org.apache.tuscany.sca.cloud.data.DocumentService;
import org.apache.tuscany.sca.data.collection.Entry;
import org.apache.tuscany.sca.data.collection.NotFoundException;
import org.oasisopen.sca.annotation.Init;
import org.oasisopen.sca.annotation.Property;
import com.google.appengine.api.memcache.Expiration;
import com.google.appengine.api.memcache.MemcacheService;
import com.google.appengine.api.memcache.MemcacheServiceFactory;
public class MemcacheDocumentServiceImpl implements DocumentService<Object, Object> {
private MemcacheService googleMemecacheService;
@Property(required=false)
protected Expiration defaultExpiration = Expiration.byDeltaSeconds(3600); // 1hr
@Init
public void init() {
googleMemecacheService = MemcacheServiceFactory.getMemcacheService();
}
public Entry<Object, Object>[] getAll() {
throw new UnsupportedOperationException();
}
public Object get(Object key) throws NotFoundException {
Object entity = null;
entity = googleMemecacheService.get(key);
if(entity == null) {
throw new NotFoundException("Could not find object with key '" + key.toString() + "'");
}
return entity;
}
public Object post(Object key, Object entity) {
if( key == null ) {
key = UUID.randomUUID().toString();
}
googleMemecacheService.put(key, entity, defaultExpiration);
return entity;
}
public void put(Object key, Object entity) throws NotFoundException {
if( get(key) == null) {
throw new NotFoundException("Could not find entity with key '" + key.toString() +"'");
}
googleMemecacheService.put(key, entity, defaultExpiration);
}
public void delete(Object key) throws NotFoundException {
googleMemecacheService.delete(key);
}
public void delete(Object... keys) throws NotFoundException {
googleMemecacheService.delete(keys);
}
public Entry<Object, Object>[] query(String query) {
throw new UnsupportedOperationException();
}
}

View file

@ -1,87 +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.cloud.user.impl;
import org.apache.tuscany.sca.cloud.user.User;
import org.apache.tuscany.sca.cloud.user.UserContext;
import org.apache.tuscany.sca.cloud.user.UserService;
import org.oasisopen.sca.annotation.Init;
import org.oasisopen.sca.annotation.Scope;
import org.oasisopen.sca.annotation.Service;
import com.google.appengine.api.users.UserServiceFactory;
@Service(UserService.class)
@Scope("COMPOSITE")
public class GoogleUserService implements UserService {
private com.google.appengine.api.users.UserService googleUerService;
@Init
public void init() {
googleUerService = UserServiceFactory.getUserService();
}
public User getCurrentUser() {
return fromGoogleUser(googleUerService.getCurrentUser());
}
public boolean isUserAdmin() {
//FIXME handle via roles from tuscany user api
throw new UnsupportedOperationException("Not supported yet");
}
public boolean isUserLoggedIn() {
return googleUerService.isUserLoggedIn();
}
public UserContext getUserContext(String destinationURL, String authDomain) {
return new UserContext (getCurrentUser(),
isUserLoggedIn(),
createLoginURL(destinationURL, authDomain),
createLogoutURL(destinationURL, authDomain));
}
public String createLoginURL(String destinationURL, String authDomain) {
if(authDomain != null && authDomain.length() > 0) {
return googleUerService.createLoginURL(destinationURL, authDomain);
} else {
return googleUerService.createLoginURL(destinationURL);
}
}
public String createLogoutURL(String destinationURL, String authDomain) {
if(authDomain != null && authDomain.length() > 0) {
return googleUerService.createLogoutURL(destinationURL, authDomain);
} else {
return googleUerService.createLogoutURL(destinationURL);
}
}
private static User fromGoogleUser(com.google.appengine.api.users.User googleUser) {
if(googleUser != null) {
return new User(googleUser.getUserId(), googleUser.getNickname(), googleUser.getEmail());
}
return new User(null, null, null);
}
}

View file

@ -1,51 +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.cloud.data.impl;
import java.io.Serializable;
public class Customer implements Serializable {
private static final long serialVersionUID = 3465788478651204747L;
private String id;
private String name;
private String creditCard;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCreditCard() {
return creditCard;
}
public void setCreditCard(String creditCard) {
this.creditCard = creditCard;
}
}

View file

@ -1,27 +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.cloud.data.impl;
import org.junit.Ignore;
@Ignore("Nothing to do here")
public class DatastoreDocumentServiceTestCase {
}

View file

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://google"
name="datastore">
<component name="DataStoreDocumentServiceComponent">
<implementation.java class="org.apache.tuscany.sca.cloud.data.impl.DatastoreDocumentServiceImpl"/>
</component>
</composite>

View file

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tuscany-cloud</artifactId>
<packaging>pom</packaging>
<name>Apache Tuscany SCA Cloud Tutorial</name>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>cloud-api</module>
<module>cloud-appengine-sdk</module>
<module>cloud-google</module>
<module>store-assets</module>
<module>store-appengine-webapp</module>
<module>store-merger-appengine-webapp</module>
<module>store-catalog-appengine-webapp</module>
<module>store-catalog-ibmcloud-webapp</module>
</modules>
</profile>
<profile>
<id>eclipse</id>
<modules>
<module>cloud-api</module>
<module>store-assets</module>
<module>store-catalog-ibmcloud-webapp</module>
</modules>
</profile>
</profiles>
</project>

View file

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project name="DojoZipInstaller">
<property name="dojo.version" value="1.3.0"/>
<property name="unpack.location" value="${basedir}/war/dojo"/>
<target name="check-dojo-installed">
<condition property="already.installed" >
<available file="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
</condition>
<condition property="maven.suffix" value="">
<os family="unix"/>
</condition>
<condition property="maven.suffix" value=".bat">
<os family="windows"/>
</condition>
</target>
<target name="check-dojo-unpacked">
<condition property="already.unpacked" >
<available file="${unpack.location}"/>
</condition>
</target>
<target name="install-dojo" depends="check-dojo-installed" unless="already.installed">
<mkdir dir="${basedir}/target/dojo-download/"/>
<get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
verbose="true"
usetimestamp="true"/>
<exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
<arg line="install:install-file -DgroupId=dojo -DartifactId=dojo -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"/>
</exec>
</target>
<target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
<mkdir dir="${basedir}/target/dojo-download/"/>
<get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
verbose="true"
usetimestamp="true"/>
<copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
tofile="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
</target>
<target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
<fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
<mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
<unzip src="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"
dest="${basedir}/target/dojo-unpack-temp/"
overwrite="false">
<patternset>
<include name="dojo-release-${dojo.version}/dojo/**"/>
<exclude name="dojo-release-${dojo.version}/dojo/tests/**"/>
<include name="dojo-release-${dojo.version}/dijit/**"/>
<exclude name="dojo-release-${dojo.version}/dojox/**"/>
<exclude name="dojo-release-${dojo.version}/util/**"/>
</patternset>
</unzip>
<move file="${basedir}/target/dojo-unpack-temp/dojo-release-${dojo.version}"
tofile="${unpack.location}"
verbose="true"/>
<delete dir="${basedir}/target/dojo-unpack-temp/"/>
</target>
<target name="clean-dojo-files">
<delete dir="${unpack.location}"/>
</target>
</project>

View file

@ -1,216 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>store-appengine-webapp</artifactId>
<packaging>war</packaging>
<name>Apache Tuscany Store</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>store-assets</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-cloud-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-cloud-google</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-webapp</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-jaxb</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-interface-java-jaxws</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<sourceIncludes>
<sourceInclude>**/*</sourceInclude>
</sourceIncludes>
<projectnatures>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
<projectnature>com.google.gdt.eclipse.core.webAppNature</projectnature>
</projectnatures>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>com.google.appengine.eclipse.core.enhancerbuilder</buildcommand>
<buildcommand>com.google.appengine.eclipse.core.projectValidator</buildcommand>
<buildcommand>com.google.gdt.eclipse.core.webAppProjectValidator</buildcommand>
</buildcommands>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<!-- version>1.1</version -->
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>install-dojo</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="install-dojo">
<property name="localRepository" value="${settings.localRepository}" />
</ant>
</tasks>
</configuration>
</execution>
<execution>
<id>copy-dojo-files</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="unpack-dojo-files">
<property name="localRepository" value="${settings.localRepository}" />
<property name="artifactId" value="${artifactId}" />
</ant>
</tasks>
</configuration>
</execution>
<execution>
<id>clean-dojo-files</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="clean-dojo-files">
<property name="localRepository" value="${settings.localRepository}" />
<property name="artifactId" value="${artifactId}" />
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>war/WEB-INF/lib</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,22 +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.
*/
public class Workaround {
}

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:store="http://store">
<deployable composite="store:catalog" />
<!-- import.java package="services" / -->
</contribution>

View file

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* 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.
-->
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>tuscany-store</application>
<version>5</version>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>

View file

@ -1,37 +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.
#
#
# A default java.util.logging configuration.
# (All App Engine logging is through java.util.logging by default).
#
# To use this configuration, copy it into your application's WEB-INF
# folder and add the following to your appengine-web.xml:
#
# <system-properties>
# <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
# </system-properties>
#
# Set the default logging level for all loggers to WARNING
.level = WARNING
#tuscany debug messages
org.apache.tuscany.level = WARNING

View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Tuscany Filter -->
<filter>
<filter-name>tuscany</filter-name>
<filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>tuscany</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>store.html</welcome-file>
</welcome-file-list>
</web-app>

View file

@ -1,28 +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.
#
#
# Configure the console as our one appender
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n
#tuscany debug messages
log4j.category.org.apache.tuscany=ALL,A1

View file

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:s="http://store"
targetNamespace="http://store"
name="catalog">
<component name="Catalog">
<implementation.java class="services.FruitsCatalogImpl"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<interface.java interface="services.Catalog"/>
<tuscany:binding.jsonrpc uri="/Catalog"/>
</service>
<reference name="currencyConverter" target="CurrencyConverter" />
</component>
<component name="CurrencyConverter">
<implementation.java class="services.CurrencyConverterImpl" />
<service name="CurrencyConverter">
<interface.java interface="services.CurrencyConverter"/>
</service>
</component>
<component name="ShoppingCartManager">
<implementation.java class="services.ShoppingCartManager"/>
<service name="ShoppingCart">
<tuscany:binding.jsonrpc uri="/ShoppingCart"/>
</service>
<reference name="userService" target="UserService">
<binding.sca name="local"/>
</reference>
</component>
<component name="UserService">
<implementation.java class="org.apache.tuscany.sca.cloud.user.impl.GoogleUserService"/>
<service name="UserService">
<binding.sca name="local"/>
<tuscany:binding.jsonrpc uri="/User"/>
</service>
</component>
</composite>

View file

@ -1,22 +0,0 @@
<style type="text/css">
html, body {
height:100%;
margin:0;
overflow:hidden;
width:100%;
}
.header {
font-size:13px;
text-align:right;
color:#CCCCCC;
padding:5px 5px 0;
padding-right:8px;
padding-top:0px !important;
padding-bottom: 0px;
border-bottom: 1px solid black;
}
</style>

View file

@ -1,194 +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.
-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Online Store - Powered by Apache Tuscany</title>
<link href="store.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="dojo/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.rpc.JsonService");
</script>
<script language="JavaScript">
var userServices = new dojo.rpc.JsonService("/User?smd");
var catalog = new dojo.rpc.JsonService("/Catalog?smd");
var shoppingCart = new dojo.rpc.JsonService("/ShoppingCart?smd");
var userContext;
var catalogItems;
function showHeader() {
var userContextCallback = function(context) {
userContext = context;
//alert(userContext.userId + " --> " + userContext.loginUrl);
var html='';
if(! userContext.userId) {
html = "<a href='" + userContext.loginUrl +"'>Login</a>";
} else {
html = userContext.email + " | <a href='" + userContext.logoutUrl +"'> Logout</a>";
}
document.getElementById('appHeader').innerHTML = html;
}
userServices.getUserContext(document.URL, "").addCallback(userContextCallback);
}
function showCatalogs() {
var catalogCallback = function(items) {
var catalog = "";
for (var i=0; i<items.length; i++) {
var item = items[i].name + ' - ' + items[i].currencySymbol + items[i].price;
catalog += '<input name="items" type="checkbox" value="' +
item + '">' + item + ' <br>';
}
document.getElementById('catalog').innerHTML=catalog;
catalogItems = items;
}
catalog.get().addCallback(catalogCallback);
}
// This handles the response from shoppingCart.getAll
// which is a collection of Entry<K,D>
function shoppingCart_getResponse(items) {
var list='';
for (var i=0; i<items.length; i++) {
//get the actual item, that is Entry.data
var item = items[i].data;
// process its attributes
var name = item.name;
var symbol = item.currencySymbol;
var price = item.price
list += name + ' - ' + symbol + price + ' <br>';
}
document.getElementById("shoppingCart").innerHTML = list;
if (items.length != 0) {
try {
shoppingCart.getTotal().addCallback(shoppingCart_getTotalResponse);
}
catch(e){
alert(e);
}
}
}
function shoppingCart_getTotalResponse(total,exception) {
if(exception) {
alert(exception.message);
return;
}
document.getElementById('total').innerHTML = total;
}
function shoppingCart_postResponse(entry) {
shoppingCart.getAll().addCallback(shoppingCart_getResponse);
}
function addToCart() {
var items = document.catalogForm.items;
var j = 0;
for (var i=0; i<items.length; i++)
if (items[i].checked) {
shoppingCart.post("", catalogItems[i]).addCallback(shoppingCart_postResponse);
items[i].checked = false;
}
}
function checkoutCart() {
document.getElementById('store').innerHTML='<h2>' +
'Thanks for Shopping With Us!</h2>'+
'<h2>Your Order</h2>'+
'<form name="orderForm">'+
document.getElementById('shoppingCart').innerHTML+
'<br>'+
document.getElementById('total').innerHTML+
'<br>'+
'<br>'+
'<input type="submit" value="Continue Shopping">'+
'</form>';
shoppingCart.delete("");
}
function deleteCart() {
shoppingCart.delete("");
document.getElementById('shoppingCart').innerHTML = "";
document.getElementById('total').innerHTML = "";
}
function init() {
try {
showHeader();
showCatalogs();
shoppingCart.getAll().addCallback(shoppingCart_getResponse);
} catch (e) {
alert(e);
}
}
</script>
</head>
<body onload="init()">
<div id="appHeader" class="header">
</div>
<h1>Store</h1>
<div id="store">
<h2>Catalog</h2>
<form name="catalogForm">
<div id="catalog" ></div>
<br>
<input type="button" onClick="addToCart()" value="Add to Cart">
</form>
<br>
<h2>Your Shopping Cart</h2>
<form name="shoppingCartForm">
<div id="shoppingCart"></div>
<br>
<div id="total"></div>
<br>
<input type="button" onClick="checkoutCart()" value="Checkout">
<input type="button" onClick="deleteCart()" value="Empty">
</form>
</div>
</body>
</html>

View file

@ -1,18 +0,0 @@
Manifest-Version: 1.0
Export-Package: services
Tool: Bnd-0.0.357
Bundle-Name: Apache Tuscany SCA Cloud Store Tutorial Assets
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.0",
org.apache.tuscany.sca.cloud.user;version="2.0.0",
org.apache.tuscany.sca.data.collection;version="2.0.0",
services
Bundle-SymbolicName: org.apache.tuscany.sca.store.assets
Bundle-DocURL: http://www.apache.org/

View file

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>store-assets</artifactId>
<version>2.0-SNAPSHOT</version>
<name>Apache Tuscany SCA Cloud store common assets</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-cloud-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-cloud-google</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View file

@ -1,28 +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 services;
import org.apache.tuscany.sca.data.collection.Collection;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface Cart extends Collection<String, Item> {
}

View file

@ -1,27 +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 services;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface Catalog {
Item[] get();
}

View file

@ -1,66 +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 services;
import org.oasisopen.sca.annotation.Property;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Scope;
import org.oasisopen.sca.annotation.Service;
@Service(Catalog.class)
@Scope("COMPOSITE")
public class CatalogAggregatorImpl implements Catalog {
@Property
public String currencyCode = "USD";
@Reference
public CurrencyConverter currencyConverter;
@Reference
public Catalog fruitsCatalog;
@Reference
public Catalog vegetablesCatalog;
public Item[] get() {
String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
Item[] fruits = fruitsCatalog.get();
Item[] vegetables = vegetablesCatalog.get();
Item[] catalog = new Item[fruits.length + vegetables.length];
int i =0;
for (Item item: fruits) {
double price = item.getPrice();
price = currencyConverter.getConversion("USD", currencyCode, price);
catalog[i++] = new Item(item.getName(), currencyCode, currencySymbol, price);
}
for (Item item: vegetables) {
double price = item.getPrice();
price = currencyConverter.getConversion("USD", currencyCode, price);
catalog[i++] = new Item(item.getName(), currencyCode, currencySymbol, price);
}
return catalog;
}
}

View file

@ -1,31 +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 services;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface CurrencyConverter {
public double getConversion(String fromCurrenycCode,
String toCurrencyCode,
double amount);
public String getCurrencySymbol(String currencyCode);
}

View file

@ -1,43 +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 services;
import org.oasisopen.sca.annotation.Service;
@Service(CurrencyConverter.class)
public class CurrencyConverterImpl implements CurrencyConverter {
public double getConversion(String fromCurrencyCode,
String toCurrencyCode,
double amount) {
if (toCurrencyCode.equals("USD"))
return amount;
else if (toCurrencyCode.equals("EUR"))
return ((double)Math.round(amount * 0.7256 * 100)) /100;
return 0;
}
public String getCurrencySymbol(String currencyCode) {
if (currencyCode.equals("USD"))
return "$";
else if (currencyCode.equals("EUR"))
return "E"; //"";
return "?";
}
}

View file

@ -1,36 +0,0 @@
package services;
import java.util.ArrayList;
import java.util.List;
import org.oasisopen.sca.annotation.Init;
import org.oasisopen.sca.annotation.Property;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Scope;
import org.oasisopen.sca.annotation.Service;
@Service(Catalog.class)
@Scope("COMPOSITE")
public class FruitsCatalogImpl implements Catalog {
@Property
public String currencyCode = "USD";
@Reference
public CurrencyConverter currencyConverter;
private List<Item> catalog = new ArrayList<Item>();
@Init
public void init() {
String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
catalog.add(new Item("Apple", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 2.99)));
catalog.add(new Item("Orange", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 3.55)));
catalog.add(new Item("Pear", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 1.55)));
}
public Item[] get() {
Item[] catalogArray = new Item[catalog.size()];
catalog.toArray(catalogArray);
return catalogArray;
}
}

View file

@ -1,73 +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 services;
import java.io.Serializable;
public class Item implements Serializable {
private static final long serialVersionUID = -5847326138627338217L;
private String name;
private String currencyCode;
private String currencySymbol;
private double price;
public Item() {
}
public Item(String name, String currencyCode, String currencySymbol, double price) {
this.name = name;
this.currencyCode = currencyCode;
this.currencySymbol = currencySymbol;
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCurrencyCode() {
return this.currencyCode;
}
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
public String getCurrencySymbol() {
return this.currencySymbol;
}
public void setCurrencySymbol(String currencySymbol) {
this.currencySymbol = currencySymbol;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}

View file

@ -1,27 +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 services;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface ShoppingCart extends Cart, Total{
}

View file

@ -1,109 +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 services;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Logger;
import org.apache.tuscany.sca.data.collection.Entry;
import org.apache.tuscany.sca.data.collection.NotFoundException;
import org.oasisopen.sca.annotation.Scope;
@Scope("COMPOSITE")
public class ShoppingCartImpl implements ShoppingCart {
private static final Logger log = Logger.getLogger(ShoppingCartImpl.class.getName());
//private DatastoreDocumentServiceImpl cart = new DatastoreDocumentServiceImpl();
private Map<String, Item> cart = new HashMap<String, Item>();
public Entry<String, Item>[] getAll() {
Entry<String, Item>[] entries = new Entry[cart.size()];
int i = 0;
for (Map.Entry<String, Item> e: cart.entrySet()) {
entries[i++] = new Entry<String, Item>(e.getKey(), e.getValue());
}
return entries;
}
public Item get(String key) throws NotFoundException {
Item item = cart.get(key);
if (item == null) {
throw new NotFoundException(key);
} else {
return item;
}
}
public String post(String key, Item item) {
if (key == null || key.length() == 0) {
key ="cart-" + UUID.randomUUID().toString();
}
cart.put(key, item);
return key;
}
public void put(String key, Item item) throws NotFoundException {
if (!cart.containsKey(key)) {
throw new NotFoundException(key);
}
cart.put(key, item);
}
public void delete(String key) throws NotFoundException {
if (key == null || key.equals("")) {
cart.clear();
} else {
Item item = cart.remove(key);
if (item == null)
throw new NotFoundException(key);
}
}
public Entry<String, Item>[] query(String queryString) {
List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
if (queryString.startsWith("name=")) {
String name = queryString.substring(5);
for (Map.Entry<String, Item> e: cart.entrySet()) {
Item item = e.getValue();
if (item.getName().equals(name)) {
entries.add(new Entry<String, Item>(e.getKey(), e.getValue()));
}
}
}
return entries.toArray(new Entry[entries.size()]);
}
public String getTotal() {
double total = 0;
String currencySymbol = "";
if (!cart.isEmpty()) {
Item item = cart.values().iterator().next();
currencySymbol = item.getCurrencySymbol();
}
for (Item item : cart.values()) {
total += item.getPrice();
}
return currencySymbol + String.valueOf(total);
}
}

View file

@ -1,114 +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 services;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Logger;
import org.apache.tuscany.sca.cloud.user.User;
import org.apache.tuscany.sca.cloud.user.UserService;
import org.apache.tuscany.sca.data.collection.Entry;
import org.apache.tuscany.sca.data.collection.NotFoundException;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Scope;
@Scope("COMPOSITE")
public class ShoppingCartManager implements ShoppingCart {
private static final Logger log = Logger.getLogger(ShoppingCartManager.class.getName());
private static String ANONYMOUS = "anonymous";
private Map<String, ShoppingCart> carts = new HashMap<String, ShoppingCart>();
@Reference
private UserService userService;
public Entry<String, Item>[] getAll() {
return getUserShoppingCart().getAll();
}
public Item get(String key) throws NotFoundException {
return getUserShoppingCart().get(key);
}
public String post(String key, Item item) {
if (key == null || key.length() == 0) {
key = this.generateItemKey();
}
return getUserShoppingCart().post(key, item);
}
public void put(String key, Item item) throws NotFoundException {
getUserShoppingCart().put(key,item);
}
public Entry<String, Item>[] query(String queryString) {
return getUserShoppingCart().query(queryString);
}
public void delete(String key) throws NotFoundException {
this.getUserShoppingCart().delete(key);
}
public String getTotal() {
return this.getUserShoppingCart().getTotal();
}
/**
* Utility functions
*/
private ShoppingCart getUserShoppingCart() {
String key = getCartKey();
ShoppingCart userCart = carts.get(key);
if(userCart == null) {
userCart = new ShoppingCartImpl();
carts.put(key, userCart);
}
return userCart;
}
private String getUserId() {
String userId = null;
if(userService != null) {
try {
User user = userService.getCurrentUser();
userId = user.getUserId();
} catch(Exception e) {
//ignore
e.printStackTrace();
}
}
if(userId == null || userId.length() == 0) {
userId = ANONYMOUS;
}
return userId;
}
private String getCartKey() {
String cartKey = "cart-" + this.getUserId();
return cartKey;
}
private String generateItemKey() {
String itemKey = getCartKey() + "-item-" + UUID.randomUUID().toString();
return itemKey;
}
}

View file

@ -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 services;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface Total {
String getTotal();
}

View file

@ -1,52 +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 services;
import java.util.ArrayList;
import java.util.List;
import org.oasisopen.sca.annotation.Init;
import org.oasisopen.sca.annotation.Property;
import org.oasisopen.sca.annotation.Reference;
public class VegetablesCatalogImpl implements Catalog {
@Property
public String currencyCode = "USD";
@Reference
public CurrencyConverter currencyConverter;
private List<Item> catalog = new ArrayList<Item>();
@Init
public void init() {
String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode);
catalog.add(new Item("Broccoli", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 2.99)));
catalog.add(new Item("Asparagus", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 3.55)));
catalog.add(new Item("Cauliflower", currencyCode, currencySymbol, currencyConverter.getConversion("USD", currencyCode, 1.55)));
}
public Item[] get() {
Item[] catalogArray = new Item[catalog.size()];
catalog.toArray(catalogArray);
return catalogArray;
}
}

View file

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:store="http://store">
<export.java package="services" />
</contribution>

View file

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>store-catalog-appengine-webapp</artifactId>
<packaging>war</packaging>
<name>Apache Tuscany Store Catalog Service</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>store-assets</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-webapp</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-jaxb</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-interface-java-jaxws</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<sourceIncludes>
<sourceInclude>**/*</sourceInclude>
</sourceIncludes>
<projectnatures>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
<projectnature>com.google.gdt.eclipse.core.webAppNature</projectnature>
</projectnatures>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>com.google.appengine.eclipse.core.enhancerbuilder</buildcommand>
<buildcommand>com.google.appengine.eclipse.core.projectValidator</buildcommand>
<buildcommand>com.google.gdt.eclipse.core.webAppProjectValidator</buildcommand>
</buildcommands>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>war/WEB-INF/lib</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,22 +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.
*/
public class Workaround {
}

View file

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:store="http://store">
<deployable composite="store:catalog"/>
</contribution>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>tuscany-store-catalog</application>
<version>3</version>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>

View file

@ -1,29 +0,0 @@
# A default java.util.logging configuration.
# (All App Engine logging is through java.util.logging by default).
#
# To use this configuration, copy it into your application's WEB-INF
# folder and add the following to your appengine-web.xml:
#
# <system-properties>
# <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
# </system-properties>
#
# Set the default logging level for all loggers to WARNING
.level = WARNING
# Set the default logging level for ORM, specifically, to WARNING
DataNucleus.JDO.level=WARNING
DataNucleus.Persistence.level=WARNING
DataNucleus.Cache.level=WARNING
DataNucleus.MetaData.level=WARNING
DataNucleus.General.level=WARNING
DataNucleus.Utility.level=WARNING
DataNucleus.Transaction.level=WARNING
DataNucleus.Datastore.level=WARNING
DataNucleus.ClassLoading.level=WARNING
DataNucleus.Plugin.level=WARNING
DataNucleus.ValueGeneration.level=WARNING
DataNucleus.Enhancer.level=WARNING
DataNucleus.SchemaTool.level=WARNING
log4j.category.org.apache.tuscany=ALL,A1

View file

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Tuscany Filter -->
<filter>
<filter-name>tuscany</filter-name>
<filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>tuscany</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:store="http://store"
targetNamespace="http://store"
name="catalog">
<component name="Catalog">
<implementation.java class="services.FruitsCatalogImpl"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<interface.java interface="services.Catalog"/>
<tuscany:binding.jsonrpc uri="/Catalog"/>
</service>
<reference name="currencyConverter" target="CurrencyConverter" />
</component>
<component name="CurrencyConverter">
<implementation.java class="services.CurrencyConverterImpl" />
<service name="CurrencyConverter">
<interface.java interface="services.CurrencyConverter"/>
</service>
</component>
</composite>

View file

@ -1,33 +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.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tuscany Store Scenario</title>
</head>
<body>
<h2>Tuscany Store Catalog Service</h2>
</br>
</br>
Catalog Service Definition available at : <a href="Catalog?smd">Store Catalog Service - JSON-RPC SMD</a>
</body>
</html>

View file

@ -1,28 +0,0 @@
Store Sample
======================================
This is a sample store scenario that is used as a getting started guide
for Tuscany SCA. For detailed information, please see:
http://tuscany.apache.org/getting-started-with-tuscany.html
or
http://tuscany.apache.org/getting-started-with-tuscany-using-tuscany-eclipse-plugin.html
Building And Running The Sample Using Ant
-----------------------------------------
With the binary distribution the sample can be built using Ant as follows:
cd store
ant compile
and then, to run:
ant run
Once the store application is running use your browser to visit the following
URL:
http://localhost:8080/store/

View file

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>store-catalog-ibmcloud-webapp</artifactId>
<packaging>war</packaging>
<name>Apache Tuscany SCA Store Catalog as WebApp</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>store-assets</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-webapp</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.3.04</version>
<scope>provided</scope>
</dependency>
<!--
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-stax-api_1.0_spec</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.4</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.1</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
</dependencies>
<build>
<finalName>${artifactId}</finalName>
</build>
</project>

View file

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:store="http://store"
targetNamespace="http://store"
name="catalog">
<component name="Catalog">
<implementation.java class="services.VegetablesCatalogImpl"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<interface.java interface="services.Catalog"/>
<tuscany:binding.jsonrpc uri="/Catalog"/>
</service>
<reference name="currencyConverter" target="CurrencyConverter"/>
</component>
<component name="CurrencyConverter">
<implementation.java class="services.CurrencyConverterImpl"/>
<service name="CurrencyConverter">
<interface.java interface="services.CurrencyConverter"/>
</service>
</component>
</composite>

View file

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:store="http://store">
<deployable composite="store:catalog"/>
</contribution>

View file

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<web:web-app
xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"
xmlns:lc="http://geronimo.apache.org/xml/ns/loginconfig-2.0"
xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2"
xmlns:pers="http://java.sun.com/xml/ns/persistence"
xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment>
<dep:moduleId>
<dep:groupId>org.apache.tuscany</dep:groupId>
<dep:artifactId>store-catalog-ibmcloud-webapp</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>car</dep:type>
</dep:moduleId>
<!-- TUSCANY-2622 -->
<dep:hidden-classes>
<dep:filter>org.apache.axiom</dep:filter>
<dep:filter>org.apache.axis2</dep:filter>
<dep:filter>org.apache.commons</dep:filter>
<dep:filter>org.jdom</dep:filter>
</dep:hidden-classes>
</dep:environment>
<web:context-root>/store-catalog-ibmcloud-webapp</web:context-root>
</web:web-app>

View file

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>store-catalog-ibmcloud-webapp</display-name>
<filter>
<filter-name>tuscany</filter-name>
<filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>tuscany</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list id="WelcomeFileList">
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

View file

@ -1,14 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tuscany Store Scenario - IBM Cloud</title>
</head>
<body>
<h2>Tuscany Store Catalog Service</h2>
</br>
</br>
Catalog Service Definition available at : <a href="Catalog?smd">Store Catalog Service - JSON-RPC SMD</a>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,304 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
* 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.
-->
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1052.3622"
height="744.09448"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45.1"
sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\store"
sodipodi:docname="store.svg"
version="1.0"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="C:\simon\tuscany\java-head\sca\samples\store\store.png"
inkscape:export-xdpi="52.84"
inkscape:export-ydpi="52.84">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10000"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="538.06165"
inkscape:cy="341.69129"
inkscape:document-units="px"
inkscape:current-layer="g2997"
inkscape:window-width="1466"
inkscape:window-height="831"
inkscape:window-x="117"
inkscape:window-y="80" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g2997">
<rect
rx="14.335117"
ry="17.743465"
y="197.1973"
x="447.35422"
height="419.39099"
width="464.23727"
id="rect2067"
style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.28840661;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<flowRoot
id="flowRoot2954"
xml:space="preserve"
transform="translate(189.90868,1.0101522)"><flowRegion
id="flowRegion2956"><rect
y="212.66591"
x="281.42856"
height="61.42857"
width="170"
id="rect2958" /></flowRegion><flowPara
id="flowPara2171">store</flowPara></flowRoot> <rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.30182266;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2175"
width="118.21779"
height="111.27543"
x="491.60019"
y="247.75989"
rx="7.1507306"
ry="9.2311935" />
<flowRoot
xml:space="preserve"
id="flowRoot2177"
transform="translate(223.8585,41.670449)"><flowRegion
id="flowRegion2179"><rect
id="rect2181"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2183">ufs</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 474.29877,279.45598 L 507.63381,279.45598 L 513.69472,292.58796 L 506.62366,304.7098 L 474.29877,304.7098 L 481.87492,292.58796 L 474.29877,279.45598 z "
id="path2187" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2191"
width="115.66247"
height="85.862968"
x="493.07068"
y="503.27759"
rx="6.9961648"
ry="7.1230249" />
<flowRoot
xml:space="preserve"
id="flowRoot2193"
transform="translate(225.47992,297.33908)"><flowRegion
id="flowRegion2195"><rect
id="rect2197"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2199">ShoppingCart</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 475.92019,535.12461 L 509.25523,535.12461 L 515.31614,548.25659 L 508.24508,560.37843 L 475.92019,560.37843 L 483.49634,548.25659 L 475.92019,535.12461 z "
id="path2203" />
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2207"
width="115.66247"
height="85.862968"
x="761.44415"
y="391.31604"
rx="6.9961648"
ry="7.1230249" />
<flowRoot
xml:space="preserve"
id="flowRoot2209"
transform="translate(487.8534,185.37751)"><flowRegion
id="flowRegion2211"><rect
id="rect2213"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2215">CurrencyConverter</flowPara></flowRoot> <path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 744.29367,423.16304 L 777.62871,423.16304 L 783.68962,436.29502 L 776.61856,448.41686 L 744.29367,448.41686 L 751.86982,436.29502 L 744.29367,423.16304 z "
id="path2219" />
<rect
style="opacity:1;fill:#0064ff;fill-opacity:1;stroke:#000000;stroke-width:0.9612025;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2223"
width="104.08451"
height="113.17588"
x="138.37151"
y="350.1156"
rx="0"
ry="0.048917599" />
<path
style="fill:#1a73fe;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
d="M 138.21429,462.66591 L 115.35714,479.80877 L 267.85714,479.80877 L 241.78571,463.02305 L 138.21429,462.66591 z "
id="path3197" />
<rect
style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect3199"
width="92.5"
height="97.14286"
x="143.57143"
y="358.38019"
ry="3.6203461"
rx="3.9285715" />
<image
y="366.6889"
x="156.24066"
id="image3323"
height="78.571434"
width="58.57143"
sodipodi:absref="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png"
xlink:href="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png" />
<image
y="270.52304"
x="526.42859"
id="image3342"
height="78.571434"
width="58.57143"
sodipodi:absref="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png"
xlink:href="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 242.85714,374.80877 C 245.71429,374.80877 345.71429,374.80877 345.71429,374.80877 L 345.71429,291.95162 L 481.42858,291.95162"
id="path3348"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 210.71429,406.95163 L 345,406.95163 L 345,437.66591 L 481.42857,437.66591"
id="path3350"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 210.71429,439.09448 L 325.71429,439.09448 L 325.71429,548.3802 L 482.85714,548.3802"
id="path3352"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 626.42857,436.23734 C 750,437.66591 752.14286,436.23734 752.14286,436.23734"
id="path3354"
sodipodi:nodetypes="cc" />
<flowRoot
xml:space="preserve"
id="flowRoot3356"
transform="translate(-94.285714,25)"><flowRegion
id="flowRegion3358"><rect
id="rect3360"
width="142.14285"
height="21.428572"
x="655"
y="349.80878" /></flowRegion><flowPara
id="flowPara3362">CurrenyCode</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3364"
transform="translate(-250.76562,-76.210859)"><flowRegion
id="flowRegion3366"><rect
id="rect3368"
width="142.14285"
height="21.428572"
x="655"
y="349.80878" /></flowRegion><flowPara
id="flowPara3370">HTTP</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3372"
transform="translate(-273.62277,70.931998)"><flowRegion
id="flowRegion3374"><rect
id="rect3376"
width="142.14285"
height="21.428572"
x="655"
y="349.80878" /></flowRegion><flowPara
id="flowPara3378">JSONRPC</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3380"
transform="translate(-243.62277,183.07485)"><flowRegion
id="flowRegion3382"><rect
id="rect3384"
width="142.14285"
height="21.428572"
x="655"
y="349.80878" /></flowRegion><flowPara
id="flowPara3386">Atom</flowPara></flowRoot> </g>
<rect
style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2988"
width="115.66247"
height="85.862968"
x="491.56897"
y="392.70135"
rx="6.9961648"
ry="7.1230249" />
<flowRoot
xml:space="preserve"
id="flowRoot2966"
transform="translate(223.97819,186.76283)"><flowRegion
id="flowRegion2968"><rect
id="rect2970"
width="170"
height="61.42857"
x="281.42856"
y="212.66591" /></flowRegion><flowPara
id="flowPara2972">Catalog</flowPara></flowRoot> <rect
style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect3006"
width="21.718224"
height="20.708065"
x="537.53094"
y="377.04398"
rx="10.859112"
ry="0" />
<path
style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 474.41846,424.54836 L 507.7535,424.54836 L 513.81441,437.68034 L 506.74335,449.80218 L 474.41846,449.80218 L 481.99461,437.68034 L 474.41846,424.54836 z "
id="path3017" />
<path
style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 587.6709,422.71008 L 621.00594,422.71008 L 627.06685,435.84206 L 619.99579,447.9639 L 587.6709,447.9639 L 595.24705,435.84206 L 587.6709,422.71008 z "
id="path3019" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 13 KiB

View file

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project name="DojoZipInstaller">
<property name="dojo.version" value="1.3.0"/>
<property name="unpack.location" value="${basedir}/war/dojo"/>
<target name="check-dojo-installed">
<condition property="already.installed" >
<available file="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
</condition>
<condition property="maven.suffix" value="">
<os family="unix"/>
</condition>
<condition property="maven.suffix" value=".bat">
<os family="windows"/>
</condition>
</target>
<target name="check-dojo-unpacked">
<condition property="already.unpacked" >
<available file="${unpack.location}"/>
</condition>
</target>
<target name="install-dojo" depends="check-dojo-installed" unless="already.installed">
<mkdir dir="${basedir}/target/dojo-download/"/>
<get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
verbose="true"
usetimestamp="true"/>
<exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
<arg line="install:install-file -DgroupId=dojo -DartifactId=dojo -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"/>
</exec>
</target>
<target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
<mkdir dir="${basedir}/target/dojo-download/"/>
<get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
verbose="true"
usetimestamp="true"/>
<copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
tofile="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
</target>
<target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
<fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
<mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
<unzip src="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"
dest="${basedir}/target/dojo-unpack-temp/"
overwrite="false">
<patternset>
<include name="dojo-release-${dojo.version}/dojo/**"/>
<exclude name="dojo-release-${dojo.version}/dojo/tests/**"/>
<include name="dojo-release-${dojo.version}/dijit/**"/>
<exclude name="dojo-release-${dojo.version}/dojox/**"/>
<exclude name="dojo-release-${dojo.version}/util/**"/>
</patternset>
</unzip>
<move file="${basedir}/target/dojo-unpack-temp/dojo-release-${dojo.version}"
tofile="${unpack.location}"
verbose="true"/>
<delete dir="${basedir}/target/dojo-unpack-temp/"/>
</target>
<target name="clean-dojo-files">
<delete dir="${unpack.location}"/>
</target>
</project>

View file

@ -1,216 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>store-merger-appengine-webapp</artifactId>
<packaging>war</packaging>
<name>Apache Tuscany Store</name>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>store-assets</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-cloud-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-cloud-google</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-java-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-host-webapp</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-databinding-jaxb</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-interface-java-jaxws</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<sourceIncludes>
<sourceInclude>**/*</sourceInclude>
</sourceIncludes>
<projectnatures>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
<projectnature>com.google.gdt.eclipse.core.webAppNature</projectnature>
</projectnatures>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>com.google.appengine.eclipse.core.enhancerbuilder</buildcommand>
<buildcommand>com.google.appengine.eclipse.core.projectValidator</buildcommand>
<buildcommand>com.google.gdt.eclipse.core.webAppProjectValidator</buildcommand>
</buildcommands>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<!-- version>1.1</version -->
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-trax</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>install-dojo</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="install-dojo">
<property name="localRepository" value="${settings.localRepository}" />
</ant>
</tasks>
</configuration>
</execution>
<execution>
<id>copy-dojo-files</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="unpack-dojo-files">
<property name="localRepository" value="${settings.localRepository}" />
<property name="artifactId" value="${artifactId}" />
</ant>
</tasks>
</configuration>
</execution>
<execution>
<id>clean-dojo-files</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant antfile="./build-dojo.xml" target="clean-dojo-files">
<property name="localRepository" value="${settings.localRepository}" />
<property name="artifactId" value="${artifactId}" />
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>war/WEB-INF/lib</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,22 +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.
*/
public class Workaround {
}

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:store="http://store">
<deployable composite="store:catalog" />
<!-- import.java package="services" / -->
</contribution>

View file

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* 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.
-->
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>tuscany-store-merger</application>
<version>1</version>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>

View file

@ -1,37 +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.
#
#
# A default java.util.logging configuration.
# (All App Engine logging is through java.util.logging by default).
#
# To use this configuration, copy it into your application's WEB-INF
# folder and add the following to your appengine-web.xml:
#
# <system-properties>
# <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
# </system-properties>
#
# Set the default logging level for all loggers to WARNING
.level = WARNING
#tuscany debug messages
org.apache.tuscany.level = WARNING

View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Tuscany Filter -->
<filter>
<filter-name>tuscany</filter-name>
<filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>tuscany</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>store.html</welcome-file>
</welcome-file-list>
</web-app>

View file

@ -1,28 +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.
#
#
# Configure the console as our one appender
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n
#tuscany debug messages
log4j.category.org.apache.tuscany=ALL,A1

View file

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:s="http://store"
targetNamespace="http://store"
name="catalog">
<component name="CatalogAggregator">
<implementation.java class="services.CatalogAggregatorImpl"/>
<property name="currencyCode">USD</property>
<service name="Catalog">
<interface.java interface="services.Catalog"/>
<tuscany:binding.jsonrpc uri="/Catalog"/>
</service>
<reference name="fruitsCatalog">
<interface.java interface="services.Catalog"/>
<tuscany:binding.jsonrpc uri="http://tuscany-store-catalog.appspot.com/Catalog"/>
</reference>
<reference name="vegetablesCatalog">
<interface.java interface="services.Catalog"/>
<tuscany:binding.jsonrpc uri="http://tuscany.figueiredos.com/store-catalog-ibmcloud-webapp/Catalog"/>
</reference>
<reference name="currencyConverter" target="CurrencyConverter" />
</component>
<component name="CurrencyConverter">
<implementation.java class="services.CurrencyConverterImpl" />
<service name="CurrencyConverter">
<interface.java interface="services.CurrencyConverter"/>
</service>
</component>
<component name="ShoppingCartManager">
<implementation.java class="services.ShoppingCartManager"/>
<service name="ShoppingCart">
<tuscany:binding.jsonrpc uri="/ShoppingCart"/>
</service>
<reference name="userService" target="UserService">
<binding.sca name="local"/>
</reference>
</component>
<component name="UserService">
<implementation.java class="org.apache.tuscany.sca.cloud.user.impl.GoogleUserService"/>
<service name="UserService">
<binding.sca name="local"/>
<tuscany:binding.jsonrpc uri="/User"/>
</service>
</component>
</composite>

View file

@ -1,22 +0,0 @@
<style type="text/css">
html, body {
height:100%;
margin:0;
overflow:hidden;
width:100%;
}
.header {
font-size:13px;
text-align:right;
color:#CCCCCC;
padding:5px 5px 0;
padding-right:8px;
padding-top:0px !important;
padding-bottom: 0px;
border-bottom: 1px solid black;
}
</style>

View file

@ -1,194 +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.
-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Online Store - Powered by Apache Tuscany</title>
<link href="store.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="dojo/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.rpc.JsonService");
</script>
<script language="JavaScript">
var userServices = new dojo.rpc.JsonService("/User?smd");
var catalog = new dojo.rpc.JsonService("/Catalog?smd");
var shoppingCart = new dojo.rpc.JsonService("/ShoppingCart?smd");
var userContext;
var catalogItems;
function showHeader() {
var userContextCallback = function(context) {
userContext = context;
//alert(userContext.userId + " --> " + userContext.loginUrl);
var html='';
if(! userContext.userId) {
html = "<a href='" + userContext.loginUrl +"'>Login</a>";
} else {
html = userContext.email + " | <a href='" + userContext.logoutUrl +"'> Logout</a>";
}
document.getElementById('appHeader').innerHTML = html;
}
userServices.getUserContext(document.URL, "").addCallback(userContextCallback);
}
function showCatalogs() {
var catalogCallback = function(items) {
var catalog = "";
for (var i=0; i<items.length; i++) {
var item = items[i].name + ' - ' + items[i].currencySymbol + items[i].price;
catalog += '<input name="items" type="checkbox" value="' +
item + '">' + item + ' <br>';
}
document.getElementById('catalog').innerHTML=catalog;
catalogItems = items;
}
catalog.get().addCallback(catalogCallback);
}
// This handles the response from shoppingCart.getAll
// which is a collection of Entry<K,D>
function shoppingCart_getResponse(items) {
var list='';
for (var i=0; i<items.length; i++) {
//get the actual item, that is Entry.data
var item = items[i].data;
// process its attributes
var name = item.name;
var symbol = item.currencySymbol;
var price = item.price
list += name + ' - ' + symbol + price + ' <br>';
}
document.getElementById("shoppingCart").innerHTML = list;
if (items.length != 0) {
try {
shoppingCart.getTotal().addCallback(shoppingCart_getTotalResponse);
}
catch(e){
alert(e);
}
}
}
function shoppingCart_getTotalResponse(total,exception) {
if(exception) {
alert(exception.message);
return;
}
document.getElementById('total').innerHTML = total;
}
function shoppingCart_postResponse(entry) {
shoppingCart.getAll().addCallback(shoppingCart_getResponse);
}
function addToCart() {
var items = document.catalogForm.items;
var j = 0;
for (var i=0; i<items.length; i++)
if (items[i].checked) {
shoppingCart.post("", catalogItems[i]).addCallback(shoppingCart_postResponse);
items[i].checked = false;
}
}
function checkoutCart() {
document.getElementById('store').innerHTML='<h2>' +
'Thanks for Shopping With Us!</h2>'+
'<h2>Your Order</h2>'+
'<form name="orderForm">'+
document.getElementById('shoppingCart').innerHTML+
'<br>'+
document.getElementById('total').innerHTML+
'<br>'+
'<br>'+
'<input type="submit" value="Continue Shopping">'+
'</form>';
shoppingCart.delete("");
}
function deleteCart() {
shoppingCart.delete("");
document.getElementById('shoppingCart').innerHTML = "";
document.getElementById('total').innerHTML = "";
}
function init() {
try {
showHeader();
showCatalogs();
shoppingCart.getAll().addCallback(shoppingCart_getResponse);
} catch (e) {
alert(e);
}
}
</script>
</head>
<body onload="init()">
<div id="appHeader" class="header">
</div>
<h1>Store</h1>
<div id="store">
<h2>Catalog</h2>
<form name="catalogForm">
<div id="catalog" ></div>
<br>
<input type="button" onClick="addToCart()" value="Add to Cart">
</form>
<br>
<h2>Your Shopping Cart</h2>
<form name="shoppingCartForm">
<div id="shoppingCart"></div>
<br>
<div id="total"></div>
<br>
<input type="button" onClick="checkoutCart()" value="Checkout">
<input type="button" onClick="deleteCart()" value="Empty">
</form>
</div>
</body>
</html>