KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > deployment > common > api > DatasourceAlreadyExistsException


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.deployment.common.api;
21
22 import java.util.LinkedList JavaDoc;
23 import java.util.List JavaDoc;
24 import org.openide.util.NbBundle;
25
26 /**
27  *
28  * Indicates conflict between the data sources being deployed/saved and the existing ones.
29  *
30  * @author Libor Kotouc
31  *
32  * @since 1.15
33  */

34 public final class DatasourceAlreadyExistsException extends Exception JavaDoc {
35     
36     private List JavaDoc<Datasource> datasources;
37     
38     /**
39      * Creates new DatasourceAlreadyExistsException with the list of conflicting data sources
40      *
41      * @param datasources the list of conflicting data sources
42      *
43      * @exception NullPointerException if the <code>datasources</code> argument is <code>null</code>
44      */

45     public DatasourceAlreadyExistsException(List JavaDoc<Datasource> datasources) {
46         if (datasources == null) {
47             throw new NullPointerException JavaDoc(NbBundle.getMessage(getClass(), "ERR_CannotPassNullDatasources")); // NOI18N
48
}
49         this.datasources = datasources;
50     }
51     
52     /**
53      * Creates new DatasourceAlreadyExistsException with the conflicting data source
54      *
55      * @param datasource the conflicting data source
56      */

57     public DatasourceAlreadyExistsException(Datasource datasource) {
58         datasources = new LinkedList JavaDoc<Datasource>();
59         datasources.add(datasource);
60     }
61     
62     /**
63      * Returns list of conflicting data sources
64      *
65      * @return list of conflicting data sources
66      */

67     public List JavaDoc<Datasource> getDatasources() {
68         return datasources;
69     }
70     
71 }
72
Popular Tags