Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Unloading an XSDResource
Unloading an XSDResource [message #33355] Fri, 21 November 2003 20:32 Go to next message
Lance Phillips is currently offline Lance Phillips
Messages: 210
Registered: July 2009
Senior Member
Ed,
We have a ResourceSet that has both XsdResources and XmiResources.
Those resources represent the IResources of an IProject in the Workspace.
Upon deletion of an IResource with an underlying EmfResource, we want to
cleanup the EmfResource and remove it from the ResourceSet. That seems to
work fine for the XmiResources by simply doing a resource.unload() and then
a resourceSet.getResources().remove(resource). However, in the case of the
XsdResource, the unload seems to take several minutes. Is there a better
procedure to ensure everything gets cleaned up correctly?

thanks,

lp
Re: Unloading an XSDResource [message #33428 is a reply to message #33355] Sat, 22 November 2003 11:40 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Lance,

I've never tried unloading an XSDResourceImpl. The complex
include/import/redefine interdependencies between .xsd files makes unloading
just one .xsd resource likely not to work well. If you can get away with just
doing resource.getContents().clear() before tossing it away, that will perform
better. Do you need all the objects to be turned into EMF proxies? (It's very
expensive.)


Lance Phillips wrote:

> Ed,
> We have a ResourceSet that has both XsdResources and XmiResources.
> Those resources represent the IResources of an IProject in the Workspace.
> Upon deletion of an IResource with an underlying EmfResource, we want to
> cleanup the EmfResource and remove it from the ResourceSet. That seems to
> work fine for the XmiResources by simply doing a resource.unload() and then
> a resourceSet.getResources().remove(resource). However, in the case of the
> XsdResource, the unload seems to take several minutes. Is there a better
> procedure to ensure everything gets cleaned up correctly?
>
> thanks,
>
> lp
Re: Unloading an XSDResource [message #33480 is a reply to message #33428] Mon, 24 November 2003 14:13 Go to previous messageGo to next message
Lance Phillips is currently offline Lance Phillips
Messages: 210
Registered: July 2009
Senior Member
Thanks Ed... you are correct. That is much faster and works much better!

That leaves me one open issue : I have an XSD Resource that imports another
XSDResource. I have both resources in the workspace. If I delete the
imported resource and rebuild the workspace, I don't get any errors. If I
OPEN the remaining resource, then I get the errors. If I then restore the
imported resource and rebuild the errors don't go away regardless of what I
do. I've stepped through the validation code, the markers do get removed,
but running the schema.validate regens a new set of errors. I've verified
that both resources are present in the workspace.

Any ideas what I might still be missing?

thanks,

lp
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:3FBF4B27.F7B80244@ca.ibm.com...
> Lance,
>
> I've never tried unloading an XSDResourceImpl. The complex
> include/import/redefine interdependencies between .xsd files makes
unloading
> just one .xsd resource likely not to work well. If you can get away with
just
> doing resource.getContents().clear() before tossing it away, that will
perform
> better. Do you need all the objects to be turned into EMF proxies? (It's
very
> expensive.)
>
>
> Lance Phillips wrote:
>
> > Ed,
> > We have a ResourceSet that has both XsdResources and XmiResources.
> > Those resources represent the IResources of an IProject in the
Workspace.
> > Upon deletion of an IResource with an underlying EmfResource, we want to
> > cleanup the EmfResource and remove it from the ResourceSet. That seems
to
> > work fine for the XmiResources by simply doing a resource.unload() and
then
> > a resourceSet.getResources().remove(resource). However, in the case of
the
> > XsdResource, the unload seems to take several minutes. Is there a
better
> > procedure to ensure everything gets cleaned up correctly?
> >
> > thanks,
> >
> > lp
>
Re: Unloading an XSDResource [message #33514 is a reply to message #33480] Mon, 24 November 2003 14:24 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Lance,

There is no builder that does XSD validation. Only the editor does it as you
open the resource.


Lance Phillips wrote:

> Thanks Ed... you are correct. That is much faster and works much better!
>
> That leaves me one open issue : I have an XSD Resource that imports another
> XSDResource. I have both resources in the workspace. If I delete the
> imported resource and rebuild the workspace, I don't get any errors. If I
> OPEN the remaining resource, then I get the errors. If I then restore the
> imported resource and rebuild the errors don't go away regardless of what I
> do. I've stepped through the validation code, the markers do get removed,
> but running the schema.validate regens a new set of errors. I've verified
> that both resources are present in the workspace.
>
> Any ideas what I might still be missing?
>
> thanks,
>
> lp
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:3FBF4B27.F7B80244@ca.ibm.com...
> > Lance,
> >
> > I've never tried unloading an XSDResourceImpl. The complex
> > include/import/redefine interdependencies between .xsd files makes
> unloading
> > just one .xsd resource likely not to work well. If you can get away with
> just
> > doing resource.getContents().clear() before tossing it away, that will
> perform
> > better. Do you need all the objects to be turned into EMF proxies? (It's
> very
> > expensive.)
> >
> >
> > Lance Phillips wrote:
> >
> > > Ed,
> > > We have a ResourceSet that has both XsdResources and XmiResources.
> > > Those resources represent the IResources of an IProject in the
> Workspace.
> > > Upon deletion of an IResource with an underlying EmfResource, we want to
> > > cleanup the EmfResource and remove it from the ResourceSet. That seems
> to
> > > work fine for the XmiResources by simply doing a resource.unload() and
> then
> > > a resourceSet.getResources().remove(resource). However, in the case of
> the
> > > XsdResource, the unload seems to take several minutes. Is there a
> better
> > > procedure to ensure everything gets cleaned up correctly?
> > >
> > > thanks,
> > >
> > > lp
> >
Re: Unloading an XSDResource [message #33548 is a reply to message #33514] Mon, 24 November 2003 14:37 Go to previous messageGo to next message
Lance Phillips is currently offline Lance Phillips
Messages: 210
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C3B266.2A54E180
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Correct... we have a builder that is doing the validation and updating =
the task view. Here is a block of code from our validation logic...

final XSDSchema schema =3D xsdResource.getSchema();

//Clear all the existing errors and warnings
xsdResource.getErrors().clear();
xsdResource.getWarnings().clear();
schema.clearDiagnostics();

//Validate the schema, generating all new diagnostics
schema.validate();
final Iterator diagnostics =3D schema.getAllDiagnostics().iterator();
while(diagnostics.hasNext() ){
final XSDDiagnostic next =3D (XSDDiagnostic)diagnostics.next();
createProblemMarker(mapper.getIResource(), next);=20
}

I don't understand why I'm not getting errors when I delete the imported =
resource until I open the remaining resource and why I still get the =
errors after resoring the imported resource until I completely close the =
workspace and restart it. It is important to note that in debug mode, =
I've verified that the task list does get cleaned up properly... the =
problem seems to actually be in xsdValidation. In the first case, the =
schema.validate returns an empty diagnostic and in the last case it =
returns a non-empty diagnostic.

thanks,

lp

"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:3FC214B6.E2A88E@ca.ibm.com...
> Lance,
>=20
> There is no builder that does XSD validation. Only the editor does it =
as you
> open the resource.
>=20
>=20
> Lance Phillips wrote:
>=20
> > Thanks Ed... you are correct. That is much faster and works much =
better!
> >
> > That leaves me one open issue : I have an XSD Resource that imports =
another
> > XSDResource. I have both resources in the workspace. If I delete =
the
> > imported resource and rebuild the workspace, I don't get any errors. =
If I
> > OPEN the remaining resource, then I get the errors. If I then =
restore the
> > imported resource and rebuild the errors don't go away regardless of =
what I
> > do. I've stepped through the validation code, the markers do get =
removed,
> > but running the schema.validate regens a new set of errors. I've =
verified
> > that both resources are present in the workspace.
> >
> > Any ideas what I might still be missing?
> >
> > thanks,
> >
> > lp
> > "Ed Merks" <merks@ca.ibm.com> wrote in message
> > news:3FBF4B27.F7B80244@ca.ibm.com...
> > > Lance,
> > >
> > > I've never tried unloading an XSDResourceImpl. The complex
> > > include/import/redefine interdependencies between .xsd files makes
> > unloading
> > > just one .xsd resource likely not to work well. If you can get =
away with
> > just
> > > doing resource.getContents().clear() before tossing it away, that =
will
> > perform
> > > better. Do you need all the objects to be turned into EMF =
proxies? (It's
> > very
> > > expensive.)
> > >
> > >
> > > Lance Phillips wrote:
> > >
> > > > Ed,
> > > > We have a ResourceSet that has both XsdResources and =
XmiResources.
> > > > Those resources represent the IResources of an IProject in the
> > Workspace.
> > > > Upon deletion of an IResource with an underlying EmfResource, we =
want to
> > > > cleanup the EmfResource and remove it from the ResourceSet. =
That seems
> > to
> > > > work fine for the XmiResources by simply doing a =
resource.unload() and
> > then
> > > > a resourceSet.getResources().remove(resource). However, in the =
case of
> > the
> > > > XsdResource, the unload seems to take several minutes. Is there =
a
> > better
> > > > procedure to ensure everything gets cleaned up correctly?
> > > >
> > > > thanks,
> > > >
> > > > lp
> > >
>
------=_NextPart_000_0017_01C3B266.2A54E180
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Correct... we have a builder that is =
doing the=20
validation and updating the task view.&nbsp; Here is a block of code =
from our=20
validation logic...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>final XSDSchema schema =3D=20
xsdResource.getSchema();</FONT></DIV>
<DIV><FONT face=3DArial><FONT size=3D2><FONT face=3DArial=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//Clear all the existing errors and=20
warnings</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>xsdResource.getErrors().clear();</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>xsdResource.getWarnings().clear();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>schema.clearDiagnostics();</FONT></DIV>
<DIV><FONT face=3DArial><FONT size=3D2><FONT face=3DArial=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//Validate the schema, generating all =
new=20
diagnostics</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>schema.validate();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>final Iterator diagnostics =3D=20
schema.getAllDiagnostics().iterator();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>while(diagnostics.hasNext() =
){</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; final XSDDiagnostic =
next =3D=20
(XSDDiagnostic)diagnostics.next();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
createProblemMarker(mapper.getIResource(), next); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I don't understand why I'm not getting =
errors when=20
I delete the imported resource until I open the remaining resource and =
why I=20
still get the errors after resoring the imported resource until I =
completely=20
close the workspace and restart it.&nbsp; It is important to note that =
in debug=20
mode, I've verified that the task list does get cleaned up properly... =
the=20
problem seems to actually be in xsdValidation.&nbsp; In the first case, =
the=20
schema.validate returns an empty diagnostic and in the last case it =
returns a=20
non-empty diagnostic.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>lp</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Ed Merks" &lt;</FONT><A=20
href=3D"mailto:merks@ca.ibm.com"><FONT face=3DArial=20
size=3D2>merks@ca.ibm.com</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in message=20
</FONT><A href=3D"news:3FC214B6.E2A88E@ca.ibm.com"><FONT face=3DArial=20
size=3D2>news:3FC214B6.E2A88E@ca.ibm.com</FONT></A><FONT face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; Lance,<BR>&gt; =
<BR>&gt;=20
There is no builder that does XSD validation.&nbsp; Only the editor does =
it as=20
you<BR>&gt; open the resource.<BR>&gt; <BR>&gt; <BR>&gt; Lance Phillips=20
wrote:<BR>&gt; <BR>&gt; &gt; Thanks Ed... you&nbsp; are correct.&nbsp; =
That is=20
much faster and works much better!<BR>&gt; &gt;<BR>&gt; &gt; That leaves =
me one=20
open issue :&nbsp; I have an XSD Resource that imports another<BR>&gt; =
&gt;=20
XSDResource. I have both resources in the workspace.&nbsp; If I delete=20
the<BR>&gt; &gt; imported resource and rebuild the workspace, I don't =
get any=20
errors.&nbsp; If I<BR>&gt; &gt; OPEN the remaining resource, then I get =
the=20
errors.&nbsp; If I then restore the<BR>&gt; &gt; imported resource and =
rebuild=20
the errors don't go away regardless of what I<BR>&gt; &gt; do.&nbsp; =
I've=20
stepped through the validation code, the markers do get removed,<BR>&gt; =
&gt;=20
but running the schema.validate regens a new set of errors.&nbsp; I've=20
verified<BR>&gt; &gt; that both resources are present in the =
workspace.<BR>&gt;=20
&gt;<BR>&gt; &gt; Any ideas what I might still be missing?<BR>&gt; =
&gt;<BR>&gt;=20
&gt; thanks,<BR>&gt; &gt;<BR>&gt; &gt; lp<BR>&gt; &gt; "Ed Merks" =
&lt;</FONT><A=20
href=3D"mailto:merks@ca.ibm.com"><FONT face=3DArial=20
size=3D2>merks@ca.ibm.com</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in=20
message<BR>&gt; &gt; </FONT><A =
href=3D"news:3FBF4B27.F7B80244@ca.ibm.com"><FONT=20
face=3DArial size=3D2>news:3FBF4B27.F7B80244@ca.ibm.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt; &gt; &gt; Lance,<BR>&gt; &gt; &gt;<BR>&gt; &gt; =
&gt; I've=20
never tried unloading an XSDResourceImpl.&nbsp; The complex<BR>&gt; &gt; =
&gt;=20
include/import/redefine interdependencies between .xsd files =
makes<BR>&gt; &gt;=20
unloading<BR>&gt; &gt; &gt; just one .xsd resource likely not to work=20
well.&nbsp; If you can get away with<BR>&gt; &gt; just<BR>&gt; &gt; &gt; =
doing=20
resource.getContents().clear() before tossing it away, that will<BR>&gt; =
&gt;=20
perform<BR>&gt; &gt; &gt; better.&nbsp; Do you need all the objects to =
be turned=20
into EMF proxies?&nbsp; (It's<BR>&gt; &gt; very<BR>&gt; &gt; &gt;=20
expensive.)<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; Lance =
Phillips=20
wrote:<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; &gt; Ed,<BR>&gt; &gt; &gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; We have a ResourceSet that has both =
XsdResources=20
and XmiResources.<BR>&gt; &gt; &gt; &gt; Those resources represent the=20
IResources of an IProject in the<BR>&gt; &gt; Workspace.<BR>&gt; &gt; =
&gt; &gt;=20
Upon deletion of an IResource with an underlying EmfResource, we want =
to<BR>&gt;=20
&gt; &gt; &gt; cleanup the EmfResource and remove it from the =
ResourceSet.&nbsp;=20
That seems<BR>&gt; &gt; to<BR>&gt; &gt; &gt; &gt; work fine for the =
XmiResources=20
by simply doing&nbsp; a resource.unload() and<BR>&gt; &gt; then<BR>&gt; =
&gt;=20
&gt; &gt; a resourceSet.getResources().remove(resource).&nbsp;&n bsp; =
However, in=20
the case of<BR>&gt; &gt; the<BR>&gt; &gt; &gt; &gt; XsdResource, the =
unload=20
seems to take several minutes.&nbsp; Is there a<BR>&gt; &gt; =
better<BR>&gt; &gt;=20
&gt; &gt; procedure to ensure everything gets cleaned up =
correctly?<BR>&gt; &gt;=20
&gt; &gt;<BR>&gt; &gt; &gt; &gt; thanks,<BR>&gt; &gt; &gt; &gt;<BR>&gt; =
&gt;=20
&gt; &gt; lp<BR>&gt; &gt; &gt;<BR>&gt; </FONT></BODY></HTML>

------=_NextPart_000_0017_01C3B266.2A54E180--
Re: Unloading an XSDResource [message #33582 is a reply to message #33548] Mon, 24 November 2003 15:12 Go to previous message
Eclipse User
Originally posted by: merks.ca.ibm.com

--------------C4002DC1CB01E351231D7B4B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Lance,

I'm pretty confused. I definitely don't understand what's happening any
better than you...


Lance Phillips wrote:

> Correct... we have a builder that is doing the validation and updating
> the task view. Here is a block of code from our validation
> logic... final XSDSchema schema = xsdResource.getSchema(); //Clear all
> the existing errors and
> warningsxsdResource.getErrors().clear();xsdResource.getWarni ngs().clear();schema.clearDiagnostics(); //Validate
> the schema, generating all new diagnosticsschema.validate();final
> Iterator diagnostics =
> schema.getAllDiagnostics().iterator();while(diagnostics.hasN ext()
> ){ final XSDDiagnostic next = (XSDDiagnostic)diagnostics.next();
> createProblemMarker(mapper.getIResource(), next);} I don't understand
> why I'm not getting errors when I delete the imported resource until I
> open the remaining resource and why I still get the errors after
> resoring the imported resource until I completely close the workspace
> and restart it. It is important to note that in debug mode, I've
> verified that the task list does get cleaned up properly... the
> problem seems to actually be in xsdValidation. In the first case, the
> schema.validate returns an empty diagnostic and in the last case it
> returns a non-empty diagnostic. thanks, lp "Ed Merks"
> <merks@ca.ibm.com> wrote in message
> news:3FC214B6.E2A88E@ca.ibm.com...> Lance,
> >
> > There is no builder that does XSD validation. Only the editor does
> it as you
> > open the resource.
> >
> >
> > Lance Phillips wrote:
> >
> > > Thanks Ed... you are correct. That is much faster and works much
> better!
> > >
> > > That leaves me one open issue : I have an XSD Resource that
> imports another
> > > XSDResource. I have both resources in the workspace. If I delete
> the
> > > imported resource and rebuild the workspace, I don't get any
> errors. If I
> > > OPEN the remaining resource, then I get the errors. If I then
> restore the
> > > imported resource and rebuild the errors don't go away regardless
> of what I
> > > do. I've stepped through the validation code, the markers do get
> removed,
> > > but running the schema.validate regens a new set of errors. I've
> verified
> > > that both resources are present in the workspace.
> > >
> > > Any ideas what I might still be missing?
> > >
> > > thanks,
> > >
> > > lp
> > > "Ed Merks" <merks@ca.ibm.com> wrote in message
> > > news:3FBF4B27.F7B80244@ca.ibm.com...
> > > > Lance,
> > > >
> > > > I've never tried unloading an XSDResourceImpl. The complex
> > > > include/import/redefine interdependencies between .xsd files
> makes
> > > unloading
> > > > just one .xsd resource likely not to work well. If you can get
> away with
> > > just
> > > > doing resource.getContents().clear() before tossing it away,
> that will
> > > perform
> > > > better. Do you need all the objects to be turned into EMF
> proxies? (It's
> > > very
> > > > expensive.)
> > > >
> > > >
> > > > Lance Phillips wrote:
> > > >
> > > > > Ed,
> > > > > We have a ResourceSet that has both XsdResources and
> XmiResources.
> > > > > Those resources represent the IResources of an IProject in the
>
> > > Workspace.
> > > > > Upon deletion of an IResource with an underlying EmfResource,
> we want to
> > > > > cleanup the EmfResource and remove it from the ResourceSet.
> That seems
> > > to
> > > > > work fine for the XmiResources by simply doing a
> resource.unload() and
> > > then
> > > > > a resourceSet.getResources().remove(resource). However, in
> the case of
> > > the
> > > > > XsdResource, the unload seems to take several minutes. Is
> there a
> > > better
> > > > > procedure to ensure everything gets cleaned up correctly?
> > > > >
> > > > > thanks,
> > > > >
> > > > > lp
> > > >
> >

--------------C4002DC1CB01E351231D7B4B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Lance,
<p>I'm pretty confused.&nbsp; I definitely don't understand what's happening
any better than you...
<br>&nbsp;
<p>Lance Phillips wrote:
<blockquote TYPE=CITE><style></style>
<font face="Arial"><font size=-1>Correct...
we have a builder that is doing the validation and updating the task view.&nbsp;
Here is a block of code from our validation logic...</font></font>&nbsp;<font face="Arial"><font size=-1>final
XSDSchema schema = xsdResource.getSchema();</font></font>&nbsp;<font face="Arial"><font size=-1>//Clear
all the existing errors and warnings</font></font><font face="Arial"><font size=-1>xsdResource.getErrors().clear();</font></font><font face="Arial"><font size=-1>xsdResource.getWarnings().clear();</font></font><font face="Arial"><font size=-1>schema.clearDiagnostics();</font></font>&nbsp; <font face="Arial"><font size=-1>//Validate
the schema, generating all new diagnostics</font></font><font face="Arial"><font size=-1>schema.validate();</font></font><font face="Arial"><font size=-1>final
Iterator diagnostics = schema.getAllDiagnostics().iterator();</font></font><font face="Arial"><font size=-1>while(diagnostics.hasNext()
){</font></font><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp; final
XSDDiagnostic next = (XSDDiagnostic)diagnostics.next();</font></font><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;
createProblemMarker(mapper.getIResource(), next);</font></font><font face="Arial"><font size=-1>}</font></font>&nbsp;<font face="Arial"><font size=-1>I
don't understand why I'm not getting errors when I delete the imported
resource until I open the remaining resource and why I still get the errors
after resoring the imported resource until I completely close the workspace
and restart it.&nbsp; It is important to note that in debug mode, I've
verified that the task list does get cleaned up properly... the problem
seems to actually be in xsdValidation.&nbsp; In the first case, the schema.validate
returns an empty diagnostic and in the last case it returns a non-empty
diagnostic.</font></font>&nbsp;<font face="Arial"><font size=-1>thanks,</font></font>&nbsp;<font face="Arial"><font size=-1>lp</font></font>&nbsp;<font face="Arial"><font size=-1>"Ed
Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>> wrote
in message <a href="news:3FC214B6.E2A88E@ca.ibm.com">news:3FC214B6.E2A88E@ca.ibm.com</a>...</font></font><font face="Arial"><font size=-1>>
Lance,</font></font>
<br><font face="Arial"><font size=-1>></font></font>
<br><font face="Arial"><font size=-1>> There is no builder that does XSD
validation.&nbsp; Only the editor does it as you</font></font>
<br><font face="Arial"><font size=-1>> open the resource.</font></font>
<br><font face="Arial"><font size=-1>></font></font>
<br><font face="Arial"><font size=-1>></font></font>
<br><font face="Arial"><font size=-1>> Lance Phillips wrote:</font></font>
<br><font face="Arial"><font size=-1>></font></font>
<br><font face="Arial"><font size=-1>> > Thanks Ed... you&nbsp; are correct.&nbsp;
That is much faster and works much better!</font></font>
<br><font face="Arial"><font size=-1>> ></font></font>
<br><font face="Arial"><font size=-1>> > That leaves me one open issue
:&nbsp; I have an XSD Resource that imports another</font></font>
<br><font face="Arial"><font size=-1>> > XSDResource. I have both resources
in the workspace.&nbsp; If I delete the</font></font>
<br><font face="Arial"><font size=-1>> > imported resource and rebuild
the workspace, I don't get any errors.&nbsp; If I</font></font>
<br><font face="Arial"><font size=-1>> > OPEN the remaining resource, then
I get the errors.&nbsp; If I then restore the</font></font>
<br><font face="Arial"><font size=-1>> > imported resource and rebuild
the errors don't go away regardless of what I</font></font>
<br><font face="Arial"><font size=-1>> > do.&nbsp; I've stepped through
the validation code, the markers do get removed,</font></font>
<br><font face="Arial"><font size=-1>> > but running the schema.validate
regens a new set of errors.&nbsp; I've verified</font></font>
<br><font face="Arial"><font size=-1>> > that both resources are present
in the workspace.</font></font>
<br><font face="Arial"><font size=-1>> ></font></font>
<br><font face="Arial"><font size=-1>> > Any ideas what I might still be
missing?</font></font>
<br><font face="Arial"><font size=-1>> ></font></font>
<br><font face="Arial"><font size=-1>> > thanks,</font></font>
<br><font face="Arial"><font size=-1>> ></font></font>
<br><font face="Arial"><font size=-1>> > lp</font></font>
<br><font face="Arial"><font size=-1>> > "Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>>
wrote in message</font></font>
<br><font face="Arial"><font size=-1>> > <a href="news:3FBF4B27.F7B80244@ca.ibm.com">news:3FBF4B27.F7B80244@ca.ibm.com</a>...</font></font>
<br><font face="Arial"><font size=-1>> > > Lance,</font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>> > > I've never tried unloading an
XSDResourceImpl.&nbsp; The complex</font></font>
<br><font face="Arial"><font size=-1>> > > include/import/redefine interdependencies
between .xsd files makes</font></font>
<br><font face="Arial"><font size=-1>> > unloading</font></font>
<br><font face="Arial"><font size=-1>> > > just one .xsd resource likely
not to work well.&nbsp; If you can get away with</font></font>
<br><font face="Arial"><font size=-1>> > just</font></font>
<br><font face="Arial"><font size=-1>> > > doing resource.getContents().clear()
before tossing it away, that will</font></font>
<br><font face="Arial"><font size=-1>> > perform</font></font>
<br><font face="Arial"><font size=-1>> > > better.&nbsp; Do you need all
the objects to be turned into EMF proxies?&nbsp; (It's</font></font>
<br><font face="Arial"><font size=-1>> > very</font></font>
<br><font face="Arial"><font size=-1>> > > expensive.)</font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>> > > Lance Phillips wrote:</font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>> > > > Ed,</font></font>
<br><font face="Arial"><font size=-1>> > > >&nbsp;&nbsp;&nbsp;&nbsp; We
have a ResourceSet that has both XsdResources and XmiResources.</font></font>
<br><font face="Arial"><font size=-1>> > > > Those resources represent
the IResources of an IProject in the</font></font>
<br><font face="Arial"><font size=-1>> > Workspace.</font></font>
<br><font face="Arial"><font size=-1>> > > > Upon deletion of an IResource
with an underlying EmfResource, we want to</font></font>
<br><font face="Arial"><font size=-1>> > > > cleanup the EmfResource and
remove it from the ResourceSet.&nbsp; That seems</font></font>
<br><font face="Arial"><font size=-1>> > to</font></font>
<br><font face="Arial"><font size=-1>> > > > work fine for the XmiResources
by simply doing&nbsp; a resource.unload() and</font></font>
<br><font face="Arial"><font size=-1>> > then</font></font>
<br><font face="Arial"><font size=-1>> > > > a resourceSet.getResources().remove(resource).&nbsp;&n bsp;
However, in the case of</font></font>
<br><font face="Arial"><font size=-1>> > the</font></font>
<br><font face="Arial"><font size=-1>> > > > XsdResource, the unload seems
to take several minutes.&nbsp; Is there a</font></font>
<br><font face="Arial"><font size=-1>> > better</font></font>
<br><font face="Arial"><font size=-1>> > > > procedure to ensure everything
gets cleaned up correctly?</font></font>
<br><font face="Arial"><font size=-1>> > > ></font></font>
<br><font face="Arial"><font size=-1>> > > > thanks,</font></font>
<br><font face="Arial"><font size=-1>> > > ></font></font>
<br><font face="Arial"><font size=-1>> > > > lp</font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>></font></font></blockquote>
</html>

--------------C4002DC1CB01E351231D7B4B--
Re: Unloading an XSDResource [message #580973 is a reply to message #33355] Sat, 22 November 2003 11:40 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26126
Registered: July 2009
Senior Member
Lance,

I've never tried unloading an XSDResourceImpl. The complex
include/import/redefine interdependencies between .xsd files makes unloading
just one .xsd resource likely not to work well. If you can get away with just
doing resource.getContents().clear() before tossing it away, that will perform
better. Do you need all the objects to be turned into EMF proxies? (It's very
expensive.)


Lance Phillips wrote:

> Ed,
> We have a ResourceSet that has both XsdResources and XmiResources.
> Those resources represent the IResources of an IProject in the Workspace.
> Upon deletion of an IResource with an underlying EmfResource, we want to
> cleanup the EmfResource and remove it from the ResourceSet. That seems to
> work fine for the XmiResources by simply doing a resource.unload() and then
> a resourceSet.getResources().remove(resource). However, in the case of the
> XsdResource, the unload seems to take several minutes. Is there a better
> procedure to ensure everything gets cleaned up correctly?
>
> thanks,
>
> lp
Re: Unloading an XSDResource [message #581010 is a reply to message #33428] Mon, 24 November 2003 14:13 Go to previous message
Lance Phillips is currently offline Lance Phillips
Messages: 210
Registered: July 2009
Senior Member
Thanks Ed... you are correct. That is much faster and works much better!

That leaves me one open issue : I have an XSD Resource that imports another
XSDResource. I have both resources in the workspace. If I delete the
imported resource and rebuild the workspace, I don't get any errors. If I
OPEN the remaining resource, then I get the errors. If I then restore the
imported resource and rebuild the errors don't go away regardless of what I
do. I've stepped through the validation code, the markers do get removed,
but running the schema.validate regens a new set of errors. I've verified
that both resources are present in the workspace.

Any ideas what I might still be missing?

thanks,

lp
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:3FBF4B27.F7B80244@ca.ibm.com...
> Lance,
>
> I've never tried unloading an XSDResourceImpl. The complex
> include/import/redefine interdependencies between .xsd files makes
unloading
> just one .xsd resource likely not to work well. If you can get away with
just
> doing resource.getContents().clear() before tossing it away, that will
perform
> better. Do you need all the objects to be turned into EMF proxies? (It's
very
> expensive.)
>
>
> Lance Phillips wrote:
>
> > Ed,
> > We have a ResourceSet that has both XsdResources and XmiResources.
> > Those resources represent the IResources of an IProject in the
Workspace.
> > Upon deletion of an IResource with an underlying EmfResource, we want to
> > cleanup the EmfResource and remove it from the ResourceSet. That seems
to
> > work fine for the XmiResources by simply doing a resource.unload() and
then
> > a resourceSet.getResources().remove(resource). However, in the case of
the
> > XsdResource, the unload seems to take several minutes. Is there a
better
> > procedure to ensure everything gets cleaned up correctly?
> >
> > thanks,
> >
> > lp
>
Re: Unloading an XSDResource [message #581032 is a reply to message #33480] Mon, 24 November 2003 14:24 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26126
Registered: July 2009
Senior Member
Lance,

There is no builder that does XSD validation. Only the editor does it as you
open the resource.


Lance Phillips wrote:

> Thanks Ed... you are correct. That is much faster and works much better!
>
> That leaves me one open issue : I have an XSD Resource that imports another
> XSDResource. I have both resources in the workspace. If I delete the
> imported resource and rebuild the workspace, I don't get any errors. If I
> OPEN the remaining resource, then I get the errors. If I then restore the
> imported resource and rebuild the errors don't go away regardless of what I
> do. I've stepped through the validation code, the markers do get removed,
> but running the schema.validate regens a new set of errors. I've verified
> that both resources are present in the workspace.
>
> Any ideas what I might still be missing?
>
> thanks,
>
> lp
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:3FBF4B27.F7B80244@ca.ibm.com...
> > Lance,
> >
> > I've never tried unloading an XSDResourceImpl. The complex
> > include/import/redefine interdependencies between .xsd files makes
> unloading
> > just one .xsd resource likely not to work well. If you can get away with
> just
> > doing resource.getContents().clear() before tossing it away, that will
> perform
> > better. Do you need all the objects to be turned into EMF proxies? (It's
> very
> > expensive.)
> >
> >
> > Lance Phillips wrote:
> >
> > > Ed,
> > > We have a ResourceSet that has both XsdResources and XmiResources.
> > > Those resources represent the IResources of an IProject in the
> Workspace.
> > > Upon deletion of an IResource with an underlying EmfResource, we want to
> > > cleanup the EmfResource and remove it from the ResourceSet. That seems
> to
> > > work fine for the XmiResources by simply doing a resource.unload() and
> then
> > > a resourceSet.getResources().remove(resource). However, in the case of
> the
> > > XsdResource, the unload seems to take several minutes. Is there a
> better
> > > procedure to ensure everything gets cleaned up correctly?
> > >
> > > thanks,
> > >
> > > lp
> >
Re: Unloading an XSDResource [message #581055 is a reply to message #33514] Mon, 24 November 2003 14:37 Go to previous message
Lance Phillips is currently offline Lance Phillips
Messages: 210
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C3B266.2A54E180
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Correct... we have a builder that is doing the validation and updating =
the task view. Here is a block of code from our validation logic...

final XSDSchema schema =3D xsdResource.getSchema();

//Clear all the existing errors and warnings
xsdResource.getErrors().clear();
xsdResource.getWarnings().clear();
schema.clearDiagnostics();

//Validate the schema, generating all new diagnostics
schema.validate();
final Iterator diagnostics =3D schema.getAllDiagnostics().iterator();
while(diagnostics.hasNext() ){
final XSDDiagnostic next =3D (XSDDiagnostic)diagnostics.next();
createProblemMarker(mapper.getIResource(), next);=20
}

I don't understand why I'm not getting errors when I delete the imported =
resource until I open the remaining resource and why I still get the =
errors after resoring the imported resource until I completely close the =
workspace and restart it. It is important to note that in debug mode, =
I've verified that the task list does get cleaned up properly... the =
problem seems to actually be in xsdValidation. In the first case, the =
schema.validate returns an empty diagnostic and in the last case it =
returns a non-empty diagnostic.

thanks,

lp

"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:3FC214B6.E2A88E@ca.ibm.com...
> Lance,
>=20
> There is no builder that does XSD validation. Only the editor does it =
as you
> open the resource.
>=20
>=20
> Lance Phillips wrote:
>=20
> > Thanks Ed... you are correct. That is much faster and works much =
better!
> >
> > That leaves me one open issue : I have an XSD Resource that imports =
another
> > XSDResource. I have both resources in the workspace. If I delete =
the
> > imported resource and rebuild the workspace, I don't get any errors. =
If I
> > OPEN the remaining resource, then I get the errors. If I then =
restore the
> > imported resource and rebuild the errors don't go away regardless of =
what I
> > do. I've stepped through the validation code, the markers do get =
removed,
> > but running the schema.validate regens a new set of errors. I've =
verified
> > that both resources are present in the workspace.
> >
> > Any ideas what I might still be missing?
> >
> > thanks,
> >
> > lp
> > "Ed Merks" <merks@ca.ibm.com> wrote in message
> > news:3FBF4B27.F7B80244@ca.ibm.com...
> > > Lance,
> > >
> > > I've never tried unloading an XSDResourceImpl. The complex
> > > include/import/redefine interdependencies between .xsd files makes
> > unloading
> > > just one .xsd resource likely not to work well. If you can get =
away with
> > just
> > > doing resource.getContents().clear() before tossing it away, that =
will
> > perform
> > > better. Do you need all the objects to be turned into EMF =
proxies? (It's
> > very
> > > expensive.)
> > >
> > >
> > > Lance Phillips wrote:
> > >
> > > > Ed,
> > > > We have a ResourceSet that has both XsdResources and =
XmiResources.
> > > > Those resources represent the IResources of an IProject in the
> > Workspace.
> > > > Upon deletion of an IResource with an underlying EmfResource, we =
want to
> > > > cleanup the EmfResource and remove it from the ResourceSet. =
That seems
> > to
> > > > work fine for the XmiResources by simply doing a =
resource.unload() and
> > then
> > > > a resourceSet.getResources().remove(resource). However, in the =
case of
> > the
> > > > XsdResource, the unload seems to take several minutes. Is there =
a
> > better
> > > > procedure to ensure everything gets cleaned up correctly?
> > > >
> > > > thanks,
> > > >
> > > > lp
> > >
>
------=_NextPart_000_0017_01C3B266.2A54E180
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Correct... we have a builder that is =
doing the=20
validation and updating the task view.&nbsp; Here is a block of code =
from our=20
validation logic...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>final XSDSchema schema =3D=20
xsdResource.getSchema();</FONT></DIV>
<DIV><FONT face=3DArial><FONT size=3D2><FONT face=3DArial=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//Clear all the existing errors and=20
warnings</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>xsdResource.getErrors().clear();</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>xsdResource.getWarnings().clear();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>schema.clearDiagnostics();</FONT></DIV>
<DIV><FONT face=3DArial><FONT size=3D2><FONT face=3DArial=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//Validate the schema, generating all =
new=20
diagnostics</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>schema.validate();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>final Iterator diagnostics =3D=20
schema.getAllDiagnostics().iterator();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>while(diagnostics.hasNext() =
){</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; final XSDDiagnostic =
next =3D=20
(XSDDiagnostic)diagnostics.next();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
createProblemMarker(mapper.getIResource(), next); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I don't understand why I'm not getting =
errors when=20
I delete the imported resource until I open the remaining resource and =
why I=20
still get the errors after resoring the imported resource until I =
completely=20
close the workspace and restart it.&nbsp; It is important to note that =
in debug=20
mode, I've verified that the task list does get cleaned up properly... =
the=20
problem seems to actually be in xsdValidation.&nbsp; In the first case, =
the=20
schema.validate returns an empty diagnostic and in the last case it =
returns a=20
non-empty diagnostic.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>lp</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Ed Merks" &lt;</FONT><A=20
href=3D"mailto:merks@ca.ibm.com"><FONT face=3DArial=20
size=3D2>merks@ca.ibm.com</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in message=20
</FONT><A href=3D"news:3FC214B6.E2A88E@ca.ibm.com"><FONT face=3DArial=20
size=3D2>news:3FC214B6.E2A88E@ca.ibm.com</FONT></A><FONT face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; Lance,<BR>&gt; =
<BR>&gt;=20
There is no builder that does XSD validation.&nbsp; Only the editor does =
it as=20
you<BR>&gt; open the resource.<BR>&gt; <BR>&gt; <BR>&gt; Lance Phillips=20
wrote:<BR>&gt; <BR>&gt; &gt; Thanks Ed... you&nbsp; are correct.&nbsp; =
That is=20
much faster and works much better!<BR>&gt; &gt;<BR>&gt; &gt; That leaves =
me one=20
open issue :&nbsp; I have an XSD Resource that imports another<BR>&gt; =
&gt;=20
XSDResource. I have both resources in the workspace.&nbsp; If I delete=20
the<BR>&gt; &gt; imported resource and rebuild the workspace, I don't =
get any=20
errors.&nbsp; If I<BR>&gt; &gt; OPEN the remaining resource, then I get =
the=20
errors.&nbsp; If I then restore the<BR>&gt; &gt; imported resource and =
rebuild=20
the errors don't go away regardless of what I<BR>&gt; &gt; do.&nbsp; =
I've=20
stepped through the validation code, the markers do get removed,<BR>&gt; =
&gt;=20
but running the schema.validate regens a new set of errors.&nbsp; I've=20
verified<BR>&gt; &gt; that both resources are present in the =
workspace.<BR>&gt;=20
&gt;<BR>&gt; &gt; Any ideas what I might still be missing?<BR>&gt; =
&gt;<BR>&gt;=20
&gt; thanks,<BR>&gt; &gt;<BR>&gt; &gt; lp<BR>&gt; &gt; "Ed Merks" =
&lt;</FONT><A=20
href=3D"mailto:merks@ca.ibm.com"><FONT face=3DArial=20
size=3D2>merks@ca.ibm.com</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in=20
message<BR>&gt; &gt; </FONT><A =
href=3D"news:3FBF4B27.F7B80244@ca.ibm.com"><FONT=20
face=3DArial size=3D2>news:3FBF4B27.F7B80244@ca.ibm.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt; &gt; &gt; Lance,<BR>&gt; &gt; &gt;<BR>&gt; &gt; =
&gt; I've=20
never tried unloading an XSDResourceImpl.&nbsp; The complex<BR>&gt; &gt; =
&gt;=20
include/import/redefine interdependencies between .xsd files =
makes<BR>&gt; &gt;=20
unloading<BR>&gt; &gt; &gt; just one .xsd resource likely not to work=20
well.&nbsp; If you can get away with<BR>&gt; &gt; just<BR>&gt; &gt; &gt; =
doing=20
resource.getContents().clear() before tossing it away, that will<BR>&gt; =
&gt;=20
perform<BR>&gt; &gt; &gt; better.&nbsp; Do you need all the objects to =
be turned=20
into EMF proxies?&nbsp; (It's<BR>&gt; &gt; very<BR>&gt; &gt; &gt;=20
expensive.)<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; Lance =
Phillips=20
wrote:<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; &gt; Ed,<BR>&gt; &gt; &gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; We have a ResourceSet that has both =
XsdResources=20
and XmiResources.<BR>&gt; &gt; &gt; &gt; Those resources represent the=20
IResources of an IProject in the<BR>&gt; &gt; Workspace.<BR>&gt; &gt; =
&gt; &gt;=20
Upon deletion of an IResource with an underlying EmfResource, we want =
to<BR>&gt;=20
&gt; &gt; &gt; cleanup the EmfResource and remove it from the =
ResourceSet.&nbsp;=20
That seems<BR>&gt; &gt; to<BR>&gt; &gt; &gt; &gt; work fine for the =
XmiResources=20
by simply doing&nbsp; a resource.unload() and<BR>&gt; &gt; then<BR>&gt; =
&gt;=20
&gt; &gt; a resourceSet.getResources().remove(resource).&nbsp;&n bsp; =
However, in=20
the case of<BR>&gt; &gt; the<BR>&gt; &gt; &gt; &gt; XsdResource, the =
unload=20
seems to take several minutes.&nbsp; Is there a<BR>&gt; &gt; =
better<BR>&gt; &gt;=20
&gt; &gt; procedure to ensure everything gets cleaned up =
correctly?<BR>&gt; &gt;=20
&gt; &gt;<BR>&gt; &gt; &gt; &gt; thanks,<BR>&gt; &gt; &gt; &gt;<BR>&gt; =
&gt;=20
&gt; &gt; lp<BR>&gt; &gt; &gt;<BR>&gt; </FONT></BODY></HTML>

------=_NextPart_000_0017_01C3B266.2A54E180--
Re: Unloading an XSDResource [message #581090 is a reply to message #33548] Mon, 24 November 2003 15:12 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26126
Registered: July 2009
Senior Member
--------------C4002DC1CB01E351231D7B4B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Lance,

I'm pretty confused. I definitely don't understand what's happening any
better than you...


Lance Phillips wrote:

> Correct... we have a builder that is doing the validation and updating
> the task view. Here is a block of code from our validation
> logic... final XSDSchema schema = xsdResource.getSchema(); //Clear all
> the existing errors and
> warningsxsdResource.getErrors().clear();xsdResource.getWarni ngs().clear();schema.clearDiagnostics(); //Validate
> the schema, generating all new diagnosticsschema.validate();final
> Iterator diagnostics =
> schema.getAllDiagnostics().iterator();while(diagnostics.hasN ext()
> ){ final XSDDiagnostic next = (XSDDiagnostic)diagnostics.next();
> createProblemMarker(mapper.getIResource(), next);} I don't understand
> why I'm not getting errors when I delete the imported resource until I
> open the remaining resource and why I still get the errors after
> resoring the imported resource until I completely close the workspace
> and restart it. It is important to note that in debug mode, I've
> verified that the task list does get cleaned up properly... the
> problem seems to actually be in xsdValidation. In the first case, the
> schema.validate returns an empty diagnostic and in the last case it
> returns a non-empty diagnostic. thanks, lp "Ed Merks"
> <merks@ca.ibm.com> wrote in message
> news:3FC214B6.E2A88E@ca.ibm.com...> Lance,
> >
> > There is no builder that does XSD validation. Only the editor does
> it as you
> > open the resource.
> >
> >
> > Lance Phillips wrote:
> >
> > > Thanks Ed... you are correct. That is much faster and works much
> better!
> > >
> > > That leaves me one open issue : I have an XSD Resource that
> imports another
> > > XSDResource. I have both resources in the workspace. If I delete
> the
> > > imported resource and rebuild the workspace, I don't get any
> errors. If I
> > > OPEN the remaining resource, then I get the errors. If I then
> restore the
> > > imported resource and rebuild the errors don't go away regardless
> of what I
> > > do. I've stepped through the validation code, the markers do get
> removed,
> > > but running the schema.validate regens a new set of errors. I've
> verified
> > > that both resources are present in the workspace.
> > >
> > > Any ideas what I might still be missing?
> > >
> > > thanks,
> > >
> > > lp
> > > "Ed Merks" <merks@ca.ibm.com> wrote in message
> > > news:3FBF4B27.F7B80244@ca.ibm.com...
> > > > Lance,
> > > >
> > > > I've never tried unloading an XSDResourceImpl. The complex
> > > > include/import/redefine interdependencies between .xsd files
> makes
> > > unloading
> > > > just one .xsd resource likely not to work well. If you can get
> away with
> > > just
> > > > doing resource.getContents().clear() before tossing it away,
> that will
> > > perform
> > > > better. Do you need all the objects to be turned into EMF
> proxies? (It's
> > > very
> > > > expensive.)
> > > >
> > > >
> > > > Lance Phillips wrote:
> > > >
> > > > > Ed,
> > > > > We have a ResourceSet that has both XsdResources and
> XmiResources.
> > > > > Those resources represent the IResources of an IProject in the
>
> > > Workspace.
> > > > > Upon deletion of an IResource with an underlying EmfResource,
> we want to
> > > > > cleanup the EmfResource and remove it from the ResourceSet.
> That seems
> > > to
> > > > > work fine for the XmiResources by simply doing a
> resource.unload() and
> > > then
> > > > > a resourceSet.getResources().remove(resource). However, in
> the case of
> > > the
> > > > > XsdResource, the unload seems to take several minutes. Is
> there a
> > > better
> > > > > procedure to ensure everything gets cleaned up correctly?
> > > > >
> > > > > thanks,
> > > > >
> > > > > lp
> > > >
> >

--------------C4002DC1CB01E351231D7B4B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Lance,
<p>I'm pretty confused.&nbsp; I definitely don't understand what's happening
any better than you...
<br>&nbsp;
<p>Lance Phillips wrote:
<blockquote TYPE=CITE><style></style>
<font face="Arial"><font size=-1>Correct...
we have a builder that is doing the validation and updating the task view.&nbsp;
Here is a block of code from our validation logic...</font></font>&nbsp;<font face="Arial"><font size=-1>final
XSDSchema schema = xsdResource.getSchema();</font></font>&nbsp;<font face="Arial"><font size=-1>//Clear
all the existing errors and warnings</font></font><font face="Arial"><font size=-1>xsdResource.getErrors().clear();</font></font><font face="Arial"><font size=-1>xsdResource.getWarnings().clear();</font></font><font face="Arial"><font size=-1>schema.clearDiagnostics();</font></font>&nbsp; <font face="Arial"><font size=-1>//Validate
the schema, generating all new diagnostics</font></font><font face="Arial"><font size=-1>schema.validate();</font></font><font face="Arial"><font size=-1>final
Iterator diagnostics = schema.getAllDiagnostics().iterator();</font></font><font face="Arial"><font size=-1>while(diagnostics.hasNext()
){</font></font><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp; final
XSDDiagnostic next = (XSDDiagnostic)diagnostics.next();</font></font><font face="Arial"><font size=-1>&nbsp;&nbsp;&nbsp;
createProblemMarker(mapper.getIResource(), next);</font></font><font face="Arial"><font size=-1>}</font></font>&nbsp;<font face="Arial"><font size=-1>I
don't understand why I'm not getting errors when I delete the imported
resource until I open the remaining resource and why I still get the errors
after resoring the imported resource until I completely close the workspace
and restart it.&nbsp; It is important to note that in debug mode, I've
verified that the task list does get cleaned up properly... the problem
seems to actually be in xsdValidation.&nbsp; In the first case, the schema.validate
returns an empty diagnostic and in the last case it returns a non-empty
diagnostic.</font></font>&nbsp;<font face="Arial"><font size=-1>thanks,</font></font>&nbsp;<font face="Arial"><font size=-1>lp</font></font>&nbsp;<font face="Arial"><font size=-1>"Ed
Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>> wrote
in message <a href="news:3FC214B6.E2A88E@ca.ibm.com">news:3FC214B6.E2A88E@ca.ibm.com</a>...</font></font><font face="Arial"><font size=-1>>
Lance,</font></font>
<br><font face="Arial"><font size=-1>></font></font>
<br><font face="Arial"><font size=-1>> There is no builder that does XSD
validation.&nbsp; Only the editor does it as you</font></font>
<br><font face="Arial"><font size=-1>> open the resource.</font></font>
<br><font face="Arial"><font size=-1>></font></font>
<br><font face="Arial"><font size=-1>></font></font>
<br><font face="Arial"><font size=-1>> Lance Phillips wrote:</font></font>
<br><font face="Arial"><font size=-1>></font></font>
<br><font face="Arial"><font size=-1>> > Thanks Ed... you&nbsp; are correct.&nbsp;
That is much faster and works much better!</font></font>
<br><font face="Arial"><font size=-1>> ></font></font>
<br><font face="Arial"><font size=-1>> > That leaves me one open issue
:&nbsp; I have an XSD Resource that imports another</font></font>
<br><font face="Arial"><font size=-1>> > XSDResource. I have both resources
in the workspace.&nbsp; If I delete the</font></font>
<br><font face="Arial"><font size=-1>> > imported resource and rebuild
the workspace, I don't get any errors.&nbsp; If I</font></font>
<br><font face="Arial"><font size=-1>> > OPEN the remaining resource, then
I get the errors.&nbsp; If I then restore the</font></font>
<br><font face="Arial"><font size=-1>> > imported resource and rebuild
the errors don't go away regardless of what I</font></font>
<br><font face="Arial"><font size=-1>> > do.&nbsp; I've stepped through
the validation code, the markers do get removed,</font></font>
<br><font face="Arial"><font size=-1>> > but running the schema.validate
regens a new set of errors.&nbsp; I've verified</font></font>
<br><font face="Arial"><font size=-1>> > that both resources are present
in the workspace.</font></font>
<br><font face="Arial"><font size=-1>> ></font></font>
<br><font face="Arial"><font size=-1>> > Any ideas what I might still be
missing?</font></font>
<br><font face="Arial"><font size=-1>> ></font></font>
<br><font face="Arial"><font size=-1>> > thanks,</font></font>
<br><font face="Arial"><font size=-1>> ></font></font>
<br><font face="Arial"><font size=-1>> > lp</font></font>
<br><font face="Arial"><font size=-1>> > "Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>>
wrote in message</font></font>
<br><font face="Arial"><font size=-1>> > <a href="news:3FBF4B27.F7B80244@ca.ibm.com">news:3FBF4B27.F7B80244@ca.ibm.com</a>...</font></font>
<br><font face="Arial"><font size=-1>> > > Lance,</font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>> > > I've never tried unloading an
XSDResourceImpl.&nbsp; The complex</font></font>
<br><font face="Arial"><font size=-1>> > > include/import/redefine interdependencies
between .xsd files makes</font></font>
<br><font face="Arial"><font size=-1>> > unloading</font></font>
<br><font face="Arial"><font size=-1>> > > just one .xsd resource likely
not to work well.&nbsp; If you can get away with</font></font>
<br><font face="Arial"><font size=-1>> > just</font></font>
<br><font face="Arial"><font size=-1>> > > doing resource.getContents().clear()
before tossing it away, that will</font></font>
<br><font face="Arial"><font size=-1>> > perform</font></font>
<br><font face="Arial"><font size=-1>> > > better.&nbsp; Do you need all
the objects to be turned into EMF proxies?&nbsp; (It's</font></font>
<br><font face="Arial"><font size=-1>> > very</font></font>
<br><font face="Arial"><font size=-1>> > > expensive.)</font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>> > > Lance Phillips wrote:</font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>> > > > Ed,</font></font>
<br><font face="Arial"><font size=-1>> > > >&nbsp;&nbsp;&nbsp;&nbsp; We
have a ResourceSet that has both XsdResources and XmiResources.</font></font>
<br><font face="Arial"><font size=-1>> > > > Those resources represent
the IResources of an IProject in the</font></font>
<br><font face="Arial"><font size=-1>> > Workspace.</font></font>
<br><font face="Arial"><font size=-1>> > > > Upon deletion of an IResource
with an underlying EmfResource, we want to</font></font>
<br><font face="Arial"><font size=-1>> > > > cleanup the EmfResource and
remove it from the ResourceSet.&nbsp; That seems</font></font>
<br><font face="Arial"><font size=-1>> > to</font></font>
<br><font face="Arial"><font size=-1>> > > > work fine for the XmiResources
by simply doing&nbsp; a resource.unload() and</font></font>
<br><font face="Arial"><font size=-1>> > then</font></font>
<br><font face="Arial"><font size=-1>> > > > a resourceSet.getResources().remove(resource).&nbsp;&n bsp;
However, in the case of</font></font>
<br><font face="Arial"><font size=-1>> > the</font></font>
<br><font face="Arial"><font size=-1>> > > > XsdResource, the unload seems
to take several minutes.&nbsp; Is there a</font></font>
<br><font face="Arial"><font size=-1>> > better</font></font>
<br><font face="Arial"><font size=-1>> > > > procedure to ensure everything
gets cleaned up correctly?</font></font>
<br><font face="Arial"><font size=-1>> > > ></font></font>
<br><font face="Arial"><font size=-1>> > > > thanks,</font></font>
<br><font face="Arial"><font size=-1>> > > ></font></font>
<br><font face="Arial"><font size=-1>> > > > lp</font></font>
<br><font face="Arial"><font size=-1>> > ></font></font>
<br><font face="Arial"><font size=-1>></font></font></blockquote>
</html>

--------------C4002DC1CB01E351231D7B4B--
Previous Topic:analyziing XSDSimpleTypeDefinitions
Next Topic:Bug in validation?
Goto Forum:
  


Current Time: Tue Oct 21 02:12:31 GMT 2014

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

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