This repository has been archived by the owner on Oct 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathActivator.java
48 lines (41 loc) · 1.97 KB
/
Activator.java
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
/*******************************************************************************
* Copyright (c) 2016,2019 iSencia Belgium NV.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Erwin De Ley - initial API and implementation and/or initial documentation
*******************************************************************************/
package org.eclipse.triquetrum.workflow.actor.plot.activator;
import org.eclipse.triquetrum.workflow.actor.plot.XYPlotActor;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.Version;
import org.ptolemy.classloading.ModelElementClassProvider;
import org.ptolemy.classloading.osgi.DefaultModelElementClassProvider;
import org.ptolemy.commons.ThreeDigitVersionSpecification;
import org.ptolemy.commons.VersionSpecification;
public class Activator implements BundleActivator {
@Override
public void start(BundleContext context) throws Exception {
// FIXME figure out a more compact way to create a version-aware provider,
// that uses the bundle version but is not too dependent on OSGi APIs itself.
Version bundleVersion = context.getBundle().getVersion();
VersionSpecification providerVersion = new ThreeDigitVersionSpecification(bundleVersion.getMajor(), bundleVersion.getMinor(), bundleVersion.getMicro(),
bundleVersion.getQualifier());
_apSvcReg = context.registerService(ModelElementClassProvider.class.getName(), new DefaultModelElementClassProvider(providerVersion, XYPlotActor.class),
null);
}
@Override
public void stop(BundleContext context) throws Exception {
_apSvcReg.unregister();
}
// private stuff
/** The svc registration for the actor provider */
private ServiceRegistration<?> _apSvcReg;
}