- 타겟 플랫폼을 좀더 쉽게 사용할 수 있도록 개선.
[Tadpole.git] / com.hangum.tadpole.commons.sql / src / com / hangum / tadpole / engine / initialize / ApplicationLicenseInitialize.java
blob44a967cf301a37dc9259a6543d9842e45de10495
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.util.ApplicationArgumentUtils;
20 import com.hangum.tadpole.engine.license.LicenseExtensionHandler;
22 /**
23 * Application license initialize
25 * @author hangum
28 public class ApplicationLicenseInitialize {
29 private static final Logger logger = Logger.getLogger(ApplicationLicenseInitialize.class);
30 public static String TDB_License_FILE = ApplicationArgumentUtils.getResourcesDir() + "TadpoleHub.lic";
32 public static void load() {
33 LicenseExtensionHandler linceseHandler = new LicenseExtensionHandler();
34 try {
35 String strLicenseInfo = ApplicationArgumentUtils.initDBServer();
36 if(!StringUtils.isEmpty(strLicenseInfo)) {
37 logger.info("******** [0] Start enterprise version ");
38 linceseHandler.license(strLicenseInfo);
39 } else {
40 File fileExist = new File(TDB_License_FILE);
41 if(fileExist.isFile()) {
42 logger.info("******** [1] Start enterprise version ");
43 linceseHandler.license(fileExist);
46 } catch(Exception e) {
47 logger.error("System initialize exception", e);
48 MessageDialog.openError(null, "Error", "License validation exception\n" + e.getMessage());
50 System.exit(0);
55 /**
56 * live chage
58 * @param strLicense
59 * @throws Exception
61 public static void liveChange(String strLicense) throws Exception {
62 LicenseExtensionHandler linceseHandler = new LicenseExtensionHandler();
63 linceseHandler.liveChange(strLicense);