diff --git a/build.xml b/build.xml index 430adaee1..ffabf69a4 100644 --- a/build.xml +++ b/build.xml @@ -139,6 +139,10 @@ + + + + @@ -569,12 +573,78 @@ - - + + + + + + + + + + + + + + + + + + + + This target can only run inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1631,6 +1701,22 @@ javax.swing.event, javax.swing.border"/> prefix="net/java/sip/communicator/plugin/autoaway" /> + + + + + + + + + + + + + diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath index a6c9a9c3f..b2f80895e 100644 --- a/ide/eclipse/.classpath +++ b/ide/eclipse/.classpath @@ -53,5 +53,6 @@ + diff --git a/lib/felix.client.run.properties b/lib/felix.client.run.properties index 4eb16073c..33cb052e6 100644 --- a/lib/felix.client.run.properties +++ b/lib/felix.client.run.properties @@ -149,6 +149,8 @@ felix.auto.start.67= \ reference:file:sc-bundles/generalconfig.jar \ reference:file:sc-bundles/dictaccregwizz.jar +#level 68 is for profiler, don't use it or change the build.xml file accordingly + felix.auto.start.70= \ reference:file:sc-bundles/simpleaccreg.jar diff --git a/lib/installer-exclude/jcommon-1.0.0.jar b/lib/installer-exclude/jcommon-1.0.0.jar new file mode 100644 index 000000000..c5d23f4ae Binary files /dev/null and b/lib/installer-exclude/jcommon-1.0.0.jar differ diff --git a/lib/installer-exclude/jfreechart-1.0.1.jar b/lib/installer-exclude/jfreechart-1.0.1.jar new file mode 100644 index 000000000..6a015249b Binary files /dev/null and b/lib/installer-exclude/jfreechart-1.0.1.jar differ diff --git a/lib/installer-exclude/p4j-exclusions.txt b/lib/installer-exclude/p4j-exclusions.txt new file mode 100644 index 000000000..a81183f8b --- /dev/null +++ b/lib/installer-exclude/p4j-exclusions.txt @@ -0,0 +1,25 @@ +# +# This file lists those classes that should be ignored by +# the agent during instrumentation. In most cases these +# classes trigger JVM internal errors and should be simply +# ignored. Notice that some classes are ignored even if +# not listed here (they may cause your JVM to crash +# seriously so I hard-coded exclusions for those within +# the agent) +# +# The agent will ignore all classes STARTING WITH the string +# indicated. So, you can exclude a whole package by ending +# with '.' +# + +org.apache.tomcat.jni.OS +org.jboss.util.xml.DOMWriter +org.jboss.mq.il.uil2.ServerSocketManagerHandler +org.hsqldb.jdbc.jdbcConnection +org.hsqldb.Index +bsh.ParserTokenManager +org.eclipse.jdt.internal.compiler.lookup.TypeBinding +org.eclipse.jdt.internal.compiler.ast.Expression +org.eclipse.jdt.internal.compiler.problem.ProblemReporter +org.eclipse.jdt.internal.compiler.impl.Constant +com.arjuna.ats.internal.arjuna.objectstore.ShadowingStore \ No newline at end of file diff --git a/lib/installer-exclude/profiler4j-1.0-beta3-SC.jar b/lib/installer-exclude/profiler4j-1.0-beta3-SC.jar new file mode 100644 index 000000000..3e38fe3df Binary files /dev/null and b/lib/installer-exclude/profiler4j-1.0-beta3-SC.jar differ diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index 4c70edb66..dbaf7a7d7 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -721,3 +721,6 @@ sasPeerUnsuportedTooltip=Securing call not supported/enabled by the other peer peerToggledOffSecurityMessage=Call peer toggled secure mode off peerToggledOffSecurityCaption=Secure Off sasUnsecuredAtPeerRequestTooltip=Call unsecured at peer request + +# Profiler4J +profiler=Profiler4j \ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/profiler4j/ProfilerActivator.java b/src/net/java/sip/communicator/plugin/profiler4j/ProfilerActivator.java new file mode 100644 index 000000000..c4c9fd90f --- /dev/null +++ b/src/net/java/sip/communicator/plugin/profiler4j/ProfilerActivator.java @@ -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.plugin.profiler4j; + +import java.util.*; +import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.util.*; +import org.osgi.framework.*; + +/** + * Activates the profiler plug-in. + * + * @author Vladimir Škarupelov + */ +public class ProfilerActivator implements BundleActivator { + + public static BundleContext bundleContext; + + Logger logger = Logger.getLogger(ProfilerActivator.class); + + private ServiceRegistration menuRegistration = null; + + public void start(BundleContext bc) throws Exception { + bundleContext = bc; + + SettingsWindowMenuEntry menuEntry = new SettingsWindowMenuEntry( + Container.CONTAINER_TOOLS_MENU); + + Hashtable toolsMenuFilter = + new Hashtable(); + toolsMenuFilter.put(Container.CONTAINER_ID, + Container.CONTAINER_TOOLS_MENU.getID()); + + menuRegistration = bc.registerService(PluginComponent.class + .getName(), menuEntry, toolsMenuFilter); + + logger.info("PROFILER4J [REGISTERED]"); + + } + + public void stop(BundleContext bc) throws Exception { + if (menuRegistration != null) + { + menuRegistration.unregister(); + logger.info("PROFILER4J [UNREGISTERED]"); + } + } + +} diff --git a/src/net/java/sip/communicator/plugin/profiler4j/Resources.java b/src/net/java/sip/communicator/plugin/profiler4j/Resources.java new file mode 100644 index 000000000..3af86eee3 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/profiler4j/Resources.java @@ -0,0 +1,52 @@ +/* + * 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.plugin.profiler4j; + +import java.util.*; +import org.osgi.framework.*; +import net.java.sip.communicator.service.resources.*; + +/** + * The Messages class manages the access to the internationalization properties + * files. + * + * @author Vladimir Škarupelov; + */ +public class Resources +{ + private static ResourceManagementService resourcesService = null; + + /** + * Returns an internationalized string corresponding to the given key. + * + * @param key The key of the string. + * @return An internationalized string corresponding to the given key. + */ + public static String getString(String key) + { + return getResources().getI18NString(key); + } + + public static ResourceManagementService getResources() + { + if (resourcesService == null) + { + ServiceReference serviceReference = ProfilerActivator.bundleContext + .getServiceReference(ResourceManagementService.class.getName()); + + if (serviceReference == null) { + return null; + } + + resourcesService = + (ResourceManagementService) ProfilerActivator.bundleContext + .getService(serviceReference); + } + + return resourcesService; + } +} diff --git a/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java b/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java new file mode 100644 index 000000000..120d6cd30 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java @@ -0,0 +1,85 @@ +/* + * 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.plugin.profiler4j; + +/** + * Menu entry for the profiler plug-in + * + * @author Vladimir Å karupelov + */ +import java.awt.event.*; +import javax.swing.*; +import net.java.sip.communicator.service.contactlist.*; +import net.java.sip.communicator.service.gui.*; +import net.sf.profiler4j.console.*; + +public class SettingsWindowMenuEntry implements PluginComponent +{ + private static final String PROFILER_NAME = "profiler"; + private JMenuItem settingsMenuEntry; + private Container container; + + public SettingsWindowMenuEntry(Container container) + { + settingsMenuEntry = new JMenuItem(Resources.getString( PROFILER_NAME )); + settingsMenuEntry.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + Prefs prefs = new Prefs(); + + System.setProperty("swing.aatext", + String.valueOf(prefs.isAntialiasing())); + + final Console app = new Console(prefs); + app.connect(); + MainFrame f = new MainFrame(app); + app.setMainFrame(f); + f.pack(); + f.setVisible(true); + } + }); + this.container = container; + } + + public Object getComponent() + { + return settingsMenuEntry; + } + + public String getConstraints() + { + return null; + } + + public Container getContainer() + { + return container; + } + + public String getName() + { + return Resources.getString( PROFILER_NAME ); + } + + public void setCurrentContact(MetaContact metaContact) + { + } + + public void setCurrentContactGroup(MetaContactGroup metaGroup) + { + } + + public int getPositionIndex() + { + return -1; + } + + public boolean isNativeComponent() { + return false; + } +} diff --git a/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf b/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf new file mode 100644 index 000000000..fdc32da98 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf @@ -0,0 +1,21 @@ +Bundle-Activator: net.java.sip.communicator.plugin.profiler4j.ProfilerActivator +Bundle-Name: Integrated profiler plugin +Bundle-Description: A bundle that provides profile cpu and memory of the running app. +Bundle-Vendor: sip-communicator.org +Bundle-Version: 0.0.1 +Import-Package: org.osgi.framework, + net.java.sip.communicator.util, + net.java.sip.communicator.service.contactlist, + net.java.sip.communicator.service.gui, + net.java.sip.communicator.service.resources, + javax.swing, + javax.swing.filechooser, + javax.swing.tree, + javax.swing.event, + javax.swing.border, + javax.swing.table, + javax.swing.text, + javax.xml.parsers, + org.xml.sax, + org.xml.sax.ext, + org.xml.sax.helpers \ No newline at end of file