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:net.sourceforge.floggy.persistence.fr2422928.FR2422928AbstractVersionTest.java

/**
 * DOCUMENT ME!// w ww  . j a  v a  2 s  .c om
*
* @throws Exception DOCUMENT ME!
*/
public void testFreezedClassIteration() throws Exception {
    Hashtable properties = new Hashtable();
    properties.put(MigrationManager.MIGRATE_FROM_PREVIOUS_1_3_0_VERSION, Boolean.TRUE);
    properties.put(MigrationManager.ITERATION_MODE, Boolean.TRUE);

    Enumeration enumeration = MigrationManager.getInstance().start(Freezed.class, properties);

    assertEquals(2, enumeration.getSize());

    if (enumeration.hasMoreElements()) {
        Hashtable data = enumeration.nextElement();
        assertNull(data.get("uuid"));
        assertNull(data.get("deadline"));
        assertNull(data.get("description"));
        assertNull(data.get("nested"));
        assertEquals(0, ((Short) data.get("code")).shortValue());
    }

    if (enumeration.hasMoreElements()) {
        Hashtable data = enumeration.nextElement();
        assertEquals(Freezed.UUID, data.get("uuid"));
        assertEquals(Freezed.DEADLINE, data.get("deadline"));
        assertEquals(Freezed.DESCRIPTION, data.get("description"));

        FieldPersistableInfo freezedInfo = (FieldPersistableInfo) data.get("nested");
        Freezed nested = new Freezed();
        manager.load(nested, freezedInfo.getId());

        assertEquals(Freezed.NESTED, nested);
        assertEquals(Freezed.CODE, ((Short) data.get("code")).shortValue());
    }
}

From source file:de.iew.spring.integration.SpringIntegrationJdbcTest.java

@Test
public void testPersistStringMessage() throws Exception {
    Map<String, Object> headers = new Hashtable<String, Object>();

    GenericMessage<String> jdbcTestMessage = new GenericMessage<String>(
            "If you can read this, the junit test was successful.", headers);
    this.simpleOutgoing.send(jdbcTestMessage);

    Statement stmt = this.dataSource.getConnection().createStatement();
    ResultSet rs = stmt.executeQuery("SELECT COUNT(id) FROM testing_spring_integration_jdbc_test");
    Assert.assertTrue(rs.next());/*from   w  w w. j a va2s .c om*/
    Assert.assertEquals(1, rs.getInt(1));

    // Eine Nachricht eingefgt. Per default im int-jdbc:outbound-gateway wird die Anzahl der aktualisierten Werte
    // geschickt.
    Message m = incoming.receive();
    Map<String, Integer> payload = (Map<String, Integer>) m.getPayload();
    Assert.assertEquals(new Integer(1), payload.get("UPDATED"));
}

From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManagerCalibrator.java

public WindowManagerCalibrator() {
    sourcePositions = new Hashtable<Position, Point>();
    destinationPositions = new Hashtable<Position, Point>();

    eventListenerManager = new EventListenerManager();
    displaySize = new Size();

    setStarted(false);//from   ww w . j a v a  2 s.  c o m
}

From source file:com.ewcms.common.mybatis.plugin.PaginationQueryPlugin.java

public PaginationQueryPlugin() {
    dialects = new Hashtable<String, LimitDialect>();
    dialects.put("postgresql", new PostgresqlDialect());
    dialects.put("oracle", new OracleDialect());
    dialects.put("derby", new DerbyDialect());
}

From source file:com.swordlord.gozer.renderer.fop.FopTemplateManager.java

public void initialiseTemplates() {
    _htTemplates = new Hashtable<String, String>();

    loadTemplate(GFopFrame.TEMPLATE_NAME, PATH_PREFIX + GFopFrame.TEMPLATE_NAME + FILE_POSTFIX);
    loadTemplate(GFopReportPanel.TEMPLATE_NAME, PATH_PREFIX + GFopReportPanel.TEMPLATE_NAME + FILE_POSTFIX);

    // not used yet
    // loadTemplate(jcrH, GFopDetail.TEMPLATE_NAME, PATH_PREFIX + GFopDetail.TEMPLATE_NAME + FILE_POSTFIX);

    loadTemplate(GFopList.TEMPLATE_TABLE_NAME, PATH_PREFIX + GFopList.TEMPLATE_TABLE_NAME + FILE_POSTFIX);
    loadTemplate(GFopList.TEMPLATE_COLUMN_NAME, PATH_PREFIX + GFopList.TEMPLATE_COLUMN_NAME + FILE_POSTFIX);
    loadTemplate(GFopList.TEMPLATE_COLUMN_CELL_NAME,
            PATH_PREFIX + GFopList.TEMPLATE_COLUMN_CELL_NAME + FILE_POSTFIX);
    loadTemplate(GFopList.TEMPLATE_ROW_NAME, PATH_PREFIX + GFopList.TEMPLATE_ROW_NAME + FILE_POSTFIX);
    loadTemplate(GFopList.TEMPLATE_ROW_CELL_NAME, PATH_PREFIX + GFopList.TEMPLATE_ROW_CELL_NAME + FILE_POSTFIX);
}

From source file:helma.main.ApplicationManager.java

/**
 * Creates a new ApplicationManager object.
 *
 * @param props the properties defining the running apps
 * @param server the server instance/*from  ww  w  .  jav  a  2  s. c  o m*/
 */
public ApplicationManager(ResourceProperties props, Server server) {
    this.props = props;
    this.server = server;
    descriptors = new Hashtable();
    applications = new Hashtable();
    xmlrpcHandlers = new Hashtable();
    lastModified = 0;
    jetty = server.jetty;
}

From source file:com.vnet.demo.service.azure.servicebus.AzureServiceBusServiceFactory.java

public AzureServiceBusService create() {
    if (this.azureServiceBusService == null) {
        try {/*from   w  w  w .  jav  a  2 s. c o  m*/
            PropertiesFactoryBean properties = SpringUtil.getBean(PropertiesFactoryBean.class);
            this.username = (String) properties.getObject().get("azure.servicebus.username");
            this.password = (String) properties.getObject().get("azure.servicebus.password");
            this.host = (String) properties.getObject().get("azure.servicebus.host");
            String defaultQueue = (String) properties.getObject().get("azure.servicebus.queue");

            String connectionString = "amqps://" + username + ":" + encode(password) + "@" + host;
            Hashtable<String, String> env = new Hashtable<String, String>();
            env.put(Context.INITIAL_CONTEXT_FACTORY,
                    "org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory");
            env.put("connectionfactory.ServiceBusConnectionFactory", connectionString);

            Context context = new InitialContext(env);
            ConnectionFactory connectionFactory = (ConnectionFactory) context
                    .lookup("ServiceBusConnectionFactory");
            azureServiceBusService = new AzureServiceBusService(connectionFactory, defaultQueue);
        } catch (NamingException | IOException e) {
            e.printStackTrace();
        }
        ;
    }
    return this.azureServiceBusService;
}

From source file:org.geowebcache.service.kml.KMLDebugGridLayer.java

private KMLDebugGridLayer() {
    super.subSets = new Hashtable<String, GridSubset>();
    subSets.put(gridSetBroker.WORLD_EPSG4326.getName(),
            GridSubsetFactory.createGridSubSet(gridSetBroker.WORLD_EPSG4326, BoundingBox.WORLD4326, 0, 3));
}

From source file:edu.ku.brc.specify.tasks.BaseTask.java

/**
 * @param fileName xml file to be read in
 * @return a double hashtable first hashed by Permissions name and then hased by User Type
 *///from www  .  ja  va2  s .c  om
@SuppressWarnings("unchecked")
public static Hashtable<String, Hashtable<String, PermissionOptionPersist>> readDefaultPermsFromXML(
        final String fileName) {
    Hashtable<String, Hashtable<String, PermissionOptionPersist>> hash = new Hashtable<String, Hashtable<String, PermissionOptionPersist>>();

    XStream xstream = new XStream();
    PermissionOptionPersist.config(xstream);

    String xmlStr = null;
    try {
        File permFile = new File(XMLHelper.getConfigDirPath("defaultperms" + File.separator + fileName)); //$NON-NLS-1$
        //baseLog.debug(permFile.getAbsoluteFile());
        if (permFile.exists()) {
            xmlStr = FileUtils.readFileToString(permFile);
        }

    } catch (IOException ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(BaseTask.class, ex);
        ex.printStackTrace();
    }

    if (xmlStr != null) {
        hash = (Hashtable<String, Hashtable<String, PermissionOptionPersist>>) xstream.fromXML(xmlStr);
        /*for (TaskPermPersist tp : list)
        {
        System.err.println("TP: "+tp.getTaskName()+"  "+tp.getUserType()+"  "+tp.isCanAdd());
        }*/
    }
    return hash;
}

From source file:com.legstar.coxb.CobolElementVisitor.java

/**
 * No-arg constructor./*w  w  w.  jav a2s. c  o m*/
 */
public CobolElementVisitor() {
    mHostBytes = null;
    mOffset = 0;
    mCobolConverters = null;
    mVariablesMap = new Hashtable<String, Object>();
}