org.osgi.framework.FrameworkUtil Java Examples

The following examples show how to use org.osgi.framework.FrameworkUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EclipseLinkOSGiTransactionController.java    From lb-karaf-examples-jpa with Apache License 2.0 7 votes vote down vote up
@Override
protected TransactionManager acquireTransactionManager() throws Exception {
    Bundle bundle = FrameworkUtil.getBundle(EclipseLinkOSGiTransactionController.class);
    BundleContext ctx = bundle.getBundleContext();

    if (ctx != null) {
        ServiceReference<?> ref = ctx.getServiceReference(TransactionManager.class.getName());

        if (ref != null) {
            TransactionManager manager = (TransactionManager) ctx.getService(ref);
            return manager;
        }
    }

    return super.acquireTransactionManager();
}
 
Example #2
Source File: MailEventHandler.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public MailEventHandler ( final String id, final MailSender sender, final PipeService pipeService, final int retries ) throws Exception
{
    this.bundle = FrameworkUtil.getBundle ( MailHandlerFactory.class );
    this.sender = sender;
    this.retries = retries;

    final String pipeName = "mail." + id;

    try
    {
        this.producer = pipeService.createProducer ( pipeName );
        this.workerHandle = pipeService.createWorker ( pipeName, this.mailWorker );
    }
    catch ( final Exception e )
    {
        if ( this.sender != null )
        {
            this.sender.dispose ();
            this.sender = null;
        }
    }
}
 
Example #3
Source File: ToolbarButton.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create a {@link ToolbarButton} with the given information.
 * 
 * @param buttonName
 *            The unique name of the dynamically created CKEditor button.
 * @param commandName
 *            The unique name of the dynamically created CKEditor command that is called by
 *            pressing this button.
 * @param buttonLabel
 *            The textual part of the button (if visible) and its tooltip.
 * @param toolbar
 *            The toolbar group into which the button will be added. An optional index value
 *            (separated by a comma) determines the button position within the group.
 * @param iconURL
 *            The {@link URL} of the image that should be show as button icon.
 */
public ToolbarButton(String buttonName, String commandName, String buttonLabel, String toolbar, URL iconURL) {
	this.buttonName = buttonName;
	this.commandName = commandName;
	this.buttonLabel = buttonLabel;
	this.toolbar = toolbar;

	// if we are in an OSGi context, we need to convert the bundle URL to a file URL
	Bundle bundle = FrameworkUtil.getBundle(RichTextEditor.class);
	if (bundle != null) {
		try {
			iconURL = FileLocator.toFileURL(iconURL);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	this.iconURL = iconURL;
}
 
Example #4
Source File: HealthRestServiceImpl.java    From peer-os with Apache License 2.0 6 votes vote down vote up
protected BundleStateService getBundleStateService()
{
    // get bundle instance via the OSGi Framework Util class
    BundleContext ctx = FrameworkUtil.getBundle( BundleStateService.class ).getBundleContext();
    if ( ctx != null )
    {
        ServiceReference serviceReference = ctx.getServiceReference( BundleStateService.class.getName() );
        if ( serviceReference != null )
        {
            Object service = ctx.getService( serviceReference );
            if ( BundleStateService.class.isInstance( service ) )
            {
                return BundleStateService.class.cast( service );
            }
        }
    }

    throw new IllegalStateException( "Can not obtain handle of BundleStateService" );
}
 
Example #5
Source File: DotnetExportWizardPage.java    From aCute with Eclipse Public License 2.0 6 votes vote down vote up
protected DotnetExportWizardPage(IFile projectFile) {
	super(DotnetExportWizardPage.class.getName());
	setTitle(Messages.DotnetExportWizardPage_exportProject_title);
	setDescription(Messages.DotnetExportWizardPage_exportProject_message);

	Bundle bundle = FrameworkUtil.getBundle(this.getClass());
	URL url = bundle.getEntry("images/dotnet.png"); //$NON-NLS-1$
	ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url);
	setImageDescriptor(imageDescriptor);

	if (projectFile != null) {
		projectPath = new Path(projectFile.getRawLocation().toString());
	}
	targetFrameworks = ProjectFileAccessor.getTargetFrameworks(projectPath);
	defaultRuntime = DotnetExportAccessor.getDefaultRuntime();
}
 
Example #6
Source File: EnrichedItemDTOMapper.java    From openhab-core with Eclipse Public License 2.0 6 votes vote down vote up
private static @Nullable String considerTransformation(String state, Item item, @Nullable Locale locale) {
    StateDescription stateDescription = item.getStateDescription(locale);
    if (stateDescription != null) {
        String pattern = stateDescription.getPattern();
        if (pattern != null) {
            try {
                return TransformationHelper.transform(
                        FrameworkUtil.getBundle(EnrichedItemDTOMapper.class).getBundleContext(), pattern, state);
            } catch (NoClassDefFoundError ex) {
                // TransformationHelper is optional dependency, so ignore if class not found
                // return state as it is without transformation
            } catch (TransformationException e) {
                LOGGER.warn("Failed transforming the state '{}' on item '{}' with pattern '{}': {}", state,
                        item.getName(), pattern, e.getMessage());
            }
        }
    }
    return state;
}
 
Example #7
Source File: XOSGi.java    From extended-objects with Apache License 2.0 6 votes vote down vote up
/**
 * Create a {@link com.buschmais.xo.api.XOManagerFactory} for the given XO unit.
 * <p>
 * Internally it performs a lookup in the OSGi service registry to retrieve the
 * XOBootstrapService service.
 * </p>
 *
 * @param xoUnit
 *            The XO unit.
 * @return The {@link com.buschmais.xo.api.XOManagerFactory}.
 */
public static XOManagerFactory createXOManagerFactory(XOUnit xoUnit) {
    if (OSGiUtil.isXOLoadedAsOSGiBundle()) {
        BundleContext bundleContext = FrameworkUtil.getBundle(XOSGi.class).getBundleContext();
        ServiceReference<XOBootstrapService> xoBootstrapServiceReference = bundleContext.getServiceReference(XOBootstrapService.class);
        if (xoBootstrapServiceReference == null) {
            throw new XOException("Cannot get XO bootstrap service reference.");
        }
        XOBootstrapService xoBootstrapService = bundleContext.getService(xoBootstrapServiceReference);
        if (xoBootstrapService == null) {
            throw new XOException("Cannot get XO bootstrap service.");
        }
        XOManagerFactory xoManagerFactory = xoBootstrapService.createXOManagerFactory(xoUnit);
        bundleContext.ungetService(xoBootstrapServiceReference);
        return xoManagerFactory;
    }
    throw new XOException("Cannot bootstrap XO implementation.");
}
 
Example #8
Source File: EclipseLinkOSGiTransactionController.java    From lb-karaf-examples-jpa with Apache License 2.0 6 votes vote down vote up
@Override
protected TransactionManager acquireTransactionManager() throws Exception {
    Bundle bundle = FrameworkUtil.getBundle(EclipseLinkOSGiTransactionController.class);
    BundleContext ctx = bundle.getBundleContext();

    if (ctx != null) {
        ServiceReference<?> ref = ctx.getServiceReference(TransactionManager.class.getName());

        if (ref != null) {
            TransactionManager manager = (TransactionManager) ctx.getService(ref);
            return manager;
        }
    }

    return super.acquireTransactionManager();
}
 
Example #9
Source File: TabbedPropertyRegistry.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the configuration elements targeted for the given extension point
 * and the current contributor id. The elements are also sorted by plugin
 * prerequisite order.
 */
protected IConfigurationElement[] getConfigurationElements(
		String extensionPointId) {
	if (contributorId == null) {
		return new IConfigurationElement[0];
	}
	IExtensionPoint point = Platform.getExtensionRegistry()
			.getExtensionPoint(FrameworkUtil.getBundle(TabbedPropertyRegistry.class).getSymbolicName(),
					extensionPointId);
	IConfigurationElement[] extensions = point.getConfigurationElements();
	List<IConfigurationElement> unordered = new ArrayList<>(extensions.length);
	for (IConfigurationElement extension : extensions) {
		if (!extension.getName().equals(extensionPointId)) {
			continue;
		}
		String contributor = extension.getAttribute(ATT_CONTRIBUTOR_ID);
		if (!contributorId.equals(contributor)) {
			continue;
		}
		unordered.add(extension);
	}
	return unordered.toArray(new IConfigurationElement[unordered.size()]);
}
 
Example #10
Source File: EclipseLinkOSGiTransactionController.java    From lb-karaf-examples-jpa with Apache License 2.0 6 votes vote down vote up
@Override
protected TransactionManager acquireTransactionManager() throws Exception {
    Bundle bundle = FrameworkUtil.getBundle(EclipseLinkOSGiTransactionController.class);
    BundleContext ctx = bundle.getBundleContext();

    if (ctx != null) {
        ServiceReference<?> ref = ctx.getServiceReference(TransactionManager.class.getName());

        if (ref != null) {
            TransactionManager manager = (TransactionManager) ctx.getService(ref);
            return manager;
        }
    }

    return super.acquireTransactionManager();
}
 
Example #11
Source File: TrackedEventHandler.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void updateEventFilter()
{
  String filterString = (String) sr.getProperty(EventConstants.EVENT_FILTER);
  try {
    if (filterString == null) {
      filter = null;
    } else {
      filter = FrameworkUtil.createFilter(filterString);
    }
  } catch (InvalidSyntaxException e) {
    filter = null;
    setBlacklist(true);
    /*
     * if (Activator.log.doError()) {
     * Activator.log.error("Failure when matching filter '" +filterString
     * +"' in handler with service.id " +sid, handlerSR, err); }
     */
  }
}
 
Example #12
Source File: TabbedPropertyRegistry.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Appends the given section to a tab from the list.
 */
protected void appendToTabDescriptor(ISectionDescriptor section,
		List aTabDescriptors) {
	for (Iterator i = aTabDescriptors.iterator(); i.hasNext();) {
		TabDescriptor tab = (TabDescriptor) i.next();
		if (tab.append(section)) {
			return;
		}
	}
	// could not append the section to any of the existing tabs - log error
	String message = MessageFormat.format(NO_TAB_ERROR, section.getId(), section.getTargetTab());
	Bundle bundle = FrameworkUtil.getBundle(TabbedPropertyRegistry.class);
	IStatus status = new Status(IStatus.ERROR, bundle.getSymbolicName(),
			TabbedPropertyViewStatusCodes.NO_TAB_ERROR, message, null);
	Platform.getLog(bundle).log(status);
}
 
Example #13
Source File: BundleSignerCondition.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Constructs a Condition that tries to match the passed Bundle's location
 * to the location pattern.
 * 
 * @param bundle The Bundle being evaluated.
 * @param info The ConditionInfo from which to construct the condition. The
 *        ConditionInfo must specify one or two arguments. The first
 *        argument of the ConditionInfo specifies the chain of distinguished
 *        names pattern to match against the signer of the bundle. The
 *        Condition is satisfied if the signer of the bundle matches the
 *        pattern. The second argument of the ConditionInfo is optional. If
 *        a second argument is present and equal to "!", then the
 *        satisfaction of the Condition is negated. That is, the Condition
 *        is satisfied if the signer of the bundle does NOT match the
 *        pattern. If the second argument is present but does not equal "!",
 *        then the second argument is ignored.
 * @return A Condition which checks the signers of the specified bundle.
 */
public static Condition getCondition(final Bundle bundle, final ConditionInfo info) {
	if (!CONDITION_TYPE.equals(info.getType()))
		throw new IllegalArgumentException("ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
	String[] args = info.getArgs();
	if (args.length != 1 && args.length != 2)
		throw new IllegalArgumentException("Illegal number of args: " + args.length);

	Map<X509Certificate, List<X509Certificate>> signers = bundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
	boolean match = false;
	for (List<X509Certificate> signerCerts : signers.values()) {
		List<String> dnChain = new ArrayList<String>(signerCerts.size());
		for (X509Certificate signer : signerCerts) {
			dnChain.add(signer.getSubjectDN().getName());
		}
		if (FrameworkUtil.matchDistinguishedNameChain(args[0], dnChain)) {
			match = true;
			break;
		}
	}

	boolean negate = (args.length == 2) ? "!".equals(args[1]) : false;
	return negate ^ match ? Condition.TRUE : Condition.FALSE;
}
 
Example #14
Source File: ControlViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Open a trace in an editor
 *
 * @throws Exception
 *             if problem occurs
 */
@Before
public void beforeTest() throws Exception {
    SWTBotUtils.openView(ControlView.ID);
    WaitUtils.waitForJobs();
    URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path("testfiles" + File.separator + getTestStream()), null);
    File testfile = new File(FileLocator.toFileURL(location).toURI());
    fTestFile = testfile.getAbsolutePath();

    // Create root component
    SWTBotView viewBot = fBot.viewById(ControlView.ID);
    viewBot.setFocus();
    IViewPart part = viewBot.getViewReference().getView(true);
    ControlView view = (ControlView) part;
    fRoot = view.getTraceControlRoot();

    // Create node component
    fNode = new TargetNodeComponent(getNodeName(), fRoot, fProxy);
    fRoot.addChild(fNode);
    fTree = viewBot.bot().tree();
}
 
Example #15
Source File: BundleLocationCondition.java    From concierge with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Constructs a condition that tries to match the passed Bundle's location
 * to the location pattern.
 * 
 * @param bundle The Bundle being evaluated.
 * @param info The ConditionInfo from which to construct the condition. The
 *        ConditionInfo must specify one or two arguments. The first
 *        argument of the ConditionInfo specifies the location pattern
 *        against which to match the bundle location. Matching is done
 *        according to the filter string matching rules. Any '*' characters
 *        in the first argument are used as wildcards when matching bundle
 *        locations unless they are escaped with a '\' character. The
 *        Condition is satisfied if the bundle location matches the pattern.
 *        The second argument of the ConditionInfo is optional. If a second
 *        argument is present and equal to "!", then the satisfaction of the
 *        Condition is negated. That is, the Condition is satisfied if the
 *        bundle location does NOT match the pattern. If the second argument
 *        is present but does not equal "!", then the second argument is
 *        ignored.
 * @return Condition object for the requested condition.
 */
static public Condition getCondition(final Bundle bundle, final ConditionInfo info) {
	if (!CONDITION_TYPE.equals(info.getType()))
		throw new IllegalArgumentException("ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
	String[] args = info.getArgs();
	if (args.length != 1 && args.length != 2)
		throw new IllegalArgumentException("Illegal number of args: " + args.length);
	String bundleLocation = AccessController.doPrivileged(new PrivilegedAction<String>() {
		public String run() {
			return bundle.getLocation();
		}
	});
	Filter filter = null;
	try {
		filter = FrameworkUtil.createFilter("(location=" + escapeLocation(args[0]) + ")");
	} catch (InvalidSyntaxException e) {
		// this should never happen, but just in case
		throw new RuntimeException("Invalid filter: " + e.getFilter(), e);
	}
	Dictionary<String, String> matchProps = new Hashtable<String, String>(2);
	matchProps.put("location", bundleLocation);
	boolean negate = (args.length == 2) ? "!".equals(args[1]) : false;
	return (negate ^ filter.match(matchProps)) ? Condition.TRUE : Condition.FALSE;
}
 
Example #16
Source File: LibraryClasspathContainerSerializer.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private IFile getFile(IJavaProject javaProject, String id, boolean create)
    throws CoreException {
  IFolder settingsFolder = javaProject.getProject().getFolder(".settings"); //$NON-NLS-1$
  IFolder folder =
      settingsFolder.getFolder(FrameworkUtil.getBundle(getClass()).getSymbolicName());
  if (!folder.exists() && create) {
    ResourceUtils.createFolders(folder, null);
  }
  IFile containerFile = folder.getFile(id + ".container"); //$NON-NLS-1$
  return containerFile;
}
 
Example #17
Source File: PlatformAgent.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings ("unchecked")
@getter (
		value = "plugins",
		initializer = true)
public IList<String> getPluginsList() {
	final BundleContext bc = FrameworkUtil.getBundle(getClass()).getBundleContext();
	return StreamEx.of(bc.getBundles()).map(b -> b.getSymbolicName()).toCollection(Containers.listOf(Types.STRING));
}
 
Example #18
Source File: TraceControlUstSessionTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Perform pre-test initialization.
 *
 * @throws Exception
 *         if the initialization fails for some reason
 */
@Before
public void setUp() throws Exception {
    fFacility = TraceControlTestFacility.getInstance();
    fFacility.init();
    URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(TraceControlTestFacility.DIRECTORY + File.separator + TEST_STREAM), null);
    File testfile = new File(FileLocator.toFileURL(location).toURI());
    fTestFile = testfile.getAbsolutePath();
}
 
Example #19
Source File: ConfigDescriptionI18nUtil.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
public String getParameterUnitLabel(Bundle bundle, URI configDescriptionURI, String parameterName, String unit,
        String defaultUnitLabel, Locale locale) {
    if (unit != null && defaultUnitLabel == null) {
        String label = i18nProvider.getText(FrameworkUtil.getBundle(this.getClass()), "unit." + unit, null, locale);
        if (label != null) {
            return label;
        }
    }
    String key = I18nUtil.stripConstantOr(defaultUnitLabel,
            () -> inferKey(configDescriptionURI, parameterName, "unitLabel"));
    return i18nProvider.getText(bundle, key, defaultUnitLabel, locale);
}
 
Example #20
Source File: HibernateUtil.java    From hibernate-demos with Apache License 2.0 5 votes vote down vote up
private EntityManagerFactory getEntityManagerFactory() {
	if ( emf == null ) {
		Bundle thisBundle = FrameworkUtil.getBundle( HibernateUtil.class );
		// Could get this by wiring up OsgiTestBundleActivator as well.
		BundleContext context = thisBundle.getBundleContext();

		ServiceReference serviceReference = context.getServiceReference( PersistenceProvider.class.getName() );
		PersistenceProvider persistenceProvider = (PersistenceProvider) context.getService( serviceReference );

		emf = persistenceProvider.createEntityManagerFactory( "unmanaged-jpa", null );
	}
	return emf;
}
 
Example #21
Source File: FindingsDataAccessor.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private Object getService(Class<?> clazz){
	// use osgi service reference to get the service
	BundleContext context =
		FrameworkUtil.getBundle(FindingsDataAccessor.class).getBundleContext();
	if (context != null) {
		ServiceReference<?> serviceReference = context.getServiceReference(clazz.getName());
		if (serviceReference != null) {
			return context.getService(serviceReference);
		}
	}
	return null;
}
 
Example #22
Source File: PojoSRLauncher.java    From sling-whiteboard with Apache License 2.0 5 votes vote down vote up
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException
{
    return (name.startsWith("org.osgi.framework.") && !name.startsWith(FrameworkUtil.class.getName())) ||
        name.startsWith("org.osgi.resource.") ?
        PojoSRLauncher.class.getClassLoader().loadClass(name) :
        define(name);
}
 
Example #23
Source File: PojoSRLauncher.java    From sling-whiteboard with Apache License 2.0 5 votes vote down vote up
@Override
public Bundle getBundle()
{
    try
    {
        return (Bundle) loadClass(FrameworkUtil.class.getName()).getField("BUNDLE").get(null);
    }
    catch (Exception e)
    {
        e.printStackTrace();
        return null;
    }
}
 
Example #24
Source File: ChannelCommandDescriptionProviderOSGiTest.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Bundle resolveBundle(@NonNullByDefault({}) Class<?> clazz) {
    if (clazz != null && clazz.equals(AbstractThingHandler.class)) {
        return testBundle;
    } else {
        return FrameworkUtil.getBundle(clazz);
    }
}
 
Example #25
Source File: AnnotatedActionModuleTypeProvider.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
private ModuleType localizeModuleType(String uid, Locale locale) {
    Set<ModuleInformation> mis = moduleInformation.get(uid);
    if (mis != null && !mis.isEmpty()) {
        ModuleInformation mi = mis.iterator().next();

        Bundle bundle = FrameworkUtil.getBundle(mi.getActionProvider().getClass());
        ModuleType mt = helper.buildModuleType(uid, moduleInformation);

        ModuleType localizedModuleType = moduleTypeI18nService.getModuleTypePerLocale(mt, locale, bundle);
        return localizedModuleType;
    }
    return null;
}
 
Example #26
Source File: ApplicationStatusHandler.java    From vespa with Apache License 2.0 5 votes vote down vote up
private static BundleInfo bundleInfo(Object component) {
    try {
        Bundle bundle = FrameworkUtil.getBundle(component.getClass());

        String bundleName = bundle != null ?
                bundle.getSymbolicName() + ":" + bundle.getVersion() :
                "From classpath";
        return new BundleInfo(component.getClass().getName(), bundleName);
    } catch (Exception | NoClassDefFoundError e) {
        return new BundleInfo("Unavailable, reconfiguration in progress.", "");
    }
}
 
Example #27
Source File: PayloadHelper.java    From tlaplus with MIT License 5 votes vote down vote up
private static URL getToolsURL() {
	final Bundle bundle = FrameworkUtil.getBundle(PayloadHelper.class);
	final URL toolsURL = bundle.getEntry("files/tla2tools.jar");
	if (toolsURL == null) {
		throw new RuntimeException("No tlatools.jar and/or spec to deploy");
	}
	return toolsURL;
}
 
Example #28
Source File: ReChargeTarmedOpenCons.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private boolean initCodeElementService(){
	BundleContext context =
		FrameworkUtil.getBundle(ReChargeTarmedOpenCons.class).getBundleContext();
	serviceRef = context.getServiceReference(ICodeElementService.class);
	if (serviceRef != null) {
		codeElementService = context.getService(serviceRef);
		return true;
	} else {
		return false;
	}
}
 
Example #29
Source File: XYDataProviderBaseTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Get the full path to a test file from this class's bundle.
 *
 * @param bundlePath
 *            path from the bundle
 * @return the absolute path
 */
private String getFullPath(String bundlePath) {
    try {
        Bundle bundle = FrameworkUtil.getBundle(this.getClass());
        URL location = FileLocator.find(bundle, new Path(bundlePath), null);
        URI uri = FileLocator.toFileURL(location).toURI();
        return new File(uri).getAbsolutePath();
    } catch (Exception e) {
        fail(e.toString());
        return null;
    }
}
 
Example #30
Source File: TasksDSComponent.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"rawtypes", "unchecked"})
public static HazelcastInstance getHazelcastInstance() {

    BundleContext ctx = FrameworkUtil.getBundle(TasksDSComponent.class).getBundleContext();
    ServiceReference ref = ctx.getServiceReference(HazelcastInstance.class);
    if (ref == null) {
        return null;
    }
    return (HazelcastInstance) ctx.getService(ref);
}