mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Removed governance dependencies
This commit is contained in:
parent
b52f8d8697
commit
021c27666c
@ -67,9 +67,6 @@
|
|||||||
org.wso2.carbon.device.mgt.common.*,
|
org.wso2.carbon.device.mgt.common.*,
|
||||||
org.wso2.carbon.user.api,
|
org.wso2.carbon.user.api,
|
||||||
org.wso2.carbon.user.core.*,
|
org.wso2.carbon.user.core.*,
|
||||||
org.wso2.carbon.governance.api.exception,
|
|
||||||
org.wso2.carbon.governance.api.generic,
|
|
||||||
org.wso2.carbon.governance.api.generic.dataobjects,
|
|
||||||
org.wso2.carbon.registry.core,
|
org.wso2.carbon.registry.core,
|
||||||
org.wso2.carbon.registry.core.exceptions,
|
org.wso2.carbon.registry.core.exceptions,
|
||||||
org.wso2.carbon.registry.core.service,
|
org.wso2.carbon.registry.core.service,
|
||||||
@ -139,10 +136,6 @@
|
|||||||
<groupId>org.wso2.carbon</groupId>
|
<groupId>org.wso2.carbon</groupId>
|
||||||
<artifactId>org.wso2.carbon.user.api</artifactId>
|
<artifactId>org.wso2.carbon.user.api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.wso2.carbon.governance</groupId>
|
|
||||||
<artifactId>org.wso2.carbon.governance.api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon</groupId>
|
<groupId>org.wso2.carbon</groupId>
|
||||||
<artifactId>org.wso2.carbon.registry.api</artifactId>
|
<artifactId>org.wso2.carbon.registry.api</artifactId>
|
||||||
|
|||||||
@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.core.config;
|
|||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||||
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
|
|
||||||
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
||||||
import org.wso2.carbon.utils.CarbonUtils;
|
import org.wso2.carbon.utils.CarbonUtils;
|
||||||
|
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* *
|
|
||||||
* * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
||||||
* *
|
|
||||||
* * Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* * you may not use this file except in compliance with the License.
|
|
||||||
* * You may obtain a copy of the License at
|
|
||||||
* *
|
|
||||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* *
|
|
||||||
* * Unless required by applicable law or agreed to in writing, software
|
|
||||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* * See the License for the specific language governing permissions and
|
|
||||||
* * limitations under the License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.wso2.carbon.device.mgt.core.internal;
|
|
||||||
|
|
||||||
import org.apache.axis2.context.ConfigurationContext;
|
|
||||||
import org.wso2.carbon.utils.Axis2ConfigurationContextObserver;
|
|
||||||
|
|
||||||
public class DeviceManagementAxis2ConfigurationObserver implements Axis2ConfigurationContextObserver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void creatingConfigurationContext(int i) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void createdConfigurationContext(ConfigurationContext configurationContext) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void terminatingConfigurationContext(ConfigurationContext configurationContext) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void terminatedConfigurationContext(ConfigurationContext configurationContext) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -20,6 +20,7 @@
|
|||||||
package org.wso2.carbon.device.mgt.core.internal;
|
package org.wso2.carbon.device.mgt.core.internal;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.core.DeviceManager;
|
import org.wso2.carbon.device.mgt.core.DeviceManager;
|
||||||
|
import org.wso2.carbon.device.mgt.core.config.license.LicenseConfig;
|
||||||
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManager;
|
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManager;
|
||||||
import org.wso2.carbon.registry.core.service.RegistryService;
|
import org.wso2.carbon.registry.core.service.RegistryService;
|
||||||
import org.wso2.carbon.user.core.service.RealmService;
|
import org.wso2.carbon.user.core.service.RealmService;
|
||||||
@ -32,6 +33,8 @@ public class DeviceManagementDataHolder {
|
|||||||
private DeviceManager deviceManager;
|
private DeviceManager deviceManager;
|
||||||
private LicenseManager licenseManager;
|
private LicenseManager licenseManager;
|
||||||
private RegistryService registryService;
|
private RegistryService registryService;
|
||||||
|
private LicenseConfig licenseConfig;
|
||||||
|
|
||||||
private static DeviceManagementDataHolder thisInstance = new DeviceManagementDataHolder();
|
private static DeviceManagementDataHolder thisInstance = new DeviceManagementDataHolder();
|
||||||
|
|
||||||
private DeviceManagementDataHolder() {
|
private DeviceManagementDataHolder() {
|
||||||
@ -85,4 +88,12 @@ public class DeviceManagementDataHolder {
|
|||||||
this.licenseManager = licenseManager;
|
this.licenseManager = licenseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LicenseConfig getLicenseConfig() {
|
||||||
|
return licenseConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicenseConfig(LicenseConfig licenseConfig) {
|
||||||
|
this.licenseConfig = licenseConfig;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class DeviceManagementServiceComponent {
|
|||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Initializing device management core bundle");
|
log.debug("Initializing device management core bundle");
|
||||||
}
|
}
|
||||||
/* Initializing Device Management Configuration */
|
/* Initializing Device Management Configuration */
|
||||||
DeviceConfigurationManager.getInstance().initConfig();
|
DeviceConfigurationManager.getInstance().initConfig();
|
||||||
DeviceManagementConfig config =
|
DeviceManagementConfig config =
|
||||||
DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
|
DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
|
||||||
@ -85,11 +85,13 @@ public class DeviceManagementServiceComponent {
|
|||||||
DeviceManager deviceManager = new DeviceManagerImpl(config, this.getPluginRepository());
|
DeviceManager deviceManager = new DeviceManagerImpl(config, this.getPluginRepository());
|
||||||
DeviceManagementDataHolder.getInstance().setDeviceManager(deviceManager);
|
DeviceManagementDataHolder.getInstance().setDeviceManager(deviceManager);
|
||||||
|
|
||||||
LicenseConfigurationManager.getInstance().initConfig();
|
LicenseConfigurationManager.getInstance().initConfig();
|
||||||
LicenseConfig licenseConfig = LicenseConfigurationManager.getInstance().getLicenseConfig();
|
LicenseConfig licenseConfig =
|
||||||
|
LicenseConfigurationManager.getInstance().getLicenseConfig();
|
||||||
|
|
||||||
LicenseManager licenseManager = new LicenseManagerImpl();
|
LicenseManager licenseManager = new LicenseManagerImpl();
|
||||||
DeviceManagementDataHolder.getInstance().setLicenseManager(licenseManager);
|
DeviceManagementDataHolder.getInstance().setLicenseManager(licenseManager);
|
||||||
|
DeviceManagementDataHolder.getInstance().setLicenseConfig(licenseConfig);
|
||||||
|
|
||||||
/* If -Dsetup option enabled then create device management database schema */
|
/* If -Dsetup option enabled then create device management database schema */
|
||||||
String setupOption =
|
String setupOption =
|
||||||
@ -101,7 +103,7 @@ public class DeviceManagementServiceComponent {
|
|||||||
"is about to begin");
|
"is about to begin");
|
||||||
}
|
}
|
||||||
this.setupDeviceManagementSchema(dsConfig);
|
this.setupDeviceManagementSchema(dsConfig);
|
||||||
this.setupDefaultLicenses(licenseConfig);
|
// this.setupDefaultLicenses(licenseConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
@ -109,10 +111,11 @@ public class DeviceManagementServiceComponent {
|
|||||||
}
|
}
|
||||||
/* Registering Device Management service */
|
/* Registering Device Management service */
|
||||||
BundleContext bundleContext = componentContext.getBundleContext();
|
BundleContext bundleContext = componentContext.getBundleContext();
|
||||||
bundleContext.registerService(DeviceManagementService.class.getName(), new DeviceManagementService(), null);
|
bundleContext.registerService(DeviceManagementService.class.getName(),
|
||||||
|
new DeviceManagementService(), null);
|
||||||
/* Registering License Management service */
|
/* Registering License Management service */
|
||||||
bundleContext.registerService(LicenseManagementService.class.getName(),
|
bundleContext.registerService(LicenseManagementService.class.getName(),
|
||||||
new LicenseManagementService(), null);
|
new LicenseManagementService(), null);
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Device management core bundle has been successfully initialized");
|
log.debug("Device management core bundle has been successfully initialized");
|
||||||
}
|
}
|
||||||
@ -141,16 +144,19 @@ public class DeviceManagementServiceComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDefaultLicenses(LicenseConfig licenseConfig) throws LicenseManagementException {
|
private void setupDefaultLicenses(LicenseConfig licenseConfig)
|
||||||
LicenseManager licenseManager = DeviceManagementDataHolder.getInstance().getLicenseManager();
|
throws LicenseManagementException {
|
||||||
for (License license : licenseConfig.getLicenses()) {
|
LicenseManager licenseManager =
|
||||||
License extLicense = licenseManager.getLicense(license.getName(), license.getLanguage());
|
DeviceManagementDataHolder.getInstance().getLicenseManager();
|
||||||
if (extLicense != null) {
|
for (License license : licenseConfig.getLicenses()) {
|
||||||
continue;
|
License extLicense =
|
||||||
}
|
licenseManager.getLicense(license.getName(), license.getLanguage());
|
||||||
licenseManager.addLicense(license);
|
if (extLicense != null) {
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
|
licenseManager.addLicense(license);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets Device Manager service.
|
* Sets Device Manager service.
|
||||||
@ -202,29 +208,29 @@ public class DeviceManagementServiceComponent {
|
|||||||
DeviceManagementDataHolder.getInstance().setRealmService(null);
|
DeviceManagementDataHolder.getInstance().setRealmService(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets Registry Service.
|
* Sets Registry Service.
|
||||||
*
|
*
|
||||||
* @param registryService An instance of RegistryService
|
* @param registryService An instance of RegistryService
|
||||||
*/
|
*/
|
||||||
protected void setRegistryService(RegistryService registryService) {
|
protected void setRegistryService(RegistryService registryService) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Setting Registry Service");
|
log.debug("Setting Registry Service");
|
||||||
}
|
}
|
||||||
DeviceManagementDataHolder.getInstance().setRegistryService(registryService);
|
DeviceManagementDataHolder.getInstance().setRegistryService(registryService);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unsets Registry Service.
|
* Unsets Registry Service.
|
||||||
*
|
*
|
||||||
* @param registryService An instance of RegistryService
|
* @param registryService An instance of RegistryService
|
||||||
*/
|
*/
|
||||||
protected void unsetRegistryService(RegistryService registryService) {
|
protected void unsetRegistryService(RegistryService registryService) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Unsetting Registry Service");
|
log.debug("Unsetting Registry Service");
|
||||||
}
|
}
|
||||||
DeviceManagementDataHolder.getInstance().setRegistryService(null);
|
DeviceManagementDataHolder.getInstance().setRegistryService(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DeviceManagementRepository getPluginRepository() {
|
private DeviceManagementRepository getPluginRepository() {
|
||||||
return pluginRepository;
|
return pluginRepository;
|
||||||
|
|||||||
@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
||||||
*
|
|
||||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
||||||
* Version 2.0 (the "License"); you may not use this file except
|
|
||||||
* in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.wso2.carbon.device.mgt.core.license.mgt;
|
|
||||||
|
|
||||||
import org.wso2.carbon.context.CarbonContext;
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
|
||||||
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
|
||||||
import org.wso2.carbon.governance.api.generic.GenericArtifactManager;
|
|
||||||
import org.wso2.carbon.registry.api.Registry;
|
|
||||||
import org.wso2.carbon.registry.core.exceptions.RegistryException;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class GenericArtifactManagerFactory {
|
|
||||||
|
|
||||||
private static Map<Integer, GenericArtifactManager> tenantArtifactManagers =
|
|
||||||
new HashMap<Integer, GenericArtifactManager>();
|
|
||||||
private static final Object lock = new Object();
|
|
||||||
|
|
||||||
public static GenericArtifactManager getTenantAwareGovernanceArtifactManager() throws
|
|
||||||
LicenseManagementException {
|
|
||||||
Registry registry;
|
|
||||||
int tenantId;
|
|
||||||
try {
|
|
||||||
tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
||||||
registry =
|
|
||||||
DeviceManagementDataHolder.getInstance().getRegistryService().getGovernanceSystemRegistry(
|
|
||||||
tenantId);
|
|
||||||
} catch (RegistryException e) {
|
|
||||||
throw new LicenseManagementException("Error occurred while initializing tenant system registry " +
|
|
||||||
"to be used to manipulate License artifacts", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
GenericArtifactManager artifactManager;
|
|
||||||
synchronized (lock) {
|
|
||||||
artifactManager =
|
|
||||||
tenantArtifactManagers.get(tenantId);
|
|
||||||
if (artifactManager == null) {
|
|
||||||
/* Hack, to fix https://wso2.org/jira/browse/REGISTRY-2427 */
|
|
||||||
//GovernanceUtils.loadGovernanceArtifacts((UserRegistry) registry);
|
|
||||||
artifactManager =
|
|
||||||
new GenericArtifactManager((org.wso2.carbon.registry.core.Registry) registry,
|
|
||||||
DeviceManagementConstants.LicenseProperties.LICENSE_REGISTRY_KEY);
|
|
||||||
tenantArtifactManagers.put(tenantId, artifactManager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return artifactManager;
|
|
||||||
} catch (RegistryException e) {
|
|
||||||
throw new LicenseManagementException("Error occurred while initializing GovernanceArtifactManager " +
|
|
||||||
"associated with tenant '" + CarbonContext.getThreadLocalCarbonContext().getTenantDomain() + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -20,89 +20,38 @@ package org.wso2.carbon.device.mgt.core.license.mgt;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
|
|
||||||
import org.wso2.carbon.device.mgt.core.DeviceManagerImpl;
|
import org.wso2.carbon.device.mgt.core.DeviceManagerImpl;
|
||||||
import org.wso2.carbon.device.mgt.core.config.license.License;
|
import org.wso2.carbon.device.mgt.core.config.license.License;
|
||||||
import org.wso2.carbon.governance.api.exception.GovernanceException;
|
import org.wso2.carbon.device.mgt.core.config.license.LicenseConfig;
|
||||||
import org.wso2.carbon.governance.api.generic.GenericArtifactFilter;
|
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
||||||
import org.wso2.carbon.governance.api.generic.GenericArtifactManager;
|
|
||||||
import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact;
|
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class LicenseManagerImpl implements LicenseManager {
|
public class LicenseManagerImpl implements LicenseManager {
|
||||||
|
|
||||||
private static Log log = LogFactory.getLog(DeviceManagerImpl.class);
|
private static Log log = LogFactory.getLog(DeviceManagerImpl.class);
|
||||||
private static final DateFormat format = new SimpleDateFormat("dd-mm-yyyy", Locale.ENGLISH);
|
private static final DateFormat format = new SimpleDateFormat("dd-mm-yyyy", Locale.ENGLISH);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public License getLicense(final String deviceType, final String languageCode) throws LicenseManagementException {
|
public License getLicense(final String deviceType, final String languageCode)
|
||||||
GenericArtifactManager artifactManager =
|
throws LicenseManagementException {
|
||||||
GenericArtifactManagerFactory.getTenantAwareGovernanceArtifactManager();
|
License deviceLicense = new License();
|
||||||
try {
|
LicenseConfig licenseConfig = DeviceManagementDataHolder.getInstance().getLicenseConfig();
|
||||||
GenericArtifact[] artifacts = artifactManager.findGenericArtifacts(new GenericArtifactFilter() {
|
for (License license : licenseConfig.getLicenses()) {
|
||||||
@Override
|
if ((deviceType.equals(license.getName())) &&
|
||||||
public boolean matches(GenericArtifact artifact) throws GovernanceException {
|
(languageCode.equals(license.getLanguage()))) {
|
||||||
String attributeNameVal = artifact.getAttribute(
|
deviceLicense = license;
|
||||||
DeviceManagementConstants.LicenseProperties.NAME);
|
break;
|
||||||
String attributeLangVal = artifact.getAttribute(
|
}
|
||||||
DeviceManagementConstants.LicenseProperties.LANGUAGE);
|
}
|
||||||
return (attributeNameVal != null && attributeLangVal != null && attributeNameVal.equals
|
return deviceLicense;
|
||||||
(deviceType) && attributeLangVal.equals(languageCode));
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
if (artifacts == null || artifacts.length <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this.populateLicense(artifacts[0]);
|
|
||||||
} catch (GovernanceException e) {
|
|
||||||
throw new LicenseManagementException("Error occurred while retrieving license corresponding to " +
|
|
||||||
"device type '" + deviceType + "'");
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new LicenseManagementException("Error occurred while parsing the ToDate/FromDate date string " +
|
|
||||||
"of the license configured upon the device type '" + deviceType + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private License populateLicense(GenericArtifact artifact) throws GovernanceException, ParseException {
|
@Override
|
||||||
License license = new License();
|
public void addLicense(License license) throws LicenseManagementException {
|
||||||
license.setName(artifact.getAttribute(DeviceManagementConstants.LicenseProperties.NAME));
|
|
||||||
license.setProvider(artifact.getAttribute(DeviceManagementConstants.LicenseProperties.PROVIDER));
|
|
||||||
license.setVersion(artifact.getAttribute(DeviceManagementConstants.LicenseProperties.VERSION));
|
|
||||||
license.setLanguage(artifact.getAttribute(DeviceManagementConstants.LicenseProperties.LANGUAGE));
|
|
||||||
license.setText(artifact.getAttribute(DeviceManagementConstants.LicenseProperties.TEXT));
|
|
||||||
license.setValidFrom(format.parse(artifact.getAttribute(
|
|
||||||
DeviceManagementConstants.LicenseProperties.VALID_FROM)));
|
|
||||||
license.setValidTo(format.parse(artifact.getAttribute(
|
|
||||||
DeviceManagementConstants.LicenseProperties.VALID_TO)));
|
|
||||||
return license;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void addLicense(License license) throws LicenseManagementException {
|
|
||||||
GenericArtifactManager artifactManager =
|
|
||||||
GenericArtifactManagerFactory.getTenantAwareGovernanceArtifactManager();
|
|
||||||
try {
|
|
||||||
GenericArtifact artifact =
|
|
||||||
artifactManager.newGovernanceArtifact(new QName("http://www.wso2.com",
|
|
||||||
DeviceManagementConstants.LicenseProperties.LICENSE_REGISTRY_KEY));
|
|
||||||
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.NAME, license.getName());
|
|
||||||
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VERSION, license.getVersion());
|
|
||||||
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.PROVIDER, license.getProvider());
|
|
||||||
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.LANGUAGE, license.getLanguage());
|
|
||||||
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.TEXT, license.getText());
|
|
||||||
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_TO,
|
|
||||||
license.getValidTo().toString());
|
|
||||||
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_FROM,
|
|
||||||
license.getValidFrom().toString());
|
|
||||||
artifactManager.addGenericArtifact(artifact);
|
|
||||||
} catch (GovernanceException e) {
|
|
||||||
throw new LicenseManagementException("Error occurred while adding license artifact", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,6 @@ import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
|
|||||||
import org.wso2.carbon.utils.CarbonUtils;
|
import org.wso2.carbon.utils.CarbonUtils;
|
||||||
import org.wso2.carbon.utils.dbcreator.DatabaseCreator;
|
import org.wso2.carbon.utils.dbcreator.DatabaseCreator;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public final class DeviceManagementSchemaInitializer extends DatabaseCreator {
|
public final class DeviceManagementSchemaInitializer extends DatabaseCreator {
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@ -93,7 +93,7 @@
|
|||||||
<artifactId>org.wso2.carbon.base</artifactId>
|
<artifactId>org.wso2.carbon.base</artifactId>
|
||||||
<version>${carbon.kernel.version}</version>
|
<version>${carbon.kernel.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!--dependency>
|
||||||
<groupId>org.wso2.carbon.governance</groupId>
|
<groupId>org.wso2.carbon.governance</groupId>
|
||||||
<artifactId>org.wso2.carbon.governance.api</artifactId>
|
<artifactId>org.wso2.carbon.governance.api</artifactId>
|
||||||
<version>${carbon.governance.version}</version>
|
<version>${carbon.governance.version}</version>
|
||||||
@ -143,7 +143,7 @@
|
|||||||
<artifactId>org.wso2.carbon.registry.extensions</artifactId>
|
<artifactId>org.wso2.carbon.registry.extensions</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency-->
|
||||||
<!-- End of Governance dependencies -->
|
<!-- End of Governance dependencies -->
|
||||||
|
|
||||||
<!-- OSGi dependencies-->
|
<!-- OSGi dependencies-->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user