Integration

This is a hard section to write as integration is such a huge area. Here we have tried to line up some common techniques we know people are using and describe pro / cons for each.

Simple integration via Iframes

Sometimes organisations have a need to embed existing applications as they are. In such cases using IFrames or ordinary frames could be a valid option. It really has nothing to do with InfoGlue as the technology is supplied by the browsers directly. We however thought it should be mentioned as it is commonly used as a way of achieving integration fast. The positive effects are that it works instantly in most cases and no modifications has to be done to the application. The negative side is that frames can be ugly, the size of the frame is fixed which can result in scrolling a part of the page and that the surrounding page often has a different style.

Simple integration via embedding

If the IFrame solution is inadequate for the particular needs another option is something we call backend embedding. The technique is rather basic and means that InfoGlue does a HTTP-request to the URL you specify like a browser would and then returns the resulting HTML for you to present or process.

The benefits of this approach are:

  • The user is unaware of that there are different parts of the page coming from different locations as the result is inserted in the html code and the page is delivered as one unit.
  • You can process the resulting HTML and change styles etc. if you want to have a common style on the page.
  • Security – you don’t have to allow the user direct access to the embedded application – it is enough if the InfoGlue machine is authorized.
  • You can have the embedded webapp call InfoGlue-methods like if it were a template if it wants to use images/labels etc. when embedded.

The drawbacks are:

  • The performance of the entire page is very dependent of the performance of the embedded webapp. If the webapp is interactive you will have to do pretty much pre/post-processing of the request and HTML to make it work back and forth. In some cases it will not work at all if the state handling is advanced in the embedded webapp.

Here is a small example-template that basically fetches the startpage from http://w3c.org and embeds it into the page. JSP has a taglib which does this as well.

 

<html> 
<head><title>Embedded</title></head> 
<body> 
# set($remoteContent = $templateLogic.getUrlContent(“http://www.w3c.org”)) 
Here is the W3C content: $remoteContent 
</body> 
</html>

 

Advanced integration via custom classes in velocity

If you wish to do embedding of external resources in a more advanced way you will probably want to integrate by using pre made or custom backend logic. A very common situation is when you have some internal or external web service or database you wish to fetch information from but you just want to fetch the data and still let InfoGlue handle the presentation.
The solution is to write custom classes. In InfoGlue this is very simple. As long as you have an empty constructor in your Java class and put it in the InfoGlue class path it will be usable from any template in your site.
Let’s say you create a class like this:

 

import java.util.List; 
public class MyClass 

    public MyClass()  
    { 
    } 
    public String getHelloWorld() 
    { 
        return “Hello World”; 
    } 
    public List getOrders(String customerNumber) 
    { 
        //Here we could connect to the order database with jdbc and query it instead 
        return null; 
    } 

 
Then after compiling it and putting the class file in the deliver class path you can reference it like this in the templates:

 

<html> 
<head><title>Embedded</title></head> 
<body> 
# set($myClass = $templateLogic.getObjectWithName(“MyClass”)) 
The class says $myClass.getHelloWorld() to us. 
</body> 
</html>

If you are using JSP you are probably used to importing custom classes so I will not describe that here.

Model class for component

Since Infoglue 3 we added the possibility to have a model class for each template. Just add a class which implements the model-interface and it will be give the chance to execute and populate data for the component view. This is ideal for situations where complex logic needs to be executed and you don't want it to polute your JSP:s with scriptlets or calls to taglibs.

Step 1: In all components (HTML-Templates) there is now a field called ModelClassName. State a classname here of the class you wish to use as the model-populator. (include package etc of course). In my example: "se.bogeblad.components.examples.Sample1Populator".

Step 2: Create the class. Here is my example:

package se.bogeblad.components.examples;
import java.util.Map;
import org.infoglue.deliver.controllers.kernel.impl.simple.TemplateController;
import org.infoglue.cms.providers.ComponentModel;

public class Sample1Populator implements ComponentModel
{
    public void prepare(String template, TemplateController templateController, Map<String,Object> model) throws Exception
    {
        model.put("currentDate", new Date());
        model.put("discount", 20);
    }
}

Step 3: You need to deploy the new class into the Infoglue-context or in the shared/common context of your appservers.

Step 4: Use the model-data in the component by using 

<c:out value="${model.currentDate}"/> or <c:out value="${model.discount}"/>

Proxy-tag for JSP / embedding

A beta feature in Infoglue 3 is the new Proxy/screenscraping-related tag. It is an attempt at making life easier when trying to manage constant change as well as unclear or changing project demands. It basically tries to act as an serverside Iframe which means you can get rid of some of the unwanted sideeffects normal iframes have. It manages sessions, cookies and all parameters back and forth. It also supports cutting out a portion of the target page.

We encourage testing this feature as it can mean incredible results almost instantly if the situation and target system are appropriate. The ambition is to improve the feature in the upcoming releases with all suggestions you give to better support real life situations.

Extension mechanism in cms for tabs, buttons, actions, views etc

A new feature introduced in Infoglue 3.0 is the new plugin architecture which allows anyone to add new tabs, function buttons, actions or views by just deploying a jar-file with the correct content. This allows for extending the default functionality with improvements or adding completely new tools or features to the administrative and front-end parts. One could for example write a plugin adding e-commerce features, mobility-features or anything else you can imagine without having to mess with the core system.

More information to come here - please email me if you want it fast!!!!