Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore +magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
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 23ab861..e3e9dd9 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java +++ b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java @@ -23,6 +23,7 @@ import com.silverwrist.dynamo.except.*; import com.silverwrist.dynamo.iface.*; import com.silverwrist.dynamo.util.*; import com.silverwrist.venice.community.CommunityServiceInstall; +import com.silverwrist.venice.util.*; import com.silverwrist.venice.conf.ConfNamespaces; import com.silverwrist.venice.conf.iface.UseCount; @@ -39,6 +40,7 @@ public class ModuleMain implements ModuleFunctions, UseCount private static final QualifiedNameKey NAME = new QualifiedNameKey(ConfNamespaces.CONFERENCING_NAMESPACE,"Venice.conferencing"); + private static final String RESOURCES = "com.silverwrist.venice.conf.module.ModuleMessages"; /*-------------------------------------------------------------------------------- * Attributes @@ -48,6 +50,8 @@ public class ModuleMain implements ModuleFunctions, UseCount private int m_usecount = 0; private ModuleSite m_site = null; private Controller m_controller = null; + private ComponentShutdown m_res1; + private ComponentShutdown m_res2; /*-------------------------------------------------------------------------------- * Constructor @@ -71,7 +75,7 @@ public class ModuleMain implements ModuleFunctions, UseCount public String getDescription() { - ResourceBundle b = ResourceBundle.getBundle("com.silverwrist.venice.conf.module.ModuleMessages"); + ResourceBundle b = ResourceBundle.getBundle(RESOURCES); return b.getString("description"); } // end getDescription @@ -80,10 +84,28 @@ public class ModuleMain implements ModuleFunctions, UseCount { m_site = site; + try + { // Mount the resource provider into the resource tree. + ResourceProvider module_res = site.getResourceProvider(); + ResourceProviderManager resmgr = (ResourceProviderManager)(services.queryService(ResourceProviderManager.class)); + m_res1 = resmgr.mountResourceProvider("/scripts/conf",new PrefixResourceProvider(module_res,"/scripts")); + m_res2 = resmgr.mountResourceProvider("/velocity/conf",new PrefixResourceProvider(module_res,"/velocity")); + + } // end try + catch (ConfigException e) + { // translate the ConfigException into a ModuleException + throw new ModuleException(e); + + } // end catch + } // end initialize public void shutdown() { + m_res1.shutdown(); + m_res1 = null; + m_res2.shutdown(); + m_res2 = null; m_site = null; m_controller = null; m_usecount = 0; @@ -111,6 +133,33 @@ public class ModuleMain implements ModuleFunctions, UseCount } // end synchronized block + ResourceBundle bun = ResourceBundle.getBundle(RESOURCES); + + try + { // Install our community menu options. + CommunityMenuInstaller comm_menu = new CommunityMenuInstaller(services); + comm_menu.installCommunityServiceEntry((DynamoUser)installer,bun.getString("comm.menu.prompt"),"SERVLET", + "conf/conferences.js.vs?cc=${cid}",SHORTVAR); + log.info("Installed conferencing option to community left menu"); + + } // end try + catch (DatabaseException de) + { // database error + log.error("Caught database error while installing menus",de); + ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","install.cmenu.fail",de); + me.setParameter(0,de.getMessage()); + throw me; + + } // end catch + catch (DynamoSecurityException dse) + { // security error + log.error("Caught security error while installing menus",dse); + ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","install.cmenu.fail",dse); + me.setParameter(0,dse.getMessage()); + throw me; + + } // end catch + try { // Install our community service. CommunityServiceInstall csi = (CommunityServiceInstall)(services.queryService(CommunityServiceInstall.class)); @@ -149,6 +198,30 @@ public class ModuleMain implements ModuleFunctions, UseCount } // end catch + try + { // uninstall the community menus + CommunityMenuInstaller comm_menu = new CommunityMenuInstaller(services); + comm_menu.removeCommunityServiceEntry((DynamoUser)uninstaller,"conf/conferences.js.vs",SHORTVAR); + log.info("Removed conferencing option from community left menu"); + + } // end try + catch (DatabaseException de) + { // database error + log.error("Caught database error while uninstalling menus",de); + ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","uninstall.cmenu.fail",de); + me.setParameter(0,de.getMessage()); + throw me; + + } // end catch + catch (DynamoSecurityException dse) + { // security error + log.error("Caught security error while uninstalling menus",dse); + ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","uninstall.cmenu.fail",dse); + me.setParameter(0,dse.getMessage()); + throw me; + + } // end catch + } // end uninstall public DynamicObject getProvidedObject(String namespace, String name) throws ModuleException diff --git a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMessages.properties b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMessages.properties index b4775ad..cc537af 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMessages.properties +++ b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMessages.properties @@ -16,5 +16,8 @@ # --------------------------------------------------------------------------------- # This file has been localized for the en_US locale description=Venice Conferencing System +comm.menu.prompt=Conferences install.service.fail=Failed to install community service object: {0} uninstall.service.fail=Failed to uninstall community service object: {0} +install.cmenu.fail=Failed to install community menu items: {0} +uninstall.cmenu.fail=Failed to uninstall community menu items: {0} diff --git a/src/dynamo-framework/com/silverwrist/dynamo/except/ModuleException.java b/src/dynamo-framework/com/silverwrist/dynamo/except/ModuleException.java index 73a28cb..090bff8 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/except/ModuleException.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/except/ModuleException.java @@ -55,4 +55,10 @@ public class ModuleException extends ExternalException } // end constructor + public ModuleException(ConfigException e) + { + super(e); + + } // end constructor + } // end class ModuleException diff --git a/src/dynamo-framework/com/silverwrist/dynamo/util/PrefixResourceProvider.java b/src/dynamo-framework/com/silverwrist/dynamo/util/PrefixResourceProvider.java new file mode 100644 index 0000000..44a2969 --- /dev/null +++ b/src/dynamo-framework/com/silverwrist/dynamo/util/PrefixResourceProvider.java @@ -0,0 +1,64 @@ +/* + * 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