keycloak
公開メンバ関数 | 静的公開変数類 | 非公開メンバ関数 | 静的非公開変数類 | 全メンバ一覧
org.keycloak.subsystem.server.extension.MigrateJsonOperation クラス
org.keycloak.subsystem.server.extension.MigrateJsonOperation の継承関係図
Inheritance graph
org.keycloak.subsystem.server.extension.MigrateJsonOperation 連携図
Collaboration graph

公開メンバ関数

void execute (OperationContext context, ModelNode operation) throws OperationFailedException
 

静的公開変数類

static final String OPERATION_NAME = "migrate-json"
 
static final OperationDefinition DEFINITION
 

非公開メンバ関数

String localConfig () throws IOException
 
String readConfig (ModelNode operation) throws IOException
 

静的非公開変数類

static final String CONFIG_DIR = System.getProperty("jboss.server.config.dir")
 
static final Path DEFAULT_CONFIG_FILE = Paths.get(CONFIG_DIR, "keycloak-server.json")
 
static final AttributeDefinition FILE_ATTRIBUTE = SimpleAttributeDefinitionBuilder.create("file", ModelType.BYTES, true).build()
 

詳解

This operation provides a migration path from keycloak-server.json to standalone.xml or domain.xml.

著者
Stan Silvert ssilv.nosp@m.ert@.nosp@m.redha.nosp@m.t.co.nosp@m.m (C) 2016 Red Hat Inc.

関数詳解

◆ execute()

void org.keycloak.subsystem.server.extension.MigrateJsonOperation.execute ( OperationContext  context,
ModelNode  operation 
) throws OperationFailedException
inline
78  {
79  List<ModelNode> ops = null;
80  try {
81  PathAddress currentAddr = context.getCurrentAddress();
82  ops = JsonConfigConverter.convertJsonConfig(readConfig(operation), currentAddr);
83  } catch (IOException ioe) {
84  throw new OperationFailedException(ioe);
85  }
86 
87  for (ModelNode op : ops) {
88  PathAddress addr = PathAddress.pathAddress(op.get(ADDRESS));
89  String opName = op.get(OP).asString();
90  context.addStep(op,
91  context.getRootResourceRegistration().getOperationHandler(addr, opName),
92  OperationContext.Stage.MODEL);
93  }
94 
95  context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
96  }
String readConfig(ModelNode operation)
Definition: MigrateJsonOperation.java:65

◆ localConfig()

String org.keycloak.subsystem.server.extension.MigrateJsonOperation.localConfig ( ) throws IOException
inlineprivate
60  {
61  if (Files.notExists(DEFAULT_CONFIG_FILE)) return null;
62  return new String(Files.readAllBytes(DEFAULT_CONFIG_FILE));
63  }
static final Path DEFAULT_CONFIG_FILE
Definition: MigrateJsonOperation.java:50

◆ readConfig()

String org.keycloak.subsystem.server.extension.MigrateJsonOperation.readConfig ( ModelNode  operation) throws IOException
inlineprivate
65  {
66  ModelNode file = operation.get(FILE_ATTRIBUTE.getName());
67  if (file.isDefined() && file.asBytes().length > 0) {
68  return new String(file.asBytes());
69  }
70 
71  String localConfig = localConfig();
72  if (localConfig != null) return localConfig;
73 
74  throw new IOException("Can not find json file to migrate");
75  }
static final AttributeDefinition FILE_ATTRIBUTE
Definition: MigrateJsonOperation.java:52
String localConfig()
Definition: MigrateJsonOperation.java:60

メンバ詳解

◆ CONFIG_DIR

final String org.keycloak.subsystem.server.extension.MigrateJsonOperation.CONFIG_DIR = System.getProperty("jboss.server.config.dir")
staticprivate

◆ DEFAULT_CONFIG_FILE

final Path org.keycloak.subsystem.server.extension.MigrateJsonOperation.DEFAULT_CONFIG_FILE = Paths.get(CONFIG_DIR, "keycloak-server.json")
staticprivate

◆ DEFINITION

final OperationDefinition org.keycloak.subsystem.server.extension.MigrateJsonOperation.DEFINITION
static
初期値:
= new SimpleOperationDefinitionBuilder(OPERATION_NAME, KeycloakExtension.getResourceDescriptionResolver())
.setRuntimeOnly()
.setReadOnly()
.setReplyType(ModelType.STRING)
.setParameters(FILE_ATTRIBUTE)
.build()

◆ FILE_ATTRIBUTE

final AttributeDefinition org.keycloak.subsystem.server.extension.MigrateJsonOperation.FILE_ATTRIBUTE = SimpleAttributeDefinitionBuilder.create("file", ModelType.BYTES, true).build()
staticprivate

◆ OPERATION_NAME

final String org.keycloak.subsystem.server.extension.MigrateJsonOperation.OPERATION_NAME = "migrate-json"
static

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