Source Code Cross Referenced for BeanNaming.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_ejb » lib » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas_ejb.lib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: BeanNaming.java 5445 2004-09-17 08:25:02Z joaninh $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ejb.lib;
025:
026:        import java.io.File;
027:        import java.lang.reflect.Method;
028:        import java.util.StringTokenizer;
029:
030:        import javax.security.jacc.EJBMethodPermission;
031:
032:        /**
033:         * This class is made for hiding Naming convention in all JOnAS framework. <br>
034:         * (Among other things, names of the implementation classes of the Enterprise
035:         * Bean's Home and Enterprise Bean Remote interfaces generated by the GenIC
036:         * tools.) <br>
037:         * It is used by the EJB generation tools and framework
038:         *
039:         * @author Helene Joanin
040:         * @author Joe Gittings has proposed to code method signature in order to avoid same signature for inherited methods
041:         * @author Christophe Ney [cney@batisseurs.com]
042:         * @author Sebastien Chassande-Barrioz
043:         */
044:        public class BeanNaming {
045:
046:            /**
047:             * returns the name of the package of the given full name
048:             */
049:            public static String getPackageName(String name) {
050:                if (name == null) {
051:                    return null;
052:                }
053:                int idx = name.lastIndexOf('.');
054:                return (idx == -1 ? "" : name.substring(0, idx));
055:            }
056:
057:            /**
058:             * return full name of a class for given package and class names
059:             *
060:             * @param packageName
061:             *            possibly empty package name
062:             * @param name
063:             *            class name
064:             * @return fully qualified class name
065:             */
066:            public static String getClassName(String packageName, String name) {
067:                return (packageName.length() == 0) ? name : packageName + "."
068:                        + name;
069:            }
070:
071:            /**
072:             * returns the basename of the given full name
073:             */
074:            public static String getBaseName(String fullName) {
075:                String baseName = null;
076:                if (fullName != null) {
077:                    int idx = fullName.lastIndexOf('.');
078:                    int len = fullName.length();
079:                    if (idx == -1) {
080:                        baseName = fullName;
081:                    } else {
082:                        if (idx != (len - 1)) {
083:                            baseName = fullName.substring(idx + 1, len);
084:                        } else {
085:                            baseName = "";
086:                        }
087:                    }
088:                }
089:                return baseName;
090:            }
091:
092:            /**
093:             * returns the full path of the file name. mainly replace '.' by '/'.
094:             */
095:            public static String getPath(String fullName) {
096:                String pkg = new String();
097:                StringTokenizer stk = new StringTokenizer(fullName, ".");
098:                int nb = stk.countTokens();
099:                for (int i = 0; i < nb; i++) {
100:                    pkg = pkg.concat(stk.nextToken());
101:                    if (i < nb - 1) {
102:                        pkg = pkg + File.separatorChar;
103:                    }
104:                }
105:                return pkg;
106:            }
107:
108:            /**
109:             * returns the given string with the first character converted to upper case
110:             */
111:            public static String firstToUpperCase(String s) {
112:                String value;
113:                if (s.length() > 0) {
114:                    char c = Character.toUpperCase(s.charAt(0));
115:                    value = new String(c + s.substring(1));
116:                } else {
117:                    value = new String();
118:                }
119:                return (value);
120:            }
121:
122:            /**
123:             * returns the name of the JOnAS specific deployment descriptor file's name
124:             * corresponding to the given standard deployment descriptor file's name.
125:             * (ex: returns "jonas-XXX.xml" for "XXX.xml" and "../../jonas-XXX.xml" for
126:             * "../../XXX.xml")
127:             */
128:            public static String getJonasXmlName(String stdXmlName) {
129:
130:                String jonasXmlName = new String();
131:                File f = new File(stdXmlName);
132:                String p = f.getParent();
133:                String n = f.getName();
134:                if (p != null) {
135:                    jonasXmlName = jonasXmlName.concat(p);
136:                    jonasXmlName = jonasXmlName.concat(File.separator);
137:                }
138:                jonasXmlName = jonasXmlName.concat("jonas-");
139:                jonasXmlName = jonasXmlName.concat(n);
140:
141:                return (jonasXmlName);
142:            }
143:
144:            /**
145:             * returns the name of the parent directory
146:             */
147:            public static String getParentName(String fileName) {
148:                File f = new File(fileName);
149:                return f.getParent();
150:            }
151:
152:            /**
153:             * Gets a string that represents the signature of a method
154:             *
155:             * @param ejbName
156:             *            name of the ejb
157:             * @param method
158:             *            Method on which the signature is required
159:             * @return string that represents the signature of a method
160:             */
161:            public static String getSignature(String ejbName, Method method) {
162:
163:                Class clazz = method.getDeclaringClass();
164:                String methItf = "";
165:
166:                if (javax.ejb.EJBHome.class.isAssignableFrom(clazz)) {
167:                    methItf = "Home";
168:                } else if (javax.ejb.EJBObject.class.isAssignableFrom(clazz)) {
169:                    methItf = "Remote";
170:                } else if (javax.ejb.EJBLocalHome.class.isAssignableFrom(clazz)) {
171:                    methItf = "LocalHome";
172:                } else if (javax.ejb.EJBLocalObject.class
173:                        .isAssignableFrom(clazz)) {
174:                    methItf = "Local";
175:                } else if (java.rmi.Remote.class.isAssignableFrom(clazz)) {
176:                    methItf = "ServiceEndpoint";
177:                }
178:
179:                return new EJBMethodPermission(ejbName, methItf, method)
180:                        .getActions();
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.