diff options
Diffstat (limited to 'sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src')
19 files changed, 1238 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java new file mode 100644 index 0000000000..3a9e7a4e60 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/account/AccountServiceComponentImpl.java @@ -0,0 +1,57 @@ +/** + * + * 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/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java new file mode 100644 index 0000000000..7bb660082d --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/LoginService.java @@ -0,0 +1,27 @@ +/** + * + * 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/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java new file mode 100644 index 0000000000..affbfe9700 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileService.java @@ -0,0 +1,36 @@ +/** + * + * 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/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java new file mode 100644 index 0000000000..7d572154c6 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/ProfileServiceImpl.java @@ -0,0 +1,68 @@ +/** + * + * 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/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java new file mode 100644 index 0000000000..2689dc7020 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/services/profile/SimpleLoginServiceImpl.java @@ -0,0 +1,45 @@ +/** + * + * 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/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java new file mode 100644 index 0000000000..ecdb0c49b4 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/account/AccountStatusTag.java @@ -0,0 +1,125 @@ +/** + * + * 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/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java new file mode 100644 index 0000000000..31fa27fa6f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/LoginBarrierTag.java @@ -0,0 +1,87 @@ +/** + * + * 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/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java new file mode 100644 index 0000000000..df5697c11f --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/tags/sca/ServiceTag.java @@ -0,0 +1,100 @@ +/** + * + * 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/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java new file mode 100644 index 0000000000..78bedbe4f7 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/java/org/apache/tuscany/samples/bigbank/webclient/ui/LoginServlet.java @@ -0,0 +1,67 @@ +/** + * + * 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); + } + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.module b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.module new file mode 100644 index 0000000000..6b4b17c6a7 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.module @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+
+ name="tuscany.samples.bigbank.webclient">
+
+ <component name="LoginServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.bigbank.webclient.services.profile.SimpleLoginServiceImpl"/>
+ <references>
+ <v:profileService>ProfileServiceComponent</v:profileService>
+ </references>
+ </component>
+
+ <component name="ProfileServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.bigbank.webclient.services.profile.ProfileServiceImpl"/>
+ <properties>
+ <v:firstName>Anonymous</v:firstName>
+ </properties>
+ </component>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.samples.bigbank.webclient.services.account.AccountServiceComponentImpl"/>
+ <references>
+ <v:accountService>AccountService</v:accountService>
+ </references>
+ </component>
+
+ <externalService name="AccountService">
+ <interface.wsdl interface="http://www.bigbank.com/Account/#AccountService"/>
+ <!--
+ <interface.java interface="org.apache.tuscany.samples.bigbank.webclient.services.account.AccountService"/>
+ -->
+ <binding.ws port="http://www.bigbank.com/Account/#AccountServiceSOAP"/>
+ </externalService>
+
+ <import.wsdl + location="wsdl/AccountService.wsdl" + namespace="http://www.bigbank.com/Account/"/> + +</module>
+
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.subsystem b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.subsystem new file mode 100644 index 0000000000..1c12f340c8 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/sca.subsystem @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 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.
+ -->
+<subsystem xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+
+ name="tuscany.samples.bigbank.webclient">
+
+ <moduleComponent name="WebClientModuleComponent" module="tuscany.samples.bigbank.webclient">
+ <references>
+ <v:AccountService>bigbank.accountsunbsystem/AccountModuleComponent/AccountService</v:AccountService>
+ </references>
+ </moduleComponent>
+
+</subsystem>
+
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..5d087530dd --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 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.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/Account/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:account="http://www.bigbank.com/Account/"
+ targetNamespace="http://www.bigbank.com/Account/" + name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/Account/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:account="http://www.bigbank.com/Account/" + xmlns:sdojava="commonj.sdo/java" + sdojava:package="org.apache.tuscany.samples.bigbank.account">
+
+ <xsd:element name="getAccountReport"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerID" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element>
+ <xsd:element name="getAccountReportResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountReport" type="account:AccountReport"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> +
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries" type="account:AccountSummary" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:attribute name="accountNumber" type="xsd:string"/>
+ <xsd:attribute name="accountType" type="xsd:string"/>
+ <xsd:attribute name="balance" type="xsd:float"/>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport" name="getAccountReportRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse" name="getAccountReportResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest"/>
+ <wsdl:output message="tns:getAccountReportResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/Account/getAccountReport"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location="http://localhost:8080/account-SNAPSHOT/services/AccountService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/axis2.xml b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/axis2.xml new file mode 100644 index 0000000000..a38cf9864a --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/axis2.xml @@ -0,0 +1,167 @@ +<axisconfig name="AxisJava2.0"> + <!-- ================================================= --> + <!-- Parameters --> + <!-- ================================================= --> + <parameter name="hotdeployment" locked="false">false</parameter> + <parameter name="hotupdate" locked="false">false</parameter> + <parameter name="enableMTOM" locked="false">false</parameter> + <!-- Uncomment this to enable REST support --> + <!-- <parameter name="enableREST" locked="false">true</parameter>--> + + + <parameter name="userName" locked="false">admin</parameter> + <parameter name="password" locked="false">axis2</parameter> + + <parameter name="seralizeLocation" locked="false">.</parameter> + <hostConfiguration> + <ip>127.0.0.1</ip> + <port>5555</port> + </hostConfiguration> + + + <!--if you want to extract the service archive file and work with that please uncomment this--> + <!--else , it wont extract archive file or does not take into consideration if someone drop--> + <!--exploded directory into /service directory--> + <!--<parameter name="extractServiceArchive" locked="false">true</parameter>--> + + + <!-- The way of adding listener to the system--> + <!-- <listener class="org.apache.axis2.ObserverIMPL">--> + <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>--> + <!-- </listener>--> + + <!-- ================================================= --> + <!-- Message Receivers --> + <!-- ================================================= --> + <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for --> + <!--all the other MEP implement it and add the correct entry to here , so that you can refer from--> + <!--any operation --> + <!--Note : You can ovride this for particular service by adding the same element with your requirement--> + <messageReceivers> + <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" + class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> + <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" + class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> + </messageReceivers> + <!-- ================================================= --> + <!-- Transport Ins --> + <!-- ================================================= --> + <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer"> + <parameter name="port" locked="false">6060</parameter> + </transportReceiver> + + <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver + <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener"> + <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter> + <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter> + <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter> + <parameter name="transport.mail.pop3.port" locked="false">110</parameter> + <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter> + </transportReceiver> --> + + <!--REMOVED FOR TUSCANY transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer"> + <parameter name="port" locked="false">6060</parameter> + </transportReceiver --> + + <!--REMOVED FOR TUSCANY transportReceiver name="jms" class="org.apache.axis2.transport.jms.SimpleJMSListener"> + <parameter name="transport.jms.Destination" locked="false">dynamicQueues/FOO</parameter> + <parameter name="java.naming.factory.initial" locked="false"> + org.activemq.jndi.ActiveMQInitialContextFactory</parameter> + <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter> + </transportReceiver> + --> + + <!-- ================================================= --> + <!-- Transport Outs --> + <!-- ================================================= --> + + <!--REMOVED FOR TUSCANY transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/> --> + <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/> + <!--REMOVED FOR TUSCANY transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/> --> + <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> + <parameter name="Transfer-Encoding" locked="false">chunked</parameter> + </transportSender> + <transportSender name="https" + class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> + <parameter name="Transfer-Encoding" locked="false">chunked</parameter> + </transportSender> + + <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver + <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> + <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter> + <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter> + <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter> + <parameter name="transport.mail.smtp.port" locked="false">25</parameter> + </transportSender> + --> + + <!-- ================================================= --> + <!-- Global Modules --> + <!-- ================================================= --> + <!-- Comment this to disable Addressing --> + <!--REMOVED FOR TUSCANY module ref="addressing"/> --> + + + <!--Configuring module , providing parameters for modules whether they refer or not--> + <!--<moduleConfig name="addressing">--> + <!--<parameter name="addressingPara" locked="false">N/A</parameter>--> + <!--</moduleConfig>--> + + <!-- ================================================= --> + <!-- Phases --> + <!-- ================================================= --> + <phaseOrder type="inflow"> + <!-- System pre defined phases --> + <phase name="TransportIn"/> + <phase name="PreDispatch"/> + <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> + <handler name="AddressingBasedDispatcher" + class="org.apache.axis2.engine.AddressingBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="RequestURIBasedDispatcher" + class="org.apache.axis2.engine.RequestURIBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="SOAPActionBasedDispatcher" + class="org.apache.axis2.engine.SOAPActionBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + + <handler name="SOAPMessageBodyBasedDispatcher" + class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"> + <order phase="Dispatch"/> + </handler> + <handler name="InstanceDispatcher" + class="org.apache.axis2.engine.InstanceDispatcher"> + <order phase="PostDispatch"/> + </handler> + </phase> + <!-- System pre defined phases --> + <!-- After Postdispatch phase module author or or service author can add any phase he want --> + <phase name="userphase1"/> + </phaseOrder> + <phaseOrder type="outflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + <!--system predefined phase--> + <!--these phase will run irrespective of the service--> + <phase name="PolicyDetermination"/> + <phase name="MessageOut"/> + </phaseOrder> + <phaseOrder type="INfaultflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + </phaseOrder> + <phaseOrder type="Outfaultflow"> + <!-- user can add his own phases to this area --> + <phase name="userphase1"/> + <phase name="PolicyDetermination"/> + <phase name="MessageOut"/> + </phaseOrder> +</axisconfig> + diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld new file mode 100644 index 0000000000..c8a4451691 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/bigbank-tags.tld @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Copyright (c) 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.
+ -->
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">
+ <tlibversion>1.0</tlibversion>
+ <jspversion>2.0</jspversion>
+ <shortname>BigBank Tags</shortname>
+ <info>Tag library containing BigBank tags</info>
+ <tag>
+ <name>service</name>
+ <tagclass>org.apache.tuscany.samples.bigbank.webclient.tags.sca.ServiceTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Places a reference to an SCA Service in the page context</info>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+ <tag>
+ <name>login</name>
+ <tagclass>org.apache.tuscany.samples.bigbank.webclient.tags.sca.LoginBarrierTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Redirects if user is not logged in</info>
+ <attribute>
+ <name>profile</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>url</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+
+ </tag>
+ <tag>
+ <name>accountStatus</name>
+ <tagclass>org.apache.tuscany.samples.bigbank.webclient.tags.account.AccountStatusTag</tagclass>
+ <bodycontent>JSP</bodycontent>
+ <info>Accesses and iterates the account service</info>
+ <attribute>
+ <name>id</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>accountService</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>profileService</name>
+ <required>true</required>
+ <rtexprvalue>false</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..859fb927af --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 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. + --> +<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> + + <display-name>Tuscany Bigbank Web UI sample</display-name> + <welcome-file-list id="WelcomeFileList"> + <welcome-file>login.html</welcome-file> + </welcome-file-list> + + <servlet> + <servlet-name>LoginServlet</servlet-name> + <servlet-class>org.apache.tuscany.samples.bigbank.webclient.ui.LoginServlet</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>LoginServlet</servlet-name> + <url-pattern>/loginAction/*</url-pattern> + </servlet-mapping> + +</web-app> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/login.html b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/login.html new file mode 100644 index 0000000000..72b180a29c --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/login.html @@ -0,0 +1,24 @@ +<html> +<title>Welcome to Big Bank</title> + +<body> +<form action="loginAction" method="post"> + <table> + <tr> + <td colspan="2">Please login in to access your account</td> + </tr> + </table> + <table> + <tr> + <td>Login</td> + <td><input type="text" name="login"/></td> + </tr> + <tr> + <td>Password</td> + <td><input type="password" name="password"/></td> + </tr> + <tr><td></td><td align="right"><input type="submit"/></td></tr> + </table> +</form> +</body> +</html> diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/summary.jsp b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/summary.jsp new file mode 100644 index 0000000000..be56e2547c --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/main/webapp/summary.jsp @@ -0,0 +1,48 @@ +<%--
+ Copyright (c) 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.
+ --%>
+<%@ taglib uri="/WEB-INF/bigbank-tags.tld" prefix="sca" %>
+<sca:login profile="ProfileServiceComponent" url="login.html">
+ <sca:service id="profile" name="ProfileServiceComponent"/>
+
+ <html>
+ <title>BigBank Account Summary</title>
+
+ <body>
+
+ Account Information for
+ <jsp:getProperty name='profile' property='firstName'/>
+ <jsp:getProperty name='profile' property='lastName'/>
+ <br>
+
+ <table>
+ <sca:accountStatus accountService="AccountServiceComponent" profileService="ProfileServiceComponent" id="account">
+ <tr>
+ <td><strong>Account</strong></td>
+ <td><strong>Balance</strong></td>
+ </tr>
+ <tr>
+ <td>
+ <jsp:getProperty name="account" property="accountNumber"/>
+ </td>
+ <td>
+ <jsp:getProperty name="account" property="balance"/>
+ </td>
+ </tr>
+ </sca:accountStatus>
+ <table>
+ </body>
+ </html>
+</sca:login>
diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestAccountService.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestAccountService.java new file mode 100644 index 0000000000..de18ee0db2 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestAccountService.java @@ -0,0 +1,51 @@ +/** + * + * 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.client; + +import java.util.List; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.samples.bigbank.account.AccountReport; +import org.apache.tuscany.samples.bigbank.account.services.account.AccountService; +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + + +public class TestAccountService extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + + AccountService accountService = (AccountService) moduleContext.locateService("AccountServiceComponent"); + + AccountReport report = accountService.getAccountReport("12345"); + List summaries = report.getAccountSummaries(); + + System.out.println("retrieved " + summaries.size() + " summaries"); + + tuscany.stop(); + } +} diff --git a/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestLoginService.java b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestLoginService.java new file mode 100644 index 0000000000..ac16890127 --- /dev/null +++ b/sca-java-1.x/tags/java-stable-20060304/samples/bigbank/webclient/src/test/java/org/apache/tuscany/samples/bigbank/webclient/client/TestLoginService.java @@ -0,0 +1,49 @@ +/** + * + * 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.client; + +import org.osoa.sca.CurrentModuleContext; +import org.osoa.sca.ModuleContext; +import org.osoa.sca.SCA; + +import org.apache.tuscany.core.client.TuscanyRuntime; +import org.apache.tuscany.samples.bigbank.webclient.services.profile.LoginService; + + +public class TestLoginService extends SCA { + + public void start() { + } + + public void stop() { + } + + public static void main(String[] args) throws Exception { + + + TuscanyRuntime tuscany = new TuscanyRuntime("bigbank.webclient.testclient", null); + tuscany.start(); + ModuleContext moduleContext = CurrentModuleContext.getContext(); + LoginService loginService = (LoginService) + moduleContext.locateService("LoginServiceComponent"); + + if (loginService.login("test", "password") == LoginService.SUCCESS) + System.out.println("Success"); + else + System.out.println("Failure"); + } +} |