X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2FNodeConnector.java;h=85a6c22c568cd97894c420c2850eeb848a6a1b14;hb=c482b318eda18c6649b012c3b42e5004aace8db8;hp=495af7970c7f0597ad50fc1e39863aafd3753fd6;hpb=9ff610f03e7fe11a5c9e40405cf24dd3e3af8a89;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java index 495af7970c..85a6c22c56 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java @@ -28,6 +28,9 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.apache.commons.lang3.tuple.ImmutablePair; +import org.opendaylight.controller.sal.utils.INodeConnectorFactory; +import org.opendaylight.controller.sal.utils.INodeFactory; +import org.opendaylight.controller.sal.utils.ServiceHelper; /** * Describe a generic network element attachment points, @@ -276,7 +279,7 @@ public class NodeConnector implements Serializable { * * @return the NodeConnectorType of this object */ - @XmlAttribute(name = "type") + @XmlElement(name = "type") public String getType() { return this.nodeConnectorType; } @@ -359,7 +362,7 @@ public class NodeConnector implements Serializable { * * @return the NodeConnector ID of this object in String format */ - @XmlAttribute(name = "id") + @XmlElement(name = "id") public String getNodeConnectorIDString() { return this.nodeConnectorID.toString(); } @@ -602,8 +605,13 @@ public class NodeConnector implements Serializable { return null; } } else { - // Lookup via OSGi service registry + //Use INodeConnectorFactory to create a NodeConnector of registered type. + //The protocol plugin being used depends on typeStr. + INodeConnectorFactory f = (INodeConnectorFactory) ServiceHelper + .getGlobalInstance(INodeConnectorFactory.class, new NodeConnector(), "(protocolName="+typeStr+")"); + if(f==null) + return null; + return f.fromStringNoNode(typeStr, IDStr, n); } - return null; } }