Java Code Examples for java.util.Hashtable

The following are top voted examples for showing how to use java.util.Hashtable. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: lams   File: AcceptLanguage.java   View source code 8 votes vote down vote up
private static void extractLocales(Hashtable languages, Vector q,Vector l)
{
    // XXX We will need to order by q value Vector in the Future ?
    Enumeration e = q.elements();
    while (e.hasMoreElements()) {
        Vector v =
            (Vector)languages.get(((Double)e.nextElement()).toString());
        Enumeration le = v.elements();
        while (le.hasMoreElements()) {
	        String language = (String)le.nextElement();
     	String country = "";
    		int countryIndex = language.indexOf("-");
            if (countryIndex > -1) {
                country = language.substring(countryIndex + 1).trim();
                language = language.substring(0, countryIndex).trim();
            }
            l.addElement(new Locale(language, country));
        }
    }
}
 
Example 2
Project: jdk8u-jdk   File: Permissions.java   View source code 6 votes vote down vote up
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the permsMap field out as a Hashtable for
 * serialization compatibility with earlier releases. allPermission
 * unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<Class<?>, PermissionCollection> perms =
        new Hashtable<>(permsMap.size()*2); // no sync; estimate
    synchronized (this) {
        perms.putAll(permsMap);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();

    pfields.put("allPermission", allPermission); // no sync; staleness OK
    pfields.put("perms", perms);
    out.writeFields();
}
 
Example 3
Project: the-vigilantes   File: DataSourceTest.java   View source code 6 votes vote down vote up
/**
 * This method is separated from the rest of the example since you normally
 * would NOT register a JDBC driver in your code. It would likely be
 * configered into your naming and directory service using some GUI.
 * 
 * @throws Exception
 *             if an error occurs
 */
private void registerDataSource() throws Exception {
    this.tempDir = File.createTempFile("jnditest", null);
    this.tempDir.delete();
    this.tempDir.mkdir();
    this.tempDir.deleteOnExit();

    com.mysql.jdbc.jdbc2.optional.MysqlDataSource ds;
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
    env.put(Context.PROVIDER_URL, this.tempDir.toURI().toString());
    this.ctx = new InitialContext(env);
    assertTrue("Naming Context not created", this.ctx != null);
    ds = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource();
    ds.setUrl(dbUrl); // from BaseTestCase
    this.ctx.bind("_test", ds);
}
 
Example 4
Project: openhab-tado   File: TadoHandlerFactory.java   View source code 6 votes vote down vote up
@Override
protected ThingHandler createHandler(Thing thing) {
    ThingTypeUID thingTypeUID = thing.getThingTypeUID();

    if (thingTypeUID.equals(THING_TYPE_HOME)) {
        TadoHomeHandler tadoHomeHandler = new TadoHomeHandler((Bridge) thing);

        TadoDiscoveryService discoveryService = new TadoDiscoveryService(tadoHomeHandler);
        bundleContext.registerService(DiscoveryService.class.getName(), discoveryService,
                new Hashtable<String, Object>());

        return tadoHomeHandler;
    } else if (thingTypeUID.equals(THING_TYPE_ZONE)) {
        return new TadoZoneHandler(thing);
    } else if (thingTypeUID.equals(THING_TYPE_MOBILE_DEVICE)) {
        return new TadoMobileDeviceHandler(thing);
    }

    return null;
}
 
Example 5
Project: AndroidBasicLibs   File: EncodingHandler.java   View source code 6 votes vote down vote up
public static Bitmap createQRCode(String str,int widthAndHeight) throws WriterException {
	Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>();  
       hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); 
	BitMatrix matrix = new MultiFormatWriter().encode(str,
			BarcodeFormat.QR_CODE, widthAndHeight, widthAndHeight);
	int width = matrix.getWidth();
	int height = matrix.getHeight();
	int[] pixels = new int[width * height];
	
	for (int y = 0; y < height; y++) {
		for (int x = 0; x < width; x++) {
			if (matrix.get(x, y)) {
				pixels[y * width + x] = BLACK;
			}
		}
	}
	Bitmap bitmap = Bitmap.createBitmap(width, height,
			Bitmap.Config.ARGB_8888);
	bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
	return bitmap;
}
 
Example 6
Project: OpenJSharp   File: ForwardValueGen.java   View source code 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, ForwardValueEntry v, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.v = v;

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  generateStub ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
}
 
Example 7
Project: parabuild-ci   File: jdbcDataSourceFactory.java   View source code 6 votes vote down vote up
/**
 * Creates a jdbcDatasource object using the location or reference
 * information specified.<p>
 *
 * The Reference object should support the properties, database, user,
 * password.
 *
 * @param obj The reference information used in creating a
 *      jdbcDatasource object.
 * @param name ignored
 * @param nameCtx ignored
 * @param environment ignored
 * @return A newly created jdbcDataSource object; null if an object
 *      cannot be created.
 * @exception Exception never
 */
public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                Hashtable environment) throws Exception {

    String    dsClass = "org.hsqldb.jdbc.jdbcDataSource";
    Reference ref     = (Reference) obj;

    if (ref.getClassName().equals(dsClass)) {
        jdbcDataSource ds = new jdbcDataSource();

        ds.setDatabase((String) ref.get("database").getContent());
        ds.setUser((String) ref.get("user").getContent());
        ds.setPassword((String) ref.get("password").getContent());

        return ds;
    } else {
        return null;
    }
}
 
Example 8
Project: jerrydog   File: CGIProcessEnvironment.java   View source code 6 votes vote down vote up
/**
 * Creates a ProcessEnvironment and derives the necessary environment,
 * working directory, command, etc.
 * @param req             HttpServletRequest for information provided by
 *                        the Servlet API
 * @param context         ServletContext for information provided by
 *                        the Servlet API
 * @param cgiPathPrefix   subdirectory of webAppRootDir below which the
 *                        web app's CGIs may be stored; can be null or "".
 * @param  debug          int debug level (0 == none, 6 == lots)
 */
public CGIProcessEnvironment(HttpServletRequest req,
    ServletContext context, String cgiPathPrefix, int debug) {
        super(req, context, debug);
        this.cgiPathPrefix = cgiPathPrefix;
        queryParameters = new Hashtable();
        Enumeration paramNames = req.getParameterNames();
        while (paramNames != null && paramNames.hasMoreElements()) {
            String param = paramNames.nextElement().toString();
            if (param != null) {
                queryParameters.put(param,
                    URLEncoder.encode(req.getParameter(param)));
            }
        }
        this.valid = deriveProcessEnvironment(req);
}
 
Example 9
Project: openjdk-jdk10   File: PartialCompositeContext.java   View source code 6 votes vote down vote up
public Object lookup(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    Object answer;
    Name nm = name;

    try {
        answer = ctx.p_lookup(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_lookup(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.lookup(e.getRemainingName());
    }
    return answer;
}
 
Example 10
Project: TuLiPA-frames   File: Environment.java   View source code 6 votes vote down vote up
/**
 * method merging env into nenv
 * 
 * @throws UnifyException
 */
public static void addBindings(Environment env, Environment nenv)
        throws UnifyException {
    Hashtable<String, Value> eTable = env.getTable();
    Set<String> keys = eTable.keySet();
    Iterator<String> it = keys.iterator();
    while (it.hasNext()) {
        // we look if the variable is bound
        String eVar = it.next();
        Value val = new Value(Value.VAR, eVar);
        Value eVal = env.deref(val);
        if (!(eVal.equals(val))) {
            // if it is, we unify the bound values in the new environment
            Value.unify(val, eVal, nenv);
        }
    }
}
 
Example 11
Project: joai-project   File: RepositoryManager.java   View source code 6 votes vote down vote up
/**
 *  Gets all possible metadata formats that may be disiminated by this RepositoryManager. This includes
 *  formats that are available by conversion from the native format via the XMLConversionService.
 *
 * @return    The metadataFormats available.
 * @see       #getConfiguredFormats
 */
public final Hashtable getAvailableFormats() {
	if (index.getLastModifiedCount() > formatsLastUpdatedTime) {
		formatsLastUpdatedTime = index.getLastModifiedCount();

		formats.clear();
		List indexedFormats = index.getTerms("metadatapfx");
		if (indexedFormats == null)
			return formats;
		String format = null;
		for (int i = 0; i < indexedFormats.size(); i++) {
			format = (String) indexedFormats.get(i);
			// remove the '0' in the doctype
			format = format.substring(1, format.length());
			formats.putAll(getMetadataFormatsConversions(format));
		}
	}
	return formats;
}
 
Example 12
Project: EARLGREY   File: QueryBuilder.java   View source code 6 votes vote down vote up
public void select(Hashtable<String,Field> params){
	ArrayList<String> param_list = new ArrayList<String>(); 
	Enumeration<String> llaves = params.keys();
	while(llaves.hasMoreElements()){
		String llave = llaves.nextElement();
		if(GEOM.class.isAssignableFrom(params.get(llave).getType())){
			param_list.add(GEOM.GetSQL(llave));
		}
		else if(CENTROID.class.isAssignableFrom(params.get(llave).getType())){
			param_list.add(CENTROID.GetSQL(llave));
		}
		else
		{
			param_list.add(llave);
		}
	}
	String parametros = String.join(",", param_list);
	this.query = "SELECT "+parametros+" FROM "+this.table;
}
 
Example 13
Project: ProyectoPacientes   File: DataSourceTest.java   View source code 6 votes vote down vote up
/**
 * This method is separated from the rest of the example since you normally
 * would NOT register a JDBC driver in your code. It would likely be
 * configered into your naming and directory service using some GUI.
 * 
 * @throws Exception
 *             if an error occurs
 */
private void registerDataSource() throws Exception {
    this.tempDir = File.createTempFile("jnditest", null);
    this.tempDir.delete();
    this.tempDir.mkdir();
    this.tempDir.deleteOnExit();

    com.mysql.jdbc.jdbc2.optional.MysqlDataSource ds;
    Hashtable<String, String> env = new Hashtable<String, String>();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
    env.put(Context.PROVIDER_URL, this.tempDir.toURI().toString());
    this.ctx = new InitialContext(env);
    assertTrue("Naming Context not created", this.ctx != null);
    ds = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource();
    ds.setUrl(dbUrl); // from BaseTestCase
    this.ctx.bind("_test", ds);
}
 
Example 14
Project: jdk8u-jdk   File: DirectoryManager.java   View source code 6 votes vote down vote up
/**
  * Creates a context in which to continue a <tt>DirContext</tt> operation.
  * Operates just like <tt>NamingManager.getContinuationContext()</tt>,
  * only the continuation context returned is a <tt>DirContext</tt>.
  *
  * @param cpe
  *         The non-null exception that triggered this continuation.
  * @return A non-null <tt>DirContext</tt> object for continuing the operation.
  * @exception NamingException If a naming exception occurred.
  *
  * @see NamingManager#getContinuationContext(CannotProceedException)
  */
@SuppressWarnings("unchecked")
public static DirContext getContinuationDirContext(
        CannotProceedException cpe) throws NamingException {

    Hashtable<Object,Object> env = (Hashtable<Object,Object>)cpe.getEnvironment();
    if (env == null) {
        env = new Hashtable<>(7);
    } else {
        // Make a (shallow) copy of the environment.
        env = (Hashtable<Object,Object>) env.clone();
    }
    env.put(CPE, cpe);

    return (new ContinuationDirContext(cpe, env));
}
 
Example 15
Project: gemini.blueprint   File: OsgiServiceDynamicInterceptorListenerTest.java   View source code 6 votes vote down vote up
public void testStickinessWhenABetterServiceIsAvailable() throws Exception {
	interceptor.setSticky(true);
	interceptor.afterPropertiesSet();

	ServiceListener sl = (ServiceListener) bundleContext.getServiceListeners().iterator().next();

	Dictionary props = new Hashtable();
	// increase service ranking
	props.put(Constants.SERVICE_RANKING, 10);

	ServiceReference ref = new MockServiceReference(null, props, null);
	ServiceEvent event = new ServiceEvent(ServiceEvent.REGISTERED, ref);

	assertEquals(1, SimpleTargetSourceLifecycleListener.BIND);
	assertEquals(0, SimpleTargetSourceLifecycleListener.UNBIND);

	sl.serviceChanged(event);

	assertEquals("the proxy is not sticky", 1, SimpleTargetSourceLifecycleListener.BIND);
	assertEquals(0, SimpleTargetSourceLifecycleListener.UNBIND);
}
 
Example 16
Project: ide-plugins   File: UiPlugin.java   View source code 5 votes vote down vote up
private void registerServices(BundleContext context) {
    // store services with low ranking such that they can be overridden
    // during testing or the like
    Dictionary<String, Object> preferences = new Hashtable<String, Object>();
    preferences.put(Constants.SERVICE_RANKING, 1);

    Dictionary<String, Object> priorityPreferences = new Hashtable<String, Object>();
    priorityPreferences.put(Constants.SERVICE_RANKING, 2);

    // register all services (override the ProcessStreamsProvider registered in the core plugin)
    this.loggerService = registerService(context, Logger.class, createLogger(), preferences);
}
 
Example 17
Project: openjdk-jdk10   File: CoreDocumentImpl.java   View source code 5 votes vote down vote up
/**
 * @serialData Serialized fields. Convert Maps to Hashtables for backward
 * compatibility.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Convert Maps to Hashtables
    Hashtable<Node, Hashtable<String, UserDataRecord>> nud = null;
    if (nodeUserData != null) {
        nud = new Hashtable<>();
        for (Map.Entry<Node, Map<String, UserDataRecord>> e : nodeUserData.entrySet()) {
            //e.getValue() will not be null since an entry is always put with a non-null value
            nud.put(e.getKey(), new Hashtable<>(e.getValue()));
        }
    }

    Hashtable<String, Node> ids = (identifiers == null)? null : new Hashtable<>(identifiers);
    Hashtable<Node, Integer> nt = (nodeTable == null)? null : new Hashtable<>(nodeTable);

    // Write serialized fields
    ObjectOutputStream.PutField pf = out.putFields();
    pf.put("docType", docType);
    pf.put("docElement", docElement);
    pf.put("fFreeNLCache", fFreeNLCache);
    pf.put("encoding", encoding);
    pf.put("actualEncoding", actualEncoding);
    pf.put("version", version);
    pf.put("standalone", standalone);
    pf.put("fDocumentURI", fDocumentURI);

    //userData is the original name. It has been changed to nodeUserData, refer to the corrsponding @serialField
    pf.put("userData", nud);
    pf.put("identifiers", ids);
    pf.put("changes", changes);
    pf.put("allowGrammarAccess", allowGrammarAccess);
    pf.put("errorChecking", errorChecking);
    pf.put("ancestorChecking", ancestorChecking);
    pf.put("xmlVersionChanged", xmlVersionChanged);
    pf.put("documentNumber", documentNumber);
    pf.put("nodeCounter", nodeCounter);
    pf.put("nodeTable", nt);
    pf.put("xml11Version", xml11Version);
    out.writeFields();
}
 
Example 18
Project: unitimes   File: Student.java   View source code 5 votes vote down vote up
public static Hashtable<Long,Set<Long>> findConflictingStudents(Long classId, int startSlot, int length, List<Date> dates) {
	Hashtable<Long,Set<Long>> table = new Hashtable();
	if (dates.isEmpty()) return table;
	String datesStr = "";
	for (int i=0; i<dates.size(); i++) {
		if (i>0) datesStr += ", ";
		datesStr += ":date"+i;
	}
	Query q = LocationDAO.getInstance().getSession()
	    .createQuery("select distinct e.clazz.uniqueId, e.student.uniqueId "+
	        	"from StudentClassEnrollment e, ClassEvent c inner join c.meetings m, StudentClassEnrollment x "+
	        	"where x.clazz.uniqueId=:classId and x.student=e.student and " + // only look among students of the given class 
	        	"e.clazz=c.clazz and " + // link ClassEvent c with StudentClassEnrollment e
        		"m.stopPeriod>:startSlot and :endSlot>m.startPeriod and " + // meeting time within given time period
        		"m.meetingDate in ("+datesStr+") and m.approvalStatus = 1")
        .setLong("classId",classId)
        .setInteger("startSlot", startSlot)
        .setInteger("endSlot", startSlot + length);
	for (int i=0; i<dates.size(); i++) {
		q.setDate("date"+i, dates.get(i));
	}
    for (Iterator i = q.setCacheable(true).list().iterator();i.hasNext();) {
        Object[] o = (Object[])i.next();
        Set<Long> set = table.get((Long)o[0]);
        if (set==null) {
        	set = new HashSet<Long>();
        	table.put((Long)o[0], set);
        }
        set.add((Long)o[1]);
    }
    return table;
}
 
Example 19
Project: OpenJSharp   File: FeatureDescriptor.java   View source code 5 votes vote down vote up
/**
 * Returns the initialized attribute table.
 *
 * @return the initialized attribute table
 */
private Hashtable<String, Object> getTable() {
    if (this.table == null) {
        this.table = new Hashtable<>();
    }
    return this.table;
}
 
Example 20
Project: creoson   File: JLJsonGeometryHandler.java   View source code 5 votes vote down vote up
public Hashtable<String, Object> handleFunction(String sessionId, String function, Hashtable<String, Object> input) throws JLIException {
	if (function==null)
		return null;
	
	if (function.equals(FUNC_BOUND_BOX)) return actionBoundingBox(sessionId, input);
	else if (function.equals(FUNC_GET_SURFACES)) return actionGetSurfaces(sessionId, input);
	else if (function.equals(FUNC_GET_EDGES)) return actionGetEdges(sessionId, input);
	else {
		throw new JLIException("Unknown function name: " + function);
	}
}
 
Example 21
Project: logistimo-web-service   File: AuthenticateOutput.java   View source code 5 votes vote down vote up
public static Hashtable loadReasonsByTag(JSONObject json) throws JSONException {
  Hashtable reasonsByTagHt = new Hashtable();
  // Enumeration en = json.keys();
  Iterator en = json.keys();
  //  while ( en.hasMoreElements() ) {
  while (en.hasNext()) {
    //  String transType = (String) en.nextElement();
    String transType = (String) en.next();
    JSONObject tagsByTransJson = json.getJSONObject(transType);
    if (tagsByTransJson == null) {
      continue;
    }
    Iterator enTags = tagsByTransJson.keys();
    // Enumeration enTags = tagsByTransJson.keys();
    Hashtable tagsHt = new Hashtable();
    // while ( enTags.hasMoreElements() ) {
    //   String tag = (String) enTags.nextElement();
    while (enTags.hasNext()) {
      String tag = (String) enTags.next();
      String value = null;
      if ((value = (String) tagsByTransJson.get(tag)) != null && !value.equals("")) {
        tagsHt.put(tag, value);
      }
    }
    reasonsByTagHt.put(transType, tagsHt);
  }
  return reasonsByTagHt;
}
 
Example 22
Project: openjdk-jdk10   File: ImageRepresentation.java   View source code 5 votes vote down vote up
public void setProperties(Hashtable<?,?> props) {
    if (src != null) {
        src.checkSecurity(null, false);
    }
    image.setProperties(props);
    newInfo(image, ImageObserver.PROPERTIES, 0, 0, 0, 0);
}
 
Example 23
Project: creoson   File: JLJsonFamilyTableHandler.java   View source code 5 votes vote down vote up
public Hashtable<String, Object> handleFunction(String sessionId, String function, Hashtable<String, Object> input) throws JLIException {
	if (function==null)
		return null;
	
	if (function.equals(FUNC_EXISTS))
		return actionExists(sessionId, input);
	else if (function.equals(FUNC_DELETE))
		return actionDelete(sessionId, input);
	else if (function.equals(FUNC_DELETE_INST))
		return actionDeleteInst(sessionId, input);
	else if (function.equals(FUNC_GET_HEADER))
		return actionGetHeader(sessionId, input);
	else if (function.equals(FUNC_GET_ROW))
		return actionGetRow(sessionId, input);
	else if (function.equals(FUNC_GET_CELL))
		return actionGetCell(sessionId, input);
	else if (function.equals(FUNC_SET_CELL))
		return actionSetCell(sessionId, input);
	else if (function.equals(FUNC_ADD_INST))
		return actionAddInst(sessionId, input);
	else if (function.equals(FUNC_REPLACE))
		return actionReplace(sessionId, input);
	else if (function.equals(FUNC_LIST))
		return actionList(sessionId, input);
	else if (function.equals(FUNC_LIST_TREE))
		return actionListTree(sessionId, input);
	else if (function.equals(FUNC_CREATE_INST))
		return actionCreateInst(sessionId, input);
	else if (function.equals(FUNC_GET_PARENTS))
		return actionGetParents(sessionId, input);
	else {
		throw new JLIException("Unknown function name: " + function);
	}
}
 
Example 24
Project: creoson   File: JLJsonInterfaceHandler.java   View source code 5 votes vote down vote up
private Hashtable<String, Object> actionExportProgram(String sessionId, Hashtable<String, Object> input) throws JLIException {
       String model = checkStringParameter(input, PARAM_MODEL, false);

       ExportResults results = intfHandler.exportProgram(model, sessionId);
       
       if (results!=null) {
		Hashtable<String, Object> out = new Hashtable<String, Object>();
		out.put(OUTPUT_DIRNAME, results.getDirname());
		out.put(OUTPUT_FILENAME, results.getFilename());
       	return out;
       }
       return null;
}
 
Example 25
Project: jdk8u-jdk   File: CNCtx.java   View source code 5 votes vote down vote up
private String initUsingUrl(ORB orb, String url, Hashtable<?,?> env)
    throws NamingException {
    if (url.startsWith("iiop://") || url.startsWith("iiopname://")) {
        return initUsingIiopUrl(orb, url, env);
    } else {
        return initUsingCorbanameUrl(orb, url, env);
    }
}
 
Example 26
Project: openjdk-jdk10   File: JLayeredPane.java   View source code 5 votes vote down vote up
/**
 * Removes all the components from this container.
 *
 * @since 1.5
 */
public void removeAll() {
    Component[] children = getComponents();
    Hashtable<Component, Integer> cToL = getComponentToLayer();
    for (int counter = children.length - 1; counter >= 0; counter--) {
        Component c = children[counter];
        if (c != null && !(c instanceof JComponent)) {
            cToL.remove(c);
        }
    }
    super.removeAll();
}
 
Example 27
Project: ramus   File: IDEF0Buffer.java   View source code 5 votes vote down vote up
private Hashtable<Row, Boolean> getStreamsBuff(Row function) {
    Hashtable<Row, Boolean> stream = functionStreamsBuff.get(function);
    if (stream == null) {
        stream = new Hashtable<Row, Boolean>();
        functionStreamsBuff.put(function, stream);
    }
    return stream;
}
 
Example 28
Project: creoson   File: JLJsonFileHandler.java   View source code 5 votes vote down vote up
private Hashtable<String, Object> actionBackup(String sessionId, Hashtable<String, Object> input) throws JLIException {
       String filename = checkStringParameter(input, PARAM_MODEL, true);
       String targetdir = checkStringParameter(input, PARAM_TARGETDIR, true);
       
       fileHandler.backup(filename, targetdir, sessionId);
	
       return null;
}
 
Example 29
Project: unitimes   File: BasePointInTimeDataReports.java   View source code 5 votes vote down vote up
@SuppressWarnings("unchecked")
public Map<Long, String> getValues(UserContext user) {
	Map<Long, String> ret = new Hashtable<Long, String>();
	for (RefTableEntry ref: (List<RefTableEntry>)SessionDAO.getInstance().getSession().createCriteria(iReference).list())
		ret.put(ref.getUniqueId(), ref.getLabel());
	return ret;
}
 
Example 30
Project: neoscada   File: Activator.java   View source code 5 votes vote down vote up
@Override
public void start ( final BundleContext context ) throws Exception
{
    Activator.context = context;

    this.executor = ScheduledExportedExecutorService.newSingleThreadExportedScheduledExecutor ( context.getBundle ().getSymbolicName () );
    this.factory = new BufferedDatasourceFactory ( context, this.executor );

    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "A counter of changes on an item over a defined timeframe" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID, context.getBundle ().getSymbolicName () );

    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );
}
 
Example 31
Project: Tarski   File: mxGraphComponent.java   View source code 5 votes vote down vote up
/**
 * 
 */
public void removeAllOverlays(Hashtable<Object, mxICellOverlay[]> map) {
  Iterator<Map.Entry<Object, mxICellOverlay[]>> it = map.entrySet().iterator();

  while (it.hasNext()) {
    Map.Entry<Object, mxICellOverlay[]> entry = it.next();
    mxICellOverlay[] c = entry.getValue();

    for (int i = 0; i < c.length; i++) {
      removeCellOverlayComponent(c[i], entry.getKey());
    }
  }
}
 
Example 32
Project: OpenJSharp   File: ExprExpression.java   View source code 5 votes vote down vote up
/**
 * Check the expression if it appears as an lvalue.
 * We just pass it on to our unparenthesized subexpression.
 * (Part of fix for 4090372)
 */
public Vset checkAssignOp(Environment env, Context ctx,
                          Vset vset, Hashtable exp, Expression outside) {
    vset = right.checkAssignOp(env, ctx, vset, exp, outside);
    type = right.type;
    return vset;
}
 
Example 33
Project: cww_framework   File: FatSecret.java   View source code 5 votes vote down vote up
private String createProfile(String userId) throws SignatureException, IOException
{
    Hashtable<String, String> params = new Hashtable<String, String>();
    params.put("method", "profile.create");
    params.put("user_id", userId);

    return callRest(params);
}
 
Example 34
Project: neoscada   File: ProxyMonitorQueryFactory.java   View source code 5 votes vote down vote up
@Override
protected Entry<ProxyMonitorQuery> createService ( final UserInformation userInformation, final String configurationId, final BundleContext context, final Map<String, String> parameters ) throws Exception
{
    logger.info ( "Creating new proxy query: {}", configurationId );

    final ProxyMonitorQuery service = new ProxyMonitorQuery ( context, this.executor );

    final Hashtable<String, Object> properties = new Hashtable<String, Object> ();
    properties.put ( Constants.SERVICE_PID, configurationId );
    final ServiceRegistration<MonitorQuery> handle = context.registerService ( MonitorQuery.class, service, properties );

    service.update ( userInformation, parameters );

    return new Entry<ProxyMonitorQuery> ( configurationId, service, handle );
}
 
Example 35
Project: creoson   File: JLJsonFileHelp.java   View source code 5 votes vote down vote up
/**
   * Convert a 3D coordinate into a generic JSON structure
   * @param x
   * @param y
   * @param z
   * @return The JSON data as a Hashtable
   */
  protected Hashtable<String, Object> writePoint(double x, double y, double z) {
Hashtable<String, Object> out = new Hashtable<String, Object>();
out.put(JLFileResponseParams.OUTPUT_X, x);
out.put(JLFileResponseParams.OUTPUT_Y, y);
out.put(JLFileResponseParams.OUTPUT_Z, z);
return out;
  }
 
Example 36
Project: jdk8u-jdk   File: VariableHeightLayoutCache.java   View source code 5 votes vote down vote up
public VariableHeightLayoutCache() {
    super();
    tempStacks = new Stack<Stack<TreePath>>();
    visibleNodes = new Vector<Object>();
    boundsBuffer = new Rectangle();
    treePathMapping = new Hashtable<TreePath, TreeStateNode>();
}
 
Example 37
Project: lams   File: ScriptEnvironment.java   View source code 5 votes vote down vote up
/**
 * Converts a Hashtable to a String array by converting each
 * key/value pair in the Hashtable to two consecutive Strings
 *
 * @param  h   Hashtable to convert
 * @return     converted string array
 * @exception  NullPointerException   if a hash key has a null value
 */
public static String[] hashToStringArray(Hashtable h)
    throws NullPointerException
{
    Vector v = new Vector();
    Enumeration e = h.keys();
    while (e.hasMoreElements()) {
        String k = e.nextElement().toString();
        v.add(k);
        v.add(h.get(k));
    }
    String[] strArr = new String[v.size()];
    v.copyInto(strArr);
    return strArr;
}
 
Example 38
Project: creoson   File: JLJsonDimensionHandler.java   View source code 5 votes vote down vote up
private Hashtable<String, Object> actionSet(String sessionId, Hashtable<String, Object> input) throws JLIException {
       String modelname = checkStringParameter(input, PARAM_MODEL, false);
       String dimname = checkStringParameter(input, PARAM_NAME, true);
       Object value = checkParameter(input, PARAM_VALUE, false);
       boolean encoded = checkFlagParameter(input, PARAM_ENCODED, false, false);
       
       dimHandler.set(modelname, dimname, value, encoded, sessionId);
       
	return null;
}
 
Example 39
Project: Hydrograph   File: JavaScanner.java   View source code 5 votes vote down vote up
/**
 * Initialize the lookup table.
 */
private void initialize() {
	fgKeys = new Hashtable<String, Integer>();
	Integer k = new Integer(JavaLineStyler.KEY);
	for (int i = 0; i < fgKeywords.length; i++)
		fgKeys.put(fgKeywords[i], k);

	loadClassColor();
}
 
Example 40
Project: openjdk-jdk10   File: FunctionalCMEs.java   View source code 5 votes vote down vote up
@DataProvider(name = "Maps", parallel = true)
private static Iterator<Object[]> makeMaps() {
    return Arrays.asList(
            // Test maps that CME
            new Object[]{new HashMap<>(), true},
            new Object[]{new Hashtable<>(), true},
            new Object[]{new LinkedHashMap<>(), true},
            // Test default Map methods - no CME
            new Object[]{new Defaults.ExtendsAbstractMap<>(), false}
    ).iterator();
}