Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to? / RCP with service plug-in and EJB3 interaction
icon5.gif  How to? / RCP with service plug-in and EJB3 interaction [message #523696] Sun, 28 March 2010 20:39 Go to next message
Sebastian is currently offline SebastianFriend
Messages: 61
Registered: March 2010
Member
Hi,

I'm quite unsure about how to design an RCP using a service plug-in which interacts with an EJB service bean. Maybe you have a quite good idea?

Here the general overview:
On the backend side there's an EJB3 pojo representing a project containing the fields id and name, which is made persistent using a database (CMP).
There's a stateless session bean providing services via RMI, let's name it ProjectServiceBean.

Now, an RCP should be developed to create/read/write project pojo's managed by the EJB3 service/container.
The project object is not revealed to EJB client, i.e. a value transfer object ist used: ProjectValue.

Now, the RCP application shall access those projects and interact with the ProjectServiceBean to get all projects (list), add, remove and change.
For EJB abstraction another plug-in is to be developed to provide services to other plugins via framework.
So OSGi-service would provide actually the same services like list, add, remove, change.

Questions
So how would you encapsulate/present the data on the model-side?
Would you wrap-up that ProjectValue using another wrapper pojo? Especially with regards to databinding maybe in a table viewer using PropertyChangeSupport.

Would you use a bean within the rcp model shown below and update that repository using events of/to OSGi-service?
public class ProjectValueWrapper {
	PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
	private ProjectValue value;
	private Set<ProjectValueWrapper > list;

	public ProjectValueWrapper (String text) {
                value = new ProjectValue();
		list = new HashSet<ProjectValueWrapper>();
	}

	public void addPropertyChangeListener(PropertyChangeListener listener) {
		changeSupport.addPropertyChangeListener(listener);
	}

	public void removePropertyChangeListener(PropertyChangeListener listener) {
		changeSupport.removePropertyChangeListener(listener);
	}

	public String getText() {
		return value.getText();
	}

	public void setText(String text) {
                String t = getText();
                value.setText(text);
		changeSupport.firePropertyChange("text", t, text);
	}

	public Set<ProjectValueWrapper> getList() {
		if (list == null)
			return null;
		return new HashSet<ProjectValueWrapper>(list);
	}

	public void setList(Set<ProjectValueWrapper> list) {
		if (list != null)
			list = new HashSet<ProjectValueWrapper>(list);
		changeSupport.firePropertyChange("list", this.list, this.list = list);
	}

	public boolean hasListeners(String propertyName) {
		return changeSupport.hasListeners(propertyName);
	}
}


What is your opinion on that issue particularly with regards to best practises?

Cheers,
Sebastian



[Updated on: Sun, 28 March 2010 21:07]

Report message to a moderator

Re: How to? / RCP with service plug-in and EJB3 interaction [message #523763 is a reply to message #523696] Mon, 29 March 2010 08:49 Go to previous message
Sebastian is currently offline SebastianFriend
Messages: 61
Registered: March 2010
Member
Hey,

I was just thinking on the whole thing again and came to the following conclusion:

1. EJB3 entity bean still a pojo
2. Adding PropertyChangeSupport to transfer object
3. DTO will be used in UI/by OSGi service, which itself interacts with the EJB service

Would you think this to be a good approach?

Cheers,
Sebastian
Previous Topic:Export to Multiple Platforms
Next Topic:Restart after an update?
Goto Forum:
  


Current Time: Fri Apr 19 03:34:31 GMT 2024

Powered by FUDForum. Page generated in 0.02633 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top