How to? / RCP with service plug-in and EJB3 interaction [message #523696] |
Sun, 28 March 2010 20:39 |
Sebastian 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03457 seconds