List of usage examples for java.util Hashtable Hashtable
public Hashtable()
From source file:edu.utah.further.osgi.shell.SpringApplicationListener.java
/** * @param bundleContext//w ww.ja va 2 s . c om */ public SpringApplicationListener(final BundleContext bundleContext) { this.states = new ConcurrentHashMap<>(); this.bundleContext = bundleContext; this.bundleContext.addBundleListener(this); this.registration = this.bundleContext.registerService(OsgiBundleApplicationContextListener.class.getName(), this, new Hashtable<>()); }
From source file:com.cyclopsgroup.waterview.tool.PopulateToolsValve.java
/** * Override or implement method of parent class or interface * /*www . j a v a 2 s . c om*/ * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration conf) throws ConfigurationException { int repoSize = conf.getChild("application-tools").getAttributeAsInteger("size", -1); if (repoSize <= 0) { applicationTools = new Hashtable(); } else { applicationTools = new LRUMap(repoSize); } Configuration[] toolConfs = conf.getChild("tools").getChildren("tool"); toolDefinitions = ListOrderedMap.decorate(new Hashtable(toolConfs.length)); for (int i = 0; i < toolConfs.length; i++) { Configuration toolConf = toolConfs[i]; ToolDef def = new ToolDef(toolConf); toolDefinitions.put(def.name, def); } }
From source file:net.hardisonbrewing.signingserver.service.SigStatusService.java
public static Hashtable parse(JSONArray sigs) throws JSONException { int length = sigs.length(); if (length == 0) { return null; }/*from w w w .jav a2 s.com*/ Hashtable result = new Hashtable(); for (int i = 0; i < length; i++) { JSONObject sig = sigs.getJSONObject(i); SigStatus _status = new SigStatus(); _status.sig = sig.getString("sig"); _status.success = sig.getBoolean("success"); _status.repeat = sig.getInt("repeat"); _status.speed = sig.getDouble("speed"); _status.aspeed = sig.getDouble("aspeed"); _status.date = sig.getLong("date"); result.put(_status.sig, _status); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("Received sig["); stringBuffer.append(_status.sig); stringBuffer.append("], success["); stringBuffer.append(_status.success); stringBuffer.append("], repeat["); stringBuffer.append(_status.repeat); stringBuffer.append("], speed["); stringBuffer.append(_status.speed); stringBuffer.append("], aspeed["); stringBuffer.append(_status.aspeed); stringBuffer.append("], date["); stringBuffer.append(_status.date); stringBuffer.append("]"); SigservApplication.logEvent(stringBuffer.toString()); } return result; }
From source file:it.unipmn.di.dcs.sharegrid.web.management.ManagementEnv.java
/** Initialized the JNDI. */ protected void initJNDI() throws ManagementException { try {//from w w w. j a v a2s. co m this.ctxFactoryBuild = new ManagementContextFactoryBuilder(); NamingManager.setInitialContextFactoryBuilder(this.ctxFactoryBuild); NamingManager.setObjectFactoryBuilder(this.ctxFactoryBuild); // Initial environment with various properties Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.INITIAL_CONTEXT_FACTORY, ManagementContextFactory.class.getName()); //env.put(Context.PROVIDER_URL, ""); //env.put(Context.OBJECT_FACTORIES, "foo.bar.ObjFactory"); env.put(Context.URL_PKG_PREFIXES, ManagementContextFactory.class.getPackage().getName()); this.initCtx = new InitialContext(env); Context javaCompCtx = (Context) this.getOrCreateSubcontext("java:comp", initCtx); if (javaCompCtx == null) { throw new ManagementException("JNDI problem. Cannot get java:comp context from InitialContext."); } Context envCtx = (Context) this.getOrCreateSubcontext("env", javaCompCtx); if (envCtx == null) { throw new ManagementException("JNDI problem. Cannot get env context from java:comp context."); } Context jdbcCtx = (Context) this.getOrCreateSubcontext("jdbc", envCtx); if (jdbcCtx == null) { throw new ManagementException("JNDI problem. Cannot get jdbc context from java:comp/env context."); } // Create the DataSource //Properties properties = new Properties(); //properties.put( "driverClassName", "com.mysql.jdbc.Driver" ); //properties.put( "url", "jdbc:mysql://localhost:3306/DB" ); //properties.put( "username", "username" ); //properties.put( "password", "********" ); // //DataSource dataSource = BasicDataSourceFactory.createDataSource( properties ); //initContext.bind( "java:comp/env/jdbc/db", dataSource ); //Reference ref = new Reference( "javax.sql.DataSource", "org.apache.commons.dbcp.BasicDataSourceFactory", null ); //ref.add(new StringRefAddr("driverClassName", "com.mysql.jdbc.Driver")); //ref.add(new StringRefAddr("url", "jdbc:mysql://localhost:3306/sharegrid")); //ref.add(new StringRefAddr("username", "root")); //ref.add(new StringRefAddr("password", "")); //initCtx.rebind( "java:comp/env/jdbc/mysql", ref ); java.util.Properties properties = new java.util.Properties(); properties.put("driverClassName", "com.mysql.jdbc.Driver"); properties.put("url", "jdbc:mysql://localhost:3306/sharegrid"); properties.put("username", "root"); properties.put("password", ""); javax.sql.DataSource dataSource = org.apache.commons.dbcp.BasicDataSourceFactory .createDataSource(properties); initCtx.rebind("java:comp/env/jdbc/mysql", dataSource); } catch (Exception ex) { throw new ManagementException("JNDI problem.", ex); } }
From source file:com.alfaariss.oa.sso.web.profile.logout.LogoutState.java
/** * Constructor.//from w w w .j a v a 2s . c o m * @param sessionFactory The TGT Factory. * @param sessionID The logout session id. */ public LogoutState(ISessionFactory sessionFactory, String sessionID) { _logger = LogFactory.getLog(LogoutState.class); _sessionFactory = sessionFactory; _sSessionID = sessionID; _htResults = new Hashtable<String, List<TGTEventError>>(); _iSize = 0; _bFinished = false; }
From source file:eu.seaclouds.platform.discoverer.crawler.CloudTypes.java
public CloudHarmonyCrawler() { /* json parser */ this.jsonParser = new JSONParser(); /* client init */ this.httpclient = HttpClients.createDefault(); /* mapping booleans */ this.booleans = new Hashtable<String, String>(); this.booleans.put("autoScaling", "auto_scaling"); this.booleans.put("selfHostable", "self_hostable"); this.booleans.put("apiRestricted", "api_restricted"); this.booleans.put("autoFailover", "auto_failover"); this.booleans.put("processPricing", "process_pricing"); this.booleans.put("vmBased", "vm_based"); /* mapping numbers */ this.numbers = new Hashtable<String, String>(); this.numbers.put("cpuCores", "num_cpus"); this.numbers.put("localDisks", "num_disks"); this.numbers.put("memory", "ram"); this.numbers.put("localStorage", "disk_size"); /* mapping strings */ this.strings = new Hashtable<String, String>(); this.strings.put("localDiskType", "disk_type"); }
From source file:edu.csun.ecs.cs.multitouchj.application.whiteboard.ui.InteractiveCanvas.java
public InteractiveCanvas() { super();/*from w ww. j a v a 2 s . c om*/ previousPoints = new Hashtable<Integer, LinkedList<Point>>(); previousTimes = new Hashtable<Integer, Long>(); pens = new Hashtable<Integer, Pen>(); setDirty(true); }
From source file:com.alfaariss.oa.engine.user.provisioning.translator.standard.StandardProfile.java
/** * Creates the object./* w ww.ja v a 2 s . co m*/ */ public StandardProfile() { _logger = LogFactory.getLog(StandardProfile.class); _htProfile = new Hashtable<String, ProfileItem>(); }
From source file:unalcol.termites.boxplots.BestAgentsRoundInfoCollected.java
/** * Creates a new demo.//from ww w. j av a 2 s . c o m * * @param title the frame title. * @param pf */ public BestAgentsRoundInfoCollected(final String title, ArrayList<Double> pf) { super(title); String sDirectorio = experimentsDir; Hashtable<String, List> info = new Hashtable(); /*for (String mode : aMode) { info.put(mode, new ArrayList()); }*/ createSampleDataset(pf, info); AddDataFailingExperiments(sDirectorio, pf, info); final BoxAndWhiskerCategoryDataset dataset = addDataSet(info); System.out.println("info" + info); final CategoryAxis xAxis = new CategoryAxis(""); //final NumberAxis yAxis = new NumberAxis("Information Collected"); final NumberAxis yAxis = new NumberAxis(""); yAxis.setAutoRangeIncludesZero(false); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setFillBox(false); renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); Font font = new Font("Dialog", Font.PLAIN, 13); xAxis.setTickLabelFont(font); yAxis.setTickLabelFont(font); yAxis.setLabelFont(font); final JFreeChart chart = new JFreeChart("Round of Best Agents " + getTitle(pf), new Font("SansSerif", Font.BOLD, 18), plot, true); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(650, 370)); setContentPane(chartPanel); TextTitle legendText = null; if (pf.size() == 1) { legendText = new TextTitle("Population Size"); } else { legendText = new TextTitle("Population Size - Probability of Failure"); } legendText.setFont(font); legendText.setPosition(RectangleEdge.BOTTOM); chart.addSubtitle(legendText); chart.getLegend().setItemFont(font); FileOutputStream output; try { output = new FileOutputStream("BestAgentsRound" + pf + mazeMode + ".jpg"); ChartUtilities.writeChartAsJPEG(output, 1.0f, chart, 450, 350, null); } catch (FileNotFoundException ex) { Logger.getLogger(BestAgentsRoundInfoCollected.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(BestAgentsRoundInfoCollected.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.autentia.intra.manager.billing.BillManager.java
/** * Account DAO */*from www. j a v a2s .c o m*/ */ public List<BillBreakDown> getAllBitacoreBreakDowns(Date start, Date end, Set<ProjectRole> roles, Set<ProjectCost> costes) { List<BillBreakDown> desgloses = new ArrayList<BillBreakDown>(); ActivityDAO activityDAO = ActivityDAO.getDefault(); ActivitySearch actSearch = new ActivitySearch(); actSearch.setBillable(new Boolean(true)); actSearch.setStartStartDate(start); actSearch.setEndStartDate(end); List<Activity> actividadesTotal = new ArrayList<Activity>(); Hashtable user_roles = new Hashtable(); for (ProjectRole proyRole : roles) { actSearch.setRole(proyRole); List<Activity> actividades = activityDAO.search(actSearch, new SortCriteria("startDate", false)); actividadesTotal.addAll(actividades); } for (Activity act : actividadesTotal) { String key = act.getRole().getId().toString() + act.getUser().getId().toString(); if (!user_roles.containsKey(key)) { Hashtable value = new Hashtable(); value.put("ROLE", act.getRole()); value.put("USER", act.getUser()); user_roles.put(key, value); } } Enumeration en = user_roles.keys(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); Hashtable pair = (Hashtable) user_roles.get(key); actSearch.setBillable(new Boolean(true)); actSearch.setStartStartDate(start); actSearch.setEndStartDate(end); ProjectRole pR = (ProjectRole) pair.get("ROLE"); User u = (User) pair.get("USER"); actSearch.setRole(pR); actSearch.setUser(u); List<Activity> actividadesUsuarioRol = activityDAO.search(actSearch, new SortCriteria("startDate", false)); BillBreakDown brd = new BillBreakDown(); brd.setConcept("Imputaciones (usuario - rol): " + u.getName() + " - " + pR.getName()); brd.setAmount(pR.getCostPerHour()); brd.setIva(new BigDecimal(ConfigurationUtil.getDefault().getIva())); BigDecimal unitsTotal = new BigDecimal(0); for (Activity act : actividadesUsuarioRol) { BigDecimal unitsActual = new BigDecimal(act.getDuration()); unitsActual = unitsActual.divide(new BigDecimal(60), 2, RoundingMode.HALF_UP); unitsTotal = unitsTotal.add(unitsActual); } brd.setUnits(unitsTotal); brd.setSelected(true); desgloses.add(brd); } for (ProjectCost proyCost : costes) { BillBreakDown brd = new BillBreakDown(); brd.setConcept("Coste: " + proyCost.getName()); brd.setUnits(new BigDecimal(1)); brd.setAmount(proyCost.getCost()); brd.setIva(new BigDecimal(ConfigurationUtil.getDefault().getIva())); brd.setSelected(true); desgloses.add(brd); } return desgloses; }