On 10/13/2014 4:20 PM, Stuart Douglas wrote:
Can you elaborate on why you need this?
In your previous thread you mentioned user provided content and I
suggested that they could use overlays, however this would require the
user to install the overlays rather than the subystem.
Looking at your example it looks like you are adding
keycloak-server.json as an overlay, and I can't help but wonder why?
I would guess that you are doing this to allow a deployment to read a
file that is external to the deployment to be read from the class
loader? If that is the case then I think there are better ways you can
approach this (e.g. adding a resource loader to the module that can
access this file).
The file will usually be a jar containing a service.
Can you elaborate on adding a resource loader to the module?
Stuart
Brian Stansberry wrote:
> There's no way now to make sure it runs after.
>
> But the fact it assumes that overlay is present in the first place
> sounds fishy. How do you know it exists?
>
> On 10/13/14, 1:30 PM, Stan Silvert wrote:
>> I have an AddStepHandler that adds a keycloak server to the management
>> model using the "Mixed Approach"[1]. It also needs to add overlay
>> content if any new content is available. The overlay itself already
>> exists in standalone.xml.
>> <deployment-overlays>
>> <deployment-overlay
>> name="main-auth-server.war-keycloak-overlay">
>> <deployment name="main-auth-server.war"/>
>> </deployment-overlay>
>> </deployment-overlays>
>>
>> I insert this operation in my AddStepHandler:
>> {
>> "operation" => "add",
>> "address" => [
>> ("deployment-overlay" =>
>> "main-auth-server.war-keycloak-overlay"),
>> ("content" =>
>> "/WEB-INF/classes/META-INF/keycloak-server.json")
>> ],
>> "content" => {"url" =>
"file:/mydir/keycloak-server.json"},
>> "rollback-on-runtime-failure" => false
>> }
>>
>> But at this point in server startup, the overlay's add handler hasn't
>> bee called. So I get
>> 14:09:20,729 ERROR [org.jboss.as.controller.management-operation]
>> (ServerService Thread Pool -- 26) JBAS014613: Operation ("add")
>> failed -
>> address: ([
>> ("deployment-overlay" =>
>> "main-auth-server.war-keycloak-overlay"),
>> ("content" =>
"/WEB-INF/classes/META-INF/keycloak-server.json")
>> ]) - failure description: "JBAS014766: Resource
>> [(\"deployment-overlay\"
>> => \"main-auth-server.war-keycloak-overlay\")] does not exist; a
>> resource at address [
>> (\"deployment-overlay\" =>
>> \"main-auth-server.war-keycloak-overlay\"),
>> (\"content\" =>
>> \"/WEB-INF/classes/META-INF/keycloak-server.json\")
>> ] cannot be created until all ancestor resources have been added"
>>
>> At startup, how can I make sure that my "add overlay content"
operation
>> is executed after "add overlay" is done?
>>
>> [1]
https://developer.jboss.org/wiki/ExtendingAS7
>
>