*** empty log message ***

This commit is contained in:
Eric J. Bowersox
2003-05-20 03:25:31 +00:00
commit b80fa05ed1
682 changed files with 85738 additions and 0 deletions

View File

@@ -0,0 +1,260 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (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.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo.db;
import java.util.*;
import com.silverwrist.dynamo.UserInfoNamespace;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
abstract class UserProxy implements DynamoUser, UserInfoNamespace, DynamicWrapper
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
protected int m_uid;
protected String m_username;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
protected UserProxy(int uid)
{
m_uid = uid;
m_username = null;
} // end constructor
protected UserProxy(int uid, String username)
{
m_uid = uid;
m_username = username;
} // end constructor
/*--------------------------------------------------------------------------------
* Abstract operations
*--------------------------------------------------------------------------------
*/
protected abstract DynamoUser getRealUser();
/*--------------------------------------------------------------------------------
* Implementations from interface Principal
*--------------------------------------------------------------------------------
*/
public boolean equals(Object another)
{
if (another==null)
return false;
if (another instanceof DynamoUser)
return (m_uid==((DynamoUser)another).getUID());
return false;
} // end equals
public String toString()
{
if (m_username!=null)
return "user " + m_username;
return getRealUser().toString();
} // end toString
public int hashCode()
{
return m_uid;
} // end hashCode
public String getName()
{
if (m_username!=null)
return m_username;
return getRealUser().getName();
} // end getName
/*--------------------------------------------------------------------------------
* Implementations from interface ObjectProvider
*--------------------------------------------------------------------------------
*/
/**
* Retrieves an object from this <CODE>ObjectProvider</CODE>.
*
* @param namespace The namespace to interpret the name relative to.
* @param name The name of the object to be retrieved.
* @return The object reference specified.
*/
public Object getObject(String namespace, String name)
{
return getRealUser().getObject(namespace,name);
} // end getObject
/*--------------------------------------------------------------------------------
* Implementations from interface SecureObjectStore
*--------------------------------------------------------------------------------
*/
public Object setObject(DynamoUser caller, String namespace, String name, Object value)
throws DatabaseException, DynamoSecurityException
{
return getRealUser().setObject(caller,namespace,name,value);
} // end setObject
public Object removeObject(DynamoUser caller, String namespace, String name)
throws DatabaseException, DynamoSecurityException
{
return getRealUser().removeObject(caller,namespace,name);
} // end removeObject
public Collection getNamespaces() throws DatabaseException
{
return getRealUser().getNamespaces();
} // end getNamespaces
public Collection getNamesForNamespace(String namespace) throws DatabaseException
{
return getRealUser().getNamesForNamespace(namespace);
} // end getNamesForNamespace
/*--------------------------------------------------------------------------------
* Implementations from interface DynamoUser
*--------------------------------------------------------------------------------
*/
public int getUID()
{
return m_uid;
} // end getUID
public boolean isAnonymous()
{
return getRealUser().isAnonymous();
} // end isAnonymous
public boolean isLocked()
{
return getRealUser().isLocked();
} // end isLocked
public void setLocked(DynamoUser caller, boolean locked) throws DatabaseException, DynamoSecurityException
{
getRealUser().setLocked(caller,locked);
} // end setLocked
public boolean isNoSpam()
{
return getRealUser().isNoSpam();
} // end isNoSpam
public void setNoSpam(DynamoUser caller, boolean nospam) throws DatabaseException, DynamoSecurityException
{
getRealUser().setNoSpam(caller,nospam);
} // end setNoSpam
public String getEMailAddress()
{
return getRealUser().getEMailAddress();
} // end getEMailAddress
public boolean setEMailAddress(DynamoUser caller, String addr)
throws DatabaseException, DynamoSecurityException
{
return getRealUser().setEMailAddress(caller,addr);
} // end setEMailAddress
public boolean authenticate(String method_namespace, String method, String source_data, String auth_data)
throws DatabaseException, AuthenticationException
{
return getRealUser().authenticate(method_namespace,method,source_data,auth_data);
} // end authenticate
public void setAuthenticationData(DynamoUser caller, String method_namespace, String method,
String source_data, String auth_data)
throws DatabaseException, AuthenticationException, DynamoSecurityException
{
getRealUser().setAuthenticationData(caller,method_namespace,method,source_data,auth_data);
} // end setAuthenticationData
public void clearAuthenticationData(DynamoUser caller, String method_namespace, String method,
String source_data) throws DatabaseException, DynamoSecurityException
{
getRealUser().clearAuthenticationData(caller,method_namespace,method,source_data);
} // end clearAuthenticationData
public void clearAuthenticationData(DynamoUser caller, String method_namespace, String method)
throws DatabaseException, DynamoSecurityException
{
getRealUser().clearAuthenticationData(caller,method_namespace,method);
} // end clearAuthenticationData
public java.util.Date getCreationDate()
{
return getRealUser().getCreationDate();
} // end getCreationDate
public java.util.Date getLastAccessDate()
{
return getRealUser().getLastAccessDate();
} // end getLastAccessDate
public synchronized void setLastAccessDate(DynamoUser caller, java.util.Date date)
throws DatabaseException, DynamoSecurityException
{
getRealUser().setLastAccessDate(caller,date);
} // end setLastAccessDate
/*--------------------------------------------------------------------------------
* Implementations from interface DynamicWrapper
*--------------------------------------------------------------------------------
*/
public Object unwrap()
{
return getRealUser();
} // end unwrap
} // end class UserProxy