Stuart J W Bell

Greenhorn
+ Follow
since Nov 23, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Stuart J W Bell

I have been looking into the use of symmetric and asymmetric keys in conjunction with the Cipher class, see following article:

http://java.sun.com/developer/JDCTechTips/2004/tt0116.html

This works fine in simplistic terms, but in a live production system, you would be unlikely to be re-generating keys each time as it wouldn't get you very far. I would have thought the process would most likely be to generate a key and store it for future re-use. Especially so if you wish to decrypt some data time and again.

So, my question is, what is common practice when it comes to storing keys for encryption and decryption purposes? And furthermore, what is the best recommendation when deciding to use symmetric versus asymmetric keys?

Thanks,


Stuart
17 years ago
Hi there,


I am investigating using a grammar cache pool to improve schema validation performance. I understand the concept, but the only piece that I would like to know about is whether you have to use it in conjunction with a parser pool as well?

http://www.ibm.com/developerworks/xml/library/x-perfap3.html

http://www.ibm.com/developerworks/xml/library/x-perfap2.html

For me, it makes sense if you are re-using the same parser each time as it will be configured to use the pre-compiled schema each time. However, if the parser is being created each time (i.e. localling in a method) then does the grammar cache pool stand much chance of working? Does the grammar cache pool get statically stored once it has been pre-compiled and will be available in that state for the remainder of the application's life?

Any thoughts out there?

Cheers,


Stuart
Hi there,


Has anyone had any issues with CPU usage when performing schema validation? I am investigating the possibility of this scenario but I am yet to be convinced that this is the case.

The code I am looking over makes use of a JAXP/DOM parser (DocumentBuilder) and applies the schema location by setting it as an attribute. Good details of how this is achieved can be found in to the article below:

http://www.onjava.com/pub/a/onjava/2004/09/15/schema-validation.html

The code seems to be constructed sensibly enough, however I was wondering what the thoughts were of schema validation, with regards to the best parser to use in that circumstance? SAX or DOM? Would SAX always be faster? The XML document is not particularly large.

Would it be advisable to use a grammer cache instead?

I welcome anyone's thoughts on this.

Cheers,


Stuart
Hi,


I was looking for links/references to articles regarding best practice for testing shared components.

I have one such component that is shared by a number of different applications, whenever a change is made to the shared component there is the headache of having to test the dependent applications rather than isolating the testing to just the changed application.

Can anyone supply some information on the best practice for this at all? I was hoping that this is a common problem (especially in an SOA world) and there might be a common view on how to resolve it or at least mitigate it.

Thanks,


Stuart
17 years ago
I worked for a small, Java development team and was one of the senior leads. We attempted to use various XP or Agile techniques, here is what worked:

- XP Game - gave people an idea of the principles of XP
- Whiteboards - we had three big ones on the walls around our area, great for technical discussion and promoting information.
- Co-locating our business teams - we had various representatives from the business areas sitting with our dev and test team. Having them on hand to answer questions and make decisions was invaluable.
- Continuous unit testing.
- Frequent builds.
- Using tools such as findbugs and checkstyle.
- Going lighter on documentation - we used a UML format for capturing information.
- Every second day we would have a 5 min stand up meeting.

Make sure that you keep management up to date with what you are doing. They need to have visible deliverables so that they are comfortable with the technique. We found that because we were not producing 300 page requirement docs or 500 page design docs, they got gittery and clamped down on us - causing a processing of retrospective documenting.

Personally, I wouldn't sling terms such as eXtreme Programming around and go for a hybrid approach. See what approaches would be easy for your organisation to adopt early on and slowly introduce each one. Remember it won't happen over night.

We never used anything like XPlanner, although the idea sounds good. I was very interested in calculating the team's velocity, but never got as far as that unfortuantely.

Hope that helps.


Stuart
Unfortunately we are not using JBoss, instead we are using IBM's WebSphere Application Server.

Any thoughts around that environment?

Cheers,


Stuart
I'm currently looking at a piece of work to replace a servlet, which currently kicks off a thread that polls a messaging queue (in this case MQ). I know I know - I hear all of you in shock at the terribleness of this, that is why I have come along to see what is the better alternative.

My solution is to use an MDB instead. However, in the servlet's init() method it carries out a few house keeping jobs that we need to keep in place post-MDB solution. Ideally I would like to dispense with the servlet, but I would need to have something equivalent to the init() method that can act during start up and perform these tasks only once.

Is there anything within an MDB that would carry this out? Or are there any other alternatives that anyone can think of?

Cheers,


Stuart
Apologies for any misdirection, it wasn't intended.

Regards,


Stuart
I've managed to make use of the EntityResolver interface to re-direct the DTD reference to a local location. Which is really what I was trying to do programmatically.

An example of this is shown below.

Thanks for all your input.


Stuart

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

import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;

public class DtdEntityResolver implements EntityResolver {

public InputSource resolveEntity(String publicID, String systemID) {

if (systemID.equals("Quote_21.dtd")) {
return new InputSource("/url/goes/here/Quotes_21.dtd");
}
else {
// use the default behaviour
return null;
}
}
}
Paul,

You are essentially correct. I am looking to configure the parser to tell it where to get a DTD and include it for validation. This would save XML string manipulation (to include the DTD reference) every time the XML is due to be parsed. I would have thought that configuring it at the parser level would have performance advantages too.

I am not concerned about how much validation a DTD gives me in comparison to schemas etc. If I had a choice I would use a schema, but I don't.

Paul, you mentioned that you have seen this question many times, has anyone found an answer? The link that Ulf provided is very much schema-centric and it is taking a bit of time to find out the means to do this using a DTD instead.

Thanks,


Stuart
Ulf,

I am aware that schemas are more versatile, modern and comprehensive than DTDs. Unfortunately, the solution we are having to use only allows for DTDs, so we are stuck with them for the moment.

I haven't tried the code yet for programmatic DTD validation, but I will spend sometime tomorrow looking at it. It just doesn't seem that clear cut and all the examples are based on schemas rather than DTDs.

I'll let you know how I get on.


Stuart
Thanks Ulf....however.

Not an encouraging point from the following article (
http://www.onjava.com/pub/a/onjava/excerpt/learnjava_23/index4.html#49809):

To use our DTD, we must associate it with the XML document. We do this by placing a DOCTYPE declaration in the XML itself. When a validating parser encounters the DOCTYPE, it attempts to load the DTD and validate the document. There are several forms the DOCTYPE can have, but the one we'll use is:

<!DOCTYPE Inventory SYSTEM "zooinventory.dtd">
Both SAX and DOM parsers can automatically validate documents that contain a DOCTYPE declaration. However, you have to explicitly ask the parser factory to provide a parser that is capable of validation. To do this, set the validating property of the parser factory to true before you ask it for an instance of the parser. For example:
SAXParserFactory factory = SAXParserFactory.newInstance( );
factory.setValidating( true );

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

Which further states "Although DTDs can define the basic structure of an XML document, they can't adequately describe data and validate it programmatically."

Unless I am missing a trick of course.


Stuart
Hi Ulf,


Thanks for your response. That is along the lines of what I am looking for. If anyone else is reading this, do they know what the setting is to invoke DTD validation rather than schema?

Thanks,


Stuart
Hi all,

I am using the Xerces2 for Java XML parser just now and I am looking for a way to validate an XML document using a DTD. The previous piece of code that I am looking at manipulates the XML string to include the <!DOCTYPE> tag with the DTD location before it is loaded into the parser.

However, this seems clunky, expensive and I feel that has to be better way of doing this.

What is the best way of dynamically attaching a DTD to an XML document so that it can be parsed using Xerces as the parser?

I've seen this done using the grammar pool property when using a schema, but I am not sure whether the same can be done with DTDs.

Any thoughts?

Thanks,


Stuart
Hi all,


I am looking into various SOAP engines to see which would be the most suitable for my needs. In particular I am looking into SOAP over JMS as a transport. I am finding a lot of conflicting information on this for a start.

In particular on the use of technology that would be supported under a WebSphere environment. I have been looking at Axis and how it can be used to send messages, however the following article casts some doubt on it:

http://www-128.ibm.com/developerworks/websphere/library/techarticles/0405_reinitz/0405_reinitz.html

Instead it talks about IBM's WebSphere SOAP engine. Has anyone used this to any degree and can they share some information on this? It appears to be rather buttoned up and I am finding it difficult to find a published API to find out how best to utilise it.

Can anyone shed some light on this?

Thanks,


Stuart
18 years ago