Example usage for java.util Hashtable Hashtable

List of usage examples for java.util Hashtable Hashtable

Introduction

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

Prototype

public Hashtable() 

Source Link

Document

Constructs a new, empty hashtable with a default initial capacity (11) and load factor (0.75).

Usage

From source file:org.jasig.portlet.emailpreview.controller.AjaxUpdateInboxFolderController.java

@ResourceMapping("inboxFolder")
public ModelAndView inboxFolder(ResourceRequest req, ResourceResponse res) throws MessagingException {
    IEmailAccountService accountDao = serviceBroker.getEmailAccountService(req);

    PortletPreferences prefs = req.getPreferences();
    String selectedFolder = prefs.getValue(EmailAccountSummaryController.INBOX_NAME_PREFERENCE,
            INBOX_DEFAULT_VALUE_PREF);/*from   w  ww. j  av a 2s. c  o m*/
    String authenticationServiceKey = prefs.getValue(AUTH_SERVICE_PREFERENCE,
            AUTH_SERVICE_DEFAULT_VALUE_PREFERENCE);

    Map<String, String> jsonData = new Hashtable<String, String>();

    if (AUTH_SERVICE_TEST_PREFERENCE.equals(authenticationServiceKey)) {
        jsonData.put("INBOX", "INBOX");
        //For demo : must have the same name that the json files in src/main/resources
        jsonData.put("demoTest", "demoTest");
        jsonData.put("Important", "Important");
        for (Map.Entry<String, String> entry : jsonData.entrySet()) {
            if (entry.getValue().equals(selectedFolder)) {
                jsonData.put(SELECTED_OPTION, entry.getValue());
                break;
            }
        }
    } else {
        for (Folder folderName : accountDao.getAllUserInboxFolders(req)) {
            if ((folderName.getType() & javax.mail.Folder.HOLDS_MESSAGES) != 0) {
                String unreadMsgCount = "";
                if (folderName.getUnreadMessageCount() != 0
                        && (!selectedFolder.equals(folderName.toString()))) {
                    unreadMsgCount = " (".concat(String.valueOf(folderName.getUnreadMessageCount())).concat(")")
                            .concat(UNREAD_MSG_FLAG);
                }
                jsonData.put(folderName.toString().concat(unreadMsgCount), folderName.toString());
                if (selectedFolder.equals(folderName.toString())) {
                    jsonData.put(SELECTED_OPTION, folderName.toString());
                }
            }
        }
    }
    return new ModelAndView("json", jsonData);
}

From source file:com.alfaariss.oa.engine.attribute.gather.processor.file.FileGatherer.java

/**
 * Creates the object.//from  w  w w. jav  a2 s . c o  m
 */
public FileGatherer() {
    _logger = LogFactory.getLog(FileGatherer.class);
    _sID = null;
    _sFriendlyName = null;
    _bEnabled = false;
    _pConfig = new Properties();
    _htGlobal = new Hashtable<String, FileAttribute>();
    _htMapper = new Hashtable<String, String>();
    _listGather = new Vector<String>();
}

From source file:ColorChooserMenu.java

public ColorMenu(String name) {
    super(name);/*from   w  ww .j  ava2  s.co m*/
    unselectedBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, getBackground()),
            new BevelBorder(BevelBorder.LOWERED, Color.white, Color.gray));
    selectedBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, Color.red),
            new MatteBorder(1, 1, 1, 1, getBackground()));
    activeBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, Color.blue),
            new MatteBorder(1, 1, 1, 1, getBackground()));

    JPanel p = new JPanel();
    p.setBorder(new EmptyBorder(5, 5, 5, 5));
    p.setLayout(new GridLayout(8, 8));
    paneTable = new Hashtable();

    int[] values = new int[] { 0, 128, 192, 255 };

    for (int r = 0; r < values.length; r++) {
        for (int g = 0; g < values.length; g++) {
            for (int b = 0; b < values.length; b++) {
                Color c = new Color(values[r], values[g], values[b]);
                ColorPane pn = new ColorPane(c);
                p.add(pn);
                paneTable.put(c, pn);
            }
        }
    }
    add(p);
}

From source file:HttpParser.java

public HttpParser(InputStream is) {
    reader = new BufferedReader(new InputStreamReader(is));
    method = "";//from  www  . j  a v  a2s . c om
    url = "";
    headers = new Hashtable();
    params = new Hashtable();
    ver = new int[2];
}

From source file:cc.arduino.packages.discoverers.NetworkDiscovery.java

public NetworkDiscovery() {
    DNSTaskStarter.Factory.setClassDelegate(new ArduinoDNSTaskStarter());
    this.boardPortsDiscoveredWithJmDNS = new LinkedList<>();
    this.mappedJmDNSs = new Hashtable<>();
    this.reachableBoardPorts = new LinkedList<>();
}

From source file:org.talend.librariesmanager.deploy.ArtifactsDeployer.java

private void init() {
    nexusServer = NexusServerManager.getCustomNexusServer();
    if (nexusServer != null) {
        String server = nexusServer.getServer().trim();
        if (server.endsWith(NexusConstants.SLASH)) {
            server = server.substring(0, server.length() - 1);
        }//from  w ww  .jav a  2s.c o m
        repositoryUrl = server + NexusConstants.CONTENT_REPOSITORIES + nexusServer.getRepositoryId()
                + NexusConstants.SLASH;
    }
    mvnResolver = MavenResolverCreator.getInstance().getMavenResolver(new Hashtable<String, String>());
}

From source file:FileMonitor.java

protected FileMonitor() {
    // Create timer, run timer thread as daemon.
    timer = new Timer(true);
    timerEntries = new Hashtable<String, FileMonitorTask>();
}

From source file:org.web4thejob.security.ADAuthenticationProvider.java

@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {

    if (authentication.getName() == null || (String) authentication.getCredentials() == null) {
        throw new BadCredentialsException("");
    }//from ww w . ja  v a2 s  . c  o  m

    String principal = getPrincipal(authentication.getName());
    String passwd = (String) authentication.getCredentials();

    LdapContext ctx = null;
    try {
        Hashtable<String, Object> env = new Hashtable<String, Object>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, LdapCtxFactory.class.getCanonicalName());
        env.put(Context.SECURITY_AUTHENTICATION, "Simple");
        env.put(Context.SECURITY_PRINCIPAL, principal);
        env.put(Context.SECURITY_CREDENTIALS, passwd);
        env.put(Context.PROVIDER_URL, url);
        ctx = new InitialLdapContext(env, null);
        //LDAP Connection Successful

        UserDetails userDetails = userDetailsService.loadUserByUsername(principal);
        return new UsernamePasswordAuthenticationToken(userDetails, "", userDetails.getAuthorities());
    } catch (NamingException nex) {
        throw new BadCredentialsException("LDAP authentication failed.", nex);
    } catch (UsernameNotFoundException e) {
        throw new BadCredentialsException("UserDetails did not find a valid user for name: " + principal, e);
    } finally {
        if (ctx != null) {
            try {
                ctx.close();
            } catch (Exception ignore) {
            }
        }
    }
}

From source file:com.tieuluan.struts2.utils.AppSetting.java

/**
 * Builds the config./*  w ww . j a v a 2 s  .com*/
 * 
 * @param configStream
 *            the config stream
 * @throws Exception
 *             the exception
 */
private static void buildConfig(InputStream configStream) throws Exception {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(configStream);
    params = new Hashtable<String, String>();
    NodeList paramNodeList = XPathAPI.selectNodeList(document, "/configuration/app-setting/param");
    for (int i = 0; i < paramNodeList.getLength(); i++) {
        Node paramNode = paramNodeList.item(i);
        String name = getNodeValue(paramNode, "./@name");
        String value = getNodeValue(paramNode, "./@value");
        params.put(name, value);
    }
}

From source file:edu.caltechUcla.sselCassel.projects.jMarkets.server.control.UpdateServ.java

/** Initializes the UpdateServ for the new session. Called when the UpdateServ
 *  is instantiated *///  w  w w .j  a  va  2s . c  o  m
public void initServ() {
    updateQueues = new Hashtable();
    disconnected = new Hashtable();

    log.debug("UpdateServ has been initialized");
}