Permalink
Browse files

Change deployment overlays so links do not need to be explicitly named

  • Loading branch information...
1 parent b3711ab commit 9635f9aed7a11a34f60ba271a9524083904a0bb1 @stuartwdouglas stuartwdouglas committed Aug 31, 2012
Showing with 197 additions and 218 deletions.
  1. +16 −17 build/src/main/resources/docs/schema/jboss-as-config_1_4.xsd
  2. +0 −1 controller/src/main/java/org/jboss/as/controller/descriptions/ModelDescriptionConstants.java
  3. +1 −0 controller/src/main/java/org/jboss/as/controller/parsing/Attribute.java
  4. +0 −2 controller/src/main/java/org/jboss/as/controller/parsing/Element.java
  5. +8 −12 ...oller/src/main/resources/org/jboss/as/controller/descriptions/common/LocalDescriptions.properties
  6. +5 −4 host-controller/src/main/java/org/jboss/as/domain/controller/DomainModelUtil.java
  7. +4 −4 ...-controller/src/main/java/org/jboss/as/domain/controller/descriptions/ServerGroupDescription.java
  8. +2 −2 ...src/main/java/org/jboss/as/domain/controller/operations/coordination/ServerOperationResolver.java
  9. +17 −18 host-controller/src/main/java/org/jboss/as/host/controller/ManagedServerOperationsFactory.java
  10. +5 −6 host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java
  11. +7 −1 ...oller/src/main/resources/org/jboss/as/domain/controller/descriptions/LocalDescriptions.properties
  12. +2 −2 server/src/main/java/org/jboss/as/server/ServerControllerModelUtil.java
  13. +0 −5 server/src/main/java/org/jboss/as/server/controller/descriptions/ServerRootDescription.java
  14. +2 −2 server/src/main/java/org/jboss/as/server/deploymentoverlay/ContentDefinition.java
  15. +19 −3 server/src/main/java/org/jboss/as/server/deploymentoverlay/DeploymentOverlayAdd.java
  16. +1 −1 server/src/main/java/org/jboss/as/server/deploymentoverlay/DeploymentOverlayDefinition.java
  17. +8 −9 ...as/server/deploymentoverlay/{DeploymentOverlayLinkAdd.java → DeploymentOverlayDeploymentAdd.java}
  18. +7 −18 ...oymentoverlay/{DeploymentOverlayLinkDefinition.java → DeploymentOverlayDeploymentDefinition.java}
  19. +5 −6 ...ver/deploymentoverlay/{DeploymentOverlayLinkRemove.java → DeploymentOverlayDeploymentRemove.java}
  20. +1 −1 server/src/main/java/org/jboss/as/server/deploymentoverlay/DeploymentOverlayModel.java
  21. +53 −76 server/src/main/java/org/jboss/as/server/parsing/CommonXml.java
  22. +1 −10 server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java
  23. +10 −3 ...e/domain/src/test/java/org/jboss/as/test/integration/domain/suites/DeploymentOverlayTestCase.java
  24. +23 −15 ...st/java/org/jboss/as/test/integration/deployment/deploymentoverlay/DeploymentOverlayTestCase.java
View
33 build/src/main/resources/docs/schema/jboss-as-config_1_4.xsd
@@ -124,7 +124,6 @@
<xs:element name="socket-binding-group" type="standalone-socket-binding-groupType" minOccurs="0" maxOccurs="1"/>
<xs:element name="deployments" type="server-deploymentsType" minOccurs="0" maxOccurs="1"/>
<xs:element name="deployment-overlays" type="deployment-overlaysType" minOccurs="0" maxOccurs="1"/>
- <xs:element name="deployment-overlay-links" type="deployment-overlay-linksType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="optional">
<xs:annotation>
@@ -1073,7 +1072,7 @@
<xs:element name="deployments" type="server-groupDeploymentsType" minOccurs="0"/>
<xs:element name="system-properties" minOccurs="0" type="properties-with-boottime"/>
- <xs:element name="deployment-overlay-links" type="deployment-overlay-linksType" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="deployment-overlays" type="server-group-deployment-overlaysType" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
@@ -2315,6 +2314,7 @@
<xs:complexType name="deployment-overlayType">
<xs:sequence>
<xs:element name="content" type="deployment-overlay-contentType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="deployment" type="deployment-overlay-deploymentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:token"/>
</xs:complexType>
@@ -2324,32 +2324,31 @@
<xs:attribute name="content" type="xs:token" use="required"/>
</xs:complexType>
- <xs:complexType name="deployment-overlay-linksType">
+
+ <xs:complexType name="deployment-overlay-deploymentType">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="regular-expression" type="xs:boolean" use="optional"/>
+ </xs:complexType>
+
+
+ <xs:complexType name="server-group-deployment-overlaysType">
<xs:annotation>
<xs:documentation>
<![CDATA[
- Stores information about the linking between deployment overlays and a deployment.
+ Stores information about deployment overlays that can be used to override deployment content.
]]>
</xs:documentation>
</xs:annotation>
<xs:sequence>
- <xs:element name="deployment-overlay-link" type="deployment-overlay-linkType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="deployment-overlay" type="server-group-deployment-overlayType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="deployment-overlay-linkType">
+ <xs:complexType name="server-group-deployment-overlayType">
+ <xs:sequence>
+ <xs:element name="deployment" type="deployment-overlay-deploymentType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
<xs:attribute name="name" use="required" type="xs:token"/>
- <xs:attribute name="deployment" use="required" type="xs:string">
- <xs:annotation>
- <xs:documentation>
- <![CDATA[
- The deployment that the given overlay is linked to. * is considered to be a wildcard, so *.jar will
- match all jar deployments.
- ]]>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="deployment-overlay" use="required" type="xs:token"/>
</xs:complexType>
</xs:schema>
View
1 controller/src/main/java/org/jboss/as/controller/descriptions/ModelDescriptionConstants.java
@@ -75,7 +75,6 @@
public static final String DEPLOY = "deploy";
public static final String DEPLOYMENT = "deployment";
public static final String DEPLOYMENT_OVERLAY = "deployment-overlay";
- public static final String DEPLOYMENT_OVERLAY_LINK = "deployment-overlay-link";
public static final String DEPRECATED = "deprecated";
public static final String DESCRIBE = "describe";
public static final String DESCRIPTION = "description";
View
1 controller/src/main/java/org/jboss/as/controller/parsing/Attribute.java
@@ -94,6 +94,7 @@
PROTOCOL("protocol"),
RECURSIVE("recursive"),
REF("ref"),
+ REGULAR_EXPRESSION("regular-expression"),
RELATIVE_TO("relative-to"),
RUNTIME_NAME("runtime-name"),
SEARCH_CREDENTIAL("search-credential"),
View
2 controller/src/main/java/org/jboss/as/controller/parsing/Element.java
@@ -54,8 +54,6 @@
DEPLOYMENTS("deployments"),
DEPLOYMENT_OVERLAY("deployment-overlay"),
DEPLOYMENT_OVERLAYS("deployment-overlays"),
- DEPLOYMENT_OVERLAY_LINK("deployment-overlay-link"),
- DEPLOYMENT_OVERLAY_LINKS("deployment-overlay-links"),
ENVIRONMENT_VARIABLES("environment-variables"),
EXTENSION("extension"),
View
20 ...c/main/resources/org/jboss/as/controller/descriptions/common/LocalDescriptions.properties
@@ -378,16 +378,12 @@ deployment-overlay.add=Adds a deployment overlay
deployment-overlay.remove=Removes a deployment overlay
deployment-overlay.override=An override for an individual content item
deployment-overlay.content=The content of the deployment overlay
+deployment-overlay.deployment=The deployment that this deployment overlay is linked to
+deployment-overlay.deployment.add=Adds a deployment overlay link
+deployment-overlay.deployment.remove=Removes a deployment overlay link
+deployment-overlay.deployment.regular-expression=If the deployment name is a regular expression
+deployment-overlay.content.add=Adds a piece of content to a deployment overlay
+deployment-overlay.content.remove=Removes a piece of content
+deployment-overlay.content.path=The archive path that this content item overrides. e.g. To override a web.xml in a war packaged in an ear this would be mywar.war/WEB-INF/web.xml .
+deployment-overlay.content.content=The content hash
-content=The content of the deployment overlay
-content.add=Adds a piece of content to a deployment overlay
-content.remove=Removes a piece of content
-content.path=The archive path that this content item overrides. e.g. To override a web.xml in a war packaged in an ear this would be mywar.war/WEB-INF/web.xml .
-content.content=The content hash
-
-deployment-overlay-link=Links a deployment overlay to a deployment name
-deployment-overlay-link.add=Adds a deployment overlay link
-deployment-overlay-link.remove=Removes a deployment overlay link
-deployment-overlay-link.deployment=The name of the deployment that the deployment overlay is linked to
-deployment-overlay-link.deployment-overlay=The deployment overlay to link
-deployment-overlay-link.regular-expression=If the deployment name is a regular expression
View
9 host-controller/src/main/java/org/jboss/as/domain/controller/DomainModelUtil.java
@@ -141,7 +141,7 @@
import org.jboss.as.server.controller.descriptions.ServerDescriptionConstants;
import org.jboss.as.server.deploymentoverlay.ContentDefinition;
import org.jboss.as.server.deploymentoverlay.DeploymentOverlayDefinition;
-import org.jboss.as.server.deploymentoverlay.DeploymentOverlayLinkDefinition;
+import org.jboss.as.server.deploymentoverlay.DeploymentOverlayDeploymentDefinition;
import org.jboss.as.server.deploymentoverlay.service.DeploymentOverlayPriority;
import org.jboss.as.server.operations.LaunchTypeHandler;
import org.jboss.as.server.services.net.LocalDestinationOutboundSocketBindingResourceDefinition;
@@ -331,11 +331,12 @@ private static void initializeDomainRegistry(final ManagementResourceRegistratio
//deployment overlays
- final ManagementResourceRegistration contentOverrides = root.registerSubModel(DeploymentOverlayDefinition.INSTANCE);
- contentOverrides.registerSubModel(new ContentDefinition(contentRepo, fileRepository));
+ final ManagementResourceRegistration deploymentOverlays = root.registerSubModel(DeploymentOverlayDefinition.INSTANCE);
+ deploymentOverlays.registerSubModel(new ContentDefinition(contentRepo, fileRepository));
//server group deployment overlay links
- serverGroups.registerSubModel(new DeploymentOverlayLinkDefinition(DeploymentOverlayPriority.SERVER_GROUP));
+ final ManagementResourceRegistration serverGroupDeploymentOverlay = serverGroups.registerSubModel(DeploymentOverlayDefinition.INSTANCE);
+ serverGroupDeploymentOverlay.registerSubModel(new DeploymentOverlayDeploymentDefinition(DeploymentOverlayPriority.SERVER_GROUP));
// Management client content
ManagedDMRContentTypeResourceDefinition plansDef = new ManagedDMRContentTypeResourceDefinition(contentRepo, ROLLOUT_PLAN,
View
8 ...ler/src/main/java/org/jboss/as/domain/controller/descriptions/ServerGroupDescription.java
@@ -36,7 +36,7 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CHILDREN;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEFAULT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HEAD_COMMENT_ALLOWED;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.JVM;
@@ -97,9 +97,9 @@ public static ModelNode getServerGroupDescription(final Locale locale) {
root.get(CHILDREN, DEPLOYMENT, MIN_OCCURS).set(0);
root.get(CHILDREN, DEPLOYMENT, MODEL_DESCRIPTION);
- root.get(CHILDREN, DEPLOYMENT_OVERLAY_LINK, DESCRIPTION).set(bundle.getString("server-group.deployment-overlay-link"));
- root.get(CHILDREN, DEPLOYMENT_OVERLAY_LINK, MIN_OCCURS).set(0);
- root.get(CHILDREN, DEPLOYMENT_OVERLAY_LINK, MODEL_DESCRIPTION);
+ root.get(CHILDREN, DEPLOYMENT_OVERLAY, DESCRIPTION).set(bundle.getString("server-group.deployment-overlay"));
+ root.get(CHILDREN, DEPLOYMENT_OVERLAY, MIN_OCCURS).set(0);
+ root.get(CHILDREN, DEPLOYMENT_OVERLAY, MODEL_DESCRIPTION);
root.get(CHILDREN, JVM, DESCRIPTION).set(bundle.getString("server-group.jvm"));
root.get(CHILDREN, JVM, MIN_OCCURS).set(0);
View
4 .../java/org/jboss/as/domain/controller/operations/coordination/ServerOperationResolver.java
@@ -31,7 +31,7 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CONTENT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.GROUP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.INTERFACE;
@@ -370,7 +370,7 @@ public static synchronized void addToDontPropagateToServersAttachment(OperationC
} else if (SYSTEM_PROPERTY.equals(type)) {
String affectedGroup = address.getElement(0).getValue();
result = getServerSystemPropertyOperations(operation, address, Level.SERVER_GROUP, domain, affectedGroup, host);
- } else if (DEPLOYMENT_OVERLAY_LINK.equals(type)) {
+ } else if (DEPLOYMENT_OVERLAY.equals(type) && address.getLastElement().getKey().equals(DEPLOYMENT)) {
String groupName = address.getElement(0).getValue();
Set<ServerIdentity> servers = getServersForGroup(groupName, host, localHostName, serverProxies);
ModelNode serverOp = operation.clone();
View
35 ...controller/src/main/java/org/jboss/as/host/controller/ManagedServerOperationsFactory.java
@@ -33,7 +33,6 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEFAULT_INTERFACE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ENABLED;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.EXTENSION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.GROUP;
@@ -43,6 +42,7 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.LDAP_CONNECTION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.LOCAL_DESTINATION_OUTBOUND_SOCKET_BINDING;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.MANAGEMENT;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAMESPACES;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
@@ -182,7 +182,6 @@ ModelNode getBootUpdates() {
addSubsystems(updates);
addDeployments(updates);
addDeploymentOverlays(updates);
- addDeploymentOverlayLinks(updates);
return updates.model;
}
@@ -564,23 +563,23 @@ public void addDeploymentOverlays(final List<ModelNode> updates) {
updates.add(addOp);
}
}
- }
- }
- }
-
- public void addDeploymentOverlayLinks(final List<ModelNode> updates) {
- if (serverGroup.hasDefined(DEPLOYMENT_OVERLAY_LINK)) {
-
- for (Property deploymentOverlayLink : serverGroup.get(DEPLOYMENT_OVERLAY_LINK).asPropertyList()) {
- String name = deploymentOverlayLink.getName();
- ModelNode details = deploymentOverlayLink.getValue();
+ if (serverGroup.hasDefined(DEPLOYMENT_OVERLAY)) {
+ final ModelNode groupOverlay = serverGroup.get(DEPLOYMENT_OVERLAY).asObject();
+ if (groupOverlay.has(name)) {
+ List<Property> deployments = groupOverlay.get(name).asPropertyList();
+ for (Property content : deployments) {
+ final String deploymentName = content.getName();
+ final ModelNode deploymentDetails = content.getValue();
+ boolean regEx = deploymentDetails.hasDefined(REGULAR_EXPRESSION) ? deploymentDetails.require(REGULAR_EXPRESSION).asBoolean() : false;
+
+ addr = PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT_OVERLAY, name), PathElement.pathElement(DEPLOYMENT, deploymentName));
+ addOp = Util.getEmptyOperation(ADD, addr.toModelNode());
+ addOp.get(REGULAR_EXPRESSION).set(regEx);
+ updates.add(addOp);
+ }
+ }
+ }
- PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT_OVERLAY_LINK, name));
- ModelNode addOp = Util.getEmptyOperation(ADD, addr.toModelNode());
- addOp.get(DEPLOYMENT).set(details.get(DEPLOYMENT));
- addOp.get(REGULAR_EXPRESSION).set(details.get(REGULAR_EXPRESSION));
- addOp.get(DEPLOYMENT_OVERLAY).set(details.get(DEPLOYMENT_OVERLAY));
- updates.add(addOp);
}
}
}
View
11 host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java
@@ -28,7 +28,6 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CONTENT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ENABLED;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.EXTENSION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HASH;
@@ -368,7 +367,7 @@ void readDomainElement1_3(final XMLExtendedStreamReader reader, final ModelNode
element = nextElement(reader, expectedNs);
}
if (element == Element.DEPLOYMENT_OVERLAYS && expectedNs.ordinal() >= Namespace.DOMAIN_1_4.ordinal()) {
- parseDeploymentOverlays(reader, expectedNs, list);
+ parseDeploymentOverlays(reader, expectedNs, new ModelNode(), list);
element = nextElement(reader, expectedNs);
}
if (element == Element.SERVER_GROUPS) {
@@ -705,8 +704,8 @@ void parseServerGroups(final XMLExtendedStreamReader reader, final ModelNode add
parseDeployments(reader, groupAddress, expectedNs, list, EnumSet.of(Attribute.NAME, Attribute.RUNTIME_NAME, Attribute.ENABLED), Collections.<Element>emptySet());
break;
}
- case DEPLOYMENT_OVERLAY_LINKS: {
- parseDeploymentOverlayLinks(reader, expectedNs, groupAddress, list);
+ case DEPLOYMENT_OVERLAYS: {
+ parseDeploymentOverlays(reader, expectedNs, groupAddress, list);
break;
}
case SYSTEM_PROPERTIES: {
@@ -988,8 +987,8 @@ private void writeServerGroup(final XMLExtendedStreamWriter writer, final String
if (group.hasDefined(DEPLOYMENT)) {
writeServerGroupDeployments(writer, group.get(DEPLOYMENT));
}
- if (group.hasDefined(DEPLOYMENT_OVERLAY_LINK)) {
- writeDeploymentOverlayLinks(writer, group.get(DEPLOYMENT_OVERLAY_LINK));
+ if (group.hasDefined(DEPLOYMENT_OVERLAY)) {
+ writeDeploymentOverlays(writer, group.get(DEPLOYMENT_OVERLAY));
writeNewLine(writer);
}
// System properties
View
8 ...c/main/resources/org/jboss/as/domain/controller/descriptions/LocalDescriptions.properties
@@ -47,7 +47,13 @@ server-group.servers.restart=Restarts all servers belonging to the server group
server-group.servers.start=Starts all configured servers belonging to the server group in the domain that are not currently running.
server-group.servers.stop=Stops all servers belonging to the server group currently running in the domain.
-server-group.deployment-overlay-link=A set of links between a deployment overlay and a deployment
+server-group.deployment-overlay=Links between a defined deployment overlay and deployments in this server group
+server-group.deployment-overlay.add=Adds a link to a deployment overlay
+server-group.deployment-overlay.remove=Removes a link to a deployment overlay
+server-group.deployment-overlay.deployment=A deployment that this overlay is applied to
+server-group.deployment-overlay.deployment.add=Adds a link between a deployment and this overlay
+server-group.deployment-overlay.deployment.remove=Removes a link between a deployment and this overlay
+server-group.deployment-overlay.deployment.regular-expression=If this deployment name should be treated as a regular expression
rollout-plans=Storage information about a set of named management update rollout plans useful to management clients that are stored in the domain content repository. The child resources under this resource provide access to these plans to management clients, allowing clients to use the plans by referencing them by name, avoiding the need to recreate them for each use.
rollout-plans.hash=The hash of all stored rollout plans. Used internally by host controllers to locate rollout plan content.
View
4 server/src/main/java/org/jboss/as/server/ServerControllerModelUtil.java
@@ -122,7 +122,7 @@
import org.jboss.as.server.deployment.DeploymentUploadURLHandler;
import org.jboss.as.server.deploymentoverlay.ContentDefinition;
import org.jboss.as.server.deploymentoverlay.DeploymentOverlayDefinition;
-import org.jboss.as.server.deploymentoverlay.DeploymentOverlayLinkDefinition;
+import org.jboss.as.server.deploymentoverlay.DeploymentOverlayDeploymentDefinition;
import org.jboss.as.server.deploymentoverlay.service.DeploymentOverlayPriority;
import org.jboss.as.server.mgmt.HttpManagementResourceDefinition;
import org.jboss.as.server.mgmt.NativeManagementResourceDefinition;
@@ -384,7 +384,7 @@ public static void initOperations(final ManagementResourceRegistration root,
contentOverrides.registerSubModel(new ContentDefinition(contentRepository, null));
//deployment overlay links
- root.registerSubModel(new DeploymentOverlayLinkDefinition(DeploymentOverlayPriority.SERVER));
+ contentOverrides.registerSubModel(new DeploymentOverlayDeploymentDefinition(DeploymentOverlayPriority.SERVER));
// The sub-deployments registry
deployments.registerSubModel(PathElement.pathElement(SUBDEPLOYMENT), ServerDescriptionProviders.SUBDEPLOYMENT_PROVIDER);
View
5 server/src/main/java/org/jboss/as/server/controller/descriptions/ServerRootDescription.java
@@ -37,7 +37,6 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEFAULT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DUMP_SERVICES;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.EXTENSION;
@@ -208,10 +207,6 @@ public static ModelNode getDescription(final Locale locale) {
root.get(CHILDREN, DEPLOYMENT_OVERLAY, MIN_OCCURS).set(0);
root.get(CHILDREN, DEPLOYMENT_OVERLAY, MODEL_DESCRIPTION);
- root.get(CHILDREN, DEPLOYMENT_OVERLAY_LINK, DESCRIPTION).set(bundle.getString("server.deployment-overlay-link"));
- root.get(CHILDREN, DEPLOYMENT_OVERLAY_LINK, MIN_OCCURS).set(0);
- root.get(CHILDREN, DEPLOYMENT_OVERLAY_LINK, MODEL_DESCRIPTION);
-
root.get(CHILDREN, SUBSYSTEM, DESCRIPTION).set(bundle.getString("server.subsystem"));
root.get(CHILDREN, SUBSYSTEM, MIN_OCCURS).set(0);
root.get(CHILDREN, SUBSYSTEM, MODEL_DESCRIPTION);
View
4 server/src/main/java/org/jboss/as/server/deploymentoverlay/ContentDefinition.java
@@ -22,15 +22,15 @@
.setFlags(AttributeAccess.Flag.RESTART_NONE)
.build();
- private static final AttributeDefinition[] ATTRIBUTES = { CONTENT};
+ private static final AttributeDefinition[] ATTRIBUTES = {CONTENT};
public static AttributeDefinition[] attributes() {
return ATTRIBUTES.clone();
}
public ContentDefinition(final ContentRepository contentRepository, final DeploymentFileRepository remoteRepository) {
super(DeploymentOverlayModel.CONTENT_PATH,
- CommonDescriptions.getResourceDescriptionResolver(ModelDescriptionConstants.CONTENT),
+ CommonDescriptions.getResourceDescriptionResolver(ModelDescriptionConstants.DEPLOYMENT_OVERLAY + "." + ModelDescriptionConstants.CONTENT, false),
new ContentAdd(contentRepository, remoteRepository),
ContentRemove.INSTANCE);
}
View
22 server/src/main/java/org/jboss/as/server/deploymentoverlay/DeploymentOverlayAdd.java
@@ -7,13 +7,17 @@
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.controller.PathAddress;
+import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ServiceVerificationHandler;
+import org.jboss.as.controller.registry.Resource;
import org.jboss.as.server.deploymentoverlay.service.DeploymentOverlayService;
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
/**
@@ -24,8 +28,20 @@
public static final DeploymentOverlayAdd INSTANCE = new DeploymentOverlayAdd();
@Override
+ public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
+
+ //check that if this is a server group level op the referenced deployment overlay exists
+ final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
+ if (address.size() > 1) {
+ final String name = address.getLastElement().getValue();
+ final Resource deploymentOverlayResource = context.readResourceFromRoot(PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT_OVERLAY, name)));
+ }
+ super.execute(context, operation);
+ }
+
+ @Override
protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException {
- for(AttributeDefinition attr : DeploymentOverlayDefinition.attributes()) {
+ for (AttributeDefinition attr : DeploymentOverlayDefinition.attributes()) {
attr.validateAndSet(operation, model);
}
}
@@ -41,11 +57,11 @@ void installServices(final OperationContext context, final ServiceVerificationHa
final DeploymentOverlayService service = new DeploymentOverlayService(name);
final ServiceName serviceName = DeploymentOverlayService.SERVICE_NAME.append(name);
ServiceBuilder<DeploymentOverlayService> builder = context.getServiceTarget().addService(serviceName, service);
- if(verificationHandler != null) {
+ if (verificationHandler != null) {
builder.addListener(verificationHandler);
}
final ServiceController<DeploymentOverlayService> controller = builder.install();
- if(newControllers != null) {
+ if (newControllers != null) {
newControllers.add(controller);
}
}
View
2 server/src/main/java/org/jboss/as/server/deploymentoverlay/DeploymentOverlayDefinition.java
@@ -21,7 +21,7 @@
private DeploymentOverlayDefinition() {
super(DeploymentOverlayModel.DEPLOYMENT_OVERRIDE_PATH,
- CommonDescriptions.getResourceDescriptionResolver(ModelDescriptionConstants.DEPLOYMENT_OVERLAY),
+ CommonDescriptions.getResourceDescriptionResolver(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, false),
DeploymentOverlayAdd.INSTANCE,
DeploymentOverlayRemove.INSTANCE);
}
View
17 ...mentoverlay/DeploymentOverlayLinkAdd.java → ...erlay/DeploymentOverlayDeploymentAdd.java
@@ -22,17 +22,17 @@
/**
* @author Stuart Douglas
*/
-public class DeploymentOverlayLinkAdd extends AbstractAddStepHandler {
+public class DeploymentOverlayDeploymentAdd extends AbstractAddStepHandler {
private final DeploymentOverlayPriority priority;
- public DeploymentOverlayLinkAdd(final DeploymentOverlayPriority priority) {
+ public DeploymentOverlayDeploymentAdd(final DeploymentOverlayPriority priority) {
this.priority = priority;
}
@Override
protected void populateModel(final ModelNode operation, final ModelNode model) throws OperationFailedException {
- for(AttributeDefinition attr : DeploymentOverlayLinkDefinition.attributes()) {
+ for(AttributeDefinition attr : DeploymentOverlayDeploymentDefinition.attributes()) {
attr.validateAndSet(operation, model);
}
}
@@ -41,14 +41,13 @@ protected void populateModel(final ModelNode operation, final ModelNode model) t
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
final String name = address.getLastElement().getValue();
- final String deployment = DeploymentOverlayLinkDefinition.DEPLOYMENT.resolveModelAttribute(context, model).asString();
- final String deploymentOverlay = DeploymentOverlayLinkDefinition.DEPLOYMENT_OVERLAY.resolveModelAttribute(context, model).asString();
- final Boolean regularExpression = DeploymentOverlayLinkDefinition.REGULAR_EXPRESSION.resolveModelAttribute(context, model).asBoolean();
- installServices(context, verificationHandler, newControllers, name, deployment, deploymentOverlay, regularExpression, priority);
+ final String deploymentOverlay =address.getElement(address.size() - 2).getValue();
+ final Boolean regularExpression = DeploymentOverlayDeploymentDefinition.REGULAR_EXPRESSION.resolveModelAttribute(context, model).asBoolean();
+ installServices(context, verificationHandler, newControllers, name, deploymentOverlay, regularExpression, priority);
}
- static void installServices(final OperationContext context, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers, final String name, final String deployment, final String deploymentOverlay, final boolean regularExpression, final DeploymentOverlayPriority priority) {
- final DeploymentOverlayLinkService service = new DeploymentOverlayLinkService(deployment, regularExpression, priority);
+ static void installServices(final OperationContext context, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers, final String name, final String deploymentOverlay, final boolean regularExpression, final DeploymentOverlayPriority priority) {
+ final DeploymentOverlayLinkService service = new DeploymentOverlayLinkService(name, regularExpression, priority);
final ServiceName serviceName = DeploymentOverlayLinkService.SERVICE_NAME.append(name);
ServiceBuilder<DeploymentOverlayLinkService> builder = context.getServiceTarget().addService(serviceName, service)
View
25 ...rlay/DeploymentOverlayLinkDefinition.java → ...eploymentOverlayDeploymentDefinition.java
@@ -16,13 +16,7 @@
* Links a deployment overlay to a deployment
* @author Stuart Douglas
*/
-public class DeploymentOverlayLinkDefinition extends SimpleResourceDefinition {
-
- static final SimpleAttributeDefinition DEPLOYMENT =
- new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.DEPLOYMENT, ModelType.STRING, false)
- .setAllowExpression(true)
- .setFlags(AttributeAccess.Flag.RESTART_NONE)
- .build();
+public class DeploymentOverlayDeploymentDefinition extends SimpleResourceDefinition {
static final SimpleAttributeDefinition REGULAR_EXPRESSION =
new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.REGULAR_EXPRESSION, ModelType.BOOLEAN, false)
@@ -31,23 +25,18 @@
.setFlags(AttributeAccess.Flag.RESTART_NONE)
.build();
- static final SimpleAttributeDefinition DEPLOYMENT_OVERLAY =
- new SimpleAttributeDefinitionBuilder(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, ModelType.STRING, false)
- .setAllowExpression(true)
- .setFlags(AttributeAccess.Flag.RESTART_NONE)
- .build();
- private static final AttributeDefinition[] ATTRIBUTES = { DEPLOYMENT, DEPLOYMENT_OVERLAY, REGULAR_EXPRESSION };
+ private static final AttributeDefinition[] ATTRIBUTES = { REGULAR_EXPRESSION };
public static AttributeDefinition[] attributes() {
return ATTRIBUTES.clone();
}
- public DeploymentOverlayLinkDefinition(DeploymentOverlayPriority priority) {
- super(DeploymentOverlayModel.DEPLOYMENT_OVERRIDE_LINK_PATH,
- CommonDescriptions.getResourceDescriptionResolver(ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK),
- new DeploymentOverlayLinkAdd(priority),
- new DeploymentOverlayLinkRemove(priority));
+ public DeploymentOverlayDeploymentDefinition(DeploymentOverlayPriority priority) {
+ super(DeploymentOverlayModel.DEPLOYMENT_OVERRIDE_DEPLOYMENT_PATH,
+ CommonDescriptions.getResourceDescriptionResolver(ModelDescriptionConstants.DEPLOYMENT_OVERLAY + "." + ModelDescriptionConstants.DEPLOYMENT),
+ new DeploymentOverlayDeploymentAdd(priority),
+ new DeploymentOverlayDeploymentRemove(priority));
}
@Override
View
11 ...toverlay/DeploymentOverlayLinkRemove.java → ...ay/DeploymentOverlayDeploymentRemove.java
@@ -16,22 +16,21 @@
*
* @author Stuart Douglas
*/
-public class DeploymentOverlayLinkRemove extends AbstractRemoveStepHandler {
+public class DeploymentOverlayDeploymentRemove extends AbstractRemoveStepHandler {
private final DeploymentOverlayPriority priority;
- public DeploymentOverlayLinkRemove(final DeploymentOverlayPriority priority) {
+ public DeploymentOverlayDeploymentRemove(final DeploymentOverlayPriority priority) {
this.priority = priority;
}
@Override
protected void recoverServices(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
final String name = address.getLastElement().getValue();
- final String deployment = DeploymentOverlayLinkDefinition.DEPLOYMENT.resolveModelAttribute(context, model).asString();
- final String deploymentOverlay = DeploymentOverlayLinkDefinition.DEPLOYMENT_OVERLAY.resolveModelAttribute(context, model).asString();
- final Boolean regularExpression = DeploymentOverlayLinkDefinition.REGULAR_EXPRESSION.resolveModelAttribute(context, model).asBoolean();
- DeploymentOverlayLinkAdd.installServices(context, null, null, name, deployment, deploymentOverlay, regularExpression, priority);
+ final String deploymentOverlay = address.getElement(address.size() - 2).getValue();
+ final Boolean regularExpression = DeploymentOverlayDeploymentDefinition.REGULAR_EXPRESSION.resolveModelAttribute(context, model).asBoolean();
+ DeploymentOverlayDeploymentAdd.installServices(context, null, null, name, deploymentOverlay, regularExpression, priority);
}
@Override
View
2 server/src/main/java/org/jboss/as/server/deploymentoverlay/DeploymentOverlayModel.java
@@ -13,7 +13,7 @@
protected static final PathElement CONTENT_PATH = PathElement.pathElement(ModelDescriptionConstants.CONTENT);
protected static final PathElement DEPLOYMENT_OVERRIDE_PATH = PathElement.pathElement(ModelDescriptionConstants.DEPLOYMENT_OVERLAY);
- protected static final PathElement DEPLOYMENT_OVERRIDE_LINK_PATH = PathElement.pathElement(ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK);
+ protected static final PathElement DEPLOYMENT_OVERRIDE_DEPLOYMENT_PATH = PathElement.pathElement(ModelDescriptionConstants.DEPLOYMENT);
static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String keyPrefix) {
return new StandardResourceDescriptionResolver(keyPrefix, RESOURCE_NAME, DeploymentOverlayModel.class.getClassLoader(), true, false);
View
129 server/src/main/java/org/jboss/as/server/parsing/CommonXml.java
@@ -69,10 +69,9 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.BOOT_TIME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CLIENT_MAPPINGS;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CONTENT;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESTINATION_ADDRESS;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESTINATION_PORT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ENABLED;
@@ -85,13 +84,12 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.PATH;
+import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REGULAR_EXPRESSION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELATIVE_TO;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REMOTE_DESTINATION_OUTBOUND_SOCKET_BINDING;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RUNTIME_NAME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SCHEMA_LOCATIONS;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SOCKET_BINDING;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SOCKET_BINDING_GROUP;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SOCKET_BINDING_PORT_OFFSET;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SOURCE_NETWORK;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SYSTEM_PROPERTY;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE;
@@ -1055,7 +1053,7 @@ protected void parseDeployments(final XMLExtendedStreamReader reader, final Mode
}
- protected void parseDeploymentOverlays(final XMLExtendedStreamReader reader, final Namespace namespace, final List<ModelNode> list) throws XMLStreamException {
+ protected void parseDeploymentOverlays(final XMLExtendedStreamReader reader, final Namespace namespace, final ModelNode baseAddress, final List<ModelNode> list) throws XMLStreamException {
requireNoAttributes(reader);
while (reader.nextTag() != END_ELEMENT) {
@@ -1064,15 +1062,15 @@ protected void parseDeploymentOverlays(final XMLExtendedStreamReader reader, fin
switch (element) {
case DEPLOYMENT_OVERLAY:
- parseDeploymentOverlay(reader, list);
+ parseDeploymentOverlay(reader, baseAddress, list);
break;
default:
throw unexpectedElement(reader);
}
}
}
- protected void parseDeploymentOverlay(final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
+ protected void parseDeploymentOverlay(final XMLExtendedStreamReader reader, final ModelNode baseAddress, final List<ModelNode> list) throws XMLStreamException {
final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME);
String name = null;
@@ -1096,109 +1094,92 @@ protected void parseDeploymentOverlay(final XMLExtendedStreamReader reader, fina
if (required.size() > 0) {
throw missingRequired(reader, required);
}
+ ModelNode addr = baseAddress.clone();
+ addr.add(DEPLOYMENT_OVERLAY, name);
final ModelNode op = new ModelNode();
op.get(OP).set(ADD);
- op.get(OP_ADDR).set(DEPLOYMENT_OVERLAY, name);
+ op.get(OP_ADDR).set(addr);
list.add(op);
while (reader.nextTag() != END_ELEMENT) {
final Element element = Element.forName(reader.getLocalName());
switch (element) {
case CONTENT:
- parseContentOverride(name, reader, list);
+ parseContentOverride(name, reader, baseAddress, list);
break;
- default:
- throw unexpectedElement(reader);
- }
- }
- }
-
- protected void parseDeploymentOverlayLinks(final XMLExtendedStreamReader reader, final Namespace namespace, final ModelNode address, final List<ModelNode> list) throws XMLStreamException {
- requireNoAttributes(reader);
-
- while (reader.nextTag() != END_ELEMENT) {
- requireNamespace(reader, namespace);
- final Element element = Element.forName(reader.getLocalName());
-
- switch (element) {
- case DEPLOYMENT_OVERLAY_LINK:
- parseDeploymentOverlayLink(reader, address, list);
+ case DEPLOYMENT:
+ parseDeploymentOverlayDeployment(name, reader, baseAddress, list);
break;
default:
throw unexpectedElement(reader);
}
}
}
- protected void parseDeploymentOverlayLink(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException {
+ protected void parseContentOverride(final String name, final XMLExtendedStreamReader reader, final ModelNode baseAddress, final List<ModelNode> list) throws XMLStreamException {
- final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME, Attribute.DEPLOYMENT, Attribute.DEPLOYMENT_OVERLAY);
- String name = null;
- String deployment = null;
- String deploymentOverlay = null;
+ final EnumSet<Attribute> required = EnumSet.of(Attribute.PATH, Attribute.CONTENT);
+ String path = null;
+ byte[] content = null;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch (attribute) {
- case NAME: {
- name = value;
- break;
- }
- case DEPLOYMENT: {
- deployment = value;
+ case PATH: {
+ path = value;
break;
}
- case DEPLOYMENT_OVERLAY: {
- deploymentOverlay = value;
+ case CONTENT: {
+ content = HashUtil.hexStringToByteArray(value);
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
+ requireNoContent(reader);
if (required.size() > 0) {
throw missingRequired(reader, required);
}
- requireNoContent(reader);
-
- final ModelNode addr = address.clone();
- addr.add(DEPLOYMENT_OVERLAY_LINK, name);
+ final ModelNode address = baseAddress.clone();
+ address.add(DEPLOYMENT_OVERLAY, name);
+ address.add(CONTENT, path);
final ModelNode op = new ModelNode();
op.get(OP).set(ADD);
- op.get(OP_ADDR).set(addr);
- op.get(DEPLOYMENT).set(deployment);
- op.get(DEPLOYMENT_OVERLAY).set(deploymentOverlay);
+ op.get(OP_ADDR).set(address);
+ op.get(CONTENT).set(content);
list.add(op);
}
- protected void parseContentOverride(final String name, final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
- final EnumSet<Attribute> required = EnumSet.of(Attribute.PATH, Attribute.CONTENT);
- String path = null;
- byte[] content = null;
+ protected void parseDeploymentOverlayDeployment(final String name, final XMLExtendedStreamReader reader, final ModelNode baseAddress, final List<ModelNode> list) throws XMLStreamException {
+
+ final EnumSet<Attribute> required = EnumSet.of(Attribute.NAME);
+ String depName = null;
+ boolean regEx = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch (attribute) {
- case PATH: {
- path = value;
+ case NAME: {
+ depName = value;
break;
}
- case CONTENT: {
- content = HashUtil.hexStringToByteArray(value);
+ case REGULAR_EXPRESSION: {
+ regEx = Boolean.parseBoolean(value);
break;
}
default:
@@ -1212,14 +1193,14 @@ protected void parseContentOverride(final String name, final XMLExtendedStreamRe
throw missingRequired(reader, required);
}
- final ModelNode address = new ModelNode();
+ final ModelNode address = baseAddress.clone();
address.add(DEPLOYMENT_OVERLAY, name);
- address.add(CONTENT, path);
+ address.add(DEPLOYMENT, depName);
final ModelNode op = new ModelNode();
op.get(OP).set(ADD);
op.get(OP_ADDR).set(address);
- op.get(CONTENT).set(content);
+ op.get(REGULAR_EXPRESSION).set(regEx);
list.add(op);
}
@@ -1620,32 +1601,28 @@ protected void writeDeploymentOverlays(final XMLExtendedStreamWriter writer, fin
}
}
+ if (contentItem.hasDefined(DEPLOYMENT)) {
+ final ModelNode deployments = contentItem.get(DEPLOYMENT);
+ Set<String> deploymentNames = deployments.keys();
+ if (deploymentNames.size() > 0) {
+ for (String deploymentName : deploymentNames) {
+ final ModelNode depNode = deployments.get(uniqueName);
+ final boolean regEx = depNode.hasDefined(REGULAR_EXPRESSION) ? depNode.get(REGULAR_EXPRESSION).asBoolean() : false;
+ writer.writeStartElement(Element.DEPLOYMENT.getLocalName());
+ writeAttribute(writer, Attribute.NAME, deploymentName);
+ if (regEx) {
+ writeAttribute(writer, Attribute.REGULAR_EXPRESSION, "true");
+ }
+ writer.writeEndElement();
+ }
+ }
+ }
writer.writeEndElement();
}
writer.writeEndElement();
writeNewLine(writer);
}
}
- protected void writeDeploymentOverlayLinks(final XMLExtendedStreamWriter writer, final ModelNode modelNode)
- throws XMLStreamException {
-
- Set<String> names = modelNode.keys();
- if (names.size() > 0) {
- writer.writeStartElement(Element.DEPLOYMENT_OVERLAY_LINKS.getLocalName());
- for (String uniqueName : names) {
- final ModelNode contentItem = modelNode.get(uniqueName);
- final String deployment = contentItem.get(DEPLOYMENT).asString();
- writer.writeStartElement(Element.DEPLOYMENT_OVERLAY_LINK.getLocalName());
- writeAttribute(writer, Attribute.NAME, uniqueName);
- writeAttribute(writer, Attribute.DEPLOYMENT, deployment);
- writeAttribute(writer, Attribute.DEPLOYMENT_OVERLAY, deployment);
-
- writer.writeEndElement();
- }
- writer.writeEndElement();
- writeNewLine(writer);
- }
- }
}
View
11 server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java
@@ -30,7 +30,6 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.CORE_SERVICE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY;
-import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ENABLED;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.EXTENSION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HTTP_INTERFACE;
@@ -358,11 +357,7 @@ private void readServerElement_1_1(final Namespace namespace, final XMLExtendedS
}
if (element == Element.DEPLOYMENT_OVERLAYS) {
- parseDeploymentOverlays(reader, namespace, list);
- element = nextElement(reader, namespace);
- }
- if (element == Element.DEPLOYMENT_OVERLAY_LINKS) {
- parseDeploymentOverlayLinks(reader, namespace, new ModelNode(), list);
+ parseDeploymentOverlays(reader, namespace, new ModelNode(), list);
element = nextElement(reader, namespace);
}
if (element != null) {
@@ -1021,10 +1016,6 @@ public void writeContent(final XMLExtendedStreamWriter writer, final ModelMarsha
writeDeploymentOverlays(writer, modelNode.get(DEPLOYMENT_OVERLAY));
writeNewLine(writer);
}
- if (modelNode.hasDefined(DEPLOYMENT_OVERLAY_LINK)) {
- writeDeploymentOverlayLinks(writer, modelNode.get(DEPLOYMENT_OVERLAY_LINK));
- writeNewLine(writer);
- }
writer.writeEndElement();
writeNewLine(writer);
writer.writeEndDocument();
View
13 .../src/test/java/org/jboss/as/test/integration/domain/suites/DeploymentOverlayTestCase.java
@@ -210,14 +210,21 @@ public void setupDeploymentOverride() throws Exception {
executeOnMaster(op);
//add the non-wildcard link to the server group
+ op = new ModelNode();
addr = new ModelNode();
addr.add(ModelDescriptionConstants.SERVER_GROUP, "main-server-group");
- addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK, TEST_OVERLAY);
+ addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_OVERLAY);
+ op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
+ op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
+ executeOnMaster(op);
+
op = new ModelNode();
+ addr = new ModelNode();
+ addr.add(ModelDescriptionConstants.SERVER_GROUP, "main-server-group");
+ addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_OVERLAY);
+ addr.add(ModelDescriptionConstants.DEPLOYMENT, "test.war");
op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
- op.get(ModelDescriptionConstants.DEPLOYMENT).set("test.war");
- op.get(ModelDescriptionConstants.DEPLOYMENT_OVERLAY).set(TEST_OVERLAY);
executeOnMaster(op);
//add the deployment overlay that will be linked to a single server
View
38 ...org/jboss/as/test/integration/deployment/deploymentoverlay/DeploymentOverlayTestCase.java
@@ -63,10 +63,11 @@ public void setup(final ManagementClient managementClient, final String containe
//add the non-wildcard link
op = new ModelNode();
- op.get(ModelDescriptionConstants.OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK, TEST_OVERLAY);
+ addr = new ModelNode();
+ addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_OVERLAY);
+ addr.add(ModelDescriptionConstants.DEPLOYMENT, "test.war");
+ op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
- op.get(ModelDescriptionConstants.DEPLOYMENT).set("test.war");
- op.get(ModelDescriptionConstants.DEPLOYMENT_OVERLAY).set(TEST_OVERLAY);
ManagementOperations.executeOperation(managementClient.getControllerClient(), op);
//add the deployment overlay that will be linked via wildcard
@@ -107,37 +108,31 @@ public void setup(final ManagementClient managementClient, final String containe
//add the wildcard link
op = new ModelNode();
- op.get(ModelDescriptionConstants.OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK, TEST_WILDCARD);
+ addr = new ModelNode();
+ addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_WILDCARD);
+ addr.add(ModelDescriptionConstants.DEPLOYMENT, ".*.war");
+ op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
- op.get(ModelDescriptionConstants.DEPLOYMENT).set(".*.war");
op.get(ModelDescriptionConstants.REGULAR_EXPRESSION).set(true);
- op.get(ModelDescriptionConstants.DEPLOYMENT_OVERLAY).set(TEST_WILDCARD);
ManagementOperations.executeOperation(managementClient.getControllerClient(), op);
}
@Override
public void tearDown(final ManagementClient managementClient, final String containerId) throws Exception {
removeContentItem(managementClient, TEST_OVERLAY, "WEB-INF/web.xml");
+ removeDeploymentItem(managementClient, TEST_OVERLAY, "test.war");
ModelNode op = new ModelNode();
- op.get(ModelDescriptionConstants.OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK, TEST_OVERLAY);
- op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.REMOVE);
- ManagementOperations.executeOperation(managementClient.getControllerClient(), op);
-
- op = new ModelNode();
op.get(ModelDescriptionConstants.OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_OVERLAY);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.REMOVE);
ManagementOperations.executeOperation(managementClient.getControllerClient(), op);
+ removeDeploymentItem(managementClient, TEST_WILDCARD, ".*.war");
removeContentItem(managementClient, TEST_WILDCARD, "WEB-INF/web.xml");
removeContentItem(managementClient, TEST_WILDCARD, "WEB-INF/classes/wildcard-new-file");
- op = new ModelNode();
- op.get(ModelDescriptionConstants.OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT_OVERLAY_LINK, TEST_WILDCARD);
- op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.REMOVE);
- ManagementOperations.executeOperation(managementClient.getControllerClient(), op);
op = new ModelNode();
op.get(ModelDescriptionConstants.OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_WILDCARD);
@@ -157,6 +152,19 @@ private void removeContentItem(final ManagementClient managementClient, final St
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.REMOVE);
ManagementOperations.executeOperation(managementClient.getControllerClient(), op);
}
+
+
+ private void removeDeploymentItem(final ManagementClient managementClient, final String w, final String a) throws IOException, MgmtOperationException {
+ final ModelNode op;
+ final ModelNode addr;
+ op = new ModelNode();
+ addr = new ModelNode();
+ addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, w);
+ addr.add(ModelDescriptionConstants.DEPLOYMENT, a);
+ op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
+ op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.REMOVE);
+ ManagementOperations.executeOperation(managementClient.getControllerClient(), op);
+ }
}
@Deployment

0 comments on commit 9635f9a

Please sign in to comment.