当前位置: 首页>>代码示例>>Java>>正文


Java LoggerEnum类代码示例

本文整理汇总了Java中org.sunbird.common.models.util.LoggerEnum的典型用法代码示例。如果您正苦于以下问题:Java LoggerEnum类的具体用法?Java LoggerEnum怎么用?Java LoggerEnum使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LoggerEnum类属于org.sunbird.common.models.util包,在下文中一共展示了LoggerEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPropertiesValueById

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
@Override
public Response getPropertiesValueById(String keyspaceName, String tableName, String id,
    String... properties) {
  long startTime = System.currentTimeMillis();
  ProjectLogger.log("Cassandra Service getPropertiesValueById method started at ==" + startTime,
      LoggerEnum.PERF_LOG);
  Response response = new Response();
  try {
    String selectQuery = CassandraUtil.getSelectStatement(keyspaceName, tableName, properties);
    PreparedStatement statement = connectionManager.getSession(keyspaceName).prepare(selectQuery);
    BoundStatement boundStatement = new BoundStatement(statement);
    ResultSet results =
        connectionManager.getSession(keyspaceName).execute(boundStatement.bind(id));
    response = CassandraUtil.createResponse(results);
  } catch (Exception e) {
    ProjectLogger.log(Constants.EXCEPTION_MSG_FETCH + tableName + " : " + e.getMessage(), e);
    throw new ProjectCommonException(ResponseCode.SERVER_ERROR.getErrorCode(),
        ResponseCode.SERVER_ERROR.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode());
  }
  long stopTime = System.currentTimeMillis();
  long elapsedTime = stopTime - startTime;
  ProjectLogger.log("Cassandra Service getPropertiesValueById method end at ==" + stopTime
      + " ,Total time elapsed = " + elapsedTime, LoggerEnum.PERF_LOG);
  return response;
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:26,代码来源:CassandraOperationImpl.java

示例2: getRecordsByProperty

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
@Override
public Response getRecordsByProperty(String keyspaceName, String tableName, String propertyName,
    List<Object> propertyValueList) {
  long startTime = System.currentTimeMillis();
  ProjectLogger.log("Cassandra Service getRecordsByProperty method started at ==" + startTime,
      LoggerEnum.PERF_LOG);
  Response response = new Response();
  try {
    Select selectQuery = QueryBuilder.select().all().from(keyspaceName, tableName);
    Where selectWhere = selectQuery.where();
    Clause clause = QueryBuilder.in(propertyName, propertyValueList);
    selectWhere.and(clause);
    ResultSet results = connectionManager.getSession(keyspaceName).execute(selectQuery);
    response = CassandraUtil.createResponse(results);
  } catch (Exception e) {
    ProjectLogger.log(Constants.EXCEPTION_MSG_FETCH + tableName + " : " + e.getMessage(), e);
    throw new ProjectCommonException(ResponseCode.SERVER_ERROR.getErrorCode(),
        ResponseCode.SERVER_ERROR.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode());
  }
  long stopTime = System.currentTimeMillis();
  long elapsedTime = stopTime - startTime;
  ProjectLogger.log("Cassandra Service getRecordsByProperty method end at ==" + stopTime
      + " ,Total time elapsed = " + elapsedTime, LoggerEnum.PERF_LOG);
  return response;
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:26,代码来源:CassandraOperationImpl.java

示例3: deleteRecord

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
@Override
public Response deleteRecord(String keyspaceName, String tableName, String identifier) {
  long startTime = System.currentTimeMillis();
  ProjectLogger.log("Cassandra Service deleteRecord method started at ==" + startTime,
      LoggerEnum.PERF_LOG);
  Response response = new Response();
  try {
    Delete.Where delete = QueryBuilder.delete().from(keyspaceName, tableName)
        .where(eq(Constants.IDENTIFIER, identifier));
    connectionManager.getSession(keyspaceName).execute(delete);
    response.put(Constants.RESPONSE, Constants.SUCCESS);
  } catch (Exception e) {
    ProjectLogger.log(Constants.EXCEPTION_MSG_DELETE + tableName + " : " + e.getMessage(), e);
    throw new ProjectCommonException(ResponseCode.SERVER_ERROR.getErrorCode(),
        ResponseCode.SERVER_ERROR.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode());
  }
  long stopTime = System.currentTimeMillis();
  long elapsedTime = stopTime - startTime;
  ProjectLogger.log("Cassandra Service deleteRecord method end at ==" + stopTime
      + " ,Total time elapsed = " + elapsedTime, LoggerEnum.PERF_LOG);
  return response;
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:23,代码来源:CassandraOperationImpl.java

示例4: sendNotification

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
public Promise<Result> sendNotification() {
  try {
    JsonNode requestData = request().body().asJson();
    ProjectLogger.log("Send notification api call" + requestData, LoggerEnum.INFO.name());
    Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
    RequestValidator.validateSendNotification(reqObj);
    reqObj.setOperation(ActorOperations.SEND_NOTIFICATION.getValue());
    reqObj.setRequestId(ExecutionContext.getRequestId());
    reqObj.setEnv(getEnvironment());
    Map<String, Object> innerMap = reqObj.getRequest();
    innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
    reqObj.setRequest(innerMap);
    return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
  } catch (Exception e) {
    return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:GeoLocationController.java

示例5: verifyToken

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
@Override
public String verifyToken(String accessToken) {
  String userId = "";
  try {
    PublicKey publicKey = toPublicKey(SSO_PUBLIC_KEY);
    AccessToken token = RSATokenVerifier.verifyToken(accessToken, publicKey,
        KeyCloakConnectionProvider.SSO_URL + "realms/" + KeyCloakConnectionProvider.SSO_REALM,
        true, true);
    userId = token.getSubject();
    ProjectLogger.log(
        token.getId() + " " + token.issuedFor + " " + token.getProfile() + " "
            + token.getSubject() + " Active== " + token.isActive() + "  isExpired=="
            + token.isExpired() + " " + token.issuedNow().getExpiration(),
        LoggerEnum.INFO.name());
  } catch (Exception e) {
    ProjectLogger.log("User token is not authorized==" + e);
    throw new ProjectCommonException(ResponseCode.unAuthorised.getErrorCode(),
        ResponseCode.unAuthorised.getErrorMessage(), ResponseCode.UNAUTHORIZED.getResponseCode());
  }
  return userId;
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:22,代码来源:KeyCloakServiceImpl.java

示例6: getSalt

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * 
 * @return
 */
public static String getSalt() {
  if (!ProjectUtil.isStringNullOREmpty(encryption_key)) {
    return encryption_key;
  } else {
    encryption_key = System.getenv(JsonKey.ENCRYPTION_KEY);
    if (ProjectUtil.isStringNullOREmpty(encryption_key)) {
      ProjectLogger.log("Salt value is not provided by Env");
      encryption_key = PropertiesCache.getInstance().getProperty(JsonKey.ENCRYPTION_KEY);
    }
  }
  if (ProjectUtil.isStringNullOREmpty(encryption_key)) {
    ProjectLogger.log("throwing exception for invalid salt==", LoggerEnum.INFO.name());
    throw new ProjectCommonException(ResponseCode.saltValue.getErrorCode(),
        ResponseCode.saltValue.getErrorMessage(), ResponseCode.SERVER_ERROR.getResponseCode());
  }
  return encryption_key;
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:22,代码来源:DefaultEncryptionServivceImpl.java

示例7: getAllUnPublishedCourseStatusId

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * This method will provide list of all those course ids , which we did the published but haven't
 * got the status back as live.
 * 
 * @return List<String>
 */
@SuppressWarnings("unchecked")
private List<String> getAllUnPublishedCourseStatusId() {
  ProjectLogger.log("start of calling get unpublished course status==", LoggerEnum.INFO.name());
  List<String> ids = new ArrayList<>();
  Response response = cassandraOperation.getRecordsByProperty(coursePublishDBInfo.getKeySpace(),
      coursePublishDBInfo.getTableName(), JsonKey.STATUS,
      ProjectUtil.CourseMgmtStatus.DRAFT.ordinal());
  if (response != null && response.get(JsonKey.RESPONSE) != null) {
    Object obj = response.get(JsonKey.RESPONSE);
    if (obj != null && obj instanceof List) {
      List<Map<String, Object>> listOfMap = (List<Map<String, Object>>) obj;
      if (listOfMap != null) {
        for (Map<String, Object> map : listOfMap) {
          ids.add((String) map.get(JsonKey.ID));
        }
      }
    }
  }
  ProjectLogger.log("end of calling get unpublished course status==" + ids,
      LoggerEnum.INFO.name());
  return ids;
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-mw,代码行数:29,代码来源:CoursePublishedUpdate.java

示例8: createData

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * This method will put a new data entry inside Elastic search. identifier
 * value becomes _id inside ES, so every time provide a unique value while
 * saving it.
 *
 * @param index String  ES index name
 * @param type String  ES type name
 * @param identifier ES column identifier as an String
 * @param data Map<String,Object>
 * @return String identifier for created data
 */
public static String createData(String index, String type, String identifier,
    Map<String, Object> data) {
  long startTime = System.currentTimeMillis();
  ProjectLogger.log("ElasticSearchUtil createData method started at ==" +startTime+" for Type "+type, LoggerEnum.PERF_LOG);
  if (ProjectUtil.isStringNullOREmpty(identifier) || ProjectUtil.isStringNullOREmpty(type)
      || ProjectUtil.isStringNullOREmpty(index)) {
    ProjectLogger.log("Identifier value is null or empty ,not able to save data.");
    return "ERROR";
  }
  verifyOrCreateIndexAndType(index, type);
  try {
    data.put("identifier", identifier);
    IndexResponse response = ConnectionManager.getClient().prepareIndex(index, type, identifier)
        .setSource(data)
        .get();
    ProjectLogger
        .log("Save value==" + response.getId() + " " + response.status(), LoggerEnum.INFO.name());
    ProjectLogger.log("ElasticSearchUtil createData method end at ==" +System.currentTimeMillis()+" for Type "+type+" ,Total time elapsed = "+calculateEndTime(startTime), LoggerEnum.PERF_LOG);
    return response.getId();
  } catch (Exception e) {
    ProjectLogger.log("Error while saving "+type+" id : "+identifier, e);
    ProjectLogger.log("ElasticSearchUtil createData method end at ==" +System.currentTimeMillis()+" for Type "+type+" ,Total time elapsed = "+calculateEndTime(startTime), LoggerEnum.PERF_LOG);
    return "";
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:37,代码来源:ElasticSearchUtil.java

示例9: getDataByIdentifier

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * This method will provide data form ES based on incoming identifier.
 * we can get data by passing index and  identifier values , or all the three
 *
 * @param type String
 * @param identifier String
 * @return Map<String,Object> or null
 */
public static Map<String, Object> getDataByIdentifier(String index, String type,
    String identifier) {
  long startTime = System.currentTimeMillis();
  ProjectLogger.log("ElasticSearchUtil getDataByIdentifier method started at ==" +startTime+" for Type "+type, LoggerEnum.PERF_LOG);
  GetResponse response = null;
  if (ProjectUtil.isStringNullOREmpty(index) || ProjectUtil.isStringNullOREmpty(identifier)) {
    ProjectLogger.log("Invalid request is coming.");
    return new HashMap<>();
  } else if (ProjectUtil.isStringNullOREmpty(type)) {
    response = ConnectionManager.getClient().prepareGet().setIndex(index).setId(identifier).get();
  } else {
    response = ConnectionManager.getClient().prepareGet(index, type, identifier).get();
  }
  if (response == null || null == response.getSource()) {
    return new HashMap<>();
  }
  long stopTime = System.currentTimeMillis();
  long elapsedTime = stopTime - startTime;
  ProjectLogger.log("ElasticSearchUtil getDataByIdentifier method end at ==" +stopTime+" for Type "+type+" ,Total time elapsed = "+elapsedTime, LoggerEnum.PERF_LOG);
  return response.getSource();
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:30,代码来源:ElasticSearchUtil.java

示例10: startRemoteActorSystem

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * This method will do the basic setup for actors.
 */
private static void startRemoteActorSystem() {
  ProjectLogger.log("startRemoteCreationSystem method called....");
  Config con = null;
  String host = System.getenv(JsonKey.SUNBIRD_ACTOR_SERVICE_IP);
  String port = System.getenv(JsonKey.SUNBIRD_ACTOR_SERVICE_PORT);

  if (!ProjectUtil.isStringNullOREmpty(host) && !ProjectUtil.isStringNullOREmpty(port)) {
    con = ConfigFactory
        .parseString(
            "akka.remote.netty.tcp.hostname=" + host + ",akka.remote.netty.tcp.port=" + port + "")
        .withFallback(ConfigFactory.load().getConfig(ACTOR_CONFIG_NAME));
  } else {
    con = ConfigFactory.load().getConfig(ACTOR_CONFIG_NAME);
  }
  system = ActorSystem.create(REMOTE_ACTOR_SYSTEM_NAME, con);
  ActorRef learnerActorSelectorRef = system.actorOf(Props.create(RequestRouterActor.class),
      RequestRouterActor.class.getSimpleName());

  RequestRouterActor.setSystem(system);

  ProjectLogger.log("normal remote ActorSelectorRef " + learnerActorSelectorRef);
  ProjectLogger.log("NORMAL ACTOR REMOTE SYSTEM STARTED " + learnerActorSelectorRef,
      LoggerEnum.INFO.name());
  checkCassandraConnection();
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-mw,代码行数:29,代码来源:Application.java

示例11: getAllPublishedCourseListFromEKStep

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * This method will verify call the EKStep to know the course published status
 * 
 * @param ids List<String>
 * @return List<String>
 */
@SuppressWarnings("unchecked")
private List<String> getAllPublishedCourseListFromEKStep(List<String> ids) {
  ProjectLogger.log("fetching course details from Ekstep start");
  List<String> liveCourseIds = new ArrayList<>();
  StringBuilder identifier = new StringBuilder("[ ");
  for (int i = 0; i < ids.size(); i++) {
    if (i == 0) {
      identifier.append(" \"" + ids.get(i) + "\"");
    } else {
      identifier.append(" ,\"" + ids.get(i) + "\"");
    }
  }
  identifier.append(" ] ");
  Object[] result = EkStepRequestUtil.searchContent(
      requestData.replace("dataVal", identifier.toString()), CourseBatchSchedulerUtil.headerMap);
  for (int i = 0; i < result.length; i++) {
    Map<String, Object> map = (Map<String, Object>) result[i];
    String status = (String) map.get(JsonKey.STATUS);
    if (ProjectUtil.CourseMgmtStatus.LIVE.getValue().equalsIgnoreCase(status)) {
      liveCourseIds.add((String) map.get(JsonKey.IDENTIFIER));
    }
  }
  ProjectLogger.log("fetching course details from Ekstep completed", LoggerEnum.INFO.name());
  return liveCourseIds;
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-mw,代码行数:32,代码来源:CoursePublishedUpdate.java

示例12: approveOrg

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * Method to approve an organization
 * 
 * @return Promise<Result>
 */
public Promise<Result> approveOrg() {

  try {
    JsonNode requestData = request().body().asJson();
    ProjectLogger.log("Approve organisation request: " + requestData, LoggerEnum.INFO.name());
    Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
    ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
    RequestValidator.validateOrg(reqObj);
    reqObj.setOperation(ActorOperations.APPROVE_ORG.getValue());
    reqObj.setRequestId(ExecutionContext.getRequestId());
    reqObj.setEnv(getEnvironment());
    HashMap<String, Object> innerMap = new HashMap<>();
    innerMap.put(JsonKey.ORGANISATION, reqObj.getRequest());
    innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
    reqObj.setRequest(innerMap);
    return actorResponseHandler(getActorRef(), reqObj, timeout, null, null);
  } catch (Exception e) {
    return Promise.<Result>pure(createCommonExceptionResponse(e, null));
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:26,代码来源:OrganisationController.java

示例13: updateOrgStatus

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * Method to update the status of the organization
 * 
 * @return Promise<Result>
 */
public Promise<Result> updateOrgStatus() {

  try {
    JsonNode requestData = request().body().asJson();
    ProjectLogger.log("Update organisation request: " + requestData, LoggerEnum.INFO.name());
    Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
    ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
    RequestValidator.validateUpdateOrgStatus(reqObj);
    reqObj.setOperation(ActorOperations.UPDATE_ORG_STATUS.getValue());
    reqObj.setRequestId(ExecutionContext.getRequestId());
    reqObj.setEnv(getEnvironment());
    HashMap<String, Object> innerMap = new HashMap<>();
    innerMap.put(JsonKey.ORGANISATION, reqObj.getRequest());
    innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
    reqObj.setRequest(innerMap);
    return actorResponseHandler(getActorRef(), reqObj, timeout, null, null);
  } catch (Exception e) {
    return Promise.<Result>pure(createCommonExceptionResponse(e, null));
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:26,代码来源:OrganisationController.java

示例14: getOrgDetails

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * This method will provide user profile details based on requested userId.
 * 
 * @return Promise<Result>
 */
public Promise<Result> getOrgDetails() {

  try {
    JsonNode requestData = request().body().asJson();
    ProjectLogger.log("Get Organisation details request: " + requestData, LoggerEnum.INFO.name());
    Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
    ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
    RequestValidator.validateOrg(reqObj);
    reqObj.setOperation(ActorOperations.GET_ORG_DETAILS.getValue());
    reqObj.setRequestId(ExecutionContext.getRequestId());
    reqObj.setEnv(getEnvironment());
    HashMap<String, Object> innerMap = new HashMap<>();
    innerMap.put(JsonKey.ORGANISATION, reqObj.getRequest());
    innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
    reqObj.setRequest(innerMap);
    return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
  } catch (Exception e) {
    return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:26,代码来源:OrganisationController.java

示例15: addMemberToOrganisation

import org.sunbird.common.models.util.LoggerEnum; //导入依赖的package包/类
/**
 * Method to add an user to the organization
 * 
 * @return Promise<Result>
 */
public Promise<Result> addMemberToOrganisation() {

  try {
    JsonNode requestData = request().body().asJson();
    ProjectLogger.log(" add member to organisation = " + requestData, LoggerEnum.INFO.name());
    Request reqObj = (Request) mapper.RequestMapper.mapRequest(requestData, Request.class);
    ProjectUtil.updateMapSomeValueTOLowerCase(reqObj);
    RequestValidator.validateAddMember(reqObj);
    reqObj.setOperation(ActorOperations.ADD_MEMBER_ORGANISATION.getValue());
    reqObj.setRequestId(ExecutionContext.getRequestId());
    reqObj.setEnv(getEnvironment());
    HashMap<String, Object> innerMap = new HashMap<>();
    innerMap.put(JsonKey.USER_ORG, reqObj.getRequest());
    innerMap.put(JsonKey.REQUESTED_BY, ctx().flash().get(JsonKey.USER_ID));
    reqObj.setRequest(innerMap);
    return actorResponseHandler(getActorRef(), reqObj, timeout, null, request());
  } catch (Exception e) {
    return Promise.<Result>pure(createCommonExceptionResponse(e, request()));
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:26,代码来源:OrganisationController.java


注:本文中的org.sunbird.common.models.util.LoggerEnum类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。