blob: 7bf3e2527859c98726e86a2ad363e30b204c9576 [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.runtime.typeprovider.bundlespace;
import org.eclipse.osbp.runtime.common.types.IBundleSpace;
import org.eclipse.osbp.runtime.common.types.ITypeProviderService;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component(immediate=true)
public class BundleSpaceTypeProviderService implements ITypeProviderService {
private static final Logger LOGGER = LoggerFactory
.getLogger(BundleSpaceTypeProviderService.class);
private IBundleSpace bundleSpace;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected void bindBundleSpace(IBundleSpace bundleSpace) {
this.bundleSpace = bundleSpace;
}
protected void unbindBundleSpace(IBundleSpace bundleSpace) {
this.bundleSpace = null;
}
@Override
public Class<?> forName(Object clazz, String qualifiedName) {
try {
return bundleSpace.forName(qualifiedName);
} catch (ClassNotFoundException e) {
LOGGER.warn("{}", e.getMessage());
}
return null;
}
}