KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > test > service > ServiceSeven


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.ejb3.test.service;
23
24 import org.jboss.annotation.ejb.Service;
25
26 /**
27  * @author <a HREF="mailto:kabir.khan@jboss.org">Kabir Khan</a>
28  * @version $Revision: 38571 $
29  */

30 @Service
31 public class ServiceSeven implements ServiceSevenLocal, ServiceSevenRemote, ServiceSevenManagement
32 {
33    static int instances = 0;
34    int localMethodCalls;
35    int remoteMethodCalls;
36    int jmxAttribute;
37    int someJmxAttribute;
38    int otherJmxAttribute;
39    int readWriteOnlyAttribute;
40
41    public ServiceSeven()
42    {
43       instances++;
44    }
45
46    public int getInstances()
47    {
48       return instances;
49    }
50
51    public int getRemoteMethodCalls()
52    {
53       return remoteMethodCalls;
54    }
55
56    public void setRemoteMethodCalls(int i)
57    {
58       remoteMethodCalls = i;
59    }
60
61    public int getLocalMethodCalls()
62    {
63       return localMethodCalls;
64    }
65
66    public void setLocalMethodCalls(int i)
67    {
68       localMethodCalls = i;
69    }
70
71    public synchronized void localMethod(String JavaDoc s)
72    {
73       localMethodCalls++;
74    }
75
76    public synchronized void remoteMethod(String JavaDoc s)
77    {
78       remoteMethodCalls++;
79    }
80
81    public String JavaDoc jmxOperation(String JavaDoc s)
82    {
83       return "x" + s + "x";
84    }
85
86    public String JavaDoc[] jmxOperation(String JavaDoc[] s)
87    {
88       for (int i = 0 ; i < s.length ; i++)
89       {
90          s[i] = jmxOperation(s[i]);
91       }
92       return s;
93    }
94
95    public int getAttribute()
96    {
97       return jmxAttribute;
98    }
99
100    public void setAttribute(int i)
101    {
102       jmxAttribute = i;
103    }
104
105    public int getSomeAttr()
106    {
107       return someJmxAttribute;
108    }
109
110    public void setSomeAttr(int i)
111    {
112       someJmxAttribute = i;
113    }
114
115    public int getOtherAttr()
116    {
117       return otherJmxAttribute;
118    }
119
120    public void setOtherAttr(int i)
121    {
122       otherJmxAttribute = i;
123    }
124
125    public void setWriteOnly(int i)
126    {
127       readWriteOnlyAttribute = i;
128    }
129
130    public int getReadOnly()
131    {
132       return readWriteOnlyAttribute;
133    }
134
135
136    public void create() throws Exception JavaDoc
137    {
138       System.out.println("ServiceSeven - CREATE");
139   // Tester.creates.add("1");
140
}
141
142    public void start() throws Exception JavaDoc
143    {
144       System.out.println("ServiceSeven - START");
145    // Tester.starts.add("1");
146
}
147
148    public void stop()
149    {
150       System.out.println("ServiceSeven - STOP");
151    }
152
153    public void destroy()
154    {
155       System.out.println("ServiceSeven - DESTROY");
156    }
157
158 }
159
Popular Tags