[Yanel-commits] rev 29966 - public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf

michi at wyona.com michi at wyona.com
Mon Dec 17 23:42:45 CET 2007


Author: michi
Date: 2007-12-17 23:42:44 +0100 (Mon, 17 Dec 2007)
New Revision: 29966

Modified:
   public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf/FOAFResource.java
Log:
get atom transformer

Modified: public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf/FOAFResource.java
===================================================================
--- public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf/FOAFResource.java	2007-12-17 22:42:22 UTC (rev 29965)
+++ public/yanel/contributions/realms/foaf/src/resources/foaf/src/java/org/wyona/yanel/impl/resources/foaf/FOAFResource.java	2007-12-17 22:42:44 UTC (rev 29966)
@@ -26,6 +26,10 @@
 import org.wyona.yarep.core.Repository;
 import org.wyona.yarep.core.RepositoryFactory;
 
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamSource;
+
 /**
  *
  */
@@ -96,8 +100,6 @@
             StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
             sb.append("<wyona:foaf xmlns:wyona=\"http://www.wyona.org/foaf/1.0\">");
 
-            // WORKAROUND: The XIncludeTransformer does to propagate the namespaces ...
-            //sb.append("<wyona:foaf xmlns:wyona=\"http://www.wyona.org/foaf/1.0\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" xmlns:i18n=\"http://www.wyona.org/yanel/i18n/1.0\" xmlns:xi=\"http://www.w3.org/2001/XInclude\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:foaf=\"http://xmlns.com/foaf/0.1/\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">");
             if (getRequest().getParameter("href") != null) {
                 sb.append("<wyona:third-party-source href=\"" + getRequest().getParameter("href") + "\"/>");
             } else {
@@ -135,6 +137,7 @@
                 view.setMimeType(getMimeType(viewId));
                 return view;
 	    } else if (viewId != null && viewId.equals("atom")) {
+                Transformer atomTransformer = getAtomTransformer();
                 view.setInputStream(new StringBufferInputStream(new StringBuffer("Not implemented yet!").toString()));
                 view.setMimeType("text/plain");
 /*
@@ -327,4 +330,15 @@
     private org.apache.xml.serializer.Serializer getSerializer() {
         return org.wyona.yanel.core.serialization.SerializerFactory.getSerializer(org.wyona.yanel.core.serialization.SerializerFactory.XML);
     }
+
+    /**
+     *
+     */
+    private Transformer getAtomTransformer() throws Exception {
+        //File xsltFile = org.wyona.commons.io.FileUtil.file(getRTD().getConfigFile().getParentFile().getAbsolutePath(), "foaf2opensocial.xsl");
+        URL xsltURL = FOAFResource.class.getClassLoader().getResource("org/wyona/yanel/impl/resources/foaf/foaf2opensocial.xsl");
+        log.error("DEBUG: XSLT url: " + xsltURL);
+        return TransformerFactory.newInstance().newTransformer(new StreamSource(xsltURL.openStream()));
+        //return TransformerFactory.newInstance().newTransformer(new StreamSource(new File(xsltURL.getFile())));
+    }
 }



More information about the Yanel-commits mailing list