Skip to main content
summaryrefslogtreecommitdiffstats
blob: 0dcc266e23c7a1b365664f687e9cd47b0d4f70a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * 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
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/

package org.eclipse.osee.ats.internal;

import org.eclipse.osee.ats.config.AtsCacheManager;
import org.eclipse.osee.ats.util.AtsNotifyUsers;
import org.eclipse.osee.ats.util.AtsPreSaveCacheRemoteEventHandler;
import org.eclipse.osee.framework.core.services.CmAccessControl;
import org.eclipse.osee.framework.core.util.OsgiUtil;
import org.eclipse.osee.framework.core.util.ServiceDependencyTracker;
import org.eclipse.osee.framework.plugin.core.IActionReportingService;
import org.eclipse.osee.framework.ui.skynet.cm.IOseeCmService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

/**
 * The main plugin class to be used in the desktop.
 * 
 * @author Donald G. Dunne
 */
public class AtsPlugin implements BundleActivator {
   public static final String PLUGIN_ID = "org.eclipse.osee.ats";

   private static AtsPlugin pluginInstance = new AtsPlugin();
   private ServiceRegistration service1;
   private ServiceRegistration service2;
   private ServiceDependencyTracker tracker;
   private AtsCmAccessControlRegHandler cmAccessHandler;

   public AtsPlugin() {
      super();
      AtsPreSaveCacheRemoteEventHandler.start();
      AtsCacheManager.start();
      AtsNotifyUsers.start();
   }

   @Override
   public void start(BundleContext context) throws Exception {
      service1 =
         context.registerService(IActionReportingService.class.getName(), new AtsActionReportingServiceImpl(), null);
      service2 = context.registerService(IOseeCmService.class.getName(), new OseeAtsServiceImpl(), null);

      // TODO Uncomment to re-enable ATS CM Access providing
      //      if (OseeInfo.isEnabled("atsAccessEnabled")) {
      cmAccessHandler = new AtsCmAccessControlRegHandler();
      //         tracker = new ServiceDependencyTracker(context, cmAccessHandler);
      //         tracker.open();
      //      }
   }

   @Override
   public void stop(BundleContext context) throws Exception {
      OsgiUtil.close(tracker);
      OsgiUtil.close(service1);
      OsgiUtil.close(service2);
   }

   public static AtsPlugin getInstance() {
      return pluginInstance;
   }

   public CmAccessControl getCmService() {
      return cmAccessHandler.getCmService();
   }

}

Back to the top