Tabnine Logo
ServerUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
ServerUtil
in
org.keycloak.subsystem.server.extension

Best Java code snippets using org.keycloak.subsystem.server.extension.ServerUtil (Showing top 14 results out of 315)

origin: org.keycloak/keycloak-wildfly-server-subsystem

static void addStepToRedeployServerWar(OperationContext context, String deploymentName) {
  addDeploymentAction(context, REDEPLOY, deploymentName);
}
origin: org.keycloak/keycloak-wildfly-server-subsystem

ServerUtil(ModelNode operation) {
  this.deploymentName = getDeploymentName(operation);
  this.subsysModule = findSubsysModule();
  this.serverWar = findServerWarUri();
}
origin: org.keycloak/keycloak-wildfly-server-subsystem

void addStepToUploadServerWar(OperationContext context) throws OperationFailedException {
  PathAddress deploymentAddress = deploymentAddress(deploymentName);
  ModelNode op = Util.createOperation(ADD, deploymentAddress);
  // this is required for deployment to take place
  op.get(ENABLED).set(true);
  // prevents writing this deployment out to standalone.xml
  op.get(PERSISTENT).set(false);
  // Owner attribute is valid starting with WidlFly 9.  Ignored in WildFly 8
  op.get("owner").set(new ModelNode().add("subsystem", KeycloakExtension.SUBSYSTEM_NAME));
  if (serverWar == null) {
    throw new OperationFailedException("Keycloak Server WAR not found in keycloak-server-subsystem module");
  }
  op.get(CONTENT).add(makeContentItem());
  context.addStep(op, getHandler(context, deploymentAddress, ADD), OperationContext.Stage.MODEL);
}
origin: org.keycloak/keycloak-wildfly-server-subsystem

private static void addDeploymentAction(OperationContext context, String operation, String deploymentName) {
  if (!context.isNormalServer()) {
    return;
  }
  PathAddress deploymentAddress = deploymentAddress(deploymentName);
  ModelNode op = Util.createOperation(operation, deploymentAddress);
  op.get(RUNTIME_NAME).set(deploymentName);
  context.addStep(op, getHandler(context, deploymentAddress, operation), OperationContext.Stage.MODEL);
}
origin: org.keycloak/keycloak-wildfly-server-subsystem

@Override
protected void finishModelStage(OperationContext context, ModelNode operation, String attributeName, ModelNode newValue, ModelNode oldValue, Resource model) throws OperationFailedException {
  if (!context.isNormalServer() || attribNotChanging(attributeName, newValue, oldValue)) {
    super.finishModelStage(context, operation, attributeName, newValue, oldValue, model);
    return;
  }
  String deploymentName = ServerUtil.getDeploymentName(operation);
  if (attributeName.equals(KeycloakSubsystemDefinition.WEB_CONTEXT.getName())) {
    KeycloakAdapterConfigService.INSTANCE.setWebContext(newValue.asString());
    ServerUtil.addStepToRedeployServerWar(context, deploymentName);
  }
  super.finishModelStage(context, operation, attributeName, newValue, oldValue, model);
}
origin: org.keycloak/keycloak-wf9-server-subsystem

  protected void populateModel(final OperationContext context, final ModelNode operation, final Resource resource) throws  OperationFailedException {
    ModelNode model = resource.getModel();

    // set attribute values from parsed model
    for (AttributeDefinition attrDef : ALL_ATTRIBUTES) {
      attrDef.validateAndSet(operation, model);
    }

    // returns early if on domain controller
    if (!requiresRuntime(context)) {
      return;
    }

    // don't want to try to start server on host controller
    if (!context.isNormalServer()) {
      return;
    }

    ModelNode webContextNode = resource.getModel().get(WEB_CONTEXT.getName());
    if (!webContextNode.isDefined()) {
      webContextNode = WEB_CONTEXT.getDefaultValue();
    }
    String webContext = webContextNode.asString();

    ServerUtil serverUtil = new ServerUtil(operation);
    serverUtil.addStepToUploadServerWar(context);
    KeycloakAdapterConfigService.INSTANCE.setWebContext(webContext);
  }
}
origin: org.keycloak/keycloak-wildfly-server-subsystem

@Override
protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
  String deploymentName = ServerUtil.getDeploymentName(operation);
  KeycloakAdapterConfigService.INSTANCE.setWebContext(null);
  if (requiresRuntime(context)) { // don't do this on a domain controller
    addStepToRemoveServerWar(context, deploymentName);
  }
  super.performRemove(context, operation, model);
}
origin: org.keycloak/keycloak-wf9-server-subsystem

void addStepToUploadServerWar(OperationContext context) throws OperationFailedException {
  PathAddress deploymentAddress = deploymentAddress(deploymentName);
  ModelNode op = Util.createOperation(ADD, deploymentAddress);
  // this is required for deployment to take place
  op.get(ENABLED).set(true);
  // prevents writing this deployment out to standalone.xml
  op.get(PERSISTENT).set(false);
  // Owner attribute is valid starting with WidlFly 9.  Ignored in WildFly 8
  op.get("owner").set(new ModelNode().add("subsystem", KeycloakExtension.SUBSYSTEM_NAME));
  if (serverWar == null) {
    throw new OperationFailedException("Keycloak Server WAR not found in keycloak-server-subsystem module");
  }
  op.get(CONTENT).add(makeContentItem());
  context.addStep(op, getHandler(context, deploymentAddress, ADD), OperationContext.Stage.MODEL);
}
origin: org.keycloak/keycloak-wf9-server-subsystem

private static void addDeploymentAction(OperationContext context, String operation, String deploymentName) {
  if (!context.isNormalServer()) {
    return;
  }
  PathAddress deploymentAddress = deploymentAddress(deploymentName);
  ModelNode op = Util.createOperation(operation, deploymentAddress);
  op.get(RUNTIME_NAME).set(deploymentName);
  context.addStep(op, getHandler(context, deploymentAddress, operation), OperationContext.Stage.MODEL);
}
origin: org.keycloak/keycloak-wf9-server-subsystem

@Override
protected void finishModelStage(OperationContext context, ModelNode operation, String attributeName, ModelNode newValue, ModelNode oldValue, Resource model) throws OperationFailedException {
  if (!context.isNormalServer() || attribNotChanging(attributeName, newValue, oldValue)) {
    super.finishModelStage(context, operation, attributeName, newValue, oldValue, model);
    return;
  }
  String deploymentName = ServerUtil.getDeploymentName(operation);
  if (attributeName.equals(KeycloakSubsystemDefinition.WEB_CONTEXT.getName())) {
    KeycloakAdapterConfigService.INSTANCE.setWebContext(newValue.asString());
    ServerUtil.addStepToRedeployServerWar(context, deploymentName);
  }
  super.finishModelStage(context, operation, attributeName, newValue, oldValue, model);
}
origin: org.keycloak/keycloak-wildfly-server-subsystem

ServerUtil serverUtil = new ServerUtil(operation);
serverUtil.addStepToUploadServerWar(context);
KeycloakAdapterConfigService.INSTANCE.setWebContext(webContext);
origin: org.keycloak/keycloak-wf9-server-subsystem

@Override
protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
  String deploymentName = ServerUtil.getDeploymentName(operation);
  KeycloakAdapterConfigService.INSTANCE.setWebContext(null);
  if (requiresRuntime(context)) { // don't do this on a domain controller
    addStepToRemoveServerWar(context, deploymentName);
  }
  super.performRemove(context, operation, model);
}
origin: org.keycloak/keycloak-wf9-server-subsystem

ServerUtil(ModelNode operation) {
  this.deploymentName = getDeploymentName(operation);
  this.subsysModule = findSubsysModule();
  this.serverWar = findServerWarUri();
}
origin: org.keycloak/keycloak-wf9-server-subsystem

static void addStepToRedeployServerWar(OperationContext context, String deploymentName) {
  addDeploymentAction(context, REDEPLOY, deploymentName);
}
org.keycloak.subsystem.server.extensionServerUtil

Javadoc

Utility methods that help assemble and start an auth server.

Most used methods

  • <init>
  • addDeploymentAction
  • addStepToRedeployServerWar
  • addStepToUploadServerWar
  • deploymentAddress
  • findServerWarUri
  • findSubsysModule
  • getDeploymentName
  • getHandler
  • makeContentItem

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (ScheduledExecutorService)
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now