|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.co.weft.htform.ResourceConsumerImpl
uk.co.weft.dbutil.JDBCUserKluge
JDBC does not provide any unified or portable way to deal with adding modifying and deleting user accounts, but in an application its often important that a user should be able to change their password; this is an attempt to provide a consistent, database independent API for creating, modifying and deleting database-layer user accounts. Obviously, it depends on the currently logged in user having authority to do these things. The per-database-type syntax for carrying out the operations is loaded from a repository as an XML document. A list of repositories is searched with the hard-wired last fallback being one at www.weft.co.uk which I will maintain. As new syntaxes are added to this repository they will automatically become available to all Jacquard applications out there in netland, even if they were not available when the application was compiled. Clearly this class could be extended. It could cover creating and deleting groups, and other areas of variant syntax. If you extend it I would be grateful of patches. Yes, it's a kluge, but just at this moment I'm feeling pretty proud of it. TODO: Create JDBCUserKlugeLite which uses the same syntax repository meachanism but isn't dependent on the whole Jacquard infrastructure.
| Field Summary | |
static java.lang.String |
ADDSYNTAXTOKEN
a token on which I will seek in my configuration 'extra' password syntaxes over and above those I already know |
protected static java.lang.String |
ADDTOGROUPTOKEN
values of the templatetype attribute: add to group |
protected static java.lang.String |
BUNDLEELEMENTTAG
tokens which name elements in the XML dialect I expect: the bundle of templates |
protected static java.lang.String |
CHANGEPASSTOKEN
values of the templatetype attribute: change password |
protected static java.lang.String |
CREATEUSERTOKEN
values of the templatetype attribute: create user |
protected static java.lang.String |
DBTYPEATTRIBUTETAG
tokens which name elements in the XML dialect I expect: the database type |
protected static java.lang.String |
DELETEUSERTOKEN
values of the templatetype attribute: drop user |
protected static java.lang.String |
GROUPATTRIBUTETAG
tokens which name elements in the XML dialect I expect: the template |
protected static java.lang.String |
JDBCPROTOCOLPART
the protocol part of a JDBC URL |
protected static java.lang.String |
LEAVEGROUPTOKEN
values of the templatetype attribute: remove from group |
protected static int |
MAXSLOTS
the maximum number of slots in a query that we will believe (i.e. |
protected static java.lang.String |
MISSINGGROUPTOKEN
something to put in for a group name where there should be no group name |
protected static java.lang.String |
MISSINGPASSWORDTOKEN
something to put in for a password where there should be no password |
protected static java.lang.String |
PASSATTRIBUTETAG
tokens which name elements in the XML dialect I expect: the template |
protected java.util.Vector |
repositories
the vector of repository URLs which I will try in reverse order |
protected java.lang.String |
repository
the fallback repository from which I will fetch syntax specifiers |
protected java.util.Hashtable |
syntaxes
the password syntaxes I know about |
static java.lang.String |
SYNTAXREPOSITORYTOKEN
a token on which I will seek the URL of the syntax repository in my configuration |
protected static java.lang.String |
TEMPLATEELEMENTTAG
tokens which name elements in the XML dialect I expect: the template |
protected static int |
TEMPLATETYPEADDTOGROUP
the type of a template to add a user to a group |
protected static int |
TEMPLATETYPECHANGEPASS
the type of a template to change a user's password |
protected static int |
TEMPLATETYPECREATEUSER
the type of a template to create a user |
protected static int |
TEMPLATETYPEDELETEUSER
the type of a template to delete a user |
protected static int |
TEMPLATETYPELEAVEGROUP
the type of a template to remove a user from a group |
protected static java.lang.String |
TYPEATTRIBUTETAG
tokens which name elements in the XML dialect I expect: the template |
protected static java.lang.String |
USERATTRIBUTETAG
tokens which name elements in the XML dialect I expect: the template |
| Fields inherited from class uk.co.weft.htform.ResourceConsumerImpl |
resourceBundleName |
| Fields inherited from interface uk.co.weft.htform.ResourceConsumer |
RESOURCEBUNDLEMAGICTOKEN |
| Constructor Summary | |
JDBCUserKluge()
create a new Kluge which knows only about the default repository |
|
JDBCUserKluge(Context config)
create a new Kluge which also knows about a repository specified in this config |
|
| Method Summary | |
void |
addRepository(java.lang.String repository)
add this URL to my repositories. |
uk.co.weft.dbutil.JDBCUserKluge.UserSyntax |
addSyntax(Document doc)
initialise me from this document, assumed to be in my own special XML format |
void |
addUser(Context context,
java.lang.String user,
java.lang.String password)
Add a user over the JDBC connection implied by this context with this username and this password |
void |
addUserToGroup(Context context,
java.lang.String username,
java.lang.String group)
add this user to this group over the JDBC connection implied by this context |
void |
changePassword(Context context,
java.lang.String password)
Change password for the currently logged in user over the JDBC connection implied by this context to this password |
void |
changePassword(Context context,
java.lang.String username,
java.lang.String password)
Change password for the a user over the JDBC connection implied by this context to this password |
protected java.lang.String |
dbTypeFromUrl(java.lang.String url)
take a JDBC URL and extract the dbtype string |
void |
dropUser(Context context,
java.lang.String user)
drop a user over the JDBC connection implied by this context |
protected uk.co.weft.dbutil.JDBCUserKluge.UserSyntax |
fetchSyntax(java.lang.String dbtype)
fetch the syntax specifier for this database type identifier |
void |
removeUserFromGroup(Context context,
java.lang.String username,
java.lang.String group)
remove this user from this group over the JDBC connection implied by this context |
| Methods inherited from class uk.co.weft.htform.ResourceConsumerImpl |
getContextOrResource, getResource, getResourceOrContext, getResourceString, grs, grs, init |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final int TEMPLATETYPECREATEUSER
protected static final int TEMPLATETYPECHANGEPASS
protected static final int TEMPLATETYPEDELETEUSER
protected static final int TEMPLATETYPEADDTOGROUP
protected static final int TEMPLATETYPELEAVEGROUP
protected static final java.lang.String BUNDLEELEMENTTAG
protected static final java.lang.String DBTYPEATTRIBUTETAG
protected static final java.lang.String TEMPLATEELEMENTTAG
protected static final java.lang.String TYPEATTRIBUTETAG
protected static final java.lang.String USERATTRIBUTETAG
protected static final java.lang.String PASSATTRIBUTETAG
protected static final java.lang.String GROUPATTRIBUTETAG
protected static final java.lang.String JDBCPROTOCOLPART
protected static final java.lang.String CREATEUSERTOKEN
protected static final java.lang.String CHANGEPASSTOKEN
protected static final java.lang.String DELETEUSERTOKEN
protected static final java.lang.String ADDTOGROUPTOKEN
protected static final java.lang.String LEAVEGROUPTOKEN
protected static final java.lang.String MISSINGPASSWORDTOKEN
protected static final java.lang.String MISSINGGROUPTOKEN
public static final java.lang.String ADDSYNTAXTOKEN
public static final java.lang.String SYNTAXREPOSITORYTOKEN
protected static final int MAXSLOTS
protected java.util.Hashtable syntaxes
protected java.lang.String repository
protected java.util.Vector repositories
| Constructor Detail |
public JDBCUserKluge()
public JDBCUserKluge(Context config)
config - a context which may have details of another repository| Method Detail |
public void addRepository(java.lang.String repository)
repository - the URL of a repository
public uk.co.weft.dbutil.JDBCUserKluge.UserSyntax addSyntax(Document doc)
throws DataStoreException
DataStoreException
protected uk.co.weft.dbutil.JDBCUserKluge.UserSyntax fetchSyntax(java.lang.String dbtype)
throws DataStoreException
dbtype - a database type identifier, being the full sub-protocol
part of a JDBC URL which specifies the database type being
addressed
DataStoreException - if syntax cannot be fetched.
protected java.lang.String dbTypeFromUrl(java.lang.String url)
throws DataFormatException
url - the JDBC url
DataFormatException
public void addUser(Context context,
java.lang.String user,
java.lang.String password)
throws DataStoreException
context - the contextuser - the username.password - the password.
DataStoreException - if the database misbehaves in an expected
way
public void dropUser(Context context,
java.lang.String user)
throws DataStoreException
context - the contextuser - the username.
DataStoreException - if the database misbehaves in an expected
way
public void changePassword(Context context,
java.lang.String password)
throws DataStoreException
context - the contextpassword - the password.
DataStoreException - if the database misbehaves in an expected
way
public void changePassword(Context context,
java.lang.String username,
java.lang.String password)
throws DataStoreException
context - the contextusername - the username.password - the password.
DataStoreException - if the database misbehaves in an expected
way
public void addUserToGroup(Context context,
java.lang.String username,
java.lang.String group)
throws DataStoreException
context - the contextusername - the user namegroup - the group
DataStoreException - if the database misbehaves in an expected
way
public void removeUserFromGroup(Context context,
java.lang.String username,
java.lang.String group)
throws java.sql.SQLException,
DataStoreException
context - the contextusername - the user namegroup - the group
DataStoreException - if the database misbehaves in an expected
way
java.sql.SQLException
|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||