My favorites | Sign in
Project Home Wiki Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Reference  
Updated Oct 15, 2010 by denis.ha...@gmail.com

Introduction

This document is introducing some of the concepts which are important for thorough understanding of Jibe. These concepts are listed without any specific structure

org.jibeframework.core project

This is the core Jibeframework project. It has no end user functions and serves as a foundation to build applications uppon.

org.jibeframework.contentmanager project

This is the reference application built on top of org.jibeframework.core project. It's main purpose is to demonstrate some of best practices in Jibe application development, but it is also quite feature rich Alfresco repository browser which could be customized to serve specific user requirements.

Resources

Jibe resources are xml configuration files, JavaScript files, CSS files,Freemarker templates, message bundles and Groovy scripts

Context

Context is an object of org.jibeframework.core.Context class created in the beginning of request handling process.

Response

Response is the object which can be obtained from context and which is used to build response sent to the client. In most of cases this response will be JSON, but it is also possible to create response of any mime type. In case we are creating JSON response it is possible to put key-value pairs

context.getResponse().put("someKey","someValue");
context.getResponse().put("someOtherKey",true);

which will translate to following response

{"someKey":"someValue","someOtherKey":true}

it is also possible to add client operations into response

context.getResponse().add(new ShowMessageBoxOperation("Warning", "This is a warning!", ShowMessageBoxOperation.WARNING));

which will eventually translate into

{
  "someKey":"someValue",
  "someOtherKey":true,
  "__operations":[
        {"namespace":"core",
         "operation":"showMessageBox",
         "title":"Warning",
         "message":"This is warning!"
         "icon":"ext-mb-warning"}
       ]
}

Client operations

Client operations is a way to push behavior from server to client in order to manipulate UI. There are two types of client operations. These are data operations and UI operations. There is a distinction existing only for a simple reason that UI operations has to be executed on the client before data operations. Creating an operation is quite simple. As an example we will use ShowMessageExample operation that has been used in response definition.

package org.jibeframework.core.operation.ui;

public class ShowMessageBoxOperation extends BaseUIOperation {
	public static final String INFO = "ext-mb-info";
	public static final String WARNING = "ext-mb-warning";
	public static final String QUESTION = "ext-mb-question";
	public static final String ERROR = "ext-mb-error";

	private String message, title, icon;

	public ShowMessageBoxOperation(String title, String msg, String icon) {
		super("core", "showMessageBox");
		this.message = msg;
		this.title = title;
		this.icon = icon;
	}
}

Please notice invocation of constructor in superclass with two arguments, namespace with value core and operation name with value showMessageBox. Also notice that there are no setters and getters for private fields. As allready shown in response example, this operation when added to response will be serialized to a JSON object with property names corresponding to private fields

{"namespace":"core",
 "operation":"showMessageox",
 "title":"Warning",
 "message":"This is warning!"
 "icon":"ext-mb-warning"}

When response is received on the client, for each JSON object in __operations array a following JavaScript function will be invoked with object itself as argument

jibe.OperationHandler.<namespace>.<operation_name>(object)

Using again showMessageBox operation as an example, this is the function that will be invoked

jibe.OperationHandlers.core.showMessageBox=function(data) {
	Ext.Msg.show({
         	title : data.title,
		msg : data.message,
		buttons : Ext.MessageBox.OK,
		icon : data.icon
	});
}

There are many different operations available for usage in package 'org.jibeframework.core.operation'

Request handler

Request handler is an object responsible to handle request and build response Within the dispatcher web script processing is actually quite simple and can be explained with the following pseudo code

set context to new Context(webscriptrequest,webscriptresponse)
FOR EACH request_handler IN registered request handlers list
    IF request_handler applies for request
         request_handler handle(context)
    END IF
END FOR
context.writeResponse

As we can see, at the beginning, context is created. After the context is created each of registered handlers is checked if it is applicable for the current request and invoked if that is the case passing the context as an argument. Within the request handler, response is built.

Dispatcher web script

Dispatcher web script is a single web script responsible to handle all requests coming from Jibe client

Data model

Node

When refering to Node it is meant an object whose class is extending org.jibeframework.core.node.Node class. Node contains key value pairs which can be accessed using following methods

node.getProperty(String name);
node.setProperty(String name, Object value);

Nodes are used to build domain model and can be contained within data model. The picture bellow is describing a class hierarchy of different Node classes.

Name Description
DocumentNode Wraps Alfresco NodeRef object and contains behavior related to Alfresco document
BeanNode Wraps Java beans and allows them to be contained in data model
UserNode Wraps and contains behavior related to Alfresco user

That is, we can say that resolver is a sort of virtual property whose value will be generated dynamically

Configuration service

Singleton Spring bean responsible to fetch configuration elements using configuration evaluation algorithm

Deployment of project

Each Jibe project has ant build.xml file in the root. Deploying means executing deploy target of this ant build file

Powered by Google Project Hosting