#    Copyright 2013 Red Hat, Inc. and/or its affiliates.
#
#    This file is part of jcliff.
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

name=infinispan
getContents=/subsystem=infinispan:read-resource(recursive=true)
client.preprocess.strip=/infinispan

prefix.modify=modify:/
modify.rule.1=/subsystem=infinispan${cmdpath(${path(..)})}:write-attribute(name=${name(.)},value=${value(.)})

prefix.remove=remove:/
remove.rule.1=/subsystem=infinispan${cmdpath(${path(.)})}:remove
remove.refresh=true

prefix.undefine=undefine:/
undefine.rule.1=/subsystem=infinispan${cmdpath(${path(..)})}:undefine-attribute(name=${name(.)})
undefine.refresh=true


match.addCacheContainer=add:/cache-container/*
addCacheContainer.precedence=10
addCacheContainer.rule=/subsystem=infinispan/cache-container=${name(.)}:add
addCacheContainer.refresh=true

match.listAddAlias=listAdd:/cache-container/*/aliases/*
match.addAlias=add:/cache-container/*/aliases/*

match.addDistributedCache=add:/cache-container/*/distributed-cache/*
addDistributedCache.precedence=40
addDistributedCache.rule=/subsystem=infinispan/cache-container=${name(../..)}/distributed-cache=${name(.)}:add(mode=${value(mode)})
addDistributedCache.refresh=true

match.addDefaultCache/cache-container/*/default-cache/*
addDefaultCache.precedence=80
addDefaultCache.rule=/subsystem=infinispan/cache-container=${name(..)}/default-cache=${name(.)}:add
addDefaultCache.refresh=true

match.addJndiName/cache-container/*/jndi-name/*
addJndiName.precedence=85
addJndiName.rule=/subsystem=infinispan/cache-container=${name(..)}/jndi-name=${name(.)}:add
addJndiName.refresh=true

match.addLocalCache=add:/cache-container/*/local-cache/*
addLocalCache.precedence=41
addLocalCache.rule=/subsystem=infinispan/cache-container=${name(../..)}/local-cache=${name(.)}:add
addLocalCache.refresh=true

match.addTransport=add:/cache-container/*/transport/*
addTransport.precedence=42
addTransport.rule=/subsystem=infinispan/cache-container=${name(../..)}/transport=${name(.)}:add
addTransport.refresh=true

match.addDistributedCache=add:/cache-container/*/distributed-cache/*/*
addDistributedCache.precedence=90
addDistributedCache.rule=/subsystem=infinispan/cache-container=${name(../../..)}/distributed-cache=${name(..)}:add(mode=${value(.)})
addDistributedCache.refresh=true

match.addReplicatedCache=add:/cache-container/*/replicated-cache/*/*
addReplicatedCache.precedence=40
addReplicatedCache.rule=/subsystem=infinispan/cache-container=${name(../../..)}/replicated-cache=${name(..)}:add(mode=${value(.)})
addReplicatedCache.refresh=true

match.addRepCacheEviction=add:/cache-container/*/replicated-cache/*/eviction/EVICTION
addRepCacheEviction.precedence=45
addRepCacheEviction.rule=/subsystem=infinispan/cache-container=${name(../../../..)}/replicated-cache=${name(../..)}/eviction=${name(.)}:add
addRepCacheEviction.refresh=true

match.addRepCacheExpiration=add:/cache-container/*/replicated-cache/*/expiration/EXPIRATION
addRepCacheExpiration.precedence=46
addRepCacheExpiration.rule=/subsystem=infinispan/cache-container=${name(../../../..)}/replicated-cache=${name(../..)}/expiration=${name(.)}:add
addRepCacheExpiration.refresh=true

match.addExpiration=add:/cache-container/*/local-cache/*/expiration/*
addExpiration.precedence=46
addExpiration.rule=/subsystem=infinispan/cache-container=${name(../../../..)}/local-cache=${name(../..)}/expiration=${name(.)}:add
addExpiration.refresh=true

match.addLocCacheEviction=add:/cache-container/*/local-cache/*/eviction/*
addLocCacheEviction.precedence=46
addLocCacheEviction.rule=/subsystem=infinispan/cache-container=${name(../../../..)}/local-cache=${name(../..)}/eviction=${name(.)}:add
addLocCacheEviction.refresh=true

match.addTransaction=add:/cache-container/*/local-cache/*/transaction/*
addTransaction.precedence=46
addTransaction.rule=/subsystem=infinispan/cache-container=${name(../../../..)}/local-cache=${name(../..)}/transaction=${name(.)}:add
addTransaction.refresh=true

match.addFileStore=add:/cache-container/*/local-cache/*/file-store/*
addFileStore.precedence=80
addFileStore.rule=/subsystem=infinispan/cache-container=${name(../../../..)}/local-cache=${name(../..)}/file-store=${name(.)}:add
addFileStore.refresh=true

match.addReplicatedCacheStore=add:/cache-container/*/replicated-cache/*/file-store/*
addReplicatedCacheStore.precedence=80
addReplicatedCacheStore.rule=/subsystem=infinispan/cache-container=${name(../../../..)}/replicated-cache=${name(../..)}/file-store=${name(.)}:add
addReplicatedCacheStore.refresh=true

match.addRepCacheLocking=add:/cache-container/*/replicated-cache/*/locking/*
addRepCacheLocking.precedence=46
addRepCacheLocking.rule=/subsystem=infinispan/cache-container=${name(../../../..)}/replicated-cache=${name(../..)}/locking=${name(.)}:add
addRepCacheLocking.refresh=true

