Introduction
Penrose uses a PartitionManager to manage the life cycle of the partitions. When you instantiate the Penrose object, none of the partitions are loaded initially. You can optionally load the partitions manually. When Penrose is started, it will automatically load all remaining partitions that are still unloaded. If you stop Penrose, the partitions will remain loaded. You can optionally unload the partitions manually. If you restart Penrose, it will only reload the partitions that have been unloaded.
To get the PartitionManager:
Penrose penrose = ... PartitionManager partitionManager = penrose.getPartitionManager();
Loading Partitions
You can load a partition manually as follows. If you load a partition manually, Penrose will not load it again when it's started.
String partitionName = "example"; Partition partition = ... partitionManager.addPartition(partitionName, partition);
Retrieving Partitions
You can retrieve a Partition object after it's been loaded by the PartitionManager.
String partitionName = "example"; Partition partition = partitionManager.getPartition(partitionName);
Unloading Partitions
If you stop Penrose then make some changes to the partition configuration files, you have to unload the partition from the PartitionManager so that the configuration files will be reloaded when you start Penrose again.
String partitionName = "example"; partitionManager.removePartition(partitionName);
To unload all partitions:
partitionManager.clear();
