Author: bblfish
Date: Thu Feb 24 13:40:29 2011
New Revision: 1074145

URL: http://svn.apache.org/viewvc?rev=1074145&view=rev
Log:
This now works. It is also a HelloWorld template that could be used for 
teaching.

Modified:
    incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml
    
incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/resources/OSGI-INF/serviceComponents.xml
    
incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/scala/org/apache/clerezza/foafssl/testservlets/TestMe.scala

Modified: incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml?rev=1074145&r1=1074144&r2=1074145&view=diff
==============================================================================
--- incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml 
(original)
+++ incubator/clerezza/trunk/parent/platform.security.foafssl/test/pom.xml Thu 
Feb 24 13:40:29 2011
@@ -9,15 +9,23 @@
        <artifactId>platform.security.foafssl.test</artifactId>
        <version>0.1-incubating-SNAPSHOT</version>
        <packaging>bundle</packaging>
-       <name>Clerezza - Platform Security foaf+ssl Tests</name>
+       <name>Clerezza - Platform Security foaf+ssl Test Servlets</name>
        <description>
-               Foaf + Ssl test "servlets" to run WebID tests on.
+               Foaf + Ssl test "servlets" to run WebID tests on.  (need to add 
link to WebID wiki)
        </description>
 
        <dependencies>
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency-->
+        <dependency>
+            <groupId>org.apache.clerezza</groupId>
+            <artifactId>web.fileserver</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.clerezza</groupId>
@@ -98,9 +106,8 @@
                                <configuration>
                                        <instructions>
                                                
<Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
-                                               
<Export-Package>!org.apache.clerezza.foafssl.ontologies,
-                                                               
org.apache.clerezza.foafssl.*</Export-Package>
-                                               
<Bundle-SymbolicName>org.apache.clerezza.foafssl</Bundle-SymbolicName>
+                                               
<Export-Package>org.apache.clerezza.foafssl.testservlets</Export-Package>
+                                               
<Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
                                        </instructions>
                                </configuration>
                        </plugin>

Modified: 
incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/resources/OSGI-INF/serviceComponents.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/resources/OSGI-INF/serviceComponents.xml?rev=1074145&r1=1074144&r2=1074145&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/resources/OSGI-INF/serviceComponents.xml
 (original)
+++ 
incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/resources/OSGI-INF/serviceComponents.xml
 Thu Feb 24 13:40:29 2011
@@ -2,8 +2,12 @@
 <components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0";>
        <scr:component enabled="true" 
name="org.apache.clerezza.foafssl.testserlvets.TestMe" immediate="true">
                <implementation 
class="org.apache.clerezza.foafssl.testservlets.TestMe"/>
+        <service servicefactory="false">
+            <provide interface="java.lang.Object"/>
+        </service>
                <reference name="UserManager"
                interface="org.apache.clerezza.platform.usermanager.UserManager"
                cardinality="1..1" policy="static" bind="bindUserManager" 
unbind="unbindUserManager"/>
+        <property name="javax.ws.rs" type="Boolean" value="true"/>
        </scr:component>
 </components>

Modified: 
incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/scala/org/apache/clerezza/foafssl/testservlets/TestMe.scala
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/scala/org/apache/clerezza/foafssl/testservlets/TestMe.scala?rev=1074145&r1=1074144&r2=1074145&view=diff
==============================================================================
--- 
incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/scala/org/apache/clerezza/foafssl/testservlets/TestMe.scala
 (original)
+++ 
incubator/clerezza/trunk/parent/platform.security.foafssl/test/src/main/scala/org/apache/clerezza/foafssl/testservlets/TestMe.scala
 Thu Feb 24 13:40:29 2011
@@ -20,9 +20,11 @@ import java.security.AccessController
 import java.security.PrivilegedAction
 import org.apache.clerezza.platform.security.UserUtil
 import org.apache.clerezza.platform.usermanager.UserManager
-import org.apache.felix.scr.annotations.Reference
-import javax.ws.rs.{GET, Path}
 import org.apache.clerezza.rdf.utils.GraphNode
+import sun.management.resources.agent
+import javax.ws.rs.{Produces, GET, Path}
+import org.apache.clerezza.web.fileserver.FileServer
+import org.osgi.service.component.ComponentContext
 
 /**
  * implementation of (very early) version of test server for WebID so that the 
following tests
@@ -32,34 +34,40 @@ import org.apache.clerezza.rdf.utils.Gra
  */
 
 @Path("/test/webIdEndPoint")
-class TestMe {
+class TestMe extends FileServer {
 
-  @Reference
   var userManager: UserManager =null;
 
   protected def bindUserManager(um: UserManager)  = {
                userManager = um
        }
 
-       protected def unbindX509TrustManagerWrapperService(um: UserManager)  = {
+       protected def unbindUserManager(um: UserManager)  = {
                userManager = null
        }
 
-  @GET
+       protected def activate(componentContext: ComponentContext ) = {
+//             configure(componentContext.getBundleContext(), 
"profile-staticweb");
+       }
+
+  @GET @Produces(Array("text/plain"))
   def getTestMe() : String = {
-    val context = AccessController.getContext();
-    val agent = AccessController.doPrivileged(new PrivilegedAction[String]() {
-      @Override
-      def run(): String = {
-        val userName = UserUtil.getUserName(context);
-        if (userName == null) {
-          return "-";
-        }
-        val node: GraphNode = userManager.getUserGraphNode(userName)
-        return node.getNode.toString;
-      }
-    });
-    return agent
+    return "Hello World!"
+//    val context = AccessController.getContext();
+//    val agent = AccessController.doPrivileged(new PrivilegedAction[String]() 
{
+//      @Override
+//      def run(): String = {
+//        val userName = UserUtil.getUserName(context);
+//        if (userName == null) {
+//          return "-";
+//        }
+//        val node: GraphNode = userManager.getUserGraphNode(userName)
+//        return node.getNode.toString;
+//      }
+//    });
+ //   return agent
   }
 
+
+
 }


Reply via email to