27 January 2011

Installing SVN plugin for eclipse

Went round in circles for a bit with this one. This is what worked for me (Helios release)

Install SVN plugin from http://download.eclipse.org/technology/subversive/0.7/update-site/

Install connectors from http://community.polarion.com/projects/subversive/download/eclipse/2.0/update-site/

25 January 2011

Proxy frustrations

Wasting heaps of time trying to access the eclipse & RAP CVS repositories from behind the company firewall & proxy. Been through all the help pages I can find but no success. The admins here say that SOCKS is not allowed but it ought to be possible to get at proxy.eclipse.org using port 80. Why is it not working?!

Grrrrr :-(

21 January 2011

Using the JFace forms package from the RAP incubator

I wanted to use the collapsible Section control so I downloaded the JFace Forms package from the RAP source repository :pserver:dev.eclipse.org:/cvsroot/rt .

Just import org.eclipse.rap.ui.forms and add to the main plugin Dependencies and it's done. As I understand it, the forms package is not yet official so I guess there might be some bugs. In fact, the section twistie doesn't react to the mouse click but the title section does so it's not a major problem.

19 January 2011

Coding vs Configuration

After a very frustrating afternoon trying to understand the configuration of ActionSets, Activities, Services etc - without success - I am wondering just how necessary it all is when writing a one-off RAP application. There is just the one plug-in and it will never be added to another plug-in set and will never have to co-operate or negotiate with other plug-ins.

So is it really necessary to do all this configuration? Can I do away with x layers of abstraction and just code the stuff I need directly? That would seem to be the pragmatic approach but I wonder what the consequences are are the project gets bigger.

18 January 2011

Role-based security in RAP

Been struggling this afternoon with role-dependent actions. I want to disable some actions unless the current user has the 'admin' role.

Found this document http://ftp.bredex.de/rcp-auth/RCP_Authorization.pdf which looks interesting. There is also a FAQ on the RAP site which covers this topic but I couldn't get it to work as I expected. The downloadable demo didn't function either :-(

More info found here https://bugs.eclipse.org/bugs/show_bug.cgi?id=71857
You could try using the activities mechanism for this.
See 
http://help.eclipse.org/help30/topic/org.eclipse.platform.doc.isv/guide/workbench_advext_activities.htm

You would:
- define separate activities corresponding to the different access levels
- define your actions in regular action sets, grouped according to access level
- associate each activity with the appropriate action sets via
activityPatternBinding elements
- set the enabled activity ids after authentication, early in the workbench
lifecycle, e.g. from your WorkbenchAdvisor's preStartup() method.

You may want to define dependencies between access levels (e.g. level A includes
level B) using the activityRequirementBinding element.

Note that this mechanism also supports dynamic changes to the set of enabled
activities.

An article from IBM http://www.ibm.com/developerworks/opensource/library/os-ecl-rcpsec/index.html

RAP Wiki http://wiki.eclipse.org/RAP/Equinox_Security_Integration

RAP forums & resources

FORUMS
Eclipse.org http://www.eclipse.org/forums/index.php?t=thread&frm_id=34&S=424f561068bca8cd9e7e5945e52bafdf

RAP Forum: http://www.eclipse.org/forums/index.php?t=thread&frm_id=34

CASE STUDIES
CAS http://www.infoq.com/articles/eclipse-rap-casestudy

First simple app in RAP

Got my first simple RAP application running. I used the RAP Mail template to get started and have 2 views: one for navigation and the other to show details of the selection. The application I'm working on is for trade fair management.

There is still a lot of 'mail' stuff visible which I haven't been able to get rid of yet but here are a few things I did to customize the example.

  • Refactor packages and classes to better reflect the application e.g. all 'mail' changed to 'fair'
  • plugin.xml -> Extensions -> ...ui.branding. Changed 'servletName' from 'mail' to 'fair'
  • plugin.xml -> Extensions -> ...ui.entrypoint. Changed 'parameter' from 'mail' to 'fair'
The default branding is not to my taste at all. This will be something to look at soon but seems to be quite extensive.
The packaged examples are worth looking at. Locate 'org.eclipse.rap.design.example' and 'org.eclipse.rap.demo' in the Plug-ins view and then Import As -> Source project.

I find these a very useful reference and used a number of items from org.eclipse.rap.demo.controls.TableViewerTab for my navigation view.


As I don't like the branding I edited the plug-in to remove the template's branding and replaced it with a default.


And the application now looks quite different.



17 January 2011

Class path problems in eclipse plug-ins

As I mentioned in a previous post, out of desperation I added the DB2 jar to an eclipse plug-in. I then innocently tried to load it using:

try {
    Class.forName("com.ibm.db2.jcc.DB2Driver");
} catch (ClassNotFoundException e) {
    Activator.logError("getConnection", e);
    throw e;
}
return DriverManager.getConnection("jdbc:db2://servername", "user", "pwd");

This did not work. Eclipse plug-ins have their own class loader and the DB2 jar must be added to the plug-in classpath.

Open the plugin.xml and select the 'Runtime' tab. In the 'Classpath' section select 'Add...' and choose the DB2.jar (and any other JARs which are needed).

Best practice (I would guess) would be to have separate plug-ins for each external library (log4j, db2 etc).

RAP: First difficulties - how to define a database connection

I have been working on J2EE projects for many years and am used to defining resouces such as DB connections in the EAR project. The connection is picked up at runtime using a JNDI lookup. Scripts are used to modify the actual connection details depending on the target environment: test, stage, production etc.

So how should this be done in RAP? At the end of the day it will also be a J2EE application and we will want to deploy to one of a number of target systems. How well will it integrate in our existing deployment system?

After a lot of head scratching I decided to adopt the pragmatic (impatient) approach and bunged the DB2 jar into the project just so that I could get on with the interesting stuff.

As soon as I find a better approach (there had better be one!) I will post again here.

UPDATES:

Howto access backend services from RAP application?

Installing RAP

This is my first post on the subject of RAP (Rich Ajax Platform for eclipse). I want to document my progress as I delve into RAP and attempt to produce a full-size, real-world application.

Here are the steps I took to install RAP and get the first simple app running:
  • Download the RAP package from http://www.eclipse.org/downloads/ (select Eclipse for RCP and RAP Developers)
  • Extract the zip file to a location of your choice
  • Start eclipse.exe
  • When prompted for a workspace path enter, for example, D:\Workspaces\RAP
  • When eclipse has started, the welcome page is displayed. Click on the 'Overview' icon and then on the 'Rich Ajax Platform (RAP)' link. 
  • Select the 'Install Target Platform' link and follow the instructions. At the time of writing, this step has to be performed. If you do not perform this action the projects will contain 100s of errors such as 'import org.eclipse.* not found'. If you forget this step you can get back to the Welcome page using Help -> Welcome.
  • You should now have a new target platform. To double-check, view the preferences: Window -> Preferences -> Plug-in Development -> Target Platform. There should be a Rich Ajax Platform (active) target
  • Create a new plugin project. File -> New -> Project... -> Plug-in Development -> Plug-in Project
  • Enter the name of the project and select 'Next'.
  • There is no need to change anything on the 'Content' dialog. Select 'Next'.
  • Choose a RAP template e.g. RAP Mail Template and select 'Finish'.
  • The project has been created and there should also be a new Run/Debug configuration. See Run -> Run Configurations... There should be a new configuration in the 'RAP Application' section. Select it and click on 'Run'.
  • The browser tab should now open and adter a few seconds the application will be visible.
This completes the first post. I hope there will be more to follow.