O'Reilly logo

OSGi and Apache Felix 3.0 by Walid Joseph Gédéon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - writing the APIs

By now, you should have prepared the bookshelf-service project structure. Let's write the BookshelfService and Authentication interfaces. Those will be in the package com.packtpub.felix.bookshelf.service.api.

The Authentication interface

The authentication interface here is a very simple one. It is based on a username and password and creates a session when the authentication information is accepted.

public interface Authentication
{
String login(String username, char[] password)
throws InvalidCredentialsException;
void logout(String sessionId);
boolean sessionIsValid(String sessionId);
}

Again, here, the exceptions (for example, InvalidCredentialsException) are not listed; they are left to you to write on your ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required