org.eclipse.emf.cdo.common.branch

## Interface CDOBranchManager

- All Superinterfaces:
    INotifier
  All Known Subinterfaces:
    InternalCDOBranchManager

      public interface CDOBranchManager
      extends INotifier

  Manages a tree of `branches` and notifies about changes in this branch tree.

  The branch tree is represented by a `main` branch, which, like all `sub` branches, offers the major part of the branching functionality. A branch manager provides additional methods to find branches by their unique integer ID or by their fully qualified path name, as well as asynchronous bulk queries.

  A branch manager can fire the following events:

  - `CDOBranchChangedEvent` after a new branch has been created, renamed or deleted.

  Branch managers are usually associated with the following entities:

  - `org.eclipse.emf.cdo.session.CDOSession`
  - `org.eclipse.emf.cdo.server.IRepository`
  Since:
    3.0
  Author:
    Eike Stepper
  No Implement
    This interface is not intended to be implemented by clients.
  No Extend
    This interface is not intended to be extended by clients.
  Apiviz
  Apiviz
    `CDOBranch` oneway - - mainBranch
  Apiviz
    `CDOBranchChangedEvent` - - fires

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `CDOBranch` | `getBranch(int branchID)` Returns the branch with the given unique integer ID.
    `CDOBranch` | `getBranch(String path)` Returns the branch with the given absolute path.
    `int` | `getBranches(int startID, int endID, CDOBranchHandler handler)` Passes all branches with IDs in the given range to the given `branch handler` and returns the number of handler invocations.
    `CDOBranch` | `getMainBranch()` Returns the main branch of the branch tree managed by this branch manager.
    `CDOCommonRepository` | `getRepository()` Returns the repository this branch manager is associated with.

    - ### Methods inherited from interface org.eclipse.net4j.util.event.INotifier

      `addListener, getListeners, hasListeners, removeListener`

- - ### Method Detail

    - #### getRepository

          CDOCommonRepository getRepository()

      Returns the repository this branch manager is associated with.
      Since:
        4.2

    - #### getMainBranch

          CDOBranch getMainBranch()

      Returns the main branch of the branch tree managed by this branch manager.

      The main branch has the fixed `name` "MAIN" and the fixed `ID` 0 (zero).

    - #### getBranch

          CDOBranch getBranch(int branchID)

      Returns the branch with the given unique integer ID.

      Note that this method never returns `null`. Due to the lazy loading nature of branch managers this method returns a transparent branch proxy if the branch is not already loaded in the internal branch cache. This can result in unchecked exceptions being thrown from calls to arbitrary branch methods if the ID that the proxy was created with does not exist in the branch tree.

    - #### getBranch

          CDOBranch getBranch(String path)

      Returns the branch with the given absolute path.
      Parameters:
        `path` - A concatenation of the names of all branches from the `main branch` to the requested branch, separated by `slashes` ("/" characters). Example: "MAIN/team1/smith".

    - #### getBranches

          int getBranches(int startID,
                          int endID,
                          CDOBranchHandler handler)

      Passes all branches with IDs in the given range to the given `branch handler` and returns the number of handler invocations.

      This is a blocking call.

Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html