Sep 042014
 

A DeepaMehta(DM) plugin can publish static resources and dynamic resources.

A DM plugin automatically publishes the Static resources (files) that are in resource/web directory. They will be published in the URI specified in bundle symbolic name in the pom.xml

A DM plugin can also publish dynamic resources created by java code, by providing a DeepaMehta RESTful service. To do so, you should define a method where you call getStaticResource to access a resource from the plugin, this method returns an Inputstream. The resources will be published in the URI obtained from the @path annotation defined in the plugin, and the resource method should be annotated with @Produces(“text/html”).

An example:


package de.example;

import de.deepamehta.core.osgi.PluginActivator;
import java.io.InputStream;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;

@Path("/website")
public class ExamplePlugin extends PluginActivator {

@GET
@Path("/{id}")
@Produces("text/html")
public InputStream invokeExample() {
return getStaticResource("web/index.html");
}
}

 Posted by at 7:27 am
Sep 042014
 

DM does not log you out automatically. There is no session timeout.

Once logged in DM creates a session in its webserver. The session ID is hold in a cookie. The cookie is a “session cookie”, that is it has no expiration date. So your session is only lost when a) restarting the DM server (in particular its web server), or b) when you restart the browser (or delete the cookie manually).

In case you have installed DM integration with SAlly, then you may experience an automatically log out, to change it you must put

org.ops4j.pax.web.session.timeout=120

in Karaf’s etc/system.properties file (gives 120 minutes to time out).

 Posted by at 6:04 am
Aug 182014
 

When coming to use DeepaMehta (DM), sometimes we are not aware of all the potential that is already there. So I’ve decided that when I come through some solutions that at first may be not obvious I’ll tag them as in the blog as DeepaMehta tips 😉

The first one, it has to do with retyping topics.
I’ve found out, that my first impulse when using DM is only to use the default topic types, almost everything can be a Note, a Person, an Institution or a WebResource. So I’m very happy just to start with those, once my project evolutes, I begin to need my own topic types, but was not sure how to do this in DM, without having to redo everything, so here it is how to reuse the information that you already have. In my case I’ve retyped Notes so I wanted to reuse its title and description.

1. Create Notes
2. Reveal the Note topic type (most simple by navigating along from a Note instance)
3. Create your own topic type, make it **composite**
4. Attach the Note type’s Title and Text child types to your own topic type
5. Create and attach further child types to your topic type
6. Optional: change the child order of your type so that Title remains the 1st child
7. RETYPE your Note instances (by invoking Retype from the context menu) -> Your Notes are now instances of your own type while keeping their existing content and label!

Retyping is on a per-instance basis, so each Note can be retyped to a different Type one by one 🙂

PastedGraphic-5

 Posted by at 2:59 am