[Yanel-commits] rev 28886 - in
public/yanel/contributions/realms/foaf: data
data/profiles.yarep data-paths data-paths/profiles
data-paths/profiles/foo-bar.rdf res-configs src/resources/findfriend
src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend
michi at wyona.com
michi at wyona.com
Wed Nov 14 21:16:59 CET 2007
Author: michi
Date: 2007-11-14 21:16:59 +0100 (Wed, 14 Nov 2007)
New Revision: 28886
Added:
public/yanel/contributions/realms/foaf/data-paths/profiles/
public/yanel/contributions/realms/foaf/data-paths/profiles/foo-bar.rdf/
public/yanel/contributions/realms/foaf/data-paths/profiles/foo-bar.rdf/.yarep-uid
public/yanel/contributions/realms/foaf/data/profiles.yarep/
public/yanel/contributions/realms/foaf/data/profiles.yarep/meta
Modified:
public/yanel/contributions/realms/foaf/res-configs/.yanel-rc
public/yanel/contributions/realms/foaf/res-configs/index.html.yanel-rc
public/yanel/contributions/realms/foaf/res-configs/profile.yanel-rc
public/yanel/contributions/realms/foaf/src/resources/findfriend/resource.xml
public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend/FindFriendResource.java
Log:
repo switch implemented also for find a friend resource
Added: public/yanel/contributions/realms/foaf/data/profiles.yarep/meta
===================================================================
--- public/yanel/contributions/realms/foaf/data/profiles.yarep/meta (rev 0)
+++ public/yanel/contributions/realms/foaf/data/profiles.yarep/meta 2007-11-14 20:16:59 UTC (rev 28886)
@@ -0,0 +1 @@
+yarep_type<string>:collection
Added: public/yanel/contributions/realms/foaf/data-paths/profiles/foo-bar.rdf/.yarep-uid
===================================================================
--- public/yanel/contributions/realms/foaf/data-paths/profiles/foo-bar.rdf/.yarep-uid (rev 0)
+++ public/yanel/contributions/realms/foaf/data-paths/profiles/foo-bar.rdf/.yarep-uid 2007-11-14 20:16:59 UTC (rev 28886)
@@ -0,0 +1 @@
+/profiles/foo-bar.rdf
Modified: public/yanel/contributions/realms/foaf/res-configs/.yanel-rc
===================================================================
--- public/yanel/contributions/realms/foaf/res-configs/.yanel-rc 2007-11-14 17:45:22 UTC (rev 28885)
+++ public/yanel/contributions/realms/foaf/res-configs/.yanel-rc 2007-11-14 20:16:59 UTC (rev 28886)
@@ -9,4 +9,11 @@
-->
<yanel:property name="type" value="simple"/>
+
+<!--
+ <yanel:property name="repo-config" value="/home/michi/src/wyona/wyona/misc/foaf/data-repository.xml"/>
+-->
+<!--
+ <yanel:property name="repo-config" value="/home/michi/src/wyona-svn/wyona/misc/foaf/data-repository.xml"/>
+-->
</yanel:resource-config>
Modified: public/yanel/contributions/realms/foaf/res-configs/index.html.yanel-rc
===================================================================
--- public/yanel/contributions/realms/foaf/res-configs/index.html.yanel-rc 2007-11-14 17:45:22 UTC (rev 28885)
+++ public/yanel/contributions/realms/foaf/res-configs/index.html.yanel-rc 2007-11-14 20:16:59 UTC (rev 28886)
@@ -11,4 +11,11 @@
-->
<yanel:property name="type" value="simple"/>
+
+<!--
+ <yanel:property name="repo-config" value="/home/michi/src/wyona/wyona/misc/foaf/data-repository.xml"/>
+-->
+<!--
+ <yanel:property name="repo-config" value="/home/michi/src/wyona-svn/wyona/misc/foaf/data-repository.xml"/>
+-->
</yanel:resource-config>
Modified: public/yanel/contributions/realms/foaf/res-configs/profile.yanel-rc
===================================================================
--- public/yanel/contributions/realms/foaf/res-configs/profile.yanel-rc 2007-11-14 17:45:22 UTC (rev 28885)
+++ public/yanel/contributions/realms/foaf/res-configs/profile.yanel-rc 2007-11-14 20:16:59 UTC (rev 28886)
@@ -4,8 +4,8 @@
<yanel:rti name="foaf" namespace="http://www.wyona.org/yanel/resource/1.0"/>
<yanel:property name="xslt" value="/xslt/foaf2xhtml.xsl"/>
- <!--
<yanel:property name="repo-config" value="/home/michi/src/wyona/wyona/misc/foaf/data-repository.xml"/>
- -->
+<!--
<yanel:property name="repo-config" value="/home/michi/src/wyona-svn/wyona/misc/foaf/data-repository.xml"/>
+-->
</yanel:resource-config>
Modified: public/yanel/contributions/realms/foaf/src/resources/findfriend/resource.xml
===================================================================
--- public/yanel/contributions/realms/foaf/src/resources/findfriend/resource.xml 2007-11-14 17:45:22 UTC (rev 28885)
+++ public/yanel/contributions/realms/foaf/src/resources/findfriend/resource.xml 2007-11-14 20:16:59 UTC (rev 28886)
@@ -12,5 +12,8 @@
<rtd>
<property name="parser" default-value="org.wyona.meguni.parser.impl.MSNParser"/>
<property name="type" default-value="simple"/><!-- other values: advanced -->
+
+ <!-- Optional -->
+ <property name="repo-config"/>
</rtd>
</resource>
Modified: public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend/FindFriendResource.java
===================================================================
--- public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend/FindFriendResource.java 2007-11-14 17:45:22 UTC (rev 28885)
+++ public/yanel/contributions/realms/foaf/src/resources/findfriend/src/java/org/wyona/yanel/impl/resources/findfriend/FindFriendResource.java 2007-11-14 20:16:59 UTC (rev 28886)
@@ -12,6 +12,10 @@
import org.wyona.meguni.parser.Parser;
import org.wyona.meguni.util.ResultSet;
+import org.wyona.yarep.core.Node;
+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;
@@ -92,13 +96,26 @@
// TODO: Remove hard-coded ...
if (qs != null) {
+ sb.append("<provider source-name=\"" + "Wyona-FOAF" + "\" source-domain=\"" + "http://foaf.wyona.org" + "\" numberOfResults=\"" + "1" + "\">");
+
+ Repository pRepo = getProfilesRepository();
+ Node[] pNodes = pRepo.getNode("/profiles").getNodes();
+ for (int i = 0; i < pNodes.length; i++) {
+ sb.append("<result number=\"" + "1" + "\" source-name=\"" + "Wyona-FOAF" + "\">");
+ sb.append("<title><![CDATA[" + "Foo Bar" + "]]></title>");
+ sb.append("<excerpt><![CDATA[" + "About Foo Bar ..." + "]]></excerpt>");
+ sb.append("<url><![CDATA[" + "profiles/" + pNodes[i].getName() + ".html" + "]]></url>");
+ sb.append("<last-modified><![CDATA[" + "null" + "]]></last-modified>");
+ sb.append("<mime-type suffix=\"html\">application/xhtml+xml</mime-type>");
+ sb.append("</result>");
+ }
/*
Nodes[] nodes = getRealm().getRepository().search(qs);
Nodes[] nodes = getRealm().getRepository().searchProperty("firstname", firstname);
Nodes[] nodes = getRealm().getRepository().searchProperty("lastname", lastname);
*/
- sb.append("<provider source-name=\"" + "Wyona-FOAF" + "\" source-domain=\"" + "http://foaf.wyona.org" + "\" numberOfResults=\"" + "1" + "\">");
+/*
sb.append("<result number=\"" + "1" + "\" source-name=\"" + "Wyona-FOAF" + "\">");
sb.append("<title><![CDATA[" + "Foo Bar" + "]]></title>");
sb.append("<excerpt><![CDATA[" + "About Foo Bar ..." + "]]></excerpt>");
@@ -106,6 +123,8 @@
sb.append("<last-modified><![CDATA[" + "null" + "]]></last-modified>");
sb.append("<mime-type suffix=\"html\">application/xhtml+xml</mime-type>");
sb.append("</result>");
+*/
+
sb.append("</provider>");
}
@@ -157,4 +176,16 @@
}
return tf;
}
+
+ /**
+ *
+ */
+ private Repository getProfilesRepository() throws Exception {
+ Repository repo = getRealm().getRepository();
+ String repoConfig = getResourceConfigProperty("repo-config");
+ if (repoConfig != null) {
+ repo = new RepositoryFactory().newRepository("profiles", new File(repoConfig));
+ }
+ return repo;
+ }
}
More information about the Yanel-commits
mailing list