summaryrefslogtreecommitdiff
path: root/java/demo/IceGrid/icebox/HelloI.java
blob: 47d84c51d85e5c973783ae7d0e6aca4dd4550b4e (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
// **********************************************************************
//
// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

import Demo.*;

public class HelloI extends _HelloDisp
{
    HelloI(String serviceName)
    {
        _serviceName = serviceName;
    }

    public void
    sayHello(Ice.Current current)
    {
        java.util.Map<String,String> env =  System.getenv();
        String lang = env.containsKey("LANG") ? env.get("LANG") : "en";
        String greeting = "Hello, ";
        if(lang.equals("fr"))
        {
            greeting = "Bonjour, ";
        }
        else if(lang.equals("de"))
        {
            greeting = "Hallo, ";
        }
        else if(lang.equals("es"))
        {
            greeting = "Hola, ";
        }
        else if(lang.equals("it"))
        {
            greeting = "Ciao, ";
        }        
        System.out.println(greeting + _serviceName);
    }

    private String _serviceName;
}