Package org.apache.oodt.cas.pushpull.exceptions

Examples of org.apache.oodt.cas.pushpull.exceptions.ParserException


                }
            }
            return new VirtualFileStructure(initialCdDir, root);
        } catch (Exception e) {
            e.printStackTrace();
            throw new ParserException("Failed to parse XML file : "
                    + e.getMessage());
        }
    }
View Full Code Here


            StringBuffer sb = new StringBuffer("");
            while (s.hasNextLine())
                sb.append(s.nextLine() + "\n");

            if (!validEmail(sb.toString()))
                throw new ParserException(
                        "Email not a IASI data processed notification email");

            Pattern cdPattern = Pattern.compile("\\s*cd\\s{1,}.{1,}?(?:\\s|$)");
            Matcher cdMatcher = cdPattern.matcher(sb);
            Pattern getPattern = Pattern.compile("\\s*get\\s{1,}.{1,}?(?:\\s|$)");
            Matcher getMatcher = getPattern.matcher(sb);
           
            VirtualFile vf = null;
            while (cdMatcher.find() && getMatcher.find()) {
                String cdCommand = sb.substring(cdMatcher.start(), cdMatcher.end());
                String directory = cdCommand.trim().split(" ")[1];

                vf = new VirtualFile(root, directory, true);
                vf.setNoDirs(true);

                String getCommand = sb.substring(getMatcher.start(), getMatcher.end());
                String file = getCommand.trim().split(" ")[1];

                if (file.endsWith("*")) {
                    vf.addChild(new VirtualFile(file.substring(0,
                            file.length() - 1), false));
                    vf.addChild(new VirtualFile(file.substring(0,
                            file.length() - 1)
                            + ".sig", false));
                } else {
                    vf.addChild(new VirtualFile(file, false));
                }
            }

            Pattern ftpPattern = Pattern.compile("\\sftp\\..*?\\s");
            Matcher ftpMatcher = ftpPattern.matcher(sb);
            RemoteSite remoteSite = null;
            if (ftpMatcher.find()) {
                String ftpSite = sb.substring(ftpMatcher.start(), ftpMatcher.end()).trim();
                remoteSite = new RemoteSite(null, new URL("ftp://"
                        + ftpSite), "anonymous", System
                        .getenv("user.name")
                        + "@jpl.nasa.gov");
            }

            return new VirtualFileStructure(remoteSite, "/", root);
        } catch (Exception e) {
            e.printStackTrace();
            throw new ParserException("Failed to parse IASI email : "
                    + e.getMessage());
        }
    }
View Full Code Here

    VirtualFile root = VirtualFile.createRootDir();

    String emailText = readEmail(emailFile);
    if (!isValidEmail(emailText)) {
      throw new ParserException("Failed to find check for pattern in email: " + checkForPattern);
    }
    List<String> filePaths = generateFilePaths(emailText);

    for (String filePath : filePaths) {
      new VirtualFile(root, pathToRoot + filePath, false);
View Full Code Here

                }
            }
            return new VirtualFileStructure(initialCdDir, root);
        } catch (Exception e) {
            e.printStackTrace();
            throw new ParserException("Failed to parse XML file : "
                    + e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.pushpull.exceptions.ParserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.