KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > examples > components > helloworld > ServerImpl


1 package org.objectweb.proactive.examples.components.helloworld;
2
3 import org.objectweb.proactive.ProActive;
4
5 /***
6  * Julia: France Telecom's implementation of the Fractal API
7  * Copyright (C) 2001-2002 France Telecom R&D
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  *
23  * Contact: Eric.Bruneton@rd.francetelecom.com
24  *
25  * Author: Eric Bruneton
26  */

27
28 public class ServerImpl implements Service, ServiceAttributes {
29
30   private String JavaDoc header = "";
31
32   private int count = 0;
33
34   public void print (final String JavaDoc msg) {
35     System.out.println("print method on server implementation object on node : " + ProActive.getBodyOnThis().getNodeURL());
36     new Exception JavaDoc() {
37       public String JavaDoc toString () {
38         return "Server: print method called";
39       }
40     }.printStackTrace();
41     System.out.println("Server: begin printing...");
42     for (int i = 0; i < count; ++i) {
43       System.out.println(header + msg);
44     }
45     System.out.println("Server: print done.");
46   }
47
48   public String JavaDoc getHeader () {
49     return header;
50   }
51
52   public void setHeader (final String JavaDoc header) {
53     this.header = header;
54   }
55   
56   public int getCount () {
57     return count;
58   }
59
60   public void setCount (final int count) {
61     this.count = count;
62   }
63 }
64
Popular Tags