lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r417565 [4/4] - in /lucene/java/trunk/contrib/gdata-server: src/java/org/apache/lucene/gdata/data/ src/java/org/apache/lucene/gdata/server/administration/ src/java/org/apache/lucene/gdata/server/authentication/ src/java/org/apache/lucene/gd...
Date Tue, 27 Jun 2006 19:31:23 GMT
Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/AuthenticationContorllerStub.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/AuthenticationContorllerStub.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/AuthenticationContorllerStub.java
(added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/AuthenticationContorllerStub.java
Tue Jun 27 12:31:20 2006
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.utils;
+
+import org.apache.lucene.gdata.data.GDataAccount;
+import org.apache.lucene.gdata.data.GDataAccount.AccountRole;
+import org.apache.lucene.gdata.server.authentication.AuthenticationController;
+import org.apache.lucene.gdata.server.registry.Component;
+import org.apache.lucene.gdata.server.registry.ComponentType;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+@Component(componentType=ComponentType.AUTHENTICATIONCONTROLLER)
+public class AuthenticationContorllerStub implements AuthenticationController {
+    public static AuthenticationController controller;
+    /**
+     * 
+     */
+    public AuthenticationContorllerStub() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.server.authentication.AuthenticationController#authenticatAccount(org.apache.lucene.gdata.data.GDataAccount,
java.lang.String, java.lang.String)
+     */
+    public String authenticatAccount(GDataAccount account, String requestIp
+            ) {
+
+        return controller.authenticatAccount(account,requestIp);
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.server.authentication.AuthenticationController#authenticateToken(java.lang.String,
java.lang.String, org.apache.lucene.gdata.data.GDataAccount.AccountRole, java.lang.String)
+     */
+    public boolean authenticateToken(String token, String requestIp,
+            AccountRole role, String serviceName) {
+
+        return controller.authenticateToken(token,requestIp,role,serviceName);
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.server.registry.ServerComponent#initialize()
+     */
+    public void initialize() {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.server.registry.ServerComponent#destroy()
+     */
+    public void destroy() {
+    }
+
+}

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ProvidedServiceStub.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ProvidedServiceStub.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ProvidedServiceStub.java
(added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ProvidedServiceStub.java
Tue Jun 27 12:31:20 2006
@@ -0,0 +1,38 @@
+package org.apache.lucene.gdata.utils;
+
+import org.apache.lucene.gdata.server.registry.ProvidedService;
+
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.ExtensionProfile;
+import com.google.gdata.data.Feed;
+
+public class ProvidedServiceStub implements ProvidedService {
+
+    public static final String SERVICE_NAME = "service";
+
+    public ProvidedServiceStub() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+    public Class getFeedType() {
+
+        return Feed.class;
+    }
+
+    public ExtensionProfile getExtensionProfile() {
+
+        return new ExtensionProfile();
+    }
+
+    public Class getEntryType() {
+
+        return Entry.class;
+    }
+
+    public String getName() {
+
+        return SERVICE_NAME;
+    }
+
+}

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ServiceFactoryStub.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ServiceFactoryStub.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ServiceFactoryStub.java
(added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ServiceFactoryStub.java
Tue Jun 27 12:31:20 2006
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.utils;
+
+import org.apache.lucene.gdata.server.Service;
+import org.apache.lucene.gdata.server.ServiceFactory;
+import org.apache.lucene.gdata.server.administration.AdminService;
+import org.apache.lucene.gdata.server.registry.Component;
+import org.apache.lucene.gdata.server.registry.ComponentType;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+@Component(componentType=ComponentType.SERVICEFACTORY)
+public class ServiceFactoryStub extends ServiceFactory {
+   
+    public Service service;
+    public AdminService adminService;
+    /**
+     * @see org.apache.lucene.gdata.server.ServiceFactory#getAdminService()
+     */
+    @Override
+    public AdminService getAdminService() {
+        
+        return adminService;
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.server.ServiceFactory#getService()
+     */
+    @Override
+    public Service getService() {
+        
+        return service;
+    }
+
+    public void setAdminService(AdminService service) {
+        this.adminService = service;
+    }
+    public void setService(Service service) {
+        this.service = service;
+    }
+    
+
+}

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageControllerStub.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageControllerStub.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageControllerStub.java
(added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageControllerStub.java
Tue Jun 27 12:31:20 2006
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.utils;
+
+import org.apache.lucene.gdata.server.registry.Component;
+import org.apache.lucene.gdata.server.registry.ComponentType;
+import org.apache.lucene.gdata.storage.Storage;
+import org.apache.lucene.gdata.storage.StorageController;
+import org.apache.lucene.gdata.storage.StorageException;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+@Component(componentType = ComponentType.STORAGECONTROLLER)
+public class StorageControllerStub implements StorageController {
+
+    /**
+     * 
+     */
+    public StorageControllerStub() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.StorageController#destroy()
+     */
+    public void destroy() {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.StorageController#getStorage()
+     */
+    public Storage getStorage() throws StorageException {
+
+        return new StorageStub();
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.server.registry.ServerComponent#initialize()
+     */
+    public void initialize() {
+    }
+
+}

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageStub.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageStub.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageStub.java
(added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageStub.java
Tue Jun 27 12:31:20 2006
@@ -0,0 +1,173 @@
+/**
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lucene.gdata.utils;
+
+import java.util.Date;
+
+import org.apache.lucene.gdata.data.GDataAccount;
+import org.apache.lucene.gdata.data.ServerBaseEntry;
+import org.apache.lucene.gdata.data.ServerBaseFeed;
+import org.apache.lucene.gdata.server.registry.Component;
+import org.apache.lucene.gdata.server.registry.ComponentType;
+import org.apache.lucene.gdata.storage.Storage;
+import org.apache.lucene.gdata.storage.StorageController;
+import org.apache.lucene.gdata.storage.StorageException;
+
+import com.google.gdata.data.BaseEntry;
+import com.google.gdata.data.BaseFeed;
+
+/**
+ * @author Simon Willnauer
+ *
+ */
+@Component(componentType=ComponentType.STORAGECONTROLLER)
+public class StorageStub implements Storage, StorageController {
+public static String SERVICE_TYPE_RETURN = "service";
+    /**
+     * 
+     */
+    public StorageStub() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#storeEntry(org.apache.lucene.gdata.data.ServerBaseEntry)
+     */
+    public BaseEntry storeEntry(ServerBaseEntry entry)
+            throws StorageException {
+
+        return null;
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#deleteEntry(org.apache.lucene.gdata.data.ServerBaseEntry)
+     */
+    public void deleteEntry(ServerBaseEntry entry) throws StorageException {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#updateEntry(org.apache.lucene.gdata.data.ServerBaseEntry)
+     */
+    public BaseEntry updateEntry(ServerBaseEntry entry)
+            throws StorageException {
+
+        return null;
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#getFeed(org.apache.lucene.gdata.data.ServerBaseFeed)
+     */
+    public BaseFeed getFeed(ServerBaseFeed feed) throws StorageException {
+
+        return null;
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#getEntry(org.apache.lucene.gdata.data.ServerBaseEntry)
+     */
+    public BaseEntry getEntry(ServerBaseEntry entry)
+            throws StorageException {
+
+        return null;
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#storeAccount(org.apache.lucene.gdata.data.GDataAccount)
+     */
+    public void storeAccount(GDataAccount Account) throws StorageException {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#updateAccount(org.apache.lucene.gdata.data.GDataAccount)
+     */
+    public void updateAccount(GDataAccount Account) throws StorageException {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#deleteAccount(java.lang.String)
+     */
+    public void deleteAccount(String Accountname) throws StorageException {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#storeFeed(org.apache.lucene.gdata.data.ServerBaseFeed,
java.lang.String)
+     */
+    public void storeFeed(ServerBaseFeed feed, String accountname)
+            throws StorageException {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#deleteFeed(java.lang.String)
+     */
+    public void deleteFeed(String feedId) throws StorageException {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#updateFeed(org.apache.lucene.gdata.data.ServerBaseFeed,
java.lang.String)
+     */
+    public void updateFeed(ServerBaseFeed feed, String accountname)
+            throws StorageException {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#close()
+     */
+    public void close() {
+    }
+
+    /**
+     * @see org.apache.lucene.gdata.storage.Storage#getServiceForFeed(java.lang.String)
+     */
+    public String getServiceForFeed(String feedId) throws StorageException {
+
+        return SERVICE_TYPE_RETURN;
+    }
+
+    public void destroy() {
+    }
+
+    public Storage getStorage() throws StorageException {
+        
+        return new StorageStub();
+    }
+
+    public GDataAccount getAccount(String accountName) throws StorageException {
+        
+        return null;
+    }
+
+    public String getAccountNameForFeedId(String feedId) throws StorageException {
+        
+        return null;
+    }
+
+    public void initialize() {
+    }
+
+
+    public Long getFeedLastModified(String feedId) throws StorageException {
+        
+        return null;
+    }
+
+    public Long getEntryLastModified(String entryId, String feedId) throws StorageException
{
+        
+        return null;
+    }
+
+}

Added: lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/TestDateFormater.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/TestDateFormater.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/TestDateFormater.java
(added)
+++ lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/TestDateFormater.java
Tue Jun 27 12:31:20 2006
@@ -0,0 +1,38 @@
+package org.apache.lucene.gdata.utils;
+
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern;
+
+import junit.framework.TestCase;
+
+public class TestDateFormater extends TestCase {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /*
+     * Test method for 'org.apache.lucene.gdata.utils.DateFormater.formatDate(Date, String)'
+     */
+    public void testFormatDate() throws ParseException {
+        
+        // this reg. --> bit weak but does the job
+            java.util.regex.Pattern pattern =  java.util.regex.Pattern.compile("[A-Z][a-z]{2},
[0-9]{1,2} [A-Z][a-z]{2} [0-9]{4} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2} [A-Z]{2,4}");
+            Date date = new Date();
+            System.out.println(date.getTime());
+            String formatedDate = DateFormater.formatDate(date,DateFormater.HTTP_HEADER_DATE_FORMAT);
+            assertTrue(pattern.matcher(formatedDate).matches());    
+            System.out.println(DateFormater.parseDate(formatedDate,DateFormater.HTTP_HEADER_DATE_FORMAT).getTime());
+            DateFormater.parseDate("Sun, 25 Jun 2006 13:51:23 +0000",DateFormater.HTTP_HEADER_DATE_FORMAT,DateFormater.HTTP_HEADER_DATE_FORMAT_TIME_OFFSET);
+        
+    }
+
+}

Added: lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-account.xsd
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-account.xsd?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-account.xsd (added)
+++ lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-account.xsd Tue Jun
27 12:31:20 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+	<xs:element name="password">
+		<xs:simpleType>
+			<xs:restriction base="xs:string">
+				<xs:minLength value="5" />
+			</xs:restriction>
+		</xs:simpleType>
+	</xs:element> 
+	<xs:element name="account-name">
+		<xs:simpleType>
+			<xs:restriction base="xs:string">
+				<xs:whiteSpace value="collapse" />
+			</xs:restriction>
+		</xs:simpleType>
+	</xs:element>
+
+	<xs:element name="email-address" type="xs:string" />
+	<xs:element name="url" type="xs:anyURI" />
+	<xs:element name="name" type="xs:string" />
+	<xs:element name="account-role">
+		<xs:simpleType>
+			<xs:restriction base="xs:positiveInteger">
+				<xs:fractionDigits value="2" />
+			</xs:restriction>
+		</xs:simpleType>
+	</xs:element>
+
+
+	<xs:element name="account-owner">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="name" />
+				<xs:element ref="email-address" />
+				<xs:element ref="url" />
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+
+	<xs:element name="account">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="account-name" />
+				<xs:element ref="password" />
+				<xs:element ref="account-role" />
+				<xs:element ref="account-owner" minOccurs="0" />
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>
\ No newline at end of file

Added: lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-config.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-config.xml?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-config.xml (added)
+++ lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-config.xml Tue Jun
27 12:31:20 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gdata>
+	<service name="feed" public="true">
+		<feed-class>com.google.gdata.data.Feed</feed-class>
+		<entry-class>com.google.gdata.data.Entry</entry-class>
+		<extension-profile>
+			com.google.gdata.data.ExtensionProfile
+		</extension-profile>
+	</service>
+	<service name="calendar" public="true">
+		<feed-class>
+			com.google.gdata.data.extensions.EventFeed
+		</feed-class>
+		<entry-class>
+			com.google.gdata.data.extensions.EventEntry
+		</entry-class>
+		<extension-profile>
+			com.google.gdata.data.ExtensionProfile
+		</extension-profile>
+	</service>
+	<server-components>
+		<component>
+			org.apache.lucene.gdata.storage.lucenestorage.StorageCoreController
+		</component>
+		<component>
+			org.apache.lucene.gdata.servlet.handler.DefaultRequestHandlerFactory
+		</component>
+		<component>
+			org.apache.lucene.gdata.server.ServiceFactory
+		</component>
+		<component>
+			org.apache.lucene.gdata.server.authentication.BlowfishAuthenticationController
+		</component>
+	</server-components>
+</gdata>
\ No newline at end of file

Added: lucene/java/trunk/contrib/gdata-server/webroot/meta-inf/context.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/webroot/meta-inf/context.xml?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/webroot/meta-inf/context.xml (added)
+++ lucene/java/trunk/contrib/gdata-server/webroot/meta-inf/context.xml Tue Jun 27 12:31:20
2006
@@ -0,0 +1,12 @@
+<!--
+    Context configuration file for the GDATA Server Web App
+-->
+
+
+<Context docBase="${catalina.home}/webapps/gdata-server"
+         privileged="false" reloadable="true" cookies="false" antiResourceLocking="false"
antiJARLocking="false">
+
+
+
+</Context>
+



Mime
View raw message