[jboss-dev-forums] [Management Development] - How can I programaticlly add "config-property" to a Connecti
rareddy
do-not-reply at jboss.com
Fri Nov 13 20:04:00 EST 2009
I am trying to create a connection factory using a program. I could add all the defined properties that are defined on "DeploymentTemplateInfo" object for that ConnectionFactory. I also wanted to add few "config-property" properties, but the resulting template does not seem to write these properties. Here is the sample code I am using
| public void addConnectionFactory(String deploymentName, Properties properties) throws AdminException{
| try {
|
| DeploymentTemplateInfo info = getView().getTemplate("NoTxConnectionFactoryTemplate");
|
| Map<String, ManagedProperty> propertyMap = info.getProperties();
| for (String key:propertyMap.keySet()) {
| String v = properties.getProperty(key);
| if (v != null) {
| ManagedProperty p = propertyMap.get(key);
| p.setValue(SimpleValueSupport.wrap(v));
| }
| }
|
| DefaultFieldsImpl fields = new DefaultFieldsImpl("my-property");
| fields.setDescription("My Custom Property");
| fields.setMetaType(SimpleMetaType.STRING);
| fields.setValue(SimpleValueSupport.wrap(properties.getProperty("my-property")));
| fields.setField(Fields.READ_ONLY, Boolean.FALSE);
| ManagedPropertyImpl mp = new ManagedPropertyImpl(fields);
|
| info.getProperties().put("config-property", mp);
| getView().applyTemplate(deploymentName, info);
|
| } catch(Exception e) {
| // handle exception
| }
| }
|
surely the above code does not work. Can somebody please tell me how I can insert a "config-property" such that when the "-ds.xml" file is written it is written in there.
Thank you.
Ramesh..
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265644#4265644
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265644
More information about the jboss-dev-forums
mailing list