최신버전에 맞는 타겟플렛폼 설정.
[Tadpole.git] / com.hangum.tadpole.commons.sql / src / com / hangum / tadpole / engine / initialize / ApplicationLicenseInitialize.java
blobcab93c4aba759e810835c96f404c661dc198f9d1
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
7 *
8 * Contributors:
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com.hangum.tadpole.engine.initialize;
13 import java.io.File;
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;
24 /**
25 * Application license initialize
27 * @author hangum
30 public class ApplicationLicenseInitialize {
31 private static final Logger logger = Logger.getLogger(ApplicationLicenseInitialize.class);
33 /**
34 * get license file location
36 * @return
38 public static String getLicenseFileLocation() {
39 String strActiveProductType = "";
40 if(PublicTadpoleDefine.ACTIVE_PRODUCT_TYPE == PRODUCT_TYPE.TadpoleDBHub) {
41 strActiveProductType = "TadpoleHub";
42 } else {
43 strActiveProductType = PublicTadpoleDefine.ACTIVE_PRODUCT_TYPE.name();
46 return String.format("%s%s.lic", ApplicationArgumentUtils.getResourcesDir(), strActiveProductType);
49 /**
50 * license load
52 public static void load() {
53 LicenseExtensionHandler linceseHandler = new LicenseExtensionHandler();
54 try {
55 String strLicenseInfo = ApplicationArgumentUtils.initDBServer();
56 if(!StringUtils.isEmpty(strLicenseInfo)) {
57 logger.info("******** [0] Start enterprise version ");
58 linceseHandler.license(strLicenseInfo);
59 } else {
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());
70 System.exit(0);
75 /**
76 * live chage
78 * @param strLicense
79 * @throws Exception
81 public static void liveChange(String strLicense) throws Exception {
82 LicenseExtensionHandler linceseHandler = new LicenseExtensionHandler();
83 linceseHandler.liveChange(strLicense);