platform-vcm-home/docs/online/team3.1/logical-physical-public.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : jlemieux 1.1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 :     <html>
3 :     <head>
4 :     <title>Support Logical Resources</title>
5 :     </head>
6 :     <body>
7 :     <table border="0" cellspacing="5" cellpadding="2" width="100%">
8 :     <tbody>
9 :     <tr>
10 :     <td align="left" valign="top" bgcolor="#0080c0"> <b><font
11 :     color="#ffffff" face="Arial,Helvetica"> Eclipse 3.1 - Plan item</font></b>
12 :     </td>
13 :     </tr>
14 :     </tbody>
15 :     </table>
16 :     <h1>Support Logical Resources</h1>
17 :     This document outlines the state of the Eclipse Platform <strong>Support
18 :     Logical Resources</strong> plan item. Interested parties should review
19 :     this document and verify that their use cases are reflected in the
20 :     requirements then later that the solution provided satisfies their
21 :     needs. Feedback is strongly encouraged and may be provided on the
22 :     platform-team-dev mailing list or in the <a
23 :     href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=37723">bug report</a>
24 :     for this plan item.
25 :     <p class="MsoNormal">This is the plan item:</p>
26 :     <blockquote>
27 :     <p>"<em>The Eclipse Platform supports a strong physical view of
28 :     projects, files, and folders in the workspace. However, there are many
29 :     situations where a physical view is not the most salient or useful for
30 :     many purposes. In some cases, multiple distinct objects happen to be
31 :     stored in a single file, like an archive. Conversely, in other cases,
32 :     something that is logically a single object is stored across multiple
33 :     files. This discrepancy between logical and physical creates problems
34 :     for common operations such as searching, comparing, and versioning,
35 :     which need to work in the physical realm. Eclipse should support some
36 :     way of mapping between a logical view and the physical organization of
37 :     files on disk.</em>"</p>
38 :     <p>Last Modified: July 2nd, 2003<br>
39 :     </p>
40 :     </blockquote>
41 :     <h1>Motivation</h1>
42 :     <p>By definition Eclipse supports logical resources. It's a "an open
43 :     extensible IDE for anything and nothing in particular". The
44 :     applications that are built with it can be tailored to a particular
45 :     problem domain and the workbench extensions can be used to provide
46 :     support for any logical model. What Eclipse really doesn't support is
47 :     integrating tools at the logical model. In order to integrate two
48 :     plugins into Eclipse either the two plugins have to know about each
49 :     other, or both plugins have to depend on some common plugin. While the
50 :     first option is satisfactory for a few cases, the second case is the
51 :     most common and the most problematic. To illustrate, the Eclipse SDK
52 :     contains several plugins that are based on the Resources plugin (e.g.
53 :     Team, Search, Compare, JDT). When an application is packaged based on
54 :     the SDK, because the plugins in the SDK are resource based that is the
55 :     common integration point between plug-ins.<br>
56 :     </p>
57 :     <p>As you will see later, even the users of the SDK (JDT+CVS+Resources)
58 :     can observe some of the problems associated with the lack of support
59 :     for logical resources and the implicit mapping to physical resources.
60 :     The lack of a logical integration point causes the co-existance of
61 :     plugins in Eclipse to be error prone for the user. The next sections
62 :     will examine the relationships between logical and physical resources
63 :     and outline the visible problems with Eclipse 3.0.</p>
64 :     <h2>Existing Bugs</h2>
65 :     <p>Bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=32582">32582</a>
66 :     logical to physical mapping problem , 1 model element = 2 Files problem<br>
67 :     Bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=3979">3979</a>
68 :     [CVS Decorator] show version info works incorrectly for sub packages
69 :     (1GFDIEB)</p>
70 :     <h2>Logical Resources Defined<br>
71 :     </h2>
72 :     <p>Whereas logical resources are elements of the application that model
73 :     the data/processes of a particular problem domain, the physical
74 :     resources are the file system resources (e.g. files and folders) into
75 :     which an application will eventually transform their application model
76 :     for storage. Applications that don't use file system resources are not
77 :     being considered as part of this plan item. For example, an application
78 :     that stores it's application data directly into a database.</p>
79 :     <p>The following table enumerates concrete examples of how logical and
80 :     physical resources are used in current applications integrated into
81 :     Eclipse.</p>
82 :     <p><a name="#table1"></a>Table 1: Example logical to physical uses</p>
83 :     <table width="100%" border="1">
84 :     <tbody>
85 :     <tr>
86 :     <td width="23%">
87 :     <div align="center"><strong>Relationships</strong></div>
88 :     </td>
89 :     <td width="77%">
90 :     <div align="center"><strong>Examples</strong></div>
91 :     </td>
92 :     </tr>
93 :     <tr>
94 :     <td>
95 :     <p>logical (1) &lt;-&gt; (*) physical</p>
96 :     <p>one logical to many physical</p>
97 :     </td>
98 :     <td valign="top">
99 :     <p><a name="#1a"></a>(<strong>1a</strong>) EJB maps to several
100 :     physical files: (WSAD + XDE Tester). This is the most common case we
101 :     have found. </p>
102 :     <blockquote>
103 :     <p>/src/org/app/bean.java<br>
104 :     /src/org/app/beanr.java<br>
105 :     /src/org/app/beanlocal.java</p>
106 :     </blockquote>
107 :     <p><em>Note: If one of the logical resource's files was deleted
108 :     who would remember that the file used to exist and is an outgoing
109 :     deletion or that there is an incoming addition to the logical resource?</em></p>
110 :     <p><a name="#1b"></a>(<strong>1b</strong>) Composite Object
111 :     (logical) maps to several changed physical resources. (Rational XDE)</p>
112 :     <p><em>Note</em>: <em>With 1 to many relationship there is
113 :     always the complication that arises if the logical element maps to
114 :     files in an other project? This would cause many problems in the
115 :     current Team plugin.</em></p>
116 :     </td>
117 :     </tr>
118 :     <tr>
119 :     <td>
120 :     <p>logical (*) &lt;-&gt; (1) physical</p>
121 :     <p>many logical to one physical</p>
122 :     </td>
123 :     <td valign="top">
124 :     <p><a name="#2a"></a>(<strong>2a</strong>) Methods in a class map
125 :     to their containing class file. (JDT)</p>
126 :     <p><a name="#2b"></a>(<strong>2b</strong>) Archive files (zip,
127 :     jar) can be seen as a logical and the contents of the archive all map
128 :     to the same physical.(JTD + all)</p>
129 :     </td>
130 :     </tr>
131 :     <tr>
132 :     <td>
133 :     <p>logical (1) &lt;-&gt; (1) physical</p>
134 :     <p>one logical to one physical</p>
135 :     </td>
136 :     <td valign="top">
137 :     <p><a name="#3a"></a>(<strong>3a</strong>) A Java Package maps to
138 :     a folder but a package does not include sub folders (e.g. they are
139 :     shallow). (JDT)</p>
140 :     <p><a name="#3b"></a>(<strong>3b</strong>) A UML class maps to a
141 :     file. For example, in a UML application a class could be stored in a
142 :     single file called 'x435dsds.umlclass'. The reason it's a logical is
143 :     that the user of the application will never be concerned about the
144 :     actual file name or even the folder it's stored in. (XDE)</p>
145 :     </td>
146 :     </tr>
147 :     </tbody>
148 :     </table>
149 :     <h1>Complaints<br>
150 :     </h1>
151 :     <p>The following complaints are representative of bug reports and
152 :     requirements received from several Eclipse users and developers.<br>
153 :     </p>
154 :     <h2>Complaint 1: Not very adaptable</h2>
155 :     <p>Object contributions and decorators are key mechanisms for providing
156 :     rich integration between tools. Using object contributions and
157 :     adaptable objects, any plugin can provide actions and decorators that
158 :     will show in another plugin's view. </p>
159 :     <p>Since IResource is the lowest common integration class and is
160 :     strongly mapped to its physical storage as files and folders, the
161 :     integration point for actions and decorators cannot be the logical
162 :     types in the view. The actions will consequently use the adaptable type
163 :     from the selection to perform the action or the decorator the resource
164 :     from the getImage request.</p>
165 :     <p>Here is an example to illustrate the problem with the CVS plugin.
166 :     When running a CVS commit action in the packages view the action
167 :     doesn't know that the IFolder is a Java package and is a shallow
168 :     namespace. It will use the selection and traverse the selected
169 :     IContainer using IContainer.members() and commit all child resources.
170 :     This is the same when the CVS outgoing decorator is shown on a package.
171 :     It will reflect the deep outgoing state of the IContainer. This can
172 :     lead to unexpected behavior because the user expected the action to run
173 :     on the model that the action was displayed on.</p>
174 :     <p>Example object contribution for the CVS commit action:</p>
175 :     <pre>&lt;extension point="org.eclipse.ui.popupMenus"&gt;<br> &lt;objectContribution<br> objectClass="org.eclipse.core.resources.IResource"<br> adaptable="true"<br> id="org.eclipse.team.ccvs.ui.IResourceContributions"&gt;<br> &lt;filter<br> name="projectPersistentProperty"<br> value="org.eclipse.team.core.repository=org.eclipse.team.cvs.core.cvsnature"&gt;<br> &lt;/filter&gt;<br> &lt;action<br> label="Commit"<br> tooltip="Commit resource to CVS repository"<br> class="org.eclipse.team.internal.ccvs.ui.actions.CommitAction"<br> menubarPath="team.main/group3"<br> id="org.eclipse.team.ccvs.ui.commit"&gt;<br> &lt;/action&gt;<br> &lt;objectContribution&gt;<br>&lt;/extension&gt;<br></pre>
176 :     <p>Example code run in the commit action to calculate the resources to
177 :     commit:</p>
178 :     <pre>public static Object[] getSelectedAdaptables(ISelection selection) {<br> ArrayList result = null;<br> if (!selection.isEmpty()) {<br> result = new ArrayList();<br> Iterator elements = ((IStructuredSelection) selection).iterator();<br> while (elements.hasNext()) {<br> Object adapter = getAdapter(elements.next(), IResource.class);<br> if (c.isInstance(adapter)) {<br> result.add(adapter);<br> }<br> }<br> }<br> if (result != null &amp;&amp; !result.isEmpty()) {<br> return (Object[])result.toArray((Object[])Array.newInstance(IResource.class, result.size()));<br> }<br> return (Object[])Array.newInstance(IResource.class, 0);<br>}</pre>
179 :     <p>Example code for defining an IResource adaptable decorator:</p>
180 :     <pre>&lt;extension<br> point="org.eclipse.ui.decorators"&gt;<br> &lt;decorator objectClass="org.eclipse.core.resources.IResource"<br> adaptable="true"<br> label="%DecoratorStandard.name"<br> state="false"<br> lightweight= "true"<br> quadrant = "BOTTOM_RIGHT"<br> class="org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator"<br> id="org.eclipse.team.cvs.ui.decorator"&gt;<br> &lt;description&gt;<br> %DecoratorStandard.desc<br> &lt;/description&gt;<br> &lt;/decorator&gt;<br>&lt;/extension&gt;</pre>
181 :     <h2>Complaint 2: Decorators</h2>
182 :     <p>When the CVS decorator decorates a logical container in a view, the
183 :     desire is to decorate parents with the dirty indicator if one or more
184 :     of their logical children are dirty. To do this properly, the decorator
185 :     would need to query the dirty status of each of the logical children of
186 :     the container. This can be a costly operation as each child may itself
187 :     be a logical container. We have optimized the dirty decoration by
188 :     caching folder dirty states. This optimization becomes far more
189 :     complicated with logical models where the caching must be based on this
190 :     alternate model (i.e. the state must be cached for each model).</p>
191 :     <p> In addition, often decorators rely on&nbsp;IResource change events
192 :     to re-calculate some new state. In the case of a logical elements
193 :     representing several physical resources there is no easy way of
194 :     associated a IResource change event to its files and the actual logical
195 :     element.</p>
196 :     <h2>Complaint 3: Presentation of mixed logical models<br>
197 :     </h2>
198 :     <p>It would be nice to see the Java logical view in the Synchronize
199 :     view, in the navigator, or in dialogs contributed by other plug-ins
200 :     besides JDT. However, the entries in these views
201 :     may not be IResources so an IResource independent mapping mechanism
202 :     would be required. A workaround for this problem is demonstrated by the
203 :     Search plug-in which allows for plug-ins to integrate with other tools
204 :     by contributing domain specific pages. JDT contributes a JDT search
205 :     page to the view and shows logical Java elements. This solution however
206 :     doesn't allow showing mixed logical models in the same widget, which is
207 :     required in the Synchronize View and Navigator.<br>
208 :     </p>
209 :     Also, if an action prompts the user, for example to add resources to
210 :     CVS, what icons and labels are used in the dialog? It would be nice to
211 :     show those that are most familiar to the user. <br>
212 :     <br>
213 :     There are two levels of logical model presentation:<br>
214 :     <ul>
215 :     <li>Need for full access to a logical model that would allow building
216 :     a dynamic UI. This would include mapping from an IResource to a logical
217 :     element.<br>
218 :     </li>
219 :     </ul>
220 :     <ul>
221 :     <li>Need name and icon for a logical element to display in simple
222 :     dialogs.<br>
223 :     </li>
224 :     </ul>
225 :     <h2>Complaint 4: Change Sets</h2>
226 :     <p>Consider a user's action as a logical change, for example, the user
227 :     renames a class using the JDT refactoring action. In the user's mind he
228 :     'renamed a class' and as a result there has been many other file
229 :     changes. Currently there is not way of capturing these logical actions
230 :     and associating the set of affected resources. This problem manifests
231 :     itself more in tools where almost every change to the model has side
232 :     effects.</p>
233 :     <h2>Complaint 5: Participating in operations</h2>
234 :     Some logical models may want to participate and even restrict the kinds
235 :     of operations are
236 :     allowed on theirs files. For example, if a logical element is composed
237 :     of three files, the users should not be allowed to move, or delete them
238 :     individually. In essence, a way of vetoing the move/rename, copy, or
239 :     delete would be useful to ensure a coherant logical model.<br>
240 :     <h2>Complaint 6: IResource based views in the IDE</h2>
241 :     There are several views in the workbench IDE that could be used by
242 :     logical models but are currently too tied to resources. For example,
243 :     the problems and tasks views have a resource column and works uniquely
244 :     on IResource markers. This means that if a logical model provides
245 :     problems and tasks the problems and tasks views cannot be used to show
246 :     the logical element instead of the file.<br>
247 :     <h2>Complaint 7: Merging can't consider all files related to a logical
248 :     element</h2>
249 :     When merging a logical element the repository may find a conflict in
250 :     one of the files that is part of the logical element. The repository
251 :     tool will typically fetch the revisions for the conflicting file so
252 :     that a comparison can be shown to the user. But since the repository
253 :     tool doesn't know that other files are part of the logical resource,
254 :     the comparison shown to the user doesn't have access to the correct
255 :     revisions of the other files. This is a problem because it then becomes
256 :     impossible to implement a comparison that has access to all the
257 :     revisions of the logical element's files.<br>
258 :     <h1>Discussion</h1>
259 :     <p>Given the number of different complaints about logical resource
260 :     support indicates that this is indeed a large problem space. If we plan
261 :     on addressing any of the complaints for 3.1, we will have to scope the
262 :     solution to address a subset of the complaints. I propose the following
263 :     grouping of the complaints:<br>
264 :     </p>
265 :     <p><span style="font-weight: bold;">Adaptables: Related to providing a
266 :     richer adaptable interface between plug-ins<br>
267 :     </span>Complaint 1: Not very adaptable<br>
268 :     Complaint 2: Decorators<br>
269 :     Complaint 7: Merging can't consider files related to a logical element<br>
270 :     </p>
271 :     <p><span style="font-weight: bold;">Presentation of logical models:
272 :     Related to exposing a non-resource based data modeling framework</span><br>
273 :     Complaint 6: IResource based views in the IDE<br>
274 :     Complaint 3: Presentation of mixed logical models<br>
275 :     </p>
276 :     <span style="font-weight: bold;">Others</span><br>
277 :     Complaint 4: Change Sets<br>
278 :     Complaint 5: Participating in operations
279 :     <p>A common discussion in the community is the idea
280 :     that the resources plug-in should be generalized to become this generic
281 :     model, but in reality it wasn't designed as such and although it
282 :     contains common model services such as eventing and threading, it was
283 :     explicitly designed to model the file system. Changes to the resources
284 :     plug-in would be a major breaking API change and not acceptable to the
285 :     community. <br>
286 :     </p>
287 :     <p>For 3.1 we will only address the Adaptables group of complaints. See
288 :     <a href="logical-physical-adaptables.html">Solution 1: Support Logical
289 :     Resources - Adaptables</a> for a discussion on a possible solution.<br>
290 :     </p>
291 :     </body>
292 :     </html>