PageRenderTime 81ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/jboss-as-7.1.1.Final/web/src/main/java/org/jboss/as/web/WebReWriteConditionDefinition.java

#
Java | 56 lines | 43 code | 9 blank | 4 comment | 0 complexity | ecfd10a8a8c19086add4f52767b1f5c0 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. package org.jboss.as.web;
  2. import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
  3. import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler;
  4. import org.jboss.as.controller.SimpleAttributeDefinition;
  5. import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
  6. import org.jboss.as.controller.SimpleResourceDefinition;
  7. import org.jboss.as.controller.operations.validation.StringLengthValidator;
  8. import org.jboss.as.controller.registry.AttributeAccess;
  9. import org.jboss.as.controller.registry.ManagementResourceRegistration;
  10. import org.jboss.dmr.ModelType;
  11. /**
  12. * @author Tomaz Cerar
  13. * @created 23.2.12 17:32
  14. */
  15. public class WebReWriteConditionDefinition extends SimpleResourceDefinition {
  16. public static final WebReWriteConditionDefinition INSTANCE = new WebReWriteConditionDefinition();
  17. protected static final SimpleAttributeDefinition TEST =
  18. new SimpleAttributeDefinitionBuilder(Constants.TEST, ModelType.STRING, true)
  19. .setXmlName(Constants.TEST)
  20. .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
  21. .setValidator(new StringLengthValidator(1, false))
  22. .build();
  23. protected static final SimpleAttributeDefinition PATTERN =
  24. new SimpleAttributeDefinitionBuilder(Constants.PATTERN, ModelType.STRING, true)
  25. .setXmlName(Constants.PATTERN)
  26. .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
  27. .setValidator(new StringLengthValidator(1, false))
  28. .build();
  29. protected static final SimpleAttributeDefinition FLAGS =
  30. new SimpleAttributeDefinitionBuilder(Constants.FLAGS, ModelType.STRING, true)
  31. .setXmlName(Constants.FLAGS)
  32. .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
  33. .setValidator(new StringLengthValidator(1, false))
  34. .build();
  35. private WebReWriteConditionDefinition() {
  36. super(WebExtension.REWRITECOND_PATH,
  37. WebExtension.getResourceDescriptionResolver("virtual-server.rewrite.condition"),
  38. WebReWriteConditionAdd.INSTANCE,
  39. new ReloadRequiredRemoveStepHandler());
  40. }
  41. @Override
  42. public void registerAttributes(ManagementResourceRegistration rewritecondition) {
  43. rewritecondition.registerReadWriteAttribute(PATTERN, null, new ReloadRequiredWriteAttributeHandler(PATTERN));
  44. rewritecondition.registerReadWriteAttribute(TEST, null, new ReloadRequiredWriteAttributeHandler(TEST));
  45. rewritecondition.registerReadWriteAttribute(FLAGS, null, new ReloadRequiredWriteAttributeHandler(FLAGS));
  46. }
  47. }