summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.1/samples/calculator-implementation-policies/src/main')
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java28
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java35
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java69
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java35
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java28
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java35
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java28
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java28
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java35
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java50
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java84
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/Calculator.composite61
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config3
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties18
-rw-r--r--branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/definitions.xml61
17 files changed, 0 insertions, 703 deletions
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java
deleted file mode 100644
index 5a1e7a638a..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-/**
- * The Add service interface
- */
-public interface AddService {
-
- double add(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java
deleted file mode 100644
index caf4d358df..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An implementation of the Add service
- */
-public class AddServiceImpl implements AddService {
-
- public double add(double n1, double n2) {
- Logger logger = Logger.getLogger("calculator");
- logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
- return n1 + n2;
- }
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java
deleted file mode 100644
index c1f79888cb..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package calculator;
-
-import javax.security.auth.login.Configuration;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * This client program shows how to create an SCA runtime, start it,
- * and locate and invoke a SCA component
- */
-public class CalculatorClient {
- public static void main(String[] args) throws Exception {
-
- try {
- Configuration secConf = Configuration.getConfiguration();
- } catch ( java.lang.SecurityException e ) {
- if ( e.getMessage().equals("Unable to locate a login configuration") ) {
- System.setProperty("java.security.auth.login.config", "target/classes/CalculatorJass.config");
- } else {
- throw e;
- }
- }
-
- SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
-
- CalculatorService calculatorService =
- scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
-
- // Calculate
- System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
- "policy for subtract and divide operations...");
- System.out.println("3 + 2=" + calculatorService.add(3, 2));
- System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
- System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
- System.out.println("3 / 2=" + calculatorService.divide(3, 2));
-
- calculatorService =
- scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent");
-
- // Calculate
- System.out.println("Calling CalculatorServiceComponent configured with 'logging' " +
- "for all operations in the implementation...");
- System.out.println("3 + 2=" + calculatorService.add(3, 2));
- System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
- System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
- System.out.println("3 / 2=" + calculatorService.divide(3, 2));
-
- scaDomain.close();
- }
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java
deleted file mode 100644
index ad87375529..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-
-/**
- * The Calculator service interface.
- */
-public interface CalculatorService {
-
- double add(double n1, double n2);
-
- double subtract(double n1, double n2);
-
- double multiply(double n1, double n2);
-
- double divide(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java
deleted file mode 100644
index ae4ed12b7b..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import org.osoa.sca.annotations.Reference;
-
-
-/**
- * An implementation of the Calculator service.
- */
-public class CalculatorServiceImpl implements CalculatorService {
-
- private AddService addService;
- private SubtractService subtractService;
- private MultiplyService multiplyService;
- private DivideService divideService;
-
- @Reference
- public void setAddService(AddService addService) {
- this.addService = addService;
- }
-
- @Reference
- public void setSubtractService(SubtractService subtractService) {
- this.subtractService = subtractService;
- }
-
- @Reference
- public void setDivideService(DivideService divideService) {
- this.divideService = divideService;
- }
-
- @Reference
- public void setMultiplyService(MultiplyService multiplyService) {
- this.multiplyService = multiplyService;
- }
-
- public double add(double n1, double n2) {
- return addService.add(n1, n2);
- }
-
- public double subtract(double n1, double n2) {
- return subtractService.subtract(n1, n2);
- }
-
- public double multiply(double n1, double n2) {
- return multiplyService.multiply(n1, n2);
- }
-
- public double divide(double n1, double n2) {
- return divideService.divide(n1, n2);
- }
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java
deleted file mode 100644
index ef6a8b375b..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-/**
- * The divide service interface
- */
-public interface DivideService {
-
- double divide(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java
deleted file mode 100644
index cd91935f08..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An implementation of the Divide service.
- */
-public class DivideServiceImpl implements DivideService {
-
- public double divide(double n1, double n2) {
- Logger logger = Logger.getLogger("calculator");
- logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
- return n1 / n2;
- }
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java
deleted file mode 100644
index db568cc762..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-/**
- * The interface for the multiply service
- */
-public interface MultiplyService {
-
- double multiply(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java
deleted file mode 100644
index c85357fcd8..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An implementation of the Multiply service.
- */
-public class MultiplyServiceImpl implements MultiplyService {
-
- public double multiply(double n1, double n2) {
- Logger logger = Logger.getLogger("calculator");
- logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
- return n1 * n2;
- }
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java
deleted file mode 100644
index 56ee372fc4..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-/**
- * The interface for the multiply service
- */
-public interface SubtractService {
-
- double subtract(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java
deleted file mode 100644
index 1b669084d9..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An implementation of the subtract service.
- */
-public class SubtractServiceImpl implements SubtractService {
-
- public double subtract(double n1, double n2) {
- Logger logger = Logger.getLogger("calculator");
- logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
- return n1 - n2;
- }
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java
deleted file mode 100644
index b48fb90148..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package calculator.security;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CalculatorCallbackHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- if (callbacks[i] instanceof NameCallback) {
- NameCallback nc = (NameCallback)callbacks[i];
- nc.setName("CalculatorUser");
- } else if (callbacks[i] instanceof PasswordCallback) {
- PasswordCallback pc = (PasswordCallback)callbacks[i];
- pc.setPassword("CalculatorUserPasswd".toCharArray());
- } else {
- throw new UnsupportedCallbackException
- (callbacks[i], "Unsupported Callback!");
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java
deleted file mode 100644
index a9461f65de..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package calculator.security;
-
-import java.util.Map;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.spi.LoginModule;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JaasLoginModule implements LoginModule {
-
- private CallbackHandler callbackHandler = null;
- private Subject subject = null;
-
- public boolean abort() throws LoginException {
- return true;
- }
-
-
- public boolean commit() throws LoginException {
- return true;
- }
-
- public void initialize(Subject subject,
- CallbackHandler callbackHandler,
- Map<String, ?> sharedState,
- Map<String, ?> options) {
- this.callbackHandler = callbackHandler;
- this.subject = subject;
- }
-
- public boolean login() throws LoginException {
- Callback[] callbacks = new Callback[2];
- callbacks[0] = new NameCallback("UserId:");
- callbacks[1] = new PasswordCallback("Password:", false);
-
- try {
- callbackHandler.handle(callbacks);
- String userId = ((NameCallback)callbacks[0]).getName();
- String password = new String(((PasswordCallback)callbacks[1]).getPassword());
-
- if ( userId.equals("CalculatorUser") && password.equals("CalculatorUserPasswd")) {
- System.out.println("Successfully AUTHENTICATED!!");
- return true;
- } else {
- System.out.println("Incorrect userId / password! AUTHENTICATION FAILED!!");
- return false;
- }
- } catch ( Exception e ) {
- e.printStackTrace();
- return false;
- }
- }
-
- public boolean logout() throws LoginException {
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/Calculator.composite b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/Calculator.composite
deleted file mode 100644
index d91bf88d96..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/Calculator.composite
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="Calculator"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl">
- <operation name="divide" requires="tuscany:logging"/>
- <operation name="subtract" requires="tuscany:logging"/>
- </implementation.java>
- <reference name="addService" target="AddServiceComponent" />
- <reference name="subtractService" target="SubtractServiceComponent" />
- <reference name="multiplyService" target="MultiplyServiceComponent" />
- <reference name="divideService" target="DivideServiceComponent" />
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl" requires="tuscany:logging"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl" requires="tuscany:jaasAuthentication"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
- <component name="AnotherCalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl" requires="tuscany:logging"/>
- <reference name="addService" target="AddServiceComponent" />
- <reference name="subtractService" target="SubtractServiceComponent" />
- <reference name="multiplyService" target="MultiplyServiceComponent" />
- <reference name="divideService" target="DivideServiceComponent" />
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config
deleted file mode 100644
index 0e7cb86633..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config
+++ /dev/null
@@ -1,3 +0,0 @@
-Calculator {
- calculator.security.JaasLoginModule required debug=true;
-};
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties
deleted file mode 100644
index f62125eaa9..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-CALLING_OPERATION=Inovoking operation {0} with arguments {1}
-OPERATION_RETURNED=Returning from operation {0} with return value {1} \ No newline at end of file
diff --git a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/definitions.xml b/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/definitions.xml
deleted file mode 100644
index f6ed3573b3..0000000000
--- a/branches/sca-java-1.1/samples/calculator-implementation-policies/src/main/resources/definitions.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://test"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:calc="http://calculator">
-
-<!-- Policy Intents -->
-<intent name="tuscany:logging"
- constrains="sca:implementation.java">
- <description>
- All messages to and from this implementation must be logged
- </description>
-</intent>
-
-<intent name="tuscany:jaasAuthentication"
- constrains="sca:implementation.java">
- <description>
- All invocations to be authenticated
- </description>
-</intent>
-
-<!-- PolicySets -->
-<policySet name="tuscany:JaasPolicy"
- provides="tuscany:jaasAuthentication"
- appliesTo="sca:implementation.java"
- xmlns="http://www.osoa.org/xmlns/sca/1.0">
- <tuscany:jaasAuthentication>
- <tuscany:callbackHandler>calculator.security.CalculatorCallbackHandler</tuscany:callbackHandler>
- </tuscany:jaasAuthentication>
-</policySet>
-
-<!-- PolicySets -->
-<policySet name="tuscany:JDKLoggingPolicy"
- provides="tuscany:logging"
- appliesTo="sca:implementation.java"
- xmlns="http://www.osoa.org/xmlns/sca/1.0">
- <tuscany:jdkLogger xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" name="calculator">
- <logLevel>FINER</logLevel>
- </tuscany:jdkLogger>
-</policySet>
-
-</definitions> \ No newline at end of file