Example usage for java.util Hashtable put

List of usage examples for java.util Hashtable put

Introduction

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

Prototype

public synchronized V put(K key, V value) 

Source Link

Document

Maps the specified key to the specified value in this hashtable.

Usage

From source file:com.openmeap.admin.web.AdminTestHelper.java

public HttpResponse postCreateDeployment(ApplicationVersion appVer, Deployment.Type deplType)
        throws HttpRequestException {

    Hashtable<String, Object> getData = new Hashtable<String, Object>();
    getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_DEPLOYMENTS);
    getData.put(FormConstants.APP_ID, appVer.getApplication().getPk().toString());

    Hashtable<String, Object> postData = new Hashtable<String, Object>();
    postData.put(FormConstants.PROCESS_TARGET, ProcessingTargets.DEPLOYMENTS);
    postData.put(FormConstants.APPVER_ID, appVer.getPk().toString());
    postData.put(FormConstants.DEPLOYMENT_TYPE, deplType.toString());

    return requestExecuter.postData(adminUrl, getData, postData);
}

From source file:com.openmeap.admin.web.AdminTestHelper.java

public Result getConnectionOpen(ApplicationVersion version, String slicVersion)
        throws HttpRequestException, IOException, JSONException {
    Hashtable<String, Object> postData = new Hashtable<String, Object>();
    postData.put(UrlParamConstants.ACTION, "connection-open-request");
    postData.put(UrlParamConstants.DEVICE_UUID, UUID.randomUUID());
    postData.put(UrlParamConstants.APP_NAME, version.getApplication().getName());
    postData.put(UrlParamConstants.APP_VERSION, version.getIdentifier());
    postData.put(UrlParamConstants.APPARCH_HASH, version.getArchive().getHash());
    postData.put(UrlParamConstants.SLIC_VERSION, slicVersion);
    HttpResponse response = requestExecuter.postData(APP_MGMT_WEB_URL, postData);

    String responseText = Utils.readInputStream(response.getResponseBody(), FormConstants.CHAR_ENC_DEFAULT);
    JSONObjectBuilder job = new JSONObjectBuilder();
    Result result = (Result) job.fromJSON(new JSONObject(responseText), new Result());
    return result;
}

From source file:com.openmeap.admin.web.AdminTestHelper.java

public HttpResponse postAddModifyApp(Application application)
        throws HttpRequestException, ParameterMapBuilderException {

    Hashtable<String, Object> getData = new Hashtable<String, Object>();
    getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APP_ADDMODIFY);
    if (application.getPk() != null) {
        getData.put(FormConstants.APP_ID, application.getPk().toString());
    }// w  w w. j av  a2  s .  c o  m

    Hashtable<String, Object> postData = new Hashtable<String, Object>();
    postData.put(FormConstants.PROCESS_TARGET, ProcessingTargets.ADDMODIFY_APP);
    postData.put("submit", "true");
    postData.put("delete", "false");

    paramsBuilder.toParameters(postData, application);

    return requestExecuter.postData(adminUrl, getData, postData);
}

From source file:com.openmeap.admin.web.AdminTestHelper.java

public HttpResponse postAddModifyAppVer(ApplicationVersion appVer, File uploadArchive)
        throws HttpRequestException, ParameterMapBuilderException {

    Hashtable<String, Object> getData = new Hashtable<String, Object>();
    getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APPVER_ADDMODIFY);
    getData.put(FormConstants.APP_ID, appVer.getApplication().getPk().toString());
    if (appVer.getPk() != null) {
        getData.put(FormConstants.APPVER_ID, appVer.getPk().toString());
    }//from   w  w w.ja  va 2 s. c  o m

    Hashtable<String, Object> postData = new Hashtable<String, Object>();
    postData.put(FormConstants.PROCESS_TARGET, ProcessingTargets.ADDMODIFY_APPVER);
    postData.put(FormConstants.APP_ID, appVer.getApplication().getPk().toString());
    postData.put(FormConstants.UPLOAD_ARCHIVE, uploadArchive);
    paramsBuilder.toParameters(postData, appVer);

    return requestExecuter.postData(adminUrl, getData, postData);
}

From source file:com.openmeap.admin.web.AdminTestHelper.java

public HttpResponse postAddModifyApp_delete(Application application)
        throws HttpRequestException, ParameterMapBuilderException {

    Hashtable<String, Object> getData = new Hashtable<String, Object>();
    getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APP_ADDMODIFY);
    if (application.getPk() != null) {
        getData.put(FormConstants.APP_ID, application.getPk().toString());
    }/*w  w  w  .j  av a2  s .co  m*/

    Hashtable<String, Object> postData = new Hashtable<String, Object>();
    postData.put(FormConstants.PROCESS_TARGET, ProcessingTargets.ADDMODIFY_APP);
    postData.put("deleteConfirm", FormConstants.APP_DELETE_CONFIRM_TEXT);
    postData.put(FormConstants.DELETE, "Delete!");
    postData.put("submit", "false");
    postData.put("delete", "true");

    paramsBuilder.toParameters(postData, application);

    return requestExecuter.postData(adminUrl, getData, postData);
}

From source file:eionet.gdem.dcm.business.WorkqueueManager.java

/**
 * Adds new jobs into the workqueue by the given XML Schema
 *
 * @param user/*  w w  w .ja va2s .c  om*/
 *            Loggedin user name.
 * @param sourceUrl
 *            Source URL of XML file.
 * @param schemaUrl
 *            XML Schema URL.
 * @return List of job IDs.
 * @throws DCMException
 */
public List<String> addSchemaScriptsToWorkqueue(String user, String sourceUrl, String schemaUrl)
        throws DCMException {

    List<String> result = new ArrayList<String>();
    try {
        if (!SecurityUtil.hasPerm(user, "/" + Names.ACL_WQ_PATH, "i")) {
            LOGGER.debug("You don't have permissions jobs into workqueue!");
            throw new DCMException(BusinessConstants.EXCEPTION_AUTORIZATION_QASCRIPT_UPDATE);
        }

    } catch (DCMException e) {
        throw e;
    } catch (Exception e) {
        LOGGER.error("Error adding job to workqueue", e);
        throw new DCMException(BusinessConstants.EXCEPTION_GENERAL);
    }
    XQueryService xqE = new XQueryService();
    xqE.setTrustedMode(false);
    try {
        Hashtable h = new Hashtable();
        Vector files = new Vector();
        files.add(sourceUrl);
        h.put(schemaUrl, files);
        Vector v_result = xqE.analyzeXMLFiles(h);
        if (v_result != null) {
            for (int i = 0; i < v_result.size(); i++) {
                Vector v = (Vector) v_result.get(i);
                result.add((String) v.get(0));
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        LOGGER.error("Error adding job to workqueue", e);
        throw new DCMException(BusinessConstants.EXCEPTION_GENERAL);
    }
    return result;
}

From source file:com.openmeap.admin.web.AdminTestHelper.java

public HttpResponse postGlobalSettings(GlobalSettings settings)
        throws HttpRequestException, ParameterMapBuilderException {

    Hashtable<String, Object> getData = new Hashtable<String, Object>();
    getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_GLOBAL_SETTINGS);

    Hashtable<String, Object> postData = new Hashtable<String, Object>();
    postData.put(FormConstants.PROCESS_TARGET, ProcessingTargets.GLOBAL_SETTINGS);
    paramsBuilder.toParameters(postData, settings);
    if (settings.getClusterNodes() != null && !settings.getClusterNodes().isEmpty()) {
        List<String> nodeUrls = new ArrayList<String>();
        List<String> nodePaths = new ArrayList<String>();
        for (ClusterNode clusterNode : settings.getClusterNodes()) {
            nodeUrls.add(clusterNode.getServiceWebUrlPrefix());
            nodePaths.add(clusterNode.getFileSystemStoragePathPrefix());
        }//from w w w. java  2 s.com
        postData.put("clusterNodeUrl", nodeUrls);
        postData.put("clusterNodePath", nodePaths);
    }

    return requestExecuter.postData(adminUrl, getData, postData);
}

From source file:com.openmeap.admin.web.AdminTestHelper.java

public HttpResponse postAddModifyAppVer_delete(ApplicationVersion appVer)
        throws HttpRequestException, ParameterMapBuilderException {

    Hashtable<String, Object> getData = new Hashtable<String, Object>();
    getData.put(FormConstants.PAGE_BEAN, FormConstants.PAGE_BEAN_APPVER_ADDMODIFY);
    getData.put(FormConstants.APP_ID, appVer.getApplication().getPk().toString());
    if (appVer.getPk() != null) {
        getData.put(FormConstants.APPVER_ID, appVer.getPk().toString());
    }/*  w  ww  . j a va 2 s  .c  om*/

    Hashtable<String, Object> postData = new Hashtable<String, Object>();
    postData.put(FormConstants.PROCESS_TARGET, ProcessingTargets.ADDMODIFY_APPVER);
    postData.put(FormConstants.APP_ID, appVer.getApplication().getPk().toString());
    if (appVer.getPk() != null) {
        postData.put(FormConstants.APPVER_ID, appVer.getPk().toString());
    }
    paramsBuilder.toParameters(postData, appVer);
    postData.put("deleteConfirm", FormConstants.APPVER_DELETE_CONFIRM_TEXT);
    postData.put(FormConstants.DELETE, "Delete!");
    postData.put("Delete!", "Delete!");

    return requestExecuter.postData(adminUrl, getData, postData);
}

From source file:com.softlayer.messaging.messagequeue.client.TopicClient.java

/**
 * removes the topic// w  ww.  j a  v a  2s. c o  m
 * 
 * @param topicName
 *            the name of the topic to remove
 * @param force
 *            a boolean indicating to force the deletion even if messages
 *            exist on the topic
 * @return
 * @throws IOException
 * @throws JSONException
 * @throws UnexpectedReplyTypeException
 */
public TopicResponse delete(String topicName, boolean force)
        throws IOException, JSONException, UnexpectedReplyTypeException {
    Hashtable<String, String> headers = super.createHeaderToken();
    Hashtable<String, String> params = new Hashtable<String, String>();
    if (force) {

        params.put(FORCE, String.valueOf(force));
    }
    String url = Client.baseurl + TOPICSURL + "/" + topicName;
    JSONObject result = super.delete(headers, params, url);
    TopicResponse response = gson.fromJson(result.toString(), TopicResponse.class);
    return response;
}

From source file:SoundPlayer.java

JSlider createSlider(final FloatControl c) {
    if (c == null)
        return null;
    final JSlider s = new JSlider(0, 1000);
    final float min = c.getMinimum();
    final float max = c.getMaximum();
    final float width = max - min;
    float fval = c.getValue();
    s.setValue((int) ((fval - min) / width * 1000));

    java.util.Hashtable labels = new java.util.Hashtable(3);
    labels.put(new Integer(0), new JLabel(c.getMinLabel()));
    labels.put(new Integer(500), new JLabel(c.getMidLabel()));
    labels.put(new Integer(1000), new JLabel(c.getMaxLabel()));
    s.setLabelTable(labels);/*from w w  w.j a  v  a2 s  . c om*/
    s.setPaintLabels(true);

    s.setBorder(new TitledBorder(c.getType().toString() + " " + c.getUnits()));

    s.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            int i = s.getValue();
            float f = min + (i * width / 1000.0f);
            c.setValue(f);
        }
    });
    return s;
}