summaryrefslogtreecommitdiffstats
path: root/sandbox/axis2-1.4/vtest/java-api/annotations/scope/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/impl/GServiceImpl.java
blob: b230a46c01fe0b5dbdf0d1dbfd999483303631b5 (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
package org.apache.tuscany.sca.vtest.javaapi.annotations.scope.impl;

import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.AService;
import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.GService;
import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.EagerInit;

@Scope("COMPOSITE")
@EagerInit
public class GServiceImpl implements GService {

	public static int initCalledCounter = 0;

	public static int destroyCalledCounter = 0;
	
	public AService a1;
	
	public String p1;
	
	@Init
    public void initGService() throws Exception {
    	initCalledCounter++;
    	System.out.println("GService->initGService");
    }

    @Destroy
    public void destroyGService() {
    	destroyCalledCounter++;
    	System.out.println("GService->destroyGService");
    }
    
	@Reference
	public void setA1(AService a1) {
		this.a1 = a1;
	}

	@Property
	public void setP1(String p1) {
		this.p1 = p1;
	}
	
    public String getName() {
        return "GService";
    }
    
	public int getInitCalledCounter() {
		return initCalledCounter;
	}

	public int getDestroyCalledCounter() {
		return destroyCalledCounter;
	}
}