Moves dns config as plugin.

cusax-fix
Damian Minkov 13 years ago
parent c89ef5ecd7
commit d85567ad14

@ -903,7 +903,8 @@
<!-- - - - - - - - - - - - - - BUNDLE BUILDING TARGETS - - - - - - - - --> <!-- - - - - - - - - - - - - - BUNDLE BUILDING TARGETS - - - - - - - - -->
<!--ALL BUNDLES--> <!--ALL BUNDLES-->
<target name="bundles" <target name="bundles"
depends="bundle-sc-launcher,bundle-util,bundle-service-dns,bundle-impl-dns, depends="bundle-sc-launcher,bundle-util,bundle-service-dns,
bundle-impl-dns,bundle-dns-config,
bundle-configuration,bundle-configuration-slick, bundle-configuration,bundle-configuration-slick,
bundle-history,bundle-history-slick,bundle-messagehistory, bundle-msghistory-slick, bundle-history,bundle-history-slick,bundle-messagehistory, bundle-msghistory-slick,
bundle-callhistory, bundle-callhistory-slick, bundle-popupmessagehandler-slick, bundle-callhistory, bundle-callhistory-slick, bundle-popupmessagehandler-slick,
@ -1091,6 +1092,15 @@
prefix="net/java/sip/communicator/impl/dns"/> prefix="net/java/sip/communicator/impl/dns"/>
</jar> </jar>
</target> </target>
<!--BUNDLE-DNS-CONFIG-->
<target name="bundle-dns-config">
<!-- Create the dnsconfig.jar-->
<jar compress="true" destfile="${bundles.dest}/dnsconfig.jar"
manifest="${src}/net/java/sip/communicator/plugin/dnsconfig/dnsconfig.manifest.mf">
<zipfileset dir="${dest}/net/java/sip/communicator/plugin/dnsconfig"
prefix="net/java/sip/communicator/plugin/dnsconfig"/>
</jar>
</target>
<!--BUNDLE-CONFIGURATION--> <!--BUNDLE-CONFIGURATION-->
<target name="bundle-configuration"> <target name="bundle-configuration">

@ -55,7 +55,8 @@ felix.auto.start.31= \
reference:file:sc-bundles/notification-service.jar reference:file:sc-bundles/notification-service.jar
felix.auto.start.32= \ felix.auto.start.32= \
reference:file:sc-bundles/dns.jar reference:file:sc-bundles/dns.jar \
reference:file:sc-bundles/dnsconfig.jar
felix.auto.start.35= \ felix.auto.start.35= \
reference:file:sc-bundles/commons-codec.jar \ reference:file:sc-bundles/commons-codec.jar \

@ -6,7 +6,6 @@
*/ */
package net.java.sip.communicator.impl.dns; package net.java.sip.communicator.impl.dns;
import net.java.sip.communicator.impl.dns.dnsconfig.*;
import net.java.sip.communicator.service.dns.*; import net.java.sip.communicator.service.dns.*;
import net.java.sip.communicator.service.netaddr.*; import net.java.sip.communicator.service.netaddr.*;
import net.java.sip.communicator.service.netaddr.event.*; import net.java.sip.communicator.service.netaddr.event.*;
@ -45,7 +44,6 @@ public class DnsUtilActivator
private static NotificationService notificationService; private static NotificationService notificationService;
private static ResourceManagementService resourceService; private static ResourceManagementService resourceService;
private static BundleContext bundleContext; private static BundleContext bundleContext;
private static DnsConfigActivator dnsConfigActivator;
/** /**
* The address of the backup resolver we would use by default. * The address of the backup resolver we would use by default.
@ -130,8 +128,6 @@ public void start(BundleContext context)
logger.info("DnssecResolver ... [REGISTERED]"); logger.info("DnssecResolver ... [REGISTERED]");
} }
dnsConfigActivator = new DnsConfigActivator();
dnsConfigActivator.start(context);
logger.info("DNS service ... [STARTED]"); logger.info("DNS service ... [STARTED]");
} }
@ -208,8 +204,6 @@ public static void reloadDnsResolverConfig()
public void stop(BundleContext context) public void stop(BundleContext context)
throws Exception throws Exception
{ {
if (dnsConfigActivator != null)
dnsConfigActivator.stop(context);
} }
/** /**

@ -4,7 +4,7 @@
* Distributable under LGPL license. * Distributable under LGPL license.
* See terms of license at gnu.org. * See terms of license at gnu.org.
*/ */
package net.java.sip.communicator.impl.dns.dnsconfig; package net.java.sip.communicator.plugin.dnsconfig;
import java.util.*; import java.util.*;

@ -1,59 +1,59 @@
/* /*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client. * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
* *
* Distributable under LGPL license. * Distributable under LGPL license.
* See terms of license at gnu.org. * See terms of license at gnu.org.
*/ */
package net.java.sip.communicator.impl.dns.dnsconfig; package net.java.sip.communicator.plugin.dnsconfig;
import net.java.sip.communicator.plugin.desktoputil.*; import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import org.jitsi.service.resources.*; import org.jitsi.service.resources.*;
import org.osgi.framework.*; import org.osgi.framework.*;
/** /**
* Container for all DNS configuration panels. * Container for all DNS configuration panels.
* *
* @author Ingo Bauersachs * @author Ingo Bauersachs
*/ */
public class DnsContainerPanel public class DnsContainerPanel
extends SIPCommTabbedPane extends SIPCommTabbedPane
{ {
/** /**
* Serial version UID. * Serial version UID.
*/ */
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
//service references //service references
private ResourceManagementService R; private ResourceManagementService R;
//panels //panels
private ParallelDnsPanel parallelDnsPanel; private ParallelDnsPanel parallelDnsPanel;
private DnssecPanel dnssecPanel; private DnssecPanel dnssecPanel;
/** /**
* Creates a new instance of this class. Loads all panels. * Creates a new instance of this class. Loads all panels.
*/ */
public DnsContainerPanel() public DnsContainerPanel()
{ {
initServices(); initServices();
parallelDnsPanel = new ParallelDnsPanel(); parallelDnsPanel = new ParallelDnsPanel();
addTab(R.getI18NString("plugin.dnsconfig.PARALLEL_DNS"), addTab(R.getI18NString("plugin.dnsconfig.PARALLEL_DNS"),
parallelDnsPanel); parallelDnsPanel);
dnssecPanel = new DnssecPanel(parallelDnsPanel); dnssecPanel = new DnssecPanel(parallelDnsPanel);
addTab(R.getI18NString("plugin.dnsconfig.DNSSEC"), addTab(R.getI18NString("plugin.dnsconfig.DNSSEC"),
dnssecPanel); dnssecPanel);
} }
/** /**
* Loads all service references * Loads all service references
*/ */
private void initServices() private void initServices()
{ {
BundleContext bc = DnsConfigActivator.bundleContext; BundleContext bc = DnsConfigActivator.bundleContext;
R = ServiceUtils.getService(bc, ResourceManagementService.class); R = ServiceUtils.getService(bc, ResourceManagementService.class);
} }
} }

@ -1,350 +1,350 @@
/* /*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client. * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
* *
* Distributable under LGPL license. * Distributable under LGPL license.
* See terms of license at gnu.org. * See terms of license at gnu.org.
*/ */
package net.java.sip.communicator.impl.dns.dnsconfig; package net.java.sip.communicator.plugin.dnsconfig;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.io.*; import java.io.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.basic.*; import javax.swing.plaf.basic.*;
import javax.swing.table.*; import javax.swing.table.*;
import net.java.sip.communicator.impl.dns.*; import net.java.sip.communicator.impl.dns.*;
import net.java.sip.communicator.plugin.desktoputil.*; import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.service.dns.*; import net.java.sip.communicator.service.dns.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import org.jitsi.service.configuration.*; import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*; import org.jitsi.service.resources.*;
import org.osgi.framework.*; import org.osgi.framework.*;
/** /**
* Configuration of the DNSSEC validating resolver. * Configuration of the DNSSEC validating resolver.
* *
* @author Ingo Bauersachs * @author Ingo Bauersachs
*/ */
public class DnssecPanel public class DnssecPanel
extends TransparentPanel extends TransparentPanel
implements ActionListener, FocusListener implements ActionListener, FocusListener
{ {
/** /**
* Serial version UID. * Serial version UID.
*/ */
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
private final static Logger logger = Logger.getLogger(DnssecPanel.class); private final static Logger logger = Logger.getLogger(DnssecPanel.class);
//UI Controls //UI Controls
private JComboBox cboDefault; private JComboBox cboDefault;
private JCheckBox chkEnabled; private JCheckBox chkEnabled;
private JCheckBox chkAbsolute; private JCheckBox chkAbsolute;
private JTable tblDomains; private JTable tblDomains;
private JTextField txtNameservers; private JTextField txtNameservers;
//service references //service references
private ResourceManagementService R; private ResourceManagementService R;
private ConfigurationService config; private ConfigurationService config;
private TableModel data = new DnssecTableModel(); private TableModel data = new DnssecTableModel();
private final ParallelDnsPanel parallelDnsPanel; private final ParallelDnsPanel parallelDnsPanel;
/** /**
* Create a new instance of this class. * Create a new instance of this class.
* @param parallelDnsPanel the panel configuring the parallel resolver * @param parallelDnsPanel the panel configuring the parallel resolver
*/ */
public DnssecPanel(ParallelDnsPanel parallelDnsPanel) public DnssecPanel(ParallelDnsPanel parallelDnsPanel)
{ {
this.parallelDnsPanel = parallelDnsPanel; this.parallelDnsPanel = parallelDnsPanel;
initServices(); initServices();
initComponents(); initComponents();
loadData(); loadData();
updateState(); updateState();
chkAbsolute.addActionListener(this); chkAbsolute.addActionListener(this);
chkEnabled.addActionListener(this); chkEnabled.addActionListener(this);
cboDefault.addActionListener(this); cboDefault.addActionListener(this);
txtNameservers.addFocusListener(this); txtNameservers.addFocusListener(this);
} }
/** /**
* Loads all service references * Loads all service references
*/ */
private void initServices() private void initServices()
{ {
BundleContext bc = DnsConfigActivator.bundleContext; BundleContext bc = DnsConfigActivator.bundleContext;
R = ServiceUtils.getService(bc, ResourceManagementService.class); R = ServiceUtils.getService(bc, ResourceManagementService.class);
config = ServiceUtils.getService(bc, ConfigurationService.class); config = ServiceUtils.getService(bc, ConfigurationService.class);
} }
/** /**
* Create the UI components * Create the UI components
*/ */
private void initComponents() private void initComponents()
{ {
setLayout(new BorderLayout(0, 10)); setLayout(new BorderLayout(0, 10));
setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0)); setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 0));
JPanel pnlCommon = new TransparentPanel(new GridBagLayout()); JPanel pnlCommon = new TransparentPanel(new GridBagLayout());
pnlCommon.setAlignmentX(LEFT_ALIGNMENT); pnlCommon.setAlignmentX(LEFT_ALIGNMENT);
GridBagConstraints cl = new GridBagConstraints(); GridBagConstraints cl = new GridBagConstraints();
GridBagConstraints cr = new GridBagConstraints(); GridBagConstraints cr = new GridBagConstraints();
cl.gridy = cr.gridy = 0; cl.gridy = cr.gridy = 0;
cl.anchor = cr.anchor = GridBagConstraints.LINE_START; cl.anchor = cr.anchor = GridBagConstraints.LINE_START;
cl.gridx = 0; cl.gridx = 0;
cl.fill = GridBagConstraints.HORIZONTAL; cl.fill = GridBagConstraints.HORIZONTAL;
cl.weightx = 0; cl.weightx = 0;
cl.insets = new Insets(0, 0, 0, 10); cl.insets = new Insets(0, 0, 0, 10);
cr.gridx = 1; cr.gridx = 1;
cr.fill = GridBagConstraints.HORIZONTAL; cr.fill = GridBagConstraints.HORIZONTAL;
cr.gridwidth = GridBagConstraints.REMAINDER; cr.gridwidth = GridBagConstraints.REMAINDER;
cr.weightx = 1; cr.weightx = 1;
add(pnlCommon, BorderLayout.NORTH); add(pnlCommon, BorderLayout.NORTH);
//always use absolute names //always use absolute names
chkAbsolute = new SIPCommCheckBox( chkAbsolute = new SIPCommCheckBox(
R.getI18NString("plugin.dnsconfig.dnssec.chkAbsolute")); R.getI18NString("plugin.dnsconfig.dnssec.chkAbsolute"));
cl.gridwidth = 2; cl.gridwidth = 2;
pnlCommon.add(chkAbsolute, cl); pnlCommon.add(chkAbsolute, cl);
cl.gridwidth = 1; cl.gridwidth = 1;
//dnssec enable/disable //dnssec enable/disable
cl.gridy = ++cr.gridy; cl.gridy = ++cr.gridy;
chkEnabled = new SIPCommCheckBox( chkEnabled = new SIPCommCheckBox(
R.getI18NString("plugin.dnsconfig.dnssec.chkEnabled")); R.getI18NString("plugin.dnsconfig.dnssec.chkEnabled"));
cl.gridwidth = 2; cl.gridwidth = 2;
pnlCommon.add(chkEnabled, cl); pnlCommon.add(chkEnabled, cl);
cl.gridwidth = 1; cl.gridwidth = 1;
cl.gridy = ++cr.gridy; cl.gridy = ++cr.gridy;
JLabel lblRestart = new JLabel( JLabel lblRestart = new JLabel(
R.getI18NString("plugin.dnsconfig.dnssec.RESTART_WARNING", R.getI18NString("plugin.dnsconfig.dnssec.RESTART_WARNING",
new String[]{ new String[]{
R.getSettingsString("service.gui.APPLICATION_NAME") R.getSettingsString("service.gui.APPLICATION_NAME")
})); }));
lblRestart.setBorder(BorderFactory.createEmptyBorder(0, 22, 10, 0)); lblRestart.setBorder(BorderFactory.createEmptyBorder(0, 22, 10, 0));
cl.gridwidth = GridBagConstraints.REMAINDER; cl.gridwidth = GridBagConstraints.REMAINDER;
pnlCommon.add(lblRestart, cl); pnlCommon.add(lblRestart, cl);
cl.gridwidth = 1; cl.gridwidth = 1;
//custom nameservers //custom nameservers
cl.gridy = ++cr.gridy; cl.gridy = ++cr.gridy;
JLabel lblNameserver = new JLabel( JLabel lblNameserver = new JLabel(
R.getI18NString("plugin.dnsconfig.dnssec.lblNameservers")); R.getI18NString("plugin.dnsconfig.dnssec.lblNameservers"));
lblNameserver.setBorder(BorderFactory.createEmptyBorder(0, 22, 0, 0)); lblNameserver.setBorder(BorderFactory.createEmptyBorder(0, 22, 0, 0));
pnlCommon.add(lblNameserver, cl); pnlCommon.add(lblNameserver, cl);
txtNameservers = new JTextField(); txtNameservers = new JTextField();
pnlCommon.add(txtNameservers, cr); pnlCommon.add(txtNameservers, cr);
cl.gridy = ++cr.gridy; cl.gridy = ++cr.gridy;
JLabel lblNsHint = new JLabel( JLabel lblNsHint = new JLabel(
R.getI18NString("plugin.dnsconfig.dnssec.lblNameserversHint")); R.getI18NString("plugin.dnsconfig.dnssec.lblNameserversHint"));
lblNsHint.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); lblNsHint.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
pnlCommon.add(lblNsHint, cr); pnlCommon.add(lblNsHint, cr);
//default dnssec handling //default dnssec handling
cl.gridy = ++cr.gridy; cl.gridy = ++cr.gridy;
JLabel lblDefault = new JLabel( JLabel lblDefault = new JLabel(
R.getI18NString("plugin.dnsconfig.dnssec.lblDefault")); R.getI18NString("plugin.dnsconfig.dnssec.lblDefault"));
lblDefault.setBorder(BorderFactory.createEmptyBorder(0, 22, 0, 0)); lblDefault.setBorder(BorderFactory.createEmptyBorder(0, 22, 0, 0));
pnlCommon.add(lblDefault, cl); pnlCommon.add(lblDefault, cl);
cboDefault = new JComboBox(SecureResolveMode.values()); cboDefault = new JComboBox(SecureResolveMode.values());
cboDefault.setRenderer(getResolveModeRenderer()); cboDefault.setRenderer(getResolveModeRenderer());
pnlCommon.add(cboDefault, cr); pnlCommon.add(cboDefault, cr);
//domain list table //domain list table
tblDomains = new JTable(data); tblDomains = new JTable(data);
tblDomains.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblDomains.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tblDomains.setRowHeight(20); tblDomains.setRowHeight(20);
tblDomains.getColumnModel().getColumn(1).setCellRenderer( tblDomains.getColumnModel().getColumn(1).setCellRenderer(
new DefaultTableCellRenderer() new DefaultTableCellRenderer()
{ {
/** /**
* Serial version UID. * Serial version UID.
*/ */
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
@Override @Override
protected void setValue(Object value) protected void setValue(Object value)
{ {
if (value instanceof SecureResolveMode) if (value instanceof SecureResolveMode)
setText(R.getI18NString( setText(R.getI18NString(
"net.java.sip.communicator.util.dns." "net.java.sip.communicator.util.dns."
+ SecureResolveMode.class.getSimpleName() + SecureResolveMode.class.getSimpleName()
+ "." + "."
+ ((SecureResolveMode) value).name())); + ((SecureResolveMode) value).name()));
else else
super.setValue(value); super.setValue(value);
} }
} }
); );
JComboBox cboTblModeEditor = new JComboBox(SecureResolveMode.values()); JComboBox cboTblModeEditor = new JComboBox(SecureResolveMode.values());
cboTblModeEditor.setRenderer(getResolveModeRenderer()); cboTblModeEditor.setRenderer(getResolveModeRenderer());
tblDomains.getColumnModel().getColumn(1).setCellEditor( tblDomains.getColumnModel().getColumn(1).setCellEditor(
new DefaultCellEditor(cboTblModeEditor)); new DefaultCellEditor(cboTblModeEditor));
JScrollPane pnlScroller = new JScrollPane(tblDomains); JScrollPane pnlScroller = new JScrollPane(tblDomains);
pnlScroller.setBorder(BorderFactory.createEmptyBorder(0, 22, 0, 0)); pnlScroller.setBorder(BorderFactory.createEmptyBorder(0, 22, 0, 0));
pnlScroller.setOpaque(false); pnlScroller.setOpaque(false);
add(pnlScroller, BorderLayout.CENTER); add(pnlScroller, BorderLayout.CENTER);
} }
/** /**
* Reads the configured properties or their defaults into the UI controls. * Reads the configured properties or their defaults into the UI controls.
*/ */
private void loadData() private void loadData()
{ {
cboDefault.setSelectedItem(Enum.valueOf(SecureResolveMode.class, cboDefault.setSelectedItem(Enum.valueOf(SecureResolveMode.class,
config.getString( config.getString(
ConfigurableDnssecResolver.PNAME_DNSSEC_VALIDATION_MODE, ConfigurableDnssecResolver.PNAME_DNSSEC_VALIDATION_MODE,
SecureResolveMode.WarnIfBogus.name()) SecureResolveMode.WarnIfBogus.name())
) )
); );
chkEnabled.setSelected(config.getBoolean( chkEnabled.setSelected(config.getBoolean(
CustomResolver.PNAME_DNSSEC_RESOLVER_ENABLED, CustomResolver.PNAME_DNSSEC_RESOLVER_ENABLED,
CustomResolver.PDEFAULT_DNSSEC_RESOLVER_ENABLED CustomResolver.PDEFAULT_DNSSEC_RESOLVER_ENABLED
)); ));
chkAbsolute.setSelected(config.getBoolean( chkAbsolute.setSelected(config.getBoolean(
NetworkUtils.PNAME_DNS_ALWAYS_ABSOLUTE, NetworkUtils.PNAME_DNS_ALWAYS_ABSOLUTE,
NetworkUtils.PDEFAULT_DNS_ALWAYS_ABSOLUTE NetworkUtils.PDEFAULT_DNS_ALWAYS_ABSOLUTE
)); ));
txtNameservers.setText( txtNameservers.setText(
config.getString(DnsUtilActivator.PNAME_DNSSEC_NAMESERVERS)); config.getString(DnsUtilActivator.PNAME_DNSSEC_NAMESERVERS));
} }
/** /**
* Action has occurred in the config form. * Action has occurred in the config form.
* @param e the action event * @param e the action event
*/ */
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
if(e.getSource() == cboDefault) if(e.getSource() == cboDefault)
{ {
if(cboDefault.getSelectedItem() == null) if(cboDefault.getSelectedItem() == null)
return; return;
SecureResolveMode oldMode = Enum.valueOf(SecureResolveMode.class, SecureResolveMode oldMode = Enum.valueOf(SecureResolveMode.class,
config.getString( config.getString(
ConfigurableDnssecResolver.PNAME_DNSSEC_VALIDATION_MODE, ConfigurableDnssecResolver.PNAME_DNSSEC_VALIDATION_MODE,
SecureResolveMode.WarnIfBogus.name()) SecureResolveMode.WarnIfBogus.name())
); );
config.setProperty( config.setProperty(
ConfigurableDnssecResolver.PNAME_DNSSEC_VALIDATION_MODE, ConfigurableDnssecResolver.PNAME_DNSSEC_VALIDATION_MODE,
((SecureResolveMode)cboDefault.getSelectedItem()).name()); ((SecureResolveMode)cboDefault.getSelectedItem()).name());
//update all values that had the default to the new default //update all values that had the default to the new default
for(int i = 0; i < tblDomains.getModel().getRowCount(); i++) for(int i = 0; i < tblDomains.getModel().getRowCount(); i++)
{ {
SecureResolveMode m = (SecureResolveMode)data.getValueAt(i, 1); SecureResolveMode m = (SecureResolveMode)data.getValueAt(i, 1);
if(m == oldMode) if(m == oldMode)
data.setValueAt(cboDefault.getSelectedItem(), i, 1); data.setValueAt(cboDefault.getSelectedItem(), i, 1);
} }
tblDomains.repaint(); tblDomains.repaint();
return; return;
} }
if(e.getSource() == chkEnabled) if(e.getSource() == chkEnabled)
{ {
File f; File f;
try try
{ {
f = DnsConfigActivator.getFileAccessService() f = DnsConfigActivator.getFileAccessService()
.getPrivatePersistentFile(".usednsjava"); .getPrivatePersistentFile(".usednsjava");
if(chkEnabled.isSelected()) if(chkEnabled.isSelected())
{ {
if(!f.createNewFile() && !f.exists()) if(!f.createNewFile() && !f.exists())
chkEnabled.setSelected(UnboundApi.isAvailable()); chkEnabled.setSelected(UnboundApi.isAvailable());
} }
else else
{ {
if(!f.delete() && f.exists()) if(!f.delete() && f.exists())
chkEnabled.setSelected(true); chkEnabled.setSelected(true);
} }
config.setProperty( config.setProperty(
CustomResolver.PNAME_DNSSEC_RESOLVER_ENABLED, CustomResolver.PNAME_DNSSEC_RESOLVER_ENABLED,
chkEnabled.isSelected()); chkEnabled.isSelected());
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.error("failed to enable DNSSEC", ex); logger.error("failed to enable DNSSEC", ex);
ErrorDialog ed = new ErrorDialog( ErrorDialog ed = new ErrorDialog(
null, null,
R.getI18NString("plugin.dnsconfig.dnssec.ENABLE_FAILED"), R.getI18NString("plugin.dnsconfig.dnssec.ENABLE_FAILED"),
R.getI18NString("plugin.dnsconfig.dnssec.ENABLE_FAILED_MSG"), R.getI18NString("plugin.dnsconfig.dnssec.ENABLE_FAILED_MSG"),
ex); ex);
ed.showDialog(); ed.showDialog();
} }
updateState(); updateState();
} }
if(e.getSource() == chkAbsolute) if(e.getSource() == chkAbsolute)
{ {
config.setProperty( config.setProperty(
NetworkUtils.PNAME_DNS_ALWAYS_ABSOLUTE, NetworkUtils.PNAME_DNS_ALWAYS_ABSOLUTE,
chkAbsolute.isSelected()); chkAbsolute.isSelected());
updateState(); updateState();
} }
} }
/** /**
* Updates the form behavior when the resolver is enabled or disabled. * Updates the form behavior when the resolver is enabled or disabled.
*/ */
private void updateState() private void updateState()
{ {
cboDefault.setEnabled(chkEnabled.isSelected()); cboDefault.setEnabled(chkEnabled.isSelected());
txtNameservers.setEnabled(chkEnabled.isSelected()); txtNameservers.setEnabled(chkEnabled.isSelected());
tblDomains.setEnabled(chkEnabled.isSelected()); tblDomains.setEnabled(chkEnabled.isSelected());
parallelDnsPanel.updateDnssecState(); parallelDnsPanel.updateDnssecState();
} }
/** /**
* Creates a ComboBox renderer for the resolve mode column. The non-edit * Creates a ComboBox renderer for the resolve mode column. The non-edit
* text is based on the selected value of the row for which the renderer is * text is based on the selected value of the row for which the renderer is
* created. * created.
* *
* @return ComboBox render for the SecureResolveMode enum. * @return ComboBox render for the SecureResolveMode enum.
*/ */
private BasicComboBoxRenderer getResolveModeRenderer() private BasicComboBoxRenderer getResolveModeRenderer()
{ {
return new BasicComboBoxRenderer() return new BasicComboBoxRenderer()
{ {
/** /**
* Serial version UID. * Serial version UID.
*/ */
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
@Override @Override
public Component getListCellRendererComponent(JList list, public Component getListCellRendererComponent(JList list,
Object value, int index, boolean isSelected, Object value, int index, boolean isSelected,
boolean cellHasFocus) boolean cellHasFocus)
{ {
Component c = Component c =
super.getListCellRendererComponent(list, value, index, super.getListCellRendererComponent(list, value, index,
isSelected, cellHasFocus); isSelected, cellHasFocus);
setText(R.getI18NString("net.java.sip.communicator.util.dns." setText(R.getI18NString("net.java.sip.communicator.util.dns."
+ SecureResolveMode.class.getSimpleName() + SecureResolveMode.class.getSimpleName()
+ "." + "."
+ value)); + value));
return c; return c;
} }
}; };
} }
/** /**
* A text field has lost the focus in the config form. * A text field has lost the focus in the config form.
* @param e the action event * @param e the action event
*/ */
public void focusLost(FocusEvent e) public void focusLost(FocusEvent e)
{ {
if(e.getSource() == txtNameservers) if(e.getSource() == txtNameservers)
{ {
config.setProperty( config.setProperty(
DnsUtilActivator.PNAME_DNSSEC_NAMESERVERS, DnsUtilActivator.PNAME_DNSSEC_NAMESERVERS,
txtNameservers.getText()); txtNameservers.getText());
DnsUtilActivator.reloadDnsResolverConfig(); DnsUtilActivator.reloadDnsResolverConfig();
} }
} }
public void focusGained(FocusEvent e) public void focusGained(FocusEvent e)
{} {}
} }

@ -1,137 +1,137 @@
/* /*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client. * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
* *
* Distributable under LGPL license. * Distributable under LGPL license.
* See terms of license at gnu.org. * See terms of license at gnu.org.
*/ */
package net.java.sip.communicator.impl.dns.dnsconfig; package net.java.sip.communicator.plugin.dnsconfig;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
import javax.swing.table.*; import javax.swing.table.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import net.java.sip.communicator.impl.dns.*; import net.java.sip.communicator.impl.dns.*;
import org.jitsi.service.configuration.*; import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*; import org.jitsi.service.resources.*;
import org.osgi.framework.*; import org.osgi.framework.*;
/** /**
* TableModel for selectively managing DNSSEC behavior for zones ever requested * TableModel for selectively managing DNSSEC behavior for zones ever requested
* by Jitsi. * by Jitsi.
* *
* @author Ingo Bauersachs * @author Ingo Bauersachs
*/ */
public class DnssecTableModel public class DnssecTableModel
extends DefaultTableModel extends DefaultTableModel
{ {
/** /**
* Serial version UID. * Serial version UID.
*/ */
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
private List<String> data = new LinkedList<String>(); private List<String> data = new LinkedList<String>();
private ResourceManagementService R; private ResourceManagementService R;
private ConfigurationService config; private ConfigurationService config;
/** /**
* Creates a new instance of this class. Reads all zones from the * Creates a new instance of this class. Reads all zones from the
* configuration store. * configuration store.
*/ */
public DnssecTableModel() public DnssecTableModel()
{ {
BundleContext bc = DnsConfigActivator.bundleContext; BundleContext bc = DnsConfigActivator.bundleContext;
R = ServiceUtils.getService(bc, ResourceManagementService.class); R = ServiceUtils.getService(bc, ResourceManagementService.class);
config = ServiceUtils.getService(bc, ConfigurationService.class); config = ServiceUtils.getService(bc, ConfigurationService.class);
data = config.getPropertyNamesByPrefix( data = config.getPropertyNamesByPrefix(
ConfigurableDnssecResolver.PNAME_BASE_DNSSEC_PIN, false); ConfigurableDnssecResolver.PNAME_BASE_DNSSEC_PIN, false);
Collections.sort(data); Collections.sort(data);
if(data == null) if(data == null)
data = new ArrayList<String>(0); data = new ArrayList<String>(0);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public int getRowCount() public int getRowCount()
{ {
if(data == null) if(data == null)
return 0; return 0;
return data.size(); return data.size();
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public int getColumnCount() public int getColumnCount()
{ {
return 2; return 2;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getColumnName(int columnIndex) public String getColumnName(int columnIndex)
{ {
switch(columnIndex) switch(columnIndex)
{ {
case 0: case 0:
return R.getI18NString("plugin.dnsconfig.dnssec.DOMAIN_NAME"); return R.getI18NString("plugin.dnsconfig.dnssec.DOMAIN_NAME");
case 1: case 1:
return R.getI18NString("plugin.dnsconfig.dnssec.MODE"); return R.getI18NString("plugin.dnsconfig.dnssec.MODE");
} }
return null; return null;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public Class<?> getColumnClass(int columnIndex) public Class<?> getColumnClass(int columnIndex)
{ {
if(columnIndex < 1) if(columnIndex < 1)
return String.class; return String.class;
return Component.class; return Component.class;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public boolean isCellEditable(int rowIndex, int columnIndex) public boolean isCellEditable(int rowIndex, int columnIndex)
{ {
return columnIndex == 1; return columnIndex == 1;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public Object getValueAt(int rowIndex, int columnIndex) public Object getValueAt(int rowIndex, int columnIndex)
{ {
switch(columnIndex) switch(columnIndex)
{ {
case 0: case 0:
return data.get(rowIndex).substring( return data.get(rowIndex).substring(
ConfigurableDnssecResolver.PNAME_BASE_DNSSEC_PIN.length()+1) ConfigurableDnssecResolver.PNAME_BASE_DNSSEC_PIN.length()+1)
.split("\\.")[0].replaceAll("__", "."); .split("\\.")[0].replaceAll("__", ".");
case 1: case 1:
return SecureResolveMode.valueOf( return SecureResolveMode.valueOf(
config.getString(data.get(rowIndex))); config.getString(data.get(rowIndex)));
} }
return null; return null;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void setValueAt(Object aValue, int rowIndex, int columnIndex) public void setValueAt(Object aValue, int rowIndex, int columnIndex)
{ {
if(aValue == null) if(aValue == null)
return; return;
config.setProperty( config.setProperty(
data.get(rowIndex), data.get(rowIndex),
((SecureResolveMode)aValue).name() ((SecureResolveMode)aValue).name()
); );
} }
} }

@ -4,7 +4,7 @@
* Distributable under LGPL license. * Distributable under LGPL license.
* See terms of license at gnu.org. * See terms of license at gnu.org.
*/ */
package net.java.sip.communicator.impl.dns.dnsconfig; package net.java.sip.communicator.plugin.dnsconfig;
import static net.java.sip.communicator.impl.dns.DnsUtilActivator.*; import static net.java.sip.communicator.impl.dns.DnsUtilActivator.*;
import static net.java.sip.communicator.service.dns.CustomResolver.*; import static net.java.sip.communicator.service.dns.CustomResolver.*;

@ -0,0 +1,30 @@
Bundle-Activator: net.java.sip.communicator.plugin.dnsconfig.DnsConfigActivator
Bundle-Name: Jitsi DNS config
Bundle-SymbolicName: net.java.sip.communicator.plugin
Bundle-Description: A bundle that export config panels for DNS utility classes.
Bundle-Vendor: jitsi.org
Bundle-Version: 0.0.1
System-Bundle: yes
Import-Package: org.jitsi.util,
org.osgi.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.plugin.desktoputil,
org.jitsi.service.resources,
org.jitsi.service.fileaccess,
net.java.sip.communicator.impl.dns,
net.java.sip.communicator.service.resources,
net.java.sip.communicator.service.notification,
net.java.sip.communicator.service.dns,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.netaddr,
net.java.sip.communicator.service.netaddr.event,
org.jitsi.service.configuration,
sun.net.dns,
org.xbill.DNS,
javax.swing,
javax.swing.event,
javax.swing.text,
javax.swing.border,
javax.swing.plaf.basic,
javax.swing.table
Loading…
Cancel
Save