2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalsdk.core.lm;
22 import java.util.Date;
24 import javax.servlet.ServletContext;
25 import javax.servlet.http.HttpServletRequest;
27 import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
28 import org.openecomp.portalsdk.core.util.SystemProperties;
29 //import org.openecomp.portalapp.lm.FusionLicenseManagerImpl;
30 import org.springframework.beans.factory.annotation.Autowired;
31 import org.springframework.stereotype.Component;
32 import org.springframework.web.context.WebApplicationContext;
33 import org.springframework.web.servlet.support.RequestContextUtils;
36 public class FusionLicenseManagerUtils {
39 private FusionLicenseManager licenseManager;
42 private EPCommonSystemProperties sysProps;
46 public int verifyLicense(ServletContext context) {
47 if(sysProps == null) {
49 sysProps = new EPCommonSystemProperties();
50 sysProps.setServletContext(context);
52 // licenseManager = new FusionLicenseManagerImpl(new LicenseableClassImpl());
53 System.out.println(licenseManager);
54 licenseManager.installLicense();
63 // WebApplicationContext ctx =RequestContextUtils.getWebApplicationContext(request);
64 // int flag = ((FusionLicenseManager)ctx.getBean("fusionLicenseManager")).verifyLicense(request);
65 // logger.debug("****************FLAG ******************** " + flag);
68 return licenseManager.verifyLicense(context);
71 public static Date getLicenseExpiryDate(HttpServletRequest request) {
72 WebApplicationContext ctx =RequestContextUtils.getWebApplicationContext(request);
73 return ((FusionLicenseManager)ctx.getBean("fusionLicenseManager")).getExpiredDate();