KEYCLOAK-274 Compact JSON String. Get resource name from DMR.

This commit is contained in:
Stan Silvert 2014-01-30 09:05:27 -05:00
parent c81a08385f
commit c7112dc19f
2 changed files with 3 additions and 9 deletions

View file

@ -58,10 +58,7 @@ public class KeycloakAdapterConfigDeploymentProcessor implements DeploymentUnitP
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);
//TODO: Find context root properly
String resourceName = deploymentName.substring(0, deploymentName.lastIndexOf('.'));
addJSONData(service.getJSON(deploymentName, resourceName), warMetaData);
addJSONData(service.getJSON(deploymentName), warMetaData);
//addJSONData(getJSON(), warMetaData);
}

View file

@ -161,21 +161,18 @@ public class KeycloakAdapterConfigService implements Service<KeycloakAdapterConf
return null;
}
public String getJSON(String deploymentName, String resourceName) {
public String getJSON(String deploymentName) {
ModelNode deployment = this.deployments.get(deploymentName);
String realmName = deployment.get(RealmDefinition.TAG_NAME).asString();
ModelNode realm = this.realms.get(realmName);
ModelNode json = new ModelNode();
json.get(RealmDefinition.TAG_NAME).set(realmName);
json.get("resource").set(resourceName);
// Realm values set first. Some can be overridden by deployment values.
setJSONValues(json, realm);
setJSONValues(json, deployment);
// TODO: change this to true to compact the string
return json.toJSONString(false);
return json.toJSONString(true);
}
private void setJSONValues(ModelNode json, ModelNode values) {