Merge pull request 'Sync with the master branch' (#172) from tcdlpds/device-mgt-core:sync-master into apim420
Reviewed-on: #172pull/177/head
commit
b249b2435f
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.impl.util;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.service.GrafanaQueryService;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
|
|
||||||
|
public class GrafanaMgtAPIUtils {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(GrafanaMgtAPIUtils.class);
|
||||||
|
private static volatile GrafanaQueryService grafanaQueryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessing GrafanaQueryService from OSGI service context
|
||||||
|
* @return GrafanaQueryService instance
|
||||||
|
*/
|
||||||
|
public static GrafanaQueryService getGrafanaQueryService() {
|
||||||
|
if (grafanaQueryService == null) {
|
||||||
|
synchronized (GrafanaMgtAPIUtils.class) {
|
||||||
|
if (grafanaQueryService == null) {
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
grafanaQueryService =
|
||||||
|
(GrafanaQueryService) ctx.getOSGiService(GrafanaQueryService.class, null);
|
||||||
|
if (grafanaQueryService == null) {
|
||||||
|
String msg = "Grafana Query service has not initialized.";
|
||||||
|
log.error(msg);
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return grafanaQueryService;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.device.mgt.common.group.mgt;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds Device Group details and expose to external access
|
||||||
|
*/
|
||||||
|
@ApiModel(value = "DeviceGroupRoleWrapper", description = "This class carries all information related to a managed device group.")
|
||||||
|
public class DeviceGroupRoleWrapper implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1998121711L;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "ID of the device group in the device group information database.")
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "description", value = "The device group description that can be set on the device group by the user.", required = true)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "name", value = "The device group name that can be set on the device group by the user.", required = true)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String owner;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "status", value = "The status of group that needs updating/retrieval.")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "parentGroupId", value = "Group ID of parent group")
|
||||||
|
private int parentGroupId;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "parentPath", value = "Path of parent group")
|
||||||
|
private String parentPath;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "childrenGroups", value = "Children groups")
|
||||||
|
private List<DeviceGroup> childrenGroups;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "userRoles", value = "User roles")
|
||||||
|
private List<String> userRoles;
|
||||||
|
|
||||||
|
public DeviceGroupRoleWrapper() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeviceGroupRoleWrapper(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> groupProperties;
|
||||||
|
|
||||||
|
public int getGroupId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwner(String owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getGroupProperties() {
|
||||||
|
return groupProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupProperties(Map<String, String> groupProperties) {
|
||||||
|
this.groupProperties = groupProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getParentGroupId() {
|
||||||
|
return parentGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentGroupId(int parentGroupId) {
|
||||||
|
this.parentGroupId = parentGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentPath() {
|
||||||
|
return parentPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentPath(String parentPath) {
|
||||||
|
this.parentPath = parentPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DeviceGroup> getChildrenGroups() {
|
||||||
|
return childrenGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildrenGroups(List<DeviceGroup> childrenGroups) {
|
||||||
|
this.childrenGroups = childrenGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getUserRoles() {
|
||||||
|
return userRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserRoles(List<String> userRoles) {
|
||||||
|
this.userRoles = userRoles;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,181 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.notification.logger;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||||
|
|
||||||
|
public class AppInstallLogContext extends LogContext {
|
||||||
|
private final String appId;
|
||||||
|
private final String appName;
|
||||||
|
private final String appType;
|
||||||
|
private final String subType;
|
||||||
|
private final String tenantId;
|
||||||
|
private final String tenantDomain;
|
||||||
|
private final String device;
|
||||||
|
private final String userName;
|
||||||
|
private final String action;
|
||||||
|
|
||||||
|
private AppInstallLogContext(Builder builder) {
|
||||||
|
this.appId = builder.appId;
|
||||||
|
this.appName = builder.appName;
|
||||||
|
this.appType = builder.appType;
|
||||||
|
this.subType = builder.subType;
|
||||||
|
this.tenantId = builder.tenantId;
|
||||||
|
this.tenantDomain = builder.tenantDomain;
|
||||||
|
this.device = builder.device;
|
||||||
|
this.userName = builder.userName;
|
||||||
|
this.action = builder.action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppId() {
|
||||||
|
return appId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppName() {
|
||||||
|
return appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppType() {
|
||||||
|
return appType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubType() {
|
||||||
|
return subType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantDomain() {
|
||||||
|
return tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDevice() {
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private String appId;
|
||||||
|
private String appName;
|
||||||
|
private String appType;
|
||||||
|
private String subType;
|
||||||
|
private String tenantId;
|
||||||
|
private String tenantDomain;
|
||||||
|
private String device;
|
||||||
|
private String userName;
|
||||||
|
private String action;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppId() {
|
||||||
|
return appId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setAppId(String appId) {
|
||||||
|
this.appId = appId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppName() {
|
||||||
|
return appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setAppName(String appName) {
|
||||||
|
this.appName = appName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppType() {
|
||||||
|
return appType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setAppType(String appType) {
|
||||||
|
this.appType = appType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubType() {
|
||||||
|
return subType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setSubType(String subType) {
|
||||||
|
this.subType = subType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantDomain() {
|
||||||
|
return tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTenantDomain(String tenantDomain) {
|
||||||
|
this.tenantDomain = tenantDomain;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTenantId(String tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDevice() {
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setDevice(String device) {
|
||||||
|
this.device = device;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setAction(String action) {
|
||||||
|
this.action = action;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppInstallLogContext build() {
|
||||||
|
return new AppInstallLogContext(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.notification.logger;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||||
|
|
||||||
|
public class DeviceConnectivityLogContext extends LogContext {
|
||||||
|
|
||||||
|
private final String deviceId;
|
||||||
|
private final String deviceType;
|
||||||
|
private final String actionTag;
|
||||||
|
private final String operationCode;
|
||||||
|
private final String tenantId;
|
||||||
|
private final String tenantDomain;
|
||||||
|
private final String userName;
|
||||||
|
|
||||||
|
private DeviceConnectivityLogContext(Builder builder) {
|
||||||
|
this.deviceId = builder.deviceId;
|
||||||
|
this.deviceType = builder.deviceType;
|
||||||
|
this.actionTag = builder.actionTag;
|
||||||
|
this.operationCode = builder.operationCode;
|
||||||
|
this.tenantId = builder.tenantId;
|
||||||
|
this.tenantDomain = builder.tenantDomain;
|
||||||
|
this.userName = builder.userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceType() {
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActionTag() {
|
||||||
|
return actionTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperationCode() {
|
||||||
|
return operationCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantDomain() {
|
||||||
|
return tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private String deviceId;
|
||||||
|
private String deviceType;
|
||||||
|
private String operationCode;
|
||||||
|
private String actionTag;
|
||||||
|
private String tenantId;
|
||||||
|
private String tenantDomain;
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setDeviceId(String deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceType() {
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setDeviceType(String deviceType) {
|
||||||
|
this.deviceType = deviceType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperationCode() {
|
||||||
|
return operationCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setOperationCode(String operationCode) {
|
||||||
|
this.operationCode = operationCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTenantId(String tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantDomain() {
|
||||||
|
return tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTenantDomain(String tenantDomain) {
|
||||||
|
this.tenantDomain = tenantDomain;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActionTag() {
|
||||||
|
return actionTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setActionTag(String actionTag) {
|
||||||
|
this.actionTag = actionTag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeviceConnectivityLogContext build() {
|
||||||
|
return new DeviceConnectivityLogContext(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.notification.logger;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||||
|
|
||||||
|
public class DeviceEnrolmentLogContext extends LogContext {
|
||||||
|
private final String deviceId;
|
||||||
|
private final String deviceType;
|
||||||
|
private final String owner;
|
||||||
|
private final String ownership;
|
||||||
|
private final String tenantID;
|
||||||
|
private final String tenantDomain;
|
||||||
|
private final String userName;
|
||||||
|
|
||||||
|
private DeviceEnrolmentLogContext(Builder builder) {
|
||||||
|
this.deviceId = builder.deviceId;
|
||||||
|
this.deviceType = builder.deviceType;
|
||||||
|
this.owner = builder.owner;
|
||||||
|
this.ownership = builder.ownership;
|
||||||
|
this.tenantID = builder.tenantID;
|
||||||
|
this.tenantDomain = builder.tenantDomain;
|
||||||
|
this.userName = builder.userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantID() {
|
||||||
|
return tenantID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceType() {
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnership() {
|
||||||
|
return ownership;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantDomain() {
|
||||||
|
return tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
public static class Builder {
|
||||||
|
private String deviceId;
|
||||||
|
private String deviceType;
|
||||||
|
private String owner;
|
||||||
|
private String ownership;
|
||||||
|
private String tenantID;
|
||||||
|
private String tenantDomain;
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceType() {
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setDeviceType(String deviceType) {
|
||||||
|
this.deviceType = deviceType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantID() {
|
||||||
|
return tenantID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTenantID(String tenantID) {
|
||||||
|
this.tenantID = tenantID;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantDomain() {
|
||||||
|
return tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTenantDomain(String tenantDomain) {
|
||||||
|
this.tenantDomain = tenantDomain;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setDeviceId(String deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwner() {
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setOwner(String owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnership() {
|
||||||
|
return ownership;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setOwnership(String ownership) {
|
||||||
|
this.ownership = ownership;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeviceEnrolmentLogContext build() {
|
||||||
|
return new DeviceEnrolmentLogContext(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.notification.logger;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||||
|
|
||||||
|
public class PolicyLogContext extends LogContext {
|
||||||
|
private final String policyName;
|
||||||
|
private final String payload;
|
||||||
|
private final String actionTag;
|
||||||
|
private final String userName;
|
||||||
|
private final String tenantID;
|
||||||
|
private final String tenantDomain;
|
||||||
|
|
||||||
|
private PolicyLogContext(Builder builder) {
|
||||||
|
this.policyName = builder.policyName;
|
||||||
|
this.payload = builder.payload;
|
||||||
|
this.actionTag = builder.actionTag;
|
||||||
|
this.userName = builder.userName;
|
||||||
|
this.tenantID = builder.tenantID;
|
||||||
|
this.tenantDomain = builder.tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPolicyName() {
|
||||||
|
return policyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPayload() {
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActionTag() {
|
||||||
|
return actionTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantID() {
|
||||||
|
return tenantID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantDomain() {
|
||||||
|
return tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private String policyName;
|
||||||
|
private String payload;
|
||||||
|
private String actionTag;
|
||||||
|
private String userName;
|
||||||
|
private String tenantID;
|
||||||
|
private String tenantDomain;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPolicyName() {
|
||||||
|
return policyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setPolicyName(String policyName) {
|
||||||
|
this.policyName = policyName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPayload() {
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setPayload(String payload) {
|
||||||
|
this.payload = payload;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActionTag() {
|
||||||
|
return actionTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setActionTag(String actionTag) {
|
||||||
|
this.actionTag = actionTag;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantID() {
|
||||||
|
return tenantID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTenantID(String tenantID) {
|
||||||
|
this.tenantID = tenantID;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTenantDomain() {
|
||||||
|
return tenantDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setTenantDomain(String tenantDomain) {
|
||||||
|
this.tenantDomain = tenantDomain;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PolicyLogContext build() {
|
||||||
|
return new PolicyLogContext(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,318 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.notification.logger.impl;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
|
||||||
|
import io.entgra.device.mgt.core.notification.logger.AppInstallLogContext;
|
||||||
|
import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.log4j.MDC;
|
||||||
|
|
||||||
|
public class EntgraAppInstallLoggerImpl implements EntgraLogger {
|
||||||
|
|
||||||
|
private static Log log = null;
|
||||||
|
|
||||||
|
public EntgraAppInstallLoggerImpl(Class<?> clazz) {
|
||||||
|
log = LogFactory.getLog(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(String message) {
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(String message, Throwable t) {
|
||||||
|
log.info(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object o) {
|
||||||
|
log.info(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object o, Throwable throwable) {
|
||||||
|
log.info(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(String message, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object object, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.info(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object object, Throwable t, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.info(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug(String message) {
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug(String message, Throwable t) {
|
||||||
|
log.debug(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object o) {
|
||||||
|
log.debug(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object o, Throwable throwable) {
|
||||||
|
log.debug(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(String message, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object object, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.debug(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object object, Throwable t, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.debug(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(String message) {
|
||||||
|
log.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(String message, Throwable t) {
|
||||||
|
log.error(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object o) {
|
||||||
|
log.error(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object o, Throwable throwable) {
|
||||||
|
log.error(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message, Throwable t, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.error(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object object, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.error(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object object, Throwable t, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.error(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(String message) {
|
||||||
|
log.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(String message, Throwable t) {
|
||||||
|
log.warn(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object o) {
|
||||||
|
log.warn(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object o, Throwable throwable) {
|
||||||
|
log.warn(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message, Throwable t, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.warn(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object object, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.warn(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object object, Throwable t, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.warn(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String message) {
|
||||||
|
log.trace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String message, Throwable t) {
|
||||||
|
log.trace(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object o) {
|
||||||
|
log.trace(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object o, Throwable throwable) {
|
||||||
|
log.trace(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(String message, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.trace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object object, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.trace(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object object, Throwable t, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.trace(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fatal(String message) {
|
||||||
|
log.fatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fatal(String message, Throwable t) {
|
||||||
|
log.fatal(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object o) {
|
||||||
|
log.fatal(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object o, Throwable throwable) {
|
||||||
|
log.fatal(0, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(String message, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.fatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object object, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.fatal(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object object, Throwable t, LogContext logContext) {
|
||||||
|
AppInstallLogContext appInstallLogContext = (AppInstallLogContext) logContext;
|
||||||
|
MDCContextUtil.populateAppInstallMDCContext(appInstallLogContext);
|
||||||
|
log.fatal(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDebugEnabled() {
|
||||||
|
return log.isDebugEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isErrorEnabled() {
|
||||||
|
return log.isErrorEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFatalEnabled() {
|
||||||
|
return log.isFatalEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInfoEnabled() {
|
||||||
|
return log.isInfoEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTraceEnabled() {
|
||||||
|
return log.isTraceEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWarnEnabled() {
|
||||||
|
return log.isWarnEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearLogContext() {
|
||||||
|
MDC.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,318 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.notification.logger.impl;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
|
||||||
|
import io.entgra.device.mgt.core.notification.logger.DeviceConnectivityLogContext;
|
||||||
|
import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.log4j.MDC;
|
||||||
|
|
||||||
|
public class EntgraDeviceConnectivityLoggerImpl implements EntgraLogger {
|
||||||
|
|
||||||
|
private static Log log = null;
|
||||||
|
|
||||||
|
public EntgraDeviceConnectivityLoggerImpl(Class<?> clazz) {
|
||||||
|
log = LogFactory.getLog(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(String message) {
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(String message, Throwable t) {
|
||||||
|
log.info(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object o) {
|
||||||
|
log.info(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object o, Throwable throwable) {
|
||||||
|
log.info(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(String message, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object object, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.info(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.info(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug(String message) {
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug(String message, Throwable t) {
|
||||||
|
log.debug(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object o) {
|
||||||
|
log.debug(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object o, Throwable throwable) {
|
||||||
|
log.debug(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(String message, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object object, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.debug(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.debug(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(String message) {
|
||||||
|
log.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(String message, Throwable t) {
|
||||||
|
log.error(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object o) {
|
||||||
|
log.error(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object o, Throwable throwable) {
|
||||||
|
log.error(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message, Throwable t, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.error(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object object, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.error(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.error(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(String message) {
|
||||||
|
log.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(String message, Throwable t) {
|
||||||
|
log.warn(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object o) {
|
||||||
|
log.warn(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object o, Throwable throwable) {
|
||||||
|
log.warn(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message, Throwable t, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.warn(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object object, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.warn(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.warn(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String message) {
|
||||||
|
log.trace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String message, Throwable t) {
|
||||||
|
log.trace(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object o) {
|
||||||
|
log.trace(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object o, Throwable throwable) {
|
||||||
|
log.trace(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(String message, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.trace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object object, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.trace(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.trace(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fatal(String message) {
|
||||||
|
log.fatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fatal(String message, Throwable t) {
|
||||||
|
log.fatal(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object o) {
|
||||||
|
log.fatal(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object o, Throwable throwable) {
|
||||||
|
log.fatal(0, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(String message, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.fatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object object, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.fatal(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceConnectivityLogContext deviceConnectivityLogContext = (DeviceConnectivityLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceConnectivityMDCContext(deviceConnectivityLogContext);
|
||||||
|
log.fatal(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDebugEnabled() {
|
||||||
|
return log.isDebugEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isErrorEnabled() {
|
||||||
|
return log.isErrorEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFatalEnabled() {
|
||||||
|
return log.isFatalEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInfoEnabled() {
|
||||||
|
return log.isInfoEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTraceEnabled() {
|
||||||
|
return log.isTraceEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWarnEnabled() {
|
||||||
|
return log.isWarnEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearLogContext() {
|
||||||
|
MDC.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,318 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.notification.logger.impl;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
|
||||||
|
import io.entgra.device.mgt.core.notification.logger.DeviceEnrolmentLogContext;
|
||||||
|
import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.log4j.MDC;
|
||||||
|
|
||||||
|
public class EntgraDeviceEnrolmentLoggerImpl implements EntgraLogger {
|
||||||
|
|
||||||
|
private static Log log = null;
|
||||||
|
|
||||||
|
public EntgraDeviceEnrolmentLoggerImpl(Class<?> clazz) {
|
||||||
|
log = LogFactory.getLog(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(String message) {
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(String message, Throwable t) {
|
||||||
|
log.info(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object o) {
|
||||||
|
log.info(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object o, Throwable throwable) {
|
||||||
|
log.info(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(String message, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object object, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.info(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.info(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug(String message) {
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug(String message, Throwable t) {
|
||||||
|
log.debug(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object o) {
|
||||||
|
log.debug(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object o, Throwable throwable) {
|
||||||
|
log.debug(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(String message, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object object, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.debug(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.debug(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(String message) {
|
||||||
|
log.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(String message, Throwable t) {
|
||||||
|
log.error(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object o) {
|
||||||
|
log.error(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object o, Throwable throwable) {
|
||||||
|
log.error(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message, Throwable t, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.error(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object object, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.error(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.error(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(String message) {
|
||||||
|
log.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(String message, Throwable t) {
|
||||||
|
log.warn(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object o) {
|
||||||
|
log.warn(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object o, Throwable throwable) {
|
||||||
|
log.warn(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message, Throwable t, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.warn(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object object, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.warn(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.warn(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String message) {
|
||||||
|
log.trace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String message, Throwable t) {
|
||||||
|
log.trace(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object o) {
|
||||||
|
log.trace(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object o, Throwable throwable) {
|
||||||
|
log.trace(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(String message, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.trace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object object, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.trace(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.trace(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fatal(String message) {
|
||||||
|
log.fatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fatal(String message, Throwable t) {
|
||||||
|
log.fatal(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object o) {
|
||||||
|
log.fatal(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object o, Throwable throwable) {
|
||||||
|
log.fatal(0, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(String message, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.fatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object object, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.fatal(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object object, Throwable t, LogContext logContext) {
|
||||||
|
DeviceEnrolmentLogContext deviceEnrolmentLogContext = (DeviceEnrolmentLogContext) logContext;
|
||||||
|
MDCContextUtil.populateDeviceEnrolmentMDCContext(deviceEnrolmentLogContext);
|
||||||
|
log.fatal(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDebugEnabled() {
|
||||||
|
return log.isDebugEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isErrorEnabled() {
|
||||||
|
return log.isErrorEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFatalEnabled() {
|
||||||
|
return log.isFatalEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInfoEnabled() {
|
||||||
|
return log.isInfoEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTraceEnabled() {
|
||||||
|
return log.isTraceEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWarnEnabled() {
|
||||||
|
return log.isWarnEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearLogContext() {
|
||||||
|
MDC.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,318 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. 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 io.entgra.device.mgt.core.notification.logger.impl;
|
||||||
|
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.LogContext;
|
||||||
|
import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger;
|
||||||
|
import io.entgra.device.mgt.core.notification.logger.PolicyLogContext;
|
||||||
|
import io.entgra.device.mgt.core.notification.logger.util.MDCContextUtil;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.log4j.MDC;
|
||||||
|
|
||||||
|
public class EntgraPolicyLoggerImpl implements EntgraLogger {
|
||||||
|
|
||||||
|
private static Log log = null;
|
||||||
|
|
||||||
|
public EntgraPolicyLoggerImpl(Class<?> clazz) {
|
||||||
|
log = LogFactory.getLog(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(String message) {
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(String message, Throwable t) {
|
||||||
|
log.info(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object o) {
|
||||||
|
log.info(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object o, Throwable throwable) {
|
||||||
|
log.info(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(String message, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object object, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.info(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(Object object, Throwable t, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.info(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug(String message) {
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debug(String message, Throwable t) {
|
||||||
|
log.debug(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object o) {
|
||||||
|
log.debug(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object o, Throwable throwable) {
|
||||||
|
log.debug(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(String message, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.debug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object object, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.debug(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(Object object, Throwable t, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.debug(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(String message) {
|
||||||
|
log.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(String message, Throwable t) {
|
||||||
|
log.error(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object o) {
|
||||||
|
log.error(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object o, Throwable throwable) {
|
||||||
|
log.error(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(String message, Throwable t, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.error(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object object, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.error(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(Object object, Throwable t, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.error(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(String message) {
|
||||||
|
log.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(String message, Throwable t) {
|
||||||
|
log.warn(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object o) {
|
||||||
|
log.warn(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object o, Throwable throwable) {
|
||||||
|
log.warn(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(String message, Throwable t, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.warn(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object object, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.warn(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(Object object, Throwable t, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.warn(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String message) {
|
||||||
|
log.trace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String message, Throwable t) {
|
||||||
|
log.trace(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object o) {
|
||||||
|
log.trace(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object o, Throwable throwable) {
|
||||||
|
log.trace(o, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(String message, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.trace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object object, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.trace(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void trace(Object object, Throwable t, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.trace(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fatal(String message) {
|
||||||
|
log.fatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fatal(String message, Throwable t) {
|
||||||
|
log.fatal(message, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object o) {
|
||||||
|
log.fatal(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object o, Throwable throwable) {
|
||||||
|
log.fatal(0, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(String message, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.fatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object object, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.fatal(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fatal(Object object, Throwable t, LogContext logContext) {
|
||||||
|
PolicyLogContext policyLogContext = (PolicyLogContext) logContext;
|
||||||
|
MDCContextUtil.populatePolicyMDCContext(policyLogContext);
|
||||||
|
log.fatal(object, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDebugEnabled() {
|
||||||
|
return log.isDebugEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isErrorEnabled() {
|
||||||
|
return log.isErrorEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFatalEnabled() {
|
||||||
|
return log.isFatalEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInfoEnabled() {
|
||||||
|
return log.isInfoEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTraceEnabled() {
|
||||||
|
return log.isTraceEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWarnEnabled() {
|
||||||
|
return log.isWarnEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearLogContext() {
|
||||||
|
MDC.clear();
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue