diff options
Diffstat (limited to 'java/sca/itest/service-reference/src/main')
12 files changed, 0 insertions, 806 deletions
diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java deleted file mode 100644 index 8b5cf4d29a..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java +++ /dev/null @@ -1,39 +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 org.apache.tuscany.sca.itest.serviceref; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface AComponent { - String foo(); - - String fooB(); - String fooB1(); - - String fooC(); - String fooC1(); - - String fooStringD(); - String fooD(); - - String fooBC(); - - String invokeDReference(); -} diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java deleted file mode 100644 index 3f68ac828a..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java +++ /dev/null @@ -1,112 +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 org.apache.tuscany.sca.itest.serviceref; - -import java.io.ByteArrayOutputStream; -import java.io.ObjectOutputStream; - -import org.oasisopen.sca.ComponentContext; -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Context; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -@Service(AComponent.class) -public class AComponentImpl implements AComponent { - - @Context - protected ComponentContext componentContext; - - @Reference(name = "bReference") - protected BComponent b; - - @Reference - protected CComponent cReference; - - @Reference - protected ServiceReference<CComponent> cServiceReference; - - @Reference(required=false) - protected DComponent dReference; - - protected DComponent dReference1; - - @Reference(name = "dReference1") - public void setDReference(DComponent dReference) { - this.dReference1 = dReference; - } - - public String foo() { - return "AComponent"; - } - - public String fooB() { - return b.foo(); - } - - public String fooB1() { - ServiceReference<BComponent> bRef = componentContext.cast(b); - return bRef.getService().foo(); - } - - public String fooC() { - return cReference.foo(); - } - - public String fooC1() { - return cServiceReference.getService().foo(); - } - - public String fooBC() { - ServiceReference<CComponent> cReference = componentContext.getServiceReference(CComponent.class, "cReference"); - return b.fooC(cReference); - } - - public String fooD() { - ServiceReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class); - return dReference1.foo(aReference); - } - - /** - * A test case to work out what needs to be done in a transformer to get the - * CallableReference across the wire. Left here for interest in case anyone - * is looking for how to get at the innards of CallableReferences - */ - public String fooStringD() { - ServiceReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class); - ByteArrayOutputStream bos = null; - - try { - bos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(aReference); - } catch (Exception ex) { - System.out.println(ex.toString()); - return null; - } - - String aReferenceString = Base64Binary.encode(bos.toByteArray()); - return dReference1.fooString(aReferenceString); - } - - public String invokeDReference() { - return dReference.foo(null); - } - -} diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java deleted file mode 100644 index 18242cd594..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java +++ /dev/null @@ -1,31 +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 org.apache.tuscany.sca.itest.serviceref; - -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Remotable; - - -@Remotable -public interface BComponent { - - String foo(); - - String fooC(ServiceReference<CComponent> cComponent); -} diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java deleted file mode 100644 index dd143df036..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java +++ /dev/null @@ -1,38 +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 org.apache.tuscany.sca.itest.serviceref; - -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Service; - -@Service(BComponent.class) -public class BComponentImpl implements BComponent { - - public BComponentImpl() { - } - - public String foo() { - return "BComponent"; - } - - public String fooC(ServiceReference<CComponent> cReference) { - return "B" + cReference.getService().foo(); - } - -} diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java deleted file mode 100644 index fb436ae10c..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java +++ /dev/null @@ -1,297 +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 org.apache.tuscany.sca.itest.serviceref; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; - -/** - * - */ - -public final class Base64Binary { - private static final char[] S_BASE64CHAR = - {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', - 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', - 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'}; - - private static final char S_BASE64PAD = '='; - - private static final byte[] S_DECODETABLE = new byte[128]; - - static { - for (int i = 0; i < S_DECODETABLE.length; i++) { - S_DECODETABLE[i] = Byte.MAX_VALUE; // 127 - } - for (int i = 0; i < S_BASE64CHAR.length; i++) { - // 0 to 63 - S_DECODETABLE[S_BASE64CHAR[i]] = (byte)i; - } - } - - private Base64Binary() { - } - - /** - * - */ - public static byte[] decode(char[] data, int off, int len) { - char[] ibuf = new char[4]; - int ibufcount = 0; - byte[] obuf = new byte[len / 4 * 3 + 3]; - int obufcount = 0; - for (int i = off; i < off + len; i++) { - char ch = data[i]; - if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { - ibuf[ibufcount++] = ch; - if (ibufcount == ibuf.length) { - ibufcount = 0; - obufcount += decode0(ibuf, obuf, obufcount); - } - } - } - if (obufcount == obuf.length) { - return obuf; - } - byte[] ret = new byte[obufcount]; - System.arraycopy(obuf, 0, ret, 0, obufcount); - return ret; - } - - /** - * - */ - public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException { - char[] ibuf = new char[4]; - int ibufcount = 0; - byte[] obuf = new byte[3]; - for (int i = off; i < off + len; i++) { - char ch = data[i]; - if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { - ibuf[ibufcount++] = ch; - if (ibufcount == ibuf.length) { - ibufcount = 0; - int obufcount = decode0(ibuf, obuf, 0); - ostream.write(obuf, 0, obufcount); - } - } - } - } - - /** - * - */ - public static byte[] decode(String data) { - char[] ibuf = new char[4]; - int ibufcount = 0; - byte[] obuf = new byte[data.length() / 4 * 3 + 3]; - int obufcount = 0; - for (int i = 0; i < data.length(); i++) { - char ch = data.charAt(i); - if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { - ibuf[ibufcount++] = ch; - if (ibufcount == ibuf.length) { - ibufcount = 0; - obufcount += decode0(ibuf, obuf, obufcount); - } - } - } - if (obufcount == obuf.length) { - return obuf; - } - byte[] ret = new byte[obufcount]; - System.arraycopy(obuf, 0, ret, 0, obufcount); - return ret; - } - - /** - * - */ - public static void decode(String data, OutputStream ostream) throws IOException { - char[] ibuf = new char[4]; - int ibufcount = 0; - byte[] obuf = new byte[3]; - for (int i = 0; i < data.length(); i++) { - char ch = data.charAt(i); - if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { - ibuf[ibufcount++] = ch; - if (ibufcount == ibuf.length) { - ibufcount = 0; - int obufcount = decode0(ibuf, obuf, 0); - ostream.write(obuf, 0, obufcount); - } - } - } - } - - private static int decode0(char[] ibuf, byte[] obuf, int index) { - int wp = index; - int outlen = 3; - if (ibuf[3] == S_BASE64PAD) { - outlen = 2; - } - if (ibuf[2] == S_BASE64PAD) { - outlen = 1; - } - int b0 = S_DECODETABLE[ibuf[0]]; - int b1 = S_DECODETABLE[ibuf[1]]; - int b2 = S_DECODETABLE[ibuf[2]]; - int b3 = S_DECODETABLE[ibuf[3]]; - switch (outlen) { - case 1: - obuf[wp] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3); - return 1; - case 2: - obuf[wp++] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3); - obuf[wp] = (byte)(b1 << 4 & 0xf0 | b2 >> 2 & 0xf); - return 2; - case 3: - obuf[wp++] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3); - obuf[wp++] = (byte)(b1 << 4 & 0xf0 | b2 >> 2 & 0xf); - obuf[wp] = (byte)(b2 << 6 & 0xc0 | b3 & 0x3f); - return 3; - default: - throw new IllegalArgumentException("The character sequence is not base64 encoded."); - } - } - - /** - * Returns base64 representation of specified byte array. - */ - public static String encode(byte[] data) { - return encode(data, 0, data.length); - } - - /** - * Returns base64 representation of specified byte array. - */ - public static String encode(byte[] data, int off, int len) { - if (len <= 0) { - return ""; - } - char[] out = new char[len / 3 * 4 + 4]; - int rindex = off; - int windex = 0; - int rest = len - off; - while (rest >= 3) { - int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); - out[windex++] = S_BASE64CHAR[i >> 18]; - out[windex++] = S_BASE64CHAR[(i >> 12) & 0x3f]; - out[windex++] = S_BASE64CHAR[(i >> 6) & 0x3f]; - out[windex++] = S_BASE64CHAR[i & 0x3f]; - rindex += 3; - rest -= 3; - } - if (rest == 1) { - int i = data[rindex] & 0xff; - out[windex++] = S_BASE64CHAR[i >> 2]; - out[windex++] = S_BASE64CHAR[(i << 4) & 0x3f]; - out[windex++] = S_BASE64PAD; - out[windex++] = S_BASE64PAD; - } else if (rest == 2) { - int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); - out[windex++] = S_BASE64CHAR[i >> 10]; - out[windex++] = S_BASE64CHAR[(i >> 4) & 0x3f]; - out[windex++] = S_BASE64CHAR[(i << 2) & 0x3f]; - out[windex++] = S_BASE64PAD; - } - return new String(out, 0, windex); - } - - /** - * Outputs base64 representation of the specified byte array to a byte stream. - */ - public static void encode(byte[] data, int off, int len, OutputStream ostream) throws IOException { - if (len <= 0) { - return; - } - byte[] out = new byte[4]; - int rindex = off; - int rest = len - off; - while (rest >= 3) { - int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); - out[0] = (byte)S_BASE64CHAR[i >> 18]; - out[1] = (byte)S_BASE64CHAR[(i >> 12) & 0x3f]; - out[2] = (byte)S_BASE64CHAR[(i >> 6) & 0x3f]; - out[3] = (byte)S_BASE64CHAR[i & 0x3f]; - ostream.write(out, 0, 4); - rindex += 3; - rest -= 3; - } - if (rest == 1) { - int i = data[rindex] & 0xff; - out[0] = (byte)S_BASE64CHAR[i >> 2]; - out[1] = (byte)S_BASE64CHAR[(i << 4) & 0x3f]; - out[2] = (byte)S_BASE64PAD; - out[3] = (byte)S_BASE64PAD; - ostream.write(out, 0, 4); - } else if (rest == 2) { - int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); - out[0] = (byte)S_BASE64CHAR[i >> 10]; - out[1] = (byte)S_BASE64CHAR[(i >> 4) & 0x3f]; - out[2] = (byte)S_BASE64CHAR[(i << 2) & 0x3f]; - out[3] = (byte)S_BASE64PAD; - ostream.write(out, 0, 4); - } - } - - /** - * Outputs base64 representation of the specified byte array to a character stream. - */ - public static void encode(byte[] data, int off, int len, Writer writer) throws IOException { - if (len <= 0) { - return; - } - char[] out = new char[4]; - int rindex = off; - int rest = len - off; - int output = 0; - while (rest >= 3) { - int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); - out[0] = S_BASE64CHAR[i >> 18]; - out[1] = S_BASE64CHAR[(i >> 12) & 0x3f]; - out[2] = S_BASE64CHAR[(i >> 6) & 0x3f]; - out[3] = S_BASE64CHAR[i & 0x3f]; - writer.write(out, 0, 4); - rindex += 3; - rest -= 3; - output += 4; - if (output % 76 == 0) { - writer.write("\n"); - } - } - if (rest == 1) { - int i = data[rindex] & 0xff; - out[0] = S_BASE64CHAR[i >> 2]; - out[1] = S_BASE64CHAR[(i << 4) & 0x3f]; - out[2] = S_BASE64PAD; - out[3] = S_BASE64PAD; - writer.write(out, 0, 4); - } else if (rest == 2) { - int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); - out[0] = S_BASE64CHAR[i >> 10]; - out[1] = S_BASE64CHAR[(i >> 4) & 0x3f]; - out[2] = S_BASE64CHAR[(i << 2) & 0x3f]; - out[3] = S_BASE64PAD; - writer.write(out, 0, 4); - } - } -} diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java deleted file mode 100644 index fc15b632d2..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java +++ /dev/null @@ -1,27 +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 org.apache.tuscany.sca.itest.serviceref; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface CComponent { - - String foo(); -} diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java deleted file mode 100644 index 276093b69f..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java +++ /dev/null @@ -1,30 +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 org.apache.tuscany.sca.itest.serviceref; - -import org.oasisopen.sca.annotation.Service; - -@Service(CComponent.class) -public class CComponentImpl implements CComponent { - - public String foo() { - return "CComponent"; - } - -} diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java deleted file mode 100644 index 84e15b5eb2..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java +++ /dev/null @@ -1,30 +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 org.apache.tuscany.sca.itest.serviceref; - -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface DComponent { - - String foo(ServiceReference<AComponent> aReference); - - String fooString(String aReferenceString); -} diff --git a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java b/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java deleted file mode 100644 index db99472385..0000000000 --- a/java/sca/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java +++ /dev/null @@ -1,64 +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 org.apache.tuscany.sca.itest.serviceref; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.oasisopen.sca.RequestContext; -import org.oasisopen.sca.ServiceReference; -import org.oasisopen.sca.annotation.Context; -import org.oasisopen.sca.annotation.Service; - -@Service(DComponent.class) -public class DComponentImpl implements DComponent { - - @Context - protected RequestContext requestContext; - - public String foo(ServiceReference<AComponent> aReference) { - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(aReference); - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())); - Object obj = ois.readObject(); - aReference = (ServiceReference<AComponent>) obj; - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println("Invoking service: " + requestContext.getServiceName()); - return "D" + aReference.getService().foo(); - } - - public String fooString(String aReferenceString) { - ServiceReference<AComponent> aReference = null; - try { - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64Binary.decode(aReferenceString))); - Object obj = ois.readObject(); - aReference = (ServiceReference<AComponent>) obj; - } catch (Exception e) { - e.printStackTrace(); - } - System.out.println("Invoking service: " + requestContext.getServiceName()); - return "D" + aReference.getService().foo(); - } -} diff --git a/java/sca/itest/service-reference/src/main/resources/nodeA/CompositeA.composite b/java/sca/itest/service-reference/src/main/resources/nodeA/CompositeA.composite deleted file mode 100644 index fb88cd8bea..0000000000 --- a/java/sca/itest/service-reference/src/main/resources/nodeA/CompositeA.composite +++ /dev/null @@ -1,44 +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 - * 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://docs.oasis-open.org/ns/opencsa/sca/200903" - xmlns:foo="http://foo" - targetNamespace="http://foo" - name="CompositeA" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <component name="AComponent"> - <implementation.java class="org.apache.tuscany.sca.itest.serviceref.AComponentImpl" /> - <service name="AComponent"> - <binding.ws uri="http://localhost:8084/AComponent"/> - </service> - <reference name="bReference"> - <binding.ws uri="http://localhost:8085/BComponent" /> - </reference> - <reference name="cReference"> - <binding.ws uri="http://localhost:8085/CComponent" /> - </reference> - <reference name="cServiceReference"> - <binding.ws uri="http://localhost:8085/CComponent" /> - </reference> - <reference name="dReference1"> - <binding.ws uri="http://localhost:8085/DComponent" /> - </reference> - </component> - -</composite>
\ No newline at end of file diff --git a/java/sca/itest/service-reference/src/main/resources/nodeB/CompositeB.composite b/java/sca/itest/service-reference/src/main/resources/nodeB/CompositeB.composite deleted file mode 100644 index 06e4c63e94..0000000000 --- a/java/sca/itest/service-reference/src/main/resources/nodeB/CompositeB.composite +++ /dev/null @@ -1,46 +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 - * 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://docs.oasis-open.org/ns/opencsa/sca/200903" - xmlns:foo="http://foo" - targetNamespace="http://foo" - name="CompositeB" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <component name="BComponent"> - <implementation.java class="org.apache.tuscany.sca.itest.serviceref.BComponentImpl" /> - <service name="BComponent"> - <binding.ws uri="http://localhost:8085/BComponent"/> - </service> - </component> - - <component name="CComponent"> - <implementation.java class="org.apache.tuscany.sca.itest.serviceref.CComponentImpl" /> - <service name="CComponent"> - <binding.ws uri="http://localhost:8085/CComponent"/> - </service> - </component> - - <component name="DComponent"> - <implementation.java class="org.apache.tuscany.sca.itest.serviceref.DComponentImpl" /> - <service name="DComponent"> - <binding.ws uri="http://localhost:8085/DComponent"/> - </service> - </component> - -</composite>
\ No newline at end of file diff --git a/java/sca/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite b/java/sca/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite deleted file mode 100644 index 63302847b5..0000000000 --- a/java/sca/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite +++ /dev/null @@ -1,48 +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 - * 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://docs.oasis-open.org/ns/opencsa/sca/200903" - xmlns:foo="http://foo" - targetNamespace="http://foo" - name="InnerReferencesTest" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <service name="AComponent" promote="AComponent"> - <interface.java interface="org.apache.tuscany.sca.itest.serviceref.AComponent" /> - </service> - - <component name="AComponent"> - <implementation.java class="org.apache.tuscany.sca.itest.serviceref.AComponentImpl" /> - <reference name="bReference" target="BComponent" /> - <reference name="cReference" target="CComponent" /> - <reference name="cServiceReference" target="CComponent" /> - <reference name="dReference1" target="DComponent" /> - </component> - - <component name="BComponent"> - <implementation.java class="org.apache.tuscany.sca.itest.serviceref.BComponentImpl" /> - </component> - - <component name="CComponent"> - <implementation.java class="org.apache.tuscany.sca.itest.serviceref.CComponentImpl" /> - </component> - - <component name="DComponent"> - <implementation.java class="org.apache.tuscany.sca.itest.serviceref.DComponentImpl" /> - </component> -</composite>
\ No newline at end of file |