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:com.nokia.example.musicexplorer.data.model.GenericProductModel.java

/**
 * Constructor./* ww  w. ja  v a  2  s.  c  o  m*/
 * @param obj
 */
public GenericProductModel(JSONObject obj) {
    this.thumbnailUrls = new Hashtable();

    try {
        setThumbnails(obj.getJSONObject("thumbnails"));
    } catch (JSONException e1) {
        L.i("Could not initialize thumbnails in GenericProductModel.", e1.toString());
        L.i("With JSONObject", obj.toString());
    }

    try {
        setCategory(obj.getJSONObject("category"));
    } catch (JSONException e1) {
        L.i("Could not initialize categories in GenericProductModel.", e1.toString());
        L.i("With JSONObject", obj.toString());
    }

    try {
        setGenres(obj.getJSONArray("genres"));
    } catch (JSONException e1) {
        L.i("Could not initialize genres in GenericProductModel.", e1.toString());
        L.i("With JSONObject", obj.toString());
    }

    try {
        this.name = obj.getString("name");
        this.id = obj.getInt("id");
    } catch (JSONException e1) {
        L.i("Could not initialize name or id in GenericProductModel.", e1.toString());
        L.i("With JSONObject", obj.toString());
    }

    L.i("This GenericProductModel", this.toString());
}

From source file:com.MainChart.java

/**
 * Creates new form Main
 */
public MainChart() {
    this.multiHashtable = new Hashtable<>();
    initComponents();
}

From source file:com.cloudbase.datacommands.CBDataAggregationCommandGroup.java

public CBDataAggregationCommandGroup() {
    this.idFields = new Vector();
    this.groupFields = new Hashtable();

    this.setCommandType(CBDataAggregationCommandType.CBDataAggregationGroup);
}

From source file:es.itecban.deployment.resource.taxonomy.DefaultTaxonomyImpl.java

private void initTaxonomy() {
    categories = new Hashtable<String, Category>();
    Properties types = new Properties();
    try {/*www.j a v  a  2 s. c  om*/
        types.load(supportedTypes.getInputStream());
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (types != null) {
        Enumeration keys = types.keys();

        while (keys.hasMoreElements()) {
            String categoryName = (String) keys.nextElement();
            String categoryDescription = (String) types.get(categoryName);
            addCategory(categoryName, categoryDescription);
        }
    }
}

From source file:ArrayMap.java

public ArrayMap() {
    keyIndex = new Hashtable<String, Integer>();
}

From source file:com.microsoft.azure.servicebus.samples.jmstopicquickstart.JmsTopicQuickstart.java

public void run(String connectionString) throws Exception {

    // The connection string builder is the only part of the azure-servicebus SDK library 
    // we use in this JMS sample and for the purpose of robustly parsing the Service Bus 
    // connection string. 
    ConnectionStringBuilder csb = new ConnectionStringBuilder(connectionString);

    // set up the JNDI context 
    Hashtable<String, String> hashtable = new Hashtable<>();
    hashtable.put("connectionfactory.SBCF",
            "amqps://" + csb.getEndpoint().getHost() + "?amqp.idleTimeout=120000&amqp.traceFrames=true");
    hashtable.put("topic.TOPIC", "BasicTopic");
    hashtable.put("queue.SUBSCRIPTION1", "BasicTopic/Subscriptions/Subscription1");
    hashtable.put("queue.SUBSCRIPTION2", "BasicTopic/Subscriptions/Subscription2");
    hashtable.put("queue.SUBSCRIPTION3", "BasicTopic/Subscriptions/Subscription3");
    hashtable.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.qpid.jms.jndi.JmsInitialContextFactory");
    Context context = new InitialContext(hashtable);

    ConnectionFactory cf = (ConnectionFactory) context.lookup("SBCF");

    // Look up the topic
    Destination topic = (Destination) context.lookup("TOPIC");

    // we create a scope here so we can use the same set of local variables cleanly 
    // again to show the receive side seperately with minimal clutter
    {// w  ww .  j  av a2s.  c o m
        // Create Connection
        Connection connection = cf.createConnection(csb.getSasKeyName(), csb.getSasKey());
        connection.start();
        // Create Session, no transaction, client ack
        Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);

        // Create producer
        MessageProducer producer = session.createProducer(topic);

        // Send messaGES
        for (int i = 0; i < totalSend; i++) {
            BytesMessage message = session.createBytesMessage();
            message.writeBytes(String.valueOf(i).getBytes());
            producer.send(message);
            System.out.printf("Sent message %d.\n", i + 1);
        }

        producer.close();
        session.close();
        connection.stop();
        connection.close();
    }

    // Look up the subscription (pretending it's a queue)
    receiveFromSubscription(csb, context, cf, "SUBSCRIPTION1");
    receiveFromSubscription(csb, context, cf, "SUBSCRIPTION2");
    receiveFromSubscription(csb, context, cf, "SUBSCRIPTION3");

    System.out.printf("Received all messages, exiting the sample.\n");
    System.out.printf("Closing queue client.\n");
}

From source file:com.whizzosoftware.hobson.openweathermap.OpenWeatherMapPluginTest.java

@Test
public void testInitWithNoConfiguration() {
    MockVariableManager vm = new MockVariableManager();
    OpenWeatherMapPlugin plugin = new OpenWeatherMapPlugin("id");
    plugin.setVariableManager(vm);//from www. j a  va  2  s  . c  o m
    assertEquals(PluginStatus.Status.INITIALIZING, plugin.getStatus().getStatus());
    plugin.onStartup(new Hashtable());
    assertEquals(PluginStatus.Status.NOT_CONFIGURED, plugin.getStatus().getStatus());
    assertEquals(0, vm.getGlobalVariables(UserUtil.DEFAULT_USER, UserUtil.DEFAULT_HUB).size());
}

From source file:net.nicholaswilliams.java.teamcity.plugin.linux.AbstractLinuxPropertiesLocator.java

@Override
public Map<String, String> locateProperties(File pluginRoot) {
    Hashtable<String, String> properties = new Hashtable<String, String>();

    this.determinePluginVersion(pluginRoot, properties);
    this.locateLinuxProperties(properties);

    return properties;
}

From source file:edu.asu.msse.dssoni.moviedescrpitionapp.MovieLibrary.java

public MovieLibrary(MainActivity parent) {
    this.parent = parent;
    movies = new Hashtable<String, MovieDescription>();
    this.clearMovies();
}

From source file:com.maverick.http.HttpHeader.java

protected HttpHeader() {
    fields = new Hashtable();
    fieldNames = new Vector();
}