Java Doc for ObjectFactory.java in  » Apache-Harmony-Java-SE » javax-package » javax » naming » spi » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » javax package » javax.naming.spi 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.naming.spi.ObjectFactory

ObjectFactory
public interface ObjectFactory (Code)
An ObjectFactory creates objects of a specified type. A variety of different objects may be used by a JNDI application; these objects are meaningful to the application and can be manipulated according to the methods available to the class of the object, such as a printer object. The class implementing this interface should be public, should also provide a public constructor taking no arguments, and should be thread-safe. Where URL is mentioned below, this refers to RFC 1738 and related RFCs.




Method Summary
 ObjectgetObjectInstance(Object o, Name n, Context c, Hashtable envmt)
     Creates an object of the type specified by parameter o, including any reference or location details, customized by the specified envmt parameter.

Object factories are specified via environment properties from several sources including provider properties files (see the specification of the Context interface) and may comprise a list of factories. Each object factory in the list is used by NamingManager.getObjectInstance() which invokes this method on each of them until a non-null result is achieved or until the list is exhausted.




Method Detail
getObjectInstance
Object getObjectInstance(Object o, Name n, Context c, Hashtable envmt) throws Exception(Code)
Creates an object of the type specified by parameter o, including any reference or location details, customized by the specified envmt parameter.

Object factories are specified via environment properties from several sources including provider properties files (see the specification of the Context interface) and may comprise a list of factories. Each object factory in the list is used by NamingManager.getObjectInstance() which invokes this method on each of them until a non-null result is achieved or until the list is exhausted. If an ObjectFactory throws an exception, it should be passed back to the code that invoked NamingManager.getObjectInstance() and no further object factories in the list are examined. An exception should only be thrown by an object factory if it is intended that no other object factories be examined. Usually, if an ObjectFactory is unable to create an object, then null should be returned.

A special case of ObjectFactory is a URL context factory which is used either to create an object whose location is specified by a URL passed as the object o or creates contexts for resolving URLs. The getObjectInstance() method of a URL context factory must obey these rules:

1. When Object o is null, return a new Context object suitable for resolving any URL of the scheme supported by this factory.

2. When Object o is a URL string, return a new object (usually a context) identified by the URL, so that names relatively lower than that context may be resolved.

3. When Object o is an Array object with more than one URL string (order is not important), return a new object (usually a context) identified by the URL as in rule 2, above. The URLs in the array are considered to be equivalent in relation to the associated context, but the object (context) factory can choose whether or not to verify that they are truly equivalent.

4. Otherwise, the behaviour of this method depends on the context factory implementation.


Parameters:
  o - may be null or may contain location or reference details
Parameters:
  n - the name relative to the context c of theobject being created and may be null; the implementation mayclone or copy this object, but will not modify the original.
Parameters:
  c - may be null when the name is relative to the default initialcontext, or specifies the context to which the name isrelative (if a factory uses this context object,synchronization should be used as Context objects are notthread-safe).
Parameters:
  envmt - may be null; the implementation may clone or copy this object,but will not modify the original. either an object of the specified type or null if no object couldbe created.
throws:
  Exception - causes no further object factory will be tried



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.