|
22 | 22 | import javax.naming.StringRefAddr;
|
23 | 23 | import javax.sql.DataSource;
|
24 | 24 |
|
| 25 | +import org.ietf.jgss.GSSCredential; |
| 26 | + |
25 | 27 | /**
|
26 | 28 | * This datasource lists properties specific for the SQLServerConnection class.
|
27 | 29 | */
|
@@ -175,6 +177,25 @@ public String getAuthentication() {
|
175 | 177 | SQLServerDriverStringProperty.AUTHENTICATION.getDefaultValue());
|
176 | 178 | }
|
177 | 179 |
|
| 180 | + /** |
| 181 | + * sets GSSCredential |
| 182 | + * |
| 183 | + * @param userCredential |
| 184 | + */ |
| 185 | + public void setGSSCredentials(GSSCredential userCredential){ |
| 186 | + setObjectProperty(connectionProps,SQLServerDriverObjectProperty.GSS_CREDENTIAL.toString(), userCredential); |
| 187 | + } |
| 188 | + |
| 189 | + /** |
| 190 | + * Retrieves the GSSCredential |
| 191 | + * |
| 192 | + * @return GSSCredential |
| 193 | + */ |
| 194 | + public GSSCredential getGSSCredentials(){ |
| 195 | + return (GSSCredential) getObjectProperty(connectionProps, SQLServerDriverObjectProperty.GSS_CREDENTIAL.toString(), |
| 196 | + SQLServerDriverObjectProperty.GSS_CREDENTIAL.getDefaultValue()); |
| 197 | + } |
| 198 | + |
178 | 199 | /**
|
179 | 200 | * Sets the access token.
|
180 | 201 | *
|
@@ -772,6 +793,30 @@ private boolean getBooleanProperty(Properties props,
|
772 | 793 | return value.booleanValue();
|
773 | 794 | }
|
774 | 795 |
|
| 796 | + private void setObjectProperty(Properties props, |
| 797 | + String propKey, |
| 798 | + Object propValue) { |
| 799 | + if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) { |
| 800 | + loggerExternal.entering(getClassNameLogging(), "set" + propKey); |
| 801 | + } |
| 802 | + if (null != propValue) { |
| 803 | + props.put(propKey, propValue); |
| 804 | + } |
| 805 | + loggerExternal.exiting(getClassNameLogging(), "set" + propKey); |
| 806 | + } |
| 807 | + |
| 808 | + private Object getObjectProperty(Properties props, |
| 809 | + String propKey, |
| 810 | + Object defaultValue) { |
| 811 | + if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) |
| 812 | + loggerExternal.entering(getClassNameLogging(), "get" + propKey); |
| 813 | + Object propValue = props.get(propKey); |
| 814 | + if (null == propValue) |
| 815 | + propValue = defaultValue; |
| 816 | + loggerExternal.exiting(getClassNameLogging(), "get" + propKey); |
| 817 | + return propValue; |
| 818 | + } |
| 819 | + |
775 | 820 | // Returns a SQLServerConnection given username, password, and pooledConnection.
|
776 | 821 | // Note that the DataSource properties set to connectionProps are used when creating
|
777 | 822 | // the connection.
|
|
0 commit comments