Extends directory persistance unit
First you need to define your JPA entities and the persistence.xml file in your bundle classpath.
Then you can extends the directory persistence unit with your JPA entities by consuming the directory JPA service and then calling the addSubPersistenceBundle method.
An example :
Extends directory tree menu
You can extends the directory tree menu by consuming the directory tree menu roots registry and adding your own tree menu entities.
Keep in mind you need to define the instance.name of the service you're consuming :
TreeMenuRootsRegistry is a tool defined on portal (and implemented by directory), check (again) the portal doc to know more on how to use it.