-
-
- Tips and Tricks
Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Release date: Monday 11.11.13 - Due date: Sunday, 17.11.13, 23:59
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!
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.
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.
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”.
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 “de.unibonn.se.atsc.firstbundle” 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; @Override public void start(BundleContext context) throws Exception { this.context = context; System.out.println("Starting: Hello World"); } @Override 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.
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.
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 “de.unibonn.se.atsc.date”.
Add the following interface to your bundle:
package de.unibonn.se.atsc.date; public interface IDateService { String getDate(); }
Make sure that the bundle exports the interface above. Open the Manifest-file (MANIFEST.MF) should include something like
Export-Package: de.unibonn.se.atsc.date
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 de.unibonn.se.atsc.date 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>
10 points |
---|
In this task you should implement a book library for lending books. As a starting point we have put a bundle “de.unibonn.se.atsc.library” 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); }
Tasks:
Submit your source code and a screenshot of the interaction of the consumer with your library service.