added installer for community services, and set up conferencing module to
use it, along with some random module manager tweaks to make everything work
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
public interface UseCount
|
||||
{
|
||||
public void incrementUseCount();
|
||||
|
||||
public void decrementUseCount();
|
||||
|
||||
} // end interface UseCount
|
||||
@@ -23,6 +23,7 @@ import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.venice.except.*;
|
||||
import com.silverwrist.venice.iface.*;
|
||||
import com.silverwrist.venice.obj.*;
|
||||
import com.silverwrist.venice.conf.iface.UseCount;
|
||||
|
||||
class Controller implements CommunityServiceController
|
||||
{
|
||||
@@ -32,15 +33,18 @@ class Controller implements CommunityServiceController
|
||||
*/
|
||||
|
||||
private DynamicImplCommunityServiceController m_dobj;
|
||||
private UseCount m_uc;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Controller()
|
||||
Controller(UseCount uc)
|
||||
{
|
||||
m_dobj = new DynamicImplCommunityServiceController(this);
|
||||
m_uc = uc;
|
||||
uc.incrementUseCount();
|
||||
|
||||
} // end constructor
|
||||
|
||||
@@ -86,6 +90,9 @@ class Controller implements CommunityServiceController
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
m_uc.decrementUseCount();
|
||||
m_uc = null;
|
||||
|
||||
} // end shutdown
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
|
||||
@@ -22,16 +22,20 @@ import java.util.*;
|
||||
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.conf.ConfNamespaces;
|
||||
import com.silverwrist.venice.conf.iface.UseCount;
|
||||
|
||||
public class ModuleMain implements ModuleFunctions
|
||||
public class ModuleMain implements ModuleFunctions, UseCount
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static final String SERVICE_NAME = "conferencing.service";
|
||||
public static final String CONTROLLER_OBJNAME = "controller";
|
||||
public static final String SHORTVAR = "CONFERENCING";
|
||||
|
||||
private static final QualifiedNameKey NAME =
|
||||
new QualifiedNameKey(ConfNamespaces.CONFERENCING_NAMESPACE,"Venice.conferencing");
|
||||
@@ -100,12 +104,52 @@ public class ModuleMain implements ModuleFunctions
|
||||
public void install(ModuleSite site, ServiceProvider services, Principal installer, DynamoLog log)
|
||||
throws ModuleException
|
||||
{
|
||||
}
|
||||
synchronized (this)
|
||||
{ // create Controller object if necessary
|
||||
if (m_controller==null)
|
||||
m_controller = new Controller(this);
|
||||
|
||||
} // end synchronized block
|
||||
|
||||
try
|
||||
{ // Install our community service.
|
||||
CommunityServiceInstall csi = (CommunityServiceInstall)(services.queryService(CommunityServiceInstall.class));
|
||||
csi.installService(ConfNamespaces.CONFERENCING_NAMESPACE,SERVICE_NAME,site.getHandle(),
|
||||
ConfNamespaces.CONFERENCING_NAMESPACE,CONTROLLER_OBJNAME,m_controller,SHORTVAR);
|
||||
log.info("Installed service " + ConfNamespaces.CONFERENCING_NAMESPACE + "::" + SERVICE_NAME);
|
||||
|
||||
} // end try
|
||||
catch (DatabaseException de)
|
||||
{ // whoops! that didn't work!
|
||||
log.error("Caught database error while installing service",de);
|
||||
ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","install.service.fail",de);
|
||||
me.setParameter(0,de.getMessage());
|
||||
throw me;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end install
|
||||
|
||||
public void uninstall(ModuleSite site, ServiceProvider services, Principal uninstaller, DynamoLog log)
|
||||
throws ModuleException
|
||||
{
|
||||
}
|
||||
try
|
||||
{ // uninstall the community service
|
||||
CommunityServiceInstall csi = (CommunityServiceInstall)(services.queryService(CommunityServiceInstall.class));
|
||||
csi.removeService(ConfNamespaces.CONFERENCING_NAMESPACE,SERVICE_NAME);
|
||||
log.info("Removed service " + ConfNamespaces.CONFERENCING_NAMESPACE + "::" + SERVICE_NAME);
|
||||
|
||||
} // end try
|
||||
catch (DatabaseException de)
|
||||
{ // whoops! that didn't work!
|
||||
log.error("Caught database error while uninstalling service",de);
|
||||
ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","uninstall.service.fail",de);
|
||||
me.setParameter(0,de.getMessage());
|
||||
throw me;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end uninstall
|
||||
|
||||
public DynamicObject getProvidedObject(String namespace, String name) throws ModuleException
|
||||
{
|
||||
@@ -114,7 +158,7 @@ public class ModuleMain implements ModuleFunctions
|
||||
synchronized (this)
|
||||
{ // create it if necessary
|
||||
if (m_controller==null)
|
||||
m_controller = new Controller();
|
||||
m_controller = new Controller(this);
|
||||
return m_controller;
|
||||
|
||||
} // end synchronized block
|
||||
@@ -125,4 +169,21 @@ public class ModuleMain implements ModuleFunctions
|
||||
|
||||
} // end getProvidedObject
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface UseCount
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public synchronized void incrementUseCount()
|
||||
{
|
||||
m_usecount++;
|
||||
|
||||
} // end incrementUseCount
|
||||
|
||||
public synchronized void decrementUseCount()
|
||||
{
|
||||
m_usecount--;
|
||||
|
||||
} // end decrementUseCount
|
||||
|
||||
} // end class ModuleMain
|
||||
|
||||
@@ -16,3 +16,5 @@
|
||||
# ---------------------------------------------------------------------------------
|
||||
# This file has been localized for the en_US locale
|
||||
description=Venice Conferencing System
|
||||
install.service.fail=Failed to install community service object: {0}
|
||||
uninstall.service.fail=Failed to uninstall community service object: {0}
|
||||
|
||||
Reference in New Issue
Block a user