[GeoNetwork-devel] Instantiate ServiceContext object

Hello!

Sorry for my bad engish.

I´m trying to use the next simple code:

    public String <http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Core/lang/java/lang/String.java.htm&gt; getMetadataId(ServiceContext srvContext, String <http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Core/lang/java/lang/String.java.htm&gt; uuid)
                    throws Exception {
                Dbms dbms = (Dbms) srvContext.getResourceManager().open(
                        Geonet.Res.MAIN_DB);
                String <http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Core/lang/java/lang/String.java.htm&gt; query = "SELECT id FROM Metadata WHERE uuid=?";
                List <http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Core/Collections-Jar-Zip-Logging-regex/java/util/List.java.htm&gt; list = dbms.select(query, uuid).getChildren();
                if (list.size() == 0)
                    return null;
                Element record = (Element) list.get(0);
                return record.getChildText("id");
            }

But I don´t know how to get a "srvContext" object, I have search an example but I didn´t found anything. Is there any example?

Thank you very much!

Manuel J. Belizón Álvarez

Dirección de Producción

Estadio Olímpico de Sevilla, Edificio NO, puerta P

Isla de la Cartuja 41092 Sevilla, Tel. 95 5043600 extensión 82150, Fax 95 5043682.

SADIEL, S.A. http://www.sadiel.es