On Thu, Oct 14, 2010 at 5:31 PM, jose garcia <josega...@gmail.com> wrote:
> Hi
>
> I modified the Font REST API to remove catalog stuff and use FontCache
> class. I attach you the patches for geoserver and geotools, now created
> using trunk.
>
> Some comments:
>
> * In FontCache systemFonts contains both faces and families, not sure if to
> return the list of fonts we want both.

Hi Jose,
I've reviewed this patch and applied it to GeoTools 2.6.x and trunk

> * The REST service extents MapResource class, producing a quite simple xml
> representation. I think if needed better representation i have to check in
> AbstractCatalogListResource (but not extending from this class). Any hint
> about where to look to produce better output is welcome.
> * Need to add test cases.

For this one you should discuss on the public ml, I'm not the maintainer of the
restconfig extension. I've reattached the patch affecting rest

Cheers
Andrea

-----------------------------------------------------
Ing. Andrea Aime
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584962313
fax:     +39 0584962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-----------------------------------------------------
Index: extension/restconfig/src/main/java/org/geoserver/rest/FontListResource.java
===================================================================
--- extension/restconfig/src/main/java/org/geoserver/rest/FontListResource.java	(revision )
+++ extension/restconfig/src/main/java/org/geoserver/rest/FontListResource.java	(revision )
@@ -0,0 +1,26 @@
+/* Copyright (c) 2001 - 2009 TOPP - www.openplans.org.  All rights reserved.
+ * This code is licensed under the GPL 2.0 license, availible at the root
+ * application directory.
+ */
+package org.geoserver.rest;
+
+import org.geoserver.rest.MapResource;
+import org.geotools.renderer.style.FontCache;
+
+
+import java.util.*;
+
+
+public class FontListResource extends MapResource {
+
+    @Override
+    public Map getMap() throws Exception {
+        FontCache cache = FontCache.getDefaultInstance();
+        
+        HashMap map = new HashMap();
+        map.put("fonts", cache.getAvailableFonts());
+
+        return map;
+    }
+}
+
Index: extension/restconfig/src/main/java/applicationContext.xml
===================================================================
--- extension/restconfig/src/main/java/applicationContext.xml	(revision 14410)
+++ extension/restconfig/src/main/java/applicationContext.xml	(revision )
@@ -266,6 +266,10 @@
           <key><value>/reload</value></key>
           <value>catalogReloader</value>
         </entry>
+        <entry>
+          <key><value>/fonts</value></key>
+          <value>fontFinder</value>
+        </entry>
         
   </map>
 </property>
@@ -287,6 +291,9 @@
   <bean id="styleFinder2" class="org.geoserver.catalog.rest.StyleFinder" parent="abstractCatalogFinder"/>
   <bean id="layerFinder2" class="org.geoserver.catalog.rest.LayerFinder" parent="abstractCatalogFinder"/>
   <bean id="layerGroupFinder2" class="org.geoserver.catalog.rest.LayerGroupFinder" parent="abstractCatalogFinder"/>
+
+  <bean id="fontFinder" class="org.geoserver.rest.FontListResource"/>
+
   <bean id="catalogReloader" class="org.geoserver.catalog.rest.CatalogReloader">
      <constructor-arg ref="geoServer"/>
   </bean>
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to