View Javadoc

1   /*
2    * #%L
3    * prolobjectlink-jpi-jtrolog
4    * %%
5    * Copyright (C) 2012 - 2018 WorkLogic Project
6    * %%
7    * This program is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU Lesser General Public License as
9    * published by the Free Software Foundation, either version 2.1 of the
10   * License, or (at your option) any later version.
11   * 
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Lesser Public License for more details.
16   * 
17   * You should have received a copy of the GNU General Lesser Public
18   * License along with this program.  If not, see
19   * <http://www.gnu.org/licenses/lgpl-2.1.html>.
20   * #L%
21   */
22  /*
23   * tuProlog - Copyright (C) 2001-2002  aliCE team at deis.unibo.it
24   *
25   * This library is free software; you can redistribute it and/or
26   * modify it under the terms of the GNU Lesser General Public
27   * License as published by the Free Software Foundation; either
28   * version 2.1 of the License, or (at your option) any later version.
29   *
30   * This library is distributed in the hope that it will be useful,
31   * but WITHOUT ANY WARRANTY; without even the implied warranty of
32   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
33   * Lesser General Public License for more details.
34   *
35   * You should have received a copy of the GNU Lesser General Public
36   * License along with this library; if not, write to the Free Software
37   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38   */
39  package jTrolog.errors;
40  
41  /**
42   * This exception means that a not valid tuProlog library has been specified.
43   * 
44   * @see jTrolog.lib.Library
45   */
46  @SuppressWarnings("serial")
47  public class InvalidLibraryException extends PrologException {
48  
49  	private String libraryName;
50  	private PrologException rootCause;
51  
52  	public InvalidLibraryException() {
53  	}
54  
55  	public InvalidLibraryException(String libName, PrologException e) {
56  		libraryName = libName;
57  		rootCause = e;
58  	}
59  
60  	public InvalidLibraryException(String libName) {
61  		libraryName = libName;
62  	}
63  
64  	public String getLibraryName() {
65  		return libraryName;
66  	}
67  
68  	public String getMessage() {
69  		return toString();
70  	}
71  
72  	public String toString() {
73  		return rootCause == null ? "InvalidLibraryException: " + libraryName : "InvalidLibraryException: " + libraryName + "\nroot cause: " + rootCause;
74  	}
75  
76  }