/** * This method should only be called if you can propagate the context id * from another LogContext. * * @param callingUser calling user * @param callingAccount calling account * @param contextId context id propagated from another call context * @return LogContext */ public static LogContext register(User callingUser, Account callingAccount, String contextId) { return register(callingUser, callingAccount, null, null, contextId); }
public static LogContext register(User callingUser, Account callingAccount) { return register(callingUser, callingAccount, UUID.randomUUID().toString()); }
public static LogContext registerSystemLogContextOnceOnly() { try { LogContext context = s_currentContext.get(); if (context == null) { return register(null, null, User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, UUID.randomUUID().toString()); } assert context.getCallingUserId() == User.UID_SYSTEM : "You are calling a very specific method that registers a one time system context. This method is meant for background threads that does processing."; return context; } catch (Exception e) { s_logger.error("Failed to register the system log context.", e); throw new CloudRuntimeException("Failed to register system log context", e); } }
public static LogContext register(long callingUserId, long callingAccountId) throws CloudAuthenticationException { Account account = s_entityMgr.findById(Account.class, callingAccountId); if (account == null) { throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, Long.toString(callingAccountId)); } User user = s_entityMgr.findById(User.class, callingUserId); if (user == null) { throw new CloudAuthenticationException("The user is no longer current.").add(User.class, Long.toString(callingUserId)); } return register(user, account); }
public static LogContext register(long callingUserId, long callingAccountId, String contextId) throws CloudAuthenticationException { Account account = s_entityMgr.findById(Account.class, callingAccountId); if (account == null) { throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, Long.toString(callingAccountId)); } User user = s_entityMgr.findById(User.class, callingUserId); if (user == null) { throw new CloudAuthenticationException("The user is no longer current.").add(User.class, Long.toString(callingUserId)); } return register(user, account, contextId); }
public static LogContext register(String callingUserUuid, String callingAccountUuid) { Account account = s_entityMgr.findByUuid(Account.class, callingAccountUuid); if (account == null) { throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, callingAccountUuid); } User user = s_entityMgr.findByUuid(User.class, callingUserUuid); if (user == null) { throw new CloudAuthenticationException("The user is no longer current.").add(User.class, callingUserUuid); } return register(user, account); }