The following example shows how to configure the network adapter
through the API. For details on programming the individual
services, see
Network component services.
IlpNetworkAdapter adapter = network.getAdapter();
// Filter
IlpFilter myFilter = new MyFilter();
// (it is the same as network.setFilter(myFilter);)
adapter.setFilter(myFilter);
// Origin
List myOrigins = new ArrayList();
myOrigins.add(objectID_1);
myOrigins.add(objectID_2);
:
:
myOrigins.add(objectID_n);
// in this case we want to display the origins
boolean showOrigin = true;
adapter.setOrigins(myOrigins, showOrigin);
// Expansion Strategy Factory
// Usually the expansion strategy factory relies
// on the adapter to access the data source and
// to load/release objects
IlpExpansionStrategyFactory myExpFactory = new
MyExpansionStrategyFactory(adapter);
adapter.setExpansionStrategyFactory(myExpFactory);
// Position Attribute
// Here, imagine that MyObject implements IlpObject
// interface and defines "Placement" as the
// IlpAttribute that defines the object position
IlpClass myObjectClass = MyObject.getIlpClass();
IlpAttribute myPosAttrib = MyObject.Placement;
adapter.setPositionAttribute(myObjectClass, myPosAttrib);
// Node and Link Factory
IlpNetworkNodeFactory myNodeFactory = new MyNodeFactory();
adapter.setNodeFactory(myNodeFactory);
IlpNetworkLinkFactory myLinkFactory = new MyLinkFactory();
adapter.setLinkFactory(myLinkFactory);