|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--opencard.core.service.CardService | +--opencard.opt.database.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
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. The memory space which is provided is implementation dependent. |
void |
commit()
Validates all the modifications made since the transaction operation BEGIN as been executed. The transaction operation BEGIN must have been previously performed. |
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. A table can only be dropped by its owner. |
void |
dropView(java.lang.String viewName)
Allows to drop a view. A table can only be dropped by its owner. |
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. The following rivileges may be granted. Privileges for table access : SELECT INSERT UPDATE DELETE ALL Privileges for view access : SELECT UPDATE Privileges for dictionary access : SELECT |
protected void |
initialize(opencard.core.service.CardServiceScheduler scheduler,
opencard.core.service.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(opencard.core.terminal.CardID cid,
opencard.core.service.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. A cursor must have been opened before. |
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. Only the owner of the table or view can revoke privileges. |
void |
rollback()
Restores the context in the way it was before the transaction operation BEGIN as been executed. The transaction operation BEGIN must have been previously performed. |
protected opencard.core.terminal.ResponseAPDU |
sendAPDU(opencard.core.terminal.CommandAPDU cmd)
This method is used to send APDU commands to the smartcard. |
protected void |
throwException(opencard.core.terminal.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. The command can only be executed by the table owner or a user with the UPDATE privilege. A cursor must be opened before. The value for the special column USER, if present, is inserted by the card. |
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 |
Field Detail |
protected final int MAX_SIZE
Constructor Detail |
public BasicDatabase()
Method Detail |
protected void initialize(opencard.core.service.CardServiceScheduler scheduler, opencard.core.service.SmartCard smartcard, boolean blocking) throws opencard.core.service.CardServiceException
scheduler
- The CardServiceScheduler.smartcard
- The SmartCard.blocking
- Boolean that defines if the smartcard blocks
access for other applications while working or not.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).
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.public void createTable(java.lang.String tableName, java.lang.String columnsList, SecurityAttribute securityAttribute) throws SCQLException
public void createView(java.lang.String viewName, java.lang.String tableName, java.lang.String colunmNames, java.lang.String conditions, SecurityAttribute securityAttribute) throws SCQLException
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.public void createDictionary(java.lang.String dictionary) throws SCQLException
dictionary
- The name of the dictionary you want to create.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
tablename
- The name of the table you want to droppublic void dropView(java.lang.String viewName) throws SCQLException
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 :
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.SecurityStatusNotSatisfiedException
,
IncorrectParameterInDataFieldException
,
OperationNotSupportedException
,
ReferencedObjectNotFoundException
public void revoke(java.lang.String privileges, java.lang.String objectName, java.lang.String userID) throws SCQLException
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.SecurityStatusNotSatisfiedException
,
IncorrectParameterInDataFieldException
,
ReferencedObjectNotFoundException
public void declareCursor(java.lang.String objectName, java.lang.String columnsName, java.lang.String conditions) throws SCQLException
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.fetch()
,
fetch(byte)
,
fetchNext()
,
fetchNext(byte)
,
open()
,
next()
public void open() throws SCQLException
declareCursor
method.fetch()
,
fetch(byte)
,
fetchNext()
,
fetchNext(byte)
,
declareCursor(java.lang.String, java.lang.String, java.lang.String)
,
next()
public void next() throws 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
maxlength
- The maximum length of expected data.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(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
maxlength
- The maximum length of expected data.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
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
tablename
- The name of the table you want to insert into.values
- The String that contains the list of values to be
inserted.update(java.lang.String)
,
delete()
public void update(java.lang.String values) throws SCQLException
values
- The String that contains the list of values to be updated.insert(java.lang.String, java.lang.String)
,
delete()
public void delete() throws SCQLException
insert(java.lang.String, java.lang.String)
,
update(java.lang.String)
public void begin() throws SCQLException
commit()
,
rollback()
public void commit() throws SCQLException
begin()
,
rollback()
public void rollback() throws SCQLException
begin()
,
commit()
public void presentUser(java.lang.String userID, SecurityAttribute securityAttribute) throws SCQLException
userid
- the login name of the presented user id.securityAttribute
- the security attribute presented
for authentication.opencard.opt.database.BasicDatabase#createUser(java.lang.String, java.lang.String, java.lang.String)
,
deleteUser(java.lang.String)
,
SecurityAttribute
public void presentUser(java.lang.String userID) throws SCQLException
public void createUser(java.lang.String userID, java.lang.String userProfile, SecurityAttribute securityAttribute) throws SCQLException
userid
- The login name of the presented user id.userprofile
- The profile of the presented user id.securityAttribute
- the security attribute presented
for authentication.opencard.opt.database.BasicDatabase#presentUser(java.lang.String, java.lang.String)
,
deleteUser(java.lang.String)
public void deleteUser(java.lang.String userID) throws SCQLException
userid
- The login name of the presented user id.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(opencard.core.terminal.ResponseAPDU apdu) throws SCQLException
adpu
- The responseAPDU to be analyzed.protected opencard.core.terminal.ResponseAPDU sendAPDU(opencard.core.terminal.CommandAPDU cmd) throws SCQLException
cmd
- The APDU command to be sent.public static boolean knows(opencard.core.terminal.CardID cid, opencard.core.service.CardServiceScheduler sched)
cid
- the ATR of the smartcardsched
- a CardServiceScheduler for temporary communication
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |