-
1. Re: JBoss AS7 Command-line public API --> Write Attribute
jaikiran Apr 18, 2013 5:56 AM (in response to suikast42)Sueleyman Vurucu wrote:
request.get("jndi-name").set("java:jboss/infinispan/hibernate");
That's not the right way. The right way is:
request.get("name").set("jndi-name"); request.get("value").set("java:jboss/infinispan/hibernate");
Of course, you can use the constants for "name" and "value" from the ClientConstants.
-
2. Re: JBoss AS7 Command-line public API --> Write Attribute
suikast42 Apr 18, 2013 5:57 AM (in response to suikast42)So I try the folowing steps,
1. try to add name
request.get("name").set("hibernate");
then I get this exception:
java.lang.RuntimeException: Operation failed: "JBAS014792: Unknown attribute hibernate"
at com.siemag.wan.jbossconfig.JBoss7ServerConfigurator.reportFailure(JBoss7ServerConfigurator.java:195)
at com.siemag.wan.jbossconfig.JBoss7ServerConfigurator.excecute(JBoss7ServerConfigurator.java:145)
at com.siemag.wan.jbossconfig.JBoss7ServerConfigurator.addInfinispanJNDIName(JBoss7ServerConfigurator.java:137)
at com.siemag.wan.jbossconfig.JBoss7ServerConfigurator.main(JBoss7ServerConfigurator.java:43)
2. Try to read attributes wit CLI.
[standalone@localhost:9999 /] /subsystem=infinispan/cache-container=hibernate:read-attribute(name=module)
{
"outcome" => "success",
"result" => "org.jboss.as.jpa.hibernate:4"
}
[standalone@localhost:9999 /] /subsystem=infinispan/cache-container=hibernate:read-attribute(name=name)
{
"outcome" => "failed",
"failure-description" => "JBAS014792: Unknown attribute name",
"rolled-back" => true
}
Why I can't read the name attribute ? Is there a BUG ??
-
3. Re: JBoss AS7 Command-line public API --> Write Attribute
ctomc Apr 18, 2013 6:00 AM (in response to suikast42)1 of 1 people found this helpfulname is not na attribute but part of path
try this commands so you will get few ideas:
/subsystem=infinispan/cache-container=hibernate:read-resource()
/subsystem=infinispan:read-children(type=cache-container)
plus why you need name of cache container if you already have it
cache-container=hibernate would translate into here is cache container with name hibernate.
so in short, no need to read it again
--
tomaz
-
4. Re: JBoss AS7 Command-line public API --> Write Attribute
suikast42 Apr 18, 2013 6:24 AM (in response to jaikiran)jaikiran pai schrieb:
That's not the right way. The right way is:
request.get("name").set("jndi-name"); request.get("value").set("java:jboss/infinispan/hibernate");
Of course, you can use the constants for "name" and "value" from the ClientConstants.
So that's a litte strange but it works . The documentation is a little bit rare. Is there a link that you can suggest ?
-
5. Re: JBoss AS7 Command-line public API --> Write Attribute
suikast42 Apr 18, 2013 6:36 AM (in response to ctomc)Tomaz Cerar schrieb:
plus why you need name of cache container if you already have it
cache-container=hibernate would translate into here is cache container with name hibernate.
so in short, no need to read it again
--
tomaz
For nothing I'll understand the API
-
6. Re: JBoss AS7 Command-line public API --> Write Attribute
jaikiran Apr 18, 2013 6:38 AM (in response to suikast42)Sueleyman Vurucu wrote:
jaikiran pai schrieb:
That's not the right way. The right way is:
request.get("name").set("jndi-name"); request.get("value").set("java:jboss/infinispan/hibernate");
Of course, you can use the constants for "name" and "value" from the ClientConstants.
So that's a litte strange but it works .
It's not strange, really. If you take a look at the CLI version of it:
:write-attribute(name=jndi-name, value=java:jboss/infinispan/hibernate)
You are telling it what the "name" of the attribute is and what the "value" of the attribute is. In other words, you are providing/setting a value for the "name" and a (different) value for the "value".
That's exactly what translates to:
request.get("name").set("jndi-name"); // set a value for the "name" request.get("value").set("java:jboss/infinispan/hibernate"); // set a value for the "value"
-
7. Re: JBoss AS7 Command-line public API --> Write Attribute
suikast42 Apr 18, 2013 7:12 AM (in response to jaikiran)jaikiran pai schrieb:
It's not strange, really. If you take a look at the CLI version of it:
That's depends on how familar you'r with the api .
How can I set List values. I want add a global module for example.
/subsystem=ee/:write-attribute(name=global-modules,value=[{\"name\" => \"my.module.com\",\"slot\" => \"main\"}])");
-
8. Re: JBoss AS7 Command-line public API --> Write Attribute
suikast42 Apr 18, 2013 7:16 AM (in response to suikast42)Ok I think I understand the api little bit more
ModelNode module= new ModelNode();
module.get("name").set("my.module.com");
module.get("slot").set("main");
ModelNode request = new ModelNode();
request.get(ADRESS).add(ClientConstants.SUBSYSTEM, "ee");
request.get("name").set("global-modules");
request.get("value").add(test);
request.get(ClientConstants.OP).set(ClientConstants.WRITE_ATTRIBUTE_OPERATION);
excecute(request);
Does the same job with /subsystem=ee/:write-attribute(name=global-modules,value=[{\"name\" => \"my.module.com\",\"slot\" => \"main\"}])");