logo       

Re: Renaming a collection: msg#00019

Subject: Re: Renaming a collection
----- Original Message ----- 
From: "Wouter de Vaal" <wouter_de_vaal@xxxxxxxxxxx>
To: <xindice-users@xxxxxxxxxxxxxx>
Sent: Monday, August 30, 2004 2:28 PM
Subject: Re: Renaming a collection


> > >>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);
> > >
> > >
> > >
> > >
> > I tried that but can't make it work, and here's why :
> >
> > The collection I want to change the name of, is right under the /db
> > collection (its name is HausseTarifaire2004).
> > When I try to perform a :
> >
> >
(CollectionImpl)DatabaseManager.getCollection("xmldb:xindice://myUrl/db",
> > username,password)
> >     MetaData metaData = xindiceCol.getMetaData('HausseTarifaire2004');
> >
> > I get the following exception :
> >
> >     org.xmldb.api.base.XMLDBException:
> > org.xmldb.api.base.XMLDBException: :This Collection 'db' cannot store
> > Documents
> >
> > When I use "HausseTarifaire2004" as current collection , I don't know
> > how to access its metadata (since you must put the resource name as
> > parameter of the getMetaData method call).
> >
> > It seems (according to the javadocs) that metadata are accessible for
> > resources (XML files) but not (or at least not easily) for collections.
> >
> > Any idea here ?
> >
> >
> Ok I pasted some generic code of us that gets and sets meta data on both
> resources and collections,
> so I guess that's not entirely clear.
>
> You should use:
> MetaData metaData = xindiceCol.getMetaData(null);
>
> instead of
>
> MetaData metaData = xindiceCol.getMetaData('HausseTarifaire2004');
>
> and vice versa for setting metadata.
>
> xindiceCol.setMetaData(null, metaData);
>
> Wouter
>
In addition set the collection in the collection url:

CollectionImpl xindiceCol =
(CollectionImpl)DatabaseManager.getCollection("xmldb:xindice://myUrl/db/Haus
seTarifaire2004",username,password)




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe