summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca')
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloService.java42
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceClient.java41
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java51
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java50
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java84
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java81
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceClientImpl.java73
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceImpl.java86
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java139
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java151
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java159
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java207
-rw-r--r--sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java142
13 files changed, 1306 insertions, 0 deletions
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloService.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloService.java
new file mode 100644
index 0000000000..ab2d9630eb
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloService.java
@@ -0,0 +1,42 @@
+/*
+ * 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.databindings.jaxb;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The interface for HelloService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface HelloService {
+ String getGreetings(String name);
+ String[] getGreetingsArray(String[] names);
+ List<String> getGreetingsList(List<String> names);
+ ArrayList<String> getGreetingsArrayList(ArrayList<String> names);
+ Map<String, String> getGreetingsMap(Map<String, String> namesMap);
+ HashMap<String, String> getGreetingsHashMap(HashMap<String, String> namesMap);
+ String getGreetingsVarArgs(String... names);
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceClient.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceClient.java
new file mode 100644
index 0000000000..7bd95cec95
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/HelloServiceClient.java
@@ -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 org.apache.tuscany.sca.itest.databindings.jaxb;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * The interface for HelloServiceClient.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface HelloServiceClient {
+ String getGreetingsForward(String name);
+ String[] getGreetingsArrayForward(String[] names);
+ List<String> getGreetingsListForward(List<String> names);
+ ArrayList<String> getGreetingsArrayListForward(ArrayList<String> names);
+ Map<String, String> getGreetingsMapForward(Map<String, String> namesMap);
+ HashMap<String, String> getGreetingsHashMapForward(HashMap<String, String> namesMap);
+ String getGreetingsVarArgsForward(String... names);
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java
new file mode 100644
index 0000000000..ac6c8d5a60
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesService.java
@@ -0,0 +1,51 @@
+/*
+ * 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.databindings.jaxb;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+/**
+ * The interface for PrimitivesService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface PrimitivesService {
+ boolean negateBoolean(boolean flag);
+ boolean[] negateBooleanArray(boolean[] flags);
+ boolean[] identityBooleanArray(boolean[] flags);
+ byte negateByte(byte b);
+ byte[] negateByteArray(byte[] ba);
+ byte[] identityByteArray(byte[] ba);
+ short negateShort(short s);
+ short[] negateShortArray(short[] s);
+ short[] identityShortArray(short[] sa);
+ int negateInt(int s);
+ int[] negateIntArray(int[] s);
+ int[] identityIntArray(int[] ia);
+ long negateLong(long l);
+ long[] negateLongArray(long[] la);
+ long[] identityLongArray(long[] la);
+ float negateFloat(float f);
+ float[] negateFloatArray(float[] fa);
+ float[] identityFloatArray(float[] fa);
+ double negateDouble(double d);
+ double[] negateDoubleArray(double[] da);
+ double[] identityDoubleArray(double[] da);
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java
new file mode 100644
index 0000000000..3a5a81bae4
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/PrimitivesServiceClient.java
@@ -0,0 +1,50 @@
+/*
+ * 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.databindings.jaxb;
+
+
+/**
+ * The interface for PrimitivesServiceClient.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PrimitivesServiceClient {
+ boolean negateBooleanForward(boolean flag);
+ boolean[] negateBooleanArrayForward(boolean[] flags);
+ boolean passByValueBooleanArray();
+ byte negateByteForward(byte b);
+ byte[] negateByteArrayForward(byte[] ba);
+ boolean passByValueByteArray();
+ short negateShortForward(short s);
+ short[] negateShortArrayForward(short[] sa);
+ boolean passByValueShortArray();
+ int negateIntForward(int i);
+ int[] negateIntArrayForward(int[] ia);
+ boolean passByValueIntArray();
+ long negateLongForward(long l);
+ long[] negateLongArrayForward(long[] la);
+ boolean passByValueLongArray();
+ float negateFloatForward(float f);
+ float[] negateFloatArrayForward(float[] fa);
+ boolean passByValueFloatArray();
+ double negateDoubleForward(double d);
+ double[] negateDoubleArrayForward(double[] da);
+ boolean passByValueDoubleArray();
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java
new file mode 100644
index 0000000000..1f3b7ec633
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesService.java
@@ -0,0 +1,84 @@
+/*
+ * 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.databindings.jaxb;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+
+
+/**
+ * The interface for StandardTypesService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface StandardTypesService {
+ BigInteger getNewBigInteger(BigInteger bi);
+ BigInteger[] getNewBigIntegerArray(BigInteger[] bia);
+
+ BigDecimal getNewBigDecimal(BigDecimal bd);
+ BigDecimal[] getNewBigDecimalArray(BigDecimal[] bda);
+
+ Calendar getNewCalendar(Calendar c);
+ Calendar[] getNewCalendarArray(Calendar[] ca);
+
+ Date getNewDate(Date d);
+ Date[] getNewDateArray(Date[] da);
+
+ QName getNewQName(QName qname);
+ QName[] getNewQNameArray(QName[] qnames);
+
+ URI getNewURI(URI uri);
+ URI[] getNewURIArray(URI[] uris);
+
+ XMLGregorianCalendar getNewXMLGregorianCalendar(XMLGregorianCalendar xgcal);
+ XMLGregorianCalendar[] getNewXMLGregorianCalendarArray(XMLGregorianCalendar[] xgcal);
+
+ Duration getNewDuration(Duration d);
+ Duration[] getNewDurationArray(Duration[] da);
+
+ Object getNewObject(Object obj);
+ Object[] getNewObjectArray(Object[] objs);
+
+ Image getNewImage(Image img);
+ Image[] getNewImageArray(Image[] imgs);
+
+ DataHandler getNewDataHandler(DataHandler dh);
+ DataHandler[] getNewDataHandlerArray(DataHandler[] dha);
+
+ Source getNewSource(Source src);
+ Source[] getNewSourceArray(Source[] srcs);
+
+ UUID getNewUUID(UUID uuid);
+ UUID[] getNewUUIDArray(UUID[] uuids);
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java
new file mode 100644
index 0000000000..0c073cd054
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/StandardTypesServiceClient.java
@@ -0,0 +1,81 @@
+/*
+ * 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.databindings.jaxb;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+
+/**
+ * The interface for StandardTypesServiceClient.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StandardTypesServiceClient {
+ BigInteger getNewBigIntegerForward(BigInteger bi);
+ BigInteger[] getNewBigIntegerArrayForward(BigInteger[] bia);
+
+ BigDecimal getNewBigDecimalForward(BigDecimal bd);
+ BigDecimal[] getNewBigDecimalArrayForward(BigDecimal[] bda);
+
+ Calendar getNewCalendarForward(Calendar c);
+ Calendar[] getNewCalendarArrayForward(Calendar[] ca);
+
+ Date getNewDateForward(Date d);
+ Date[] getNewDateArrayForward(Date[] da);
+
+ QName getNewQNameForward(QName qname);
+ QName[] getNewQNameArrayForward(QName[] qnames);
+
+ URI getNewURIForward(URI uri);
+ URI[] getNewURIArrayForward(URI[] uris);
+
+ XMLGregorianCalendar getNewXMLGregorianCalendarForward(XMLGregorianCalendar xgcal);
+ XMLGregorianCalendar[] getNewXMLGregorianCalendarArrayForward(XMLGregorianCalendar[] xgcals);
+
+ Duration getNewDurationForward(Duration d);
+ Duration[] getNewDurationArrayForward(Duration[] da);
+
+ Object getNewObjectForward(Object obj);
+ Object[] getNewObjectArrayForward(Object[] objs);
+
+ Image getNewImageForward(Image img);
+ Image[] getNewImageArrayForward(Image[] imgs);
+
+ DataHandler getNewDataHandlerForward(DataHandler dh);
+ DataHandler[] getNewDataHandlerArrayForward(DataHandler[] dha);
+
+ Source getNewSourceForward(Source src);
+ Source[] getNewSourceArrayForward(Source[] srcs);
+
+ UUID getNewUUIDForward(UUID uuid);
+ UUID[] getNewUUIDArrayForward(UUID[] uuids);
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceClientImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceClientImpl.java
new file mode 100644
index 0000000000..61449c8981
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceClientImpl.java
@@ -0,0 +1,73 @@
+/*
+ * 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.databindings.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceClient;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * An implementation of HelloServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ */
+@Service(HelloServiceClient.class)
+public class HelloServiceClientImpl {
+
+ private HelloService service;
+
+ @Reference
+ public void setHelloService(HelloService service) {
+ this.service = service;
+ }
+
+ public String getGreetingsForward(String name) {
+ return service.getGreetings(name);
+ }
+
+ public String[] getGreetingsArrayForward(String[] names) {
+ return service.getGreetingsArray(names);
+ }
+
+ public List<String> getGreetingsListForward(List<String> names) {
+ return service.getGreetingsList(names);
+ }
+
+ public Map<String, String> getGreetingsMapForward(Map<String, String> namesMap) {
+ return service.getGreetingsMap(namesMap);
+ }
+
+ public ArrayList<String> getGreetingsArrayListForward(ArrayList<String> names) {
+ return service.getGreetingsArrayList(names);
+ }
+
+ public HashMap<String, String> getGreetingsHashMapForward(HashMap<String, String> namesMap) {
+ return service.getGreetingsHashMap(namesMap);
+ }
+
+ public String getGreetingsVarArgsForward(String... names) {
+ return service.getGreetingsVarArgs(names[0], names[1], names[2]);
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceImpl.java
new file mode 100644
index 0000000000..690001bfe1
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/HelloServiceImpl.java
@@ -0,0 +1,86 @@
+/*
+ * 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.databindings.jaxb.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.HelloService;
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * An implementation of HelloService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(HelloService.class)
+public class HelloServiceImpl implements HelloService {
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public String[] getGreetingsArray(String[] names) {
+ String[] resps = new String[names.length];
+ for (int i = 0; i < names.length; ++i) {
+ resps[i] = "Hello " + names[i];
+ }
+ return resps;
+ }
+
+ public List<String> getGreetingsList(List<String> names) {
+ List<String> resps = new ArrayList<String>();
+ for (int i = 0; i < names.size(); ++i) {
+ resps.add("Hello " + names.get(i));
+ }
+ return resps;
+ }
+
+ public ArrayList<String> getGreetingsArrayList(ArrayList<String> names) {
+ ArrayList<String> resps = new ArrayList<String>();
+ for (int i = 0; i < names.size(); ++i) {
+ resps.add("Hello " + names.get(i));
+ }
+ return resps;
+ }
+
+ public Map<String, String> getGreetingsMap(Map<String, String> namesMap) {
+ for (Map.Entry<String, String> entry : namesMap.entrySet()) {
+ entry.setValue("Hello " + entry.getKey());
+ }
+ return namesMap;
+ }
+
+ public HashMap<String, String> getGreetingsHashMap(HashMap<String, String> namesMap) {
+ for (Map.Entry<String, String> entry : namesMap.entrySet()) {
+ entry.setValue("Hello " + entry.getKey());
+ }
+ return namesMap;
+ }
+
+ public String getGreetingsVarArgs(String... names) {
+ String resp = "Hello";
+ for(int i = 0; i < names.length; ++i) {
+ resp += (" "+names[i]);
+ }
+ return resp;
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java
new file mode 100644
index 0000000000..e55d2527f4
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceClientImpl.java
@@ -0,0 +1,139 @@
+/*
+ * 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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesServiceClient;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * An implementation of PrimitivesServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(PrimitivesServiceClient.class)
+public class PrimitivesServiceClientImpl {
+
+ private PrimitivesService service;
+
+ @Reference
+ public void setPrimitivesService(PrimitivesService service) {
+ this.service = service;
+ }
+ public boolean negateBooleanForward(boolean flag) {
+ return service.negateBoolean(flag);
+ }
+
+ public boolean[] negateBooleanArrayForward(boolean[] flags) {
+ return service.negateBooleanArray(flags);
+ }
+
+ public boolean passByValueBooleanArray() {
+ boolean[] req = new boolean[2];
+ boolean[] resp = service.identityBooleanArray(req);
+ return req != resp;
+ }
+
+ public byte negateByteForward(byte b) {
+ return service.negateByte(b);
+ }
+
+ public byte[] negateByteArrayForward(byte[] ba) {
+ return service.negateByteArray(ba);
+ }
+
+ public boolean passByValueByteArray() {
+ byte[] req = new byte[2];
+ byte[] resp = service.identityByteArray(req);
+ return req != resp;
+ }
+
+ public short negateShortForward(short s) {
+ return service.negateShort(s);
+ }
+
+ public short[] negateShortArrayForward(short[] s) {
+ return service.negateShortArray(s);
+ }
+
+ public boolean passByValueShortArray() {
+ short[] req = new short[2];
+ short[] resp = service.identityShortArray(req);
+ return req != resp;
+ }
+
+ public int negateIntForward(int i) {
+ return service.negateInt(i);
+ }
+
+ public int[] negateIntArrayForward(int[] ia) {
+ return service.negateIntArray(ia);
+ }
+
+ public boolean passByValueIntArray() {
+ int[] req = new int[2];
+ int[] resp = service.identityIntArray(req);
+ return req != resp;
+ }
+
+ public long negateLongForward(long l) {
+ return service.negateLong(l);
+ }
+
+ public long[] negateLongArrayForward(long[] la) {
+ return service.negateLongArray(la);
+ }
+
+ public boolean passByValueLongArray() {
+ long[] req = new long[2];
+ long[] resp = service.identityLongArray(req);
+ return req != resp;
+ }
+
+ public float negateFloatForward(float f) {
+ return service.negateFloat(f);
+ }
+
+ public float[] negateFloatArrayForward(float[] fa) {
+ return service.negateFloatArray(fa);
+ }
+
+ public boolean passByValueFloatArray() {
+ float[] req = new float[2];
+ float[] resp = service.identityFloatArray(req);
+ return req != resp;
+ }
+
+ public double negateDoubleForward(double d) {
+ return service.negateDouble(d);
+ }
+
+ public double[] negateDoubleArrayForward(double[] da) {
+ return service.negateDoubleArray(da);
+ }
+
+ public boolean passByValueDoubleArray() {
+ double[] req = new double[2];
+ double[] resp = service.identityDoubleArray(req);
+ return req != resp;
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java
new file mode 100644
index 0000000000..60ff4163d0
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesServiceImpl.java
@@ -0,0 +1,151 @@
+/*
+ * 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.databindings.jaxb.impl;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesService;
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * An implementation of PrimitivesService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(PrimitivesService.class)
+public class PrimitivesServiceImpl implements PrimitivesService {
+
+ public boolean negateBoolean(boolean flag) {
+ return !flag;
+ }
+
+ public boolean[] negateBooleanArray(boolean[] flags) {
+ boolean[] resp = new boolean[flags.length];
+
+ for(int i = 0; i < flags.length; ++i) {
+ resp[i] = !flags[i];
+ }
+ return resp;
+ }
+
+ public boolean[] identityBooleanArray(boolean[] flags) {
+ return flags;
+ }
+
+ public byte negateByte(byte b) {
+ return (byte)-b;
+ }
+
+ public byte[] negateByteArray(byte[] ba) {
+ byte[] resp = new byte[ba.length];
+
+ for(int i = 0; i < ba.length; ++i) {
+ resp[i] = (byte)-ba[i];
+ }
+ return resp;
+ }
+
+ public byte[] identityByteArray(byte[] ba) {
+ return ba;
+ }
+
+ public short negateShort(short s) {
+ return (short)-s;
+ }
+
+ public short[] negateShortArray(short[] s) {
+ short[] resp = new short[s.length];
+
+ for(int i = 0; i < s.length; ++i) {
+ resp[i] = (short)-s[i];
+ }
+ return resp;
+ }
+
+ public short[] identityShortArray(short[] sa) {
+ return sa;
+ }
+
+ public int negateInt(int i) {
+ return -i;
+ }
+
+ public int[] negateIntArray(int[] ia) {
+ int[] resp = new int[ia.length];
+
+ for(int i = 0; i < ia.length; ++i) {
+ resp[i] = -ia[i];
+ }
+ return resp;
+ }
+
+ public int[] identityIntArray(int[] ia) {
+ return ia;
+ }
+
+ public long negateLong(long l) {
+ return -l;
+ }
+
+ public long[] negateLongArray(long[] la) {
+ long[] resp = new long[la.length];
+
+ for(int i = 0; i < la.length; ++i) {
+ resp[i] = -la[i];
+ }
+ return resp;
+ }
+
+ public long[] identityLongArray(long[] la) {
+ return la;
+ }
+
+ public float negateFloat(float f) {
+ return -f;
+ }
+
+ public float[] negateFloatArray(float[] fa) {
+ float[] resp = new float[fa.length];
+
+ for(int i = 0; i < fa.length; ++i) {
+ resp[i] = -fa[i];
+ }
+ return resp;
+ }
+
+ public float[] identityFloatArray(float[] fa) {
+ return fa;
+ }
+
+ public double negateDouble(double d) {
+ return -d;
+ }
+
+ public double[] negateDoubleArray(double[] da) {
+ double[] resp = new double[da.length];
+
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = -da[i];
+ }
+ return resp;
+ }
+
+ public double[] identityDoubleArray(double[] da) {
+ return da;
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java
new file mode 100644
index 0000000000..b3d3c3eb3a
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceClientImpl.java
@@ -0,0 +1,159 @@
+/*
+ * 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.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService;
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesServiceClient;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * An implementation of StandardTypesServiceClient.
+ * The client forwards the request to the service component and returns the response from the service component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(StandardTypesServiceClient.class)
+public class StandardTypesServiceClientImpl implements StandardTypesServiceClient{
+
+ private StandardTypesService service;
+
+ @Reference
+ public void setStandardTypesService(StandardTypesService service) {
+ this.service = service;
+ }
+
+ public BigInteger getNewBigIntegerForward(BigInteger bi) {
+ return service.getNewBigInteger(bi);
+ }
+
+ public BigInteger[] getNewBigIntegerArrayForward(BigInteger[] bia) {
+ return service.getNewBigIntegerArray(bia);
+ }
+
+ public BigDecimal getNewBigDecimalForward(BigDecimal bd) {
+ return service.getNewBigDecimal(bd);
+ }
+
+ public BigDecimal[] getNewBigDecimalArrayForward(BigDecimal[] bda) {
+ return service.getNewBigDecimalArray(bda);
+ }
+ public Calendar getNewCalendarForward(Calendar c) {
+ return service.getNewCalendar(c);
+ }
+ public Calendar[] getNewCalendarArrayForward(Calendar[] ca) {
+ return service.getNewCalendarArray(ca);
+ }
+
+ public Date getNewDateForward(Date d) {
+ return service.getNewDate(d);
+ }
+
+ public Date[] getNewDateArrayForward(Date[] da) {
+ return service.getNewDateArray(da);
+ }
+
+ public QName getNewQNameForward(QName qname) {
+ return service.getNewQName(qname);
+ }
+
+ public QName[] getNewQNameArrayForward(QName[] qnames) {
+ return service.getNewQNameArray(qnames);
+ }
+
+ public URI getNewURIForward(URI uri) {
+ return service.getNewURI(uri);
+ }
+
+ public URI[] getNewURIArrayForward(URI[] uris) {
+ return service.getNewURIArray(uris);
+ }
+
+ public XMLGregorianCalendar getNewXMLGregorianCalendarForward(XMLGregorianCalendar xgcal) {
+ return service.getNewXMLGregorianCalendar(xgcal);
+ }
+
+ public XMLGregorianCalendar[] getNewXMLGregorianCalendarArrayForward(XMLGregorianCalendar[] xgcals) {
+ return service.getNewXMLGregorianCalendarArray(xgcals);
+ }
+
+ public Duration getNewDurationForward(Duration d) {
+ return service.getNewDuration(d);
+ }
+
+ public Duration[] getNewDurationArrayForward(Duration[] da) {
+ return service.getNewDurationArray(da);
+ }
+
+ public Object getNewObjectForward(Object obj) {
+ return service.getNewObject(obj);
+ }
+
+ public Object[] getNewObjectArrayForward(Object[] objs) {
+ return service.getNewObjectArray(objs);
+ }
+
+ public Image getNewImageForward(Image img) {
+ return service.getNewImage(img);
+ }
+
+ public Image[] getNewImageArrayForward(Image[] imgs) {
+ return service.getNewImageArray(imgs);
+ }
+
+ public DataHandler getNewDataHandlerForward(DataHandler dh) {
+ return service.getNewDataHandler(dh);
+ }
+
+ public DataHandler[] getNewDataHandlerArrayForward(DataHandler[] dha) {
+ return service.getNewDataHandlerArray(dha);
+ }
+
+
+ public Source getNewSourceForward(Source src) {
+ return service.getNewSource(src);
+ }
+
+ public Source[] getNewSourceArrayForward(Source[] srcs) {
+ return service.getNewSourceArray(srcs);
+ }
+
+ public UUID getNewUUIDForward(UUID uuid) {
+ return service.getNewUUID(uuid);
+ }
+
+ public UUID[] getNewUUIDArrayForward(UUID[] uuids) {
+ return service.getNewUUIDArray(uuids);
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java
new file mode 100644
index 0000000000..1fa525a0ee
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesServiceImpl.java
@@ -0,0 +1,207 @@
+/*
+ * 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.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+
+import org.apache.tuscany.sca.itest.databindings.jaxb.StandardTypesService;
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ * An implementation of StandardTypesService.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(StandardTypesService.class)
+public class StandardTypesServiceImpl implements StandardTypesService {
+ public BigInteger getNewBigInteger(BigInteger bi) {
+ return bi.negate();
+ }
+
+ public BigInteger[] getNewBigIntegerArray(BigInteger[] bia) {
+ BigInteger[] resp = new BigInteger[bia.length];
+ for(int i = 0; i < bia.length; ++i) {
+ resp[i] = bia[i].negate();
+ }
+ return resp;
+ }
+
+ public BigDecimal getNewBigDecimal(BigDecimal bd) {
+ return bd.negate();
+ }
+
+ public BigDecimal[] getNewBigDecimalArray(BigDecimal[] bda) {
+ BigDecimal[] resp = new BigDecimal[bda.length];
+ for(int i = 0; i < bda.length; ++i) {
+ resp[i] = bda[i].negate();
+ }
+ return resp;
+ }
+
+ public Calendar getNewCalendar(Calendar c) {
+ Calendar resp = (Calendar)c.clone();
+ resp.add(Calendar.DAY_OF_MONTH, 5);
+ return resp;
+ }
+
+ public Calendar[] getNewCalendarArray(Calendar[] ca) {
+ Calendar[] resp = new Calendar[ca.length];
+ for(int i = 0; i < ca.length; ++i) {
+ resp[i] = getNewCalendar(ca[i]);
+ }
+ return resp;
+ }
+
+ public Date getNewDate(Date d) {
+ return new Date(d.getTime() + 5*24*60*60*1000);
+ }
+
+ public Date[] getNewDateArray(Date[] da) {
+ Date[] resp = new Date[da.length];
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = getNewDate(da[i]);
+ }
+ return resp;
+ }
+
+ public QName getNewQName(QName qname) {
+ return new QName(qname.getNamespaceURI()+"q", qname.getLocalPart()+"q", qname.getPrefix()+"q");
+
+ }
+
+ public QName[] getNewQNameArray(QName[] qnames) {
+ QName[] resp = new QName[qnames.length];
+ for(int i = 0; i < qnames.length; ++i) {
+ resp[i] = getNewQName(qnames[i]);
+ }
+ return resp;
+ }
+
+ public URI getNewURI(URI uri) {
+ return uri.resolve("uri");
+ }
+
+ public URI[] getNewURIArray(URI[] uris) {
+ URI[] resp = new URI[uris.length];
+ for(int i = 0; i < uris.length; ++i) {
+ resp[i] = getNewURI(uris[i]);
+ }
+ return resp;
+ }
+
+ public XMLGregorianCalendar getNewXMLGregorianCalendar(XMLGregorianCalendar xgcal) {
+ xgcal = (XMLGregorianCalendar)xgcal.clone();
+ xgcal.setDay(xgcal.getDay()+5);
+ return xgcal;
+ }
+
+ public XMLGregorianCalendar[] getNewXMLGregorianCalendarArray(XMLGregorianCalendar[] xgcals) {
+ XMLGregorianCalendar[] resp = new XMLGregorianCalendar[xgcals.length];
+ for(int i = 0; i < xgcals.length; ++i) {
+ resp[i] = getNewXMLGregorianCalendar(xgcals[i]);
+ }
+ return resp;
+ }
+
+ public Duration getNewDuration(Duration d) {
+ return d.negate();
+ }
+
+ public Duration[] getNewDurationArray(Duration[] da) {
+ Duration[] resp = new Duration[da.length];
+ for(int i = 0; i < da.length; ++i) {
+ resp[i] = da[i].negate();
+ }
+ return resp;
+ }
+
+ public Object getNewObject(Object obj) {
+ return StandardTypesTransformer.getNewObject(obj);
+ }
+
+ public Object[] getNewObjectArray(Object[] objs) {
+ Object[] resp = new Object[objs.length];
+ for(int i = 0; i < objs.length; ++i) {
+ resp[i] = getNewObject(objs[i]);
+ }
+ return resp;
+ }
+
+ public Image getNewImage(Image img) {
+ return StandardTypesTransformer.getNewImage(img);
+ }
+
+ public Image[] getNewImageArray(Image[] imgs) {
+ Image[] resp = new Image[imgs.length];
+ for(int i = 0; i < imgs.length; ++i) {
+ resp[i] = getNewImage(imgs[i]);
+ }
+ return resp;
+ }
+
+ public DataHandler getNewDataHandler(DataHandler dh) {
+ // FIXME: transform the input
+ return dh;
+ }
+
+ public DataHandler[] getNewDataHandlerArray(DataHandler[] dha) {
+ DataHandler[] resp = new DataHandler[dha.length];
+ for(int i = 0; i < dha.length; ++i) {
+ resp[i] = dha[i];
+ }
+ return resp;
+ }
+
+ public Source getNewSource(Source src) {
+ return StandardTypesTransformer.getNewSource(src);
+ }
+
+ public Source[] getNewSourceArray(Source[] srcs) {
+ Source[] resp = new Source[srcs.length];
+ for(int i = 0; i < srcs.length; ++i) {
+ resp[i] = getNewSource(srcs[i]);
+ }
+ return resp;
+ }
+
+ public UUID getNewUUID(UUID uuid) {
+ return UUID.fromString(uuid.toString()+"AAA");
+ }
+
+ public UUID[] getNewUUIDArray(UUID[] uuids) {
+ UUID[] resp = new UUID[uuids.length];
+ for(int i = 0; i < uuids.length; ++i) {
+ resp[i] = getNewUUID(uuids[i]);
+ }
+ return resp;
+ }
+}
diff --git a/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java
new file mode 100644
index 0000000000..9d851455da
--- /dev/null
+++ b/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-top-down/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/StandardTypesTransformer.java
@@ -0,0 +1,142 @@
+/*
+ * 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.databindings.jaxb.impl;
+
+import java.awt.Image;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayReader;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+
+/**
+ * StandardTypesTransformer class that provide for transforming input provided to StandardTypesService methods.
+ *
+ * @version $Rev$ $Date$
+ */
+public class StandardTypesTransformer {
+
+ public static Object getNewObject(Object obj) {
+ if(obj instanceof String) {
+ return "Hello "+obj;
+ } else if(obj instanceof Integer) {
+ return new Integer(-((Integer)obj).intValue());
+ } else if(obj instanceof Double) {
+ return new Double(-((Double)obj).doubleValue());
+ }
+
+ return obj;
+ }
+
+ /**
+ * Returns a copy of the source object if the input is DOMSource, SAXSource or StreamSource.
+ * Returns the input object as is for other types.
+ */
+ public static Source getNewSource(Source src) {
+ Source ret = null;
+ if(src instanceof DOMSource) {
+ DOMSource dsrc = (DOMSource)src;
+ ret = new DOMSource(dsrc.getNode() != null ? dsrc.getNode().cloneNode(true) : null);
+ } else if(src instanceof SAXSource) {
+ SAXSource ssrc = (SAXSource)src;
+ if(ssrc.getInputSource().getByteStream() != null) {
+ InputStream inp = ssrc.getInputSource().getByteStream();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ int b;
+ try {
+ while((b = inp.read()) != -1) {
+ bout.write(b);
+ }
+ } catch (IOException ignored) {
+ }
+ try { bout.close();} catch (IOException ignored) {}
+ try { inp.reset();} catch (IOException ignored) {}
+ ret = new SAXSource(new InputSource(new ByteArrayInputStream(bout.toByteArray())));
+ } else if(ssrc.getInputSource().getCharacterStream() != null) {
+ Reader rdr = ssrc.getInputSource().getCharacterStream();
+ CharArrayWriter caw = new CharArrayWriter();
+ try {
+ int c;
+ while((c = rdr.read()) != -1) {
+ caw.append((char)c);
+ }
+ } catch (IOException ignored) {
+ }
+ caw.close();
+ try{ rdr.reset();} catch(IOException ignored) {}
+ ret = new SAXSource(new InputSource(new CharArrayReader(caw.toCharArray())));
+ } else {
+ ret = new SAXSource();
+ }
+ } else if(src instanceof StreamSource) {
+ StreamSource ssrc = (StreamSource)src;
+ if(ssrc.getInputStream() != null) {
+ InputStream inp = ssrc.getInputStream();
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ int b;
+ try {
+ while((b = inp.read()) != -1) {
+ bout.write(b);
+ }
+ } catch (IOException ignored) {
+ }
+ try { bout.close();} catch (IOException ignored) {}
+ try { inp.reset();} catch (IOException ignored) {}
+ ret = new StreamSource(new ByteArrayInputStream(bout.toByteArray()));
+ } else if(ssrc.getReader() != null) {
+ Reader rdr = ssrc.getReader();
+ CharArrayWriter caw = new CharArrayWriter();
+ try {
+ int c;
+ while((c = rdr.read()) != -1) {
+ caw.append((char)c);
+ }
+ } catch (IOException ignored) {
+ }
+ caw.close();
+ try{ rdr.reset();} catch(IOException ignored) {}
+ ret = new StreamSource(new CharArrayReader(caw.toCharArray()));
+ } else {
+ ret = new StreamSource();
+ }
+ }
+
+ if(ret != null) {
+ ret.setSystemId(src.getSystemId());
+ } else {
+ ret = src;
+ }
+ return ret;
+ }
+
+ public static Image getNewImage(Image arg) {
+ arg.getGraphics().drawOval(2, 2, 7, 7);
+ return arg;
+ }
+}