01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License as published by the
09: * Free Software Foundation; either version 2 of the License, or (at your option)
10: * any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15: * for more details.
16: *
17: * You should have received a copy of the GNU General Public License along with
18: * this program; if not, write to the Free Software Foundation, Inc.,
19: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: *
21: *
22: * $Id$
23: */
24: package com.bostechcorp.cbesb.console.server;
25:
26: import java.io.File;
27: import java.io.IOException;
28:
29: import com.bostechcorp.cbesb.common.util.EsbPathHelper;
30: import com.bostechcorp.cbesb.common.util.FileUtil;
31: import com.bostechcorp.cbesb.console.common.LicenseInfo;
32: import com.bostechcorp.cbesb.console.common.ServerSideException;
33: import com.bostechcorp.cbesb.console.rpc.LicensingOperation;
34:
35: public class LicensingOperationImpl extends ConsoleRemoteServiceServlet
36: implements LicensingOperation {
37:
38: /**
39: *
40: */
41: private static final long serialVersionUID = -3464280731696027751L;
42:
43: public static String CBESB_HOME = EsbPathHelper.getCbesbHomeDir();
44:
45: public static String LICENSE_PATH = "/licenses";
46:
47: public LicenseInfo getLicenseInfo() {
48:
49: // TODO return a empty LicenseInfo object for now
50: LicenseInfo lic = new LicenseInfo();
51:
52: lic.setLicensed(false);
53: return lic;
54:
55: }
56:
57: public String getLicense(String filename)
58: throws ServerSideException {
59: String fileContent = null;
60: File licenseFile = new File(CBESB_HOME + LICENSE_PATH + "/"
61: + filename);
62: if (!licenseFile.exists())
63: fileContent = "File not exists.";
64: // ((ConsoleMessages)GWT.create(ConsoleMessages.class)).file_not_exists();
65: else {
66: try {
67: fileContent = FileUtil.readStringFromFile(CBESB_HOME
68: + LICENSE_PATH + "/" + filename);
69: } catch (IOException e) {
70: throw new ServerSideException(e);
71: }
72: }
73: return fileContent;
74: }
75:
76: }
|