You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2006/10/26 01:06:28 UTC
svn commit: r467804 - in /incubator/tuscany/sandbox/rfeng/samples/mortgage:
./ src/main/resources/ src/main/resources/META-INF/sca/
src/test/java/mortgage/
Author: rfeng
Date: Wed Oct 25 16:06:27 2006
New Revision: 467804
URL: http://svn.apache.org/viewvc?view=rev&rev=467804
Log:
Add JavaScript impl for mortgage calculator
Added:
incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType
incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js
Modified:
incubator/tuscany/sandbox/rfeng/samples/mortgage/pom.xml
incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl
incubator/tuscany/sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java
Modified: incubator/tuscany/sandbox/rfeng/samples/mortgage/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/rfeng/samples/mortgage/pom.xml?view=diff&rev=467804&r1=467803&r2=467804
==============================================================================
--- incubator/tuscany/sandbox/rfeng/samples/mortgage/pom.xml (original)
+++ incubator/tuscany/sandbox/rfeng/samples/mortgage/pom.xml Wed Oct 25 16:06:27 2006
@@ -40,6 +40,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.tuscany.sca.services.containers</groupId>
+ <artifactId>javascript</artifactId>
+ <version>${tuscanyVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.tuscany.sca.services.bindings</groupId>
<artifactId>axis2</artifactId>
<version>${tuscanyVersion}</version>
Modified: incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl?view=diff&rev=467804&r1=467803&r2=467804
==============================================================================
--- incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl (original)
+++ incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/META-INF/sca/default.scdl Wed Oct 25 16:06:27 2006
@@ -22,10 +22,14 @@
<component name="LoanApprovalComponent">
<implementation.java class="mortgage.LoanApprovalImpl" />
<property name="minimumCreditScore">600</property>
+ <!--
<reference name="creditCheck">CreditCheckService</reference>
+ <reference name="mortgageCalculator">MortgageCalculatorComponent</reference>
+ -->
+ <reference name="creditCheck">CreditCheckComponent</reference>
<reference name="interestRateQuote">InterestRateQuoteComponent</reference>
<reference name="riskAssessment">RiskAssessmentComponent</reference>
- <reference name="mortgageCalculator">MortgageCalculatorComponent</reference>
+ <reference name="mortgageCalculator">MortgageCalculatorJSComponent</reference>
</component>
<component name="CreditCheckComponent">
@@ -38,7 +42,8 @@
<interface.wsdl xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
interface="http://credit#wsdl.interface(CreditCheck)" wsdli:wsdlLocation="http://credit wsdl/credit.wsdl" />
-->
- <binding.ws endpoint="http://credit#wsdl.endpoint(CreditCheckService/CreditCheckSoapPort)" location="wsdl/credit.wsdl" />
+ <binding.ws endpoint="http://credit#wsdl.endpoint(CreditCheckService/CreditCheckSoapPort)"
+ location="wsdl/credit.wsdl" />
</reference>
<component name="InterestRateQuoteComponent">
@@ -51,6 +56,11 @@
<component name="MortgageCalculatorComponent">
<implementation.java class="mortgage.MortgageCalculatorImpl" />
+ </component>
+
+ <component name="MortgageCalculatorJSComponent"
+ xmlns:js="http://incubator.apache.org/tuscany/xmlns/container/js/1.0-incubator-M2">
+ <js:implementation.js script="MortgageCalculator.js" />
</component>
</composite>
Added: incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType?view=auto&rev=467804
==============================================================================
--- incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType (added)
+++ incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.componentType Wed Oct 25 16:06:27 2006
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="MortgageCalculatorService">
+ <interface.java interface="mortgage.MortgageCalculator"/>
+ </service>
+
+</componentType>
Added: incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js?view=auto&rev=467804
==============================================================================
--- incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js (added)
+++ incubator/tuscany/sandbox/rfeng/samples/mortgage/src/main/resources/MortgageCalculator.js Wed Oct 25 16:06:27 2006
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+function getMonthlyPayment(principal, years, interestRate) {
+ var monthlyRate = interestRate / 12.0 / 100.0;
+ var p = Math.pow(1 + monthlyRate, years * 12);
+ var q = p / (p - 1);
+ var monthlyPayment = principal * monthlyRate * q;
+ return monthlyPayment;
+}
Modified: incubator/tuscany/sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java?view=diff&rev=467804&r1=467803&r2=467804
==============================================================================
--- incubator/tuscany/sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java (original)
+++ incubator/tuscany/sandbox/rfeng/samples/mortgage/src/test/java/mortgage/MortgageClientTestCase.java Wed Oct 25 16:06:27 2006
@@ -35,8 +35,8 @@
protected void setUp() throws Exception {
setApplicationSCDL(LoanApproval.class, "META-INF/sca/default.scdl");
ClassLoader classLoader = getClass().getClassLoader();
- addExtension("axis2.extension", classLoader.getResource("META-INF/sca/binding.axis2.scdl"));
- addExtension("databinding.sdo.extension", classLoader.getResource("META-INF/sca/databinding.sdo.scdl"));
+ addExtension("binding.axis2", classLoader.getResource("META-INF/sca/binding.axis2.scdl"));
+ addExtension("container.js", classLoader.getResource("META-INF/sca/js.system.scdl"));
super.setUp();
CompositeContext context = CurrentCompositeContext.getContext();
loanApproval = context.locateService(LoanApproval.class, "LoanApprovalComponent");
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org