Example usage for java.util Hashtable get

List of usage examples for java.util Hashtable get

Introduction

In this page you can find the example usage for java.util Hashtable get.

Prototype

@SuppressWarnings("unchecked")
public synchronized V get(Object key) 

Source Link

Document

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Usage

From source file:com.flexive.tests.browser.AdmUserAccountsTest.java

/**
 * open the edit screen of a structure element
 * @param src the html source//from   w w  w. j a v  a  2 s  .  c o  m
 * @param prefix the prefix to search
 */
private void openEdit(String src, String prefix) {
    Hashtable<String, String> params = buildHashtableFromMenu(src, prefix);
    if (params.get("nodeType").equals("Type")) {
        loadContentPage(EDIT_TYPE + "?action=editInstance&id=" + params.get("typeId"));
    }
}

From source file:net.sourceforge.floggy.persistence.fr2422928.FR2422928MigrationTest.java

/**
 * DOCUMENT ME!//from w  w w. ja va2  s .c o  m
*
* @throws Exception DOCUMENT ME!
*/
public void testAfterUpddate() throws Exception {
    MigrationManager um = MigrationManager.getInstance();
    Enumeration enumeration = um.start(FR2422928.class, null);

    PersistableMetadata metadata = PersistableMetadataManager.getRMSBasedMetadata(FR2422928.class.getName());

    assertEquals(PersistableMetadataManager.VERSION_1_3_0, metadata.getRecordStoreVersion());

    try {
        while (enumeration.hasMoreElements()) {
            Hashtable data = (Hashtable) enumeration.nextElement();
            assertFalse("Should not be empty!", data.isEmpty());
            assertEquals(name, data.get("name"));
            assertEquals(checkpoint, data.get("checkpoint"));

            FR2422928 persistable = new FR2422928();
            persistable.setName((String) data.get("name"));
            persistable.setCheckpoint((Calendar) data.get("checkpoint"));
            enumeration.update(persistable);
        }
    } finally {
        um.finish(FR2422928.class);
    }

    metadata = PersistableMetadataManager.getRMSBasedMetadata(FR2422928.class.getName());

    assertEquals(PersistableMetadataManager.getBytecodeVersion(), metadata.getRecordStoreVersion());

    try {
        ObjectSet os = manager.find(FR2422928.class, null, null);
        assertEquals(1, os.size());

        FR2422928 persistable = (FR2422928) os.get(0);
        assertEquals(name, persistable.getName());
        assertEquals(checkpoint, persistable.getCheckpoint());
    } catch (Exception ex) {
        fail(ex.getMessage());
    }
}

From source file:eionet.gdem.qa.XQueryService.java

private String getExtension(Vector outputTypes, String content_type) {
    String ret = "html";
    if (outputTypes == null) {
        return ret;
    }/*from   ww  w.  ja va 2  s .  c o m*/
    if (content_type == null) {
        return ret;
    }

    for (int i = 0; i < outputTypes.size(); i++) {
        Hashtable outType = (Hashtable) outputTypes.get(i);
        if (outType == null) {
            continue;
        }
        if (!outType.containsKey("conv_type") || !outType.containsKey("file_ext")
                || outType.get("conv_type") == null || outType.get("file_ext") == null) {
            continue;
        }
        String typeId = (String) outType.get("conv_type");
        if (!content_type.equalsIgnoreCase(typeId)) {
            continue;
        }
        ret = (String) outType.get("file_ext");
    }

    return ret;
}

From source file:net.sf.joost.stx.TransformerHandlerResolverImpl.java

/** Creates a new Hashtable with String resp. Object values */
private Hashtable createExternalParameters(Hashtable params) {
    // create new Hashtable with String values only
    Hashtable result = new Hashtable();
    for (Enumeration e = params.keys(); e.hasMoreElements();) {
        String key = (String) e.nextElement();
        // remove preceding "{}" if present
        String name = key.startsWith("{}") ? key.substring(2) : key;
        Value val = ((Value) (params.get(key)));
        result.put(name, val.type == Value.OBJECT ? val.getObject() : val.getStringValue());
    }/*  w w  w .  ja v  a2s  .com*/
    return result;
}

From source file:fedorax.server.module.storage.IrodsExternalContentManager.java

/**
 * Retrieves external content via http or https.
 * //from w w w  . j  av a 2  s  . co  m
 * @param url
 *            The url pointing to the content.
 * @param context
 *            The Map containing parameters.
 * @param mimeType
 *            The default MIME type to be used in case no MIME type can be
 *            detected.
 * @return A MIMETypedStream
 * @throws ModuleInitializationException
 * @throws GeneralException
 */
private MIMETypedStream getFromWeb(ContentManagerParams params)
        throws ModuleInitializationException, GeneralException {
    String username = params.getUsername();
    String password = params.getPassword();
    boolean backendSSL = false;
    String url = params.getUrl();

    if (ServerUtility.isURLFedoraServer(url) && !params.isBypassBackend()) {
        BackendSecuritySpec m_beSS;
        BackendSecurity m_beSecurity = (BackendSecurity) getServer()
                .getModule("fedora.server.security.BackendSecurity");
        try {
            m_beSS = m_beSecurity.getBackendSecuritySpec();
        } catch (Exception e) {
            throw new ModuleInitializationException(
                    "Can't intitialize BackendSecurity module (in default access) from Server.getModule",
                    getRole());
        }
        Hashtable<String, String> beHash = m_beSS.getSecuritySpec(BackendPolicies.FEDORA_INTERNAL_CALL);
        username = beHash.get("callUsername");
        password = beHash.get("callPassword");
        backendSSL = new Boolean(beHash.get("callSSL")).booleanValue();
        if (backendSSL) {
            if (params.getProtocol().equals("http:")) {
                url = url.replaceFirst("http:", "https:");
            }
            url = url.replaceFirst(":" + fedoraServerPort + "/", ":" + fedoraServerRedirectPort + "/");
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("************************* backendUsername: " + username + "     backendPassword: "
                    + password + "     backendSSL: " + backendSSL);
            LOG.debug("************************* doAuthnGetURL: " + url);
        }

    }
    return get(url, username, password, params.getMimeType());
}

From source file:edu.caltechUcla.sselCassel.projects.jMarkets.server.network.ConnectionMonitor.java

/** Every STATUS_CHECK_PERIOD milliseconds, retrieve a list of sessionIds from the ControlServ,
 *  and a list of connection statuses from the UpdateServ. Run through the connection status
 *  for each client in each session, and update the server monitors if anyone's connection
 *  status has changed. Changes are monitored using the alreadyDisconnected Vector stored in
 *  this object *///from  w w w .  ja  v  a2s.  co  m
public void startMonitor() {
    while (!stopMonitor) {
        waitPeriod();

        int[] sessionIds = controlServ.getSessionIds();
        Hashtable disconnected = updateServ.getDisconnectStatus();

        for (int i = 0; i < sessionIds.length; i++) {
            int[] clients = controlServ.getSessionClients(sessionIds[i]);
            if (clients == null)
                continue;

            for (int j = 0; j < clients.length; j++) {
                if (clients[j] < 0)
                    continue;

                Integer client = new Integer(clients[j]);
                boolean discon = ((Boolean) disconnected.get(client)).booleanValue();

                if (!alreadyDisconnected.contains(client)) {

                    if (discon) {
                        log.warn("Client " + client + " in session " + sessionIds[i] + " has lost connection");
                        monitorServ.updateConnectionStatus(sessionIds[i], j, false);
                        alreadyDisconnected.add(client);
                    }
                }

                else if (!discon) {
                    log.info("Client " + client + " in session " + sessionIds[i]
                            + " has re-established connection");
                    monitorServ.updateConnectionStatus(sessionIds[i], j, true);
                    alreadyDisconnected.remove(client);
                }
            }
        }
    }
}

From source file:edu.ku.brc.af.prefs.GenericPrefsPanel.java

public void getChangedFields(final Properties changeHash) {
    FormViewObj fvo = (FormViewObj) form;
    if (form != null) {
        Hashtable<String, String> idToNameHash = fvo.getIdToNameHash();

        Vector<String> ids = new Vector<String>();
        fvo.getFieldIds(ids);/*from   w w  w  .  j av a 2 s. c o m*/
        for (String id : ids) {
            Component comp = fvo.getCompById(id);
            if (comp instanceof UIValidatable && ((UIValidatable) comp).isChanged()) {
                String nameForHash = idToNameHash.get(id);
                if (StringUtils.isNotEmpty(nameForHash)) {
                    Object value = comp instanceof GetSetValueIFace ? ((GetSetValueIFace) comp).getValue() : "";
                    if (value != null) {
                        changeHash.put(nameForHash, value); //$NON-NLS-1$
                    }
                }
            }
            //System.err.println("ID: "+id+"  Name: "+idToNameHash.get(id)+" changed: "+(comp instanceof UIValidatable && ((UIValidatable)comp).isChanged()));
            /*Object newVal = FormViewObj.getValueFromComponent(comp, false, false, id);
            Object oldVal = oldValues.get(id);
            System.err.println("["+newVal.toString()+"]["+oldVal.toString()+"] "+(!newVal.toString().equals(oldVal.toString())));
            if (!newVal.toString().equals(oldVal.toString()))
            {
            System.err.println("id: "+id+" changed.");
            }*/
        }
    }
}

From source file:com.alfaariss.oa.engine.user.provisioning.translator.standard.StandardProfile.java

private Object getValue(ProfileItem oItem, Hashtable<String, Object> htFields) throws UserException {
    Object oValue = null;// www  . ja v  a 2  s.  c  om
    try {
        if (oItem == null)
            return Boolean.FALSE;

        oValue = oItem.getDefault();
        if (oValue == null)
            oValue = Boolean.FALSE;

        String sField = oItem.getField();
        if (sField != null) {
            Object oFieldValue = htFields.get(sField);
            if (oFieldValue != null)
                oValue = oFieldValue;
        }

        IConverter oConverter = oItem.getConverter();
        if (oConverter != null)
            oValue = oConverter.convert(oValue);

        if (oValue instanceof String)
            oValue = new Boolean((String) oValue);
    } catch (Exception e) {
        _logger.fatal("Could not retrieve value", e);
        throw new UserException(SystemErrors.ERROR_INTERNAL);
    }
    return oValue;
}

From source file:com.krawler.esp.servlets.FileImporterServlet.java

public FileInputStream getStoredfile(String docid) throws ServiceException, ParseException {
    FileInputStream fis = null;//from w w  w  .j a  va2s  . c  o m
    try {
        java.util.Hashtable ht = com.krawler.esp.database.dbcon.getfileinfo(docid);
        String src = StorageHandler.GetDocStorePath(ht.get("storeindex").toString())
                + StorageHandler.GetFileSeparator();
        src = src + "importplans" + StorageHandler.GetFileSeparator() + ht.get("svnname");
        File fp = new File(src);
        byte[] buff = new byte[(int) fp.length()];
        fis = new FileInputStream(fp);
        //            fis.close();
    } catch (ConfigurationException ex) {
        KrawlerLog.op.warn("Problem Storing Data In DB [FileImporterServlet.storeInDB()]:" + ex);
    } catch (IOException ex) {
        KrawlerLog.op.warn("Problem Storing Data In DB [FileImporterServlet.storeInDB()]:" + ex);
    }
    return fis;
}