Java Code Examples for org.osgi.service.component.annotations.ReferencePolicyOption#GREEDY

The following examples show how to use org.osgi.service.component.annotations.ReferencePolicyOption#GREEDY . 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: WrapperMetricsServlet.java    From sling-whiteboard with Apache License 2.0 5 votes vote down vote up
@Reference(service = MetricRegistry.class, cardinality = ReferenceCardinality.MULTIPLE,
        policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
void bindMetricRegistry(MetricRegistry metricRegistry, Map<String, Object> properties) {
    
    log.info("Binding Metrics Registry...");
    
    String name = registryName(metricRegistry, properties);
    
    CopyMetricRegistryListener listener = new CopyMetricRegistryListener(this.metrics, metricRegistry, name);
    listener.start();
    childRegistries.put(metricRegistry, listener);
    log.info("Bound Metrics Registry {} ", name);
}
 
Example 2
Source File: CodeElementService.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public void setCodeElementServiceContribution(ICodeElementServiceContribution contribution){
	ICodeElementServiceContribution previous =
		contributions.put(contribution.getSystem(), contribution);
	if (previous != null) {
		LoggerFactory.getLogger(getClass())
			.warn("Possible ICodeElementServiceContribution collision previous [" + previous
				+ "] new [" + contribution + "]");
	}
}
 
Example 3
Source File: ValueSetService.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY)
public synchronized void bindContribution(IValueSetContribution contribution){
	if (contribution.getValueSetIds() != null && !contribution.getValueSetIds().isEmpty()) {
		addContribution(contribution);
	} else {
		getLogger().warn(
			"Contribution " + contribution + " returns no value set ids. It will be ignored.");
	}
}
 
Example 4
Source File: CodingService.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.STATIC, policyOption = ReferencePolicyOption.GREEDY)
public synchronized void bindFhirTransformer(ICodingContribution contribution){
	if (contributions == null) {
		contributions = new ArrayList<ICodingContribution>();
	}
	if(contribution.getCodeSystem() != null && !contribution.getCodeSystem().isEmpty()) {
		contributions.add(contribution);
		if (contribution instanceof ILocalCodingContribution) {
			localCoding = (ILocalCodingContribution) contribution;
		}
	} else {
		getLogger().warn(
			"Contribution " + contribution + " returns no code system. It will be ignored.");
	}
}
 
Example 5
Source File: ReferenceDataImporterService.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public void setReferenceDataImporter(IReferenceDataImporter referenceDataImporter,
	Map<String, Object> properties){
	IReferenceDataImporter previous =
		importersMap.put((String) properties.get(IReferenceDataImporter.REFERENCEDATAID),
			referenceDataImporter);
	if (previous != null) {
		LoggerFactory.getLogger(getClass())
			.warn("Possible IReferenceDataImporter collision previous [" + previous
				+ "] new [" + referenceDataImporter + "]");
	}
}
 
Example 6
Source File: PoCodeElementService.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public void setCodeElementServiceContribution(ICodeElementServiceContribution contribution){
	ICodeElementServiceContribution previous =
		contributions.put(contribution.getSystem(), contribution);
	if (previous != null) {
		LoggerFactory.getLogger(getClass())
			.warn("Possible ICodeElementServiceContribution collision previous [" + previous
				+ "] new [" + contribution + "]");
	}
}
 
Example 7
Source File: SerialPortRegistry.java    From openhab-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Registers a {@link SerialPortProvider}.
 *
 * @param creator
 */
@Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
protected void registerSerialPortCreator(SerialPortProvider creator) {
    synchronized (portCreators) {
        portCreators.add(creator);
    }
}
 
Example 8
Source File: SerialPortRegistry.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Registers a {@link SerialPortProvider}.
 *
 * @param creator
 */
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
protected void registerSerialPortCreator(SerialPortProvider creator) {
    synchronized (this.portCreators) {
        this.portCreators.add(creator);
    }
}
 
Example 9
Source File: StoreToStringService.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public synchronized void setCodeElementServiceContribution(
	IStoreToStringContribution contribution){
	contributions.add(contribution);
}
 
Example 10
Source File: StockCommissioningSystemDriverFactories.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public void bind(ICommissioningSystemDriverFactory driverFactory){
	log.debug("Binding " + driverFactory.getClass().getName());
	driverFactories.put(driverFactory.getIdentification(), driverFactory);
}
 
Example 11
Source File: MessageService.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public void setMessageTransporter(IMessageTransporter messageTransporter){
	if (!messageTransporters.containsKey(messageTransporter.getUriScheme())) {
		messageTransporters.put(messageTransporter.getUriScheme(), messageTransporter);
	}
}
 
Example 12
Source File: BillingService.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public void setBillableAdjuster(IBillableAdjuster adjuster){
	if (!billableAdjusters.contains(adjuster)) {
		billableAdjusters.add(adjuster);
	}
}
 
Example 13
Source File: BillingService.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public void setBilledAdjuster(IBilledAdjuster adjuster){
	if (!billedAdjusters.contains(adjuster)) {
		billedAdjusters.add(adjuster);
	}
}
 
Example 14
Source File: ContextServiceHolder.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY)
public void setContextService(IContextService contextService){
	ContextServiceHolder.contextService = contextService;
}
 
Example 15
Source File: ContextServiceHolder.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policyOption = ReferencePolicyOption.GREEDY)
public void setContextService(IContextService contextService){
	ContextServiceHolder.contextService = contextService;
}
 
Example 16
Source File: ExplorableDatasetRest.java    From mobi with GNU Affero General Public License v3.0 4 votes vote down vote up
@Reference(policyOption = ReferencePolicyOption.GREEDY)
public void setOntologyManager(OntologyManager ontologyManager) {
    this.ontologyManager = ontologyManager;
}
 
Example 17
Source File: MigratorService.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
public void setMigratorContribution(IMigratorContribution contribution){
	if(!contributions.contains(contribution)) {
		contributions.add(contribution);
	}
}
 
Example 18
Source File: OntologyRecordVersioningService.java    From mobi with GNU Affero General Public License v3.0 4 votes vote down vote up
@Reference(policyOption = ReferencePolicyOption.GREEDY)
protected void setOntologyManager(OntologyManager ontologyManager) {
    this.ontologyManager = ontologyManager;
}
 
Example 19
Source File: OntologyRepositoryCacheFactory.java    From mobi with GNU Affero General Public License v3.0 4 votes vote down vote up
@Reference(policyOption = ReferencePolicyOption.GREEDY)
void setOntologyManager(OntologyManager ontologyManager) {
    this.ontologyManager = ontologyManager;
}
 
Example 20
Source File: TransformationManagerImpl.java    From sling-whiteboard with Apache License 2.0 4 votes vote down vote up
@Reference(service = TransformationStep.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
void bindTransformationStep(Map<String, Object> properties, TransformationStep step) {
    mapping.put(properties, step);
}