started filling in conferencing resources and some of the init/shutdown/

install/uninstall operations for Conferencing
This commit is contained in:
Eric J. Bowersox 2003-06-21 06:18:05 +00:00
parent 6c5e8b9f86
commit 145509a886
9 changed files with 214 additions and 4 deletions

View File

@ -318,6 +318,10 @@
<copy todir="workingarea/conferencing-module"> <copy todir="workingarea/conferencing-module">
<fileset dir="src/conferencing-module" includes="**/*.properties"/> <fileset dir="src/conferencing-module" includes="**/*.properties"/>
</copy> </copy>
<mkdir dir="workingarea/conferencing-module/resources"/>
<copy todir="workingarea/conferencing-module/resources">
<fileset dir="resources/conferencing-module" includes="**/*"/>
</copy>
</target> </target>
<!-- ============================================================================ <!-- ============================================================================
@ -328,7 +332,7 @@
<jar destfile="jars/venice-conferencing.jar" basedir="workingarea/conferencing-module"> <jar destfile="jars/venice-conferencing.jar" basedir="workingarea/conferencing-module">
<manifest> <manifest>
<attribute name="X-Dynamo-Module-Class" value="com.silverwrist.venice.conf.module.ModuleMain"/> <attribute name="X-Dynamo-Module-Class" value="com.silverwrist.venice.conf.module.ModuleMain"/>
<!-- <attribute name="X-Dynamo-Resource-Prefix" value="/resources"/> --> <attribute name="X-Dynamo-Resource-Prefix" value="/resources"/>
</manifest> </manifest>
</jar> </jar>
</target> </target>

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):
importPackage(java.lang);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.content);
importPackage(Packages.com.silverwrist.venice.iface);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
user = vlib.getUser(req); // get user
comm = vlib.getCommunity(req); // get community
// Create the view.
rc = new VelocityView("Conference List: " + comm.name,"conf/conferences.vm");
rc.setParameter("community",comm);
dynamo.scriptOutput(rc);

View File

@ -0,0 +1,27 @@
#*
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):
*#
#*
Parameters:
community = The community we're getting the conferences of.
*#
#header2( "Conference List:" $community.Name )
## TEMPORARY
<p>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.</p>

View File

@ -23,6 +23,7 @@ import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*; import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.util.*; import com.silverwrist.dynamo.util.*;
import com.silverwrist.venice.community.CommunityServiceInstall; import com.silverwrist.venice.community.CommunityServiceInstall;
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;
@ -39,6 +40,7 @@ public class ModuleMain implements ModuleFunctions, UseCount
private static final QualifiedNameKey NAME = private static final QualifiedNameKey NAME =
new QualifiedNameKey(ConfNamespaces.CONFERENCING_NAMESPACE,"Venice.conferencing"); new QualifiedNameKey(ConfNamespaces.CONFERENCING_NAMESPACE,"Venice.conferencing");
private static final String RESOURCES = "com.silverwrist.venice.conf.module.ModuleMessages";
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Attributes
@ -48,6 +50,8 @@ public class ModuleMain implements ModuleFunctions, UseCount
private int m_usecount = 0; private int m_usecount = 0;
private ModuleSite m_site = null; private ModuleSite m_site = null;
private Controller m_controller = null; private Controller m_controller = null;
private ComponentShutdown m_res1;
private ComponentShutdown m_res2;
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -71,7 +75,7 @@ public class ModuleMain implements ModuleFunctions, UseCount
public String getDescription() public String getDescription()
{ {
ResourceBundle b = ResourceBundle.getBundle("com.silverwrist.venice.conf.module.ModuleMessages"); ResourceBundle b = ResourceBundle.getBundle(RESOURCES);
return b.getString("description"); return b.getString("description");
} // end getDescription } // end getDescription
@ -80,10 +84,28 @@ public class ModuleMain implements ModuleFunctions, UseCount
{ {
m_site = site; 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 } // end initialize
public void shutdown() public void shutdown()
{ {
m_res1.shutdown();
m_res1 = null;
m_res2.shutdown();
m_res2 = null;
m_site = null; m_site = null;
m_controller = null; m_controller = null;
m_usecount = 0; m_usecount = 0;
@ -111,6 +133,33 @@ public class ModuleMain implements ModuleFunctions, UseCount
} // end synchronized block } // 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 try
{ // Install our community service. { // Install our community service.
CommunityServiceInstall csi = (CommunityServiceInstall)(services.queryService(CommunityServiceInstall.class)); CommunityServiceInstall csi = (CommunityServiceInstall)(services.queryService(CommunityServiceInstall.class));
@ -149,6 +198,30 @@ public class ModuleMain implements ModuleFunctions, UseCount
} // end catch } // 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 } // end uninstall
public DynamicObject getProvidedObject(String namespace, String name) throws ModuleException public DynamicObject getProvidedObject(String namespace, String name) throws ModuleException

View File

@ -16,5 +16,8 @@
# --------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------
# This file has been localized for the en_US locale # This file has been localized for the en_US locale
description=Venice Conferencing System description=Venice Conferencing System
comm.menu.prompt=Conferences
install.service.fail=Failed to install community service object: {0} install.service.fail=Failed to install community service object: {0}
uninstall.service.fail=Failed to uninstall 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}

View File

@ -55,4 +55,10 @@ public class ModuleException extends ExternalException
} // end constructor } // end constructor
public ModuleException(ConfigException e)
{
super(e);
} // end constructor
} // end class ModuleException } // end class ModuleException

View File

@ -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 <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.dynamo.util;
import java.io.*;
import com.silverwrist.dynamo.iface.*;
public class PrefixResourceProvider implements ResourceProvider
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private ResourceProvider m_inner;
private String m_prefix;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public PrefixResourceProvider(ResourceProvider inner, String prefix)
{
m_inner = inner;
m_prefix = prefix;
while ((m_prefix.length()>0) && m_prefix.endsWith("/"))
m_prefix = m_prefix.substring(0,m_prefix.length()-1);
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface ResourceProvider
*--------------------------------------------------------------------------------
*/
public InputStream getResource(String resource_path) throws IOException
{
return m_inner.getResource(m_prefix + resource_path);
} // end getResource
public long getResourceModTime(String resource_path)
{
return m_inner.getResourceModTime(m_prefix + resource_path);
} // end getResourceModTime
} // end class PrefixResourceProvider

View File

@ -43,7 +43,7 @@ public class CommunityMenuInstaller
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
CommunityMenuInstaller(ServiceProvider services) public CommunityMenuInstaller(ServiceProvider services)
{ {
m_provider = (MenuProvider)(services.queryService(MenuProvider.class)); m_provider = (MenuProvider)(services.queryService(MenuProvider.class));

View File

@ -43,7 +43,7 @@ public class SystemAdminMenuInstaller
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
SystemAdminMenuInstaller(ServiceProvider services) public SystemAdminMenuInstaller(ServiceProvider services)
{ {
m_provider = (MenuProvider)(services.queryService(MenuProvider.class)); m_provider = (MenuProvider)(services.queryService(MenuProvider.class));