Java Doc for BaseNaming.java in  » Sevlet-Container » tomcat-connectors » org » apache » naming » core » 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 » Sevlet Container » tomcat connectors » org.apache.naming.core 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.naming.core.BaseNaming

All known Subclasses:   org.apache.naming.core.BaseContext,
BaseNaming
public class BaseNaming (Code)
This is the base class for our naming operations, for easy reading.

Creating a new context:

  • Create a new class, extending BaseContext or BaseDirContext ( second if you want to support attributes ).
  • Add setters for configuration. The setters will be called autmatically, like in ant, from the initial env settings.
  • Override methods that are defined in BaseNaming. Default behavior is provided for all.
  • If performance is a concern or have special behavior - override Context and DirContext methods. That shouldn't be needed in most cases.
This class is designed to minimize the ammount of code that is required to create a new context. The usual DirContext interface has way too many methods, so implementation requires a lot of typing. Our contexts are mostly wrappers for files or in memory structures. That means some operations are cheaper, and we're far from the features that would be exposed for an LDAP or real Directory server.
author:
   Remy Maucherat
author:
   Costin Manolache


Field Summary
protected  Hashtableenv
     Environment.
final protected  NameParsernameParser
     Default name parser for this context.
protected  StringurlPrefix
     Prefix used for URL-based namming lookup.

Constructor Summary
public  BaseNaming()
     Builds a base directory context.
public  BaseNaming(Hashtable env)
     Builds a base directory context using the given environment.

Method Summary
public  voidallocate()
     Allocate resources for this directory context.
public  voidbind(Name name, Object obj, Attributes attrs, boolean rebind)
     The setter method.
protected  voidcheckWritable(Name n)
     Throws a naming exception is Context is not writable.
public  DirContextcreateSubcontext(Name name, Attributes attrs)
    
public  voidexecute()
     Just a hack so that all DirContexts can be used as tasks.
public  ObjectgetAttribute(Name name, String attName)
    
public  String[]getAttributeNames(Name name)
    
public  intgetCacheObjectMaxSize()
    
public  intgetCacheTTL()
    
public  EnumerationgetChildren()
     Return the child elements, if any. This is a String or Name or Binding or NameClassPari enumeration - the Context implementation will wrap it as a NamingEnumeration and construct the right information. XXX name is all we need - all other info can be extracted - with some penalty.
public  booleanisCached()
    
protected  booleanisWritable(Name name)
     Returns true if writing is allowed on this context.
public  Objectlookup(Name name, boolean resolveLinks)
     The lookup method.
public  voidrecycle()
    
public  voidrelease()
     Release any resources allocated for this directory context.
public  voidsetAttribute(Name name, String attName, Object value)
    
public  voidsetCacheObjectMaxSize(int cacheObjectMaxSize)
    
public  voidsetCacheTTL(int cacheTTL)
    
public  voidsetCached(boolean cached)
    
public  voidsetURLPrefix(String s)
    
protected  Namestring2Name(String s)
    
public  voidunbind(Name name, boolean isContext)
     Remove a binding.

Field Detail
env
protected Hashtable env(Code)
Environment. All context config info.



nameParser
final protected NameParser nameParser(Code)
Default name parser for this context. XXX This should be combined with the Tomcat mapper, and optimized for MessageBytes.



urlPrefix
protected String urlPrefix(Code)
Prefix used for URL-based namming lookup. It must be removed from all names. Deprecated ? Do we need it ?




Constructor Detail
BaseNaming
public BaseNaming()(Code)
Builds a base directory context.



BaseNaming
public BaseNaming(Hashtable env)(Code)
Builds a base directory context using the given environment.




Method Detail
allocate
public void allocate()(Code)
Allocate resources for this directory context.



bind
public void bind(Name name, Object obj, Attributes attrs, boolean rebind) throws NamingException(Code)
The setter method. Implement it if the context is read/write.
Parameters:
  name -
Parameters:
  obj - The object to be bound.
Parameters:
  attrs - Attributes - if this is a dir context, null otherwise
Parameters:
  rebind - What to do if the name is already bound. XXX can be further simplified - do a lookup and implement it.



checkWritable
protected void checkWritable(Name n) throws NamingException(Code)
Throws a naming exception is Context is not writable.



createSubcontext
public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException(Code)



execute
public void execute()(Code)
Just a hack so that all DirContexts can be used as tasks. They'll do nothing - the setters will be called ( just like new Context(Hashtable) - since we use introspection ) and the context can be registred as a reference in the Project ns. Then other tasks could manipulate it by name. In a future version of ant we should have the 'references' pluggable and a possible impl should be JNDI. Alternative: there is a way to use tasks without this method, but for now it's simpler.



getAttribute
public Object getAttribute(Name name, String attName) throws NamingException(Code)
Implement for directories



getAttributeNames
public String[] getAttributeNames(Name name) throws NamingException(Code)



getCacheObjectMaxSize
public int getCacheObjectMaxSize()(Code)



getCacheTTL
public int getCacheTTL()(Code)



getChildren
public Enumeration getChildren() throws NamingException(Code)
Return the child elements, if any. This is a String or Name or Binding or NameClassPari enumeration - the Context implementation will wrap it as a NamingEnumeration and construct the right information. XXX name is all we need - all other info can be extracted - with some penalty. It's easy to do some instanceof tricks to avoid it, if possible, but the goal is to make it easy to write contexts, and name should be enough.



isCached
public boolean isCached()(Code)



isWritable
protected boolean isWritable(Name name)(Code)
Returns true if writing is allowed on this context.



lookup
public Object lookup(Name name, boolean resolveLinks) throws NamingException(Code)
The lookup method. This is the main method you should implement.
Parameters:
  name -
Parameters:
  resolveLinks - If false, this is a lookupLink call.



recycle
public void recycle()(Code)



release
public void release()(Code)
Release any resources allocated for this directory context.



setAttribute
public void setAttribute(Name name, String attName, Object value) throws NamingException(Code)



setCacheObjectMaxSize
public void setCacheObjectMaxSize(int cacheObjectMaxSize)(Code)



setCacheTTL
public void setCacheTTL(int cacheTTL)(Code)



setCached
public void setCached(boolean cached)(Code)



setURLPrefix
public void setURLPrefix(String s)(Code)



string2Name
protected Name string2Name(String s) throws InvalidNameException(Code)



unbind
public void unbind(Name name, boolean isContext) throws NamingException(Code)
Remove a binding. XXX do we need the isContext case ?



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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