Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 66293 Details for
Bug 167036
MAX: Use metadata
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Initial code changes
defect_167036.patch (text/plain), 3.09 KB, created by
Hariharan L Narayanan
on 2007-05-08 10:35:41 EDT
(
hide
)
Description:
Initial code changes
Filename:
MIME Type:
Creator:
Hariharan L Narayanan
Created:
2007-05-08 10:35:41 EDT
Size:
3.09 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.monitoring.managedagent.wsdm >Index: src/org/eclipse/tptp/monitoring/managedagent/wsdm/provisional/agents/WSDMAgent.java >=================================================================== >RCS file: /cvsroot/ganges/org.eclipse.tptp.monitoring.managedagent.wsdm/src/org/eclipse/tptp/monitoring/managedagent/wsdm/provisional/agents/WSDMAgent.java,v >retrieving revision 1.11 >diff -u -r1.11 WSDMAgent.java >--- src/org/eclipse/tptp/monitoring/managedagent/wsdm/provisional/agents/WSDMAgent.java 26 Apr 2007 22:49:26 -0000 1.11 >+++ src/org/eclipse/tptp/monitoring/managedagent/wsdm/provisional/agents/WSDMAgent.java 8 May 2007 14:28:14 -0000 >@@ -26,6 +26,9 @@ > import java.util.Hashtable; > import java.util.Map; > >+import javax.xml.namespace.QName; >+ >+import org.apache.muse.tools.inspector.ResourceInspector; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.hyades.internal.execution.local.control.AgentConfiguration; > import org.eclipse.hyades.internal.execution.local.control.AgentConfigurationEntry; >@@ -163,7 +166,9 @@ > protected void setResourceProperty(String propertyName, Object[] values) throws Exception { > try { > getResourceProperty(propertyName); >- _runtime.updateResourceProperty(propertyName, values); >+ String valErr = validateProperty(propertyName, values); >+ if(!(valErr.length() > 0)) >+ _runtime.updateResourceProperty(propertyName, values); > } catch (Exception e) { > //TODO this is a hack, this should really be done more cleanly > _runtime.insertResourceProperty(propertyName, values); >@@ -177,5 +182,50 @@ > protected Object invokeOperation(String methodName, Object[] params) throws Exception { > return _runtime.invokeOperation(methodName, params); > } >+ >+ private String validateProperty(String propName, Object[] values) >+ { >+ if(values == null || values.length == 0) >+ return "Invalid value(s) for the property " + propName; >+ ResourceInspector inspector = new ResourceInspector(); >+ QName qName = getQNameForProperty(propName); >+ if(!inspector.isPropertyMutable(qName)) >+ { >+ return "This property is read-only and cannot be modified"; >+ } >+ else if(!inspector.isPropertyMultiple(qName) && values.length > 1) >+ { >+ return "The property can occur only once at the maximum"; >+ } >+ else if(!inspector.isPropertyAppendable(qName)) >+ { >+ return "This property is not appendable and cannot be modified"; >+ } >+ return ""; >+ } >+ >+ private QName getQNameForProperty(String propName) >+ { >+ QName retQName = new QName("", ""); >+ if(propName == null) >+ return retQName; >+ propName = propName.trim(); >+ if(propName.length() == 0) >+ return retQName; >+ int tnsStartIdx = propName.indexOf('['); >+ int nameStartIdx = propName.indexOf(':'); >+ String tns = ""; >+ String name = ""; >+ if(tnsStartIdx != -1) >+ { >+ tns = propName.substring(tnsStartIdx + 1, propName.length() - 1); >+ } >+ if(nameStartIdx != -1) >+ { >+ name = propName.substring(nameStartIdx + 1, tnsStartIdx).trim(); >+ } >+ retQName = new QName(tns, name); >+ return retQName; >+ } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 167036
: 66293