Interface VRMLNodeFactory

All Known Implementing Classes:
DefaultNodeFactory, NRNodeFactory, OGLNodeFactory

public interface VRMLNodeFactory
Representation of a factory that can produce instances of VRMLNode implementations.

This interface is primarily provided to allow an independence of the factory implementation from the factory functionality. Classes that need to create instances of VRMLNodes would just be passed this interface rather than the full factory. That then allows a single parser to be passed different factories generating different output as needed. For example one factory might use it to write info to a serialised network stream while another uses it as a layer over a rendering API such as Java3D or OpenGL.

The factory has a form of filtering mechanism in built for profile support. It acts as a form of filtering when requesting nodes. If the requested node is not part of the set profile list then the create calls would return null.

Node Creation Behaviour

In order to create a node, the factory has to be told what profile and any optional components the nodes are to come from. Then, the createVRMLNode() calls work on this information to determine whether it is legal or not to create the node. If it is not, then an UnsupportedNodeException is generated naming the node that is in error.

Because Xj3D is also permanently "in development", we have to also recognise that not all components will be completely implemented. For these, the loaded file should not fail with an undefined node message when the node really is valid for that component but we haven't implemented it yet. In that case, the createVRMLNode() methods will return a null. Users should check for this and make sure to understand the difference between this case and that of the invalid node, which generates the exception. In this later case, the user should continue to process the rest of the stream, while issuing a notification message about the missing node implementation.

Version:
$Revision: 1.8 $
Author:
Justin Couch