1 /* Copyright (c) 2009 Peter Troshin
\r
3 * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
19 package compbio.metadata;
\r
21 import java.util.List;
\r
23 import javax.xml.bind.annotation.XmlAccessType;
\r
24 import javax.xml.bind.annotation.XmlAccessorType;
\r
26 import compbio.data.sequence.FastaSequence;
\r
29 * Thrown if the task larger in size that the limit that applies to the
\r
36 * Date February 2010
\r
38 @XmlAccessorType(XmlAccessType.FIELD)
\r
39 public class LimitExceededException extends JobSubmissionException {
\r
41 private static final long serialVersionUID = 15066952180013505L;
\r
43 int numberOfSequencesAllowed;
\r
44 int actualNumberofSequences;
\r
45 int aSequenceLenghtAllowed;
\r
46 int aSequenceLenghtActual;
\r
48 public LimitExceededException(String message) {
\r
52 public static LimitExceededException newLimitExceeded(Limit<?> limit,
\r
53 List<FastaSequence> seqs) {
\r
54 String message = "Job exceed size limits, maximum number of sequences must be less than "
\r
55 + limit.getSeqNumber() + "\n";
\r
56 if (limit.getAvgSeqLength() != 0) {
\r
57 message += "and an average sequence length must not exceed "
\r
58 + limit.getAvgSeqLength() + "\n";
\r
60 message += " However, the task contained " + seqs.size()
\r
61 + " sequences " + "\n";
\r
62 if (limit.getAvgSeqLength() != 0) {
\r
63 message += "and an average sequence length was "
\r
64 + Limit.getAvgSequenceLength(seqs) + "\n";
\r
66 return new LimitExceededException(message);
\r
69 public int getNumberOfSequencesAllowed() {
\r
70 return numberOfSequencesAllowed;
\r
73 public int getActualNumberofSequences() {
\r
74 return actualNumberofSequences;
\r
77 public int getSequenceLenghtAllowed() {
\r
78 return aSequenceLenghtAllowed;
\r
81 public int getSequenceLenghtActual() {
\r
82 return aSequenceLenghtActual;
\r