----- Original Message ----- From: "Alexander DEJANOVSKI" <[EMAIL PROTECTED]> To: <xindice-users@xml.apache.org> Sent: Friday, August 27, 2004 5:09 PM Subject: Re: Renaming a collection
> Wouter de Vaal wrote: > > >>Is it possible to rename a collection that already exists and is filled > >>with data ? > >> > >> > >> > >No. The trick we used in our project is to put a presentable name of the > >collection in MetaData > >and then let the collection real name be a generated unique one. > > > >Regards, > >Wouter > > > > > > > So according to what I understand, it would be possible to change the > presentable name of the collection by changing it in the metadata ? > Since the name used to access the collection is the one stored in the > metadata, I want to change this one. > If it is indeed possible, would you mind showing me a piece of code that > does it ? > > Thanks, that would really help out here !! > > > this is basically all you need to do: //get name: CollectionImpl xindiceCol = (CollectionImpl)DatabaseManager.getCollection(collectionURI, username, password); MetaData metaData = xindiceCol.getMetaData(resource); String name = metaData.getAttribute("REALNAME"); //change name: name = "foo"; metaData.setType(MetaData.COLLECTION); metaData.setAttribute("REALNAME", name); xindiceCol.setMetaData(resource, metaData);