diff --git a/src/conferencing-module/com/silverwrist/venice/conf/iface/ConferenceAccessObject.java b/src/conferencing-module/com/silverwrist/venice/conf/iface/ConferenceAccessObject.java new file mode 100644 index 0000000..1e1db2a --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/iface/ConferenceAccessObject.java @@ -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 . + * + * 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 , + * 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 diff --git a/src/conferencing-module/com/silverwrist/venice/conf/iface/VeniceConference.java b/src/conferencing-module/com/silverwrist/venice/conf/iface/VeniceConference.java new file mode 100644 index 0000000..21f20bd --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/iface/VeniceConference.java @@ -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 . + * + * 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 , + * 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 diff --git a/src/conferencing-module/com/silverwrist/venice/conf/iface/VeniceLinkedConference.java b/src/conferencing-module/com/silverwrist/venice/conf/iface/VeniceLinkedConference.java new file mode 100644 index 0000000..db051d9 --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/iface/VeniceLinkedConference.java @@ -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 . + * + * 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 , + * 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 diff --git a/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManager.java b/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManager.java new file mode 100644 index 0000000..d17477e --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManager.java @@ -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 . + * + * 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 , + * 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 diff --git a/src/conferencing-module/com/silverwrist/venice/conf/module/Controller.java b/src/conferencing-module/com/silverwrist/venice/conf/module/Controller.java index bf02fbe..6d43a57 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/module/Controller.java +++ b/src/conferencing-module/com/silverwrist/venice/conf/module/Controller.java @@ -29,7 +29,7 @@ import com.silverwrist.venice.iface.*; import com.silverwrist.venice.obj.*; import com.silverwrist.venice.util.*; import com.silverwrist.venice.conf.ConfNamespaces; -import com.silverwrist.venice.conf.iface.UseCount; +import com.silverwrist.venice.conf.iface.*; class Controller implements CommunityServiceController { @@ -47,6 +47,7 @@ class Controller implements CommunityServiceController private DynamicImplCommunityServiceController m_dobj; private UseCount m_uc; + private ConferenceAccessObject m_access; 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_uc = uc; uc.incrementUseCount(); + m_access = access; m_srm_name = srm_name; } // end constructor @@ -107,6 +109,7 @@ class Controller implements CommunityServiceController { m_uc.decrementUseCount(); m_uc = null; + m_access = null; } // end shutdown @@ -188,4 +191,10 @@ class Controller implements CommunityServiceController } // end removeServiceFromCommunity + public DynamicObject getAccessObject() + { + return m_access; + + } // end getAccessObject + } // end class Controller diff --git a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java index eb31275..635925f 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java +++ b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java @@ -33,6 +33,7 @@ import com.silverwrist.venice.community.CommunityServiceInstall; import com.silverwrist.venice.util.*; import com.silverwrist.venice.conf.ConfNamespaces; import com.silverwrist.venice.conf.iface.UseCount; +import com.silverwrist.venice.conf.impl.ConferenceManager; public class ModuleMain implements ModuleFunctions, UseCount { @@ -59,6 +60,7 @@ public class ModuleMain implements ModuleFunctions, UseCount private ModuleSite m_site = null; private String m_srm_name = null; private Controller m_controller = null; + private ConferenceManager m_mgr; private ComponentShutdown m_res1; private ComponentShutdown m_res2; @@ -150,6 +152,8 @@ public class ModuleMain implements ModuleFunctions, UseCount m_res2 = null; m_site = null; m_controller = null; + m_mgr.dispose(); + m_mgr = null; m_usecount = 0; } // end shutdown @@ -186,8 +190,10 @@ public class ModuleMain implements ModuleFunctions, UseCount loadSRMName(services); synchronized (this) { // create Controller object if necessary + if (m_mgr==null) + m_mgr = new ConferenceManager(this); 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 @@ -299,8 +305,10 @@ public class ModuleMain implements ModuleFunctions, UseCount { // we want the community service controller synchronized (this) { // create it if necessary + if (m_mgr==null) + m_mgr = new ConferenceManager(this); 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; } // end synchronized block diff --git a/src/conferencing-module/com/silverwrist/venice/conf/module/database-init-mysql.xml b/src/conferencing-module/com/silverwrist/venice/conf/module/database-init-mysql.xml index 93b172a..6ef62e9 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/module/database-init-mysql.xml +++ b/src/conferencing-module/com/silverwrist/venice/conf/module/database-init-mysql.xml @@ -23,6 +23,7 @@ confid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, createdate DATETIME NOT NULL, lastupdate DATETIME NULL, + hosts_gid INT NOT NULL DEFAULT -1, aclid INT NOT NULL DEFAULT -1, highest_topic SMALLINT NOT NULL DEFAULT 0, name VARCHAR(128) NOT NULL, diff --git a/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassConferenceAccess.java b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassConferenceAccess.java new file mode 100644 index 0000000..1a7025e --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassConferenceAccess.java @@ -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 . + * + * 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 , + * 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 diff --git a/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplConferenceAccess.java b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplConferenceAccess.java new file mode 100644 index 0000000..9065fcd --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplConferenceAccess.java @@ -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 . + * + * 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 , + * 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 diff --git a/src/dynamo-framework/com/silverwrist/dynamo/obj/DynamicObjectImpl.java b/src/dynamo-framework/com/silverwrist/dynamo/obj/DynamicObjectImpl.java index 49570b0..556551d 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/obj/DynamicObjectImpl.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/obj/DynamicObjectImpl.java @@ -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) { if (parameters.length!=len) @@ -53,15 +65,30 @@ public class DynamicObjectImpl implements DynamicObject } // 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) { if (parameters[ndx]==null) return; 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 + 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 *-------------------------------------------------------------------------------- diff --git a/src/venice-base/com/silverwrist/venice/community/CommunityServiceDescriptor.java b/src/venice-base/com/silverwrist/venice/community/CommunityServiceDescriptor.java index 2ce5053..fc2faab 100644 --- a/src/venice-base/com/silverwrist/venice/community/CommunityServiceDescriptor.java +++ b/src/venice-base/com/silverwrist/venice/community/CommunityServiceDescriptor.java @@ -17,6 +17,7 @@ */ package com.silverwrist.venice.community; +import com.silverwrist.dynamo.iface.*; import com.silverwrist.dynamo.util.*; import com.silverwrist.venice.iface.*; @@ -95,4 +96,10 @@ public final class CommunityServiceDescriptor } // end getDescription + public DynamicObject getAccessObject() + { + return m_csc.getAccessObject(); + + } // end getAccessObject + } // end class CommunityServiceDescriptor diff --git a/src/venice-base/com/silverwrist/venice/iface/CommunityServiceController.java b/src/venice-base/com/silverwrist/venice/iface/CommunityServiceController.java index f0047d4..577d79f 100644 --- a/src/venice-base/com/silverwrist/venice/iface/CommunityServiceController.java +++ b/src/venice-base/com/silverwrist/venice/iface/CommunityServiceController.java @@ -33,4 +33,6 @@ public interface CommunityServiceController extends DynamicObject, ComponentShut public void removeServiceFromCommunity(Request req, VeniceCommunity comm) throws DatabaseException, CommunityServiceException; + public DynamicObject getAccessObject(); + } // end interface CommunityServiceController diff --git a/src/venice-base/com/silverwrist/venice/obj/DynamicImplCommunityServiceController.java b/src/venice-base/com/silverwrist/venice/obj/DynamicImplCommunityServiceController.java index b628073..4269dc6 100644 --- a/src/venice-base/com/silverwrist/venice/obj/DynamicImplCommunityServiceController.java +++ b/src/venice-base/com/silverwrist/venice/obj/DynamicImplCommunityServiceController.java @@ -66,6 +66,8 @@ public class DynamicImplCommunityServiceController extends DynamicObjectImpl { if (property_name.equals("description")) return m_impl.getDescription(); + if (property_name.equals("accessObject")) + return m_impl.getAccessObject(); return super.get(property_name); } // end get @@ -84,6 +86,13 @@ public class DynamicImplCommunityServiceController extends DynamicObjectImpl // N.B.: "addServiceToCommunity" 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); } // end call