List of usage examples for java.util ResourceBundle getBundle
@CallerSensitive public static final ResourceBundle getBundle(String baseName)
From source file:ctd.services.getCleanData2.java
public String cleanData() { String message = ""; String timestamp = new java.util.Date().getTime() + ""; try {/*w w w.j a v a 2 s .c o m*/ CleanDataResult result = new CleanDataResult(); String error_message = ""; //get parameters. ResourceBundle res = ResourceBundle.getBundle("settings"); ResourceBundle cdf_list = ResourceBundle.getBundle("cdf"); //Base directory ftp folder: Here the temporary subfolders are found for each set of CEL-files, and the final assaytoken-based folder. String ftp_folder = res.getString("ws.upload_folder"); String rscript_cleandata = res.getString("ws.rscript_cleandata"); String rscript = res.getString("ws.rscript"); //db String db_username = res.getString("db.username"); String db_password = res.getString("db.password"); String db_database = res.getString("db.database"); //retrieve the information on the assignment from the database SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); Transaction tr = session.beginTransaction(); Query q = session.createQuery( "from Ticket where password='" + getPassword() + "' AND ctd_REF='" + getCTD_REF() + "'"); Ticket ticket = null; String closed = ""; if (q.list().size() != 0) { ticket = (Ticket) q.list().get(0); closed = ticket.getClosed(); } if (ticket == null) { error_message = "Ticket password and CTD_REF don't match."; } if (closed.equals("yes")) { error_message = "Ticket is already used for normalization of these CEL-files."; ticket = null; } if (ticket != null) { //get the folder String folder = ticket.getFolder(); String zip_folder = ftp_folder + folder; //get contents File dir = new File(zip_folder); //find the zip file. File[] files = dir.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isFile(); } }); String cel_zip_file = ""; String zip_file = ""; String gct_file = ""; for (int i = 0; i < files.length; i++) { String file = files[i].getName(); if (file.contains("zip")) { // Add the timestamp to the zip files[i].renameTo(new File(zip_folder + "/" + timestamp + "_zip.zip")); file = timestamp + "_zip.zip"; cel_zip_file = file; zip_file = zip_folder + "/" + cel_zip_file; gct_file = zip_folder + "/" + timestamp + "_gctfile"; } } Process p3 = Runtime.getRuntime().exec("chmod 777 " + zip_file); ////////////////////////////////////////////////////////////////// //Do a system call to normalize. R. (zip_folder zip_file gct_file rscript) String args = rscript + " --verbose --vanilla " + rscript_cleandata + " -i" + zip_file + " -o" + gct_file + " -w" + zip_folder; Logger.getLogger(getTicket.class.getName()).log(Level.INFO, timestamp + ": Running: " + args); Process p = Runtime.getRuntime().exec(args); // Check if CEL files are unzipped allready // This is done by checking every 5 seconds for the existence of a .chip file // This is a bad way of doing this, in future versions of CTD // the output of the R scripts should be parsed boolean do_loop = true; while (do_loop) { File dir2 = new File(zip_folder); String[] files2 = dir2.list(); //Check if CEL files are allready there for (int i = 0; i < files2.length; i++) { String file = files2[i]; if (file.endsWith("chip")) { do_loop = false; try { Thread.sleep(5000); } catch (InterruptedException ex) { Logger.getLogger(getCleanData.class.getName()).log(Level.SEVERE, null, timestamp + ": " + ex); } } } } Logger.getLogger(getTicket.class.getName()).log(Level.INFO, timestamp + ": rscript has finished."); File dir2 = new File(zip_folder); String[] files2 = dir2.list(); String chip_file = ""; String chip_file_db = ""; ArrayList<String> unziped_files = new ArrayList<String>(); for (int i = 0; i < files2.length; i++) { String file = files2[i]; if (file.endsWith("CEL")) { unziped_files.add(file); } if (file.endsWith("chip")) { chip_file = file; chip_file_db = chip_file.split("_CDF_")[1]; File fileFile = new File(chip_file); fileFile.renameTo(new File(zip_folder + "/" + chip_file_db)); //Making the file correspond to the database entry. Duplicates can be safely overwritten, and will be. } } //Check if all CEL files are derived from the same chip. //This is essential for normalization. //initiate check hashmap. This map contains all the unique chip definition file names. There should be only one per analysis. ArrayList<StudySampleAssay> map = new ArrayList<StudySampleAssay>(); for (int i = 0; i < unziped_files.size(); i++) { String cel_file = unziped_files.get(i); StudySampleAssay ssa = new StudySampleAssay(); // Open the file that is the first // command line parameter //String cel_file_path = zip_folder + "/" + cel_file; String name = cel_file; ssa.setNameRawfile(name); ssa.setXREF(getCTD_REF()); map.add(ssa); } ticket.getStudySampleAssaies().addAll(map); session.saveOrUpdate(ticket); session.persist(ticket); tr.commit(); session.close(); //Storage chip definition file (CDF), creation gct file and database storage. SessionFactory sessionFactory1 = new Configuration().configure().buildSessionFactory(); Session session1 = sessionFactory1.openSession(); //check if cdf (chip definition file) is allready stored, if not, store it. List<ChipAnnotation> chip_annotation = null; Query q2 = session1.createQuery("from Chip Where Name='" + chip_file_db + "'"); if (q2.uniqueResult() != null) { Chip chip = (Chip) q2.list().get(0); chip_annotation = chip.getChipAnnotation(); } if (q2.uniqueResult() == null) { //Add this chip and its annotation Chip chip_new = new Chip(); chip_new.setName(chip_file_db); //read chip file String chip_file_path = zip_folder + "/" + chip_file; chip_annotation = readChip(chip_file_path); //Store the whole chip_new.getChipAnnotation().addAll(chip_annotation); Transaction tr1 = session1.beginTransaction(); session1.save(chip_new); session1.persist(chip_new); tr1.commit(); session1.close(); } //create the temp file for storage of the data_insert file. String data_file = zip_folder + "/expression.txt"; FileOutputStream out = null; PrintStream pr = null; out = new FileOutputStream(data_file); pr = new PrintStream(out); //create array data input file for the database table, find correct foreign keys. //get the study_sample_assay id and the probeset ids. SessionFactory sessionFactory2 = new Configuration().configure().buildSessionFactory(); Session session2 = sessionFactory2.openSession(); //Get the cip_annotation_id Query q3 = session2.createQuery("from Chip Where Name='" + chip_file_db + "'"); Chip chip = (Chip) q3.list().get(0); chip_annotation = chip.getChipAnnotation(); Iterator it2 = chip_annotation.iterator(); //for speed, put the chip annotation id in a hashmap HashMap<String, String> chip_annotation_ids = new HashMap<String, String>(); while (it2.hasNext()) { ChipAnnotation ca = (ChipAnnotation) it2.next(); String id = ca.getId().toString(); String ps = ca.getProbeset(); chip_annotation_ids.put(ps, id); } //Create the .gct-files try { Query qt = session2.createQuery("from Ticket where password='" + getPassword() + "' AND ctd_REF='" + getCTD_REF() + "'"); ticket = null; if (qt.list().size() != 0) { ticket = (Ticket) qt.list().get(0); } Iterator it3 = ticket.getStudySampleAssaies().iterator(); while (it3.hasNext()) { StudySampleAssay ssa = (StudySampleAssay) it3.next(); String name_raw_file = ssa.getNameRawfile(); String sampleToken = getSampletokens().get(name_raw_file); String ssa_id = ssa.getId().toString(); error_message = error_message + name_raw_file; String gct_file_generated = gct_file + ".gct"; ArrayList<Double> values = writeFile(pr, chip_annotation_ids, ssa_id, gct_file_generated, name_raw_file.replaceAll(".CEL", "")); Statistics stat = new Statistics(); stat.setData(values); Double average = stat.getAverage(); Double std = stat.getSTD(); ssa.setXREF(getCTD_REF()); ssa.setAverage(average); ssa.setStudyToken(getStudytoken()); ssa.setSampleToken(sampleToken); ssa.setStd(std); } } catch (IOException e) { Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, timestamp + ": ERROR IN getCleanData2: " + e.getMessage() + " " + e.getLocalizedMessage()); } pr.close(); out.close(); //update ticket Transaction tr2 = session2.beginTransaction(); session2.update(ticket); session2.persist(ticket); tr2.commit(); session2.close(); //import the data into the database String u = "--user=" + db_username; String passw = "--password=" + db_password; String[] commands = new String[] { "mysqlimport", u, passw, "--local", db_database, data_file }; Process p4 = Runtime.getRuntime().exec(commands); message = message + " RMA and GRSN on the CEL-files is done, data is stored."; //close the ticket when finished, normalization can only be performed once by the client. CloseTicket(); //Remove zip and data file (expression.txt) File fileFolderOld = new File(zip_folder); File fileFolderDest = new File(res.getString("ws.upload_folder") + getCTD_REF()); File[] listOfFiles = fileFolderOld.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].getPath().toLowerCase().endsWith(".zip") || listOfFiles[i].getPath().toLowerCase().endsWith("expression.txt")) { try { listOfFiles[i].delete(); } catch (Exception e) { Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, timestamp + ": ERROR IN getCleanData2 (try to delete): " + e.toString()); } } else { try { FileUtils.copyFileToDirectory(listOfFiles[i], fileFolderDest, false); listOfFiles[i].delete(); } catch (Exception e) { Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, timestamp + ": ERROR IN getCleanData2 (try to copy): " + e.toString()); } } } // Remove temporary folder try { fileFolderOld.delete(); } catch (Exception e) { Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, timestamp + ": ERROR IN getCleanData2: " + e.toString()); } // -------------------------------------------- // This piece of code is added in order to cleanup all the files // of aborted upload procedures. It checks for these old folders // (more than a day old and a temporaty name (which is just a number // from 1 upwards. It is assumed that a temporary folder has a // name shorter than 10 chars) and removes these files and folders File folderData = new File(res.getString("ws.upload_folder")); long lngTimestamp = new java.util.Date().getTime(); listOfFiles = folderData.listFiles(); for (int i = 0; i < listOfFiles.length; i++) { if (listOfFiles[i].lastModified() < (lngTimestamp - 10000) && listOfFiles[i].getName().length() < 10) { // This folder is more than a day old // We know it is a temporary folder because the name is less than 10 chars long File[] lstDelete = listOfFiles[i].listFiles(); for (int j = 0; j < lstDelete.length; j++) { // Delete all content of the old folder lstDelete[j].delete(); } // Delete the old folder if (!listOfFiles[i].delete()) { Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, "delSample(): Folder deletion failed: " + listOfFiles[i].getName()); } } } // -------------------------------------------- } // set the messages of the response result.setErrorMessage(error_message); result.setMessage(message); // Use SKARINGA in order to create the JSON response ObjectTransformer trans = null; try { trans = ObjectTransformerFactory.getInstance().getImplementation(); message = trans.serializeToString(result); } catch (NoImplementationException ex) { Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, "SKARINGA ERROR IN getCleanData2: " + ex.getLocalizedMessage()); } } catch (Exception e) { Logger.getLogger(getTicket.class.getName()).log(Level.SEVERE, timestamp + ": ERROR IN getCleanData2: " + e.toString()); } return message; }
From source file:gemlite.core.internal.admin.service.ConfService.java
/** * ?sever?//from w w w . j av a 2 s .c om * * @param cache * @return */ public String getSystemInfo(Cache cache) { StringBuilder sb = new StringBuilder(); String ip = System.getProperty(ITEMS.BINDIP.name()); // 1.??log sb.append("\n===================================================================\n"); DistributedMember member = cache.getDistributedSystem().getDistributedMember(); sb.append("IP:" + ip + " host:" + member.getHost() + "\n"); sb.append("node:" + System.getProperty(ITEMS.NODE_NAME.name()) + "\n"); sb.append("server ID:" + member.getId() + "\n"); sb.append("server logLevel:" + cache.getLogger().getHandler().getLevel().getName() + "\n"); // sb.append("log4j logLevel:" + Logger.get Logger.getRootLogger().getLevel().toString() + "\n"); String location = System.getenv("GS_WORK"); if (StringUtils.isEmpty(location)) { try { ResourceBundle bundle = ResourceBundle.getBundle("env"); location = bundle.getString("GS_WORK"); } catch (Exception e) { LogUtil.getAppLog().error("env:" + e.getMessage()); } } // ??work sb.append("disk:" + location + "\n"); return sb.toString(); }
From source file:com.balero.controllers.UsersController.java
@RequestMapping(value = "/register", method = RequestMethod.POST) public String register(RedirectAttributes redirectAttributes, @RequestParam("username") String username, @RequestParam("password") String password, @RequestParam("name") String lastname, @RequestParam("email") String email) { UsersDAO.register(username, password, lastname, email, "user"); ResourceBundle bundle = ResourceBundle.getBundle("messages"); redirectAttributes.addFlashAttribute("message", bundle.getString("label.login.registerok")); return "redirect:/"; }
From source file:com.dominion.salud.mpr.configuration.MPRInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.scan("com.dominion.salud.mpr.configuration"); ctx.setServletContext(servletContext); System.setProperty("mpr.conf.home", findConfigurationAndLogger(ctx)); ctx.refresh();// w w w. j a v a 2s . c o m ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); dispatcher.addMapping("/controller/*"); dispatcher.addMapping("/services/*"); servletContext.addListener(new ContextLoaderListener(ctx)); // Configuracion GENERAL DEL MODULO MPRConstantes._MPR_HOME = StringUtils.endsWith(servletContext.getRealPath("/"), File.separator) ? servletContext.getRealPath("/") : servletContext.getRealPath("/") + File.separator; MPRConstantes._MPR_CONF_HOME = ctx.getEnvironment().getProperty("mpr.conf.home"); MPRConstantes._MPR_VERSION = ResourceBundle.getBundle("version").getString("version"); MPRConstantes._MPR_RESOURCES = MPRConstantes._MPR_HOME + "resources" + File.separator; MPRConstantes._MPR_TEMP = MPRConstantes._MPR_HOME + "WEB-INF" + File.separator + "temp" + File.separator; MPRConstantes._MPR_CONTEXT_NAME = servletContext.getServletContextName(); MPRConstantes._MPR_CONTEXT_PATH = servletContext.getContextPath(); MPRConstantes._MPR_CONTEXT_SERVER = servletContext.getServerInfo(); // 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(MPRConstantes._MPR_HOME + "WEB-INF" + File.separator + "classes" + File.separator + "logs" + File.separator + "mpr-desktop.log"); } MPRConstantes._MPR_LOGS = new File( ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile()) .getParent(); // Parametrizacion GENERAL DEL SISTEMA MPRConstantes._ENABLE_TECHNICAL_INFORMATION = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.enable.technical.information")) ? Boolean.parseBoolean(ctx.getEnvironment().getProperty("mpr.enable.technical.information")) : false; // Parametrizacion de CONEXION A EMPI MPRConstantes._EMPI_ENABLE = StringUtils.isNotBlank(ctx.getEnvironment().getProperty("mpr.empi.enable")) ? Boolean.parseBoolean(ctx.getEnvironment().getProperty("mpr.empi.enable")) : false; MPRConstantes._EMPI_USUARIO = StringUtils.isNotBlank(ctx.getEnvironment().getProperty("mpr.empi.usuario")) ? ctx.getEnvironment().getProperty("mpr.empi.usuario") : ""; MPRConstantes._EMPI_SISTEMA = StringUtils.isNotBlank(ctx.getEnvironment().getProperty("mpr.empi.sistema")) ? ctx.getEnvironment().getProperty("mpr.empi.sistema") : ""; MPRConstantes._EMPI_URL = StringUtils.isNotBlank(ctx.getEnvironment().getProperty("mpr.empi.url")) ? ctx.getEnvironment().getProperty("mpr.empi.url") : ""; // Parametrizacion de TAREAS PROGRAMADAS MPRConstantes._TASK_BUZON_IN_PROCESS_MESSAGES = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.in.process.messages")) ? ctx.getEnvironment().getProperty("mpr.task.buzon.in.process.messages") : MPRConstantes._TASK_BUZON_IN_PROCESS_MESSAGES; MPRConstantes._TASK_BUZON_OUT_PROCESS_MESSAGES = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.out.process.messages")) ? ctx.getEnvironment().getProperty("mpr.task.buzon.out.process.messages") : MPRConstantes._TASK_BUZON_OUT_PROCESS_MESSAGES; MPRConstantes._TASK_BUZON_IN_HIS_CLEAN = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.in.his.clean")) ? ctx.getEnvironment().getProperty("mpr.task.buzon.in.his.clean") : MPRConstantes._TASK_BUZON_IN_HIS_CLEAN; MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.out.his.clean")) ? ctx.getEnvironment().getProperty("mpr.task.buzon.out.his.clean") : MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN; MPRConstantes._TASK_BUZON_IN_HIS_CLEAN_OLD = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.in.his.clean.old")) ? Integer.parseInt(ctx.getEnvironment().getProperty("mpr.task.buzon.in.his.clean.old")) : MPRConstantes._TASK_BUZON_IN_HIS_CLEAN_OLD; MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN_OLD = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.out.his.clean.old")) ? Integer.parseInt(ctx.getEnvironment().getProperty("mpr.task.buzon.out.his.clean.old")) : MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN_OLD; MPRConstantes._TASK_BUZON_IN_CLEAN = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.in.clean")) ? ctx.getEnvironment().getProperty("mpr.task.buzon.in.clean") : MPRConstantes._TASK_BUZON_IN_CLEAN; MPRConstantes._TASK_BUZON_OUT_CLEAN = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.out.clean")) ? ctx.getEnvironment().getProperty("mpr.task.buzon.out.clean") : MPRConstantes._TASK_BUZON_OUT_CLEAN; MPRConstantes._TASK_BUZON_ERRORES_CLEAN = StringUtils .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.errores.clean")) ? ctx.getEnvironment().getProperty("mpr.task.buzon.errores.clean") : MPRConstantes._TASK_BUZON_ERRORES_CLEAN; logger.info("Iniciando el modulo de [" + MPRConstantes._MPR_CONTEXT_NAME + "]"); logger.debug(" Configuracion GENERAL DEL MODULO"); logger.debug(" mpr.home: " + MPRConstantes._MPR_HOME); logger.debug(" mpr.conf.home: " + MPRConstantes._MPR_CONF_HOME); logger.debug(" mpr.version: " + MPRConstantes._MPR_VERSION); logger.debug(" mpr.resources: " + MPRConstantes._MPR_RESOURCES); logger.debug(" mpr.temp: " + MPRConstantes._MPR_TEMP); logger.debug(" mpr.logs: " + MPRConstantes._MPR_LOGS); logger.debug(" mpr.logs.file: " + ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile()); logger.debug(" mpr.context.name: " + MPRConstantes._MPR_CONTEXT_NAME); logger.debug(" mpr.context.path: " + MPRConstantes._MPR_CONTEXT_PATH); logger.debug(" mpr.context.server: " + MPRConstantes._MPR_CONTEXT_SERVER); logger.debug(" java.version: " + ctx.getEnvironment().getProperty("java.version")); logger.debug(""); logger.debug(" Parametrizacion GENERAL DEL SISTEMA"); logger.debug(" mpr.enable.technical.information: " + MPRConstantes._ENABLE_TECHNICAL_INFORMATION); logger.debug(" Parametrizacion de CONEXION A EMPI"); logger.debug(" mpr.empi.enable: " + MPRConstantes._EMPI_ENABLE); logger.debug(" mpr.empi.usuario: " + MPRConstantes._EMPI_USUARIO); logger.debug(" mpr.empi.sistema: " + MPRConstantes._EMPI_SISTEMA); logger.debug(" mpr.empi.url: " + MPRConstantes._EMPI_URL); logger.debug(" Parametrizacion de TAREAS PROGRAMADAS"); logger.debug( " mpr.task.buzon.in.process.messages: " + MPRConstantes._TASK_BUZON_IN_PROCESS_MESSAGES); logger.debug( " mpr.task.buzon.out.process.messages: " + MPRConstantes._TASK_BUZON_OUT_PROCESS_MESSAGES); logger.debug(" mpr.task.buzon.in.his.clean: " + MPRConstantes._TASK_BUZON_IN_HIS_CLEAN); logger.debug(" mpr.task.buzon.out.his.clean: " + MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN); logger.debug(" mpr.task.buzon.in.his.clean.old: " + MPRConstantes._TASK_BUZON_IN_HIS_CLEAN_OLD); logger.debug(" mpr.task.buzon.out.his.clean.old: " + MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN_OLD); logger.debug(" mpr.task.buzon.in.clean: " + MPRConstantes._TASK_BUZON_IN_CLEAN); logger.debug(" mpr.task.buzon.out.clean: " + MPRConstantes._TASK_BUZON_OUT_CLEAN); logger.debug(" mpr.task.buzon.errores.clean: " + MPRConstantes._TASK_BUZON_ERRORES_CLEAN); logger.debug(" Variables de ENTORNO de utilidad"); logger.debug(" catalina.home: " + ctx.getEnvironment().getProperty("catalina.home")); logger.debug(" jboss.home.dir: " + ctx.getEnvironment().getProperty("jboss.home.dir")); logger.info("Modulo [" + MPRConstantes._MPR_CONTEXT_NAME + "] iniciado correctamente"); }
From source file:it.doqui.index.ecmengine.client.engine.EcmEngineDirectDelegateImpl.java
protected EcmEngineManagementBusinessInterface createManagementService() throws Throwable { this.log.debug("[" + getClass().getSimpleName() + "::createManagementService] BEGIN "); Properties properties = new Properties(); /* Caricamento del file contenenti le properties su cui fare il binding */ rb = ResourceBundle.getBundle(ECMENGINE_PROPERTIES_FILE); /*//from w ww . jav a 2 s. c om * Caricamento delle proprieta' su cui fare il binding all'oggetto di business delle funzionalita' * implementate per il management. */ try { this.log.debug( "[" + getClass().getSimpleName() + "::createManagementService] P-Delegata di backoffice."); this.log.debug("[" + getClass().getSimpleName() + "::createManagementService] context factory vale : " + rb.getString(ECMENGINE_CONTEXT_FACTORY)); properties.put(Context.INITIAL_CONTEXT_FACTORY, rb.getString(ECMENGINE_CONTEXT_FACTORY)); this.log.debug("[" + getClass().getSimpleName() + "::createManagementService] url to connect vale : " + rb.getString(ECMENGINE_URL_TO_CONNECT)); properties.put(Context.PROVIDER_URL, rb.getString(ECMENGINE_URL_TO_CONNECT)); /* Controllo che la property cluster partition sia valorizzata per capire se * sto lavorando in una configurazione in cluster oppure no */ String clusterPartition = rb.getString(ECMENGINE_CLUSTER_PARTITION); this.log.debug("[" + getClass().getSimpleName() + "::createManagementService] clusterPartition vale : " + clusterPartition); if (clusterPartition != null && clusterPartition.length() > 0) { properties.put("jnp.partitionName", clusterPartition); this.log.debug( "[" + getClass().getSimpleName() + "::createManagementService] disable discovery vale : " + rb.getString(ECMENGINE_DISABLE_DISCOVERY)); properties.put("jnp.disableDiscovery", rb.getString(ECMENGINE_DISABLE_DISCOVERY)); } // Get an initial context InitialContext jndiContext = new InitialContext(properties); log.debug("[" + getClass().getSimpleName() + "::createManagementService] context istanziato"); // Get a reference to the Bean Object ref = jndiContext.lookup(ECMENGINE_MANAGEMENT_JNDI_NAME); // Get a reference from this to the Bean's Home interface EcmEngineManagementHome home = (EcmEngineManagementHome) PortableRemoteObject.narrow(ref, EcmEngineManagementHome.class); // Create an Adder object from the Home interface return home.create(); } catch (Throwable e) { this.log.error("[" + getClass().getSimpleName() + "::createManagementService] " + "Impossibile istanziare la P-Delegata di management: " + e.getMessage()); throw e; } finally { this.log.debug("[" + getClass().getSimpleName() + "::createManagementService] END "); } }
From source file:com.siapa.managedbean.JaulaManangedBean.java
@Override public void delete(ActionEvent event) { String msg = ResourceBundle.getBundle("/crudbundle").getString(Jaula.class.getSimpleName() + "Deleted"); persist(PersistAction.DELETE, msg);//from ww w . ja va 2 s .c om tipoJaulaList = tipoJaulaService.findAllActives(); setSuma(this.jaulaService.sumAllJ()); toCreateJaula(); if (!isValidationFailed()) { items = null; // Invalidate list of items to trigger re-query. } }
From source file:es.urjc.mctwp.service.Command.java
/** * It creates a new command and retrieves user business logic * /*from w ww. j av a2 s . c om*/ * @param bf */ public Command(BeanFactory bf) { if (bf != null) { // Get ResourceBundle messages = ResourceBundle.getBundle("es.urjc.mctwp.resources.messages_en"); try { factory = bf; userUtils = (UserUtils) bf.getBean(BeanNames.USER_UTILS); } catch (Exception e) { } } }
From source file:cz.nn.copytables.gui.CopyTablesGUI.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Rudolf Rada ResourceBundle bundle = ResourceBundle.getBundle("locale"); menuBar = new JMenuBar(); menuFile = new JMenu(); menuItemOpenFile = new JMenuItem(); menuItemCloseFile = new JMenuItem(); menuItemConfig = new JMenuItem(); menuHelp = new JMenu(); menuItemHelp = new JMenuItem(); menuItemAbout = new JMenuItem(); CellConstraints cc = new CellConstraints(); //======== this ======== setBackground(new Color(204, 255, 204)); // JFormDesigner evaluation mark setBorder(/*ww w . jav a2s .c om*/ new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), getBorder())); addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); setLayout(new FormLayout("default", "default, $lgap, default")); //======== menuBar ======== { //======== menuFile ======== { menuFile.setText(bundle.getString("CopyTablesGUI.menuFile.text")); //---- menuItemOpenFile ---- menuItemOpenFile.setText(bundle.getString("CopyTablesGUI.menuItemOpenFile.text")); menuItemOpenFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItem2ActionPerformed(e); } }); menuFile.add(menuItemOpenFile); //---- menuItemCloseFile ---- menuItemCloseFile.setText(bundle.getString("CopyTablesGUI.menuItemCloseFile.text")); menuItemCloseFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItem3ActionPerformed(e); } }); menuFile.add(menuItemCloseFile); //---- menuItemConfig ---- menuItemConfig.setText(bundle.getString("CopyTablesGUI.menuItemConfig.text")); menuItemConfig.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItem4ActionPerformed(e); } }); menuFile.add(menuItemConfig); } menuBar.add(menuFile); //======== menuHelp ======== { menuHelp.setText(bundle.getString("CopyTablesGUI.menuHelp.text")); //---- menuItemHelp ---- menuItemHelp.setText(bundle.getString("CopyTablesGUI.menuItemHelp.text")); menuItemHelp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItemHelpActionPerformed(e); } }); menuHelp.add(menuItemHelp); //---- menuItemAbout ---- menuItemAbout.setText(bundle.getString("CopyTablesGUI.menuItemAbout.text")); menuItemAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { menuItemAboutActionPerformed(e); } }); menuHelp.add(menuItemAbout); } menuBar.add(menuHelp); } add(menuBar, cc.xy(1, 1)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:io.github.benas.todolist.web.servlet.user.LoginServlet.java
@Override public void init(ServletConfig servletConfig) throws ServletException { //initialize Spring user service ApplicationContext applicationContext = WebApplicationContextUtils .getWebApplicationContext(servletConfig.getServletContext()); userService = applicationContext.getBean(UserService.class); //initialize JSR 303 validator ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator();//from w ww .j a v a 2s . c o m resourceBundle = ResourceBundle.getBundle("todolist"); }
From source file:de.mendelson.comm.as2.message.AS2MessageCreation.java
public AS2MessageCreation(CertificateManager signatureCertManager, CertificateManager encryptionCertManager) { //Load resourcebundle try {/* ww w . jav a2 s .c o m*/ this.rb = (MecResourceBundle) ResourceBundle.getBundle(ResourceBundleAS2MessagePacker.class.getName()); this.rbMessage = (MecResourceBundle) ResourceBundle.getBundle(ResourceBundleAS2Message.class.getName()); } //load up resourcebundle catch (MissingResourceException e) { throw new RuntimeException("Oops..resource bundle " + e.getClassName() + " not found."); } this.signatureCertManager = signatureCertManager; this.encryptionCertManager = encryptionCertManager; }