[jboss-jira] [JBoss JIRA] (AS7-3478) read-operation-description incorrect for distributed-cache
Richard Achmatowicz (JIRA)
jira-events at lists.jboss.org
Sun Jan 29 10:50:48 EST 2012
[ https://issues.jboss.org/browse/AS7-3478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662610#comment-12662610 ]
Richard Achmatowicz commented on AS7-3478:
------------------------------------------
With the current setup, creating separate attribute definitions for these two is a problem.
At the moment, we do not use resources in the Infinispan subsystem, and we store all AttributeDefinitions in an interface called CommonAttributes. In other words, attribute definitions have global scope. The net effect is that it is not easy to set up a situation where two attributes are accessed within the model by different keys (e.g. cache-mode and txn-mode) and yet these attributes use the same parameter name in add or read-attribute commands (i.e. mode). This is the case we have with use of the key "mode" which is used both in cache mode processing as well as transaction mode processing:
{noformat}
<cache mode="ASYNC" .../>
...
<transaction mode="NON_XA" .../>
{noformat}
Previously, we were using one AttributeDefinition for MODE to handle both cases, but we can no longer as cache mode is required and txn mode is not. So we need two definitions. But defining AttributeDefinitions CACHE_MODE and TXN_MODE force the add() command parameter names to change from CacheAdd(mode=,...) to CacheAdd(cache-mode=,...) and similarly when adding a transaction element.
In order to work around this, I created as ShareableNameAttributeDefinition:
{noformat}
ShareableNameAttributeDefinition CACHE_MODE = new ShareableNameAttributeDefinition(ModelKeys.CACHE_MODE, ModelKeys.MODE, ModelType.STRING, false, null, new CacheModeValidator(false));
{noformat}
This allows specifying for an attribute, not only a different xmlName() (to be used when processing XML elements), but also a cliName() ( used when generating attribute and operation parameter descriptions for the add() and read-attribute() write-attribute() commands).
So, we can now define two AttributeDefinitions for CACHE_MODE and TXN_MODE and still allow them to use the key "mode" in their operation descriptions.
When we move to resources, this can go.
> read-operation-description incorrect for distributed-cache
> ----------------------------------------------------------
>
> Key: AS7-3478
> URL: https://issues.jboss.org/browse/AS7-3478
> Project: Application Server 7
> Issue Type: Bug
> Reporter: Stan Silvert
> Assignee: Richard Achmatowicz
>
> {noformat}
> /subsystem=infinispan/cache-container=hibernate/distributed-cache=distributed/:add(batching=false)
> {
> "outcome" => "failed",
> "failure-description" => "JBAS014749: Operation handler failed: No child 'mode' exists",
> "rolled-back" => true,
> "response-headers" => {"process-state" => "reload-required"}
> }
> {noformat}
> read-operation-description doesn't show "mode" as a required field and it doesn't restrict its values with "allowed"
> {noformat}
> /subsystem=infinispan/cache-container=hibernate/distributed-cache=*/:read-operation-description(name=add)
> {
> "outcome" => "success",
> "result" => {
> "operation-name" => "add",
> "description" => "Add a distributed cache to this cache container",
> "request-properties" => {
> ...
> "mode" => {
> "type" => STRING,
> "description" => "Sets the clustered cache mode, ASYNC for asynchronous operation, or SYNC for synchronous operation.",
> "expressions-allowed" => false,
> "required" => false,
> "nillable" => true,
> "min-length" => 1L,
> "max-length" => 2147483647L
> },
> ...
> }
> }
> {noformat}
> It should be:
> {noformat}
> "mode" => {
> "type" => STRING,
> "description" => "Sets the clustered cache mode, ASYNC for asynchronous operation, or SYNC for synchronous operation.",
> "expressions-allowed" => false,
> "required" => true,
> "nillable" => true,
> "min-length" => 1L,
> "max-length" => 2147483647L
> "allowed" => [
> "ASYNC",
> "SYNC"
> ]
> },
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list