KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > core > admin > datasources > IDatasourceAdmin


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * @created Jan 25, 2006
14  * @author James Dixon
15  */

16
17 package org.pentaho.core.admin.datasources;
18
19 import java.util.Map JavaDoc;
20
21 public interface IDatasourceAdmin {
22
23     public static final int DS_DELETED = 1;
24
25     public static final int DS_SAVED = 2;
26
27     public static final int DS_OPERATION_FAILED = 3;
28
29     public static final int DS_FILE_OPERATION_FAILED = 4;
30
31     public static final int DS_NOT_FOUND = 5;
32
33     public static final int DS_RENAMED = 6;
34
35     public static final int DS_OPERATION_NOT_ALLOWED = 7;
36
37     public static final String JavaDoc JDBC_PREFIX = "jdbc/"; //$NON-NLS-1$
38

39     public static final String JavaDoc JNDI_PREFIX = "java:/"; //$NON-NLS-1$
40

41     public static final String JavaDoc JAVAX_SQL_DATASOURCE = "javax.sql.DataSource"; //$NON-NLS-1$
42

43     /**
44      * Lists the datasources that are found in the Application Server for the
45      * Pentaho web app. For each datasource reference that is defined in the
46      * Application Server a DataSourceInfo object is added to the list that is
47      * returned. This method returns an empty list if the operation fails for
48      * any reason.
49      *
50      * @return List of DataSourceInfo objects
51      */

52     public Map JavaDoc listDataSources();
53
54     /**
55      * Deletes a datasource reference from WEB-INF/web.xml. The id passed in
56      * will be matched with the datasource references in web.xml by adding
57      * 'jdbc/' to the front of the id and comparing it to the 'res-ref-name'
58      * nodes. This method returns DS_DELETED if the operation succeeded and
59      * DS_OPERATION_FAILED if it did not.
60      *
61      * @param The
62      * id of the datasource
63      * @return The status of the operation
64      */

65     public int deleteDataSource(String JavaDoc id);
66
67     /**
68      * Renames a datasource reference within the web.xml.
69      *
70      * @param id
71      * The id of the datasource reference
72      * @param newId
73      * The new id to give the datasource reference
74      * @return The status of the operation
75      */

76     public abstract int renameDataSource(String JavaDoc id, String JavaDoc newId);
77
78     /**
79      * Saves a datasource reference into web.xml
80      *
81      * @param info
82      * The DataSourceInfo object containing the properties of the
83      * datasource reference
84      * @param allowEdit
85      * True if the datasource reference can exist in web.xml before
86      * the operation
87      * @return The status of the operation
88      */

89     public abstract int saveDataSource(DataSourceInfo info, boolean allowEdit);
90
91     /**
92      * Gets a DataSourceInfo to describe a named datasource
93      *
94      * @param id
95      * The name of the datasource
96      * @return
97      */

98     public abstract DataSourceInfo getDataSourceInfo(String JavaDoc id);
99
100     /**
101      * Tests a datasource by attempting to connect to it using the properties of
102      * a DataSourceInfo object
103      *
104      * @param dsInfo
105      * The properties of the datasource
106      * @return A message about the success or failure of the test
107      */

108     public String JavaDoc testDataSource(DataSourceInfo dsInfo);
109
110 }
111
Popular Tags