Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*-
* #%L
* com.paremus.dosgi.net
* %%
* Copyright (C) 2016 - 2019 Paremus Ltd
* %%
* Licensed under the Fair Source License, Version 0.9 (the "License");
*
* See the NOTICE.txt file distributed with this work for additional
* information regarding copyright ownership. You may not use this file
* except in compliance with the License. For usage restrictions see the
* LICENSE.txt file distributed with this work
* #L%
*/
package com.paremus.dosgi.net.impl;
import static com.paremus.dosgi.net.impl.RegistrationState.CLOSED;
import static com.paremus.dosgi.net.impl.RegistrationState.ERROR;
import static com.paremus.dosgi.net.impl.RegistrationState.OPEN;
import static com.paremus.dosgi.net.impl.RegistrationState.PRE_INIT;
import static org.osgi.framework.ServiceException.REMOTE;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import org.osgi.framework.ServiceException;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.launch.Framework;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.ExportReference;
import org.osgi.service.remoteserviceadmin.ExportRegistration;
import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
import org.osgi.util.tracker.ServiceTracker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExportRegistrationImpl implements ExportRegistration {
private static final Logger LOG = LoggerFactory.getLogger(ExportRegistrationImpl.class);
private final ServiceReference> _serviceReference;
private final Framework _sourceFramework;
private final ExportReference _exportReference;
private final RemoteServiceAdminImpl _rsa;
private final ServiceTracker super Object, ServiceReference>> _serviceTracker;
private final UUID _id;
private EndpointDescription _endpointDescription;
private Throwable _exception;
private RegistrationState _state = PRE_INIT;
private Map _extraProperties;
/**
* Default constructor for a new service export.
*
* @param sref a reference to the service being exported
* @param extraProperties the extra properties with which this service is being exported
* @param endpoint the description of the exported endpoint
* @param sourceFramework the framework from which this service is being exported
* @param rsa the exporting {@link RemoteServiceAdmin}
* @throws NullPointerException if either argument is null
*/
@SuppressWarnings("unchecked")
public ExportRegistrationImpl(ServiceReference> sref, Map extraProperties,
EndpointDescription endpoint, Framework sourceFramework, RemoteServiceAdminImpl rsa) {
_serviceReference = Objects.requireNonNull(sref, "The service reference for an export must not be null");
_extraProperties = extraProperties;
_sourceFramework = Objects.requireNonNull(sourceFramework, "The source framework of the service reference for an export must not be null");
_endpointDescription = Objects.requireNonNull(endpoint, "The endpoint for an export must not be null");
_id = UUID.fromString(_endpointDescription.getId());
_exportReference = new SimpleExportReference();
_rsa = rsa;
_exception = null;
_serviceTracker = new ServiceTracker