Ejemplo n.º 1
0
 /**
  * Retrieve the ICamelManagerService with the given service id.
  *
  * @param serviceId
  * @return
  * @throws CamelManagerException
  */
 public static ICamelManagerService getManagerService(String serviceVersion)
     throws CamelManagerException {
   try {
     BundleContext context = CamelModelServiceCoreActivator.getBundleContext();
     CamelManagerServiceProxy proxy = new CamelManagerServiceProxy(context, serviceVersion);
     proxy.open();
     return proxy;
   } catch (InvalidSyntaxException ise) {
     throw new CamelManagerException(ise);
   }
 }
Ejemplo n.º 2
0
 public static String[] getAvailableVersions() throws CamelManagerException {
   try {
     BundleContext context = CamelModelServiceCoreActivator.getBundleContext();
     Collection<ServiceReference<ICamelManagerService>> refs =
         BundleUtils.findServiceReferences(context, ICamelManagerService.class);
     ArrayList<String> ret = new ArrayList<>();
     Iterator<ServiceReference<ICamelManagerService>> it = refs.iterator();
     while (it.hasNext()) {
       ServiceReference<ICamelManagerService> next = it.next();
       String vers = (String) next.getProperty("camel.version");
       if (!ret.contains(vers)) ret.add(vers);
     }
     return ret.toArray(new String[ret.size()]);
   } catch (InvalidSyntaxException ise) {
     throw new CamelManagerException(ise);
   }
 }