code: public static XOManagerFactory createXOManagerFactory(String name) {
          if (OSGiUtil.isXOLoadedAsOSGiBundle()) {
              try {
                  BundleContext bundleContext = FrameworkUtil.getBundle(XOSGi.class).getBundleContext();
                  String filterString = "(name=" + name + ")";
                  Collection<ServiceReference<XOManagerFactory>> xoManagerFactoryServices = bundleContext.getServiceReferences(XOManagerFactory.class,
                          filterString);
                  for (ServiceReference<XOManagerFactory> xoManagerFactoryService : xoManagerFactoryServices) {
                      XOManagerFactory xoManagerFactory = bundleContext.getService(xoManagerFactoryService);
                      if (xoManagerFactory != null) {
                          xoManagerFactory.addCloseListener(new CloseAdapter() {
  
                              @Override
                              public void onAfterClose() {
                                  bundleContext.ungetService(xoManagerFactoryService);
                              }
  
                          });
                          return xoManagerFactory;
                      }
                  }
              } catch (InvalidSyntaxException e) {
                  throw new XOException("Cannot bootstrap XO implementation.", e);
              }
          }
          throw new XOException("Cannot bootstrap XO implementation.");
      }
docs: Create a {@link com.buschmais.xo.api.XOManagerFactory} for the XO unit
  identified by name.
  <p>
  Internally it performs a lookup in the OSGi service registry to retrieve the
  XOManagerFactory service that is bound to the given XO unit name. The bundle
  providing this XO unit must be processed by the OSGi bundle listener.
  </p>
  
  @param name
  The name of the XO unit.
  @return The {@link com.buschmais.xo.api.XOManagerFactory}.
  @see com.buschmais.xo.impl.bootstrap.osgi.XOUnitBundleListener