skip to main content
TGO > Programmers documentation > Business objects and data sources > Links > Link sets
 
Link sets
Link set class
Link sets are predefined business objects of the class IltLinkSet used to represent a collection of links between network resources, laid out in a specific order and with a specific distance.
Link sets let you group together links between two nodes, so that the graph layout cannot insert a link that is not in the link set between them or have them follow different paths. You can fix the order of the links in the set and specify the distance that separates two links.
Link sets
NOTE Link sets can be nested. In other words, they can include other link sets, which in turn can group a set of links.
The IltLinkSet class does not declare any specific attribute.
You can retrieve the class IltLinkSet using its GetIlpClass method. You can handle its instances as simple IlpObject instances and set and get its attributes with the generic methods getAttributeValue and setAttributeValue.
Loading a link set defined in XML
This section shows how to load a link set from an XML file in a data source. For detailed information about data sources, see Data sources.
All you have to do is create a data source using the data source default implementation defined by IltDefaultDataSource and pass the XML file to the parse method of the data source, as shown below:
 
dataSource = new IltDefaultDataSource();
dataSource.parse("LinkSetXMLFile.xml");
How to define a link set in XML
The following is an example of a link set defined in XML format. For details about the XML elements used in this example, see Elements in an XML data file .
 
<addObject id="Link1">
  <class>ilog.tgo.model.IltLink</class>
  <link> <from>Paris</from> <to>Berlin</to> </link>
  <attribute name="name">1</attribute>
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSONETObjectState">
    <state>
      Active
    </state>
  </attribute>
</addObject>
 
<addObject id="Link2">
  <class>ilog.tgo.model.IltLink</class>
  <link> <from>Paris</from> <to>Berlin</to> </link>
  <attribute name="name">2</attribute>
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSONETObjectState">
    <state>
      Active
    </state>
  </attribute>
</addObject>
 
<addObject id="linkSet12">
  <class>ilog.tgo.model.IltLinkSet</class>
  <link>
    <from>Paris</from>
    <to>Berlin</to>
  </link>
  <children>
    <child>Link1</child>
    <child>Link2</child>
  </children>
</addObject>
The figure below shows the link set displayed in a network component:
Link set displayed in a network component
Creating a link set with the API
This section shows how to create a link set through the API and how to add it to a data source.
How to create a link set with the API
 
IltNetworkElement paris = new IltNetworkElement("Paris",
         IltNetworkElement.Type.NE, null);
paris.setFunction(IltNetworkElement.Function.SwitchCrossConnect);
paris.setPosition(new IlpPoint(120, 350));
 
IltNetworkElement berlin = new IltNetworkElement("Berlin",
         IltNetworkElement.Type.NE, null);
berlin.setFunction(IltNetworkElement.Function.TransportCrossConnect);
berlin.setFamily(IltNetworkElement.Family.OC12);
berlin.setPosition(new IlpPoint(250, 350));
 
IltLink link1 = new IltLink(new IltSONETObjectState(IltSONET.State.Active),
         "1", null);
IltLink link2 = new IltLink(new IltSONETObjectState(IltSONET.State.Active),
         "2", null);
IltLinkSet linkSet = new IltLinkSet();
List objects = new ArrayList();
objects.add(paris);
objects.add(berlin);
objects.add(link1);
objects.add(link2);
objects.add(linkSet);
dataSource.setLink(link1.getIdentifier(), paris.getIdentifier(),
         berlin.getIdentifier());
dataSource.setLink(link2.getIdentifier(), paris.getIdentifier(),
         berlin.getIdentifier());
dataSource.setLink(linkSet.getIdentifier(), paris.getIdentifier(),
         berlin.getIdentifier());
dataSource.setParent(link1.getIdentifier(), linkSet.getIdentifier());
dataSource.setParent(link2.getIdentifier(), linkSet.getIdentifier());
dataSource.addObjects(objects);
The result looks like this:
Link set displayed in a network component

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.