summaryrefslogtreecommitdiffstats
path: root/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient')
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java57
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java27
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java36
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java68
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java45
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java125
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java87
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java100
-rw-r--r--tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java67
9 files changed, 0 insertions, 612 deletions
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java
deleted file mode 100644
index 3a9e7a4e60..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.services.account;
-
-import org.apache.tuscany.samples.bigbank.account.AccountFactory;
-import org.apache.tuscany.samples.bigbank.account.AccountReport;
-import org.apache.tuscany.samples.bigbank.account.services.account.AccountService;
-import org.apache.tuscany.sdo.util.SDOUtil;
-import org.osoa.sca.ServiceUnavailableException;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Service;
-
-/**
- */
-@Service(AccountService.class)
-public class AccountServiceComponentImpl implements AccountService {
-
- static {
- SDOUtil.registerStaticTypes(AccountFactory.class);
- }
-
- @Reference
- public AccountService accountService;
-
- /**
- *
- */
- public AccountServiceComponentImpl() {
- super();
- }
-
- /**
- * @see org.apache.tuscany.samples.bigbank.webclient.services.account.AccountService#getAccountReport(java.lang.String)
- */
- public AccountReport getAccountReport(String customerID) {
- try {
- return accountService.getAccountReport(customerID);
- } catch (Exception e) {
- throw new ServiceUnavailableException(e);
- }
- }
-
-}
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java
deleted file mode 100644
index 7bb660082d..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.services.profile;
-
-public interface LoginService {
-
- public static final int SUCCESS = 1;
- public static final int INVALID_LOGIN = -1;
- public static final int INVALID_PASSWORD = -2;
-
- public int login(String userName, String password);
-}
-
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java
deleted file mode 100644
index affbfe9700..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.services.profile;
-
-public interface ProfileService {
-
- public String getFirstName();
-
- public void setFirstName(String pName);
-
- public String getLastName();
-
- public void setLastName(String pName);
-
- public boolean isLoggedIn();
-
- public void setLoggedIn(boolean pStatus);
-
- public String getId();
-
- public void setId(String pId);
-}
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java
deleted file mode 100644
index 7d572154c6..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.services.profile;
-
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-@Service(ProfileService.class)
-@Scope("session")
-public class ProfileServiceImpl implements ProfileService {
-
- @Property
- private String firstName;
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- private String lastName;
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- private boolean loggedIn;
-
- public boolean isLoggedIn() {
- return loggedIn;
- }
-
- public void setLoggedIn(boolean status) {
- loggedIn = status;
- }
-
- private String id;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-}
-
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java
deleted file mode 100644
index 2689dc7020..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.services.profile;
-
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Service;
-
-@Service(LoginService.class)
-public class SimpleLoginServiceImpl implements LoginService {
-
- @Reference
- public ProfileService profileService;
-
- public int login(String userName, String password) {
-
- if (!"test".equals(userName)) {
- return INVALID_LOGIN;
- }
-
- if (!"password".equals(password)) {
- return INVALID_PASSWORD;
- }
-
- profileService.setLoggedIn(true);
- profileService.setFirstName("John");
- profileService.setLastName("Doe");
- profileService.setId("12345");
-
- return SUCCESS;
- }
-}
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java
deleted file mode 100644
index ecdb0c49b4..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.tags.account;
-
-import java.util.Iterator;
-import java.util.List;
-
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.TagSupport;
-
-import org.apache.tuscany.samples.bigbank.account.services.account.AccountService;
-import org.apache.tuscany.samples.bigbank.webclient.services.profile.ProfileService;
-import org.osoa.sca.CurrentModuleContext;
-import org.osoa.sca.ModuleContext;
-
-/**
- * Retrieves and iterates over account summary information for the current
- * profile by accessing the remotable account service component
- */
-
-public class AccountStatusTag extends TagSupport {
-
- // ----------------------------------
- // Constructors
- // ----------------------------------
-
- public AccountStatusTag() {
- super();
- }
-
- // ----------------------------------
- // Methods
- // ----------------------------------
-
- private String mAccountService;
-
- public String getAccountService() {
- return mAccountService;
- }
-
- public void setAccountService(String pAccountService) {
- mAccountService = pAccountService;
- }
-
- private String mProfileService;
-
- public String getProfileService() {
- return mProfileService;
- }
-
- public void setProfileService(String pProfileService) {
- mProfileService = pProfileService;
- }
-
- private String mId;
-
- public String getId() {
- return mId;
- }
-
- public void setId(String pId) {
- mId = pId;
- }
-
- private Iterator mIterator;
-
- public int doStartTag() throws JspException {
- ModuleContext moduleContext = CurrentModuleContext.getContext();
- ProfileService profile = (ProfileService) moduleContext
- .locateService(mProfileService);
- if (profile == null) {
- throw new JspException("Profile [" + mProfileService
- + "] not found in current module context");
- }
-
- AccountService service = (AccountService) moduleContext
- .locateService(mAccountService);
- if (service == null) {
- throw new JspException("Service [" + mAccountService
- + "] not found in current module context");
- }
- List summaries;
- try {
- summaries = service.getAccountReport(profile.getId()).getAccountSummaries();
- } catch (Exception e) {
- throw new JspException(e);
- }
- mIterator = summaries.iterator();
- if (mIterator.hasNext()) {
- pageContext.setAttribute(mId, mIterator.next());
- return EVAL_BODY_INCLUDE;
- } else {
- return SKIP_BODY;
- }
- }
-
- public int doAfterBody() {
- if (mIterator.hasNext()) {
- pageContext.setAttribute(mId, mIterator.next());
- return EVAL_BODY_AGAIN;
- } else {
- return SKIP_BODY;
- }
- }
-
- public void release() {
- super.release();
- mId = null;
- mIterator = null;
- }
-} \ No newline at end of file
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java
deleted file mode 100644
index 31fa27fa6f..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.tags.sca;
-
-import java.io.IOException;
-import javax.servlet.ServletException;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.TagSupport;
-
-import org.osoa.sca.CurrentModuleContext;
-import org.osoa.sca.ModuleContext;
-
-import org.apache.tuscany.samples.bigbank.webclient.services.profile.ProfileService;
-
-public class LoginBarrierTag extends TagSupport {
-
- public LoginBarrierTag() {
- super();
- }
-
- private String mProfile;
-
- public String getProfile() {
- return mProfile;
- }
-
- public void setProfile(String pProfile) {
- mProfile = pProfile;
- }
-
- private String mUrl;
-
- public String getUrl() {
- return mUrl;
- }
-
- public void setUrl(String pUrl) {
- mUrl = pUrl;
- }
-
- public int doStartTag() throws JspException {
- if (mProfile == null || mProfile.length() < 1) {
- throw new JspException("Invalid profile location specified");
- }
-
- ModuleContext moduleContext = CurrentModuleContext.getContext();
- ProfileService profile = (ProfileService) moduleContext.locateService(mProfile);
- if (profile == null) {
- throw new JspException("Profile [" + mProfile + "] not found in current module context");
- }
- if (profile.isLoggedIn()) {
- return EVAL_BODY_INCLUDE;
- } else {
- try {
- pageContext.forward(mUrl);
- return SKIP_BODY;
- } catch (ServletException e) {
- throw new JspException("Unable to forward to [" + mUrl + "]");
- } catch (IOException e) {
- throw new JspException("Unable to forward to [" + mUrl + "]");
- }
- }
- }
-
- public int doEndTag() throws JspException {
- return EVAL_PAGE;
- }
-
- public void release() {
- super.release();
- }
-
-}
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java
deleted file mode 100644
index df5697c11f..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.tags.sca;
-
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.TagSupport;
-
-import org.osoa.sca.CurrentModuleContext;
-import org.osoa.sca.ModuleContext;
-
-
-/**
- * Places an SCA service in the JSP page context, making it available to other
- * tags corresponding to its id value.
- */
-
-public class ServiceTag extends TagSupport {
-
- // ----------------------------------
- // Constructors
- // ----------------------------------
-
- public ServiceTag() {
- super();
- }
-
- // ----------------------------------
- // Methods
- // ----------------------------------
-
- private String mName;
-
- /**
- * Returns the name of the SCA service to import into the page context.
- */
- public String getName() {
- return mName;
- }
-
- /**
- * Sets name of the SCA service to import into the page context.
- */
- public void setName(String pName) {
- mName = pName;
- }
-
- private String mId;
-
- /**
- * Returns the id of the service in the page context
- */
- public String getId() {
- return mId;
- }
-
- /**
- * Sets the id of the service for the page context
- */
-
- public void setId(String pId) {
- mId = pId;
- }
-
- public int doStartTag() throws JspException {
- ModuleContext moduleContext = CurrentModuleContext.getContext();
- Object service = moduleContext.locateService(mName);
- if (service == null) {
- throw new JspException("Service [" + mName + "] not found in current module context");
- }
- if (mId == null) {
- // if the Id name was not specified, default to the basic name of the
- // service
- mId = mName;
- }
- pageContext.setAttribute(mId, service);
- return EVAL_BODY_INCLUDE;
- }
-
- public int doEndTag() throws JspException {
- return EVAL_PAGE;
- }
-
- public void release() {
- super.release();
- }
-} \ No newline at end of file
diff --git a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java b/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java
deleted file mode 100644
index 78bedbe4f7..0000000000
--- a/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed 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.samples.bigbank.webclient.ui;
-
-import java.io.IOException;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.tuscany.samples.bigbank.webclient.services.profile.LoginService;
-import org.osoa.sca.CurrentModuleContext;
-import org.osoa.sca.ModuleContext;
-
-
-public class LoginServlet extends HttpServlet {
-
- private ServletContext mContext;
-
- public void init(ServletConfig pCfg) throws ServletException {
- mContext = pCfg.getServletContext();
- }
-
- public void doPost(HttpServletRequest pReq, HttpServletResponse pResp) throws ServletException {
-
- ModuleContext moduleContext = CurrentModuleContext.getContext();
- LoginService loginMgr = (LoginService)
- moduleContext.locateService("LoginServiceComponent");
-
- if (loginMgr == null) {
- throw new ServletException("LoginManager not found");
- }
-
- String login = pReq.getParameter("login");
- String password = pReq.getParameter("password");
- try {
- if (login == null || password == null) {
- pResp.sendRedirect("summary.jsp");
- }
- int resp = loginMgr.login(login, password);
- if (resp == LoginService.SUCCESS) {
- mContext.getRequestDispatcher("/summary.jsp").forward(pReq, pResp);
- } else {
- mContext.getRequestDispatcher("/login.html").forward(pReq, pResp);
- }
- } catch (IOException e) {
- throw new ServletException(e);
- }
- }
-}