Removes org.apache.felix.servicebinder.

cusax-fix
Lyubomir Marinov 17 years ago
parent 2e83c45aa2
commit 8805906417

@ -7,7 +7,6 @@
<classpathentry kind="lib" path="lib/felix.jar"/>
<classpathentry kind="lib" path="lib/jdic-all.jar"/>
<classpathentry kind="lib" path="lib/bundle/junit.jar"/>
<classpathentry kind="lib" path="lib/bundle/org.apache.felix.servicebinder-0.9.0-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/apache-ant-1.7.0.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/aclibico-2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/commons-logging.jar"/>

@ -122,7 +122,7 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>src</package-root>
<classpath mode="compile">lib/bcprovider.jar:lib/felix.jar:lib/jdic-all.jar:lib/bundle/junit.jar:lib/bundle/log4j.jar:lib/bundle/org.apache.felix.servicebinder-0.9.0-SNAPSHOT.jar:lib/installer-exclude/commons-logging.jar:lib/installer-exclude/concurrent.jar:lib/installer-exclude/dict4j.jar:lib/installer-exclude/dnsjava-2.0.3.jar:lib/installer-exclude/JainSipApi1.2.jar:lib/installer-exclude/JainSipRi1.2.jar:lib/installer-exclude/jcalendar-1.3.2.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/jdom.jar:lib/installer-exclude/jmf.jar:lib/installer-exclude/jml-1.0b2.jar:lib/installer-exclude/joscar-client.jar:lib/installer-exclude/joscar-common.jar:lib/installer-exclude/joscar-protocol.jar:lib/installer-exclude/jsocks-klea.jar:lib/installer-exclude/jspeex.jar:lib/installer-exclude/junit.jar:lib/installer-exclude/log4j-1.2.8.jar:lib/installer-exclude/nist-sdp-1.0.jar:lib/installer-exclude/rome-0.9.jar:lib/installer-exclude/smack.jar:lib/installer-exclude/smackx.jar:lib/installer-exclude/smackx-jingle.jar:lib/installer-exclude/Stun4J.jar:lib/installer-exclude/ymsg_network_v0_63.jar:lib/installer-exclude/ffmpeg-java-gpl.jar:lib/installer-exclude/fmj.jar:lib/installer-exclude/jna.jar:lib/installer-exclude/lti-civil-no_s_w_t.jar:lib/installer-exclude/swing-worker-1.2.jar:lib/os-specific/linux/installer-exclude/jmf.jar:lib/os-specific/linux/jdic_stub.jar:lib/os-specific/mac/AppleJavaExtensions.jar:lib/os-specific/mac/growl.jar:lib/os-specific/mac/jdic_stub.jar:lib/os-specific/mac/installer-exclude/jmf.jar:lib/os-specific/mac/installer-exclude/dock.jar:lib/os-specific/windows/jdic_stub.jar:lib/os-specific/windows/installer-exclude/jmf.jar:lib/os-specific/windows/installer-exclude/sound.jar:lib/installer-exclude/aclibico-2.1.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/pircbot.jar:lib/os-specific/solaris/jdic_stub.jar:lib/os-specific/solaris/installer-exclude/jmf.jar:lib/installer-exclude/jsch-0.1.36.jar:lib/installer-exclude/apache-ant-1.7.0.jar:lib/installer-exclude/izpack-shortcut-link.jar:lib/installer-exclude/jfontchooser-1.0.5.jar:lib/installer-exclude/KeybindingUtil.jar:lib/installer-exclude/laf-widget.jar:lib/installer-exclude/transparency.jar:lib/installer-exclude/zrtp4j-1.4.0.jar:lib/installer-exclude/profiler4j-1.0-beta3-SC.jar</classpath>
<classpath mode="compile">lib/bcprovider.jar:lib/felix.jar:lib/jdic-all.jar:lib/bundle/junit.jar:lib/bundle/log4j.jar:lib/installer-exclude/commons-logging.jar:lib/installer-exclude/concurrent.jar:lib/installer-exclude/dict4j.jar:lib/installer-exclude/dnsjava-2.0.3.jar:lib/installer-exclude/JainSipApi1.2.jar:lib/installer-exclude/JainSipRi1.2.jar:lib/installer-exclude/jcalendar-1.3.2.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/jdom.jar:lib/installer-exclude/jmf.jar:lib/installer-exclude/jml-1.0b2.jar:lib/installer-exclude/joscar-client.jar:lib/installer-exclude/joscar-common.jar:lib/installer-exclude/joscar-protocol.jar:lib/installer-exclude/jsocks-klea.jar:lib/installer-exclude/jspeex.jar:lib/installer-exclude/junit.jar:lib/installer-exclude/log4j-1.2.8.jar:lib/installer-exclude/nist-sdp-1.0.jar:lib/installer-exclude/rome-0.9.jar:lib/installer-exclude/smack.jar:lib/installer-exclude/smackx.jar:lib/installer-exclude/smackx-jingle.jar:lib/installer-exclude/Stun4J.jar:lib/installer-exclude/ymsg_network_v0_63.jar:lib/installer-exclude/ffmpeg-java-gpl.jar:lib/installer-exclude/fmj.jar:lib/installer-exclude/jna.jar:lib/installer-exclude/lti-civil-no_s_w_t.jar:lib/installer-exclude/swing-worker-1.2.jar:lib/os-specific/linux/installer-exclude/jmf.jar:lib/os-specific/linux/jdic_stub.jar:lib/os-specific/mac/AppleJavaExtensions.jar:lib/os-specific/mac/growl.jar:lib/os-specific/mac/jdic_stub.jar:lib/os-specific/mac/installer-exclude/jmf.jar:lib/os-specific/mac/installer-exclude/dock.jar:lib/os-specific/windows/jdic_stub.jar:lib/os-specific/windows/installer-exclude/jmf.jar:lib/os-specific/windows/installer-exclude/sound.jar:lib/installer-exclude/aclibico-2.1.jar:lib/installer-exclude/jdic_misc.jar:lib/installer-exclude/pircbot.jar:lib/os-specific/solaris/jdic_stub.jar:lib/os-specific/solaris/installer-exclude/jmf.jar:lib/installer-exclude/jsch-0.1.36.jar:lib/installer-exclude/apache-ant-1.7.0.jar:lib/installer-exclude/izpack-shortcut-link.jar:lib/installer-exclude/jfontchooser-1.0.5.jar:lib/installer-exclude/KeybindingUtil.jar:lib/installer-exclude/laf-widget.jar:lib/installer-exclude/transparency.jar:lib/installer-exclude/zrtp4j-1.4.0.jar:lib/installer-exclude/profiler4j-1.0-beta3-SC.jar</classpath>
<built-to>classes</built-to>
<source-level>1.5</source-level>
</compilation-unit>

@ -55,12 +55,9 @@ org.osgi.framework.system.packages.extra= org.osgi.framework; ; version=1.3.0, \
org.bouncycastle.crypto.params; \
org.bouncycastle.crypto.engines;
felix.auto.start.10= reference:file:lib/bundle/org.apache.felix.bundlerepository-1.0.0.jar \
reference:file:lib/bundle/org.apache.felix.servicebinder-0.9.0-SNAPSHOT.jar
#reference:file:lib/bundle/org.apache.felix.bundlerepository-0.8.0-SNAPSHOT.jar
#\
felix.auto.start.10= \
reference:file:lib/bundle/org.apache.felix.bundlerepository-1.0.0.jar
# file:lib/bundle/shell.jar \
# \
# file:lib/bundle/servicebinder.jar \
# file:lib/bundle/tablelayout.jar

@ -59,12 +59,11 @@ org.osgi.framework.system.packages.extra= org.osgi.framework; ; version=1.3.0, \
# file:lib/bundle/tablelayout.jar \
#
felix.auto.start.1= file:lib/bundle/org.apache.felix.servicebinder-0.9.0-SNAPSHOT.jar \
felix.auto.start.1= \
file:lib/bundle/junit.jar
# file:lib/bundle/shell.jar \
# file:lib/bundle/bundlerepository.jar \
# file:lib/bundle/servicebinder.jar \
#
felix.auto.start.2= \
reference:file:sc-bundles/util.jar \

@ -1,12 +1,39 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.fileaccess;
import org.apache.felix.servicebinder.GenericActivator;
import org.osgi.framework.*;
import net.java.sip.communicator.service.fileaccess.*;
/**
* Invoke "Service Binder" to parse the service XML and register all services.
*
* @author Alexander Pelov
* @author Lubomir Marinov
*/
public class FileAccessActivator extends GenericActivator {
public class FileAccessActivator
implements BundleActivator
{
private ServiceRegistration serviceRegistration;
public void start(BundleContext bundleContext)
{
serviceRegistration =
bundleContext.registerService(FileAccessService.class.getName(),
new FileAccessServiceImpl(), null);
}
public void stop(BundleContext bundleContext)
{
if (serviceRegistration != null)
{
serviceRegistration.unregister();
serviceRegistration = null;
}
}
}

@ -35,13 +35,6 @@ public class FileAccessServiceImpl implements FileAccessService {
*/
public static final String TEMP_FILE_SUFFIX = "TEMP";
/**
* An synchronization object.
*
* A lock should be obtained whenever the configuration service is accessed.
*/
private Object syncRoot = new Object();
/**
* This method returns a created temporary file. After you close this file
* it is not guaranteed that you will be able to open it again nor that it

@ -5,7 +5,6 @@ Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
org.apache.felix.servicebinder,
org.xml.sax,
org.w3c.dom,
javax.xml.transform,
@ -15,6 +14,5 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.util.xml,
net.java.sip.communicator.service.fileaccess,
Export-Package: net.java.sip.communicator.service.fileaccess,
net.java.sip.communicator.impl.fileaccess
Export-Package: net.java.sip.communicator.service.fileaccess
Metadata-Location: /net/java/sip/communicator/impl/fileaccess/fileaccess.metadata.xml

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<bundle>
<component class="net.java.sip.communicator.impl.fileaccess.FileAccessServiceImpl">
<provides service="net.java.sip.communicator.service.fileaccess.FileAccessService"/>
</component>
</bundle>

@ -6,13 +6,34 @@
*/
package net.java.sip.communicator.impl.history;
import org.apache.felix.servicebinder.GenericActivator;
import org.osgi.framework.*;
import net.java.sip.communicator.service.history.*;
/**
* Invoke "Service Binder" to parse the service XML and register all services.
*
* @author Alexander Pelov
* @author Lubomir Marinov
*/
public class HistoryActivator extends GenericActivator {
public class HistoryActivator
implements BundleActivator
{
private ServiceRegistration serviceRegistration;
public void start(BundleContext bundleContext) throws Exception
{
serviceRegistration =
bundleContext.registerService(HistoryService.class.getName(),
new HistoryServiceImpl(bundleContext), null);
}
public void stop(BundleContext bundleContext)
{
if (serviceRegistration != null)
{
serviceRegistration.unregister();
serviceRegistration = null;
}
}
}

@ -8,9 +8,12 @@
import java.io.*;
import java.util.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.osgi.framework.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.fileaccess.*;
@ -21,9 +24,11 @@
/**
* @author Alexander Pelov
* @author Damian Minkov
* @author Lubomir Marinov
*/
public class HistoryServiceImpl implements HistoryService {
public class HistoryServiceImpl
implements HistoryService
{
public static final String DATA_DIRECTORY = "history_ver1.0";
public static final String DATA_FILE = "dbstruct.dat";
@ -31,25 +36,18 @@ public class HistoryServiceImpl implements HistoryService {
/**
* The logger for this class.
*/
private static Logger log = Logger.getLogger(HistoryServiceImpl.class);
private Map histories = new Hashtable(); // Note: Hashtable is
// SYNCHRONIZED
private Collection loadedFiles = Collections
.synchronizedCollection(new Vector());
private ConfigurationService configurationService;
private static final Logger logger =
Logger.getLogger(HistoryServiceImpl.class);
private FileAccessService fileAccessService;
// Note: Hashtable is SYNCHRONIZED
private final Map<HistoryID, History> histories =
new Hashtable<HistoryID, History>();
private Object syncRoot_FileAccess = new Object();
private final FileAccessService fileAccessService;
private Object syncRoot_Config = new Object();
private final DocumentBuilder builder;
private DocumentBuilder builder;
private boolean cacheEnabled = false;
private final boolean cacheEnabled;
/**
* Characters and their replacement in created folder names
@ -68,16 +66,20 @@ public class HistoryServiceImpl implements HistoryService {
{"\\|", "&_pp"} // the char |
};
public HistoryServiceImpl()
public HistoryServiceImpl(BundleContext bundleContext)
throws Exception
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
this.builder = factory.newDocumentBuilder();
this.builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
this.cacheEnabled =
getConfigurationService(bundleContext).getBoolean(
CACHE_ENABLED_PROPERTY, false);
this.fileAccessService = getFileAccessService(bundleContext);
}
public Iterator getExistingIDs()
public Iterator<HistoryID> getExistingIDs()
{
Vector vect = new Vector();
List<File> vect = new Vector<File>();
File histDir = null;
try {
String userSetDataDirectory = System.getProperty("HistoryServiceDirectory");
@ -91,34 +93,27 @@ public Iterator getExistingIDs()
findDatFiles(vect, histDir);
} catch (Exception e)
{
log.error("Error opening directory", e);
logger.error("Error opening directory", e);
}
DBStructSerializer structParse = new DBStructSerializer(this);
int size = vect.size();
for (int i = 0; i < size; i++)
for (File f : vect)
{
File f = (File) vect.get(i);
synchronized (this.loadedFiles)
synchronized (this.histories)
{
if (!this.loadedFiles.contains(f))
try
{
synchronized (this.histories)
History hist = structParse.loadHistory(f);
if (!this.histories.containsKey(hist.getID()))
{
try {
History hist = structParse.loadHistory(f);
if (!this.histories.containsKey(hist.getID()))
{
this.histories.put(hist.getID(), hist);
}
} catch (Exception e)
{
log.error("Could not load history from file: "
+ f.getAbsolutePath(), e);
}
this.histories.put(hist.getID(), hist);
}
}
catch (Exception e)
{
logger.error("Could not load history from file: "
+ f.getAbsolutePath(), e);
}
}
}
@ -218,7 +213,7 @@ protected synchronized Document parse(ByteArrayInputStream in)
return builder.parse(in);
}
private void findDatFiles(Vector vect, File directory)
private void findDatFiles(List<File> vect, File directory)
{
File[] files = directory.listFiles();
for (int i = 0; i < files.length; i++)
@ -226,7 +221,8 @@ private void findDatFiles(Vector vect, File directory)
if (files[i].isDirectory())
{
findDatFiles(vect, files[i]);
} else if (DATA_FILE.equalsIgnoreCase(files[i].getName()))
}
else if (DATA_FILE.equalsIgnoreCase(files[i].getName()))
{
vect.add(files[i]);
}
@ -271,78 +267,6 @@ private File createHistoryDirectories(HistoryID id)
return directory;
}
// //////////////////////////////////////////////////////////////////////////
/**
* Set the configuration service.
*
* @param configurationService ConfigurationService
*/
public void setConfigurationService(
ConfigurationService configurationService)
{
synchronized (this.syncRoot_Config)
{
this.configurationService = configurationService;
log.debug("New configuration service registered.");
// store some config for further use
Object isCacheEnabledObj =
this.configurationService.getProperty(HistoryService.CACHE_ENABLED_PROPERTY);
if(isCacheEnabledObj != null && isCacheEnabledObj.equals(HistoryService.CACHE_ENABLED))
cacheEnabled = true;
}
}
/**
* Remove a configuration service.
*
* @param configurationService ConfigurationService
*/
public void unsetConfigurationService(
ConfigurationService configurationService)
{
synchronized (this.syncRoot_Config)
{
if (this.configurationService == configurationService)
{
this.configurationService = null;
log.debug("Configuration service unregistered.");
}
}
}
/**
* Set the file access service.
*
* @param fileAccessService FileAccessService
*/
public void setFileAccessService(FileAccessService fileAccessService)
{
synchronized (this.syncRoot_FileAccess)
{
this.fileAccessService = fileAccessService;
log.debug("New file access service registered.");
}
}
/**
* Remove the file access service.
*
* @param fileAccessService FileAccessService
*/
public void unsetFileAccessService(FileAccessService fileAccessService)
{
synchronized (this.syncRoot_FileAccess)
{
if (this.fileAccessService == fileAccessService)
{
this.fileAccessService = null;
log.debug("File access service unregistered.");
}
}
}
/**
* Returns whether caching of readed documents is enabled or desibled.
* @return boolean
@ -361,9 +285,9 @@ protected boolean isCacheEnabled()
public void purgeLocallyStoredHistory(HistoryID id)
throws IOException
{
// get the history direcoty coresponding the given id
// get the history directory corresponding the given id
File dir = this.createHistoryDirectories(id);
log.trace("Removing history directory " + dir);
logger.trace("Removing history directory " + dir);
deleteDirAndContent(dir);
}
@ -414,4 +338,24 @@ private void escapeCharacters(String[] ids)
ids[i] = currId;
}
}
private static ConfigurationService getConfigurationService(
BundleContext bundleContext)
{
ServiceReference serviceReference =
bundleContext.getServiceReference(ConfigurationService.class
.getName());
return (serviceReference == null) ? null
: (ConfigurationService) bundleContext.getService(serviceReference);
}
private static FileAccessService getFileAccessService(
BundleContext bundleContext)
{
ServiceReference serviceReference =
bundleContext
.getServiceReference(FileAccessService.class.getName());
return (serviceReference == null) ? null
: (FileAccessService) bundleContext.getService(serviceReference);
}
}

@ -5,7 +5,6 @@ Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.osgi.framework,
org.apache.felix.servicebinder,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.fileaccess,
net.java.sip.communicator.service.history,
@ -20,6 +19,5 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.util.xml,
Export-Package: net.java.sip.communicator.service.history,
net.java.sip.communicator.service.history.event,
net.java.sip.communicator.impl.history,
net.java.sip.communicator.service.history.records,
net.java.sip.communicator.service.history.records
Metadata-Location: /net/java/sip/communicator/impl/history/history.metadata.xml

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<bundle>
<component class="net.java.sip.communicator.impl.history.HistoryServiceImpl">
<provides service="net.java.sip.communicator.service.history.HistoryService"/>
<requires service="net.java.sip.communicator.service.configuration.ConfigurationService"
filter=""
policy="static"
cardinality="1..1"
bind-method="setConfigurationService"
unbind-method="unsetConfigurationService" />
<requires service="net.java.sip.communicator.service.fileaccess.FileAccessService"
filter=""
policy="static"
cardinality="1..1"
bind-method="setFileAccessService"
unbind-method="unsetFileAccessService" />
</component>
</bundle>

@ -29,15 +29,13 @@ public interface HistoryService {
*/
public static String CACHE_ENABLED_PROPERTY =
"net.java.sip.communicator.service.history.CACHE_ENABLED";
public static String CACHE_ENABLED = "true";
public static String CACHE_DISABLED = "false";
/**
* Returns the IDs of all existing histories.
*
* @return An iterator to a list of IDs.
*/
Iterator getExistingIDs();
Iterator<HistoryID> getExistingIDs();
/**
* Returns the history associated with this ID.

Loading…
Cancel
Save