Example usage for java.util ResourceBundle getBundle

List of usage examples for java.util ResourceBundle getBundle

Introduction

In this page you can find the example usage for java.util ResourceBundle getBundle.

Prototype

@CallerSensitive
public static final ResourceBundle getBundle(String baseName) 

Source Link

Document

Gets a resource bundle using the specified base name, the default locale, and the caller module.

Usage

From source file:es.mityc.firmaJava.configuracion.Configuracion.java

private void cargarConfiguracionPorDefecto() {

    log.debug(CARGA_CONFIGURACION_DEFECTO);
    Enumeration<String> enuClaves = null;
    ResourceBundle propiedadesPorDefecto = ResourceBundle.getBundle(FICHERO_RESOURCE);
    configuracion = new HashMap<String, String>();
    enuClaves = propiedadesPorDefecto.getKeys();
    boolean hasNext = enuClaves.hasMoreElements();
    while (hasNext) {
        String clave = enuClaves.nextElement();
        hasNext = enuClaves.hasMoreElements();
        configuracion.put(clave, propiedadesPorDefecto.getString(clave));
    }/*from   w w  w  .  j a v  a  2  s .  c om*/

}

From source file:org.duracloud.client.ContentStoreImpl.java

/**
 * Creates a ContentStore. This ContentStore uses the default number of
 * retries when a failure occurs (3)./*from  w w  w.  j  ava 2s .  c  o  m*/
 *
 * @param baseURL           a {@link java.lang.String} object.
 * @param type              a {@link org.duracloud.storage.domain.StorageProviderType} object.
 * @param storeId           a {@link java.lang.String} object.
 * @param writable          flag that indicates whether the content store is writable by non-root users (value
 *                          can be toggled in the Management Console)
 * @param restHelper        a {@link org.duracloud.common.web.RestHttpHelper} object
 */
public ContentStoreImpl(String baseURL, StorageProviderType type, String storeId, boolean writable,
        RestHttpHelper restHelper) {
    this.baseURL = baseURL;
    this.type = type;
    this.storeId = storeId;
    this.restHelper = restHelper;
    this.writable = writable;

    this.retryExceptionHandler = new ExceptionHandler() {
        @Override
        public void handle(Exception ex) {
            if (!(ex instanceof NotFoundException)) {
                log.warn(ex.getMessage());
            } else {
                log.debug(ex.getMessage());
            }
        }
    };

    this.clientVersion = ResourceBundle.getBundle("storeclient").getString("version");

}

From source file:edu.smu.tspell.wordnet.impl.file.SampleSentenceData.java

/**
 * Returns a reference to the resource bundle that maps synset types to
 * the names of files containing the data.
 * //  ww  w  .  j  a  va  2 s .c  o  m
 * @return Resource bundle containing the type / file name mappings.
 */
private ResourceBundle getBundle() {
    if (bundle == null) {
        bundle = ResourceBundle.getBundle(getResourceBundleName());
    }
    return bundle;
}

From source file:edu.toronto.cs.phenotips.measurements.internal.DefaultMeasurementsChartConfigurationsFactory.java

@Override
public List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType) {
    ResourceBundle configuration = ResourceBundle.getBundle("measurementsChartsConfigurations");
    String key = "charts." + measurementType + ".configurations";
    if (!configuration.containsKey(key)) {
        return Collections.emptyList();
    }/*from  ww  w  . ja v a 2s .c  o  m*/
    String[] charts = configuration.getString(key).split(",");
    List<MeasurementsChartConfiguration> result = new ArrayList<MeasurementsChartConfiguration>(charts.length);
    for (String chart : charts) {
        SimpleMeasurementsChartConfiguration chartSettings = loadChart(key + '.' + chart + '.', configuration);
        if (validateChart(chartSettings)) {
            chartSettings.measurementType = measurementType;
            result.add(chartSettings);
        }
    }
    return result;
}

From source file:de.mendelson.comm.as2.server.AS2ServerProcessing.java

public AS2ServerProcessing(ClientServer clientserver, DirPollManager pollManager,
        CertificateManager certificateManager, Connection configConnection, Connection runtimeConnection) {
    //Load default resourcebundle
    try {/*ww  w . ja v  a 2 s.  c  o  m*/
        this.rb = (MecResourceBundle) ResourceBundle
                .getBundle(ResourceBundleAS2ServerProcessing.class.getName());
    } //load up  resourcebundle
    catch (MissingResourceException e) {
        throw new RuntimeException("Oops..resource bundle " + e.getClassName() + " not found.");
    }
    this.filesystemview = new FileSystemViewProcessorServer(this.logger);
    this.clientserver = clientserver;
    this.configConnection = configConnection;
    this.runtimeConnection = runtimeConnection;
    this.pollManager = pollManager;
    this.certificateManager = certificateManager;
}

From source file:de.mendelson.comm.as2.send.MessageHttpUploader.java

/** Creates new message uploader instance
 * @param hostname Name of the host to connect to
 * @param username Name of the user that will connect to the remote ftp server
 * @param password password to connect to the ftp server
 */// w w  w.  j a  v  a  2 s .  c o  m
public MessageHttpUploader() throws Exception {
    //Load default resourcebundle
    try {
        this.rb = (MecResourceBundle) ResourceBundle.getBundle(ResourceBundleHttpUploader.class.getName());
    } //load up resourcebundle
    catch (MissingResourceException e) {
        throw new RuntimeException("Oops..resource bundle " + e.getClassName() + " not found.");
    }
}

From source file:com.tiempometa.muestradatos.JProgramTags.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos");
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    label1 = new JLabel();
    statusLabel = new JLabel();
    nextChipnumberTextField = new JTextField();
    programButton = new JButton();
    bibLabel = new JLabel();
    label3 = new JLabel();
    tidTextField = new JTextField();
    label4 = new JLabel();
    epcTextField = new JTextField();
    label5 = new JLabel();
    programmedEpcTextField = new JTextField();
    scrollPane1 = new JScrollPane();
    tagReadTable = new JTable();
    lockCheckbox = new JCheckBox();
    label2 = new JLabel();
    accessPasswordTextField = new JTextField();
    label6 = new JLabel();
    killPasswordTextField = new JTextField();
    checkBox1 = new JCheckBox();
    buttonBar = new JPanel();
    closeButton = new JButton();
    CellConstraints cc = new CellConstraints();

    // ======== this ========
    setTitle(bundle.getString("JProgramTags.this.title"));
    setIconImage(//  w  ww .  j a va  2 s. com
            new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png"))
                    .getImage());
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    // ======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        // ======== contentPanel ========
        {
            contentPanel.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { new ColumnSpec(Sizes.dluX(12)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(86)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(73)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(68)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(97)) },
                    new RowSpec[] { new RowSpec(Sizes.dluY(10)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC }));

            // ---- label1 ----
            label1.setText(bundle.getString("JProgramTags.label1.text"));
            label1.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(label1, cc.xywh(3, 5, 3, 1));

            // ---- statusLabel ----
            statusLabel.setText(bundle.getString("JProgramTags.statusLabel.text"));
            statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
            statusLabel.setBackground(Color.yellow);
            statusLabel.setOpaque(true);
            statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
            contentPanel.add(statusLabel, cc.xywh(9, 3, 3, 5));

            // ---- nextChipnumberTextField ----
            nextChipnumberTextField.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(nextChipnumberTextField, cc.xy(7, 5));

            // ---- programButton ----
            programButton.setText(bundle.getString("JProgramTags.programButton.text"));
            programButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            programButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    programButtonActionPerformed(e);
                }
            });
            contentPanel.add(programButton, cc.xywh(3, 7, 3, 1));

            // ---- bibLabel ----
            bibLabel.setForeground(Color.red);
            bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36));
            bibLabel.setHorizontalAlignment(SwingConstants.CENTER);
            contentPanel.add(bibLabel, cc.xy(11, 9));

            // ---- label3 ----
            label3.setText(bundle.getString("JProgramTags.label3.text"));
            label3.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label3, cc.xy(7, 11));

            // ---- tidTextField ----
            tidTextField.setEditable(false);
            tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(tidTextField, cc.xywh(9, 11, 3, 1));

            // ---- label4 ----
            label4.setText(bundle.getString("JProgramTags.label4.text"));
            label4.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label4, cc.xy(7, 13));

            // ---- epcTextField ----
            epcTextField.setEditable(false);
            epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(epcTextField, cc.xywh(9, 13, 3, 1));

            // ---- label5 ----
            label5.setText(bundle.getString("JProgramTags.label5.text"));
            label5.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label5, cc.xy(7, 15));

            // ---- programmedEpcTextField ----
            programmedEpcTextField.setEditable(false);
            programmedEpcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(programmedEpcTextField, cc.xywh(9, 15, 3, 1));

            // ======== scrollPane1 ========
            {
                scrollPane1.setViewportView(tagReadTable);
            }
            contentPanel.add(scrollPane1, cc.xywh(3, 17, 9, 1));

            // ---- lockCheckbox ----
            lockCheckbox.setText(bundle.getString("JProgramTags.lockCheckbox.text"));
            lockCheckbox.setSelected(true);
            lockCheckbox.setFont(new Font("Tahoma", Font.PLAIN, 14));
            lockCheckbox.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    checkBox2ItemStateChanged(e);
                }
            });
            contentPanel.add(lockCheckbox, cc.xy(3, 19));

            // ---- label2 ----
            label2.setText(bundle.getString("JProgramTags.label2.text"));
            label2.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label2, cc.xy(5, 19));

            // ---- accessPasswordTextField ----
            accessPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(accessPasswordTextField, cc.xy(7, 19));

            // ---- label6 ----
            label6.setText(bundle.getString("JProgramTags.label6.text"));
            label6.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label6, cc.xy(5, 21));

            // ---- killPasswordTextField ----
            killPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(killPasswordTextField, cc.xy(7, 21));

            // ---- checkBox1 ----
            checkBox1.setText(bundle.getString("JProgramTags.checkBox1.text"));
            checkBox1.setEnabled(false);
            contentPanel.add(checkBox1, cc.xy(9, 21));
        }
        dialogPane.add(contentPanel, BorderLayout.EAST);

        // ======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(
                    new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC },
                            RowSpec.decodeSpecs("pref")));

            // ---- closeButton ----
            closeButton.setText("Cerrar");
            closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            closeButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    closeButtonActionPerformed(e);
                }
            });
            buttonBar.add(closeButton, cc.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(700, 625);
    setLocationRelativeTo(getOwner());
    // //GEN-END:initComponents
}

From source file:it.infn.ct.security.utilities.LDAPUtils.java

public static boolean isCNregistered(String cn) {
    boolean registered = false;
    NamingEnumeration results = null;
    DirContext ctx = null;/*from w  w  w.j  a v  a 2s.  co  m*/
    try {
        ctx = getContext();
        SearchControls controls = new SearchControls();
        controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
        ResourceBundle rb = ResourceBundle.getBundle("ldap");

        results = ctx.search(rb.getString("peopleRoot"), "(cn=" + cn + ")", controls);
        if (results.hasMore()) {
            registered = true;
        }
    } catch (NameNotFoundException ex) {
        _log.error(ex);
    } catch (NamingException e) {
        registered = true;
    } finally {
        if (results != null) {
            try {
                results.close();
            } catch (Exception e) {
                // Never mind this.
            }
        }
        if (ctx != null) {
            try {
                ctx.close();
            } catch (Exception e) {
                // Never mind this.
            }
        }
    }

    return registered;
}

From source file:de.gbv.ole.Marc21ToOleBulk.java

/**
 * Print usage to System.err and exit the program.
 *///from   www. j av a2  s  .  com
private static void usageExit() {
    ResourceBundle messages = ResourceBundle.getBundle("application");
    System.err.println(messages.getString("usage"));
    System.exit(1);
}

From source file:cz.hobrasoft.pdfmu.error.ErrorType.java

/**
 * Loads error messages from the resource bundle
 * {@link #MESSAGES_RESOURCE_BUNDLE_BASE_NAME} and stores them in
 * {@link #messages}./*  ww w . j  a  v  a2 s. co m*/
 */
private static void loadErrorMessages() {
    try {
        messages = ResourceBundle.getBundle(MESSAGES_RESOURCE_BUNDLE_BASE_NAME);
    } catch (MissingResourceException ex) {
        LOGGER.severe(String.format("Could not load the error messages resource bundle: %s", ex));
    }
}