import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.opendaylight.controller.sal.utils.HexEncode;
*
* @return The node Type for this Node object
*/
- @XmlAttribute(name = "type")
+ @XmlElement(name = "type")
public String getType() {
return this.nodeType;
}
} else if (typeStr.equals(NodeIDType.PRODUCTION)) {
this.nodeID = IDStr;
} else {
- // We need to lookup via OSGi service registry for an
- // handler for this
+ //Use plugin's method to get appropriate conversion from IDStr to nodeID
+ INodeFactory f = (INodeFactory) ServiceHelper
+ .getGlobalInstance(INodeFactory.class, new Node(), "(protocolName="+typeStr+")");
+ if(f!=null){
+ Node n = f.fromString(typeStr, IDStr);
+ this.nodeID = n.nodeID;
+ }
}
}
*
* @param type of node to be set
*/
+ @SuppressWarnings("unused")
private void setType(String type) {
this.nodeType = type;
if (this.nodeIDString != null) {
*
* @return The nodeID in string format
*/
- @XmlAttribute(name = "id")
+ @XmlElement(name = "id")
public String getNodeIDString() {
if (this.nodeType.equals(NodeIDType.OPENFLOW)) {
return HexEncode.longToHexString((Long) this.nodeID);
*
* @param nodeIDString String representation for NodeID
*/
+ @SuppressWarnings("unused")
private void setNodeIDString(String nodeIDString) {
this.nodeIDString = nodeIDString;
if (this.nodeType != null) {
@Override
public String toString() {
if (this.nodeType.equals(NodeIDType.OPENFLOW)) {
- return this.nodeType.toString() + "|"
+ return this.nodeType + "|"
+ HexEncode.longToHexString((Long) this.nodeID);
} else {
- return this.nodeType.toString() + "|" + this.nodeID.toString();
+ return this.nodeType + "|" + this.nodeID.toString();
}
}
.getGlobalInstance(INodeFactory.class, new Node(), "(protocolName="+typeStr+")");
if(f==null)
return null;
- return f.fromString(IDStr, typeStr);
+ return f.fromString(typeStr, IDStr);
}
}
}