List of usage examples for java.util Properties put
@Override public synchronized Object put(Object key, Object value)
From source file:com.cssweb.android.common.CssIniFile.java
public static boolean saveIniWithAPPEND(Context context, int parmInt, String key, String value) { FileOutputStream fileOut = null; Properties properties = new Properties(); properties.put(key, value); try {//w ww. jav a2 s .co m fileOut = context.openFileOutput(GetFileName(parmInt), Context.MODE_APPEND);// properties.store(fileOut, ""); fileOut.close(); } catch (FileNotFoundException e) { return false; } catch (IOException e) { return false; } return true; }
From source file:com.yirendai.sqoop.worker.PropertyConfigurer.java
/** * Get properties starting with a specified string. */// w w w . j a va2 s .c o m public static Properties getPropertiesStartingWith(String startingWith) { Properties props = new Properties(); for (Enumeration it = config.keys(); it.hasMoreElements();) { String key = (String) it.nextElement(); props.put(key, config.get(key)); } return props; }
From source file:corner.orm.gae.GaeModule.java
public static EntityManagerFactory buildEntityManagerFactory( @Autobuild DatastorePersistenceProvider persistenceProvider) { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setPersistenceProvider(persistenceProvider); Properties jpaProperties = new Properties(); jpaProperties.put("datanucleus.NontransactionalRead", "true"); jpaProperties.put("datanucleus.NontransactionalWrite", "true"); jpaProperties.put("datanucleus.ConnectionURL", "appengine"); jpaProperties.put("datanucleus.jpa.addClassTransformer", "false"); entityManagerFactoryBean.setJpaProperties(jpaProperties); LoadTimeWeaver loadTimeWeaver = new SimpleLoadTimeWeaver(); entityManagerFactoryBean.setLoadTimeWeaver(loadTimeWeaver); entityManagerFactoryBean.afterPropertiesSet(); return entityManagerFactoryBean.getObject(); }
From source file:org.opennms.ng.services.collectd.DefaultCollectionAgentService.java
/** * <p>create</p>// w w w .ja v a 2 s .c o m * * @param ifaceId a {@link Integer} object. * @param ifaceDao a {@link org.opennms.netmgt.dao.api.IpInterfaceDao} object. * @param transMgr a {@link org.springframework.transaction.PlatformTransactionManager} object. * @return a {@link CollectionAgentService} object. */ public static CollectionAgentService create(Integer ifaceId, final OnmsIpInterfaceDao ifaceDao, final PlatformTransactionManager transMgr) { CollectionAgentService agent = new DefaultCollectionAgentService(ifaceId, ifaceDao); TransactionProxyFactoryBean bean = new TransactionProxyFactoryBean(); bean.setTransactionManager(transMgr); bean.setTarget(agent); Properties props = new Properties(); props.put("*", "PROPAGATION_REQUIRED,readOnly"); bean.setTransactionAttributes(props); bean.afterPropertiesSet(); return (CollectionAgentService) bean.getObject(); }
From source file:com.cssweb.android.common.CssIniFile.java
public static void saveIni(Context context, int parmInt, String key, String value) { FileOutputStream fileOut = null; Properties properties = new Properties(); properties.put(key, value); try {/*w w w . jav a 2s . co m*/ fileOut = context.openFileOutput(GetFileName(parmInt), Context.MODE_PRIVATE);// properties.store(fileOut, ""); } catch (FileNotFoundException e) { } catch (IOException e) { } finally { try { fileOut.close(); } catch (IOException e) { e.printStackTrace(); } } }
From source file:com.mimp.hibernate.HiberMail.java
public static void generateAndSendEmail2(String correo, String pass_plano, String user) { final String username = "formacionadopcion@gmail.com"; final String password = "cairani."; Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); }//from w ww.j a v a 2 s . co m }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("formacionadopcion@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(correo)); message.setSubject("Sistema de adopciones"); message.setText("Estimado solicitante," + "\n\n Bienvenido al SISTEMA INFORM?TICO DEL REGISTRO NACIONAL DE ADOPCIONES, " + "sus credenciales para inscribirse al taller son las siguientes:" + "\n\n Usuario: " + user + "\n\n Contrasea: " + pass_plano // + "\n\n Para ingresar al sistema realizar lo siguiente, " // + "\n\n" // + "\n\n" // + "\n\n A. Click directamente en el siguiente link: " // + "\n\n" // + "\n\n 1. Click: http://app.mimp.gob.pe:8080/sirna " // + "\n\n 2. Ingresar con el usuario y contrasea mencionadas lneas arriba. " // + "\n\n" // + "\n\n B. En caso no funcione el link, ingresar al sistema desde la pgina web: " // + "\n\n" // + "\n\n 1. Ingresar a la pgina web: www.mimp.gob.pe " // + "\n\n 2. En la barra de men Direcciones Generales? submen Vicemin. Pob. Vulnerables? seleccionar Adopciones? " // + "\n\n 3. Click en SIRNA Sistema Informtico del Registro Nacional de Adopciones? " // + "\n\n 4. Ingresar con el usuario y contrasea mencionadas lneas arriba. " // + "\n\n" // + "\n\n A travs del SIRNA usted podr realizar las siguientes acciones: " // + "\n\n" // + "\n\n - Inscribirse a uno de los talleres programados. " // + "\n\n - Descargar las lecturas de su taller. " // + "\n\n - Revisar el estado del proceso de adopcin. " // + "\n\n - Cambiar su contrasea. " // + "\n\n" // + "\n\n Para continuar con el proceso, por favor ingresar al sistema e inscribirse a uno de los talleres programados, hasta un da antes de inicio del taller y/o las bacantes se " // + "\n\n encuentres disponibles. " + "\n\n" + "\n\n De tener alguna complicacin y no fue posible su ingreso al sistema, comunicarse inmediatamente con la unidad de adopcin correspondiente. " + "\n\n" + "\n\n Atentamente, " + "\n\n" + "\n\n Direccin General de Adopciones " + "\n\n" + "\n\n Ministerio de la Mujer y Poblaciones Vulnerables " + "\n\n "); Transport.send(message); /* } catch (Exception ex) { */ } catch (Exception ex) { } /*catch (MessagingException e) { throw new RuntimeException(e); }*/ }
From source file:uk.ac.cam.cl.dtg.picky.client.analytics.Analytics.java
private static void fillProperties(Properties properties, ObservableList<TreeItem<String>> entrySelection) { if (entrySelection == null) return;/*from w w w. j ava2 s .c o m*/ entrySelection.forEach(e -> { properties.put(KEY_ENTRY_SELECTION + e.getValue(), "selected"); }); }
From source file:de.iritgo.aktario.client.gui.UserLoginHelper.java
/** *///from w w w.j a va2s .co m public static boolean login(final UserLoginPane loginPane, final String server, final String username, final String password, final boolean remember, final boolean autoLogin) { AppContext.instance().setServerIP(server); connectAndGo(username, password, loginPane); final FlowControl flowControl = Engine.instance().getFlowControl(); flowControl.add(new FrameworkFlowRule("UserLogin", null, null) { @Override public void success() { flowControl.clear(); AktarioGUI gui = (AktarioGUI) Client.instance().getClientGUI(); new Thread(new Runnable() { public void run() { try { InputStream input = new URL("http://" + server + "/autoupdate.jar").openStream(); String workingDirPath = Engine.instance().getSystemDir(); IOUtils.copy(input, FileUtils.openOutputStream(new File( workingDirPath + System.getProperty("file.separator") + "autoupdate.jar"))); } catch (Exception x) { } }; }).start(); gui.show(); gui.setStatusUser(username + "@" + server); Engine.instance().getSystemProperties().setProperty("lastlogin", username + "@" + server); if (loginPane != null) { if (remember) { loginPane.rememberAccount(); } else { loginPane.removeAccount(); } if (autoLogin) { loginPane.rememberAutoLogin(); } } } @Override public void failure(Object arg) { int failure = ((Integer) arg).intValue(); Client.instance().getNetworkService().closeAllChannels(); if (failure == UserLoginFailureAction.USER_ALREADY_ONLINE) { setCompleteState(false); Properties props = new Properties(); props.put("failure", arg); Command cmd = new ShowDialog("AktarioUserLoginFailureDialog"); cmd.setProperties(props); CommandTools.performSimple(cmd); try { Thread.sleep(10000); } catch (Exception x) { } connectAndGo(username, password, loginPane); return; } if (failure == UserLoginFailureAction.LOGIN_NOT_ALLOWED) { setCompleteState(false); Properties props = new Properties(); props.put("failure", arg); Command cmd = new ShowDialog("AktarioUserLoginFailureDialog"); cmd.setProperties(props); CommandTools.performSimple(cmd); return; } if (failure == UserLoginFailureAction.BAD_USERNAME_OR_PASSWORD) { setCompleteState(false); Properties props = new Properties(); props.put("failure", arg); Command cmd = new ShowDialog("AktarioUserLoginFailureDialog"); cmd.setProperties(props); CommandTools.performSimple(cmd); return; } } }); flowControl.add(new FrameworkFlowRule("WrongVersion", null, null) { @Override public void success() { flowControl.clear(); Client.instance().getNetworkService().closeAllChannels(); JOptionPane.showMessageDialog(loginPane != null ? loginPane.getPanel() : null, Engine.instance().getResourceService().getStringWithoutException("wrongClientVersion"), Engine.instance().getResourceService().getStringWithoutException("systemMessage"), JOptionPane.OK_OPTION); try { String workingDirPath = Engine.instance().getSystemDir(); if (workingDirPath.endsWith("\\")) { workingDirPath = workingDirPath.substring(0, workingDirPath.length() - 1); } @SuppressWarnings("unused") Process proc = Runtime.getRuntime() .exec("java" + " -jar \"" + workingDirPath + Engine.instance().getFileSeparator() + "autoupdate.jar\" http://" + AppContext.instance().getServerIP() + "/update.jar" + " \"" + workingDirPath + "\""); } catch (Exception x) { JOptionPane.showMessageDialog(loginPane != null ? loginPane.getPanel() : null, x.toString(), "Iritgo", JOptionPane.OK_OPTION); } System.exit(0); } }); return false; }
From source file:com.idega.hibernate.HibernateUtil.java
private static Properties getProperties() { Properties prop = new Properties(); if (ConnectionBroker.isUsingIdegaPool()) { PoolManager pmgr = PoolManager.getInstance(); prop.put("hibernate.connection.driver_class", pmgr.getDriverClassForPool()); prop.put("hibernate.connection.url", pmgr.getURLForPool()); prop.put("hibernate.connection.username", pmgr.getUserNameForPool()); prop.put("hibernate.connection.password", pmgr.getPasswordForPool()); detectDialect(prop);//w w w. jav a 2 s . co m } else if (ConnectionBroker.isUsingJNDIDatasource()) { String prefix = "java:comp/env/"; prop.put("hibernate.connection.datasource", prefix + ConnectionBroker.getDefaultJNDIUrl()); detectDialect(prop); } prop.put("hibernate.cache.provider_class", IWCacheProvider.class.getName()); return prop; }
From source file:com.glaf.core.config.Environment.java
public static Properties getSystemPropertiesByName(String name) { Properties props = systemProperties.get(name); Properties p = new Properties(); Enumeration<?> e = props.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); String value = props.getProperty(key); p.put(key, value); }/*from w w w . j a v a 2 s .c om*/ return p; }