Started work on the MetaContactList SLICK.

cusax-fix
Emil Ivov 20 years ago
parent acdf5b7bcb
commit d9439982f5

@ -397,7 +397,8 @@
bundle-history-slick,bundle-configuration-slick,bundle-netaddr, bundle-history-slick,bundle-configuration-slick,bundle-netaddr,
bundle-netaddr-slick,bundle-slickless,bundle-slick-runner,bundle-sip, bundle-netaddr-slick,bundle-slickless,bundle-slick-runner,bundle-sip,
bundle-fileaccess,bundle-fileaccess-slick,bundle-media, bundle-fileaccess,bundle-fileaccess-slick,bundle-media,
bundle-media-slick,bundle-icq,bundle-icq-slick,bundle-swing-ui"/> bundle-media-slick,bundle-icq,bundle-icq-slick,bundle-swing-ui,
meta-contactlist,meta-contactlist-slick"/>
<!--BUNDLE-HISTORY--> <!--BUNDLE-HISTORY-->
<target name="bundle-history" depends="rebuild"> <target name="bundle-history" depends="rebuild">
@ -617,6 +618,7 @@ javax.swing.event, javax.swing.border"/>
<!-- BUNDLE-SWING-UI --> <!-- BUNDLE-SWING-UI -->
<target name="bundle-swing-ui" depends="rebuild"> <target name="bundle-swing-ui" depends="rebuild">
<!-- Bundle sip-communicator's UI."-->
<jar compress="false" destfile="${bundles.dest}/swing-ui.jar" <jar compress="false" destfile="${bundles.dest}/swing-ui.jar"
manifest="src/net/java/sip/communicator/impl/gui/swing.ui.manifest.mf"> manifest="src/net/java/sip/communicator/impl/gui/swing.ui.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/service/gui" <zipfileset dir="${dest}/net/java/sip/communicator/service/gui"
@ -627,5 +629,27 @@ javax.swing.event, javax.swing.border"/>
</jar> </jar>
</target> </target>
<!-- BUNDLE-META-CONTACTLIST -->
<target name="meta-contactlist" depends="rebuild">
<!-- Creates the meta contact list bundle."-->
<jar compress="false" destfile="${bundles.dest}/meta-cl.jar"
manifest="src/net/java/sip/communicator/impl/contactlist/meta.cl.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/service/contactlist"
prefix="net/java/sip/communicator/service/contactlist"/>
<zipfileset dir="${dest}/net/java/sip/communicator/impl/contactlist"
prefix="net/java/sip/communicator/impl/contactlist"/>
</jar>
</target>
<!-- BUNDLE-META-CONTACTLIST-SLICK -->
<target name="meta-contactlist-slick" depends="rebuild">
<!-- Creates a bundle for the meta contact list SLICK."-->
<jar compress="false" destfile="${bundles.dest}/meta-cl-slick.jar"
manifest="test/net/java/sip/communicator/slick/contactlist/meta.cl.slick.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/slick/contactlist"
prefix="net/java/sip/communicator/slick/contactlist"/>
</jar>
</target>
</project> </project>

@ -51,7 +51,8 @@ oscar.auto.start.4= \
file:sc-bundles/fileaccess.jar \ file:sc-bundles/fileaccess.jar \
file:sc-bundles/history.jar \ file:sc-bundles/history.jar \
file:sc-bundles/protocol-icq.jar \ file:sc-bundles/protocol-icq.jar \
file:sc-bundles/media.jar file:sc-bundles/media.jar \
file:sc-bundles/meta-cl.jar
oscar.auto.start.5= \ oscar.auto.start.5= \
file:sc-bundles/slickless.jar \ file:sc-bundles/slickless.jar \
@ -60,7 +61,9 @@ oscar.auto.start.5= \
file:sc-bundles/netaddr-slick.jar \ file:sc-bundles/netaddr-slick.jar \
file:sc-bundles/fileaccess-slick.jar \ file:sc-bundles/fileaccess-slick.jar \
file:sc-bundles/history-slick.jar \ file:sc-bundles/history-slick.jar \
file:sc-bundles/protocol-icq-slick.jar file:sc-bundles/meta-cl-slick.jar \
file:sc-bundles/protocol-icq-slick.jar \
oscar.auto.start.100= \ oscar.auto.start.100= \
file:sc-bundles/slick-runner.jar file:sc-bundles/slick-runner.jar

@ -9,4 +9,5 @@ test.list=ConfigurationServiceLick \
FileAccessServiceLick \ FileAccessServiceLick \
HistoryServiceLick \ HistoryServiceLick \
SlicklessTests \ SlicklessTests \
IcqProtocolProviderSlick IcqProtocolProviderSlick \
MetaContactListServiceLick

@ -18,8 +18,6 @@
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.xml.*; import net.java.sip.communicator.util.xml.*;
/** /**
* A straight forward implementation of the ConfigurationService using an xml * A straight forward implementation of the ConfigurationService using an xml
* file for storing properties. Currently only String properties are * file for storing properties. Currently only String properties are

@ -0,0 +1,62 @@
/*
* 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.contactlist;
import org.osgi.framework.*;
import java.util.*;
import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.util.*;
/**
*
* @author Emil Ivov
*/
public class Activator
implements BundleActivator
{
private static final Logger logger =
Logger.getLogger(Activator.class);
ServiceRegistration mclServiceRegistration = null;
/**
* Called when this bundle is started.
*
* @param context The execution context of the bundle being started.
* @throws Exception If
*/
public void start(BundleContext context) throws Exception
{
logger.debug("Service Impl: " + getClass().getName() + " [ STARTED ]");
Hashtable hashtable = new Hashtable();
MetaContactListServiceImpl mclServiceImpl =
new MetaContactListServiceImpl();
//reg the icq account man.
mclServiceRegistration = context.registerService(
MetaContactListService.class.getName(),
mclServiceImpl,
hashtable);
logger.debug("Service Impl: " + getClass().getName() + " [REGISTERED]");
}
/**
* Called when this bundle is stopped so the Framework can perform the
* bundle-specific activities necessary to stop the bundle.
*
* @param context The execution context of the bundle being stopped.
* @throws Exception If this method throws an exception, the bundle is
* still marked as stopped, and the Framework will remove the bundle's
* listeners, unregister all services registered by the bundle, and
* release all services used by the bundle.
*/
public void stop(BundleContext context) throws Exception
{
}
}

@ -367,6 +367,15 @@ private void synchronizeOpSetWithServerContactList(
= new MetaContactGroupImpl(group.getGroupName()); = new MetaContactGroupImpl(group.getGroupName());
newMetaGroup.addProtoGroup(provider, group); newMetaGroup.addProtoGroup(provider, group);
Iterator contactsIter = group.contacts();
while(contactsIter.hasNext())
{
Contact contact = (Contact)contactsIter.next();
MetaContactImpl newMetaContact = new MetaContactImpl();
newMetaContact.addProtoContact(contact);
}
} }
} }
@ -431,12 +440,24 @@ public void serviceChanged(ServiceEvent event)
if(event.getType() == ServiceEvent.REGISTERED) if(event.getType() == ServiceEvent.REGISTERED)
{ {
this.handleProviderAdded((ProtocolProviderService)sService); //if we have the PROVIDER_MASK property set, make sure that this
//provider has it and if not ignore it.
String providerMask = System.getProperty(
MetaContactListService.PROVIDER_MASK_PROPERTY);
if(providerMask != null && providerMask.trim().length() > 0)
{
if (event.getServiceReference().getProperty(
MetaContactListService.PROVIDER_MASK_PROPERTY)
.equals(providerMask)){
return;
}
}
this.handleProviderAdded( (ProtocolProviderService)sService);
} }
else if(event.getType() == ServiceEvent.UNREGISTERING) else if(event.getType() == ServiceEvent.UNREGISTERING)
{ {
this.handleProviderRemoved((ProtocolProviderService)sService); this.handleProviderRemoved((ProtocolProviderService)sService);
} }
} }
} }

@ -0,0 +1,12 @@
Bundle-Activator: net.java.sip.communicator.impl.contactlist.Activator
Bundle-Name: MetaContactList
Bundle-Description: An implementation of the MetaContactList service.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
Export-Package: net.jata.sip.communicator.service.contactlist
Import-Package: org.osgi.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.configuration.event,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event

@ -33,18 +33,38 @@
* specific contacts. These protocol specific contacts may also be removed * specific contacts. These protocol specific contacts may also be removed
* away from a MetaContact. Whenever a MetaContact remains empty (i.e. all of * away from a MetaContact. Whenever a MetaContact remains empty (i.e. all of
* its protocol specific contacts are removed) it is automatically deleted. * its protocol specific contacts are removed) it is automatically deleted.
* * <p>
* Note that for most of the methods defined by this interface, it is likely * Note that for most of the methods defined by this interface, it is likely
* that implementations require one or more network operations to complete * that implementations require one or more network operations to complete
* before returning. It is therefore strongly advised not to call these methods * before returning. It is therefore strongly advised not to call these methods
* in event dispatching threads (watch out UI implementors ;) ) as this may lead * in event dispatching threads (watch out UI implementors ;) ) as this may lead
* to unpleasant user experience. * to unpleasant user experience.
* * <p>
* The MetaContactListService also defines a property named:<br>
* <tt>net.java.sip.communicator.service.contactlist.PROVIDER_MASK</tt><br>
* When this property is set, implementations of the MetaContactListService
* would only interact with protocol providers that same property set to the
* same value. This feature is mostly used during unit testing so that testing
* bundles could make sure that a tested meta contact list implementation would
* only load their mocking protocol provider implementations during the test
* run.
* <p>
* @todo expections * @todo expections
* @author Emil Ivov * @author Emil Ivov
*/ */
public interface MetaContactListService public interface MetaContactListService
{ {
/**
* This property is used to tell implementations of the
* MetaContactListService that they are to only interact with providers
* that have the same property set to the same value as the system one.
* This feature is mostly used during unit testing so that testing bundles
* could make sure that a tested meta contact list implementation would only
* load their mocking protocol provider implementations during the test run.
*/
public static String PROVIDER_MASK_PROPERTY =
"net.java.sip.communicator.service.contactlist.PROVIDER_MASK";
/** /**
* Returns the root <tt>MetaContactGroup</tt> in this contact list. * Returns the root <tt>MetaContactGroup</tt> in this contact list.
* All meta contacts and subgroups are children of the root meta contact * All meta contacts and subgroups are children of the root meta contact

@ -0,0 +1,53 @@
/*
* 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.slick.contactlist;
import junit.framework.*;
import org.osgi.framework.*;
import net.java.sip.communicator.util.*;
import java.util.*;
/**
*
* @author Emil Ivov
*/
public class MetaContactListServiceLick
extends TestSuite
implements BundleActivator
{
private static final Logger logger =
Logger.getLogger(MetaContactListServiceLick.class);
/**
* The bundle context that we get upon activation.
*/
protected static BundleContext bundleContext = null;
/**
*/
public void start(BundleContext context) throws Exception
{
this.bundleContext = context;
setName("MetaContactListServiceLick");
Hashtable properties = new Hashtable();
properties.put("service.pid", getName());
addTestSuite(TestMetaContactList.class);
bundleContext.registerService(getClass().getName(), this, properties);
logger.debug("Service " + getClass().getName() + " [REGISTERED]");
}
/**
*/
public void stop(BundleContext context) throws Exception
{
}
}

@ -0,0 +1,33 @@
package net.java.sip.communicator.slick.contactlist;
import junit.framework.*;
/**
* Test basic meta contact list functionality such as filling in the contact
* list from existing protocol provider implementations and others.
* @author Emil Ivov
*/
public class TestMetaContactList
extends TestCase
{
public TestMetaContactList(String name)
{
super(name);
}
protected void setUp() throws Exception
{
super.setUp();
}
protected void tearDown() throws Exception
{
super.tearDown();
}
public void testContactListRetrieving()
{
System.out.println("-= DUPE =-");
}
}

@ -0,0 +1,13 @@
Bundle-Activator: net.java.sip.communicator.slick.contactlist.MetaContactListServiceLick
Bundle-Name: MetaContactListServiceLick
Bundle-Description: An SLI compatibility kit for the MetaContactList service.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
Import-Package: net.jata.sip.communicator.service.contactlist,
org.osgi.framework,
junit.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.service.configuration,
net.java.sip.communicator.service.configuration.event,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event
Loading…
Cancel
Save