Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Each country has their own implementation of the National Connector and therefore the way that OpenNCP connects with the NC will be different for each country. Therefore it is necessary to “inject” country-specific functionality implementations into the Protocol Terminator.

...

Here is an example that shows the ServiceLoader in action.  Here you can see how an implementation of the PatientSearchInterface is loaded. 

Code Block
languagejava
linenumberstrue
public class XCPDServiceImpl implements XCPDServiceInterface {
    private ServiceLoader<PatientSearchInterface> serviceLoader;
    private PatientSearchInterface patientSearchService;
    
    public XCPDServiceImpl() {
        serviceLoader = ServiceLoader.load(PatientSearchInterface.class);
    	try {
    		logger.info("Loading National implementation of PatientSearchInterface...");
    		patientSearchService = serviceLoader.iterator().next();
    		logger.info("Successfully loaded PatientSearchService");
    	} catch (ServiceConfigurationError e) {
    		logger.fatal("Exception loading PatientSearchService: ", e);
    	}
    }
}

...

Mock implementations of the DocumentSubmitImpl, DocumentSearchImpl and PatientSearchImpl are provided in the project epsos-nc-mock-it (integration test, not Italy!).  These classes return dummy responses or exceptions where appropriate.  Please refer to the  the /wiki/spaces/INT/pages/4948035 Wiki pages for more information.  The mock implementations are packaged as a jar file epsos-nc-mock-it.jar.

Image Added

Packaging

Each country must build their own jar file containing their own implementations, dependencies and supporting files.

...

Code Block
languagehtml/xml
	<profiles>
		<profile>
			<!-- This profile bundles a mock National Connector interfaceimplementation -->
			<id>national-connector-mock-impl</id>
			<dependencies>
				<dependency>
                    <groupId>eu.europa.ec.joinup.ecc.epsos-protocol-terminators.epsos-ncp-server</groupId>
                    <artifactId>epsos-nc-mock-it</artifactId>
                    <version>0.1-SNAPSHOT</version>
                    <scope>runtime</scope>
                </dependency>
			</dependencies>
		</profile>
		<profile>
			<!-- This profile bundles the country-specifigreal National Connector interfaceimplementation -->
			<id>national-connector-impl</id>
			<dependencies>
				<dependency>
					<groupId>${national-connector-impl.groupId}</groupId>
					<artifactId>${national-connector-impl.artifactId}</artifactId>
					<version>${national-connector-impl.version}</version>
					<scope>runtime</scope>
				</dependency>
			</dependencies>
		</profile>
	</profiles>

...