Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools

Assignment 04: Software Architecture: Components

Release date: Monday 11.11.13 - Due date: Sunday, 17.11.13, 23:59

Please make sure that your source code is compiling and working.

Task 20: The Ariane 5

2+2+2=6 points

In June 1996, during the start of the Ariane 5 space launcher, the launcher veered off course and exploded less than one minute after takeoff.

a.) Research and describe the issues of this crash with a focus on software. (at least 1-3 sentences)

b.) Describe the motivation of software reuse. (at least 1-3 sentences)

c.) What are the challenges and implications of this crash for software reuse? (at least 1-3 sentences)

Hint: Don't forget to reference your source!

Task 21: Stateful or Stateless Beans

2+2+2=6 points

a.) Describe in your own words what Stateful and Stateless Beans are (1-3 sentences for each is sufficient) and give an example for each.

b.) Present an issue of Stateful Beans (Hint: Search for „Performance and Stateful Session Beans“).

c.) What is a benefit of using Stateful Beans?

Hint: If you use additional literature you have to reference it.

Task 22: J2SE CORBA

3+3=6 points

In this task you will generate Java CORBA code from an IDL file. For this purpose, you will need a JDK installed as you will need the “idlj” compiler. You will need the IDL file named “renting.idl” for this task that we put into your repository.

a.) Use the idlj compiler to generate Java code from the “renting.idl” file.

  • Which files are generated? (Hint: It is sufficient to write down the names)
  • What does the idlj argument “-fall” do?
  • After using this argument, write down which generated files are skeletons and which are stubs.

b.) Write down the mapping between the elements (types, attributes, return types/parameter types) defined in the idl and the resulting Java elements of the interface “ManageRentings”.

Task 23: Hello OSGi

0 points

In this task you are going to get familiar with creation and running of OSGi bundles in the Eclipse IDE.

The OSGi-Framework provides the possibility to separate a java application into several independent modules (bundles). Each bundle has a certain life-cycle and can be loaded, started and stopped. This principle e.g. allows updates of parts of the system while other components remain unchanged. Bundles can be interconnected using services.

In Eclipse start with creating a new Bundle called “” via File > New > Project > Plug-in Development > Plug-in Project. Select Equinox as plug-in target platform (see Figure below). Create a new project without using a predefined template.

After creating such a bundle, the project-structure in your workspace should look like the following picture.

Change the Activator class to have the following code snippet:

public class Activator implements BundleActivator {
        private BundleContext context;
        public void start(BundleContext context) throws Exception {
                this.context = context;
                System.out.println("Starting: Hello World");
        public void stop(BundleContext context) throws Exception {
                System.out.println("Stopping: Goodbye World");
                this.context = null;

To start the new bundle, create a new Run-Configuration. Select your bundle and deselect all other bundles. Click Add Required Bundles to activate the required bundles for your bundle. Finally use the Validate Bundles to check if all required bundles are available.

Important: You have to add the following bundles to your runtime configuration to use the OSGi console.

  • org.eclipse.equinox.console
  • org.apache.felix.gogo.command
  • org.apache.felix.gogo.runtime

After running your bundle, you should get some output. Use the following commands to control your bundle.

ss: Lists all bundles in the OSGi environment
start <bundle-id>: start a certain bundle
stop <bundle-id>: stop a certain bundle

Start and stop your plugin for a few times. You will see in the console that the start/stop methods of your bundle are called accordingly.

Task 24: A Date Service

2+2=4 points

In this task you will use your OSGi knowledge to create a bundle with a service that returns the current time. Start with creating a bundle called “”.

Add the following interface to your bundle:

public interface IDateService {
  String getDate();

Make sure that the bundle exports the interface above. Open the Manifest-file (MANIFEST.MF) should include something like


Either add this line to the Manifest, or use the Manifest-Editor of Eclipse (Runtime→ “Exported Packages” Add… → Select the package → Ok → Save the File

a.) Add an implementation class DateService for the interface that in the package that returns the current date in the format “yyyy-MM-dd HH:mm”.

To bind the service to the concrete implementation, use the registerService method of the context object in the Activator.start(BundleContext) method:

bundleContext.registerService( IDateService.class, new DateService(), null );

b.) To use the new created service, a consumer application should be created. Use a new Plugin-Project with a single Activator class. Add the import for the interface bundle to the Manifest-file. Afterwards start your date consumer bundle with the date service and ask for the date. Save a screenshot of this and submit this screenshot as part of solving this task.

<code Java> public class Activator implements BundleActivator { @Override public void start( final BundleContext bundleContext ) throws Exception{

  System.out.println("Starting Client...");
  ServiceReference<IDateService> sref = bundleContext.getServiceReference(IDateService.class);
  if(sref != null){
     IDateService  service = bundleContext.getService(sref);
     System.out.println("Date: " + service.getDate());


@Override public void stop(BundleContext bundleContext ) throws Exception {


} </Code>

Task 25: The Library Service

10 points

In this task you should implement a book library for lending books. As a starting point we have put a bundle “” with an interface IBookLibrary and a Book class into your repository.

public interface IBookLibrary {
  List<Book> getCollection();
  Book lendBook(String isbn);
  void returnBook(Book book);


  • Implement the library service for the given interface in the “” bundle.
  • Add some books to your library
  • Create a consumer bundle that lends a book from the library and prints the library state before and afterwards.

Submit your source code and a screenshot of the interaction of the consumer with your library service.

teaching/lectures/atsc/2013/assignment_04.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2020