1 /*******************************************************************************
2 * Copyright (c) 2016 hangum.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Lesser Public License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com
.hangum
.tadpole
.engine
.initialize
;
15 import org
.apache
.commons
.lang
.StringUtils
;
16 import org
.apache
.log4j
.Logger
;
17 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
19 import com
.hangum
.tadpole
.commons
.libs
.core
.define
.PublicTadpoleDefine
;
20 import com
.hangum
.tadpole
.commons
.libs
.core
.define
.PublicTadpoleDefine
.PRODUCT_TYPE
;
21 import com
.hangum
.tadpole
.commons
.util
.ApplicationArgumentUtils
;
22 import com
.hangum
.tadpole
.engine
.license
.LicenseExtensionHandler
;
25 * Application license initialize
30 public class ApplicationLicenseInitialize
{
31 private static final Logger logger
= Logger
.getLogger(ApplicationLicenseInitialize
.class);
34 * get license file location
38 public static String
getLicenseFileLocation() {
39 String strActiveProductType
= "";
40 if(PublicTadpoleDefine
.ACTIVE_PRODUCT_TYPE
== PRODUCT_TYPE
.TadpoleDBHub
) {
41 strActiveProductType
= "TadpoleHub";
43 strActiveProductType
= PublicTadpoleDefine
.ACTIVE_PRODUCT_TYPE
.name();
46 return String
.format("%s%s.lic", ApplicationArgumentUtils
.getResourcesDir(), strActiveProductType
);
52 public static void load() {
53 LicenseExtensionHandler linceseHandler
= new LicenseExtensionHandler();
55 String strLicenseInfo
= ApplicationArgumentUtils
.initDBServer();
56 if(!StringUtils
.isEmpty(strLicenseInfo
)) {
57 logger
.info("******** [0] Start enterprise version ");
58 linceseHandler
.license(strLicenseInfo
);
60 File fileExist
= new File(getLicenseFileLocation());
61 if(fileExist
.isFile()) {
62 logger
.info("******** [1] Start enterprise version ");
63 linceseHandler
.license(fileExist
);
66 } catch(Exception e
) {
67 logger
.error("System initialize exception", e
);
68 MessageDialog
.openError(null, "Error", "License validation exception\n" + e
.getMessage());
81 public static void liveChange(String strLicense
) throws Exception
{
82 LicenseExtensionHandler linceseHandler
= new LicenseExtensionHandler();
83 linceseHandler
.liveChange(strLicense
);