|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopencard.core.service.CardService
opencard.opt.database.BasicDatabase
public class BasicDatabase
This class is designed as a basic default class which allows programmers to access ISO 7816-7-compliant smartcards.
It provides all methods necessary to access database smartcards, as describes in the ISO 7816-7 norm.
It is intended that the CardService developers for specific card use this class as a base class and by inheriting its functionalities
DatabaseCardService
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface opencard.opt.database.DatabaseCardService |
---|
DatabaseCardService.Constants |
Field Summary | |
---|---|
protected int |
MAX_SIZE
MAX_SIZE represents maximum size of a command APDU that can be built. |
Constructor Summary | |
---|---|
BasicDatabase()
Constructor called when creating a new BasicDatabase. |
Method Summary | |
---|---|
void |
begin()
Allocates space for a memory image, e.g. a row. |
void |
commit()
Validates all the modifications made since the transaction operation BEGIN as been executed. |
void |
createDictionary(java.lang.String dictionary)
Defines a view on the system tables *O, *U and *P. |
void |
createTable(java.lang.String tableName,
java.lang.String columnsList,
byte maxNumberOfRows,
SecurityAttribute securityAttribute)
Defines a table with its columns and possibly with security attributes. |
void |
createTable(java.lang.String tableName,
java.lang.String columnsList,
SecurityAttribute securityAttribute)
|
void |
createUser(java.lang.String userID,
java.lang.String userProfile,
SecurityAttribute securityAttribute)
Initiates the registration of a user. |
void |
createView(java.lang.String viewName,
java.lang.String tableName,
java.lang.String colunmNames,
java.lang.String conditions,
SecurityAttribute securityAttribute)
Defines a view on a table. |
void |
declareCursor(java.lang.String objectName,
java.lang.String columnsName,
java.lang.String conditions)
Cursor is used for pointing to a row on a table, view or dictionary. |
void |
delete()
Deletes a row in a table to which the cursor points. |
void |
deleteUser(java.lang.String userID)
Allows a user to be deleted. |
void |
dropTable(java.lang.String tableName)
Allows to drop a table. |
void |
dropView(java.lang.String viewName)
Allows to drop a view. |
java.lang.String[] |
fetch()
Allows to fetch a row or part of it. |
java.lang.String[] |
fetch(byte maxLength)
Allows to fetch a row or part of it. |
java.lang.String[] |
fetchNext()
Used for reading the logical next row from the cursor position. |
java.lang.String[] |
fetchNext(byte maxLength)
Used for reading the logical next row from the cursor position. |
void |
grant(java.lang.String privileges,
java.lang.String objectName,
java.lang.String userID)
Allows to grant privileges to a single user, to a user group or to all users. |
protected void |
initialize(CardServiceScheduler scheduler,
SmartCard smartcard,
boolean blocking)
Allows to initialize the cardservice. |
void |
insert(java.lang.String tableName,
java.lang.String values)
Used to insert a row in a table. |
static boolean |
knows(CardID cid,
CardServiceScheduler sched)
A static method to analyze a smartcard in order to determine if it is an SCQL card, i.e., compliant with the ISO7816-7 standard. |
void |
next()
Sets the current cursor on the next row satisfying the cursor specification. |
void |
open()
Opens a cursor, i.e., the cursor is positioned on the first row which satisfies the selection previously defined with the declareCursor method. |
void |
presentUser(java.lang.String userID)
|
void |
presentUser(java.lang.String userID,
SecurityAttribute securityAttribute)
Checks the presented user id. |
void |
revoke(java.lang.String privileges,
java.lang.String objectName,
java.lang.String userID)
Allows to revoke privileges granted before. |
void |
rollback()
Restores the context in the way it was before the transaction operation BEGIN as been executed. |
protected ResponseAPDU |
sendAPDU(CommandAPDU cmd)
This method is used to send APDU commands to the smartcard. |
protected void |
throwException(ResponseAPDU apdu)
This method is used in this package to manage exceptions. |
void |
update(java.lang.String values)
Updates one or more fields of a row in a table or view to which the cursor points. |
Methods inherited from class opencard.core.service.CardService |
---|
allocateCardChannel, getCard, getCardChannel, getCHVDialog, releaseCardChannel, setCardChannel, setCHVDialog |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface opencard.opt.service.CardServiceInterface |
---|
getCard, setCHVDialog |
Field Detail |
---|
protected final int MAX_SIZE
Constructor Detail |
---|
public BasicDatabase()
Method Detail |
---|
protected void initialize(CardServiceScheduler scheduler, SmartCard smartcard, boolean blocking) throws CardServiceException
initialize
in class CardService
scheduler
- The CardServiceScheduler.smartcard
- The SmartCard.blocking
- Boolean that defines if the smartcard blocks
access for other applications while working or not.
CardServiceException
- if the service could not be initialized. The object created via the
default constructor may not be used if this happens.BasicDatabase()
public void createTable(java.lang.String tableName, java.lang.String columnsList, byte maxNumberOfRows, SecurityAttribute securityAttribute) throws SCQLException
A table can only be created by users with the DB_O profile (DataBase Owner) or DBOO (DataBase Object Owner).
createTable
in interface DatabaseCardService
tablename
- The name of the table to be created.columnslist
- The list of the columns of the table.
This parameter is a string. Each column is separated by a
semi-column from the next.maxnumberofrows
- The maximum number of rows that can be
inserted in the table.securityattribute
- The security attributes.
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException
(java.lang.String, java.lang.String, java.lang.String, java.lang.String, byte);
,
(java.lang.String)
public void createTable(java.lang.String tableName, java.lang.String columnsList, SecurityAttribute securityAttribute) throws SCQLException
SCQLException
public void createView(java.lang.String viewName, java.lang.String tableName, java.lang.String colunmNames, java.lang.String conditions, SecurityAttribute securityAttribute) throws SCQLException
createView
in interface DatabaseCardService
viewname
- The name of the view you want to create.tablename
- The name of the object on which you want
to build your view.colunmname
- The list of fields presents in the view.
Each field is separed from the next by a coma.conditions
- The list of conditions used to build the view.
Each field is separed from the next by a coma.securityattribute
- The security attribute used to create the view.
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException
(java.lang.String, java.lang.String, byte, byte)
,
(java.lang.String)
public void createDictionary(java.lang.String dictionary) throws SCQLException
createDictionary
in interface DatabaseCardService
dictionary
- The name of the dictionary you want to create.
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException
opencard.opt.database.BasicDatabase#createTable(java.lang.String, java.lang.String ,byte, byte)
,
(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public void dropTable(java.lang.String tableName) throws SCQLException
dropTable
in interface DatabaseCardService
tablename
- The name of the table you want to drop
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException
(java.lang.String)
public void dropView(java.lang.String viewName) throws SCQLException
dropView
in interface DatabaseCardService
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException
(java.lang.String)
public void grant(java.lang.String privileges, java.lang.String objectName, java.lang.String userID) throws SCQLException
The following rivileges may be granted.
Privileges for table access :
grant
in interface DatabaseCardService
privilege
- The list of privileges to grant. Each privilege is a
part of the string. Each privilege is separated from the next by a coma.objectname
- The object you want to grant (a table, a view
or a dictionary).userid
- The user(s) you want to be granted privileges.
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException
(java.lang.String, java.lang.String, java.lang.String)
,
SecurityStatusNotSatisfiedException
,
IncorrectParameterInDataFieldException
,
OperationNotSupportedException
,
ReferencedObjectNotFoundException
public void revoke(java.lang.String privileges, java.lang.String objectName, java.lang.String userID) throws SCQLException
revoke
in interface DatabaseCardService
privilege
- The list of privileges to revoke. Each privilege
is a part of the string. Each privilege is separated from the next
by a coma.objectname
- The object you want to revoke privileges on
(i.e., a table, a view or a dictionary).userid
- The user(s) you want to be revoked privileges.
opencard.opt.database.SCQLException#SCQLException()
opencard.opt.database.SCQLException#SCQLException(java.lang.String)
SCQLException
(java.lang.String, java.lang.String, java.lang.String)
,
SecurityStatusNotSatisfiedException
,
IncorrectParameterInDataFieldException
,
ReferencedObjectNotFoundException
public void declareCursor(java.lang.String objectName, java.lang.String columnsName, java.lang.String conditions) throws SCQLException
declareCursor
in interface DatabaseCardService
objectname
- The name of the object on which you want
to declare your cursor.columnsname
- The list of the columns you want to build
your selection on.condition
- The string that contains the conditions to
apply for the cursor.
SCQLException
fetch()
,
fetch(byte)
,
fetchNext()
,
fetchNext(byte)
,
open()
,
next()
public void open() throws SCQLException
declareCursor
method.
open
in interface DatabaseCardService
SCQLException
fetch()
,
fetch(byte)
,
fetchNext()
,
fetchNext(byte)
,
declareCursor(java.lang.String, java.lang.String, java.lang.String)
,
next()
public void next() throws SCQLException
next
in interface DatabaseCardService
SCQLException
fetch()
,
fetch(byte)
,
fetchNext()
,
fetchNext(byte)
,
declareCursor(java.lang.String, java.lang.String, java.lang.String)
,
open()
public java.lang.String[] fetch(byte maxLength) throws SCQLException
fetch
in interface DatabaseCardService
maxlength
- The maximum length of expected data.
SCQLException
fetch()
,
fetchNext()
,
fetchNext(byte)
,
declareCursor(java.lang.String, java.lang.String, java.lang.String)
,
open()
,
opencard.opt.database.BasicDatabase#next(byte)
public java.lang.String[] fetch() throws SCQLException
fetch
in interface DatabaseCardService
SCQLException
fetch(byte)
,
fetchNext()
,
fetchNext(byte)
,
declareCursor(java.lang.String, java.lang.String, java.lang.String)
,
open()
,
opencard.opt.database.BasicDatabase#next(byte)
public java.lang.String[] fetchNext(byte maxLength) throws SCQLException
fetchNext
in interface DatabaseCardService
maxlength
- The maximum length of expected data.
SCQLException
fetch(byte)
,
fetch()
,
fetchNext()
,
declareCursor(java.lang.String, java.lang.String, java.lang.String)
,
open()
,
opencard.opt.database.BasicDatabase#next(byte)
public java.lang.String[] fetchNext() throws SCQLException
fetchNext
in interface DatabaseCardService
SCQLException
fetch(byte)
,
fetch()
,
fetchNext(byte)
,
declareCursor(java.lang.String, java.lang.String, java.lang.String)
,
open()
,
opencard.opt.database.BasicDatabase#next(byte)
public void insert(java.lang.String tableName, java.lang.String values) throws SCQLException
insert
in interface DatabaseCardService
tablename
- The name of the table you want to insert into.values
- The String that contains the list of values to be
inserted.
SCQLException
update(java.lang.String)
,
delete()
public void update(java.lang.String values) throws SCQLException
update
in interface DatabaseCardService
values
- The String that contains the list of values to be updated.
SCQLException
insert(java.lang.String, java.lang.String)
,
delete()
public void delete() throws SCQLException
delete
in interface DatabaseCardService
SCQLException
insert(java.lang.String, java.lang.String)
,
update(java.lang.String)
public void begin() throws SCQLException
begin
in interface DatabaseCardService
SCQLException
commit()
,
rollback()
public void commit() throws SCQLException
commit
in interface DatabaseCardService
SCQLException
begin()
,
rollback()
public void rollback() throws SCQLException
rollback
in interface DatabaseCardService
SCQLException
begin()
,
commit()
public void presentUser(java.lang.String userID, SecurityAttribute securityAttribute) throws SCQLException
presentUser
in interface DatabaseCardService
userid
- the login name of the presented user id.securityAttribute
- the security attribute presented
for authentication.
SCQLException
createUser(java.lang.String, java.lang.String, SecurityAttribute)
,
deleteUser(java.lang.String)
,
SecurityAttribute
public void presentUser(java.lang.String userID) throws SCQLException
presentUser
in interface DatabaseCardService
SCQLException
public void createUser(java.lang.String userID, java.lang.String userProfile, SecurityAttribute securityAttribute) throws SCQLException
createUser
in interface DatabaseCardService
userid
- The login name of the presented user id.userprofile
- The profile of the presented user id.securityAttribute
- the security attribute presented
for authentication.
SCQLException
presentUser(java.lang.String, SecurityAttribute)
,
deleteUser(java.lang.String)
public void deleteUser(java.lang.String userID) throws SCQLException
deleteUser
in interface DatabaseCardService
userid
- The login name of the presented user id.
SCQLException
opencard.opt.database.BasicDatabase#presentUser(java.lang.String, java.lang.String)
,
opencard.opt.database.BasicDatabase#createUser(java.lang.String, java.lang.String, java.lang.String)
protected void throwException(ResponseAPDU apdu) throws SCQLException
adpu
- The responseAPDU to be analyzed.
SCQLException
protected ResponseAPDU sendAPDU(CommandAPDU cmd) throws SCQLException
cmd
- The APDU command to be sent.
SCQLException
public static boolean knows(CardID cid, CardServiceScheduler sched)
cid
- the ATR of the smartcardsched
- a CardServiceScheduler for temporary communication
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |