dean tomlinson

Ranch Hand
+ Follow
since Jan 31, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by dean tomlinson

Hi guys,
Thanks for the congrats - here are a some answers to your q's...

Could you please explain your design..?
How did you implement the lock/unlocl


In exactly the way described by the many posts on this forum on locking using the remote connection object approach

did you include dynamic code downloading?


No

Also, do you have a feeling for what it was that Sun particularly liked about your project?


I was actually very worried that I may have blown it. I didn't strictly adhere to the requirement that you must modify or subclass Data (i did both), and I also changed the exception thrown by the lock method so it threw DatabaseException instead of the IOException supplied (even though i was strongly advised not to change anything but the deprecated methods in Data).
My design was simple and did the job. i did embelish the data server, and provided it with a GUI console that could be used to stop and restart the service. it also kept track of the number of active clients which was nice, becasue it allowed the administrator to close the database service when there are no client connections.) used observer and observable to decouple the gui from the server, the idea here was too keep the dataserver bound to the registry as light as possible.
I think the main reason I got top marks is becasue I had good sound reasons backing up each of my design choices. I read posts from others who seemed to have done much more. Dont get bogged down attempting to provide the most functional system, instead perhaps tackle the assignment more from an object oriented design perspective.
Design a generic database subsystem (and also anything else that isn't application specific). Design around interfaces, and connect subsystems using interfaces (where appropriate !). Chain exceptions so an operation only throws an exception that is at the same level of abstraction, and use design patterns where appropriate, but dont try too hard to make things fit to a pattern just for the sake of it. Note any assumptions you have made. Inter layer coupling should only be from higher layers to lower layers, use a package structure that illustrates which packages are generic and which are application specific.
I know that the reason I got top marks was due to the tremendous help i got from this forum, but i did find myself often becoming overly influenced to the point twhere I changed aspects of my design that I was obviuosly right on, after reading post's saying "i did it this way and passed". I blitzed the assignment in the final 2 weeks and ended up going back to my own ideas on many of these issues, try not to take what someone else has done as being the only correct solution, i think as long as you can back up your design choices you will pass easily.
Most of all, use this assignment as an opportunity to learn ! I hadn't done any Swing or RMI until this, but to me, the important lesson is that in OO design. API's are easily learned and are really just remebered. The OO stuff though requires an understanding, that can be applied to any develpoment projects, whether Swing, Servlet or J2ME !
Try not to rush through it, the longer you spend on it, the more you will gain from the experience.
Cheers, Dean
22 years ago
just like to thank everyone who's hepled me with this cert, especially mark spritzler and sai prasad (who were always there to lend a hand).
as for my design, from a high level it was based on the RMIFactory pattern you'll read lots about on here.
i have been very nervous over the last 4 weeks becasue i felt that i hadn't stuck to some of the requirements, but think if you have a good reason for changing aspects of the supplied code, that is not specifically asked for, they obviously dont mark you down.
infact i think it might be such a decision that gets you the extra few points (assuming the reason's were valid)
if you want to ask me any specific questions, please post and i'll try and help as many of you as possible.
cheers, dean
[ July 04, 2002: Message edited by: dean tomlinson ]
22 years ago
i am trying to attach a fiel to an email using JavaMail. This all works fine, but the file displays it's full file path name in the sent email.
the only way i have been able to get around this is if i attach a file that exists in user.dir.
unfortunately this is not practical, becasue i am trying to to use this in a web application, and the fie tht is created needs to be in a directroy exclusive to each web client.
can anyone help ?

// Get system properties
Properties props = System.getProperties();
System.out.println("sendEmailWithAttachment - 1");

// Setup mail server
props.put("mail.smtp.host", smtpServer);
System.out.println("sendEmailWithAttachment - 2");

// Get session
//Session session = Session.getInstance(props, null);
Session session = Session.getDefaultInstance(props, null);
System.out.println("sendEmailWithAttachment - 3");

// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom( new InternetAddress(msgFrom) );
message.addRecipient( Message.RecipientType.TO, new InternetAddress(msgTo) );
message.setSubject(msgSubject);
System.out.println("sendEmailWithAttachment - 4");

// create the message part
MimeBodyPart messageBodyPart = new MimeBodyPart();
System.out.println("sendEmailWithAttachment - 5");

//fill message
messageBodyPart.setText(msgBody);
System.out.println("sendEmailWithAttachment - 6");

Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
System.out.println("sendEmailWithAttachment - 7");

// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(attachmentName);
messageBodyPart.setDataHandler( new DataHandler(source) );
messageBodyPart.setFileName(attachmentName);
//messageBodyPart.setFileName("dt.txt");
multipart.addBodyPart(messageBodyPart);
System.out.println("sendEmailWithAttachment - 8");

// Put parts in message
message.setContent(multipart);

message.setSentDate(new Date());
System.out.println("sendEmailWithAttachment - 9");

// Send the message
Transport.send( message );


[ June 13, 2002: Message edited by: dean tomlinson ]
22 years ago
just wondering - as i'm about to sit the exam and dont want to be the first
any quick tips for the exam ?
cheers - dean
hi mark,
thanks for your reply. yes the lock method in my data class throws ioexception - and the javadoc comment for the method, says it will throw this if the recrod number is invalid, but really to test if a recrod exists you need to use getRecord, and that throws DatabaseException in my original data class.
so really i feel the lock method should also throw DatabaseException, but infact inside my lock method i am calling gerRecord to validate the record nmuber entered, then if a DatabaseException is thorwn, I convert this into an IOException to satisfy that stupid Data interface.
Anyway it's got too late for me to change anything now. it's 10pm and my exam is at 2pm tommorow (and i've not finshed documneting !).
i'm just gonna explain that i didn't want to change the interface of Data (due to the way this could impact other subclasses / projects ) and say that i read the requirmenets to say that i could only modify OR subclass data.
at the end of the day i think we hav to be able to justify the pro's and cons of our design, and talk about the constraints we worked around.
thanks for all your help. i'll let you know how it went.
cheers - dean
hi mark,
have you got any comment on my originla post.
it kind of relates to your advise that i should not change any of the thrwos clauses in the Data class.
i am still a bit uneasy about the fact that my DataAccess.lock method throws IOException if the record number was not found, and not DatabaseException.
any thoughts on if it is strictly a case of do everything in Data or create subclasses.
if you have any knoweldge that this is not a strict requirement, i am thinking of making my SingleUserData class delegate to Data rather than extend, then i can clean up this lock method's exception, and i'll be much happier that my DataAcccess interface is good.
this will be my last question - but obviuolsy i'll stick around to help others like you've done so generously.
with regards to the javadocs...
is it enought just to document the api, or should we be describing how the classes work - collaborate ? and usung this as one of the main ways to describe our designs ?
is it necessary to do an overview ?
my time has almost run out - gonna sit the exam tommorow and haven't even half finished the documentation. (and it's too late to cancel the exam)
any tips to save me time are v much appreciated.
ps - i recommend leaving plenty of time to do the documentation properly - it takes longer than you think !
By keeping an interface generic ie. throwing Exception from methods, and taking Object type method parameters and returning Object's, you are maximising the interfaces re-use potential. This is because it is totally indpendent of any specifc implementation classes or exceptions.
the only problem with this is if you build your client to work against such an interface, your client end's up catching Exception instead of the specifc exception's that are thrown by the implementations such as DatabaseException (if there was an invalid recrod number), or RemoteException if the network connection failed.
Therefore the interface has given the client no way of handling these to actual exception types seperately.
If the interface we worked against was declared to throw Exception, that would mean the client could only be written to catch Exception.
I think this not recommended, becasue you would catch any runtime exceptions, and as a rule these shouldn't be caught - so the user has visibility of program bugs - and can report them.

[ June 05, 2002: Message edited by: dean tomlinson ]
hi,
having followed many of the suggestions from others on this forum, i have implemented a gui for my dat server, that enables the data server to be shutdown.
and that shutdown process basically calls lock(-1) and when this completes, the server can be sure that no clients have begun to modify the database, the database is safely closed
what i want to do is give the server's thread priority over the client threads that may be competing to lock out records.
i have set the server threads priority to maximum, and i have read that this will only have aneffetc on certain operating systems, but assuming my operating does, will this mean that if the dataserver's thread and a client's thread are both waiting to enter the syncd lock method, the notifyAll call will wake up the server's thread ?
in the books i've got that cover thread scheduling, it doesn't mention that the notifyAll call wakes up the thread with the highest priority (on an os that supports preemtive scheduling).
if it doesn't, what does the threads priority affect ?
cheers - dean
both - your gui layer should deal only with your datainterface, it needn't know anything about remotedatainterface.
[ June 05, 2002: Message edited by: dean tomlinson ]
i'm not sure they are 2 seperate issues. they are listed as one "issue" in the requirements. just beneath the line that says you may enhance the Data class by modifcation or subclassing.
i've got a complete system but are now getting really pedantic about doing exactly what is asked for in the requirements, and have started to bin things that were not.
hi raphael,

you have to think about the reasons why you will subclass rather than modify !
For instance, if modifying will cause problems with you application not being compatible anymore with legacy clients, you should not ! Subclass instead in this case.


i am interpretting from

part of the assignment will be to enhance the Data class. You may do this by modification or subclassing, but you must document the approach and reason for your choice


that you can either modify Data so that it has an inmplementation for criteriaFind lock and unlock, or you can choose to leave it as is, and create subclasses of Data to provide this functionality.
therefroe i think the reason why subclassing is needed, is becasue the locking functionality should not be used by the database for local mode, only when the database is being used within a data server.
therefore creating 2 subclasses of Data (1 for local and 1 for shared use) is a better solution than modifying Data to do everything.
what do you guys think ?
[ June 04, 2002: Message edited by: dean tomlinson ]
hi steven,

There's nothing wrong with fixing the deprecated methods and adding 'criteriaFind' to the 'Data' class even if it is in use elsewhere. The class will still perform the same.


originally i did add criteriaFind to Data (which meant modifying Data) but also created a subclass called SharedData which had locking functionality.
therefroe i think this is against the requirment ...

part of the assignment will be to enhance the Data class. You may do this by modification or subclassing, but you must document the approach and reason for your choice


becasue i am not doing one or the other - but both.
i'm assuming this constraint is there to restrict what can be done. i remember reading that this assignment would involve working around some less than ideal features that exist in the supplied code.
what do you think ?
in the requirements under the section "extending suncertify.db.Data", it says ...


part ofthe assignment will be to enhance the Data class. You may do this by modification or subclassing, but you must document the approach and reason for your choice


this seems to relate to where you implement criteriaFind, lock and unlock. as we are expected to fix the deprecated methods in data regardless.
does anyone know if this is strictly a case of one or the other ?
currently i have implemented criteriafind in Data and i did this this becasue Data was not a complete implementation of a local DataAccess (the interface which enables my gui to seemlessly work in local and reomte mode) resource without it.
i have also created a SharedData class that, together with the SharedDataConnection class provides the locking functionality.
wondering if to totally leave Data - apart from fixing the deprecated code, incase it is being used in other fly by night systems, and create a new subclass for local use perhaps called SingleUserData, which would implement criteriafind. my sharedData could then extend this to provide locking functionality ?
any comments greatly appreciated as always - dean
thanks a lot mark - i really appreciate your help.
it seems that less is more with this assignment. it's really hard to get used to this - with uni assignments the extra marks come from doing that little bit more.
anyway i was supposed to be uploading my assignment tomorow and sitting the exam on wednesday ! best crack on - gonna do the exam on friday instead.
cheers - dean