Example usage for java.util Vector elements

List of usage examples for java.util Vector elements

Introduction

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

Prototype

public Enumeration<E> elements() 

Source Link

Document

Returns an enumeration of the components of this vector.

Usage

From source file:org.soaplab.services.AnalysisInventoryProvider.java

/**************************************************************************
 *
 *************************************************************************/
public String[] getAvailableAnalyses() {

    Set<String> result = new TreeSet<String>();
    for (int i = 0; i < listProviders.length; i++) {
        String authority = getAuthorityAsPrefix(listProviders[i]);
        Hashtable<String, Vector<AnalysisInstallation>> list = listProviders[i].getList();
        for (Enumeration<String> en = list.keys(); en.hasMoreElements();) {
            String key = en.nextElement();
            String prefix = authority + key.trim();
            if (!"".equals(prefix))
                prefix += SoaplabConstants.SOAPLAB_SERVICE_NAME_DELIMITER;
            Vector<AnalysisInstallation> apps = list.get(key);
            for (Enumeration<AnalysisInstallation> en2 = apps.elements(); en2.hasMoreElements();) {
                AnalysisInstallation app = en2.nextElement();
                result.add(prefix + app.getAppName());
            }/*from   w  ww  .j  av a  2  s  .  co m*/
        }
    }
    return result.toArray(new String[] {});
}

From source file:org.soaplab.services.AnalysisInventoryProvider.java

/******************************************************************************
 *
 ******************************************************************************/
public SoaplabMap getAvailableAnalysesWithDescription() {

    Map<String, String> result = new HashMap<String, String>();
    for (int i = 0; i < listProviders.length; i++) {
        String authority = getAuthorityAsPrefix(listProviders[i]);
        Hashtable<String, Vector<AnalysisInstallation>> list = listProviders[i].getList();
        for (Enumeration<String> en = list.keys(); en.hasMoreElements();) {
            String key = en.nextElement();
            String prefix = authority + key.trim();
            if (!"".equals(prefix))
                prefix += SoaplabConstants.SOAPLAB_SERVICE_NAME_DELIMITER;
            Vector<AnalysisInstallation> apps = list.get(key);
            for (Enumeration<AnalysisInstallation> en2 = apps.elements(); en2.hasMoreElements();) {
                AnalysisInstallation app = en2.nextElement();
                result.put(prefix + app.getAppName(), app.getDesc());
            }//from   www .j  av  a  2s  . c o  m
        }
    }
    return SoaplabMap.fromStringMap(result);
}

From source file:org.soaplab.services.AnalysisInventoryProvider.java

/**************************************************************************
 * Return a container with information about an analysis
 * represented by the given service. <p>
 *
 * @return an information about a service, or null
 *************************************************************************/
public AnalysisInstallation getServiceInstallation(String serviceName) {
    if (serviceName == null)
        return null;

    for (int i = 0; i < listProviders.length; i++) {
        String authority = getAuthorityAsPrefix(listProviders[i]);
        Hashtable<String, Vector<AnalysisInstallation>> list = listProviders[i].getList();
        for (Enumeration<String> en = list.keys(); en.hasMoreElements();) {
            String key = en.nextElement();
            String prefix = authority + key.trim();
            if (!"".equals(prefix))
                prefix += SoaplabConstants.SOAPLAB_SERVICE_NAME_DELIMITER;
            Vector<AnalysisInstallation> apps = list.get(key);
            for (Enumeration<AnalysisInstallation> en2 = apps.elements(); en2.hasMoreElements();) {
                AnalysisInstallation app = en2.nextElement();
                if (serviceName.equals(prefix + app.getAppName()))
                    return app;
            }/*from  ww w  .  j a va 2s  .  c o  m*/
        }
    }
    return null;
}

From source file:be.fedict.hsm.jca.HSMProxyKeyStore.java

@Override
public Enumeration<String> engineAliases() {
    Set<String> aliases = this.keyStoreParameter.getHSMProxyClient().getAliases();
    Vector<String> aliasesVector = new Vector<String>();
    for (String alias : aliases) {
        aliasesVector.add(alias);/*from   w w  w  .  j  a v a 2s  .  co  m*/
    }
    return aliasesVector.elements();
}

From source file:org.jbpm.formModeler.service.bb.mvc.controller.RequestMultipartWrapper.java

/**
 * Returns the parameter names on the MultipartRequest that are of type file
 *
 * @return An Enumeration containing all the Parameter Names
 *//*  www.  ja  va2 s . c o m*/
public Enumeration getFileParameterNames() {
    Vector names = new Vector(requestFiles.size());
    names.addAll(requestFiles.keySet());
    return names.elements();
}

From source file:com.globalsight.everest.webapp.pagehandler.projects.workflows.WorkflowHandlerHelper.java

/**
 * Converts the vector of workflow instance tasks to an array.
 * //from  w  w w.  ja  va2  s. com
 * @param p_wfInstanceTasks
 *            - the workflow instance tasks.
 * 
 * @return an array of the workflow instance tasks.
 */
public static WorkflowTaskInstance[] convertToArray(Vector p_wfInstanceTasks) {
    WorkflowTaskInstance[] taskInstances = new WorkflowTaskInstance[p_wfInstanceTasks.size()];

    Enumeration e = p_wfInstanceTasks.elements();
    int i = 0;
    while (e.hasMoreElements()) {
        taskInstances[i++] = (WorkflowTaskInstance) e.nextElement();
    }

    return taskInstances;
}

From source file:org.apache.shindig.gadgets.servlet.ServletUtilTest.java

Enumeration<String> makeEnumeration(String... args) {
    Vector<String> vector = new Vector<String>();
    vector.addAll(Arrays.asList(args));
    return vector.elements();
}

From source file:org.jboss.dashboard.ui.controller.RequestMultipartWrapper.java

/**
 * Returns the parameter names on the MultipartRequest that are of type file
 *
 * @return An Enumeration containing all the Parameter Names
 *///from  w w w  .j  a  va2  s.c  om
public Enumeration<String> getFileParameterNames() {
    Vector<String> names = new Vector<String>(requestFiles.size());
    names.addAll(requestFiles.keySet());
    return names.elements();
}

From source file:org.apache.shindig.gadgets.servlet.HtmlAccelServletTest.java

private void expectRequest(String extraPath, String url) {
    expect(request.getMethod()).andReturn("GET").anyTimes();
    expect(request.getServletPath()).andReturn(SERVLET).anyTimes();
    expect(request.getScheme()).andReturn("http").anyTimes();
    expect(request.getServerName()).andReturn("apache.org").anyTimes();
    expect(request.getServerPort()).andReturn(-1).anyTimes();
    expect(request.getRequestURI()).andReturn(SERVLET + extraPath).anyTimes();
    expect(request.getRequestURL()).andReturn(new StringBuffer("apache.org" + SERVLET + extraPath)).anyTimes();
    String queryParams = (url == null ? "" : "url=" + url + "&container=accel" + "&gadget=test");
    expect(request.getQueryString()).andReturn(queryParams).anyTimes();
    Vector<String> headerNames = new Vector<String>();
    expect(request.getHeaderNames()).andReturn(headerNames.elements());
}

From source file:net.firejack.platform.core.utils.StringUtils.java

/**
 * @param text//from w  ww . j av  a2s .  c  o  m
 * @param len
 * @return
 */
public static String[] wrapText(String text, int len) {
    // return empty array for null text
    if (text == null)
        return new String[] {};

    // return text if len is zero or less
    if (len <= 0)
        return new String[] { text };

    // return text if less than length
    if (text.length() <= len)
        return new String[] { text };

    char[] chars = text.toCharArray();
    Vector lines = new Vector();
    StringBuilder line = new StringBuilder();
    StringBuilder word = new StringBuilder();

    for (char aChar : chars) {
        word.append(aChar);

        if (aChar == ' ') {
            if ((line.length() + word.length()) > len) {
                lines.add(line.toString());
                line.delete(0, line.length());
            }

            line.append(word);
            word.delete(0, word.length());
        }
    }

    // handle any extra chars in current word
    if (word.length() > 0) {
        if ((line.length() + word.length()) > len) {
            lines.add(line.toString());
            line.delete(0, line.length());
        }
        line.append(word);
    }

    // handle extra line
    if (line.length() > 0) {
        lines.add(line.toString());
    }

    String[] ret = new String[lines.size()];
    int c = 0; // counter
    for (Enumeration e = lines.elements(); e.hasMoreElements(); c++) {
        ret[c] = (String) e.nextElement();
    }

    return ret;
}