RIO YOU

Greenhorn
+ Follow
since Nov 08, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by RIO YOU

Simply,

1. No Longer exist deleted flag record section.
########################################################################
I understand reuse the deleted flag tuple to insert new data.

When i need to create new another record more and more when there is no longer exist deleted flag record section.

Increate the data file? or throw DuplicateException?
########################################################################


2. Is it possible locking whole database file during accessing database?
########################################################################
Is it possible locking whole database file during accessing database?
or should I implement locking algorithm for each record?
########################################################################

Any comments could be happy for me. ^^
Let me ask few more questions about Interface classes which is just given by assignment.



Here is my assignment about Interface class.

-----------------------------------------------------------------
Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface:

package suncertify.db;
public interface DBMain {
// Reads a record from the file. Returns an array where each
// element is a record value.
public String [] read(int recNo) throws RecordNotFoundException;
// Modifies the fields of a record. The new value for field n
// appears in data[n].
public void update(int recNo, String [] data)
throws RecordNotFoundException;
// Deletes a record, making the record number and associated disk
// storage available for reuse.
public void delete(int recNo) throws RecordNotFoundException;
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int [] find(String [] criteria)
throws RecordNotFoundException;
// Creates a new record in the database (possibly reusing a
// deleted entry). Inserts the given data, and returns the record
// number of the new record.
public int create(String [] data) throws DuplicateKeyException;
// Locks a record so that it can only be updated or deleted by this client.
// If the specified record is already locked, the current thread gives up
// the CPU and consumes no CPU cycles until the record is unlocked.
public void lock(int recNo) throws RecordNotFoundException;
// Releases the lock on a record.
public void unlock(int recNo) throws RecordNotFoundException;
// Determines if a record is currenly locked. Returns true if the
// record is locked, false otherwise.
public boolean isLocked(int recNo)
throws RecordNotFoundException;
}

--------------------------------------------------------------------


Accoding to assignment, There are String[] array values when transforming
the data. I don't think it is good for coding so that I'm concerned about
making hotel class to transfer and manipulate data.

As it goes by, I don't need the interface class using String[] array method.
I only need the Hotel Class.

Here is my quesiton.

########################################################################
Is it possible not to use interface class but to use my one hotel object class? But i will just implement interface class to my own object class(DAO)
########################################################################
[ August 21, 2006: Message edited by: RIO YOU ]
Thanks for your all reply. It's very helpful for me.

I'm seriously concerned about how to implement the Data class.

I decided to program using DAO which is better for me. ^^:


By the way, I appreciate all of you guys.

Blss you ^^:
My Data.java Interface must be implemented following statements.


#########################################################################
package suncertify.db;
public interface DBMain {
// Reads a record from the file. Returns an array where each
// element is a record value.
public String [] read(int recNo) throws RecordNotFoundException;
// Modifies the fields of a record. The new value for field n
// appears in data[n].
public void update(int recNo, String [] data)
throws RecordNotFoundException;
// Deletes a record, making the record number and associated disk
// storage available for reuse.
public void delete(int recNo) throws RecordNotFoundException;
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int [] find(String [] criteria)
throws RecordNotFoundException;
// Creates a new record in the database (possibly reusing a
// deleted entry). Inserts the given data, and returns the record
// number of the new record.
public int create(String [] data) throws DuplicateKeyException;
// Locks a record so that it can only be updated or deleted by this client.
// If the specified record is already locked, the current thread gives up
// the CPU and consumes no CPU cycles until the record is unlocked.
public void lock(int recNo) throws RecordNotFoundException;
// Releases the lock on a record.
public void unlock(int recNo) throws RecordNotFoundException;
// Determines if a record is currenly locked. Returns true if the
// record is locked, false otherwise.
public boolean isLocked(int recNo)
throws RecordNotFoundException;
}
##########################################################################

Is it possible that I add more interface functions on Data.java which
is given to my assignment for data access class.

something like,
public String[] toString(URLyBirdHotelClass ubhc) throws Exception;

After, The something-class which implements the Data interface class should
be implemented.


Is it OK?
When I've been trying to read the database you supplied, there is one problem which I ask to.

The original filesize is below,
2003-04-08 AM 11:51 4,856 db-1x3.db

As I read that file, there is EOFException at the last read time.
The last one char(last Valid Flag) is missing so that I get the EOFException.

I've been wondering it is OK and Doing how to solve it.

Please, give me advice.

Regards,
DBMain.java interface, it just says that returns
the recNo(record Number) when you find and etc.

When the client requests the data or find data, which is correct,
The server returns the recNo? or Hotel OBjecct??

I simply thought that The Hotel Object should be transfered.




Plz, give any tips.
I've been thinking of a lot of cases implementing Design-Patterns which are a lot.. @.@;


To be Honest, I couldn't figure out what I choose some of them.

Could u give me some tips which are generally used for this SCJD assign.?

When networking, you better choose the Adapter pattern.
When Data Object, you better select the Singleton pattern.

something like them...

looking forward to your reply. ^^:


Have a good coding~ ^:^
Locking-UnLocking methods are just confusing for me.

I'm just thinking....


================================================= my scenario is,
If The REMOTE CLIENT reads the DB-File by RMI, it would be based on
READ-ONLY Threads.

OK.. It's Fine.

imagine that If the CLIENT's trying to book-update-delete one record.

At this time, Should the CLIENT re-open the DB-File as READ-WRITE mode?


Any comments helpful for me.
should I make Client-UI besides Server-UI?

I'm just confusing how to make it.

Is my idea OK?
================= my idea is, making A ONE UI including RMI and DATA Server.
If I make A UI-System (attached "Local-connect" & "Remote-connect" ),
= Local Connect : call local function
= Remote Connect : call RMI method function
=================


Any comments good for me.