Remove the bundle audionotifier because its functionality has already been replaced by the bundle neomedia.

cusax-fix
Lyubomir Marinov 15 years ago
parent 63091bd18a
commit edab91d34a

@ -906,7 +906,7 @@
bundle-httpcore,bundle-httpclient,
bundle-version,bundle-version-impl,bundle-shutdown-timeout,
bundle-growlnotification,bundle-swingnotification,bundle-galagonotification,
bundle-sparkle, bundle-plugin-branding, bundle-audionotifier,
bundle-sparkle, bundle-plugin-branding,
bundle-osdependent,bundle-browserlauncher,bundle-gibberish,
bundle-gibberish-slick,bundle-plugin-gibberishaccregwizz,
bundle-rss, bundle-rss-slick,bundle-plugin-rssaccregwizz,
@ -1734,18 +1734,6 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
<!--BUNDLE-AUDIO NOTIFIER-->
<target name="bundle-audionotifier">
<!-- Creates a bundle for the audio notifier service.-->
<jar compress="false" destfile="${bundles.dest}/audionotifier.jar"
manifest="${src}/net/java/sip/communicator/impl/audionotifier/audionotifier.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/service/audionotifier"
prefix="net/java/sip/communicator/service/audionotifier"/>
<zipfileset dir="${dest}/net/java/sip/communicator/impl/audionotifier"
prefix="net/java/sip/communicator/impl/audionotifier" />
</jar>
</target>
<!-- BUNDLE-PLUGIN-EXAMPLE PLUGIN -->
<target name="bundle-plugin-exampleplugin">
<!-- Creates a bundle for the plugin SIP Account Registration Wizard.-->

@ -96,7 +96,6 @@ felix.auto.start.60= \
reference:file:sc-bundles/callhistory.jar \
reference:file:sc-bundles/filehistory.jar \
reference:file:sc-bundles/metahistory.jar \
reference:file:sc-bundles/audionotifier.jar \
reference:file:sc-bundles/keybindings.jar \
reference:file:sc-bundles/notification.jar \
reference:file:sc-bundles/contactsource.jar

@ -1,115 +0,0 @@
/*
* 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.audionotifier;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/**
* The AudioNotifier activator class.
*
* @author Yana Stamcheva
*/
public class AudioNotifierActivator implements BundleActivator
{
private AudioNotifierServiceImpl audioNotifier;
private ConfigurationService configService;
private static ResourceManagementService resourcesService;
/**
* A currently valid bundle context.
*/
public static BundleContext bundleContext;
private static final Logger logger
= Logger.getLogger(AudioNotifierActivator.class);
/**
* Called when this bundle is started.
*
* @param bContext The execution context of the bundle being started.
*/
public void start(BundleContext bContext) throws Exception
{
// this service is deprecated, will leave it for now
// we suspect that even we remove it from starting
// felix starts the version it has in its cache
// try {
// AudioNotifierActivator.bundleContext = bContext;
//
// //Create the audio notifier service
// audioNotifier = new AudioNotifierServiceImpl();
//
// ServiceReference configReference = bundleContext
// .getServiceReference(ConfigurationService.class.getName());
//
// configService = (ConfigurationService) bundleContext
// .getService(configReference);
//
// audioNotifier.setMute(
// !configService
// .getBoolean(
// "net.java.sip.communicator.impl.sound.isSoundEnabled",
// true));
//
// logger.logEntry();
//
// logger.info("Audio Notifier Service...[ STARTED ]");
//
// bundleContext
// .registerService(
// AudioNotifierService.class.getName(),
// audioNotifier,
// null);
//
// logger.info("Audio Notifier Service ...[REGISTERED]");
//
// } finally {
// logger.logExit();
// }
}
/**
* Called when this bundle is stopped so the Framework can perform the
* bundle-specific activities necessary to stop the bundle.
*
* @param bContext 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 bContext) throws Exception
{
// deprecated
// try {
// configService.setProperty(
// "net.java.sip.communicator.impl.sound.isSoundEnabled",
// Boolean.toString(!audioNotifier.isMute()));
//
// }
// catch (PropertyVetoException e1) {
// logger.error("The proposed property change "
// + "represents an unacceptable value");
// }
//
// logger.info("AudioNotifier Service ...[STOPPED]");
}
public static ResourceManagementService getResources()
{
if (resourcesService == null)
resourcesService
= ResourceManagementServiceUtils.getService(bundleContext);
return resourcesService;
}
}

@ -1,122 +0,0 @@
/*
* 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.audionotifier;
import java.net.*;
import java.util.*;
import net.java.sip.communicator.service.audionotifier.*;
/**
* The implementation of the AudioNotifierService.
*
* @author Yana Stamcheva
*/
public class AudioNotifierServiceImpl
implements AudioNotifierService
{
private static final Map<String, SCAudioClipImpl> audioClips =
new HashMap<String, SCAudioClipImpl>();
private boolean isMute;
/**
* Creates an SCAudioClip from the given URI and adds it to the list of
* available audio-s.
*
* @param uri the path where the audio file could be found
*/
public SCAudioClip createAudio(String uri)
{
SCAudioClipImpl audioClip;
synchronized (audioClips)
{
if(audioClips.containsKey(uri))
{
audioClip = audioClips.get(uri);
}
else
{
URL url =
AudioNotifierActivator.getResources().getSoundURLForPath(uri);
if (url == null)
{
// Not found by the class loader. Perhaps it's a local file.
try
{
url = new URL(uri);
}
catch (MalformedURLException e)
{
//logger.error("The given uri could not be parsed.", e);
return null;
}
}
try
{
audioClip = new SCAudioClipImpl(url, this);
}
catch (Throwable e)
{
// Cannot create audio to play
return null;
}
audioClips.put(uri, audioClip);
}
}
return audioClip;
}
/**
* Removes the given audio from the list of available audio clips.
*
* @param audioClip the audio to destroy
*/
public void destroyAudio(SCAudioClip audioClip)
{
synchronized (audioClips) {
audioClips.remove(audioClip);
}
}
/**
* Enables or disables the sound in the application. If FALSE, we try to
* restore all looping sounds if any.
*
* @param isMute when TRUE disables the sound, otherwise enables the sound.
*/
public void setMute(boolean isMute)
{
this.isMute = isMute;
for (SCAudioClipImpl audioClip : audioClips.values())
{
if (isMute)
{
audioClip.internalStop();
}
else if (audioClip.isLooping())
{
audioClip.playInLoop(audioClip.getLoopInterval());
}
}
}
/**
* Returns TRUE if the sound is currently disabled, FALSE otherwise.
* @return TRUE if the sound is currently disabled, FALSE otherwise
*/
public boolean isMute()
{
return isMute;
}
}

@ -1,241 +0,0 @@
/*
* 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.audionotifier;
import java.applet.*;
import java.awt.event.*;
import java.io.*;
import java.lang.reflect.*;
import java.net.*;
import java.security.*;
import javax.swing.*;
import net.java.sip.communicator.service.audionotifier.*;
/**
* Implementation of SCAudioClip.
*
* @author Yana Stamcheva
*/
public class SCAudioClipImpl
implements SCAudioClip,
ActionListener
{
private static Constructor<AudioClip> acConstructor = null;
private final Timer playAudioTimer = new Timer(1000, null);
private final AudioClip audioClip;
private boolean isInvalid;
private boolean isLooping;
private int loopInterval;
private final AudioNotifierService audioNotifier;
/**
* Creates the audio clip and initialize the listener used from the
* loop timer.
*
* @param url the url pointing to the audio file
*/
public SCAudioClipImpl(URL url, AudioNotifierService audioNotifier)
throws IOException
{
this.audioClip = createAppletAudioClip(url.openStream());
this.audioNotifier = audioNotifier;
this.playAudioTimer.addActionListener(this);
}
/**
* Plays this audio.
*/
public void play()
{
if ((audioClip != null) && !audioNotifier.isMute())
audioClip.play();
}
/**
* Plays this audio in loop.
*
* @param interval the loop interval
*/
public void playInLoop(int interval)
{
if ((audioClip != null) && !audioNotifier.isMute())
{
if (interval == 0)
audioClip.loop();
else
{
//first play the audio and then start the timer and wait
audioClip.play();
playAudioTimer.setDelay(interval);
playAudioTimer.setRepeats(true);
playAudioTimer.start();
}
}
this.loopInterval = interval;
this.isLooping = true;
}
/**
* Stops this audio.
*/
public void stop()
{
if (audioClip != null)
audioClip.stop();
if (isLooping)
{
playAudioTimer.stop();
this.isLooping = false;
}
}
/**
* Stops this audio without setting the isLooping property in the case of
* a looping audio. The AudioNotifier uses this method to stop the audio
* when setMute(true) is invoked. This allows us to restore all looping
* audios when the sound is restored by calling setMute(false).
*/
public void internalStop()
{
if (audioClip != null)
audioClip.stop();
if (isLooping)
playAudioTimer.stop();
}
/**
* Creates an AppletAudioClip.
*
* @param inputstream the audio input stream
* @throws IOException
*/
private static AudioClip createAppletAudioClip(InputStream inputstream)
throws IOException
{
if (acConstructor == null)
{
try
{
acConstructor
= AccessController.doPrivileged(
new PrivilegedExceptionAction<Constructor<AudioClip>>()
{
public Constructor<AudioClip> run()
throws ClassNotFoundException,
NoSuchMethodException,
SecurityException
{
return createAcConstructor();
}
});
}
catch (PrivilegedActionException paex)
{
throw
new IOException(
"Failed to get AudioClip constructor: "
+ paex.getException());
}
}
try
{
return acConstructor.newInstance(inputstream);
}
catch (Exception ex)
{
throw new IOException("Failed to construct the AudioClip: " + ex);
}
}
@SuppressWarnings("unchecked")
private static Constructor<AudioClip> createAcConstructor()
throws ClassNotFoundException,
NoSuchMethodException,
SecurityException
{
Class<?> class1;
try
{
class1
= Class.forName(
"com.sun.media.sound.JavaSoundAudioClip",
true,
ClassLoader.getSystemClassLoader());
}
catch (ClassNotFoundException cnfex)
{
class1
= Class.forName("sun.audio.SunAudioClip", true, null);
}
return
(Constructor<AudioClip>) class1.getConstructor(InputStream.class);
}
/**
* Plays an audio clip. Used in the playAudioTimer to play an audio in loop.
*/
public void actionPerformed(ActionEvent e)
{
if (audioClip != null)
{
audioClip.stop();
audioClip.play();
}
}
/**
* Returns TRUE if this audio is invalid, FALSE otherwise.
*
* @return TRUE if this audio is invalid, FALSE otherwise
*/
public boolean isInvalid()
{
return isInvalid;
}
/**
* Marks this audio as invalid or not.
*
* @param isInvalid TRUE to mark this audio as invalid, FALSE otherwise
*/
public void setInvalid(boolean isInvalid)
{
this.isInvalid = isInvalid;
}
/**
* Returns TRUE if this audio is currently playing in loop, FALSE otherwise.
* @return TRUE if this audio is currently playing in loop, FALSE otherwise.
*/
public boolean isLooping()
{
return isLooping;
}
/**
* Returns the loop interval if this audio is looping.
* @return the loop interval if this audio is looping
*/
public int getLoopInterval()
{
return loopInterval;
}
}

@ -1,13 +0,0 @@
Bundle-Activator: net.java.sip.communicator.impl.audionotifier.AudioNotifierActivator
Bundle-Name: Audio Notifier
Bundle-Description: An implementation of the AudioNotifier service.
Bundle-Vendor: sip-communicator.org
Bundle-Version: 0.0.1
System-Bundle: yes
Export-Package: net.java.sip.communicator.service.audionotifier
Import-Package: org.osgi.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.service.audionotifier,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.configuration,
javax.swing
Loading…
Cancel
Save