From a6286c384205bcb32d4eaf458d983cc4d33935a5 Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Thu, 26 Jun 2003 10:10:26 +0000 Subject: [PATCH] filled in more skeletons for linked conference implementation; updated the Javadoc task to include docs for the conferencing module and SourceID add-ons --- build.xml | 26 +- .../conf/impl/ConferenceManagerOps.java | 14 + .../conf/impl/ConferenceManagerOps_mysql.java | 6 + .../conf/impl/LinkedConferenceImpl.java | 320 ++++++++++++++++++ .../venice/conf/impl/LinkedConferenceOps.java | 43 +++ .../conf/impl/LinkedConferenceOps_mysql.java | 45 +++ .../conf/obj/DynamicClassConference.java | 8 +- .../obj/DynamicClassLinkedConference.java | 57 ++++ .../conf/obj/DynamicImplConferenceAccess.java | 4 +- .../conf/obj/DynamicImplLinkedConference.java | 200 +++++++++++ .../dynamo/obj/DynamicObjectImpl.java | 50 ++- 11 files changed, 758 insertions(+), 15 deletions(-) create mode 100644 src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceImpl.java create mode 100644 src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceOps.java create mode 100644 src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceOps_mysql.java create mode 100644 src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassLinkedConference.java create mode 100644 src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplLinkedConference.java diff --git a/build.xml b/build.xml index b5ba908..6df6731 100644 --- a/build.xml +++ b/build.xml @@ -600,13 +600,36 @@ + + - + + + + + + + + + + + + + + + + + + + + + + @@ -616,6 +639,7 @@ + diff --git a/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManagerOps.java b/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManagerOps.java index 716cfa4..7b5f052 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManagerOps.java +++ b/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManagerOps.java @@ -30,6 +30,7 @@ abstract class ConferenceManagerOps extends OpsBase */ private ConferenceOps m_confops = null; + private LinkedConferenceOps m_linkedops = null; /*-------------------------------------------------------------------------------- * Constructor @@ -52,6 +53,9 @@ abstract class ConferenceManagerOps extends OpsBase if (m_confops!=null) m_confops.dispose(); m_confops = null; + if (m_linkedops!=null) + m_linkedops.dispose(); + m_linkedops = null; super.dispose(); } // end dispose @@ -63,6 +67,8 @@ abstract class ConferenceManagerOps extends OpsBase protected abstract ConferenceOps createConferenceOps(DBConnectionPool pool); + protected abstract LinkedConferenceOps createLinkedConferenceOps(DBConnectionPool pool); + /*-------------------------------------------------------------------------------- * External operations *-------------------------------------------------------------------------------- @@ -76,6 +82,14 @@ abstract class ConferenceManagerOps extends OpsBase } // end getConferenceOps + synchronized LinkedConferenceOps getLinkedConferenceOps() + { + if (m_linkedops==null) + m_linkedops = createLinkedConferenceOps(getPool()); + return m_linkedops; + + } // end getConferenceOps + /*-------------------------------------------------------------------------------- * External static operations *-------------------------------------------------------------------------------- diff --git a/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManagerOps_mysql.java b/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManagerOps_mysql.java index 2656f4c..52f52bc 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManagerOps_mysql.java +++ b/src/conferencing-module/com/silverwrist/venice/conf/impl/ConferenceManagerOps_mysql.java @@ -48,4 +48,10 @@ public class ConferenceManagerOps_mysql extends ConferenceManagerOps } // end createConferenceOps + protected LinkedConferenceOps createLinkedConferenceOps(DBConnectionPool pool) + { + return new LinkedConferenceOps_mysql(pool); + + } // end createLinkedConferenceOps + } // end class ConferenceManagerOps_mysql diff --git a/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceImpl.java b/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceImpl.java new file mode 100644 index 0000000..19c2ab0 --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceImpl.java @@ -0,0 +1,320 @@ +/* + * 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.security.acl.*; +import java.util.*; +import com.silverwrist.dynamo.iface.*; +import com.silverwrist.dynamo.except.*; +import com.silverwrist.venice.iface.*; +import com.silverwrist.venice.conf.iface.*; +import com.silverwrist.venice.conf.obj.*; + +class LinkedConferenceImpl implements VeniceLinkedConference +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private DynamicImplLinkedConference m_dobj; + private LinkedConferenceOps m_ops; + private ConferenceImpl m_conf; + private VeniceCommunity m_comm; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + LinkedConferenceImpl(LinkedConferenceOps ops, ConferenceImpl conf, VeniceCommunity comm) + { + m_dobj = new DynamicImplLinkedConference(this); + m_ops = ops; + m_conf = conf; + m_comm = comm; + + } // 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 NamedObject + *-------------------------------------------------------------------------------- + */ + + /** + * Returns the name of this object. + * + * @return The name of this object. + */ + public String getName() + { + return m_conf.getName(); + + } // end getName + + /*-------------------------------------------------------------------------------- + * Implementations from interface ObjectProvider + *-------------------------------------------------------------------------------- + */ + + /** + * Retrieves an object from this ObjectProvider. + * + * @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 m_conf.getObject(namespace,name); + + } // end getObject + + /*-------------------------------------------------------------------------------- + * Implementations from interface SecureObjectStore + *-------------------------------------------------------------------------------- + */ + + /** + * Sets an object into this SecureObjectStore. + * + * @param caller The user performing the operation. + * @param namespace The namespace to interpret the name relative to. + * @param name The name of the object to be set. + * @param value The object to set into the SecureObjectStore. + * @return The previous object that was set into the SecureObjectStore under this namespace and name, or + * null if there was no such object. + * @exception com.silverwrist.dynamo.except.DatabaseException If there was an error setting the object value. + * @exception com.silverwrist.dynamo.except.DynamoSecurityException If the specified user is not permitted to + * set this object value into this SecureObjectStore. + */ + public Object setObject(DynamoUser caller, String namespace, String name, Object value) + throws DatabaseException, DynamoSecurityException + { + return m_conf.setObject(caller,namespace,name,value); + + } // end setObject + + /** + * Removes an object from this SecureObjectStore. + * + * @param caller The user performing the operation. + * @param namespace The namespace to interpret the name relative to. + * @param name The name of the object to be removed. + * @return The previous object that was set into the SecureObjectStore under this namespace and name, or + * null if there was no such object. + * @exception com.silverwrist.dynamo.except.DatabaseException If there was an error removing the object value. + * @exception com.silverwrist.dynamo.except.DynamoSecurityException If the specified user is not permitted to + * remove this object value from this SecureObjectStore. + */ + public Object removeObject(DynamoUser caller, String namespace, String name) + throws DatabaseException, DynamoSecurityException + { + return m_conf.removeObject(caller,namespace,name); + + } // end removeObject + + /** + * Returns a collection of all object namespaces that have been set into this SecureObjectStore. + * + * @return A {@link java.util.Collection Collection} containing {@link java.lang.String String} objects specifying + * all the object namespaces. + * @exception com.silverwrist.dynamo.except.DatabaseException If there was an error getting the namespace list. + */ + public Collection getNamespaces() throws DatabaseException + { + return m_conf.getNamespaces(); + + } // end getNamespaces + + /** + * Returns a collection of all object names that have been set into this SecureObjectStore under + * a given namespace. + * + * @param namespace The namespace to look for names under. + * @return A {@link java.util.Collection Collection} containing {@link java.lang.String String} objects + * specifying all the object names for this namespace. + * @exception com.silverwrist.dynamo.except.DatabaseException If there was an error getting the object name list. + */ + public Collection getNamesForNamespace(String namespace) throws DatabaseException + { + return m_conf.getNamesForNamespace(namespace); + + } // end getNamesForNamespace + + /*-------------------------------------------------------------------------------- + * Implementations from interface VeniceConference + *-------------------------------------------------------------------------------- + */ + + public int getConfID() + { + return m_conf.getConfID(); + + } // end getConfID + + public void setName(DynamoUser caller, String name) throws DatabaseException, DynamoSecurityException + { + m_conf.setName(caller,name); + + } // end setName + + public java.util.Date getCreatedDate() + { + return m_conf.getCreatedDate(); + + } // end getCreatedDate + + public java.util.Date getLastUpdateDate() + { + return m_conf.getLastUpdateDate(); + + } // end getLastUpdateDate + + public void setLastUpdateDate(DynamoUser caller, java.util.Date date) + throws DatabaseException, DynamoSecurityException + { + m_conf.setLastUpdateDate(caller,date); + + } // end setLastUpdateDate + + public int getHostsGID() + { + return m_conf.getHostsGID(); + + } // end getHostsGID + + public DynamoGroup getHosts() throws DatabaseException + { + return m_conf.getHosts(); + + } // end getHosts + + public DynamoAcl getAcl() throws DatabaseException, AclNotFoundException + { + return m_conf.getAcl(); + + } // end getAcl + + public Set getAliases() throws DatabaseException + { + return m_conf.getAliases(); + + } // end getAliases + + public String getPrimaryAlias() throws DatabaseException + { + return m_conf.getPrimaryAlias(); + + } // end getPrimaryAlias + + public void setPrimaryAlias(DynamoUser caller, String alias) throws DatabaseException, DynamoSecurityException + { + m_conf.setPrimaryAlias(caller,alias); + + } // end setPrimaryAlias + + public void addAlias(DynamoUser caller, String alias) throws DatabaseException, DynamoSecurityException + { + m_conf.addAlias(caller,alias); + + } // end addAlias + + public void removeAlias(DynamoUser caller, String alias) throws DatabaseException, DynamoSecurityException + { + m_conf.removeAlias(caller,alias); + + } // end removeAlias + + /*-------------------------------------------------------------------------------- + * Implementations from interface VeniceLinkedConference + *-------------------------------------------------------------------------------- + */ + + public VeniceCommunity getCommunity() + { + return m_comm; + + } // end getCommunity + + public VeniceConference getConference() + { + return m_conf; + + } // end getConference + + public int getSequence() + { + return -1; // TEMP + + } + + public void setSequence(DynamoUser caller, int sequence) throws DatabaseException, DynamoSecurityException + { + } + + public boolean isHidden() + { + return false; // TEMP + + } + + public void setHidden(DynamoUser caller, boolean flag) throws DatabaseException, DynamoSecurityException + { + } + + public void unlink(DynamoUser caller) throws DatabaseException, DynamoSecurityException + { + } + +} // end class LinkedConferenceImpl diff --git a/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceOps.java b/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceOps.java new file mode 100644 index 0000000..5c868ac --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceOps.java @@ -0,0 +1,43 @@ +/* + * 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.db.OpsBase; +import com.silverwrist.dynamo.except.*; +import com.silverwrist.dynamo.iface.*; + +abstract class LinkedConferenceOps extends OpsBase +{ + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + protected LinkedConferenceOps(DBConnectionPool pool) + { + super(pool); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Abstract operations + *-------------------------------------------------------------------------------- + */ + +} // end class LinkedConferenceOps diff --git a/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceOps_mysql.java b/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceOps_mysql.java new file mode 100644 index 0000000..8fe439c --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/impl/LinkedConferenceOps_mysql.java @@ -0,0 +1,45 @@ +/* + * 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.sql.*; +import java.util.*; +import com.silverwrist.util.*; +import com.silverwrist.dynamo.except.*; +import com.silverwrist.dynamo.iface.*; +import com.silverwrist.dynamo.util.*; + +class LinkedConferenceOps_mysql extends LinkedConferenceOps +{ + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + LinkedConferenceOps_mysql(DBConnectionPool pool) + { + super(pool); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Abstract implementations from class LinkedConferenceOps + *-------------------------------------------------------------------------------- + */ + +} // end class LinkedConferenceOps_mysql diff --git a/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassConference.java b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassConference.java index 3426afa..4ca5504 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassConference.java +++ b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassConference.java @@ -25,7 +25,7 @@ import com.silverwrist.venice.conf.iface.*; class DynamicClassConference extends DynamicClassImpl { /*-------------------------------------------------------------------------------- - * Constructor + * Constructors *-------------------------------------------------------------------------------- */ @@ -35,6 +35,12 @@ class DynamicClassConference extends DynamicClassImpl } // end constructor + protected DynamicClassConference(String name) + { + super(name); + + } // end constructor + /*-------------------------------------------------------------------------------- * Overrides from class DynamicClassImpl *-------------------------------------------------------------------------------- diff --git a/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassLinkedConference.java b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassLinkedConference.java new file mode 100644 index 0000000..633fa8d --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicClassLinkedConference.java @@ -0,0 +1,57 @@ +/* + * 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 DynamicClassLinkedConference extends DynamicClassConference +{ + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + DynamicClassLinkedConference() + { + super("Dynamic." + VeniceLinkedConference.class.getName()); + + } // end constructor + + protected DynamicClassLinkedConference(String name) + { + super(name); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class DynamicClassImpl + *-------------------------------------------------------------------------------- + */ + + public DynamicObject cast(Object source) throws ClassCastException + { + if (source instanceof VeniceLinkedConference) + return (DynamicObject)source; + return super.cast(source); + + } // end cast + +} // end class DynamicClassLinkedConference diff --git a/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplConferenceAccess.java b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplConferenceAccess.java index 9065fcd..535a720 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplConferenceAccess.java +++ b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplConferenceAccess.java @@ -89,8 +89,8 @@ public class DynamicImplConferenceAccess extends DynamicObjectImpl 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])); + int foo = getIntValue(method_name,parameters,0); + return m_impl.getConference(foo); } // end try catch (DatabaseException e) diff --git a/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplLinkedConference.java b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplLinkedConference.java new file mode 100644 index 0000000..2997973 --- /dev/null +++ b/src/conferencing-module/com/silverwrist/venice/conf/obj/DynamicImplLinkedConference.java @@ -0,0 +1,200 @@ +/* + * 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 java.security.acl.*; +import java.util.*; +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 DynamicImplLinkedConference extends DynamicImplConference +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static DynamicClass s_baseclass = null; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private VeniceLinkedConference m_impl; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public DynamicImplLinkedConference(VeniceLinkedConference impl, DynamicClass dclass) + { + super(impl,dclass); + m_impl = impl; + + } // end constructor + + public DynamicImplLinkedConference(VeniceLinkedConference impl) + { + super(impl,getBaseDClass()); + m_impl = impl; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class DynamicObjectImpl + *-------------------------------------------------------------------------------- + */ + + public Object get(String property_name) throws DynamicObjectException + { + if (property_name.equals("community")) + return m_impl.getCommunity(); + if (property_name.equals("conference")) + return m_impl.getConference(); + if (property_name.equals("sequence")) + return new Integer(m_impl.getSequence()); + if (property_name.equals("hidden")) + return Boolean.valueOf(m_impl.isHidden()); + return super.get(property_name); + + } // end get + + public Object call(String method_name, Object[] parameters) throws DynamicObjectException + { + if (method_name.equals("getCommunity")) + { // verify parameters and call method + verifyParameterLength(method_name,parameters,0); + return m_impl.getCommunity(); + + } // end if + + if (method_name.equals("getConference")) + { // verify parameters and call method + verifyParameterLength(method_name,parameters,0); + return m_impl.getConference(); + + } // end if + + if (method_name.equals("getSequence")) + { // verify parameters and call method + verifyParameterLength(method_name,parameters,0); + return new Integer(m_impl.getSequence()); + + } // end if + + if (method_name.equals("setSequence")) + { // verify parameters and call method + try + { // make sure and catch exceptions + verifyParameterLength(method_name,parameters,2); + verifyParameterType(method_name,parameters,0,DynamoUser.class); + int foo = getIntValue(method_name,parameters,1); + m_impl.setSequence((DynamoUser)(parameters[0]),foo); + return null; + + } // end try + catch (DatabaseException e) + { // catch and turn into a call failure + throw callFailed(e); + + } // end catch + catch (DynamoSecurityException e) + { // catch and turn into a call failure + throw callFailed(e); + + } // end catch + + } // end if + + if (method_name.equals("isHidden")) + { // verify parameters and call method + verifyParameterLength(method_name,parameters,0); + return Boolean.valueOf(m_impl.isHidden()); + + } // end if + + if (method_name.equals("setHidden")) + { // verify parameters and call method + try + { // make sure and catch exceptions + verifyParameterLength(method_name,parameters,2); + verifyParameterType(method_name,parameters,0,DynamoUser.class); + boolean foo = getBooleanValue(method_name,parameters,1); + m_impl.setHidden((DynamoUser)(parameters[0]),foo); + return null; + + } // end try + catch (DatabaseException e) + { // catch and turn into a call failure + throw callFailed(e); + + } // end catch + catch (DynamoSecurityException e) + { // catch and turn into a call failure + throw callFailed(e); + + } // end catch + + } // end if + + if (method_name.equals("unlink")) + { // verify parameters and call method + try + { // make sure and catch exceptions + verifyParameterLength(method_name,parameters,1); + verifyParameterType(method_name,parameters,0,DynamoUser.class); + m_impl.unlink((DynamoUser)(parameters[0])); + return null; + + } // end try + catch (DatabaseException e) + { // catch and turn into a call failure + throw callFailed(e); + + } // end catch + catch (DynamoSecurityException e) + { // catch and turn into a call failure + 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 DynamicClassLinkedConference(); + return s_baseclass; + + } // end getBaseDClass + +} // end class DynamicImplLinkedConference diff --git a/src/dynamo-framework/com/silverwrist/dynamo/obj/DynamicObjectImpl.java b/src/dynamo-framework/com/silverwrist/dynamo/obj/DynamicObjectImpl.java index 556551d..cf81dc6 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/obj/DynamicObjectImpl.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/obj/DynamicObjectImpl.java @@ -18,6 +18,7 @@ package com.silverwrist.dynamo.obj; import java.util.*; +import com.silverwrist.util.*; import com.silverwrist.dynamo.except.*; import com.silverwrist.dynamo.iface.*; @@ -46,22 +47,22 @@ 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 ParameterCountException badCount(String method_name, Object[] parameters, int len) + { + return new ParameterCountException(m_dclass,method_name,len,parameters.length); + + } // end badCount + protected final void verifyParameterLength(String method_name, Object[] parameters, int len) { if (parameters.length!=len) - throw new ParameterCountException(m_dclass,method_name,len,parameters.length); + throw badCount(method_name,parameters,len); } // end verifyParameterLength @@ -80,14 +81,41 @@ public class DynamicObjectImpl implements DynamicObject } // end verifyParameterType - protected final void verifyParameterNumber(String method_name, Object[] parameters, int ndx) + protected final int getIntValue(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()); + if (parameters[ndx] instanceof Number) + return ((Number)(parameters[ndx])).intValue(); + try + { // parse string equivalent as integer + return Integer.parseInt(parameters[ndx].toString()); - } // end verifyParameterNumber + } // end try + catch (NumberFormatException e) + { // this is where the type error goes... + throw badType(method_name,ndx,Integer.class,parameters[ndx].getClass()); + + } // end catch + + } // end getIntValue + + protected final boolean getBooleanValue(String method_name, Object[] parameters, int ndx) + { + if (parameters[ndx]==null) + throw badType(method_name,ndx,Boolean.class,null); + if (parameters[ndx] instanceof Boolean) + return ((Boolean)(parameters[ndx])).booleanValue(); + if (parameters[ndx] instanceof Number) + return (((Number)(parameters[ndx])).intValue()!=0); + String s = parameters[ndx].toString(); + if (StringUtils.isBooleanTrue(s)) + return true; + if (StringUtils.isBooleanFalse(s)) + return false; + throw badType(method_name,ndx,Boolean.class,parameters[ndx].getClass()); + + } // end getBooleanValue /*-------------------------------------------------------------------------------- * Implementations from interface DynamicObject