You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2007/02/18 20:15:33 UTC
svn commit: r508944 - in
/incubator/tuscany/java/sca/core-samples/standalone/loanapplication: ./
src/main/java/loanapplication/ src/main/java/loanapplication/message/
src/main/java/loanapplication/message/impl/
src/main/java/loanapplication/provider/ s...
Author: jmarino
Date: Sun Feb 18 11:15:32 2007
New Revision: 508944
URL: http://svn.apache.org/viewvc?view=rev&rev=508944
Log:
initial checkin of loan app sample; work in progress
Added:
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java (with props)
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java (with props)
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java (with props)
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java (with props)
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java (with props)
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java (with props)
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java (with props)
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java (with props)
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java (with props)
Modified:
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/pom.xml
incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl
Modified: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/pom.xml?view=diff&rev=508944&r1=508943&r2=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/pom.xml (original)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/pom.xml Sun Feb 18 11:15:32 2007
@@ -31,6 +31,10 @@
<dependencies>
<dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r1.0</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,45 @@
+/*
+ * 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 loanapplication.message;
+
+/**
+ * Represents a loan application
+ */
+public interface Application {
+
+ String getCustomerID();
+
+ void setCustomerID(String customerID);
+
+ float getAmount();
+
+ void setAmount(float amount);
+
+ float getDownPayment();
+
+ void setDownPayment(float downPayment);
+
+ int getType();
+
+ void setType(int type);
+
+ int getTerm();
+
+ void setTerm(int term);
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/Application.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,45 @@
+/*
+ * 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 loanapplication.message;
+
+/**
+ * Contains information for a completed loan
+ */
+public interface LoanPackage {
+
+ String getLoanNumber();
+
+ void setLoanNumber(String loanNumber);
+
+ int getType();
+
+ void setType(int type);
+
+ float getAmount();
+
+ void setAmount(float amount);
+
+ float getRate();
+
+ void setRate(float rate);
+
+ int getTerm();
+
+ void setTerm(int term);
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/LoanPackage.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,75 @@
+/*
+ * 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 loanapplication.message.impl;
+
+import java.io.Serializable;
+
+import loanapplication.message.Application;
+
+/**
+ * A simple implementation of an Application
+ */
+public class ApplicationImpl implements Application, Serializable {
+ private static final long serialVersionUID = -4289535647716763141L;
+ private float amount;
+ private float downPayment;
+ private String customerID;
+ private int type;
+ private int term;
+
+ public float getAmount() {
+ return amount;
+ }
+
+ public void setAmount(float amount) {
+ this.amount = amount;
+ }
+
+ public float getDownPayment() {
+ return downPayment;
+ }
+
+ public void setDownPayment(float downPayment) {
+ this.downPayment = downPayment;
+ }
+
+ public String getCustomerID() {
+ return customerID;
+ }
+
+ public void setCustomerID(String customerID) {
+ this.customerID = customerID;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public int getTerm() {
+ return term;
+ }
+
+ public void setTerm(int term) {
+ this.term = term;
+ }
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/ApplicationImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,57 @@
+package loanapplication.message.impl;
+
+import java.io.Serializable;
+
+import loanapplication.message.LoanPackage;
+
+/**
+ * A simple implementation of a LoanPackage
+ */
+public class LoanPackageImpl implements LoanPackage, Serializable {
+ private static final long serialVersionUID = 51755060138169723L;
+ private int type;
+ private float amount;
+ private float rate;
+ private int term;
+ private String loanNumber;
+
+ public String getLoanNumber() {
+ return loanNumber;
+ }
+
+ public void setLoanNumber(String loanNumber) {
+ this.loanNumber = loanNumber;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public float getAmount() {
+ return amount;
+ }
+
+ public void setAmount(float amount) {
+ this.amount = amount;
+ }
+
+ public float getRate() {
+ return rate;
+ }
+
+ public void setRate(float rate) {
+ this.rate = rate;
+ }
+
+ public int getTerm() {
+ return term;
+ }
+
+ public void setTerm(int term) {
+ this.term = term;
+ }
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/message/impl/LoanPackageImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,34 @@
+/*
+ * 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 loanapplication.provider;
+
+/**
+ * Performs a credit check on a customer
+ */
+public interface CreditService {
+
+ /**
+ * Returns the customer credit rating
+ *
+ * @param customerID the customer ID
+ * @return the credit score
+ */
+ int getCreditRating(String customerID);
+
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/CreditService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,52 @@
+/*
+ * 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 loanapplication.provider;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndConversation;
+import org.osoa.sca.annotations.OneWay;
+
+import loanapplication.message.Application;
+
+/**
+ * Defines the loan service contract.
+ */
+@Conversational
+@Callback(LoanServiceCallback.class)
+public interface LoanService {
+
+ /**
+ * Submits a new loan application
+ *
+ * @param application the loan application
+ * @return the application number
+ */
+ @OneWay
+ void apply(Application application);
+
+ @OneWay
+ @EndConversation
+ void secureLoan();
+
+ @OneWay
+ @EndConversation
+ void cancel();
+
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,41 @@
+/*
+ * 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 loanapplication.provider;
+
+import org.osoa.sca.annotations.OneWay;
+
+import loanapplication.message.LoanPackage;
+
+/**
+ * Defines the callback contract for loan service clients
+ */
+public interface LoanServiceCallback {
+ int APPROVED = 1;
+ int DECLINED = -1;
+
+ @OneWay
+ void creditResult(int code);
+
+ @OneWay
+ void applicationResult(int code);
+
+ @OneWay
+ void loanPackage(LoanPackage loanPackage);
+
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/LoanServiceCallback.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,31 @@
+/*
+ * 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 loanapplication.provider.impl;
+
+import loanapplication.provider.CreditService;
+
+/**
+ *
+ */
+public class CreditServiceImpl implements CreditService {
+
+ public int getCreditRating(String customerID) {
+ return 700;
+ }
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/CreditServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java?view=auto&rev=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java (added)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java Sun Feb 18 11:15:32 2007
@@ -0,0 +1,75 @@
+/*
+ * 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 loanapplication.provider.impl;
+
+import static loanapplication.provider.LoanServiceCallback.DECLINED;
+import static loanapplication.provider.LoanServiceCallback.APPROVED;
+
+import java.util.UUID;
+
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Reference;
+
+import loanapplication.provider.LoanService;
+import loanapplication.provider.LoanServiceCallback;
+import loanapplication.provider.CreditService;
+import loanapplication.message.Application;
+
+/**
+ * The loan service implementation
+ */
+@Scope("CONVERSATIONAL")
+public class LoanServiceImpl implements LoanService {
+ private String loanNumber;
+ private CreditService creditService;
+ private LoanServiceCallback callback;
+
+ public LoanServiceImpl(@Reference CreditService creditService) {
+ this.creditService = creditService;
+ }
+
+ @Callback
+ public void setCallback(LoanServiceCallback callback) {
+ this.callback = callback;
+ }
+
+ public void apply(Application application) {
+ String id = application.getCustomerID();
+ System.out.println("Application received: "+ id);
+ loanNumber = UUID.randomUUID().toString();
+ int rating = creditService.getCreditRating(id);
+ if (rating > 500){
+ callback.creditResult(APPROVED);
+ } else {
+ callback.creditResult(DECLINED);
+ }
+ }
+
+ @OneWay
+ public void secureLoan() {
+ System.out.println("Loan secured: "+ loanNumber);
+ }
+
+ @OneWay
+ public void cancel() {
+ System.out.println("Loan cancelled: "+ loanNumber);
+ }
+}
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/java/loanapplication/provider/impl/LoanServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl?view=diff&rev=508944&r1=508943&r2=508944
==============================================================================
--- incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl (original)
+++ incubator/tuscany/java/sca/core-samples/standalone/loanapplication/src/main/resources/META-INF/sca/default.scdl Sun Feb 18 11:15:32 2007
@@ -17,15 +17,15 @@
* specific language governing permissions and limitations
* under the License.
-->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="simplecallback">
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="LoanApplication">
- <component name="LoanClientComponent">
- <implementation.java class="loanappconversation.LoanClientImpl"/>
- <reference name="loanService">LoanServiceComponent</reference>
+ <component name="LoanService">
+ <implementation.java class="loanapplication.provider.impl.LoanServiceImpl"/>
+ <reference name="creditService">CreditService</reference>
</component>
- <component name="LoanServiceComponent">
- <implementation.java class="loanappconversation.LoanServiceImpl"/>
+ <component name="CreditService">
+ <implementation.java class="loanapplication.provider.impl.CreditServiceImpl"/>
</component>
</composite>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org