Category: Apache SYNCOPE (GSOC Project)

Posts

GSoC 2016 Work Submission

As a part of the final evaluation, GSoC 2016 accepted students are required to provide a permanent link with details about the work done along with the documentation for that work. This post is for that content.

Here are the details about my GSoC 2016 project once again:

Title: Apache SYNCOPE-809

ORGANIZATION

Apache Software Foundation

MENTOR

Francesco Chicchiriccò

Description:

The SYNCOPE-809 feature request points out the lack of a plugin for IDEs to allow users to create and edit mail templates and report stylesheets in the IDE itself instead of doing so using their dashboard. The feature request also provides a sample layout for the plugin where the mail and report templates are listed in a tree layout and made available for the user to view, edit and create new ones. The aim of this project will be to build a plugin that will solve the aforementioned problem and host it on the server so that end users can easily access and install the plugin on their own installation of eclipse and deployment of syncope.

htmlhelpers package

The following files are available in the htmlhelpers package

  • AssistInfo.java: Provides replace functionality for template content
  • AttributeInfo.java: Identifies attribute for html tags
  • AutoIndentAction.java: Provides logic for auto indentation of html code
  • CSSBlockScanner.java: Provides logic for CSS block identification
  • CSSRule.java: Provides logic for CSS code identification
  • DocTypeRule.java: Provides logic for html doctype tag identification
  • HTMLAutoEditStrategy.java: Provides logic for html content assist
  • HTMLCompletionProcessor.java: Provides logic for html code auto-completion
  • HTMLContextType.java: Provides logic for html content identification
  • HTMLFileDocumentProvider.java: Defines content types allowed in an html content
  • HTMLPartitionScanner.java: Provides logic for html block identification
  • HTMLScanner.java: Provides logic for html parsing
  • HTMLTagDamagerRepairer.java: Provides logic for html tag identification
  • HTMLTagScanner.java: Provides logic for html tag parsing
  • HTMLTemplateAssistProcessor.java: Provides logic for html content assist
  • HTMLTemplateManager.java: Links HTML content type to the HTML content
  • HTMLWhitespaceDetector.java: Provides logic for whitespace detection in html content
  • IHTMLColorConstants.java: Provides constants for html syntax highlighting colors
  • InnerCSSScanner.java: Provides logic for CSS parsing
  • InnerJavaScriptScanner.java: Provides logic for Javascript parsing
  • JavaScriptDamagerRepairer.java: Provides logic for JS code identification
  • JavaScriptScanner.java: Provides logic for JS code parsing
  • JavaWordDetector.java: Provides logic for JS identifier detection
  • SyncopeTagRule.java: Provides logic for syncope code identification
  • SyncopeTagScanner.java: Provides logic for syncope code parsing
  • TagDefinition.java: Provides definitions for different html tags
  • TagInfo.java: Provides info about html tags
  • TagRule.java: Provides rules for html tags
  • TextInfo.java: Provides generic methodology for simple text content

HTML Editor

Resource Bundle

The HTML editor requires some properties which should be both available for the functionality of the editor and should be readily available for editing. This resource bundle is available at “syncope/ide/eclipse/bundles/org.apache.syncope.ide.eclipse.plugin/src/main/resources/HTMLEditor.properties” .

**Note: **While writing tests for the plugin using swtbot, the editors were unable to initialize because for some reason the HTMLEditor was unable to access the resource bundle while automated testing, whereas while manually working with the plugin, the editors work perfectly fine. This is still an issue.

Editors

The editor displays the content of the mail and report templates, but to display all the available formats of a template, the editor needs to be a multi-page editor. This is done by the TemplateEditor class which extends the MultiPageEditorPart class to allow multiple text editors to be displayed in a single view. The input to these pages is provided by the TemplateEditorInput class which accepts the title, type and content of the template from the SyncopeView class. To provide basic editor capabilities such as syntax highlighting and content assist, specific editor classes are used which will be discussed in a future post.

The tree viewer was almost complete by the last post. The only thing required to be added was a reset button for re-fetching the keys to allow the user to refresh the list. Simple enough, I added the same functionality used after login. I wanted to list a few things that might be worth mentioning to anyone looking at the SyncopeView.java file.

Details about SyncopeView.java

  1. There is an invisible root to ensure that the tree view consists of 2 visible roots, namely Mail Templates and Report Templates.
  2. If you are “Reading the code” the main part starts at the initialize method. It does the following:
    • Check username and password for null or empty values.
    • Create the visible roots, Mail Templates and Report Templates.
    • Generate a SyncopeClient instance from the provided username, password and deployment url
    • Fetch lists of keys for both Mail and Report Templates from the above instance
    • Generate a TreeObject for each of these instances and populate them in the visible roots
  3. User interactions are handled within the createPartControl() method.
    • makeActions() creates the anonymous classes for each action to be done on user interaction.
    • hookContextMenu() populates and assigns actions to the context menu (right click menu for TreeObjects).
    • hookDoubleClickAction() as the name suggests, assigns actions to double click events on TreeObjects.
    • contributeToActionBars() populates and assigns actions to the action bar
  4. Make Actions makes the following action anonymous classes
    • loginAction: Open Login dialog and update TreeViewer once the user clicks OK
    • refreshAction: Update the TreeViewer. This action is disabled by default and enabled only when TreeViewer is already populated.
    • doubleClickAction: Calls openTemplateInEditor on the currently selected TreeObject.
    • readAction: Same as above. Only available to context menu.
    • addAction: Opens up a dialog for the key name and once entered, creates a new TemplateTO object and refreshes the TreeViewer
    • removeAction: Deletes the currently selected TreeObject from the deployments and refreshes the TreeViewer.
  5. To open template content in an editor, the openTemplateInEditor() method is called. It does the following:
    • There are separate code blocks for Mail and Report templates because of 2 reasons:
      • TemplateService for the 2 templates are named differently, MailTemplateService and ReportTemplateService
      • The formats used by MailTemplates and ReportTemplates are both different in name and number.
    • Each of the above code blocks, opens up a dialog to block UI while fetching template content from the deployment url.
    • The content of the template for any particular format is fetched by the getStringFromTemplate() method which opens an InputStream to read the template format content
    • Upon opening the editor with TemplateEditorInput, 3 arrays are passed to it
      1. templateData: content of each of the formats supported by the template
      2. editorTitles: The format names of the template such as TEMPLATE_FORMAT_HTML
      3. editorToolTips: The name of the current TreeObject
  6. To restrict the available of SyncopeClient instance to just this class, it contains the setMailTemplateContent and setReportTemplateContent public static methods which allow the editor classes to set content for any template format without having to deal with SyncopeClient instance generation (since it requires values such as username which would not be directly available to them).

Why did I use

  • display.syncExec : Any changes to the UI in eclipse must be made on the UI thread
  • Jobs : The UI must be blocked while performing background tasks to ensure that the user is aware of the task.
  • Public Template Format names : (such as TEMPLATE_FORMAT_HTML) They will be used by TemplateEditor.java to find out which editor to open up for the content.

Progress Report

The SYNCOPE-809 project is going as expected. There are new things that I now understand crystal clear (like maven) and there are things that I don’t yet understand very well (most of the source code of syncope). But here’s another update on the part of it that I have been assigned to build.

What has been done since?

The Tree Viewer was built, but I still had to interface with the syncope deployment to fetch and send data to a user defined url. Here are the changes / additions I made to fulfill this requirement.

Now, diving into the plugin development, the first step for the process was to create a tree view as suggested in the issues page of apache syncope. The aim of this view would be to allow the user to view the available mail and report templates so that he/she can interact with it and open it up in the editor. Here are the images of the suggested tree view and the one I built.

Google Summer of Code (GSOC)

Apache Syncope

An Open Source Identity Management System


Ready for a new start? The community bonding period has ended and we have reached the most awaited Coding Period. Been waiting for this day since long and it is every bit as exciting as I imagined. Don’t yet know what I’m talking about? Well let me tell you! My proposal got accepted earlier and I am now a Google Summer of Code Student. Exciting right? Well let’s get back to business and talk about what’s been done and what’s to be done.

Google Summer of Code (GSOC)

Apache Syncope

An Open Source Identity Management System


Introduction

Apache syncope is an identity management system which essentially means that it allows enterprises to maintain information and credentials for their employees in an organized and efficient way. It is a real world solution for a pressing problem.

Apache Syncope is an Open Source system for managing digital identities in enterprise environments, implemented in Java EE technology and released under Apache 2.0 license.

Identity management (or IdM) means to manage data on systems and applications, using the combination of business processes and IT.