gluu
公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.xdi.oxd.server.Processor クラス
org.xdi.oxd.server.Processor 連携図
Collaboration graph

公開メンバ関数

 Processor (ValidationService validationService)
 
String process (String p_command)
 
CommandResponse process (Command command)
 

非公開変数類

final ValidationService validationService
 

静的非公開変数類

static final Logger LOG = LoggerFactory.getLogger(Processor.class)
 

詳解

oxD operation processor.

著者
Yuriy Zabrovarnyy

構築子と解体子

◆ Processor()

org.xdi.oxd.server.Processor.Processor ( ValidationService  validationService)
inline
36  {
38  }
final ValidationService validationService
Definition: Processor.java:33

関数詳解

◆ process() [1/2]

String org.xdi.oxd.server.Processor.process ( String  p_command)
inline

Processed command.

引数
p_commandcommand as string
戻り値
response as string
46  {
47  LOG.trace("Command: {}", p_command);
48  try {
49  if (StringUtils.isNotBlank(p_command)) {
50  final Command command = CoreUtils.createJsonMapper().readValue(p_command, Command.class);
51  final CommandResponse response = process(command);
52  if (response != null) {
53  final String json = CoreUtils.asJson(response);
54  LOG.trace("Send back response: {}", json);
55  return json;
56  } else {
57  LOG.error("There is no response produced by Processor.");
58  return null;
59  }
60  }
61  } catch (IOException e) {
62  LOG.error(e.getMessage(), e);
63  }
64  LOG.trace("No command or it's corrupted. Stop handling commands for this client.");
66  }
static ObjectMapper createJsonMapper()
Definition: CoreUtils.java:142
static String asJson(Object p_object)
Definition: CoreUtils.java:122
Definition: CommandResponse.java:22
static final Logger LOG
Definition: Processor.java:31
static final String INTERNAL_ERROR_RESPONSE_AS_STRING
Definition: CommandResponse.java:28
String process(String p_command)
Definition: Processor.java:46
Definition: CoreUtils.java:48
Definition: Command.java:19

◆ process() [2/2]

CommandResponse org.xdi.oxd.server.Processor.process ( Command  command)
inline
68  {
69  if (command != null) {
70  try {
71  final IOperation<IParams> operation = (IOperation<IParams>) OperationFactory.create(command, ServerLauncher.getInjector());
72  if (operation != null) {
73  IParams iParams = Convertor.asParams(operation.getParameterClass(), command);
74  Pair<Rp, Boolean> rpWithIsClientLocalPair = validationService.validate(iParams);
75 
76  CommandResponse operationResponse = operation.execute(iParams);
77  if (operationResponse != null) {
78  if (operationResponse.getStatus() == ResponseStatus.OK && rpWithIsClientLocalPair != null) { // report usage only of operation is ok
79  ServerLauncher.getInjector().getInstance(LicenseService.class).notifyClientUsed(rpWithIsClientLocalPair.getFirst(), rpWithIsClientLocalPair.getSecond());
80  }
81  return operationResponse;
82  } else {
83  LOG.error("No response from operation. Command: " + command);
84  }
85  } else {
86  LOG.error("Operation is not supported!");
88  }
89  } catch (ErrorResponseException e) {
90  LOG.error(e.getLocalizedMessage(), e);
92  } catch (Throwable e) {
93  LOG.error(e.getMessage(), e);
94  }
95  }
97  }
static CommandResponse createErrorResponse(ErrorResponse p_error)
Definition: CommandResponse.java:90
Definition: IParams.java:13
Definition: ErrorResponseException.java:8
static final CommandResponse INTERNAL_ERROR_RESPONSE
Definition: CommandResponse.java:26
final ValidationService validationService
Definition: Processor.java:33
OK
Definition: ResponseStatus.java:18
Pair< Rp, Boolean > validate(IParams params)
Definition: ValidationService.java:41
static final CommandResponse OPERATION_IS_NOT_SUPPORTED
Definition: CommandResponse.java:30
Definition: CommandResponse.java:22
static final Logger LOG
Definition: Processor.java:31
Definition: ResponseStatus.java:17
ResponseStatus getStatus()
Definition: CommandResponse.java:51
ErrorResponseCode getErrorResponseCode()
Definition: ErrorResponseException.java:16

メンバ詳解

◆ LOG

final Logger org.xdi.oxd.server.Processor.LOG = LoggerFactory.getLogger(Processor.class)
staticprivate

Logger

◆ validationService

final ValidationService org.xdi.oxd.server.Processor.validationService
private

このクラス詳解は次のファイルから抽出されました: