summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/tags/2.0.1-RC1/testing/itest/databindings/jaxb-bottom-up/src/main/java/org/apache/tuscany/sca/itest/databindings/jaxb/impl/PrimitivesLocalServiceClientImpl.java
blob: eea19521c45ef4bfb4871efad755a4f787ddb597 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * 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.PrimitivesLocalService;
import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesServiceClient;
import org.oasisopen.sca.annotation.Reference;
import org.oasisopen.sca.annotation.Service;

/**
 * An implementation of PrimitivesLocalServiceClient.
 * The client forwards the request to the service component and returns the response from the service component.
 */
@Service(PrimitivesServiceClient.class)
public class PrimitivesLocalServiceClientImpl implements PrimitivesServiceClient {

    private PrimitivesLocalService service;

    @Reference(required=false)
    protected void setPrimitivesLocalService(PrimitivesLocalService 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;
    }
}