From 5f69a4a71cf0e76b61161839408721a2e40a2da7 Mon Sep 17 00:00:00 2001 From: lresende Date: Fri, 16 Oct 2009 02:57:40 +0000 Subject: Committing minor local changes to allow moving the location of the project git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@825751 13f79535-47bb-0310-9956-ffa450edef68 --- .../com.google.appengine.eclipse.core.prefs | 4 +- .../src/log4j.properties | 24 ----- .../src/org/apache/tuscany/expertise/Expert.java | 64 ------------- .../tuscany/expertise/restfull/ExpertRegistry.java | 35 ------- .../expertise/restfull/ExpertRegistryImpl.java | 92 ------------------ .../restfull/RestfulExpertiseLocator.java | 104 --------------------- .../src/rest.composite | 38 -------- 7 files changed, 2 insertions(+), 359 deletions(-) delete mode 100644 sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/log4j.properties delete mode 100644 sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/Expert.java delete mode 100644 sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/ExpertRegistry.java delete mode 100644 sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/ExpertRegistryImpl.java delete mode 100644 sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/RestfulExpertiseLocator.java delete mode 100644 sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/rest.composite (limited to 'sandbox/lresende') diff --git a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/.settings/com.google.appengine.eclipse.core.prefs b/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/.settings/com.google.appengine.eclipse.core.prefs index 4cb9799348..351c3205e5 100644 --- a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/.settings/com.google.appengine.eclipse.core.prefs +++ b/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/.settings/com.google.appengine.eclipse.core.prefs @@ -1,3 +1,3 @@ -#Mon Sep 21 17:52:18 PDT 2009 +#Thu Oct 15 18:16:29 PDT 2009 eclipse.preferences.version=1 -filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.2.5.jar|appengine-api-labs-1.2.5.jar|datanucleus-appengine-1.0.3.jar|datanucleus-core-1.1.5.jar|datanucleus-jpa-1.1.5.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-eb.jar +filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.2.6.jar|appengine-api-labs-1.2.6.jar|datanucleus-appengine-1.0.3.jar|datanucleus-core-1.1.5.jar|datanucleus-jpa-1.1.5.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-eb.jar diff --git a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/log4j.properties b/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/log4j.properties deleted file mode 100644 index d9c3edc9fe..0000000000 --- a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/log4j.properties +++ /dev/null @@ -1,24 +0,0 @@ -# A default log4j configuration for log4j users. -# -# To use this configuration, deploy it into your application's WEB-INF/classes -# directory. You are also encouraged to edit it as you like. - -# 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 - -# tighten logging on the DataNucleus Categories -log4j.category.DataNucleus.JDO=WARN, A1 -log4j.category.DataNucleus.Persistence=WARN, A1 -log4j.category.DataNucleus.Cache=WARN, A1 -log4j.category.DataNucleus.MetaData=WARN, A1 -log4j.category.DataNucleus.General=WARN, A1 -log4j.category.DataNucleus.Utility=WARN, A1 -log4j.category.DataNucleus.Transaction=WARN, A1 -log4j.category.DataNucleus.Datastore=WARN, A1 -log4j.category.DataNucleus.ClassLoading=WARN, A1 -log4j.category.DataNucleus.Plugin=WARN, A1 -log4j.category.DataNucleus.ValueGeneration=WARN, A1 -log4j.category.DataNucleus.Enhancer=WARN, A1 -log4j.category.DataNucleus.SchemaTool=WARN, A1 diff --git a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/Expert.java b/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/Expert.java deleted file mode 100644 index 61ac1c12b7..0000000000 --- a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/Expert.java +++ /dev/null @@ -1,64 +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.expertise; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -public class Expert implements Serializable { - private static final long serialVersionUID = 2026687637313310397L; - - private String id; - private String name; - private String location; - private List expertises = new ArrayList(); - - public Expert() { - - } - - 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 getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public List getExpertise() { - return this.expertises; - } -} diff --git a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/ExpertRegistry.java b/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/ExpertRegistry.java deleted file mode 100644 index 04dc7424a6..0000000000 --- a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/ExpertRegistry.java +++ /dev/null @@ -1,35 +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.expertise.restfull; - -import java.util.List; - -import org.apache.tuscany.expertise.Expert; - -public interface ExpertRegistry { - - void addExpert(Expert expert); - - void removeExpert(Expert expert); - - List getExperts(); - - List getExpertsByExpertise(String expertise); -} \ No newline at end of file diff --git a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/ExpertRegistryImpl.java b/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/ExpertRegistryImpl.java deleted file mode 100644 index 800dc101a0..0000000000 --- a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/ExpertRegistryImpl.java +++ /dev/null @@ -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.expertise.restfull; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.expertise.Expert; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Service; - -@Service(ExpertRegistry.class) -public class ExpertRegistryImpl implements ExpertRegistry { - private List experts = new ArrayList(); - - public ExpertRegistryImpl() { - - } - - @Init - public void init() { - Expert expert; - - expert = new Expert(); - expert.setId("1"); - expert.setName("John Smith"); - expert.setLocation("CA"); - expert.getExpertise().add("SOA"); - expert.getExpertise().add("SCA"); - expert.getExpertise().add("WAS"); - - experts.add(expert); - - expert = new Expert(); - expert.setId("2"); - expert.setName("Ken Johnson"); - expert.setLocation("NY"); - expert.getExpertise().add("Search"); - - experts.add(expert); - - expert = new Expert(); - expert.setId("3"); - expert.setName("Mark Smith"); - expert.setLocation("CA"); - expert.getExpertise().add("SCA"); - expert.getExpertise().add("WASCE"); - - experts.add(expert); - } - - public void addExpert(Expert expert) { - experts.add(expert); - } - - public void removeExpert(Expert expert) { - experts.remove(expert); - } - - public List getExperts() { - return experts; - } - - public List getExpertsByExpertise(String expertise) { - List expertsByExpertise = new ArrayList(); - - for (Expert expert : experts) { - if (expert.getExpertise().contains(expertise)) { - expertsByExpertise.add(expert); - } - } - - return expertsByExpertise; - } -} diff --git a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/RestfulExpertiseLocator.java b/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/RestfulExpertiseLocator.java deleted file mode 100644 index 73828c639f..0000000000 --- a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/org/apache/tuscany/expertise/restfull/RestfulExpertiseLocator.java +++ /dev/null @@ -1,104 +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.expertise.restfull; - -import java.io.IOException; -import java.net.URLDecoder; -import java.util.List; - -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.tuscany.expertise.Expert; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -@Service(Servlet.class) -@Scope("COMPOSITE") -public class RestfulExpertiseLocator extends HttpServlet implements Servlet { - - private static final long serialVersionUID = 4021701701436888369L; - - @Reference - protected ExpertRegistry experts; - - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String path = URLDecoder.decode(getRequestPath(request), "UTF-8"); - String expertise = path.substring(1); - - if (expertise != null && expertise.length() > 0 ) { - printExperts(response.getOutputStream(), experts.getExpertsByExpertise(expertise)); - } else { - printExperts(response.getOutputStream(), experts.getExperts()); - } - - } - - - private void printExperts(ServletOutputStream out, List experts) throws IOException { - out.print(""); - out.print("

Expertise Locator

"); - - if (experts.size() > 0) { - for (Expert expert: experts) { - out.print("Location: " + expert.getLocation() + " - " + expert.getName() +" ==> "); - for (String expertise : expert.getExpertise()) { - out.print(expertise + ";"); - } - out.print("
"); - } - } else { - out.println("No experts found"); - } - out.print(""); - } - - /** - * - * @param request - * @return - */ - private static String getRequestPath(HttpServletRequest request) { - // Get the request path - String contextPath = request.getContextPath(); - String servletPath = request.getServletPath(); - String requestURI = request.getRequestURI(); - - int contextPathLength = request.getContextPath().length(); - int servletPathLenght = servletPath.contains(contextPath) ? servletPath.length() - contextPath.length() : servletPath.length(); - - String requestPath = requestURI.substring(contextPathLength + servletPathLenght); - - if (requestURI.startsWith("/")) { - requestPath = requestPath.substring(1); - } - - return requestPath; - } - - -} diff --git a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/rest.composite b/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/rest.composite deleted file mode 100644 index 9e32209a18..0000000000 --- a/sandbox/lresende/sca/samples/expertise-rest-appengine-webapp/src/rest.composite +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3