Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Phantom resources are discarded
Phantom resources are discarded [message #273167] Thu, 30 September 2004 21:15 Go to next message
Eclipse UserFriend
Originally posted by: vgrishchenko.serena.com

Hi,

I'm seeing some inconsistent behavior when I clear sync info for a folder
that was just deleted. In my handler of IResourceDelta.REMOVED I'm clearing
sync info for such folders. If that folder already contains phantom
resources they are preserved and ISynchronizer.getSyncInfo() returns
previously stored bytes for those resources, but in case when there are
normal resources under that folder that have sync info set their sync info
is cleared, i.e. no phantoms are left. Is it expected? I'm on 2.1.

Thanks,
Vladimir.
Re: Phantom resources are discarded [message #273195 is a reply to message #273167] Fri, 01 October 2004 09:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dj_houghton.nospam.ca.ibm.com

I'm not sure I quite understand your scenerio. Can you describe your
situation step-by-step? Thanks.

Random notes:
- Phantom resources are used to represent resource which have been
deleted locally but still exist on a server. (server timestamps, etc is
stored in the sync bytes on that resource)

- when you flush the sync info on a folder, you have to specify a depth
parameter if you want the children cleared as well

- if you remove the sync info for a phantom resource and there is no
more sync info on it, then it will be removed from the workspace tree

Vladimir Grishchenko wrote:
> Hi,
>
> I'm seeing some inconsistent behavior when I clear sync info for a folder
> that was just deleted. In my handler of IResourceDelta.REMOVED I'm clearing
> sync info for such folders. If that folder already contains phantom
> resources they are preserved and ISynchronizer.getSyncInfo() returns
> previously stored bytes for those resources, but in case when there are
> normal resources under that folder that have sync info set their sync info
> is cleared, i.e. no phantoms are left. Is it expected? I'm on 2.1.
>
> Thanks,
> Vladimir.
>
>
Re: Phantom resources are discarded [message #273204 is a reply to message #273195] Fri, 01 October 2004 12:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vgrishchenko.serena.com

As far as I understand there is a difference between flushing and clearing
sync info, in particular you cannot flush sync info on a resource that does
not exist but you can clear it which results in deletion of a phantom
resource.

below is pseudo code

class MyChangeListener implements IResourceChangeListener {
resourceChanged(IResourceChangeEvent rce) {
if (a folder is removed) {
synchronizer.setSyncInfo(mypartner, folder, null);
}
}
}

Case 1

folder - has sync info
phantom file - has sync info

Case 2

folder - has sync info
normal file - has sync info

As a result of processing resource change event in MyChangeListener in case
1 member phantom file is preserved, i.e. synchronizer.getSyncInfo() returns
previously stored bytes for that file. However in case 2 member file is not
converted to a phantom resource and synchronizer.getSyncInfo() returns
null. I tested and if sync info is not explicitly cleared for that folder
members are conveted to phantoms.

Thanks.


"DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
news:cjjnjd$f2k$1@eclipse.org...
> I'm not sure I quite understand your scenerio. Can you describe your
> situation step-by-step? Thanks.
>
> Random notes:
> - Phantom resources are used to represent resource which have been
> deleted locally but still exist on a server. (server timestamps, etc is
> stored in the sync bytes on that resource)
>
> - when you flush the sync info on a folder, you have to specify a depth
> parameter if you want the children cleared as well
>
> - if you remove the sync info for a phantom resource and there is no
> more sync info on it, then it will be removed from the workspace tree
>
> Vladimir Grishchenko wrote:
> > Hi,
> >
> > I'm seeing some inconsistent behavior when I clear sync info for a
folder
> > that was just deleted. In my handler of IResourceDelta.REMOVED I'm
clearing
> > sync info for such folders. If that folder already contains phantom
> > resources they are preserved and ISynchronizer.getSyncInfo() returns
> > previously stored bytes for those resources, but in case when there are
> > normal resources under that folder that have sync info set their sync
info
> > is cleared, i.e. no phantoms are left. Is it expected? I'm on 2.1.
> >
> > Thanks,
> > Vladimir.
> >
> >
Re: Phantom resources are discarded [message #273217 is a reply to message #273204] Fri, 01 October 2004 16:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dj_houghton.nospam.ca.ibm.com

I wrote a test case and everything works ok. In both cases both the file
and folder were completely removed from the tree and were not phantoms
and had no sync info. Here is my test case. If you have any problems
please enter a bug report against Platform/Resources. Thanks.

public void testSetInListener() {
IProject project =
getWorkspace().getRoot().getProject("myproject");
final IFolder folder = project.getFolder("folder");
IFile file = folder.getFile("file.txt");
final QualifiedName partner = new
QualifiedName("org.eclipse.core.tests.resources", "#testListener");
byte[] syncInfo = "my sync info".getBytes();
final ISynchronizer synchronizer =
getWorkspace().getSynchronizer();
synchronizer.add(partner);

// set up the resource change listener
IResourceChangeListener listener = new IResourceChangeListener() {

public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta = event.getDelta();
if (delta == null) return;
IResourceDelta childDelta =
delta.findMember(folder.getFullPath());
if (childDelta == null) return;
if (childDelta.getKind() != IResourceDelta.REMOVED) return;
try {
synchronizer.setSyncInfo(partner, folder, null);
} catch (CoreException e) {
fail("0.0", e);
}
}
};
getWorkspace().addResourceChangeListener(listener,
IResourceChangeEvent.POST_AUTO_BUILD);

// case 1 - regular folder with phantom file
// setup
ensureExistsInWorkspace(new IResource[] { project, folder,
file}, true);
try {
synchronizer.setSyncInfo(partner, folder, syncInfo);
synchronizer.setSyncInfo(partner, file, syncInfo);
assertTrue("1.0", folder.exists());
assertTrue("1.1", file.exists());
assertEquals("1.2", syncInfo,
synchronizer.getSyncInfo(partner, folder));
assertEquals("1.3", syncInfo,
synchronizer.getSyncInfo(partner, file));
// make the file a phantom
file.delete(IResource.FORCE, getMonitor());
assertTrue("1.4", file.isPhantom());
assertEquals("1.5", syncInfo,
synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("1.99.5", e);
}
try {
// remove the folder
folder.delete(IResource.FORCE, getMonitor());
} catch (CoreException e) {
fail("1.99.6", e);
}
// check post conditions
assertTrue("1.6", !folder.exists());
assertTrue("1.7", !file.exists());
assertTrue("1.8", !folder.isPhantom());
assertTrue("1.9", !file.isPhantom());
try {
assertNull("1.10", synchronizer.getSyncInfo(partner, folder));
assertNull("1.11", synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("1.99.8", e);
}

// case 2 - regular folder with regular file
// setup
ensureExistsInWorkspace(new IResource[] { project, folder,
file}, true);
try {
synchronizer.setSyncInfo(partner, folder, syncInfo);
synchronizer.setSyncInfo(partner, file, syncInfo);
assertTrue("2.0", folder.exists());
assertTrue("2.1", file.exists());
assertEquals("2.2", syncInfo,
synchronizer.getSyncInfo(partner, folder));
assertEquals("2.3", syncInfo,
synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("2.99.3", e);
}
// remove the folder
try {
folder.delete(IResource.FORCE, getMonitor());
} catch (CoreException e) {
fail("2.99.4", e);
}
// check post conditions
assertTrue("2.4", !folder.exists());
assertTrue("2.5", !file.exists());
assertTrue("2.6", !folder.isPhantom());
assertTrue("2.7", !file.isPhantom());
try {
assertNull("2.8", synchronizer.getSyncInfo(partner, folder));
assertNull("2.9", synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("2.99.6", e);
}

// cleanup
getWorkspace().removeResourceChangeListener(listener);
try {
synchronizer.flushSyncInfo(partner, project,
IResource.DEPTH_INFINITE);
} catch (CoreException e) {
fail("2.99.7", e);
}
synchronizer.remove(partner);
}

Vladimir Grishchenko wrote:
> As far as I understand there is a difference between flushing and clearing
> sync info, in particular you cannot flush sync info on a resource that does
> not exist but you can clear it which results in deletion of a phantom
> resource.
>
> below is pseudo code
>
> class MyChangeListener implements IResourceChangeListener {
> resourceChanged(IResourceChangeEvent rce) {
> if (a folder is removed) {
> synchronizer.setSyncInfo(mypartner, folder, null);
> }
> }
> }
>
> Case 1
>
> folder - has sync info
> phantom file - has sync info
>
> Case 2
>
> folder - has sync info
> normal file - has sync info
>
> As a result of processing resource change event in MyChangeListener in case
> 1 member phantom file is preserved, i.e. synchronizer.getSyncInfo() returns
> previously stored bytes for that file. However in case 2 member file is not
> converted to a phantom resource and synchronizer.getSyncInfo() returns
> null. I tested and if sync info is not explicitly cleared for that folder
> members are conveted to phantoms.
>
> Thanks.
>
>
> "DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
> news:cjjnjd$f2k$1@eclipse.org...
>
>>I'm not sure I quite understand your scenerio. Can you describe your
>>situation step-by-step? Thanks.
>>
>>Random notes:
>>- Phantom resources are used to represent resource which have been
>>deleted locally but still exist on a server. (server timestamps, etc is
>>stored in the sync bytes on that resource)
>>
>>- when you flush the sync info on a folder, you have to specify a depth
>>parameter if you want the children cleared as well
>>
>>- if you remove the sync info for a phantom resource and there is no
>>more sync info on it, then it will be removed from the workspace tree
>>
>>Vladimir Grishchenko wrote:
>>
>>>Hi,
>>>
>>>I'm seeing some inconsistent behavior when I clear sync info for a
>
> folder
>
>>>that was just deleted. In my handler of IResourceDelta.REMOVED I'm
>
> clearing
>
>>>sync info for such folders. If that folder already contains phantom
>>>resources they are preserved and ISynchronizer.getSyncInfo() returns
>>>previously stored bytes for those resources, but in case when there are
>>>normal resources under that folder that have sync info set their sync
>
> info
>
>>>is cleared, i.e. no phantoms are left. Is it expected? I'm on 2.1.
>>>
>>>Thanks,
>>>Vladimir.
>>>
>>>
>
>
>
Re: Phantom resources are discarded [message #273230 is a reply to message #273217] Fri, 01 October 2004 19:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vgrishchenko.serena.com

Against what release did you run it? I noticed it on 2.1.2, will double
check.

Let me see if understand it right. Phantom folder deletion via
setSyncInfo(... null) should result in deletion of its phantom members, i.e.
case 1 is anomaly if it holds. This makes sense, otherwise there would be no
way to discover orphan phantoms unless their exact paths are known.


"DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
news:cjkcs4$oof$1@eclipse.org...
> I wrote a test case and everything works ok. In both cases both the file
> and folder were completely removed from the tree and were not phantoms
> and had no sync info. Here is my test case. If you have any problems
> please enter a bug report against Platform/Resources. Thanks.
>
> public void testSetInListener() {
> IProject project =
> getWorkspace().getRoot().getProject("myproject");
> final IFolder folder = project.getFolder("folder");
> IFile file = folder.getFile("file.txt");
> final QualifiedName partner = new
> QualifiedName("org.eclipse.core.tests.resources", "#testListener");
> byte[] syncInfo = "my sync info".getBytes();
> final ISynchronizer synchronizer =
> getWorkspace().getSynchronizer();
> synchronizer.add(partner);
>
> // set up the resource change listener
> IResourceChangeListener listener = new IResourceChangeListener()
{
>
> public void resourceChanged(IResourceChangeEvent event) {
> IResourceDelta delta = event.getDelta();
> if (delta == null) return;
> IResourceDelta childDelta =
> delta.findMember(folder.getFullPath());
> if (childDelta == null) return;
> if (childDelta.getKind() != IResourceDelta.REMOVED)
return;
> try {
> synchronizer.setSyncInfo(partner, folder, null);
> } catch (CoreException e) {
> fail("0.0", e);
> }
> }
> };
> getWorkspace().addResourceChangeListener(listener,
> IResourceChangeEvent.POST_AUTO_BUILD);
>
> // case 1 - regular folder with phantom file
> // setup
> ensureExistsInWorkspace(new IResource[] { project, folder,
> file}, true);
> try {
> synchronizer.setSyncInfo(partner, folder, syncInfo);
> synchronizer.setSyncInfo(partner, file, syncInfo);
> assertTrue("1.0", folder.exists());
> assertTrue("1.1", file.exists());
> assertEquals("1.2", syncInfo,
> synchronizer.getSyncInfo(partner, folder));
> assertEquals("1.3", syncInfo,
> synchronizer.getSyncInfo(partner, file));
> // make the file a phantom
> file.delete(IResource.FORCE, getMonitor());
> assertTrue("1.4", file.isPhantom());
> assertEquals("1.5", syncInfo,
> synchronizer.getSyncInfo(partner, file));
> } catch (CoreException e) {
> fail("1.99.5", e);
> }
> try {
> // remove the folder
> folder.delete(IResource.FORCE, getMonitor());
> } catch (CoreException e) {
> fail("1.99.6", e);
> }
> // check post conditions
> assertTrue("1.6", !folder.exists());
> assertTrue("1.7", !file.exists());
> assertTrue("1.8", !folder.isPhantom());
> assertTrue("1.9", !file.isPhantom());
> try {
> assertNull("1.10", synchronizer.getSyncInfo(partner,
folder));
> assertNull("1.11", synchronizer.getSyncInfo(partner, file));
> } catch (CoreException e) {
> fail("1.99.8", e);
> }
>
> // case 2 - regular folder with regular file
> // setup
> ensureExistsInWorkspace(new IResource[] { project, folder,
> file}, true);
> try {
> synchronizer.setSyncInfo(partner, folder, syncInfo);
> synchronizer.setSyncInfo(partner, file, syncInfo);
> assertTrue("2.0", folder.exists());
> assertTrue("2.1", file.exists());
> assertEquals("2.2", syncInfo,
> synchronizer.getSyncInfo(partner, folder));
> assertEquals("2.3", syncInfo,
> synchronizer.getSyncInfo(partner, file));
> } catch (CoreException e) {
> fail("2.99.3", e);
> }
> // remove the folder
> try {
> folder.delete(IResource.FORCE, getMonitor());
> } catch (CoreException e) {
> fail("2.99.4", e);
> }
> // check post conditions
> assertTrue("2.4", !folder.exists());
> assertTrue("2.5", !file.exists());
> assertTrue("2.6", !folder.isPhantom());
> assertTrue("2.7", !file.isPhantom());
> try {
> assertNull("2.8", synchronizer.getSyncInfo(partner, folder));
> assertNull("2.9", synchronizer.getSyncInfo(partner, file));
> } catch (CoreException e) {
> fail("2.99.6", e);
> }
>
> // cleanup
> getWorkspace().removeResourceChangeListener(listener);
> try {
> synchronizer.flushSyncInfo(partner, project,
> IResource.DEPTH_INFINITE);
> } catch (CoreException e) {
> fail("2.99.7", e);
> }
> synchronizer.remove(partner);
> }
>
> Vladimir Grishchenko wrote:
> > As far as I understand there is a difference between flushing and
clearing
> > sync info, in particular you cannot flush sync info on a resource that
does
> > not exist but you can clear it which results in deletion of a phantom
> > resource.
> >
> > below is pseudo code
> >
> > class MyChangeListener implements IResourceChangeListener {
> > resourceChanged(IResourceChangeEvent rce) {
> > if (a folder is removed) {
> > synchronizer.setSyncInfo(mypartner, folder, null);
> > }
> > }
> > }
> >
> > Case 1
> >
> > folder - has sync info
> > phantom file - has sync info
> >
> > Case 2
> >
> > folder - has sync info
> > normal file - has sync info
> >
> > As a result of processing resource change event in MyChangeListener in
case
> > 1 member phantom file is preserved, i.e. synchronizer.getSyncInfo()
returns
> > previously stored bytes for that file. However in case 2 member file is
not
> > converted to a phantom resource and synchronizer.getSyncInfo() returns
> > null. I tested and if sync info is not explicitly cleared for that
folder
> > members are conveted to phantoms.
> >
> > Thanks.
> >
> >
> > "DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
> > news:cjjnjd$f2k$1@eclipse.org...
> >
> >>I'm not sure I quite understand your scenerio. Can you describe your
> >>situation step-by-step? Thanks.
> >>
> >>Random notes:
> >>- Phantom resources are used to represent resource which have been
> >>deleted locally but still exist on a server. (server timestamps, etc is
> >>stored in the sync bytes on that resource)
> >>
> >>- when you flush the sync info on a folder, you have to specify a depth
> >>parameter if you want the children cleared as well
> >>
> >>- if you remove the sync info for a phantom resource and there is no
> >>more sync info on it, then it will be removed from the workspace tree
> >>
> >>Vladimir Grishchenko wrote:
> >>
> >>>Hi,
> >>>
> >>>I'm seeing some inconsistent behavior when I clear sync info for a
> >
> > folder
> >
> >>>that was just deleted. In my handler of IResourceDelta.REMOVED I'm
> >
> > clearing
> >
> >>>sync info for such folders. If that folder already contains phantom
> >>>resources they are preserved and ISynchronizer.getSyncInfo() returns
> >>>previously stored bytes for those resources, but in case when there are
> >>>normal resources under that folder that have sync info set their sync
> >
> > info
> >
> >>>is cleared, i.e. no phantoms are left. Is it expected? I'm on 2.1.
> >>>
> >>>Thanks,
> >>>Vladimir.
> >>>
> >>>
> >
> >
> >
Re: Phantom resources are discarded [message #273238 is a reply to message #273230] Sat, 02 October 2004 08:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dj_houghton.nospam.ca.ibm.com

I ran this against 2.1.2.

Yes, when a phantom folder is finally removed, its children are removed
as well. This is somewhat less than optimal if the "root" of your sync
info isn't the project or an immediate child.

Out of curiousity, what are you using the sync info for? Phantom
resources are used to represent resource which exist on a repo but have
been deleted locally. That's one thing that I don't understand about
your resource change listener...how are you determining that you have a
local deletion if you are removing the phantom folder yourself? Unless
of course the folder is the sync root for your tree.


Vladimir Grishchenko wrote:
> Against what release did you run it? I noticed it on 2.1.2, will double
> check.
>
> Let me see if understand it right. Phantom folder deletion via
> setSyncInfo(... null) should result in deletion of its phantom members, i.e.
> case 1 is anomaly if it holds. This makes sense, otherwise there would be no
> way to discover orphan phantoms unless their exact paths are known.
>
>
> "DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
> news:cjkcs4$oof$1@eclipse.org...
>
>>I wrote a test case and everything works ok. In both cases both the file
>>and folder were completely removed from the tree and were not phantoms
>>and had no sync info. Here is my test case. If you have any problems
>>please enter a bug report against Platform/Resources. Thanks.
>>
>> public void testSetInListener() {
>> IProject project =
>>getWorkspace().getRoot().getProject("myproject");
>> final IFolder folder = project.getFolder("folder");
>> IFile file = folder.getFile("file.txt");
>> final QualifiedName partner = new
>>QualifiedName("org.eclipse.core.tests.resources", "#testListener");
>> byte[] syncInfo = "my sync info".getBytes();
>> final ISynchronizer synchronizer =
>>getWorkspace().getSynchronizer();
>> synchronizer.add(partner);
>>
>> // set up the resource change listener
>> IResourceChangeListener listener = new IResourceChangeListener()
>
> {
>
>> public void resourceChanged(IResourceChangeEvent event) {
>> IResourceDelta delta = event.getDelta();
>> if (delta == null) return;
>> IResourceDelta childDelta =
>>delta.findMember(folder.getFullPath());
>> if (childDelta == null) return;
>> if (childDelta.getKind() != IResourceDelta.REMOVED)
>
> return;
>
>> try {
>> synchronizer.setSyncInfo(partner, folder, null);
>> } catch (CoreException e) {
>> fail("0.0", e);
>> }
>> }
>> };
>> getWorkspace().addResourceChangeListener(listener,
>>IResourceChangeEvent.POST_AUTO_BUILD);
>>
>> // case 1 - regular folder with phantom file
>> // setup
>> ensureExistsInWorkspace(new IResource[] { project, folder,
>>file}, true);
>> try {
>> synchronizer.setSyncInfo(partner, folder, syncInfo);
>> synchronizer.setSyncInfo(partner, file, syncInfo);
>> assertTrue("1.0", folder.exists());
>> assertTrue("1.1", file.exists());
>> assertEquals("1.2", syncInfo,
>>synchronizer.getSyncInfo(partner, folder));
>> assertEquals("1.3", syncInfo,
>>synchronizer.getSyncInfo(partner, file));
>> // make the file a phantom
>> file.delete(IResource.FORCE, getMonitor());
>> assertTrue("1.4", file.isPhantom());
>> assertEquals("1.5", syncInfo,
>>synchronizer.getSyncInfo(partner, file));
>> } catch (CoreException e) {
>> fail("1.99.5", e);
>> }
>> try {
>> // remove the folder
>> folder.delete(IResource.FORCE, getMonitor());
>> } catch (CoreException e) {
>> fail("1.99.6", e);
>> }
>> // check post conditions
>> assertTrue("1.6", !folder.exists());
>> assertTrue("1.7", !file.exists());
>> assertTrue("1.8", !folder.isPhantom());
>> assertTrue("1.9", !file.isPhantom());
>> try {
>> assertNull("1.10", synchronizer.getSyncInfo(partner,
>
> folder));
>
>> assertNull("1.11", synchronizer.getSyncInfo(partner, file));
>> } catch (CoreException e) {
>> fail("1.99.8", e);
>> }
>>
>> // case 2 - regular folder with regular file
>> // setup
>> ensureExistsInWorkspace(new IResource[] { project, folder,
>>file}, true);
>> try {
>> synchronizer.setSyncInfo(partner, folder, syncInfo);
>> synchronizer.setSyncInfo(partner, file, syncInfo);
>> assertTrue("2.0", folder.exists());
>> assertTrue("2.1", file.exists());
>> assertEquals("2.2", syncInfo,
>>synchronizer.getSyncInfo(partner, folder));
>> assertEquals("2.3", syncInfo,
>>synchronizer.getSyncInfo(partner, file));
>> } catch (CoreException e) {
>> fail("2.99.3", e);
>> }
>> // remove the folder
>> try {
>> folder.delete(IResource.FORCE, getMonitor());
>> } catch (CoreException e) {
>> fail("2.99.4", e);
>> }
>> // check post conditions
>> assertTrue("2.4", !folder.exists());
>> assertTrue("2.5", !file.exists());
>> assertTrue("2.6", !folder.isPhantom());
>> assertTrue("2.7", !file.isPhantom());
>> try {
>> assertNull("2.8", synchronizer.getSyncInfo(partner, folder));
>> assertNull("2.9", synchronizer.getSyncInfo(partner, file));
>> } catch (CoreException e) {
>> fail("2.99.6", e);
>> }
>>
>> // cleanup
>> getWorkspace().removeResourceChangeListener(listener);
>> try {
>> synchronizer.flushSyncInfo(partner, project,
>>IResource.DEPTH_INFINITE);
>> } catch (CoreException e) {
>> fail("2.99.7", e);
>> }
>> synchronizer.remove(partner);
>> }
>>
>>Vladimir Grishchenko wrote:
>>
>>>As far as I understand there is a difference between flushing and
>
> clearing
>
>>>sync info, in particular you cannot flush sync info on a resource that
>
> does
>
>>>not exist but you can clear it which results in deletion of a phantom
>>>resource.
>>>
>>>below is pseudo code
>>>
>>>class MyChangeListener implements IResourceChangeListener {
>>> resourceChanged(IResourceChangeEvent rce) {
>>> if (a folder is removed) {
>>> synchronizer.setSyncInfo(mypartner, folder, null);
>>> }
>>> }
>>>}
>>>
>>>Case 1
>>>
>>>folder - has sync info
>>> phantom file - has sync info
>>>
>>>Case 2
>>>
>>>folder - has sync info
>>> normal file - has sync info
>>>
>>>As a result of processing resource change event in MyChangeListener in
>
> case
>
>>>1 member phantom file is preserved, i.e. synchronizer.getSyncInfo()
>
> returns
>
>>>previously stored bytes for that file. However in case 2 member file is
>
> not
>
>>>converted to a phantom resource and synchronizer.getSyncInfo() returns
>>>null. I tested and if sync info is not explicitly cleared for that
>
> folder
>
>>>members are conveted to phantoms.
>>>
>>>Thanks.
>>>
>>>
>>>"DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
>>>news:cjjnjd$f2k$1@eclipse.org...
>>>
>>>
>>>>I'm not sure I quite understand your scenerio. Can you describe your
>>>>situation step-by-step? Thanks.
>>>>
>>>>Random notes:
>>>>- Phantom resources are used to represent resource which have been
>>>>deleted locally but still exist on a server. (server timestamps, etc is
>>>>stored in the sync bytes on that resource)
>>>>
>>>>- when you flush the sync info on a folder, you have to specify a depth
>>>>parameter if you want the children cleared as well
>>>>
>>>>- if you remove the sync info for a phantom resource and there is no
>>>>more sync info on it, then it will be removed from the workspace tree
>>>>
>>>>Vladimir Grishchenko wrote:
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>I'm seeing some inconsistent behavior when I clear sync info for a
>>>
>>>folder
>>>
>>>
>>>>>that was just deleted. In my handler of IResourceDelta.REMOVED I'm
>>>
>>>clearing
>>>
>>>
>>>>>sync info for such folders. If that folder already contains phantom
>>>>>resources they are preserved and ISynchronizer.getSyncInfo() returns
>>>>>previously stored bytes for those resources, but in case when there are
>>>>>normal resources under that folder that have sync info set their sync
>>>
>>>info
>>>
>>>
>>>>>is cleared, i.e. no phantoms are left. Is it expected? I'm on 2.1.
>>>>>
>>>>>Thanks,
>>>>>Vladimir.
>>>>>
>>>>>
>>>
>>>
>>>
>
>
Re: Phantom resources are discarded [message #273351 is a reply to message #273238] Mon, 04 October 2004 18:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vgrishchenko.serena.com

That's pretty much what I'm doing. My change listener no longer deletes sync
info for deleted folders. I don't really have a reason to keep phantom
folders because our repository has only virtual folders, i.e. there cannot
be a folder without members, and deletion of last folder member in the
repository automatically deletes its parent folder, that's the best way to
describe it. Because of that I originally thought I could just keep file
phantoms around but now understand why it is not possible, so I keep phantom
folders too. I'm pretty sure I saw the original problem but if your test
seem to cover the cases very well. Can you add another final assertion to
both cases which recreates both the folder and the file and makes sure sync
info is still null for both? That would be a better reflection of what my
code was doing before.

Thanks for your help.

"DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
news:cjm4vc$s94$1@eclipse.org...
> I ran this against 2.1.2.
>
> Yes, when a phantom folder is finally removed, its children are removed
> as well. This is somewhat less than optimal if the "root" of your sync
> info isn't the project or an immediate child.
>
> Out of curiousity, what are you using the sync info for? Phantom
> resources are used to represent resource which exist on a repo but have
> been deleted locally. That's one thing that I don't understand about
> your resource change listener...how are you determining that you have a
> local deletion if you are removing the phantom folder yourself? Unless
> of course the folder is the sync root for your tree.
>
>
> Vladimir Grishchenko wrote:
> > Against what release did you run it? I noticed it on 2.1.2, will double
> > check.
> >
> > Let me see if understand it right. Phantom folder deletion via
> > setSyncInfo(... null) should result in deletion of its phantom members,
i.e.
> > case 1 is anomaly if it holds. This makes sense, otherwise there would
be no
> > way to discover orphan phantoms unless their exact paths are known.
> >
> >
> > "DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
> > news:cjkcs4$oof$1@eclipse.org...
> >
> >>I wrote a test case and everything works ok. In both cases both the file
> >>and folder were completely removed from the tree and were not phantoms
> >>and had no sync info. Here is my test case. If you have any problems
> >>please enter a bug report against Platform/Resources. Thanks.
> >>
> >> public void testSetInListener() {
> >> IProject project =
> >>getWorkspace().getRoot().getProject("myproject");
> >> final IFolder folder = project.getFolder("folder");
> >> IFile file = folder.getFile("file.txt");
> >> final QualifiedName partner = new
> >>QualifiedName("org.eclipse.core.tests.resources", "#testListener");
> >> byte[] syncInfo = "my sync info".getBytes();
> >> final ISynchronizer synchronizer =
> >>getWorkspace().getSynchronizer();
> >> synchronizer.add(partner);
> >>
> >> // set up the resource change listener
> >> IResourceChangeListener listener = new
IResourceChangeListener()
> >
> > {
> >
> >> public void resourceChanged(IResourceChangeEvent event) {
> >> IResourceDelta delta = event.getDelta();
> >> if (delta == null) return;
> >> IResourceDelta childDelta =
> >>delta.findMember(folder.getFullPath());
> >> if (childDelta == null) return;
> >> if (childDelta.getKind() != IResourceDelta.REMOVED)
> >
> > return;
> >
> >> try {
> >> synchronizer.setSyncInfo(partner, folder, null);
> >> } catch (CoreException e) {
> >> fail("0.0", e);
> >> }
> >> }
> >> };
> >> getWorkspace().addResourceChangeListener(listener,
> >>IResourceChangeEvent.POST_AUTO_BUILD);
> >>
> >> // case 1 - regular folder with phantom file
> >> // setup
> >> ensureExistsInWorkspace(new IResource[] { project, folder,
> >>file}, true);
> >> try {
> >> synchronizer.setSyncInfo(partner, folder, syncInfo);
> >> synchronizer.setSyncInfo(partner, file, syncInfo);
> >> assertTrue("1.0", folder.exists());
> >> assertTrue("1.1", file.exists());
> >> assertEquals("1.2", syncInfo,
> >>synchronizer.getSyncInfo(partner, folder));
> >> assertEquals("1.3", syncInfo,
> >>synchronizer.getSyncInfo(partner, file));
> >> // make the file a phantom
> >> file.delete(IResource.FORCE, getMonitor());
> >> assertTrue("1.4", file.isPhantom());
> >> assertEquals("1.5", syncInfo,
> >>synchronizer.getSyncInfo(partner, file));
> >> } catch (CoreException e) {
> >> fail("1.99.5", e);
> >> }
> >> try {
> >> // remove the folder
> >> folder.delete(IResource.FORCE, getMonitor());
> >> } catch (CoreException e) {
> >> fail("1.99.6", e);
> >> }
> >> // check post conditions
> >> assertTrue("1.6", !folder.exists());
> >> assertTrue("1.7", !file.exists());
> >> assertTrue("1.8", !folder.isPhantom());
> >> assertTrue("1.9", !file.isPhantom());
> >> try {
> >> assertNull("1.10", synchronizer.getSyncInfo(partner,
> >
> > folder));
> >
> >> assertNull("1.11", synchronizer.getSyncInfo(partner,
file));
> >> } catch (CoreException e) {
> >> fail("1.99.8", e);
> >> }
> >>
> >> // case 2 - regular folder with regular file
> >> // setup
> >> ensureExistsInWorkspace(new IResource[] { project, folder,
> >>file}, true);
> >> try {
> >> synchronizer.setSyncInfo(partner, folder, syncInfo);
> >> synchronizer.setSyncInfo(partner, file, syncInfo);
> >> assertTrue("2.0", folder.exists());
> >> assertTrue("2.1", file.exists());
> >> assertEquals("2.2", syncInfo,
> >>synchronizer.getSyncInfo(partner, folder));
> >> assertEquals("2.3", syncInfo,
> >>synchronizer.getSyncInfo(partner, file));
> >> } catch (CoreException e) {
> >> fail("2.99.3", e);
> >> }
> >> // remove the folder
> >> try {
> >> folder.delete(IResource.FORCE, getMonitor());
> >> } catch (CoreException e) {
> >> fail("2.99.4", e);
> >> }
> >> // check post conditions
> >> assertTrue("2.4", !folder.exists());
> >> assertTrue("2.5", !file.exists());
> >> assertTrue("2.6", !folder.isPhantom());
> >> assertTrue("2.7", !file.isPhantom());
> >> try {
> >> assertNull("2.8", synchronizer.getSyncInfo(partner,
folder));
> >> assertNull("2.9", synchronizer.getSyncInfo(partner, file));
> >> } catch (CoreException e) {
> >> fail("2.99.6", e);
> >> }
> >>
> >> // cleanup
> >> getWorkspace().removeResourceChangeListener(listener);
> >> try {
> >> synchronizer.flushSyncInfo(partner, project,
> >>IResource.DEPTH_INFINITE);
> >> } catch (CoreException e) {
> >> fail("2.99.7", e);
> >> }
> >> synchronizer.remove(partner);
> >> }
> >>
> >>Vladimir Grishchenko wrote:
> >>
> >>>As far as I understand there is a difference between flushing and
> >
> > clearing
> >
> >>>sync info, in particular you cannot flush sync info on a resource that
> >
> > does
> >
> >>>not exist but you can clear it which results in deletion of a phantom
> >>>resource.
> >>>
> >>>below is pseudo code
> >>>
> >>>class MyChangeListener implements IResourceChangeListener {
> >>> resourceChanged(IResourceChangeEvent rce) {
> >>> if (a folder is removed) {
> >>> synchronizer.setSyncInfo(mypartner, folder, null);
> >>> }
> >>> }
> >>>}
> >>>
> >>>Case 1
> >>>
> >>>folder - has sync info
> >>> phantom file - has sync info
> >>>
> >>>Case 2
> >>>
> >>>folder - has sync info
> >>> normal file - has sync info
> >>>
> >>>As a result of processing resource change event in MyChangeListener in
> >
> > case
> >
> >>>1 member phantom file is preserved, i.e. synchronizer.getSyncInfo()
> >
> > returns
> >
> >>>previously stored bytes for that file. However in case 2 member file is
> >
> > not
> >
> >>>converted to a phantom resource and synchronizer.getSyncInfo() returns
> >>>null. I tested and if sync info is not explicitly cleared for that
> >
> > folder
> >
> >>>members are conveted to phantoms.
> >>>
> >>>Thanks.
> >>>
> >>>
> >>>"DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
> >>>news:cjjnjd$f2k$1@eclipse.org...
> >>>
> >>>
> >>>>I'm not sure I quite understand your scenerio. Can you describe your
> >>>>situation step-by-step? Thanks.
> >>>>
> >>>>Random notes:
> >>>>- Phantom resources are used to represent resource which have been
> >>>>deleted locally but still exist on a server. (server timestamps, etc
is
> >>>>stored in the sync bytes on that resource)
> >>>>
> >>>>- when you flush the sync info on a folder, you have to specify a
depth
> >>>>parameter if you want the children cleared as well
> >>>>
> >>>>- if you remove the sync info for a phantom resource and there is no
> >>>>more sync info on it, then it will be removed from the workspace tree
> >>>>
> >>>>Vladimir Grishchenko wrote:
> >>>>
> >>>>
> >>>>>Hi,
> >>>>>
> >>>>>I'm seeing some inconsistent behavior when I clear sync info for a
> >>>
> >>>folder
> >>>
> >>>
> >>>>>that was just deleted. In my handler of IResourceDelta.REMOVED I'm
> >>>
> >>>clearing
> >>>
> >>>
> >>>>>sync info for such folders. If that folder already contains phantom
> >>>>>resources they are preserved and ISynchronizer.getSyncInfo() returns
> >>>>>previously stored bytes for those resources, but in case when there
are
> >>>>>normal resources under that folder that have sync info set their sync
> >>>
> >>>info
> >>>
> >>>
> >>>>>is cleared, i.e. no phantoms are left. Is it expected? I'm on 2.1.
> >>>>>
> >>>>>Thanks,
> >>>>>Vladimir.
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >
> >
Re: Phantom resources are discarded [message #273384 is a reply to message #273351] Tue, 05 October 2004 09:18 Go to previous message
Eclipse UserFriend
Originally posted by: dj_houghton.nospam.ca.ibm.com

Here is the updated test case. (fyi: helper methods are in
EclipseWorkspaceTest...my class's superclass) It works ok for me. Let me
know if you have any problems or more questions.

public void testSetInListener() {
IProject project =
getWorkspace().getRoot().getProject("myproject");
final IFolder folder = project.getFolder("folder");
IFile file = folder.getFile("file.txt");
final QualifiedName partner = new
QualifiedName("org.eclipse.core.tests.resources", "#testListener");
byte[] syncInfo = "my sync info".getBytes();
final ISynchronizer synchronizer =
getWorkspace().getSynchronizer();
synchronizer.add(partner);

// set up the resource change listener
IResourceChangeListener listener = new IResourceChangeListener() {

public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta = event.getDelta();
if (delta == null) return;
IResourceDelta childDelta =
delta.findMember(folder.getFullPath());
if (childDelta == null) return;
if (childDelta.getKind() != IResourceDelta.REMOVED) return;
try {
synchronizer.setSyncInfo(partner, folder, null);
} catch (CoreException e) {
fail("0.0", e);
}
}
};
getWorkspace().addResourceChangeListener(listener,
IResourceChangeEvent.POST_AUTO_BUILD);

// case 1 - regular folder with phantom file
// setup
ensureExistsInWorkspace(new IResource[] { project, folder,
file}, true);
try {
synchronizer.setSyncInfo(partner, folder, syncInfo);
synchronizer.setSyncInfo(partner, file, syncInfo);
assertTrue("1.0", folder.exists());
assertTrue("1.1", file.exists());
assertEquals("1.2", syncInfo,
synchronizer.getSyncInfo(partner, folder));
assertEquals("1.3", syncInfo,
synchronizer.getSyncInfo(partner, file));
// make the file a phantom
file.delete(IResource.FORCE, getMonitor());
assertTrue("1.4", file.isPhantom());
assertEquals("1.5", syncInfo,
synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("1.99.5", e);
}
try {
// remove the folder
folder.delete(IResource.FORCE, getMonitor());
} catch (CoreException e) {
fail("1.99.6", e);
}
// check post conditions
assertTrue("1.6", !folder.exists());
assertTrue("1.7", !file.exists());
assertTrue("1.8", !folder.isPhantom());
assertTrue("1.9", !file.isPhantom());
try {
assertNull("1.10", synchronizer.getSyncInfo(partner, folder));
assertNull("1.11", synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("1.99.8", e);
}
// re-create the file and folder to ensure they don't have any
sync info set
try {
folder.create(IResource.NONE, true, getMonitor());
file.create(getRandomContents(), IResource.NONE, getMonitor());
assertNull("1.12", synchronizer.getSyncInfo(partner, folder));
assertNull("1.13", synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("1.99.9", e);
}

// case 2 - regular folder with regular file
// setup
ensureExistsInWorkspace(new IResource[] { project, folder,
file}, true);
try {
synchronizer.setSyncInfo(partner, folder, syncInfo);
synchronizer.setSyncInfo(partner, file, syncInfo);
assertTrue("2.0", folder.exists());
assertTrue("2.1", file.exists());
assertEquals("2.2", syncInfo,
synchronizer.getSyncInfo(partner, folder));
assertEquals("2.3", syncInfo,
synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("2.99.3", e);
}
// remove the folder
try {
folder.delete(IResource.FORCE, getMonitor());
} catch (CoreException e) {
fail("2.99.4", e);
}
// check post conditions
assertTrue("2.4", !folder.exists());
assertTrue("2.5", !file.exists());
assertTrue("2.6", !folder.isPhantom());
assertTrue("2.7", !file.isPhantom());
try {
assertNull("2.8", synchronizer.getSyncInfo(partner, folder));
assertNull("2.9", synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("2.99.6", e);
}

// re-create the file and folder to ensure they don't have any
sync info set
try {
folder.create(IResource.NONE, true, getMonitor());
file.create(getRandomContents(), IResource.NONE, getMonitor());
assertNull("2.10", synchronizer.getSyncInfo(partner, folder));
assertNull("2.11", synchronizer.getSyncInfo(partner, file));
} catch (CoreException e) {
fail("2.99.7", e);
}

// cleanup
getWorkspace().removeResourceChangeListener(listener);
try {
synchronizer.flushSyncInfo(partner, project,
IResource.DEPTH_INFINITE);
} catch (CoreException e) {
fail("4.99", e);
}
synchronizer.remove(partner);
}


Vladimir Grishchenko wrote:
> That's pretty much what I'm doing. My change listener no longer deletes sync
> info for deleted folders. I don't really have a reason to keep phantom
> folders because our repository has only virtual folders, i.e. there cannot
> be a folder without members, and deletion of last folder member in the
> repository automatically deletes its parent folder, that's the best way to
> describe it. Because of that I originally thought I could just keep file
> phantoms around but now understand why it is not possible, so I keep phantom
> folders too. I'm pretty sure I saw the original problem but if your test
> seem to cover the cases very well. Can you add another final assertion to
> both cases which recreates both the folder and the file and makes sure sync
> info is still null for both? That would be a better reflection of what my
> code was doing before.
>
> Thanks for your help.
>
> "DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
> news:cjm4vc$s94$1@eclipse.org...
>
>>I ran this against 2.1.2.
>>
>>Yes, when a phantom folder is finally removed, its children are removed
>>as well. This is somewhat less than optimal if the "root" of your sync
>>info isn't the project or an immediate child.
>>
>>Out of curiousity, what are you using the sync info for? Phantom
>>resources are used to represent resource which exist on a repo but have
>>been deleted locally. That's one thing that I don't understand about
>>your resource change listener...how are you determining that you have a
>>local deletion if you are removing the phantom folder yourself? Unless
>>of course the folder is the sync root for your tree.
>>
>>
>>Vladimir Grishchenko wrote:
>>
>>>Against what release did you run it? I noticed it on 2.1.2, will double
>>>check.
>>>
>>>Let me see if understand it right. Phantom folder deletion via
>>>setSyncInfo(... null) should result in deletion of its phantom members,
>
> i.e.
>
>>>case 1 is anomaly if it holds. This makes sense, otherwise there would
>
> be no
>
>>>way to discover orphan phantoms unless their exact paths are known.
>>>
>>>
>>>"DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
>>>news:cjkcs4$oof$1@eclipse.org...
>>>
>>>
>>>>I wrote a test case and everything works ok. In both cases both the file
>>>>and folder were completely removed from the tree and were not phantoms
>>>>and had no sync info. Here is my test case. If you have any problems
>>>>please enter a bug report against Platform/Resources. Thanks.
>>>>
>>>> public void testSetInListener() {
>>>> IProject project =
>>>>getWorkspace().getRoot().getProject("myproject");
>>>> final IFolder folder = project.getFolder("folder");
>>>> IFile file = folder.getFile("file.txt");
>>>> final QualifiedName partner = new
>>>>QualifiedName("org.eclipse.core.tests.resources", "#testListener");
>>>> byte[] syncInfo = "my sync info".getBytes();
>>>> final ISynchronizer synchronizer =
>>>>getWorkspace().getSynchronizer();
>>>> synchronizer.add(partner);
>>>>
>>>> // set up the resource change listener
>>>> IResourceChangeListener listener = new
>
> IResourceChangeListener()
>
>>>{
>>>
>>>
>>>> public void resourceChanged(IResourceChangeEvent event) {
>>>> IResourceDelta delta = event.getDelta();
>>>> if (delta == null) return;
>>>> IResourceDelta childDelta =
>>>>delta.findMember(folder.getFullPath());
>>>> if (childDelta == null) return;
>>>> if (childDelta.getKind() != IResourceDelta.REMOVED)
>>>
>>>return;
>>>
>>>
>>>> try {
>>>> synchronizer.setSyncInfo(partner, folder, null);
>>>> } catch (CoreException e) {
>>>> fail("0.0", e);
>>>> }
>>>> }
>>>> };
>>>> getWorkspace().addResourceChangeListener(listener,
>>>>IResourceChangeEvent.POST_AUTO_BUILD);
>>>>
>>>> // case 1 - regular folder with phantom file
>>>> // setup
>>>> ensureExistsInWorkspace(new IResource[] { project, folder,
>>>>file}, true);
>>>> try {
>>>> synchronizer.setSyncInfo(partner, folder, syncInfo);
>>>> synchronizer.setSyncInfo(partner, file, syncInfo);
>>>> assertTrue("1.0", folder.exists());
>>>> assertTrue("1.1", file.exists());
>>>> assertEquals("1.2", syncInfo,
>>>>synchronizer.getSyncInfo(partner, folder));
>>>> assertEquals("1.3", syncInfo,
>>>>synchronizer.getSyncInfo(partner, file));
>>>> // make the file a phantom
>>>> file.delete(IResource.FORCE, getMonitor());
>>>> assertTrue("1.4", file.isPhantom());
>>>> assertEquals("1.5", syncInfo,
>>>>synchronizer.getSyncInfo(partner, file));
>>>> } catch (CoreException e) {
>>>> fail("1.99.5", e);
>>>> }
>>>> try {
>>>> // remove the folder
>>>> folder.delete(IResource.FORCE, getMonitor());
>>>> } catch (CoreException e) {
>>>> fail("1.99.6", e);
>>>> }
>>>> // check post conditions
>>>> assertTrue("1.6", !folder.exists());
>>>> assertTrue("1.7", !file.exists());
>>>> assertTrue("1.8", !folder.isPhantom());
>>>> assertTrue("1.9", !file.isPhantom());
>>>> try {
>>>> assertNull("1.10", synchronizer.getSyncInfo(partner,
>>>
>>>folder));
>>>
>>>
>>>> assertNull("1.11", synchronizer.getSyncInfo(partner,
>
> file));
>
>>>> } catch (CoreException e) {
>>>> fail("1.99.8", e);
>>>> }
>>>>
>>>> // case 2 - regular folder with regular file
>>>> // setup
>>>> ensureExistsInWorkspace(new IResource[] { project, folder,
>>>>file}, true);
>>>> try {
>>>> synchronizer.setSyncInfo(partner, folder, syncInfo);
>>>> synchronizer.setSyncInfo(partner, file, syncInfo);
>>>> assertTrue("2.0", folder.exists());
>>>> assertTrue("2.1", file.exists());
>>>> assertEquals("2.2", syncInfo,
>>>>synchronizer.getSyncInfo(partner, folder));
>>>> assertEquals("2.3", syncInfo,
>>>>synchronizer.getSyncInfo(partner, file));
>>>> } catch (CoreException e) {
>>>> fail("2.99.3", e);
>>>> }
>>>> // remove the folder
>>>> try {
>>>> folder.delete(IResource.FORCE, getMonitor());
>>>> } catch (CoreException e) {
>>>> fail("2.99.4", e);
>>>> }
>>>> // check post conditions
>>>> assertTrue("2.4", !folder.exists());
>>>> assertTrue("2.5", !file.exists());
>>>> assertTrue("2.6", !folder.isPhantom());
>>>> assertTrue("2.7", !file.isPhantom());
>>>> try {
>>>> assertNull("2.8", synchronizer.getSyncInfo(partner,
>
> folder));
>
>>>> assertNull("2.9", synchronizer.getSyncInfo(partner, file));
>>>> } catch (CoreException e) {
>>>> fail("2.99.6", e);
>>>> }
>>>>
>>>> // cleanup
>>>> getWorkspace().removeResourceChangeListener(listener);
>>>> try {
>>>> synchronizer.flushSyncInfo(partner, project,
>>>>IResource.DEPTH_INFINITE);
>>>> } catch (CoreException e) {
>>>> fail("2.99.7", e);
>>>> }
>>>> synchronizer.remove(partner);
>>>> }
>>>>
>>>>Vladimir Grishchenko wrote:
>>>>
>>>>
>>>>>As far as I understand there is a difference between flushing and
>>>
>>>clearing
>>>
>>>
>>>>>sync info, in particular you cannot flush sync info on a resource that
>>>
>>>does
>>>
>>>
>>>>>not exist but you can clear it which results in deletion of a phantom
>>>>>resource.
>>>>>
>>>>>below is pseudo code
>>>>>
>>>>>class MyChangeListener implements IResourceChangeListener {
>>>>> resourceChanged(IResourceChangeEvent rce) {
>>>>> if (a folder is removed) {
>>>>> synchronizer.setSyncInfo(mypartner, folder, null);
>>>>> }
>>>>> }
>>>>>}
>>>>>
>>>>>Case 1
>>>>>
>>>>>folder - has sync info
>>>>> phantom file - has sync info
>>>>>
>>>>>Case 2
>>>>>
>>>>>folder - has sync info
>>>>> normal file - has sync info
>>>>>
>>>>>As a result of processing resource change event in MyChangeListener in
>>>
>>>case
>>>
>>>
>>>>>1 member phantom file is preserved, i.e. synchronizer.getSyncInfo()
>>>
>>>returns
>>>
>>>
>>>>>previously stored bytes for that file. However in case 2 member file is
>>>
>>>not
>>>
>>>
>>>>>converted to a phantom resource and synchronizer.getSyncInfo() returns
>>>>>null. I tested and if sync info is not explicitly cleared for that
>>>
>>>folder
>>>
>>>
>>>>>members are conveted to phantoms.
>>>>>
>>>>>Thanks.
>>>>>
>>>>>
>>>>>"DJ Houghton" <dj_houghton@nospam.ca.ibm.com> wrote in message
>>>>>news:cjjnjd$f2k$1@eclipse.org...
>>>>>
>>>>>
>>>>>
>>>>>>I'm not sure I quite understand your scenerio. Can you describe your
>>>>>>situation step-by-step? Thanks.
>>>>>>
>>>>>>Random notes:
>>>>>>- Phantom resources are used to represent resource which have been
>>>>>>deleted locally but still exist on a server. (server timestamps, etc
>
> is
>
>>>>>>stored in the sync bytes on that resource)
>>>>>>
>>>>>>- when you flush the sync info on a folder, you have to specify a
>
> depth
>
>>>>>>parameter if you want the children cleared as well
>>>>>>
>>>>>>- if you remove the sync info for a phantom resource and there is no
>>>>>>more sync info on it, then it will be removed from the workspace tree
>>>>>>
>>>>>>Vladimir Grishchenko wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi,
>>>>>>>
>>>>>>>I'm seeing some inconsistent behavior when I clear sync info for a
>>>>>
>>>>>folder
>>>>>
>>>>>
>>>>>
>>>>>>>that was just deleted. In my handler of IResourceDelta.REMOVED I'm
>>>>>
>>>>>clearing
>>>>>
>>>>>
>>>>>
>>>>>>>sync info for such folders. If that folder already contains phantom
>>>>>>>resources they are preserved and ISynchronizer.getSyncInfo() returns
>>>>>>>previously stored bytes for those resources, but in case when there
>
> are
>
>>>>>>>normal resources under that folder that have sync info set their sync
>>>>>
>>>>>info
>>>>>
>>>>>
>>>>>
>>>>>>>is cleared, i.e. no phantoms are left. Is it expected? I'm on 2.1.
>>>>>>>
>>>>>>>Thanks,
>>>>>>>Vladimir.
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>
>
>
Previous Topic:Automatic check-out of plugin projects into workspace for Eclipse end-users
Next Topic:3.01 cannot read workspace correctly
Goto Forum:
  


Current Time: Sat Oct 25 10:40:15 EDT 2025

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

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

Back to the top