more groundwork for the conferencing module - establishing the access object

This commit is contained in:
Eric J. Bowersox 2003-06-26 05:09:35 +00:00
parent f6f6403f6b
commit eecc26baf0
13 changed files with 493 additions and 5 deletions

View File

@ -0,0 +1,33 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.conf.iface;
import java.util.List;
import com.silverwrist.dynamo.except.DatabaseException;
import com.silverwrist.dynamo.iface.DynamicObject;
import com.silverwrist.venice.iface.VeniceCommunity;
public interface ConferenceAccessObject extends DynamicObject
{
public List getConferences(VeniceCommunity comm) throws DatabaseException;
public VeniceConference getConference(int confid) throws DatabaseException;
public VeniceConference getConference(String alias) throws DatabaseException;
} // end interface ConferenceAccessObject

View File

@ -0,0 +1,60 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.conf.iface;
import java.security.acl.AclNotFoundException;
import java.util.Set;
import com.silverwrist.dynamo.except.DatabaseException;
import com.silverwrist.dynamo.except.DynamoSecurityException;
import com.silverwrist.dynamo.iface.DynamicObject;
import com.silverwrist.dynamo.iface.DynamoAcl;
import com.silverwrist.dynamo.iface.DynamoGroup;
import com.silverwrist.dynamo.iface.DynamoUser;
import com.silverwrist.dynamo.iface.NamedObject;
import com.silverwrist.dynamo.iface.SecureObjectStore;
public interface VeniceConference extends DynamicObject, NamedObject, SecureObjectStore
{
public int getConfID();
public void setName(DynamoUser caller, String name) throws DatabaseException, DynamoSecurityException;
public java.util.Date getCreatedDate();
public java.util.Date getLastUpdateDate();
public void setLastUpdateDate(DynamoUser caller, java.util.Date date)
throws DatabaseException, DynamoSecurityException;
public int getHostsGID();
public DynamoGroup getHosts() throws DatabaseException;
public DynamoAcl getAcl() throws DatabaseException, AclNotFoundException;
public Set getAliases() throws DatabaseException;
public String getPrimaryAlias() throws DatabaseException;
public void setPrimaryAlias(DynamoUser caller, String alias) throws DatabaseException, DynamoSecurityException;
public void addAlias(DynamoUser caller, String alias) throws DatabaseException, DynamoSecurityException;
public void removeAlias(DynamoUser caller, String alias) throws DatabaseException, DynamoSecurityException;
} // end interface VeniceConference

View File

@ -0,0 +1,41 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.conf.iface;
import com.silverwrist.dynamo.except.DatabaseException;
import com.silverwrist.dynamo.except.DynamoSecurityException;
import com.silverwrist.dynamo.iface.DynamoUser;
import com.silverwrist.venice.iface.VeniceCommunity;
public interface VeniceLinkedConference extends VeniceConference
{
public VeniceCommunity getCommunity();
public VeniceConference getConference();
public int getSequence();
public void setSequence(DynamoUser caller, int sequence) throws DatabaseException, DynamoSecurityException;
public boolean isHidden();
public void setHidden(DynamoUser caller, boolean flag) throws DatabaseException, DynamoSecurityException;
public void unlink(DynamoUser caller) throws DatabaseException, DynamoSecurityException;
} // end interface VeniceLinkedConference

View File

@ -0,0 +1,119 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.conf.impl;
import java.util.*;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.venice.iface.*;
import com.silverwrist.venice.conf.iface.*;
import com.silverwrist.venice.conf.obj.*;
public class ConferenceManager implements ConferenceAccessObject
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private DynamicImplConferenceAccess m_dobj;
private UseCount m_uc;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public ConferenceManager(UseCount uc)
{
m_dobj = new DynamicImplConferenceAccess(this);
m_uc = uc;
uc.incrementUseCount();
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface DynamicObject
*--------------------------------------------------------------------------------
*/
public Object get(String property_name) throws DynamicObjectException
{
return m_dobj.get(property_name);
} // end get
public void set(String property_name, Object value) throws DynamicObjectException
{
m_dobj.set(property_name,value);
} // end set
public Object call(String method_name, Object[] parameters) throws DynamicObjectException
{
return m_dobj.call(method_name,parameters);
} // end call
public Object call(String method_name, List parameters) throws DynamicObjectException
{
return m_dobj.call(method_name,parameters);
} // end call
public DynamicClass getDClass()
{
return m_dobj.getDClass();
} // end getDClass
/*--------------------------------------------------------------------------------
* Implementations from interface ConferenceAccessObject
*--------------------------------------------------------------------------------
*/
public List getConferences(VeniceCommunity comm) throws DatabaseException
{
return Collections.EMPTY_LIST; // TEMP
} // end getConferences
public VeniceConference getConference(int confid) throws DatabaseException
{
return null; // TEMP
} // end getConference
public VeniceConference getConference(String alias) throws DatabaseException
{
return null; // TEMP
} // end getConference
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public void dispose()
{
m_uc.decrementUseCount();
} // end dispose
} // end class ConferenceManager

View File

@ -29,7 +29,7 @@ import com.silverwrist.venice.iface.*;
import com.silverwrist.venice.obj.*; import com.silverwrist.venice.obj.*;
import com.silverwrist.venice.util.*; import com.silverwrist.venice.util.*;
import com.silverwrist.venice.conf.ConfNamespaces; import com.silverwrist.venice.conf.ConfNamespaces;
import com.silverwrist.venice.conf.iface.UseCount; import com.silverwrist.venice.conf.iface.*;
class Controller implements CommunityServiceController class Controller implements CommunityServiceController
{ {
@ -47,6 +47,7 @@ class Controller implements CommunityServiceController
private DynamicImplCommunityServiceController m_dobj; private DynamicImplCommunityServiceController m_dobj;
private UseCount m_uc; private UseCount m_uc;
private ConferenceAccessObject m_access;
private String m_srm_name; private String m_srm_name;
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
@ -54,11 +55,12 @@ class Controller implements CommunityServiceController
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
Controller(UseCount uc, String srm_name) Controller(UseCount uc, ConferenceAccessObject access, String srm_name)
{ {
m_dobj = new DynamicImplCommunityServiceController(this); m_dobj = new DynamicImplCommunityServiceController(this);
m_uc = uc; m_uc = uc;
uc.incrementUseCount(); uc.incrementUseCount();
m_access = access;
m_srm_name = srm_name; m_srm_name = srm_name;
} // end constructor } // end constructor
@ -107,6 +109,7 @@ class Controller implements CommunityServiceController
{ {
m_uc.decrementUseCount(); m_uc.decrementUseCount();
m_uc = null; m_uc = null;
m_access = null;
} // end shutdown } // end shutdown
@ -188,4 +191,10 @@ class Controller implements CommunityServiceController
} // end removeServiceFromCommunity } // end removeServiceFromCommunity
public DynamicObject getAccessObject()
{
return m_access;
} // end getAccessObject
} // end class Controller } // end class Controller

View File

@ -33,6 +33,7 @@ import com.silverwrist.venice.community.CommunityServiceInstall;
import com.silverwrist.venice.util.*; import com.silverwrist.venice.util.*;
import com.silverwrist.venice.conf.ConfNamespaces; import com.silverwrist.venice.conf.ConfNamespaces;
import com.silverwrist.venice.conf.iface.UseCount; import com.silverwrist.venice.conf.iface.UseCount;
import com.silverwrist.venice.conf.impl.ConferenceManager;
public class ModuleMain implements ModuleFunctions, UseCount public class ModuleMain implements ModuleFunctions, UseCount
{ {
@ -59,6 +60,7 @@ public class ModuleMain implements ModuleFunctions, UseCount
private ModuleSite m_site = null; private ModuleSite m_site = null;
private String m_srm_name = null; private String m_srm_name = null;
private Controller m_controller = null; private Controller m_controller = null;
private ConferenceManager m_mgr;
private ComponentShutdown m_res1; private ComponentShutdown m_res1;
private ComponentShutdown m_res2; private ComponentShutdown m_res2;
@ -150,6 +152,8 @@ public class ModuleMain implements ModuleFunctions, UseCount
m_res2 = null; m_res2 = null;
m_site = null; m_site = null;
m_controller = null; m_controller = null;
m_mgr.dispose();
m_mgr = null;
m_usecount = 0; m_usecount = 0;
} // end shutdown } // end shutdown
@ -186,8 +190,10 @@ public class ModuleMain implements ModuleFunctions, UseCount
loadSRMName(services); loadSRMName(services);
synchronized (this) synchronized (this)
{ // create Controller object if necessary { // create Controller object if necessary
if (m_mgr==null)
m_mgr = new ConferenceManager(this);
if (m_controller==null) if (m_controller==null)
m_controller = new Controller(this,m_srm_name); m_controller = new Controller(this,m_mgr,m_srm_name);
} // end synchronized block } // end synchronized block
@ -299,8 +305,10 @@ public class ModuleMain implements ModuleFunctions, UseCount
{ // we want the community service controller { // we want the community service controller
synchronized (this) synchronized (this)
{ // create it if necessary { // create it if necessary
if (m_mgr==null)
m_mgr = new ConferenceManager(this);
if (m_controller==null) if (m_controller==null)
m_controller = new Controller(this,m_srm_name); m_controller = new Controller(this,m_mgr,m_srm_name);
return m_controller; return m_controller;
} // end synchronized block } // end synchronized block

View File

@ -23,6 +23,7 @@
confid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, confid INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
createdate DATETIME NOT NULL, createdate DATETIME NOT NULL,
lastupdate DATETIME NULL, lastupdate DATETIME NULL,
hosts_gid INT NOT NULL DEFAULT -1,
aclid INT NOT NULL DEFAULT -1, aclid INT NOT NULL DEFAULT -1,
highest_topic SMALLINT NOT NULL DEFAULT 0, highest_topic SMALLINT NOT NULL DEFAULT 0,
name VARCHAR(128) NOT NULL, name VARCHAR(128) NOT NULL,

View File

@ -0,0 +1,51 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.conf.obj;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.obj.*;
import com.silverwrist.venice.conf.iface.*;
class DynamicClassConferenceAccess extends DynamicClassImpl
{
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
DynamicClassConferenceAccess()
{
super("Dynamic." + ConferenceAccessObject.class.getName());
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class DynamicClassImpl
*--------------------------------------------------------------------------------
*/
public DynamicObject cast(Object source) throws ClassCastException
{
if (source instanceof ConferenceAccessObject)
return (DynamicObject)source;
return super.cast(source);
} // end cast
} // end class DynamicClassConferenceAccess

View File

@ -0,0 +1,121 @@
/*
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.conf.obj;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.obj.*;
import com.silverwrist.venice.iface.*;
import com.silverwrist.venice.conf.iface.*;
public class DynamicImplConferenceAccess extends DynamicObjectImpl
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static DynamicClass s_baseclass = null;
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private ConferenceAccessObject m_impl;
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public DynamicImplConferenceAccess(ConferenceAccessObject impl, DynamicClass dclass)
{
super(dclass);
m_impl = impl;
} // end constructor
public DynamicImplConferenceAccess(ConferenceAccessObject impl)
{
super(getBaseDClass());
m_impl = impl;
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class DynamicObjectImpl
*--------------------------------------------------------------------------------
*/
public Object call(String method_name, Object[] parameters) throws DynamicObjectException
{
if (method_name.equals("getConferences"))
{ // call the getConferences method
try
{ // verify the parameters and call the method
verifyParameterLength(method_name,parameters,1);
verifyParameterType(method_name,parameters,0,VeniceCommunity.class);
return m_impl.getConferences((VeniceCommunity)(parameters[0]));
} // end try
catch (DatabaseException e)
{ // reflect the exception back up
throw callFailed(e);
} // end catch
} // end if
if (method_name.equals("getConference"))
{ // call one of the getConference methods
try
{ // verify the parameters and call the method
verifyParameterLength(method_name,parameters,1);
if ((parameters[0]==null) || (parameters[0] instanceof String))
return m_impl.getConference((String)(parameters[0]));
verifyParameterNumber(method_name,parameters,0);
return m_impl.getConference(getIntValue(parameters[0]));
} // end try
catch (DatabaseException e)
{ // reflect the exception back up
throw callFailed(e);
} // end catch
} // end if
return super.call(method_name,parameters);
} // end call
/*--------------------------------------------------------------------------------
* External static operations
*--------------------------------------------------------------------------------
*/
public static synchronized DynamicClass getBaseDClass()
{
if (s_baseclass==null)
s_baseclass = new DynamicClassConferenceAccess();
return s_baseclass;
} // end getBaseDClass
} // end class DynamicImplConferenceAccess

View File

@ -46,6 +46,18 @@ public class DynamicObjectImpl implements DynamicObject
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
protected static final int getIntValue(Object param)
{
return ((Number)param).intValue();
} // end getIntValue
protected final CallFailureException callFailed(Throwable cause)
{
return new CallFailureException(m_dclass,cause);
} // end callFailed
protected final void verifyParameterLength(String method_name, Object[] parameters, int len) protected final void verifyParameterLength(String method_name, Object[] parameters, int len)
{ {
if (parameters.length!=len) if (parameters.length!=len)
@ -53,15 +65,30 @@ public class DynamicObjectImpl implements DynamicObject
} // end verifyParameterLength } // end verifyParameterLength
protected final ParameterTypeException badType(String method_name, int ndx, Class expected, Class actual)
{
return new ParameterTypeException(m_dclass,method_name,ndx,expected,actual);
} // end badType
protected final void verifyParameterType(String method_name, Object[] parameters, int ndx, Class klass) protected final void verifyParameterType(String method_name, Object[] parameters, int ndx, Class klass)
{ {
if (parameters[ndx]==null) if (parameters[ndx]==null)
return; return;
if (!(klass.isInstance(parameters[ndx]))) if (!(klass.isInstance(parameters[ndx])))
throw new ParameterTypeException(m_dclass,method_name,ndx,klass,parameters[ndx].getClass()); throw badType(method_name,ndx,klass,parameters[ndx].getClass());
} // end verifyParameterType } // end verifyParameterType
protected final void verifyParameterNumber(String method_name, Object[] parameters, int ndx)
{
if (parameters[ndx]==null)
throw badType(method_name,ndx,Number.class,null);
if (!(parameters[ndx] instanceof Number))
throw badType(method_name,ndx,Number.class,parameters[ndx].getClass());
} // end verifyParameterNumber
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface DynamicObject * Implementations from interface DynamicObject
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -17,6 +17,7 @@
*/ */
package com.silverwrist.venice.community; package com.silverwrist.venice.community;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.util.*; import com.silverwrist.dynamo.util.*;
import com.silverwrist.venice.iface.*; import com.silverwrist.venice.iface.*;
@ -95,4 +96,10 @@ public final class CommunityServiceDescriptor
} // end getDescription } // end getDescription
public DynamicObject getAccessObject()
{
return m_csc.getAccessObject();
} // end getAccessObject
} // end class CommunityServiceDescriptor } // end class CommunityServiceDescriptor

View File

@ -33,4 +33,6 @@ public interface CommunityServiceController extends DynamicObject, ComponentShut
public void removeServiceFromCommunity(Request req, VeniceCommunity comm) public void removeServiceFromCommunity(Request req, VeniceCommunity comm)
throws DatabaseException, CommunityServiceException; throws DatabaseException, CommunityServiceException;
public DynamicObject getAccessObject();
} // end interface CommunityServiceController } // end interface CommunityServiceController

View File

@ -66,6 +66,8 @@ public class DynamicImplCommunityServiceController extends DynamicObjectImpl
{ {
if (property_name.equals("description")) if (property_name.equals("description"))
return m_impl.getDescription(); return m_impl.getDescription();
if (property_name.equals("accessObject"))
return m_impl.getAccessObject();
return super.get(property_name); return super.get(property_name);
} // end get } // end get
@ -84,6 +86,13 @@ public class DynamicImplCommunityServiceController extends DynamicObjectImpl
// N.B.: "addServiceToCommunity" should NOT be a dynamic call // N.B.: "addServiceToCommunity" should NOT be a dynamic call
// N.B.: "removeServiceFromCommunity" should NOT be a dynamic call // N.B.: "removeServiceFromCommunity" should NOT be a dynamic call
if (method_name.equals("getAccessObject"))
{ // call getAccessObject
verifyParameterLength(method_name,parameters,0);
return m_impl.getAccessObject();
} // end if
return super.call(method_name,parameters); return super.call(method_name,parameters);
} // end call } // end call