| package org.eclipse.osbp.abstractstatemachine; |
| |
| import org.eclipse.osbp.ui.api.pos.IPOSService; |
| import org.osgi.service.component.annotations.Component; |
| import org.osgi.service.component.annotations.Reference; |
| import org.osgi.service.component.annotations.ReferenceCardinality; |
| import org.osgi.service.component.annotations.ReferencePolicy; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| @Component |
| public class POSServiceBinder { |
| /** The Constant LOGGER. */ |
| private static final Logger LOGGER = LoggerFactory.getLogger("servicebinder"); |
| |
| public static IPOSService posService; |
| |
| @Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC) |
| public void bindPOSService(IPOSService posService) { |
| LOGGER.debug(POSServiceBinder.class.getCanonicalName()+" bound"); |
| POSServiceBinder.posService = posService; |
| } |
| |
| public void unbindPOSService(IPOSService posService) { |
| LOGGER.debug(POSServiceBinder.class.getCanonicalName() + " unbound"); |
| POSServiceBinder.posService = null; |
| } |
| |
| public static IPOSService getPosService() { |
| return posService; |
| } |
| } |