Example usage for java.util ResourceBundle getString

List of usage examples for java.util ResourceBundle getString

Introduction

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

Prototype

public final String getString(String key) 

Source Link

Document

Gets a string for the given key from this resource bundle or one of its parents.

Usage

From source file:JAXRGetMyObjects.java

/**
     * Establishes a connection to a registry.
     *// w  ww  . j  a  va2 s. c om
     * @param queryUrl        the URL of the query registry
     * @param publishUrl        the URL of the publish registry
     */
    public void makeConnection(String queryUrl, String publishUrl) {
        /*
         * Specify proxy information in case you
         *  are going beyond your firewall.
         */
        ResourceBundle bundle = ResourceBundle.getBundle("JAXRExamples");
        String httpProxyHost = bundle.getString("http.proxyHost");
        String httpProxyPort = bundle.getString("http.proxyPort");
        String httpsProxyHost = bundle.getString("https.proxyHost");
        String httpsProxyPort = bundle.getString("https.proxyPort");

        /*
         * Define connection configuration properties.
         * For simple queries, you need the query URL.
         */
        Properties props = new Properties();
        props.setProperty("javax.xml.registry.queryManagerURL", queryUrl);
        props.setProperty("javax.xml.registry.lifeCycleManagerURL", publishUrl);
        props.setProperty("com.sun.xml.registry.http.proxyHost", httpProxyHost);
        props.setProperty("com.sun.xml.registry.http.proxyPort", httpProxyPort);
        props.setProperty("com.sun.xml.registry.https.proxyHost", httpsProxyHost);
        props.setProperty("com.sun.xml.registry.https.proxyPort", httpsProxyPort);

        try {
            // Create the connection, passing it the 
            // configuration properties
            ConnectionFactory factory = ConnectionFactory.newInstance();
            factory.setProperties(props);
            connection = factory.createConnection();
            System.out.println("Created connection to registry");
        } catch (Exception e) {
            e.printStackTrace();

            if (connection != null) {
                try {
                    connection.close();
                } catch (JAXRException je) {
                }
            }
        }
    }

From source file:es.pode.modificador.presentacion.pendientes.ModificacionesPendientesControllerImpl.java

/**
 * @see es.pode.modificador.presentacion.pendientes.ModificacionesPendientesController#submit(org.apache.struts.action.ActionMapping, es.pode.modificador.presentacion.pendientes.SubmitForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 *//*from w  ww . j  a va  2s  . c  o m*/
public final void submit(ActionMapping mapping, es.pode.modificador.presentacion.pendientes.SubmitForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    java.util.Locale locale = (java.util.Locale) request.getSession()
            .getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);
    String accion = form.getAction();
    if (accion.equals(i18n.getString("modificacionesPendientes.eliminar"))) {

        if (form.getIdModificacionRowSelection() == null || form.getIdModificacionRowSelection().size() == 0) {
            throw new ValidatorException("{modificacionesPendientes.elementoSeleccionado.exception}");
        }
        // Transformo a Long[]
        ArrayList lista = new ArrayList();
        String[] ids = form.getIdModificacionRowSelectionAsArray();
        for (int i = 0; i < ids.length; i++) {
            lista.add(Long.valueOf(ids[i]));
        }
        form.setIdentificadores(lista);
    }
}

From source file:main.export.sql.DataImporter.java

public DataImporter(ResourceBundle rb)
        throws MongoException, InvalidAttributesException, MalformedURLException, IOException {
    dataStoreType = DataStoreType.valueOf(rb.getString("dataStoreType").toUpperCase());
    findDataStoreWriter();/*w  w w.  ja  v  a  2s .c o  m*/
    getWriter().initConnection(rb);
}

From source file:JAXRPublishConcept.java

/**
     * Establishes a connection to a registry.
     *//w ww  . j a va  2 s.  c  o  m
     * @param queryUrl        the URL of the query registry
     * @param publishUrl        the URL of the publish registry
     */
    public void makeConnection(String queryUrl, String publishUrl) {
        /*
         * Specify proxy information in case you
         *  are going beyond your firewall.
         */
        ResourceBundle bundle = ResourceBundle.getBundle("JAXRExamples");
        String httpProxyHost = bundle.getString("http.proxyHost");
        String httpProxyPort = bundle.getString("http.proxyPort");
        String httpsProxyHost = bundle.getString("https.proxyHost");
        String httpsProxyPort = bundle.getString("https.proxyPort");

        /*
         * Define connection configuration properties.
         * To publish, you need both the query URL and the
         * publish URL.
         */
        Properties props = new Properties();
        props.setProperty("javax.xml.registry.queryManagerURL", queryUrl);
        props.setProperty("javax.xml.registry.lifeCycleManagerURL", publishUrl);
        props.setProperty("com.sun.xml.registry.http.proxyHost", httpProxyHost);
        props.setProperty("com.sun.xml.registry.http.proxyPort", httpProxyPort);
        props.setProperty("com.sun.xml.registry.https.proxyHost", httpsProxyHost);
        props.setProperty("com.sun.xml.registry.https.proxyPort", httpsProxyPort);

        try {
            // Create the connection, passing it the 
            // configuration properties
            ConnectionFactory factory = ConnectionFactory.newInstance();
            factory.setProperties(props);
            connection = factory.createConnection();
            System.out.println("Created connection to registry");
        } catch (Exception e) {
            e.printStackTrace();

            if (connection != null) {
                try {
                    connection.close();
                } catch (JAXRException je) {
                }
            }
        }
    }

From source file:org.yccheok.jstock.gui.portfolio.DividendSummaryBarChartJDialog.java

/** This method is called from within the constructor to
 * initialize the form./*from w w  w  .j ava  2s .c om*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    jComboBox1 = new javax.swing.JComboBox();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/yccheok/jstock/data/gui"); // NOI18N
    setTitle(bundle.getString("DividendSummaryBarChartJDialog_DividendByYear")); // NOI18N

    jPanel1.setLayout(new java.awt.BorderLayout(5, 5));

    jComboBox1.setModel(getComboBoxModel());
    jComboBox1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBox1ActionPerformed(evt);
        }
    });
    jPanel1.add(jComboBox1, java.awt.BorderLayout.EAST);

    getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);

    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((screenSize.width - 700) / 2, (screenSize.height - 500) / 2, 700, 500);
}

From source file:es.pode.empaquetador.presentacion.avanzado.recursos.gestor.GestorRecursosControllerImpl.java

public final void submit(ActionMapping mapping,
        es.pode.empaquetador.presentacion.avanzado.recursos.gestor.SubmitForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    EmpaquetadorSession sesEmpaq = this.getEmpaquetadorSession(request);
    java.util.Locale locale = (Locale) request.getSession().getAttribute(ConstantesAgrega.DEFAULT_LOCALE);
    ResourceBundle i18n = ResourceBundle.getBundle("application-resources", locale);

    String accion = form.getAction();
    if ((accion.equals(i18n.getString("presentacion.avanzado.recursos.gestor.submit.exportar")))
            || (accion.equals(i18n.getString("presentacion.avanzado.recursos.gestor.submit.eliminar")))) {

        List elementos = form.getIdentifierRowSelection();
        if (elementos != null && elementos.size() > 0) {
            List SubmanifestPath = sesEmpaq.getSubmanifestPath();
            OdeVO ultimoElemSubmPath = (OdeVO) SubmanifestPath.get(SubmanifestPath.size() - 1);

            RecursoVO[] recur = ultimoElemSubmPath.getRecursos();

            List recurRecuperados = new ArrayList();
            for (int i = 0; i < recur.length; i++) {
                if (elementos.contains(recur[i].getIdentifier())) {
                    recurRecuperados.add(recur[i]);
                }//  w  w w  . j  a v  a 2s.  c  o  m
            }

            form.setRecursosVO(recurRecuperados);
        } //fin_if (elementos!=null && elementos.size()!=0)
        else {
            throw new ValidatorException(
                    "{presentacion.avanzado.recursos.gestor.submit.error.seleccionar.recursos}");
        }

    }

}

From source file:eu.europa.ec.markt.dss.applet.WizardFinishedPanel.java

/**
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
 * content of this method is always regenerated by the Form Editor.
 *///from www. j a  v a2s . com
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jLabel1 = new javax.swing.JLabel();

    setBackground(new java.awt.Color(255, 255, 255));

    jLabel1.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/eu/europa/ec/markt/dss/applet/wizard/big_ok.png"))); // NOI18N
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("eu/europa/ec/markt/dss/applet/i18n"); // NOI18N
    jLabel1.setText(bundle.getString("SIGNED_FILE_SAVED")); // NOI18N
    jLabel1.setName("result"); // NOI18N

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                    .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
                    .addContainerGap()));
}

From source file:io.github.swagger2markup.internal.document.builder.OverviewDocumentBuilder.java

public OverviewDocumentBuilder(Swagger2MarkupConverter.Context context,
        Swagger2MarkupExtensionRegistry extensionRegistry, Path outputPath) {
    super(context, extensionRegistry, outputPath);

    ResourceBundle labels = ResourceBundle.getBundle("io/github/swagger2markup/lang/labels",
            config.getOutputLanguage().toLocale());
    OVERVIEW = labels.getString("overview");
    CURRENT_VERSION = labels.getString("current_version");
    VERSION = labels.getString("version");
    CONTACT_INFORMATION = labels.getString("contact_information");
    CONTACT_NAME = labels.getString("contact_name");
    CONTACT_EMAIL = labels.getString("contact_email");
    LICENSE_INFORMATION = labels.getString("license_information");
    LICENSE = labels.getString("license");
    LICENSE_URL = labels.getString("license_url");
    TERMS_OF_SERVICE = labels.getString("terms_of_service");
    URI_SCHEME = labels.getString("uri_scheme");
    HOST = labels.getString("host");
    BASE_PATH = labels.getString("base_path");
    SCHEMES = labels.getString("schemes");
}

From source file:com.inkubator.hrm.web.converter.OvertimeImplCalculationMethodConverter.java

@Override
public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object value) {
    ResourceBundle resourceBundle = ResourceBundle.getBundle("Messages",
            new Locale(FacesUtil.getSessionAttribute(HRMConstant.BAHASA_ACTIVE).toString()));
    String messages = StringUtils.EMPTY;
    Integer data = (Integer) value;
    if (Objects.equals(data, HRMConstant.OVERTIME_CALCULATION_STATIC)) {
        messages = resourceBundle.getString("overTimeImplementation.static");
    } else if (Objects.equals(data, HRMConstant.OVERTIME_CALCULATION_RELATIVE)) {
        messages = resourceBundle.getString("overTimeImplementation.relative");
    }/*w ww.j a va 2  s. c  o  m*/
    return messages;

}

From source file:com.google.ratel.util.RatelUtils.java

/**
 * Return the Click Framework version string.
 *
 * @return the Click Framework version string
 *///w  w w  .ja v  a  2 s .  c om
public static String getRatelVersion() {
    ResourceBundle bundle = getBundle("ratel");
    return bundle.getString("ratel-version");
}