Example usage for java.util StringTokenizer nextElement

List of usage examples for java.util StringTokenizer nextElement

Introduction

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

Prototype

public Object nextElement() 

Source Link

Document

Returns the same value as the nextToken method, except that its declared return value is Object rather than String .

Usage

From source file:controller.servlet.PostServlet.java

/**
 * Handles the HTTP <code>POST</code> method.
 *
 * @param request servlet request//from w  w  w . jav a2  s  . c om
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    PostDAOService postService = PostDAO.getInstance();
    String title = null;
    String shortTitle = null;
    String sCategoryID = null;
    String content = null;
    String link = null;
    String action = null;
    // String pathImage;
    String imageName = "";
    boolean isUploadSuccess = false;
    ServletFileUpload fileUpload = new ServletFileUpload();
    try {
        FileItemIterator itr = fileUpload.getItemIterator(request);
        while (itr.hasNext()) {
            FileItemStream fileItemStream = itr.next();
            if (fileItemStream.isFormField()) {
                String fieldName = fileItemStream.getFieldName();
                InputStream is = fileItemStream.openStream();

                byte[] b = new byte[is.available()];
                is.read(b);
                String value = new String(b, "UTF-8");
                if (fieldName.equals("action")) {
                    action = value;
                }
                if (fieldName.equals("title")) {
                    title = value;
                }
                if (fieldName.equals("content")) {
                    content = value;
                }
                if (fieldName.equals("short-title")) {
                    shortTitle = value;
                }
                if (fieldName.equals("category-id")) {
                    sCategoryID = value;
                }
                if (fieldName.equals("link")) {
                    link = value;
                }

            } else {
                String realPath = getServletContext().getRealPath("/");
                String filePath = realPath.replace("\\build\\web", "\\web\\image\\post");//Duong dan luu file anh
                imageName = fileItemStream.getName();
                StringTokenizer token = new StringTokenizer(imageName, ".");
                String fileNameExtension = "";
                while (token.hasMoreElements()) {
                    fileNameExtension = token.nextElement().toString();
                }
                System.out.println("img: " + imageName);
                if (!imageName.equals("")) {
                    imageName = Support.randomString();
                    isUploadSuccess = FileUpload.processFile(filePath, fileItemStream, imageName,
                            fileNameExtension);
                    imageName += "." + fileNameExtension;
                }
            }
        }
        Post currentPost = new Post();
        currentPost.setPostID(postService.nextID());
        currentPost.setTitle(title);
        currentPost.setShortTitle(shortTitle);
        currentPost.setCategory(new Category(Integer.valueOf(sCategoryID), "", false));
        currentPost.setContent(content);
        currentPost.setDatePost(Support.getDatePost());
        currentPost.setUser((User) request.getSession().getAttribute(Constants.CURRENT_USER));
        currentPost.setLink(link);
        currentPost.setActive(false);
        request.setAttribute(Constants.CURRENT_POST, currentPost);
        request.setAttribute(Constants.LIST_CATEGORY, CategoryDAO.getInstance().getCategories());
        if (action != null) {
            switch (action) {
            case "up-load":
                upLoad(request, response, imageName, isUploadSuccess);
                break;
            case "add-topic":
                addTopic(request, response, currentPost);
                break;
            }
        }
    } catch (IOException | org.apache.tomcat.util.http.fileupload.FileUploadException e) {
        response.getWriter().println(e.toString());
    }
}

From source file:org.opentestsystem.delivery.testreg.upload.FileUploadUtils.java

public int getDomainObject(final Object[] cellData) {

    //getting each row data during file-upload process and construct LinkedHashMap assign data to its corresponding key

    int counter = 0;
    List<String> headersList = masterResourceAccommodationService.getAllOptionsCodes();
    HashMap<String, String> headerResourceTypes = masterResourceAccommodationService.getAllResourceTypes();
    headerResourceTypes.put("StudentId", "SingleSelectResource");
    headerResourceTypes.put("StateAbbreviation", "SingleSelectResource");
    headerResourceTypes.put("Subject", "SingleSelectResource");
    Map<String, String> accommodationMap = new LinkedHashMap<String, String>();
    Map<String, Object> accommoMap = new LinkedHashMap<String, Object>();
    if (cellData.length == 4) {
        accommoMap = convertDataToMap(cellData, headersList, headerResourceTypes);
    } else {//from   ww w.  ja v  a 2  s .c  om
        for (int i = 0; i < headersList.size(); i++) {
            String key = ARTHelpers.convertCodeToUpperCase(headersList.get(i));
            if (headerResourceTypes.containsKey(key) && headerResourceTypes.get(key)
                    .equals(AccommodationResourceType.MultiSelectResource.name())) {
                List<String> al = new ArrayList<String>();
                StringTokenizer tokenizer = new StringTokenizer(cellData[i].toString(), ";");
                while (tokenizer.hasMoreElements()) {
                    String token = (String) tokenizer.nextElement();
                    al.add(token.trim());
                }
                accommodationMap.put(headersList.get(i), al.toString());
                accommoMap.put(headersList.get(i), al);
            } else if (headerResourceTypes.containsKey(key)
                    && headerResourceTypes.get(key)
                            .equals(AccommodationResourceType.SingleSelectResource.name())
                    || headerResourceTypes.get(key).equals(AccommodationResourceType.EditResource.name())) {
                if (headersList.get(i).equalsIgnoreCase("subject")
                        || headersList.get(i).equalsIgnoreCase("stateAbbreviation")) {
                    accommodationMap.put(headersList.get(i), cellData[i].toString().toUpperCase());
                    accommoMap.put(headersList.get(i), cellData[i].toString().toUpperCase());
                } else {
                    accommodationMap.put(headersList.get(i), cellData[i].toString());
                    accommoMap.put(headersList.get(i), cellData[i].toString());
                }
            }
        }
    }

    String studentId = (String) accommoMap.get("studentId");
    String stateAbbreviation = (String) accommoMap.get("stateAbbreviation");

    //saving accommodationMap we constructed into it's corresponding student based on studentId,stateAbbreviation
    Student student = studentService.saveAccommodation(studentId, stateAbbreviation, accommoMap);
    if (student != null) {
        counter++;
    }
    return counter;
}

From source file:org.opentestsystem.delivery.testreg.upload.FileUploadUtils.java

/**
 * Converting accommodationData( accommodation upload data ) to accommodationMap
 * //from   w w  w  . j av  a2 s.  co m
 * @param columns               accommodation data from upload file 
 * @param headers               list of all accommodation resource codes 
 * @param headerResourceTypes   masterResourceAccommodation map with key : resourceCode and value : resourceType
 * @return map with data( values ) assigned to its corresponding resource codes(key)
 */
@SuppressWarnings("unchecked")
private Map<String, Object> convertDataToMap(Object[] columns, List<String> headers,
        HashMap<String, String> headerResourceTypes) {

    HashMap<String, Object> accommodationMap = new LinkedHashMap<String, Object>();
    HashMap<String, Object> data = new LinkedHashMap<String, Object>();
    for (String columnHeader : headers) {
        if (columnHeader.equalsIgnoreCase("subject") || columnHeader.equalsIgnoreCase("stateAbbreviation")) {
            accommodationMap.put(columnHeader, columns[headers.indexOf(columnHeader)].toString().toUpperCase());
        } else if (columnHeader.equalsIgnoreCase("studentId")) {
            accommodationMap.put(columnHeader, columns[headers.indexOf(columnHeader)].toString());
        }
    }
    String allAccommodationCodes = columns[3].toString();
    List<String> accommodationCode = new ArrayList<String>();
    StringTokenizer tokenizer = new StringTokenizer(allAccommodationCodes, "|");
    while (tokenizer.hasMoreElements()) {
        String token = (String) tokenizer.nextElement();
        accommodationCode.add(token.trim());
    }

    HashMap<String, List<String>> masterAccommodationOptions = masterResourceAccommodationService
            .getMasterResourceOptions();

    Set<String> masterCodes = masterAccommodationOptions.keySet();
    for (String uploadCode : accommodationCode) {
        for (String resourceCode : masterCodes) {
            ArrayList<String> options = new ArrayList<String>();
            if (uploadCode.contains("(") && uploadCode.contains(")")) {
                int startIndex = (uploadCode.indexOf("(")) + 1;
                int endIndex = (uploadCode.indexOf(")"));
                String editResource = uploadCode.substring(startIndex, endIndex);
                String matchResource = uploadCode.substring(0, uploadCode.indexOf("("));
                if (resourceCode.equalsIgnoreCase(matchResource)) {
                    data.put(resourceCode, editResource);
                    break;
                }
            } else {
                if (masterAccommodationOptions.get(resourceCode).contains(uploadCode)) {
                    String key = ARTHelpers.convertCodeToUpperCase(resourceCode);
                    if (headerResourceTypes.containsKey(key) && headerResourceTypes.get(key)
                            .equals(AccommodationResourceType.MultiSelectResource.name())) {
                        if (data.containsKey(resourceCode)) {
                            ArrayList<String> tempResourceCodes = (ArrayList<String>) data.get(resourceCode);
                            if (tempResourceCodes != null) {
                                tempResourceCodes.add(uploadCode);
                                data.put(resourceCode, tempResourceCodes);
                                break;
                            }
                        } else {
                            options.add(uploadCode);
                            data.put(resourceCode, options);
                            break;
                        }
                    } else {
                        data.put(resourceCode, uploadCode);
                        break;
                    }
                }
            }
        }
    }
    for (String resourceCode : masterAccommodationOptions.keySet()) {
        Set<String> accommodationResourceCodes = data.keySet();
        if (accommodationResourceCodes.contains(resourceCode)) {
            String key = ARTHelpers.convertToLowerCase(resourceCode);
            accommodationMap.put(key, data.get(resourceCode));
        } else {
            if (headerResourceTypes.containsKey(resourceCode) && headerResourceTypes.get(resourceCode)
                    .equals(AccommodationResourceType.MultiSelectResource.name())) {
                ArrayList<String> accommoList = new ArrayList<String>();
                accommodationMap.put(ARTHelpers.convertToLowerCase(resourceCode), accommoList);
            } else {
                accommodationMap.put(ARTHelpers.convertToLowerCase(resourceCode), "");
            }

        }
    }

    return accommodationMap;
}

From source file:gtu._work.ui.ObnfExceptionLogDownloadUI.java

private void downloadBtnAction() {
    try {/*  www  .j a va  2s  .  c  om*/
        FtpSite ftpSite = (FtpSite) siteFtpComboBox.getSelectedItem();
        if (ftpSite == null) {
            JCommonUtil._jOptionPane_showMessageDialog_error("?");
            return;
        }
        String messageIdAreaText = messageIdArea.getText();
        if (StringUtils.isBlank(messageIdAreaText)) {
            JCommonUtil._jOptionPane_showMessageDialog_error("MessageId");
            return;
        }
        String destDirStr = exportTextField.getText();
        if (StringUtils.isBlank(destDirStr)) {
            JCommonUtil._jOptionPane_showMessageDialog_error("");
            return;
        }
        File destDir = new File(destDirStr);
        if (!destDir.exists() || !destDir.isDirectory()) {
            JCommonUtil._jOptionPane_showMessageDialog_error("??");
            return;
        }
        List<String> findList = new ArrayList<String>();
        StringTokenizer tok = new StringTokenizer(messageIdAreaText);
        while (tok.hasMoreElements()) {
            String messageId = (String) tok.nextElement();
            findList.add(messageId);
        }
        logArea.setText("");
        FtpUtil ftpUtil = new FtpUtil();
        ftpUtil.connect(ftpSite.ip, ftpSite.port, ftpSite.userId, ftpSite.password, false);

        List<FtpFileInfo> fileList = new ArrayList<FtpFileInfo>();
        ftpUtil.scanFindFile(ftpSite.path, ".*", fileList, ftpUtil.getFtp());
        for (FtpFileInfo f : fileList) {
            System.out.println("===>" + f.getAbsolutePath());
        }

        List<FtpFileInfo> findOkList = new ArrayList<FtpFileInfo>();
        for (FtpFileInfo f : fileList) {
            for (int ii = 0; ii < findList.size(); ii++) {
                String messageId = findList.get(ii);
                if (f.getName().contains(messageId)) {
                    findOkList.add(f);
                    findList.remove(ii);
                    ii--;
                    break;
                }
            }
        }

        StringBuffer sb = new StringBuffer();
        for (FtpFileInfo f : findOkList) {
            File downloadFile = new File(destDir, f.getName());
            sb.append("ftp:" + f.getAbsolutePath() + "\n");
            ftpUtil.getFile(f.getAbsolutePath(), new FileOutputStream(downloadFile));
            sb.append(":" + downloadFile + "\n");
        }
        ftpUtil.disconnect();

        for (String messageId : findList) {
            sb.append(messageId + " - ?\n");
        }

        logArea.setText(sb.toString());
        JCommonUtil._jOptionPane_showMessageDialog_info("?, log");
    } catch (Exception ex) {
        JCommonUtil.handleException(ex);
        File f = new File(FileUtil.DESKTOP_DIR, "test_log_001.log");
        try {
            PrintWriter pw = new PrintWriter(new FileOutputStream(f));
            ex.printStackTrace(pw);
            pw.flush();
            pw.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.actionbazaar.controller.SellController.java

/**
 * Performs the category search// w w w.  j a va2s  . c  o m
 */
public void performCategorySearch() {
    List<String> split = new LinkedList<>();
    StringTokenizer tokenizer = new StringTokenizer(keywords, " ");
    while (tokenizer.hasMoreElements()) {
        split.add((String) tokenizer.nextElement());
    }
    String splitArray[] = new String[split.size()];
    splitArray = split.toArray(splitArray);
    searchCategories.setSource(pickListBean.findCategories(splitArray));
}

From source file:org.apache.jcs.auxiliary.lateral.http.server.AbstractDeleteCacheServlet.java

/** Description of the Method */
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    if (!authenticator.authenticate(req, res)) {
        return;/*w  w w .  j a  v a2 s.  c  o m*/
    }
    Hashtable params = new Hashtable();
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    try {
        String paramName;
        String paramValue;

        // GET PARAMETERS INTO HASHTABLE
        for (Enumeration e = req.getParameterNames(); e.hasMoreElements();) {
            paramName = (String) e.nextElement();
            paramValue = req.getParameter(paramName);
            params.put(paramName, paramValue);
            if (log.isDebugEnabled()) {
                log.debug(paramName + "=" + paramValue);
            }
        }
        String hashtableName = req.getParameter("hashtableName");
        String key = req.getParameter("key");

        if (hashtableName == null) {
            hashtableName = req.getParameter("cacheName");
        }
        out.println("<html><body bgcolor=#FFFFFF>");

        if (hashtableName != null) {

            if (log.isDebugEnabled()) {
                log.debug("hashtableName = " + hashtableName);
            }
            out.println("(Last hashtableName = " + hashtableName + ")");

            if (hashtableName.equals("ALL")) {

                // Clear all caches.
                String[] list = cacheMgr.getCacheNames();
                Arrays.sort(list);

                for (int i = 0; i < list.length; i++) {
                    String name = list[i];
                    ICache cache = cacheMgr.getCache(name);
                    cache.removeAll();
                }
                out.println("All caches have been cleared!");
            } else {

                ICache cache = cacheMgr.getCache(hashtableName);

                String task = (String) params.get("task");
                if (task == null) {
                    task = "delete";
                }

                if (task.equalsIgnoreCase("stats")) {

                    //                        out.println( "<br><br>" );
                    //                        out.println( "<b>Stats for " + hashtableName + ":</b><br>" );
                    //                        out.println( cache.getStats() );
                    //                        out.println( "<br>" );

                } else {

                    // Remove the specified cache.

                    if (key != null) {
                        if (key.toUpperCase().equals("ALL")) {
                            cache.removeAll();

                            if (log.isDebugEnabled()) {
                                log.debug("Removed all elements from " + hashtableName);
                            }
                            out.println("key = " + key);
                        } else {
                            if (log.isDebugEnabled()) {
                                log.debug("key = " + key);
                            }
                            out.println("key = " + key);
                            StringTokenizer toke = new StringTokenizer(key, "_");

                            while (toke.hasMoreElements()) {
                                String temp = (String) toke.nextElement();
                                cache.remove(key);

                                if (log.isDebugEnabled()) {
                                    log.debug("Removed " + temp + " from " + hashtableName);
                                }
                            }
                        }
                    } else {
                        out.println("key is null");
                    }

                }
                // end is task == delete

            }
        } else {
            out.println("(No hashTableName specified.)");
        }

        // PRINT OUT MENU
        out.println("<br>");
        int antiCacheRandom = (int) (10000.0 * Math.random());
        out.println("<a href=?antiCacheRandom=" + antiCacheRandom + ">List all caches</a><br>");
        out.println("<br>");
        out.println("<a href=?hashtableName=ALL&key=ALL&antiCacheRandom=" + antiCacheRandom
                + "><font color=RED>Clear All Cache Regions</font></a><br>");
        out.println("<br>");
        String[] list = cacheMgr.getCacheNames();
        Arrays.sort(list);
        out.println("<div align=CENTER>");
        out.println("<table border=1 width=80%>");
        out.println("<tr bgcolor=#eeeeee><td>Cache Region Name</td><td>Size</td><td>Status</td><td>Stats</td>");
        for (int i = 0; i < list.length; i++) {
            String name = list[i];
            out.println("<tr><td><a href=?hashtableName=" + name + "&key=ALL&antiCacheRandom=" + antiCacheRandom
                    + ">" + name + "</a></td>");
            ICache cache = cacheMgr.getCache(name);
            out.println("<td>");
            out.print(cache.getSize());
            out.print("</td><td>");
            int status = cache.getStatus();
            out.print(status == CacheConstants.STATUS_ALIVE ? "ALIVE"
                    : status == CacheConstants.STATUS_DISPOSED ? "DISPOSED"
                            : status == CacheConstants.STATUS_ERROR ? "ERROR" : "UNKNOWN");
            out.print("</td>");
            out.println("<td><a href=?task=stats&hashtableName=" + name + "&key=NONE&antiCacheRandom="
                    + antiCacheRandom + ">stats</a></td>");
        }
        out.println("</table>");
        out.println("</div>");
    }
    //CATCH EXCEPTIONS
    catch (Exception e) {
        log.error(e);
        //log.logIt( "hashtableName = " + hashtableName );
        //log.logIt( "key = " + key );
    }
    // end try{
    finally {
        String isRedirect = (String) params.get("isRedirect");
        if (isRedirect == null) {
            isRedirect = "N";
        }
        if (log.isDebugEnabled()) {
            log.debug("isRedirect = " + isRedirect);
        }
        String url;
        if (isRedirect.equals("Y")) {
            url = (String) params.get("url");
            if (log.isDebugEnabled()) {
                log.debug("url = " + url);
            }
            res.sendRedirect(url);
            // will not work if there's a previously sent header
            out.println("<br>\n");
            out.println(" <script>");
            out.println(" location.href='" + url + "'; ");
            out.println(" </script> ");
            out.flush();
        } else {
            url = "";
        }
        out.println("</body></html>");
    }
}

From source file:org.wso2.appcloud.core.docker.DockerClient.java

/**
 * Create a docker file according to given details. This will get docker template file and replace the parameters
 * with the given customized values in the dockerFilePropertyMap
 * @param dockerFilePath/*from w  w w  .  j ava 2s  . com*/
 * @param runtimeId - application runtime id
 * @param dockerTemplateFilePath
 * @param dockerFileCategory - app creation method eg : svn, url, default
 * @param dockerFilePropertyMap
 * @param customDockerFileProperties
 * @throws IOException
 * @throws AppCloudException
 */
public void createDockerFile(String dockerFilePath, String runtimeId, String dockerTemplateFilePath,
        String dockerFileCategory, Map<String, String> dockerFilePropertyMap,
        Map<String, String> customDockerFileProperties) throws AppCloudException {

    customDockerFileProperties.keySet().removeAll(dockerFilePropertyMap.keySet());
    dockerFilePropertyMap.putAll(customDockerFileProperties);

    // Get docker template file
    // A sample docker file can be found at
    // https://github.com/wso2/app-cloud/blob/master/modules/resources/dockerfiles/wso2as/default/Dockerfile.wso2as.6.0.0-m1
    String dockerFileTemplatePath = DockerUtil.getDockerFileTemplatePath(runtimeId, dockerTemplateFilePath,
            dockerFileCategory);
    List<String> dockerFileConfigs = new ArrayList<>();

    try {
        for (String line : FileUtils.readLines(new File(dockerFileTemplatePath))) {
            StringTokenizer stringTokenizer = new StringTokenizer(line);
            //Search if line contains keyword to replace with the value
            while (stringTokenizer.hasMoreElements()) {
                String element = stringTokenizer.nextElement().toString().trim();
                if (dockerFilePropertyMap.containsKey(element)) {
                    if (log.isDebugEnabled()) {
                        log.debug("Dockerfile placeholder : " + element);
                    }
                    String value = dockerFilePropertyMap.get(element);
                    line = line.replace(element, value);
                }
            }
            dockerFileConfigs.add(line);
        }
    } catch (IOException e) {
        String msg = "Error occurred while reading docker template file " + dockerFileTemplatePath;
        throw new AppCloudException(msg, e);
    }
    try {
        FileUtils.writeLines(new File(dockerFilePath), dockerFileConfigs);
    } catch (IOException e) {
        String msg = "Error occurred while writing to docker file " + dockerFilePath;
        throw new AppCloudException(msg, e);
    }
}

From source file:org.wso2.carbon.andes.authorization.andes.AndesAuthorizationHandler.java

/**
 * We want to check user is authorize for parent topic in case of hierarchical topic
 * i.e. Let's say there is topic hierarchical topic country.province.city1
 * user who has permission to either country or province should be able to subscribe or
 * publish to city1 as well./*  w  w w. j a  va2 s.  co  m*/
 *
 * @param username username of logged user
 * @param userRealm User's Realm
 * @param topicId topic id
 * @param permission The permission type to check for
 *
 * @return is user authorize
 * @throws UserStoreException
 */
private static boolean isAuthorizeToParentInHierarchy(String username, UserRealm userRealm, String topicId,
        TreeNode.Permission permission) throws UserStoreException, RegistryClientException {

    //check given resource path exist before check permission in parent hierarchy
    if (!RegistryClient.isResourceExist(topicId)) {
        return false;
    }
    //tokenize resource path
    StringTokenizer tokenizer = new StringTokenizer(topicId, "/");
    StringBuilder resourcePathBuilder = new StringBuilder();
    //get token count
    int tokenCount = tokenizer.countTokens();
    int count = 0;
    boolean userAuthorized = false;
    Pattern pattern = Pattern.compile(PARENT_RESOURCE_PATH);

    while (tokenizer.hasMoreElements()) {
        //get each element in topicId resource path
        String resource = tokenizer.nextElement().toString();
        //build resource path again
        resourcePathBuilder.append(resource);
        //we want to check that build resource path has permission to any resource
        // after event/topics/
        Matcher matcher = pattern.matcher(resourcePathBuilder.toString());
        if (matcher.find()) {
            if (userRealm.getAuthorizationManager().isUserAuthorized(username, resourcePathBuilder.toString(),
                    permission.toString().toLowerCase())) {
                userAuthorized = true;
                break;
            }

        }
        count++;
        if (count < tokenCount) {
            resourcePathBuilder.append("/");
        }

    }
    return userAuthorized;
}

From source file:org.fusesource.cloudmix.agent.jbi.AgentComponent.java

private String[] getConfigList(Properties properties, String name, String defaultValue) {

    String value = properties.getProperty(name);
    if (value == null) {
        value = defaultValue;//from  w  ww.  j  av  a2s.  c  o m
    }

    StringTokenizer tokeniser = new StringTokenizer(value, ",");
    int arraySize = tokeniser.countTokens();
    String[] array = new String[arraySize];
    for (int i = 0; i < arraySize; i++) {
        String item = (String) tokeniser.nextElement();
        array[i] = item.trim();
    }
    return array;
}

From source file:com.frameworkset.orm.engine.model.JavaNameGenerator.java

/**
 * Converts a database schema name to java object name.  Operates
 * same as underscoreMethod but does not convert anything to
 * lowercase.//from ww  w.j  av a  2 s  .  c  o  m
 *
 * @param schemaName name to be converted.
 * @return converted name.
 * @see com.frameworkset.orm.engine.model.NameGenerator
 * @see #underscoreMethod(String)
 */
protected String javanameMethod(String schemaName, boolean IGNORE_FIRST_TOKEN) {
    StringBuffer name = new StringBuffer();
    StringTokenizer tok = new StringTokenizer(schemaName, String.valueOf(STD_SEPARATOR_CHAR));
    boolean first = true;
    String firstNamepart = null;
    while (tok.hasMoreTokens()) {

        if (first && IGNORE_FIRST_TOKEN) {
            firstNamepart = (String) tok.nextElement();
            first = false;

            continue;
        }
        String namePart = (String) tok.nextElement();

        name.append(StringUtils.capitalize(namePart));

    }

    // remove the SCHEMA_SEPARATOR_CHARs and capitalize 
    // the tokens
    if (name.length() > 0)
        schemaName = name.toString();
    else if (IGNORE_FIRST_TOKEN && firstNamepart != null)
        schemaName = firstNamepart;
    name = new StringBuffer();

    tok = new StringTokenizer(schemaName, String.valueOf(SCHEMA_SEPARATOR_CHAR));
    while (tok.hasMoreTokens()) {
        String namePart = (String) tok.nextElement();
        name.append(StringUtils.capitalize(namePart));
    }
    return name.toString();
}