List of usage examples for java.util ResourceBundle getBundle
@CallerSensitive public static final ResourceBundle getBundle(String baseName)
From source file:de.chaosfisch.uploader.UploaderModule.java
@Override protected void configure() { bind(String.class).annotatedWith(Names.named(IPersistenceService.PERSISTENCE_FOLDER)) .toInstance(String.format("%s/%s", ApplicationData.DATA_DIR, ApplicationData.VERSION)); try {/*from ww w . ja v a2 s .c o m*/ final String configFile = ApplicationData.DATA_DIR + "/config.properties"; if (!Files.exists(Paths.get(configFile))) { Files.createFile(Paths.get(configFile)); } final PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(configFile); propertiesConfiguration.setAutoSave(true); bind(Configuration.class).toInstance(propertiesConfiguration); } catch (IOException | ConfigurationException e) { throw new RuntimeException(e); } install(new PersistenceModule()); install(new GoogleModule()); final Multibinder<UploadPreProcessor> preProcessorMultibinder = Multibinder.newSetBinder(binder(), UploadPreProcessor.class); preProcessorMultibinder.addBinding().to(PlaceholderPreProcessor.class); final Multibinder<UploadPostProcessor> uploadPostProcessorMultibinder = Multibinder.newSetBinder(binder(), UploadPostProcessor.class); uploadPostProcessorMultibinder.addBinding().to(ExportPostProcessor.class); bind(ResourceBundle.class).annotatedWith(Names.named("i18n-resources")) .toInstance(ResourceBundle.getBundle("de.chaosfisch.uploader.resources.application")); mapServices(); mapUtil(); }
From source file:ai.grakn.factory.OrientDBInternalFactory.java
private OrientGraph createIndicesVertex(OrientGraph graph) { ResourceBundle keys = ResourceBundle.getBundle("indices-vertices"); Set<String> labels = keys.keySet(); for (String label : labels) { String[] configs = keys.getString(label).split(","); for (String propertyConfig : configs) { String[] propertyConfigs = propertyConfig.split(":"); Schema.VertexProperty property = Schema.VertexProperty.valueOf(propertyConfigs[0]); boolean isUnique = Boolean.parseBoolean(propertyConfigs[1]); OType orientDataType = getOrientDataType(property); BaseConfiguration indexConfig = new BaseConfiguration(); indexConfig.setProperty("keytype", orientDataType); //TODO: Figure out why this is not working when the Orient Guys say it should //indexConfig.setProperty("metadata.ignoreNullValues", true); if (isUnique) { indexConfig.setProperty("type", "UNIQUE"); }/*from w w w . j av a 2 s . c om*/ if (!graph.getVertexIndexedKeys(label).contains(property.name())) { graph.createVertexIndex(property.name(), label, indexConfig); } } } return graph; }
From source file:JAXRGetMyObjects.java
/** * Establishes a connection to a registry. */*w w w . j av a 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. * 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:com.microsoft.alm.plugin.idea.ui.branch.CreateBranchForm.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL//from ww w. j a v a2 s .c om */ private void $$$setupUI$$$() { contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); nameLabel = new JLabel(); this.$$$loadLabelText$$$(nameLabel, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin") .getString("CreateBranchDialog.NameLabel")); contentPanel.add(nameLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); remoteBranchComboBox = new JComboBox(); contentPanel.add(remoteBranchComboBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); nameTextField = new JTextField(); contentPanel.add(nameTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); basedOn = new JLabel(); this.$$$loadLabelText$$$(basedOn, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin") .getString("CreateBranchDialog.BasedOn")); contentPanel.add(basedOn, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); }
From source file:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.java
private ByteArrayInputStream doMetadataRequest(LSID lsid) throws LSIDServerException { logger.debug("getting metadata for lsid " + lsid.getLsid()); try {/*from www.j av a 2s. co m*/ LSIDDataLookup myLookup = new LSIDDataLookup(); InputStream content = myLookup.lsidData(lsid); InputStream content2 = myLookup.lsidData(lsid); if (!isEML(content2)) { content = getEML(lsid); } content2.close(); setCurrentLSID(lsid); // based on the doctype choose the appropriate stylesheet String styleSheetName = null; String _docType = myLookup.getDocType(lsid); try { ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid"); styleSheetName = rb.getString(_docType.replaceAll(":", "")); } catch (java.util.MissingResourceException mre) { logger.warn("there is no style corresponding to: '" + _docType + "' -- using default"); styleSheetName = this.DEFAULT_STYLESHEET; mre.getMessage(); } InputStream styleSheet = getClass().getResourceAsStream(styleSheetName); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(styleSheet)); ByteArrayOutputStream out = new ByteArrayOutputStream(); transformer.transform(new StreamSource(content), new StreamResult(out)); content.close(); clearState(); return new ByteArrayInputStream(out.toByteArray()); } catch (Exception e) { throw new LSIDServerException(e, "Error transforming XML for: " + lsid); } }
From source file:contactsdirectory.frontend.MainJFrame.java
/** * Creates new form MainJFrame/*from w w w . j a v a 2s . c om*/ */ public MainJFrame() { localizedTexts = ResourceBundle.getBundle("contactsdirectory.frontend.resources.mainForm"); initDataSource(); asignDataSource(); initComponents(); setPersonsToListModel(); jProgressBar.setVisible(false); }
From source file:com.dominion.salud.pedicom.configuration.PEDICOMInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.scan("com.dominion.salud.pedicom.configuration"); ctx.setServletContext(servletContext); PEDICOMConstantes._NOMBRE_CONFIG = servletContext.getInitParameter("NOMBRE_CONFIG"); System.setProperty("pedicom.conf.home", findConfigurationAndLogger(ctx)); ctx.refresh();//from w w w .java 2 s . c o m // Spring Dispatcher ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dispatcher.setInitParameter("contextClass", ctx.getClass().getName()); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); dispatcher.addMapping("/controller/*"); servletContext.addListener(new ContextLoaderListener(ctx)); // Configuracion general PEDICOMConstantes._HOME = StringUtils.endsWith(servletContext.getRealPath("/"), File.separator) ? servletContext.getRealPath("/") : servletContext.getRealPath("/") + File.separator; PEDICOMConstantes._CONF_HOME = ctx.getEnvironment().getProperty("pedicom.conf.home"); PEDICOMConstantes._TEMP = PEDICOMConstantes._HOME + "WEB-INF" + File.separator + "temp" + File.separator; PEDICOMConstantes._VERSION = ResourceBundle.getBundle("version").getString("version"); PEDICOMConstantes._LOGS = PEDICOMConstantes._HOME + "WEB-INF" + File.separator + "classes" + File.separator + "logs"; PEDICOMConstantes._CONTEXT_NAME = servletContext.getServletContextName(); PEDICOMConstantes._CONTEXT_PATH = servletContext.getContextPath(); PEDICOMConstantes._CONTEXT_SERVER = servletContext.getServerInfo(); PEDICOMConstantes._ENABLE_TECHNICAL_INFORMATION = StringUtils.isNotBlank( ResourceBundle.getBundle("application").getString("pedicom.enable.technical.information")) ? Boolean.parseBoolean(ResourceBundle.getBundle("application") .getString("pedicom.enable.technical.information")) : false; PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON = StringUtils .isNotBlank(ResourceBundle.getBundle("application").getString("pedicom_scheduler_send_mail_cron")) ? PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON = ResourceBundle.getBundle("application") .getString("pedicom_scheduler_send_mail_cron") : PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON; PEDICOMConstantes._SCHEDULER_UPDATE_EXISTENCIAS_CRON = StringUtils.isNotBlank( ResourceBundle.getBundle("application").getString("pedicom_scheduler_update_existencias_cron")) ? PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON = ResourceBundle.getBundle("application") .getString("pedicom_scheduler_update_existencias_cron") : PEDICOMConstantes._SCHEDULER_UPDATE_EXISTENCIAS_CRON; // Configuracion de LOGS DEL MODULO if (StringUtils.isBlank( ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile())) { ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")) .setFile(PEDICOMConstantes._HOME + "WEB-INF" + File.separator + "classes" + File.separator + "logs" + File.separator + "mpr-desktop.log"); } PEDICOMConstantes._LOGS = new File( ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile()) .getParent(); Environment env = ctx.getEnvironment(); XmlUnmarshaler xml = new XmlUnmarshaler(); Datos datos = (Datos) xml.unmarshal(); logger.info(" Datasources"); for (Datasources dat : datos.getDatasources()) { if (dat.getNombreDatasource().equals("Central")) { PEDICOMConstantes.EXISTENCIAS_EXISTE = true; } logger.info(" codCentro: " + dat.getCodCentro()); logger.info(" nombreDatasource: " + dat.getNombreDatasource()); logger.info(" driverClassName: " + dat.getDriverClassName()); logger.info(" jndi: " + dat.getJndi()); logger.info(" url: " + dat.getUrl()); logger.info(" username: " + dat.getUsername()); logger.info(" usernameEmail: " + dat.getUsernameEmail()); logger.info(" passwordEmail: " + dat.getPasswordEmail()); logger.info(" from: " + dat.getFrom()); logger.info(" host: " + dat.getHost()); logger.info(" port: " + dat.getPort()); logger.info(" TLS: " + dat.getTLS()); logger.info(" SSL: " + dat.getSSL()); } // ctx.refresh(); // PropertyConfigurator.configureAndWatch("log4j"); logger.info(" Configuracion general del sistema"); logger.info(" pedicom.home: " + PEDICOMConstantes._HOME); logger.info(" pedicom.conf.home: " + PEDICOMConstantes._CONF_HOME); logger.info(" pedicom.temp: " + PEDICOMConstantes._TEMP); logger.info(" pedicom.version: " + PEDICOMConstantes._VERSION); logger.info(" pedicom.logs: " + PEDICOMConstantes._LOGS); logger.info(" pedicom.context.name: " + PEDICOMConstantes._CONTEXT_NAME); logger.info(" pedicom.context.path: " + PEDICOMConstantes._CONTEXT_PATH); logger.info(" pedicom.context.server: " + PEDICOMConstantes._CONTEXT_SERVER); logger.info(" Parametrizacion del sistema"); logger.info(" pedicom.enable.technical.information: " + PEDICOMConstantes._ENABLE_TECHNICAL_INFORMATION); logger.info( " pedicom_scheduler_send_mail_cron: " + PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON); logger.info(" pedicom_scheduler_update_existencias_cron: " + PEDICOMConstantes._SCHEDULER_UPDATE_EXISTENCIAS_CRON); logger.info(" Modulo configurado correctamente"); logger.info("MODULO INICIADO CORRECTAMENTE"); }
From source file:esmska.gui.AboutFrame.java
/** This method is called from within the constructor to * initialize the form./* w w w . j ava2s . com*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new JLabel(); jLabel2 = new JLabel(); jLabel3 = new JLabel(); creditsButton = new JButton(); closeButton = new JButton(); licenseButton = new JButton(); jLabel5 = new JLabel(); jLabel4 = new JLabel(); jLabel6 = new JLabel(); jLabel7 = new JLabel(); jLabel8 = new JLabel(); homeHyperlink = new JXHyperlink(); supportHyperlink = new JXHyperlink(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); ResourceBundle bundle = ResourceBundle.getBundle("esmska/resources/l10n"); // NOI18N setTitle(bundle.getString("AboutFrame.title")); // NOI18N setLocationByPlatform(true); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/esmska.png"))); // NOI18N jLabel1.setFocusable(false); jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() | Font.BOLD, jLabel2.getFont().getSize() + 22)); jLabel2.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(jLabel2, "Esmska " + config.getLatestVersion()); jLabel2.setFocusable(false); jLabel3.setHorizontalAlignment(SwingConstants.CENTER); Mnemonics.setLocalizedText(jLabel3, bundle.getString("AboutFrame.jLabel3.text")); // NOI18N jLabel3.setFocusable(false); creditsButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/about-22.png"))); // NOI18N Mnemonics.setLocalizedText(creditsButton, bundle.getString("AboutFrame.creditsButton.text")); creditsButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { creditsButtonActionPerformed(evt); } }); closeButton.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/close-22.png"))); // NOI18N Mnemonics.setLocalizedText(closeButton, bundle.getString("Close_")); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeButtonActionPerformed(evt); } }); Mnemonics.setLocalizedText(licenseButton, bundle.getString("AboutFrame.licenseButton.text")); licenseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { licenseButtonActionPerformed(evt); } }); jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getSize() - 2f)); jLabel5.setHorizontalAlignment(SwingConstants.CENTER); jLabel5.setIcon(new ImageIcon(getClass().getResource("/esmska/resources/copyleft-12.png"))); // NOI18N Mnemonics.setLocalizedText(jLabel5, bundle.getString("AboutFrame.jLabel5.text")); // NOI18N jLabel5.setFocusable(false); setURI(homeHyperlink, Links.getURI(Links.HOMEPAGE)); Mnemonics.setLocalizedText(homeHyperlink, l10n.getString("AboutFrame.homeHyperlink.text")); homeHyperlink.setToolTipText(l10n.getString("AboutFrame.homeHyperlink.toolTipText")); // NOI18N setURI(supportHyperlink, Links.getURI(Links.DONATE)); Mnemonics.setLocalizedText(supportHyperlink, l10n.getString("AboutFrame.supportHyperlink.text")); supportHyperlink.setToolTipText(l10n.getString("AboutFrame.supportHyperlink.toolTipText")); // NOI18N GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(jLabel5, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(homeHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(supportHyperlink, Alignment.CENTER, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(jLabel2, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addComponent(jLabel1, Alignment.CENTER, GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup().addComponent(creditsButton) .addPreferredGap(ComponentPlacement.RELATED).addComponent(licenseButton) .addPreferredGap(ComponentPlacement.RELATED, 151, Short.MAX_VALUE) .addComponent(closeButton)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4, GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE) .addGap(108, 108, 108) .addComponent(jLabel6, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel8, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE) .addGap(138, 138, 138) .addComponent(jLabel7, GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE))) .addContainerGap())); layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { closeButton, creditsButton, licenseButton }); layout.setVerticalGroup( layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addGap(18, 18, 18) .addComponent(jLabel2).addPreferredGap(ComponentPlacement.RELATED) .addComponent(jLabel3).addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(jLabel5).addGap(18, 18, 18) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel4).addComponent(jLabel6)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel7).addComponent(jLabel8))) .addComponent(homeHyperlink, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(supportHyperlink, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 48, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(creditsButton) .addComponent(closeButton).addComponent(licenseButton)) .addContainerGap())); layout.linkSize(SwingConstants.VERTICAL, new Component[] { jLabel4, jLabel6 }); layout.linkSize(SwingConstants.VERTICAL, new Component[] { closeButton, creditsButton, licenseButton }); pack(); }
From source file:mSearch.tool.Functions.java
public static String getBuildNr() { final ResourceBundle rb; String propToken = "BUILD"; String msg = ""; try {/*from w w w. j a v a2s . c o m*/ ResourceBundle.clearCache(); rb = ResourceBundle.getBundle("version"); msg = rb.getString(propToken); } catch (Exception e) { Log.errorLog(134679898, e); } return msg; }
From source file:JAXRPublishConcept.java
/** * Establishes a connection to a registry. *//from w w w . ja va 2 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. * 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) { } } } }