Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dtp-dev] Fine-grained refresh control on ICatalogObject

Hey Hui,

Could you provide a use case for this change (i.e. why do we need fine
grained control)?  From my perspective, the refresh action is provided so
the view can be updated to reflect any changes made by either the current
user, or another user that might be working on the same database.  Given
this, I don't understand what purpose a refresh(1) would serve.  For
example, if the user modifies a table definition and refreshes the
containing schema object, the update will only be visible if the tables are
also refreshed.  Furthermore, if the user modifies a table definition,
there is no way to determine what has changed (e.g. they added or removed
an index), so we have to refresh all the objects underneath the table
anyway.

All that said, I am also curious as to why we try reuse the old catalog
objects (seeing as we have to update the children, we're not saving a trip
to the server, so all we're really saving is newing up the objects).  In my
opinion, this was not worth the complexity it added, but perhaps there was
a more compelling reason.

Thanks in advance,
Rob

dtp-dev-bounces@xxxxxxxxxxx wrote on 11/07/2006 03:21:29 AM:

>
> Hi,
>         In DSE, when user invokes "Refresh" on a folder, the parent
> ICatalogObject.refresh() will be called, resulting in all other
> folders under the same ICatalogObject are refreshed as well. Is
> there a reason to do so? How about adding a "refresh(int flag)"
> method to allow fine-grained refresh control? In this way only the
> desired objects are refreshed.
>         Another question is about whether to reserve the old objects
> while loading in catalog loader. I have seen the following pattern
> in WTP RDB catalog loaders (please notice the bold part):
>         private synchronized void loadSchemas() {
>                 if(this.schemasLoaded) return;
>                 EList schemaList = super.getSchemas();
>                 Object[] oldList = schemaList.toArray();
>                 boolean deliver = this.eDeliver();
>                 this.eSetDeliver(false);
>                 try {
>                         List list =
CatalogUtils.getDBSchemas(this.dbName,
> this.connection);
>                         for (int i = 0; i < list.size(); i++) {
>                                 final String schemaname = (String)
> list.get(i);
>
>                                 Schema schema;
>
>                                 EClass metaclass= SQLSchemaPackage.
> eINSTANCE.getSchema();
>
>                                 Object element = CatalogSchema.
> findElement(oldList,schemaname,metaclass);
>
>                                 try {
>                                         if (element != null) {
>                                                 schema = (Schema)
element;
> //we must put list.add before refresh, otherwise NPE will be thrown
>                                                 schemaList.add(schema);
>                                                 ((ICatalogObject)
> schema).refresh();
>                                         } else {
>                                                 schema = new
CatalogSchema();
>
schema.setName(schemaname);
>                                                 schemaList.add(schema);
>                                         }
>
>                                 } catch (ArrayIndexOutOfBoundsException
e) {
>                                         // do nothing
>                                         e.printStackTrace();
>                                 } catch (NullPointerException e) {
>                                         // do nothing
>                                         e.printStackTrace();
>                                 }
>                         }
>                         this.schemasLoaded = true;
>                 }
>                 catch (Exception e) {
>                         System.out.println(e.toString());
>                 }
>                 this.eSetDeliver(deliver);
>         }
>
> That is, the catalog loader tries to reserve the old object
> references. I suppose this is to make sql model objects referenced
> by other components (such as schema object editor) valid after
> refresh, it that true?
>
> Best Regards!
>
> Max ( Hui ) Cao
> Sybase, Inc. Shanghai,
China_______________________________________________
> dtp-dev mailing list
> dtp-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dtp-dev



Back to the top