You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by ho...@apache.org on 2006/06/27 21:31:23 UTC
svn commit: r417565 [1/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...
Author: hossman
Date: Tue Jun 27 12:31:20 2006
New Revision: 417565
URL: http://svn.apache.org/viewvc?rev=417565&view=rev
Log:
LUCENE-618: commiting GData server patch 27.06.06.diff
Added:
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseEntry.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseFeed.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AccountBuilder.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AdminService.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/GDataAdminService.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/package.html
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationController.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationException.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticatorException.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/BlowfishAuthenticationController.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/GDataHttpAuthenticator.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/package.html
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/Component.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/ComponentType.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/ProvidedService.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/ProvidedServiceConfig.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/RegistryException.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/ServerComponent.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/registry/SuperType.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/AccountAdministrationServlet.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/AuthenticationServlet.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/FeedAdministrationServlet.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/AbstractAccountHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/AbstractFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/AuthenticationHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DeleteAccountStrategy.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/DeleteFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/InsertAccountStrategy.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/InsertFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/RequestAuthenticator.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/UpdataAccountStrategy.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/servlet/handler/UpdateFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/ResourceNotFoundException.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageAccountWrapper.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageFeedWrapper.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/StorageWrapper.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/recover/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/recover/RecoverController.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/recover/RecoverException.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/recover/RecoverReader.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/recover/RecoverWriter.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/storage/lucenestorage/recover/package.html
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/utils/
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/utils/DateFormater.java
lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/utils/package.html
lucene/java/trunk/contrib/gdata-server/src/test/gdata-config.xml
lucene/java/trunk/contrib/gdata-server/src/test/lucenestorage.properties.xml
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/data/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/data/TestGDataUser.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/administration/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/administration/TestAccountBuilder.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/authentication/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/server/authentication/TestBlowfishAuthenticationController.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestAbstractFeedHandler.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/servlet/handler/TestRequestAuthenticator.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/StorageModifierStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/recover/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/recover/TestRecoverController.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/recover/TestRecoverWriter.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/storage/lucenestorage/recover/TestRevocerReader.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/AuthenticationContorllerStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ProvidedServiceStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/ServiceFactoryStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageControllerStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/StorageStub.java
lucene/java/trunk/contrib/gdata-server/src/test/org/apache/lucene/gdata/utils/TestDateFormater.java
lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-account.xsd
lucene/java/trunk/contrib/gdata-server/webroot/WEB-INF/classes/gdata-config.xml
lucene/java/trunk/contrib/gdata-server/webroot/meta-inf/
lucene/java/trunk/contrib/gdata-server/webroot/meta-inf/context.xml
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/GDataAccount.java Tue Jun 27 12:31:20 2006
@@ -0,0 +1,332 @@
+/**
+ * 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.data;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import com.google.gdata.data.Person;
+
+/**
+ * The GData-Server system provides acccount to be associated with registered
+ * feed. Every feed has an owner account. The account holder is automaticaly in
+ * role to modify his feeds. One account can own <i>n</i> feeds having <i>m</i>
+ * entries.
+ * <p>
+ * Additionally an account can be in role to modify other feeds, create accounts
+ * or feeds. See {@link AccountRole} for detailed infomation about roles. One
+ * account can also have more than one role. All roles in {@link AccountRole}
+ * can be combined
+ * </p>
+ * <p>
+ * For each account values for author name, author email and author link can be
+ * set at creation time or during an update. These values will be used as the
+ * corresponding values for the feed
+ * {@link org.apache.lucene.gdata.data.ServerBaseFeed#addAuthor(Person)} if no
+ * value for the feed has be specified.
+ * </p>
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class GDataAccount {
+ private String name;
+
+ private String authorname;
+
+ private String authorMail;
+
+ private URL authorLink;
+
+ private String password;
+
+ private Set<AccountRole> roles = new HashSet<AccountRole>(4);
+
+ /**
+ * Creates a new GDataAccount. The default role {@link AccountRole#USER}
+ * will be set.
+ *
+ */
+ public GDataAccount() {
+ this.roles.add(AccountRole.USER);
+
+ }
+
+ /**
+ * @return - the password
+ */
+ public String getPassword() {
+ return this.password;
+ }
+
+ /**
+ * @param password -
+ * the account Password
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ /**
+ * @return - the account name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @param name
+ * The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return - the http link specified for the author
+ */
+ public URL getAuthorLink() {
+ return this.authorLink;
+ }
+
+ /**
+ * @param authorLink -
+ * the http link specified for the author
+ */
+ public void setAuthorLink(URL authorLink) {
+ this.authorLink = authorLink;
+ }
+
+ /**
+ * @return - the authors mail address
+ */
+ public String getAuthorMail() {
+ return this.authorMail;
+ }
+
+ /**
+ * @param authorMail -
+ * the authors mail address
+ */
+ public void setAuthorMail(String authorMail) {
+ this.authorMail = authorMail;
+ }
+
+ /**
+ * @return - the name specified as being the author name
+ */
+ public String getAuthorname() {
+ return this.authorname;
+ }
+
+ /**
+ * @param authorname -
+ * the name specified as being the author name
+ */
+ public void setAuthorname(String authorname) {
+ this.authorname = authorname;
+ }
+
+ /**
+ * Adds the given role to the role list
+ *
+ * @param role -
+ * the role to add to the role list
+ */
+ public void setRole(AccountRole role) {
+ if (role == null)
+ return;
+ this.roles.add(role);
+ }
+
+ /**
+ * @return - the set containing all roles
+ */
+ public Set<AccountRole> getRoles() {
+ return this.roles;
+ }
+
+ /**
+ * @param role -
+ * the role to check
+ * @return <code>true</code> if the role list contains the given role
+ */
+ public boolean isUserInRole(AccountRole role) {
+ if (role == null)
+ return false;
+ return this.roles.contains(role);
+ }
+
+ /**
+ * @see GDataAccount#setRolesAsInt(int)
+ * @return - the integer representation for the user roles
+ */
+ public int getRolesAsInt() {
+ // 1 as the Userrole is always set
+ int bits = 1;
+ for (AccountRole role : this.roles) {
+ if (role == AccountRole.ENTRYAMINISTRATOR)
+ bits ^= 2;
+ else if (role == AccountRole.FEEDAMINISTRATOR)
+ bits ^= 4;
+ else if (role == AccountRole.USERADMINISTRATOR)
+ bits ^= 8;
+
+ }
+ return bits;
+
+ }
+
+ /**
+ * Sets the roles from a int representation.
+ * <ol>
+ * <li>The fist bit set indicates a {@link AccountRole#USER} - int value 1</li>
+ * <li>The second bit set indicates a {@link AccountRole#ENTRYAMINISTRATOR} -
+ * int value 2</li>
+ * <li>The third bit set indicates a {@link AccountRole#FEEDAMINISTRATOR} -
+ * int value 4</li>
+ * <li>The forth bit set indicates a {@link AccountRole#USERADMINISTRATOR} -
+ * int value 8</li>
+ * <ol>
+ * This method will only set roles, will not remove roles! A combination of
+ * roles is also possible e.g. the int value 6 combines
+ * {@link AccountRole#ENTRYAMINISTRATOR} and
+ * {@link AccountRole#FEEDAMINISTRATOR}.
+ *
+ * @param i -
+ * the integer used to set the roles
+ */
+ public void setRolesAsInt(int i) {
+
+ if ((i & 2) > 0)
+ this.roles.add(AccountRole.ENTRYAMINISTRATOR);
+ if ((i & 4) > 0)
+ this.roles.add(AccountRole.FEEDAMINISTRATOR);
+ if ((i & 8) > 0)
+ this.roles.add(AccountRole.USERADMINISTRATOR);
+
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (!(o instanceof GDataAccount) || o == null)
+ return false;
+ GDataAccount toCompare = (GDataAccount) o;
+ if (this.name.equals(toCompare.name))
+ return true;
+ return false;
+
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ int ret = 37;
+ ret = 9 * ret + this.name.hashCode();
+ return ret;
+ }
+
+ /**
+ * Checks the requiered values for creating an account are set. Required
+ * values are <tt>name</tt> and <tt>password</tt> the minimum length of
+ * these values is 6.
+ *
+ * @return <code>true</code> if an only if password and name are not <code>null</code> and the length is <tt>> 5</tt>
+ */
+ public boolean requiredValuesSet() {
+ return (this.name != null && this.password != null
+ && this.name.length() > 5 && this.password.length() > 5);
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString(){
+ StringBuilder builder = new StringBuilder("GdataAccount: ");
+ builder.append("name: ").append(this.name);
+ builder.append(" password: ").append((this.password!= null?" length: "+this.password.length():null));
+ builder.append(" author: ").append(this.authorname);
+ builder.append(" author email: ").append(this.authorMail);
+ builder.append(" author link: ").append(this.authorLink);
+ return builder.toString();
+ }
+
+ /**
+ * checks whether the given integer matches the account role.
+ * @param intRole - integer representation of a role
+ * @param role - the accountrole to match
+ * @return <code>true</code> if and only if the given roles match, otherwise <code>false</code>
+ */
+ public static boolean isInRole(int intRole, AccountRole role){
+ if(role == AccountRole.USER)
+ return (intRole&1)>0;
+ if (role == AccountRole.ENTRYAMINISTRATOR)
+ return (intRole&2) >0 ;
+ else if (role == AccountRole.FEEDAMINISTRATOR)
+ return (intRole&4) >0 ;
+ else if (role == AccountRole.USERADMINISTRATOR)
+ return (intRole&8) >0 ;
+ return false;
+ }
+
+ /**
+ * @return - a new Administartor accoutn
+ */
+ public static final GDataAccount createAdminAccount(){
+ GDataAccount retVal = new GDataAccount();
+ retVal.setName("administrator");
+ retVal.setPassword("password");
+ retVal.setRole(AccountRole.USERADMINISTRATOR);
+ retVal.setRole(AccountRole.FEEDAMINISTRATOR);
+ retVal.setRole(AccountRole.ENTRYAMINISTRATOR);
+ return retVal;
+ }
+
+ /**
+ * This enum respesents all account roles an account can have.
+ *
+ * @author Simon Willnauer
+ *
+ */
+ public enum AccountRole {
+
+ /**
+ * Can create / alter user
+ */
+ USERADMINISTRATOR,
+
+ /**
+ * Can create / alter feeds
+ */
+ FEEDAMINISTRATOR,
+ /**
+ * Can create / alter entries
+ */
+ ENTRYAMINISTRATOR,
+ /**
+ * can create / alter his own feed entries
+ */
+ USER
+ }
+
+}
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseEntry.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseEntry.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseEntry.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseEntry.java Tue Jun 27 12:31:20 2006
@@ -0,0 +1,623 @@
+/**
+ * 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.data;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.lucene.gdata.server.registry.ProvidedService;
+
+import com.google.gdata.client.Service;
+import com.google.gdata.data.BaseEntry;
+import com.google.gdata.data.Content;
+import com.google.gdata.data.DateTime;
+import com.google.gdata.data.Entry;
+import com.google.gdata.data.Extension;
+import com.google.gdata.data.ExtensionProfile;
+import com.google.gdata.data.Link;
+import com.google.gdata.data.Source;
+import com.google.gdata.data.TextConstruct;
+import com.google.gdata.util.ParseException;
+import com.google.gdata.util.ServiceException;
+import com.google.gdata.util.XmlBlob;
+import com.google.gdata.util.common.xml.XmlWriter;
+
+/**
+ * The GData-Server uses the GDATA-Client API for an interal representation of
+ * entries. These entities have dynamic elements like Links being generated
+ * using the requested URL.<br/> Some components of the server also need
+ * additional infomation like the service type
+ * {@link org.apache.lucene.gdata.server.registry.ProvidedService} of the entry
+ * and the feedid a entry belongs to. All these information are
+ * encapsulated in the ServerBaseEntry decorating a concrete sub class of <tt>BaseEntry</tt>. The actual
+ * {@link com.google.gdata.data.BaseEntry} will be passed to the ServerBaseEntry
+ * at creation time via the constructor. To use the ServerBaseFeed for generation a provided format like
+ * RSS/ATOM the corresponding {@link com.google.gdata.data.ExtensionProfile} has
+ * to be provided to the generation method.
+ * <p> For a general overview of the generic BaseFeed class see the gdata-client API documentation</p>
+ *
+ * @see com.google.gdata.data.ExtensionProfile
+ * @see com.google.gdata.data.BaseFeed
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class ServerBaseEntry {
+ private String feedId;
+
+ private String serviceType;
+
+ private ProvidedService serviceConfig;
+ private BaseEntry entry;
+
+
+
+
+ /**
+ * @return - the provided service for the source entry
+ */
+ public ProvidedService getServiceConfig() {
+ return this.serviceConfig;
+ }
+
+ /**
+ * @param serviceConfig - the provided service for the source entry
+ */
+ public void setServiceConfig(ProvidedService serviceConfig) {
+ this.serviceConfig = serviceConfig;
+ if (serviceConfig != null)
+ this.serviceType = serviceConfig.getName();
+ }
+
+ /**
+ * @return - the name of the service related of the feed containing this entry
+ */
+ public String getServiceType() {
+ return this.serviceType;
+ }
+
+ /**
+ * Constructs a new ServerBaseEntry.
+ * To provide a concrete entry to decorate after object creation use {@link ServerBaseEntry#setEntry(BaseEntry)}
+ *
+ */
+ @SuppressWarnings("unchecked")
+ public ServerBaseEntry() {
+
+ this.entry = new Entry();
+ }
+
+ /**
+ * @param arg0 - the source entry
+ */
+ @SuppressWarnings("unchecked")
+ public ServerBaseEntry(BaseEntry arg0) {
+ this.entry = arg0;
+
+ }
+
+
+ /**
+ * @param link - a link added to this entry
+ */
+ @SuppressWarnings("unchecked")
+ public void addLink(final Link link) {
+ this.entry.getLinks().add(link);
+ }
+
+ /**
+ * @return - the id of the owning feed
+ */
+ public String getFeedId() {
+ return this.feedId;
+ }
+
+ /**
+ * @param feedId - the id of the owning feed
+ */
+ public void setFeedId(String feedId) {
+ this.feedId = feedId;
+ }
+ /**
+ * @return - the decorated entry
+ */
+ public BaseEntry getEntry(){
+ return this.entry;
+ }
+ /**
+ * @param entry - the entry to decorate
+ */
+ public void setEntry(BaseEntry entry){
+ this.entry = entry;
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#addHtmlLink(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void addHtmlLink(String arg0, String arg1, String arg2) {
+
+ this.entry.addHtmlLink(arg0, arg1, arg2);
+ }
+
+
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#generateAtom(com.google.gdata.util.common.xml.XmlWriter, com.google.gdata.data.ExtensionProfile)
+ */
+
+ public void generateAtom(XmlWriter arg0, ExtensionProfile arg1) throws IOException {
+
+ this.entry.generateAtom(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#generateRss(com.google.gdata.util.common.xml.XmlWriter, com.google.gdata.data.ExtensionProfile)
+ */
+
+ public void generateRss(XmlWriter arg0, ExtensionProfile arg1) throws IOException {
+
+ this.entry.generateRss(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getAuthors()
+ */
+
+ public List getAuthors() {
+
+ return this.entry.getAuthors();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getCanEdit()
+ */
+
+ public boolean getCanEdit() {
+
+ return this.entry.getCanEdit();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getCategories()
+ */
+
+ public Set getCategories() {
+
+ return this.entry.getCategories();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getContent()
+ */
+
+ public Content getContent() {
+
+ return this.entry.getContent();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getContributors()
+ */
+
+ public List getContributors() {
+
+ return this.entry.getContributors();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getEditLink()
+ */
+
+ public Link getEditLink() {
+
+ return this.entry.getEditLink();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getHtmlLink()
+ */
+
+ public Link getHtmlLink() {
+
+ return this.entry.getHtmlLink();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getId()
+ */
+
+ public String getId() {
+
+ return this.entry.getId();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getLink(java.lang.String, java.lang.String)
+ */
+
+ public Link getLink(String arg0, String arg1) {
+
+ return this.entry.getLink(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getLinks()
+ */
+
+ public List getLinks() {
+
+ return this.entry.getLinks();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getPublished()
+ */
+
+ public DateTime getPublished() {
+
+ return this.entry.getPublished();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getRights()
+ */
+
+ public TextConstruct getRights() {
+
+ return this.entry.getRights();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getSelf()
+ */
+
+ public BaseEntry getSelf() throws IOException, ServiceException {
+
+ return this.entry.getSelf();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getSelfLink()
+ */
+
+ public Link getSelfLink() {
+
+ return this.entry.getSelfLink();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getService()
+ */
+
+ public Service getService() {
+
+ return this.entry.getService();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getSource()
+ */
+
+ public Source getSource() {
+
+ return this.entry.getSource();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getSummary()
+ */
+
+ public TextConstruct getSummary() {
+
+ return this.entry.getSummary();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getTitle()
+ */
+
+ public TextConstruct getTitle() {
+
+ return this.entry.getTitle();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getUpdated()
+ */
+
+ public DateTime getUpdated() {
+
+ return this.entry.getUpdated();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#getVersionId()
+ */
+
+ public String getVersionId() {
+
+ return this.entry.getVersionId();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#isDraft()
+ */
+
+ public boolean isDraft() {
+
+ return this.entry.isDraft();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#parseAtom(com.google.gdata.data.ExtensionProfile, java.io.InputStream)
+ */
+
+ public void parseAtom(ExtensionProfile arg0, InputStream arg1) throws IOException, ParseException {
+
+ this.entry.parseAtom(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#parseAtom(com.google.gdata.data.ExtensionProfile, java.io.Reader)
+ */
+
+ public void parseAtom(ExtensionProfile arg0, Reader arg1) throws IOException, ParseException {
+
+ this.entry.parseAtom(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setCanEdit(boolean)
+ */
+
+ public void setCanEdit(boolean arg0) {
+
+ this.entry.setCanEdit(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setContent(com.google.gdata.data.Content)
+ */
+
+ public void setContent(Content arg0) {
+
+ this.entry.setContent(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setContent(com.google.gdata.data.TextConstruct)
+ */
+
+ public void setContent(TextConstruct arg0) {
+
+ this.entry.setContent(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setDraft(boolean)
+ */
+
+ public void setDraft(boolean arg0) {
+
+ this.entry.setDraft(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setId(java.lang.String)
+ */
+
+ public void setId(String arg0) {
+
+ this.entry.setId(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setPublished(com.google.gdata.data.DateTime)
+ */
+
+ public void setPublished(DateTime arg0) {
+
+ this.entry.setPublished(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setRights(com.google.gdata.data.TextConstruct)
+ */
+
+ public void setRights(TextConstruct arg0) {
+
+ this.entry.setRights(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setService(com.google.gdata.client.Service)
+ */
+
+ public void setService(Service arg0) {
+
+ this.entry.setService(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setSource(com.google.gdata.data.Source)
+ */
+
+ public void setSource(Source arg0) {
+
+ this.entry.setSource(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setSummary(com.google.gdata.data.TextConstruct)
+ */
+
+ public void setSummary(TextConstruct arg0) {
+
+ this.entry.setSummary(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setTitle(com.google.gdata.data.TextConstruct)
+ */
+
+ public void setTitle(TextConstruct arg0) {
+
+ this.entry.setTitle(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setUpdated(com.google.gdata.data.DateTime)
+ */
+
+ public void setUpdated(DateTime arg0) {
+
+ this.entry.setUpdated(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#setVersionId(java.lang.String)
+ */
+
+ public void setVersionId(String arg0) {
+
+ this.entry.setVersionId(arg0);
+ }
+
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#addExtension(com.google.gdata.data.Extension)
+ */
+
+ public void addExtension(Extension arg0) {
+
+ this.entry.addExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#addRepeatingExtension(com.google.gdata.data.Extension)
+ */
+
+ public void addRepeatingExtension(Extension arg0) {
+
+ this.entry.addRepeatingExtension(arg0);
+ }
+
+
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#generateCumulativeXmlBlob(com.google.gdata.data.ExtensionProfile)
+ */
+
+ public XmlBlob generateCumulativeXmlBlob(ExtensionProfile arg0) throws IOException {
+
+ return this.entry.generateCumulativeXmlBlob(arg0);
+ }
+
+
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#getRepeatingExtension(java.lang.Class)
+ */
+
+ public <T extends Extension> List<T> getRepeatingExtension(Class<T> arg0) {
+
+ return this.entry.getRepeatingExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#getXmlBlob()
+ */
+
+ public XmlBlob getXmlBlob() {
+
+ return this.entry.getXmlBlob();
+ }
+
+
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#parseCumulativeXmlBlob(com.google.gdata.util.XmlBlob, com.google.gdata.data.ExtensionProfile, java.lang.Class)
+ */
+
+ public void parseCumulativeXmlBlob(XmlBlob arg0, ExtensionProfile arg1, Class arg2) throws IOException, ParseException {
+
+ this.entry.parseCumulativeXmlBlob(arg0, arg1, arg2);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#removeExtension(java.lang.Class)
+ */
+
+ public void removeExtension(Class arg0) {
+
+ this.entry.removeExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#removeExtension(com.google.gdata.data.Extension)
+ */
+
+ public void removeExtension(Extension arg0) {
+
+ this.entry.removeExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#removeRepeatingExtension(com.google.gdata.data.Extension)
+ */
+
+ public void removeRepeatingExtension(Extension arg0) {
+
+ this.entry.removeRepeatingExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#setExtension(com.google.gdata.data.Extension)
+ */
+
+ public void setExtension(Extension arg0) {
+
+ this.entry.setExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#setXmlBlob(com.google.gdata.util.XmlBlob)
+ */
+
+ public void setXmlBlob(XmlBlob arg0) {
+
+ this.entry.setXmlBlob(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseEntry#declareExtensions(com.google.gdata.data.ExtensionProfile)
+ */
+
+ public void declareExtensions(ExtensionProfile arg0) {
+ this.entry.declareExtensions(arg0);
+ }
+
+
+
+
+
+
+
+}
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseFeed.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseFeed.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseFeed.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/data/ServerBaseFeed.java Tue Jun 27 12:31:20 2006
@@ -0,0 +1,683 @@
+/**
+ * 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.data;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.lucene.gdata.server.registry.ProvidedService;
+
+import com.google.gdata.client.Service;
+import com.google.gdata.data.BaseEntry;
+import com.google.gdata.data.BaseFeed;
+import com.google.gdata.data.Category;
+import com.google.gdata.data.DateTime;
+import com.google.gdata.data.Extension;
+import com.google.gdata.data.ExtensionProfile;
+import com.google.gdata.data.Feed;
+import com.google.gdata.data.Generator;
+import com.google.gdata.data.Link;
+import com.google.gdata.data.Person;
+import com.google.gdata.data.TextConstruct;
+import com.google.gdata.util.ParseException;
+import com.google.gdata.util.ServiceException;
+import com.google.gdata.util.XmlBlob;
+import com.google.gdata.util.common.xml.XmlWriter;
+
+/**
+ * The GData-Server uses the GDATA-Client API for an interal representation of
+ * entries. These entities have dynamic elements like Links being generated
+ * using the requested URL.<br/> Some components of the server also need
+ * additional infomation like the service type
+ * {@link org.apache.lucene.gdata.server.registry.ProvidedService} of the feed.
+ * All these information are
+ * encapsulated in the ServerBaseFeed decoration a concrete subl class of <tt>BaseFeed</tt>. The type of the
+ * {@link com.google.gdata.data.BaseEntry} contained it this feed will be passed to the ServerBaseFeed
+ * at creation time via the constructor. To retrieve the original entry call
+ * {@link ServerBaseFeed#getFeed()} returns a
+ * {@link com.google.gdata.data.BaseFeed} instance which can be casted into the
+ * actual type. To use the ServerBaseEntry for generation a provided format like
+ * RSS/ATOM the corresponding {@link com.google.gdata.data.ExtensionProfile} has
+ * to be provided to the generation method.
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class ServerBaseFeed {
+
+ private String serviceType;
+
+ private ProvidedService serviceConfig;
+
+ private GDataAccount account;
+
+ private BaseFeed feed;
+ /**
+ * @return Returns the account.
+ */
+ public GDataAccount getAccount() {
+ return this.account;
+ }
+
+ /**
+ * @param account The account to set.
+ */
+ public void setAccount(GDataAccount account) {
+ this.account = account;
+ }
+
+ /**
+ * Creates a new ServerBaseFeed and decorates a basic instance of {@link Feed}
+ */
+ @SuppressWarnings("unchecked")
+ public ServerBaseFeed() {
+ this.feed = new Feed();
+
+ }
+ /**
+ * @param feed - the feed to decorate
+ *
+ */
+ @SuppressWarnings("unchecked")
+ public ServerBaseFeed(BaseFeed feed) {
+ this.feed = feed;
+
+ }
+
+ /**
+ * @return Returns the feed.
+ */
+ public BaseFeed getFeed() {
+ return this.feed;
+ }
+
+ /**
+ * @param feed The feed to set.
+ */
+ public void setFeed(BaseFeed feed) {
+ this.feed = feed;
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#declareExtensions(com.google.gdata.data.ExtensionProfile)
+ */
+ public void declareExtensions(ExtensionProfile extProfile) {
+
+ this.feed.declareExtensions(extProfile);
+ }
+
+ /**
+ * @param link -
+ * a link added to the link list of the feed
+ */
+ @SuppressWarnings("unchecked")
+ public void addLink(final Link link) {
+ this.feed.getLinks().add(link);
+ }
+
+ /**
+ * @param collection -
+ * a collection of <code>Link</code> instance to be added to
+ * the feeds link list
+ */
+ public void addLinks(final Collection<Link> collection) {
+ this.feed.getLinks().addAll(collection);
+ }
+
+ /**
+ * @return - the name of the service related of the feed represented by this
+ * ServerBaseFeed
+ */
+ public String getServiceType() {
+ return this.serviceType;
+ }
+
+ /**
+ * @param serviceType -
+ * the name of the service related of the feed represented by
+ * this ServerBaseFeed
+ */
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ /**
+ * @return - the provided service
+ */
+ public ProvidedService getServiceConfig() {
+ return this.serviceConfig;
+ }
+
+ /**
+ * @param serviceConfig - -
+ * the provided service
+ */
+ public void setServiceConfig(ProvidedService serviceConfig) {
+ this.serviceConfig = serviceConfig;
+ if (serviceConfig != null)
+ this.serviceType = this.serviceConfig.getName();
+
+ }
+
+ /**
+ * @param person -
+ * adds an author to the feed
+ */
+ public void addAuthor(final Person person) {
+ this.feed.getAuthors().add(person);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#createEntry()
+ */
+
+ public BaseEntry createEntry() {
+
+ return this.feed.createEntry();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#generateAtom(com.google.gdata.util.common.xml.XmlWriter, com.google.gdata.data.ExtensionProfile)
+ */
+
+ public void generateAtom(XmlWriter arg0, ExtensionProfile arg1) throws IOException {
+
+ this.feed.generateAtom(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#generateAtomColl(com.google.gdata.util.common.xml.XmlWriter)
+ */
+
+ public void generateAtomColl(XmlWriter arg0) throws IOException {
+
+ this.feed.generateAtomColl(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#generateRss(com.google.gdata.util.common.xml.XmlWriter, com.google.gdata.data.ExtensionProfile)
+ */
+
+ public void generateRss(XmlWriter arg0, ExtensionProfile arg1) throws IOException {
+
+ this.feed.generateRss(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getCanPost()
+ */
+
+ public boolean getCanPost() {
+
+ return this.feed.getCanPost();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getEntries()
+ */
+
+ public List getEntries() {
+
+ return this.feed.getEntries();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getEntryPostLink()
+ */
+
+ public Link getEntryPostLink() {
+
+ return this.feed.getEntryPostLink();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getItemsPerPage()
+ */
+
+ public int getItemsPerPage() {
+
+ return this.feed.getItemsPerPage();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getSelf()
+ */
+
+ public BaseFeed getSelf() throws IOException, ServiceException {
+
+ return this.feed.getSelf();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getSelfLink()
+ */
+
+ public Link getSelfLink() {
+
+ return this.feed.getSelfLink();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getService()
+ */
+
+ public Service getService() {
+
+ return this.feed.getService();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getStartIndex()
+ */
+
+ public int getStartIndex() {
+
+ return this.feed.getStartIndex();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#getTotalResults()
+ */
+
+ public int getTotalResults() {
+
+ return this.feed.getTotalResults();
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#insert(E)
+ */
+
+ public BaseEntry insert(BaseEntry arg0) throws ServiceException, IOException {
+
+ return this.feed.insert(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#parseAtom(com.google.gdata.data.ExtensionProfile, java.io.InputStream)
+ */
+
+ public void parseAtom(ExtensionProfile arg0, InputStream arg1) throws IOException, ParseException {
+
+ this.feed.parseAtom(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#parseAtom(com.google.gdata.data.ExtensionProfile, java.io.Reader)
+ */
+
+ public void parseAtom(ExtensionProfile arg0, Reader arg1) throws IOException, ParseException {
+
+ this.feed.parseAtom(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#setCanPost(boolean)
+ */
+
+ public void setCanPost(boolean arg0) {
+
+ this.feed.setCanPost(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#setItemsPerPage(int)
+ */
+
+ public void setItemsPerPage(int arg0) {
+
+ this.feed.setItemsPerPage(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#setService(com.google.gdata.client.Service)
+ */
+
+ public void setService(Service arg0) {
+
+ this.feed.setService(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#setStartIndex(int)
+ */
+
+ public void setStartIndex(int arg0) {
+
+ this.feed.setStartIndex(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.BaseFeed#setTotalResults(int)
+ */
+
+ public void setTotalResults(int arg0) {
+
+ this.feed.setTotalResults(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#addHtmlLink(java.lang.String, java.lang.String, java.lang.String)
+ */
+
+ public void addHtmlLink(String arg0, String arg1, String arg2) {
+
+ this.feed.addHtmlLink(arg0, arg1, arg2);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getAuthors()
+ */
+
+ public List<Person> getAuthors() {
+
+ return this.feed.getAuthors();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getCategories()
+ */
+
+ public Set<Category> getCategories() {
+
+ return this.feed.getCategories();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getContributors()
+ */
+
+ public List<Person> getContributors() {
+
+ return this.feed.getContributors();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getGenerator()
+ */
+
+ public Generator getGenerator() {
+
+ return this.feed.getGenerator();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getHtmlLink()
+ */
+
+ public Link getHtmlLink() {
+
+ return this.feed.getHtmlLink();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getIcon()
+ */
+
+ public String getIcon() {
+
+ return this.feed.getIcon();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getId()
+ */
+
+ public String getId() {
+
+ return this.feed.getId();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getLink(java.lang.String, java.lang.String)
+ */
+
+ public Link getLink(String arg0, String arg1) {
+
+ return this.feed.getLink(arg0, arg1);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getLinks()
+ */
+
+ public List<Link> getLinks() {
+
+ return this.feed.getLinks();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getLogo()
+ */
+
+ public String getLogo() {
+
+ return this.feed.getLogo();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getRights()
+ */
+
+ public TextConstruct getRights() {
+
+ return this.feed.getRights();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getSubtitle()
+ */
+
+ public TextConstruct getSubtitle() {
+
+ return this.feed.getSubtitle();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getTitle()
+ */
+
+ public TextConstruct getTitle() {
+
+ return this.feed.getTitle();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#getUpdated()
+ */
+
+ public DateTime getUpdated() {
+
+ return this.feed.getUpdated();
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#setGenerator(com.google.gdata.data.Generator)
+ */
+
+ public void setGenerator(Generator arg0) {
+
+ this.feed.setGenerator(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#setIcon(java.lang.String)
+ */
+
+ public void setIcon(String arg0) {
+
+ this.feed.setIcon(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#setId(java.lang.String)
+ */
+
+ public void setId(String arg0) {
+
+ this.feed.setId(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#setLogo(java.lang.String)
+ */
+
+ public void setLogo(String arg0) {
+
+ this.feed.setLogo(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#setRights(com.google.gdata.data.TextConstruct)
+ */
+
+ public void setRights(TextConstruct arg0) {
+
+ this.feed.setRights(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#setSubtitle(com.google.gdata.data.TextConstruct)
+ */
+
+ public void setSubtitle(TextConstruct arg0) {
+
+ this.feed.setSubtitle(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#setTitle(com.google.gdata.data.TextConstruct)
+ */
+
+ public void setTitle(TextConstruct arg0) {
+
+ this.feed.setTitle(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.Source#setUpdated(com.google.gdata.data.DateTime)
+ */
+
+ public void setUpdated(DateTime arg0) {
+
+ this.feed.setUpdated(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#addExtension(com.google.gdata.data.Extension)
+ */
+
+ public void addExtension(Extension arg0) {
+
+ this.feed.addExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#addRepeatingExtension(com.google.gdata.data.Extension)
+ */
+
+ public void addRepeatingExtension(Extension arg0) {
+
+ this.feed.addRepeatingExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#getExtension(java.lang.Class)
+ */
+
+ public <T extends Extension> T getExtension(Class<T> arg0) {
+
+ return this.feed.getExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#getRepeatingExtension(java.lang.Class)
+ */
+
+ public <T extends Extension> List<T> getRepeatingExtension(Class<T> arg0) {
+
+ return this.feed.getRepeatingExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#getXmlBlob()
+ */
+
+ public XmlBlob getXmlBlob() {
+
+ return this.feed.getXmlBlob();
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#parseCumulativeXmlBlob(com.google.gdata.util.XmlBlob, com.google.gdata.data.ExtensionProfile, java.lang.Class)
+ */
+
+ public void parseCumulativeXmlBlob(XmlBlob arg0, ExtensionProfile arg1, Class arg2) throws IOException, ParseException {
+
+ this.feed.parseCumulativeXmlBlob(arg0, arg1, arg2);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#removeExtension(java.lang.Class)
+ */
+
+ public void removeExtension(Class arg0) {
+
+ this.feed.removeExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#removeExtension(com.google.gdata.data.Extension)
+ */
+
+ public void removeExtension(Extension arg0) {
+
+ this.feed.removeExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#removeRepeatingExtension(com.google.gdata.data.Extension)
+ */
+
+ public void removeRepeatingExtension(Extension arg0) {
+
+ this.feed.removeRepeatingExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#setExtension(com.google.gdata.data.Extension)
+ */
+
+ public void setExtension(Extension arg0) {
+
+ this.feed.setExtension(arg0);
+ }
+
+ /**
+ * @see com.google.gdata.data.ExtensionPoint#setXmlBlob(com.google.gdata.util.XmlBlob)
+ */
+
+ public void setXmlBlob(XmlBlob arg0) {
+
+ this.feed.setXmlBlob(arg0);
+ }
+
+}
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AccountBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AccountBuilder.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AccountBuilder.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AccountBuilder.java Tue Jun 27 12:31:20 2006
@@ -0,0 +1,62 @@
+/**
+ * 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.server.administration;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import org.apache.commons.digester.Digester;
+import org.apache.lucene.gdata.data.GDataAccount;
+import org.xml.sax.SAXException;
+
+/**
+ * Helperclass to create {@link org.apache.lucene.gdata.data.GDataAccount}
+ * instances from a xml stream provided via a {@link Reader} instance.
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class AccountBuilder {
+
+ /**
+ * Reads the xml from the provided reader and binds the values to the
+ * @param reader - the reader to read the xml from
+ * @return - the GDataAccount
+ * @throws IOException - if an IOException occures
+ * @throws SAXException - if the xml can not be parsed by the sax reader
+ */
+ public static GDataAccount buildAccount(final Reader reader) throws IOException,
+ SAXException {
+ if (reader == null)
+ throw new IllegalArgumentException("Reader must not be null");
+ GDataAccount account = null;
+ Digester digester = new Digester();
+ digester.setValidating(false);
+ digester.addObjectCreate("account", GDataAccount.class);
+ digester.addBeanPropertySetter("account/account-name", "name");
+ digester.addBeanPropertySetter("account/password", "password");
+ digester.addBeanPropertySetter("account/account-role", "rolesAsInt");
+ digester.addBeanPropertySetter("account/account-owner/name",
+ "authorname");
+ digester.addBeanPropertySetter("account/account-owner/email-address",
+ "authorMail");
+ digester.addBeanPropertySetter("account/account-owner/url",
+ "authorLink");
+ account = (GDataAccount) digester.parse(reader);
+ return account;
+ }
+
+}
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AdminService.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AdminService.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AdminService.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/AdminService.java Tue Jun 27 12:31:20 2006
@@ -0,0 +1,123 @@
+/**
+ * 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.server.administration;
+
+import org.apache.lucene.gdata.data.GDataAccount;
+import org.apache.lucene.gdata.data.ServerBaseFeed;
+import org.apache.lucene.gdata.server.Service;
+import org.apache.lucene.gdata.server.ServiceException;
+
+/**
+ * The AdminService interface extends the Service interface to serve common
+ * administrator requests. Common users can not create feed or user instances.
+ * This interface provides all actions for create, delete or update Users and
+ * Feeds. Each Feed has an associated Feed - Name which acts as an ID. Feed will
+ * be identified by the feed name e.g. {@link com.google.gdata.data.Source#getId()}
+ * <p>User accounts are supposed to have a unique username attribute as the username acts as a primary key for the storage</p>
+ *
+ *
+ * @author Simon Willnauer
+ *
+ */
+public interface AdminService extends Service {
+
+ /**
+ * Creates a new feed instance.
+ *
+ * @param feed -
+ * the feed to create
+ * @param account - the account who own this feed
+ * @throws ServiceException -
+ * if the feed can not be created
+ */
+ public abstract void createFeed(final ServerBaseFeed feed,
+ final GDataAccount account) throws ServiceException;
+
+ /**
+ * Updates the given feed
+ *
+ * @param feed -
+ * the feed to update
+ * @param account - the account who own this feed
+ *
+ * @throws ServiceException -
+ * if the feed can not be updated or does not exist.
+ */
+ public abstract void updateFeed(final ServerBaseFeed feed,
+ final GDataAccount account) throws ServiceException;
+
+ /**
+ * Deletes the given feed and all containing entries from the storage. The feed will not be accessable
+ * anymore.
+ *
+ * @param feed -
+ * the feed to deltete
+ *
+ * @throws ServiceException -
+ * if the feed can not be deleted or does not exist
+ */
+ public abstract void deleteFeed(final ServerBaseFeed feed) throws ServiceException;
+
+ /**
+ * Creates a new account accout.
+ *
+ * @param account -
+ * the account to create
+ * @throws ServiceException -
+ * if the account can not be created or the account does already
+ * exist.
+ */
+ public abstract void createAccount(final GDataAccount account)
+ throws ServiceException;
+
+ /**
+ * Deletes the given account from the storage. it will also delete all
+ * accociated feeds.
+ *
+ * @param account
+ * the account to delete
+ * @throws ServiceException -
+ * if the account does not exist or the account can not be deleted
+ */
+ public abstract void deleteAccount(final GDataAccount account)
+ throws ServiceException;
+
+ /**
+ * Updates the given account if the account already exists.
+ *
+ * @param account - the account to update
+ * @throws ServiceException - if the account can not be updated or the account does not exist
+ */
+ public abstract void updateAccount(final GDataAccount account)
+ throws ServiceException;
+
+ /**
+ * Returns the account for the given account name or <code>null</code> if the account does not exist
+ *
+ * @param account - account name
+ * @return - the account for the given account name or <code>null</code> if the account does not exist
+ * @throws ServiceException - if the account can not be accessed
+ */
+ public abstract GDataAccount getAccount(String account) throws ServiceException;
+
+ /**
+ * Returns the account associated with the feed for the given feed id
+ * @param feedId - the feed id
+ * @return - the GdataAccount assoziated with the feed for the given feed Id or <code>null</code> if there is no feed for the given feed Id
+ * @throws ServiceException - if the storage can not be accessed
+ */
+ public abstract GDataAccount getFeedOwningAccount(String feedId) throws ServiceException;
+}
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/GDataAdminService.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/GDataAdminService.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/GDataAdminService.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/GDataAdminService.java Tue Jun 27 12:31:20 2006
@@ -0,0 +1,195 @@
+/**
+ * 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.server.administration;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.lucene.gdata.data.GDataAccount;
+import org.apache.lucene.gdata.data.ServerBaseFeed;
+import org.apache.lucene.gdata.server.GDataService;
+import org.apache.lucene.gdata.server.ServiceException;
+import org.apache.lucene.gdata.storage.StorageException;
+
+
+
+/**
+ * default implementation of the {@link org.apache.lucene.gdata.server.administration.AdminService} interface.
+ * @author Simon Willnauer
+ *
+ */
+public class GDataAdminService extends GDataService implements AdminService {
+ private static final Log LOG = LogFactory.getLog(GDataAdminService.class);
+ /**
+ * @throws ServiceException
+ */
+ public GDataAdminService() throws ServiceException {
+ super();
+
+ }
+
+
+
+ /**
+ * @see org.apache.lucene.gdata.server.administration.AdminService#createFeed(org.apache.lucene.gdata.data.ServerBaseFeed, org.apache.lucene.gdata.data.GDataAccount)
+ */
+ public void createFeed(final ServerBaseFeed feed,final GDataAccount account) throws ServiceException {
+ if(feed == null)
+ throw new ServiceException("Can not create feed -- feed is null");
+ if(account == null)
+ throw new ServiceException("Can not create feed -- account is null");
+ if(feed.getId() == null)
+ throw new ServiceException("Feed ID is null can not create feed");
+ if(account.getName() == null)
+ throw new ServiceException("Account name is null -- can't create feed");
+ try {
+ feed.setAccount(account);
+ this.storage.storeFeed(feed,account.getName());
+ } catch (StorageException e) {
+ if(LOG.isInfoEnabled())
+ LOG.info("Can not save feed -- "+e.getMessage(),e);
+ throw new ServiceException("Can not save feed",e);
+ }
+
+ }
+
+
+
+ /**
+ * @see org.apache.lucene.gdata.server.administration.AdminService#updateFeed(org.apache.lucene.gdata.data.ServerBaseFeed, org.apache.lucene.gdata.data.GDataAccount)
+ */
+ public void updateFeed(ServerBaseFeed feed, GDataAccount account) throws ServiceException {
+ if(feed == null)
+ throw new ServiceException("Can not update null feed");
+ if(account == null)
+ throw new ServiceException("Can not update feed -- account is null");
+ if(feed.getId() == null)
+ throw new ServiceException("Feed ID is null can not update feed");
+ if(account.getName() == null)
+ throw new ServiceException("Account name is null -- can't update feed");
+ try {
+ feed.setAccount(account);
+ this.storage.updateFeed(feed,account.getName());
+ } catch (StorageException e) {
+ if(LOG.isInfoEnabled())
+ LOG.info("Can not update feed -- "+e.getMessage(),e);
+ throw new ServiceException("Can not update feed",e);
+ }
+
+ }
+
+
+
+ /**
+ * @see org.apache.lucene.gdata.server.administration.AdminService#deleteFeed(org.apache.lucene.gdata.data.ServerBaseFeed)
+ */
+ public void deleteFeed(ServerBaseFeed feed) throws ServiceException {
+ if(feed == null)
+ throw new ServiceException("Can not delete null feed");
+ if(feed.getId() == null)
+ throw new ServiceException("Feed ID is null can not delete feed");
+ try {
+ this.storage.deleteFeed(feed.getId());
+ } catch (StorageException e) {
+ if(LOG.isInfoEnabled())
+ LOG.info("Can not delete feed -- "+e.getMessage(),e);
+ throw new ServiceException("Can not delete feed",e);
+ }
+
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.server.administration.AdminService#createAccount(org.apache.lucene.gdata.data.GDataAccount)
+ */
+ public void createAccount(GDataAccount account) throws ServiceException {
+ if(account == null)
+ throw new ServiceException("Can not save null account");
+ try {
+ this.storage.storeAccount(account);
+ } catch (StorageException e) {
+ if(LOG.isInfoEnabled())
+ LOG.info("Can not save account -- "+e.getMessage(),e);
+ throw new ServiceException("Can not save account",e);
+ }
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.server.administration.AdminService#deleteAccount(org.apache.lucene.gdata.data.GDataAccount)
+ */
+ public void deleteAccount(GDataAccount account) throws ServiceException {
+ if(account == null)
+ throw new ServiceException("Can not delete null account");
+ try {
+ this.storage.deleteAccount(account.getName());
+ } catch (StorageException e) {
+ if(LOG.isInfoEnabled())
+ LOG.info("Can not save account -- "+e.getMessage(),e);
+ throw new ServiceException("Can not save account",e);
+ }
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.server.administration.AdminService#updateAccount(org.apache.lucene.gdata.data.GDataAccount)
+ */
+ public void updateAccount(GDataAccount account) throws ServiceException {
+ if(account == null)
+ throw new ServiceException("Can not update null account");
+ try {
+ this.storage.updateAccount(account);
+ } catch (StorageException e) {
+ if(LOG.isInfoEnabled())
+ LOG.info("Can not save account -- "+e.getMessage(),e);
+ throw new ServiceException("Can not save account",e);
+ }
+ }
+
+ /**
+ * @see org.apache.lucene.gdata.server.administration.AdminService#getAccount(java.lang.String)
+ */
+ public GDataAccount getAccount(String accountName)throws ServiceException{
+ if(accountName == null)
+ throw new ServiceException("Can not get null account");
+ try {
+ return this.storage.getAccount(accountName);
+ } catch (StorageException e) {
+ if(LOG.isInfoEnabled())
+ LOG.info("Can not get account -- "+e.getMessage(),e);
+ throw new ServiceException("Can not get account",e);
+ }
+
+ }
+
+
+
+ /**
+ * @see org.apache.lucene.gdata.server.administration.AdminService#getFeedOwningAccount(java.lang.String)
+ */
+ public GDataAccount getFeedOwningAccount(String feedId) throws ServiceException {
+ if(feedId == null)
+ throw new ServiceException("Can not get account - feed id must not be null");
+ try {
+ String accountName = this.storage.getAccountNameForFeedId(feedId);
+ return this.storage.getAccount(accountName);
+
+ } catch (StorageException e) {
+ if(LOG.isInfoEnabled())
+ LOG.info("Can not get account for feed Id -- "+e.getMessage(),e);
+ throw new ServiceException("Can not get account for the given feed id",e);
+ }
+ }
+
+
+
+}
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/package.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/package.html?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/package.html (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/administration/package.html Tue Jun 27 12:31:20 2006
@@ -0,0 +1,10 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="Simon Willnauer">
+</head>
+<body>
+Classes and Services used for user and feed configuration
+</body>
+</html>
\ No newline at end of file
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationController.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationController.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationController.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationController.java Tue Jun 27 12:31:20 2006
@@ -0,0 +1,122 @@
+/**
+ * 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.server.authentication;
+
+import org.apache.lucene.gdata.data.GDataAccount;
+import org.apache.lucene.gdata.data.GDataAccount.AccountRole;
+import org.apache.lucene.gdata.server.registry.ServerComponent;
+
+/**
+ * Implementations of the AuthenticationController interface contain all the
+ * logic for processing token based authentification. A token is an encoded
+ * unique <tt>String</tt> value passed back to the client if successfully
+ * authenticated. Clients provide account name, password, the requested service
+ * and the name of the application used for accessing the the gdata service.
+ * <p>
+ * The algorithmn to create and reauthenticate the token can be choosen by the
+ * implementor. <br/> This interface extends
+ * {@link org.apache.lucene.gdata.server.registry.ServerComponent} e.g.
+ * implementing classes can be registered as a
+ * {@link org.apache.lucene.gdata.server.registry.Component} in the
+ * {@link org.apache.lucene.gdata.server.registry.GDataServerRegistry} to be
+ * accessed via the provided lookup service
+ * </p>
+ *
+ * @see org.apache.lucene.gdata.server.authentication.BlowfishAuthenticationController
+ * @author Simon Willnauer
+ *
+ */
+public interface AuthenticationController extends ServerComponent {
+
+ /**
+ * The header name containing the authentication token provided by the
+ * client
+ */
+ public static final String AUTHORIZATION_HEADER = "Authorization";
+
+ /**
+ * Authentication parameter for the account name. Provided by the client to
+ * recieve the auth token.
+ */
+ public static final String ACCOUNT_PARAMETER = "Email";
+
+ /**
+ * Authentication parameter for the account password. Provided by the client
+ * to recieve the auth token.
+ */
+ public static final String PASSWORD_PARAMETER = "Passwd";
+
+ /**
+ * Authentication parameter for the requested service. Provided by the
+ * client to recieve the auth token.
+ */
+ public static final String SERVICE_PARAMETER = "service";
+
+ /**
+ * Authentication parameter for the application name of the clients
+ * application. This is just used for loggin purposes
+ */
+ public static final String APPLICATION_PARAMETER = "source";
+
+ /**
+ * The key used for respond the auth token to the client. Either as a cookie
+ * (key as cookie name) or as plain response (TOKEN_KEY=TOKEN)
+ */
+ public final static String TOKEN_KEY = "Auth";
+
+ /**
+ * Creates a authentication token for the given account. The token will be
+ * calculated based on a part of the clients ip address, the account role
+ * and the account name and the time in millisecond at the point of
+ * creation.
+ *
+ * @param account -
+ * the account to create the token for
+ * @param requestIp -
+ * the clients request ip address
+ * @return - a BASE64 encoded authentification token
+ */
+ public abstract String authenticatAccount(GDataAccount account,
+ String requestIp);
+
+ /**
+ * Authenticates the given auth token and checks the given parameter for
+ * matching the information contained inside the token.
+ * <p>
+ * if the given account name is <code>null</code> the authentication will
+ * ignore the account name and the decision whether the token is valid or
+ * not will be based on the given role compared to the role inside the token
+ * </p>
+ *
+ * @param token -
+ * the token to authenticate
+ * @param requestIp -
+ * the client request IP address
+ * @param role -
+ * the required role
+ * @param accountName -
+ * the name of the account
+ * @return <code>true</code> if the given values match the values inside
+ * the token and if the timestamp plus the configured timeout is
+ * greater than the current time, if one of the values does not
+ * match or the token has timed out it will return
+ * <code>false</code>
+ */
+ public abstract boolean authenticateToken(final String token,
+ final String requestIp, AccountRole role, String accountName);
+
+}
\ No newline at end of file
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationException.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationException.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticationException.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.server.authentication;
+
+/**
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class AuthenticationException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5467768078178612671L;
+
+ /**
+ * Constructs a new Authentication Exception
+ */
+ public AuthenticationException() {
+ super();
+
+ }
+
+ /**
+ * Constructs a new Authentication Exception with the specified detail message
+ * @param arg0 - detail message
+ */
+ public AuthenticationException(String arg0) {
+ super(arg0);
+
+ }
+
+ /**
+ * Constructs a new Authentication Exception with the specified detail message and
+ * nested exception caused this exception.
+ * @param arg0 -
+ * detail message
+ * @param arg1 -
+ * nested exception
+ */
+ public AuthenticationException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+
+ }
+
+ /**
+ * Constructs a new Authentication Exception with a nested exception caused this exception
+ * @param arg0 - nested exception
+ */
+ public AuthenticationException(Throwable arg0) {
+ super(arg0);
+
+ }
+
+}
Added: lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticatorException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticatorException.java?rev=417565&view=auto
==============================================================================
--- lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticatorException.java (added)
+++ lucene/java/trunk/contrib/gdata-server/src/java/org/apache/lucene/gdata/server/authentication/AuthenticatorException.java Tue Jun 27 12:31:20 2006
@@ -0,0 +1,71 @@
+/**
+ * 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.server.authentication;
+
+/**
+ * This exception will be thrown by
+ * {@link org.apache.lucene.gdata.server.authentication.AuthenticationController}
+ * implementations if an error while de/encrypting the token occures.
+ *
+ * @author Simon Willnauer
+ *
+ */
+public class AuthenticatorException extends RuntimeException {
+
+ private static final long serialVersionUID = -5690495392712564651L;
+
+ /**
+ * Constructs a new Authenticator Exception
+ */
+ public AuthenticatorException() {
+ super();
+
+ }
+
+ /**
+ * Constructs a new Authenticator Exception with the specified detail message.
+ * @param arg0 - detail message
+ */
+ public AuthenticatorException(String arg0) {
+ super(arg0);
+
+ }
+
+ /**
+ * Constructs a new Authenticator Exception with the specified detail message and
+ * nested exception.
+ *
+ * @param arg0 -
+ * detail message
+ * @param arg1 -
+ * nested exception
+ */
+ public AuthenticatorException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+
+ }
+
+ /**
+ * Constructs a new Authenticator Exception with a nested exception caused this exception.
+ * @param arg0 - nested exception
+ */
+ public AuthenticatorException(Throwable arg0) {
+ super(arg0);
+
+ }
+
+}