Source Code Cross Referenced for EjbGroup.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » ejb » datamodel » 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 » IDE Netbeans » visualweb.api.designer » org.netbeans.modules.visualweb.ejb.datamodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        /*
043:         * EjbGroup.java
044:         *
045:         * Created on April 28, 2004, 4:46 PM
046:         */
047:
048:        package org.netbeans.modules.visualweb.ejb.datamodel;
049:
050:        import java.beans.PropertyChangeEvent;
051:        import java.beans.PropertyChangeListener;
052:        import java.io.File;
053:        import java.util.*;
054:
055:        /**
056:         * This class is to encapsulates the information Rave needs to know abount an EJB Group.
057:         * An EJB group is a group of EJBs deployed on the same server. They must shared the
058:         * following information:
059:         *  - Application server vendor name, for example, SunAppLicationServer, WebLogic, WebSphere
060:         *  - Server host name
061:         *  - RMI-IIOP port number
062:         *  - Client Jar file
063:         *
064:         * An EJB group also contains
065:         *  - All the session Beans in the group
066:         *  - All the entity Beans in the group
067:         *  - All the message Driven beans in the group
068:         *
069:         * @author cao
070:         */
071:        public class EjbGroup implements  java.lang.Cloneable {
072:            private Vector propertyChangeListeners;
073:
074:            private String name;
075:            private String appServerVendorName;
076:            private String hostName;
077:            private int iiopPort;
078:            // A collection of Strings
079:            private ArrayList clientJarFileNames;
080:            private String ddLocationFileName;
081:            private String clientWrapperBeanJar;
082:            private String designInfoJar;
083:
084:            // EjbInfo objects in this ejb group
085:            // Keyed by component interface - (component interface, EjbInfo)
086:            private Map sessionBeans;
087:            private Map entityBeans;
088:            private Map mdbs;
089:
090:            // All the classes found in this ejb group
091:            private ArrayList allClazz = new ArrayList();
092:
093:            public EjbGroup(String name, String vendorName,
094:                    String serverHostName, int iiopPortNum,
095:                    ArrayList clientJarFileNames, String ddLocationFileName) {
096:                this .name = name;
097:                this .appServerVendorName = vendorName;
098:                this .hostName = serverHostName;
099:                this .iiopPort = iiopPortNum;
100:                this .clientJarFileNames = clientJarFileNames;
101:                this .ddLocationFileName = ddLocationFileName;
102:            }
103:
104:            public EjbGroup(String name, String vendorName,
105:                    String serverHostName, int iiopPortNum,
106:                    ArrayList clientJarFileNames) {
107:                this (name, vendorName, serverHostName, iiopPortNum,
108:                        clientJarFileNames, null);
109:            }
110:
111:            public EjbGroup() {
112:            }
113:
114:            /**
115:             * Find the ejb with the given remote interface
116:             */
117:            public EjbInfo getEjbInfo(String remote) {
118:                // Only search session beans for now
119:                return (EjbInfo) sessionBeans.get(remote);
120:            }
121:
122:            public void setName(String newName) {
123:                // Note: if the old name is null, most likely it is
124:                // called by the ejb loader. We do not want to
125:                // notify any listeners for such case.
126:
127:                if (this .name != null && !this .name.equals(newName)) {
128:                    // Notify whoever is interested in the change
129:                    notifyPropertyChangeListeners("name", name, newName);
130:                }
131:
132:                this .name = newName;
133:            }
134:
135:            public void setAppServerVendor(String vendor) {
136:                this .appServerVendorName = vendor;
137:            }
138:
139:            public void setServerHost(String host) {
140:                this .hostName = host;
141:            }
142:
143:            public void setIIOPPort(int port) {
144:                this .iiopPort = port;
145:            }
146:
147:            public void setClientJarFiles(ArrayList fileNames) {
148:                this .clientJarFileNames = fileNames;
149:            }
150:
151:            public void addClientJarFile(String jarFile) {
152:                if (this .clientJarFileNames == null)
153:                    this .clientJarFileNames = new ArrayList();
154:
155:                this .clientJarFileNames.add(jarFile);
156:            }
157:
158:            public void setDDLocationFile(String fileName) {
159:                this .ddLocationFileName = fileName;
160:            }
161:
162:            public void setSessionBeans(Collection beans) {
163:                if (beans == null) {
164:                    sessionBeans = null;
165:                    return;
166:                }
167:
168:                // Wipe out what had before
169:                sessionBeans = new HashMap();
170:
171:                for (Iterator iter = beans.iterator(); iter.hasNext();) {
172:                    EjbInfo ejbInfo = (EjbInfo) iter.next();
173:                    sessionBeans.put(ejbInfo.getCompInterfaceName(), ejbInfo);
174:                }
175:            }
176:
177:            public void addSessionBeans(Collection beans) {
178:                if (this .sessionBeans == null)
179:                    this .sessionBeans = new HashMap();
180:
181:                for (Iterator iter = beans.iterator(); iter.hasNext();) {
182:                    EjbInfo ejbInfo = (EjbInfo) iter.next();
183:                    sessionBeans.put(ejbInfo.getCompInterfaceName(), ejbInfo);
184:                }
185:            }
186:
187:            public void addSessionBean(EjbInfo ejbInfo) {
188:                if (sessionBeans == null)
189:                    sessionBeans = new HashMap();
190:
191:                sessionBeans.put(ejbInfo.getCompInterfaceName(), ejbInfo);
192:            }
193:
194:            public void setEntityBeans(Collection beans) {
195:                if (beans == null) {
196:                    entityBeans = null;
197:                    return;
198:                }
199:
200:                // Wipe out what had before
201:                entityBeans = new HashMap();
202:
203:                for (Iterator iter = beans.iterator(); iter.hasNext();) {
204:                    EjbInfo ejbInfo = (EjbInfo) iter.next();
205:                    entityBeans.put(ejbInfo.getCompInterfaceName(), ejbInfo);
206:                }
207:            }
208:
209:            public void setMDBs(Collection beans) {
210:                if (beans == null) {
211:                    mdbs = null;
212:                    return;
213:                }
214:
215:                // Wipe out what had before
216:                mdbs = new HashMap();
217:
218:                for (Iterator iter = beans.iterator(); iter.hasNext();) {
219:                    EjbInfo ejbInfo = (EjbInfo) iter.next();
220:                    mdbs.put(ejbInfo.getCompInterfaceName(), ejbInfo);
221:                }
222:            }
223:
224:            public void setClientWrapperBeanJar(String jar) {
225:                this .clientWrapperBeanJar = jar;
226:            }
227:
228:            public void setDesignInfoJar(String jar) {
229:                this .designInfoJar = jar;
230:            }
231:
232:            public void setAllClazz(Set allClazz) {
233:                ArrayList classList = new ArrayList(allClazz);
234:                Collections.sort(classList);
235:                this .allClazz = classList;
236:            }
237:
238:            public String getName() {
239:                return this .name;
240:            }
241:
242:            public String getAppServerVendor() {
243:                return this .appServerVendorName;
244:            }
245:
246:            public String getServerHost() {
247:                return this .hostName;
248:            }
249:
250:            public int getIIOPPort() {
251:                return this .iiopPort;
252:            }
253:
254:            public ArrayList getClientJarFiles() {
255:                return this .clientJarFileNames;
256:            }
257:
258:            public String getDDLocationFile() {
259:                return this .ddLocationFileName;
260:            }
261:
262:            public ArrayList getAllClazz() {
263:                return this .allClazz;
264:            }
265:
266:            public boolean hasAnyMethodWithColletionReturn() {
267:                for (Iterator iter = getSessionBeans().iterator(); iter
268:                        .hasNext();) {
269:                    EjbInfo ejbInfo = (EjbInfo) iter.next();
270:
271:                    if (ejbInfo.hasAnyMethodWithCollectionReturn())
272:                        return true;
273:                }
274:
275:                // Didn't find any
276:                return false;
277:            }
278:
279:            public boolean hasAnyConfigurableMethod() {
280:                for (Iterator iter = getSessionBeans().iterator(); iter
281:                        .hasNext();) {
282:                    EjbInfo ejbInfo = (EjbInfo) iter.next();
283:
284:                    if (ejbInfo.hasAnyConfigurableMethod())
285:                        return true;
286:                }
287:
288:                // Didn't find any
289:                return false;
290:            }
291:
292:            public String getClientJarFilesAsOneStr() {
293:                if (this .clientJarFileNames == null
294:                        || this .clientJarFileNames.isEmpty())
295:                    return null;
296:                else {
297:                    StringBuffer str = new StringBuffer();
298:                    boolean first = true;
299:                    for (Iterator iter = this .clientJarFileNames.iterator(); iter
300:                            .hasNext();) {
301:                        String jar = (String) iter.next();
302:
303:                        if (first)
304:                            first = false;
305:                        else
306:                            str.append(", ");
307:
308:                        str.append(jar);
309:                    }
310:
311:                    return str.toString();
312:                }
313:            }
314:
315:            public ArrayList getClientJarFileNames() {
316:                ArrayList justNames = new ArrayList();
317:
318:                if (this .clientJarFileNames != null) {
319:                    for (Iterator iter = this .clientJarFileNames.iterator(); iter
320:                            .hasNext();)
321:                        justNames
322:                                .add(org.netbeans.modules.visualweb.ejb.util.Util
323:                                        .getFileName((String) iter.next()));
324:                }
325:
326:                return justNames;
327:            }
328:
329:            public List<EjbInfo> getSessionBeans() {
330:                if (this .sessionBeans != null) {
331:                    ArrayList<EjbInfo> beans = new ArrayList<EjbInfo>(
332:                            this .sessionBeans.values());
333:                    Collections.sort(beans);
334:                    return beans;
335:                } else
336:                    return null;
337:            }
338:
339:            public Collection getEntityBeans() {
340:                if (this .entityBeans != null)
341:                    return this .entityBeans.values();
342:                else
343:                    return null;
344:            }
345:
346:            public Collection getMDBs() {
347:                if (this .mdbs != null)
348:                    return this .mdbs.values();
349:                else
350:                    return null;
351:            }
352:
353:            public String getDesignInfoJar() {
354:                return this .designInfoJar;
355:            }
356:
357:            public String getClientWrapperBeanJar() {
358:                return this .clientWrapperBeanJar;
359:            }
360:
361:            public boolean isSunAppServer() {
362:                return EjbContainerVendor.isSunAppServer(getAppServerVendor());
363:            }
364:
365:            public boolean isWebLogicAppServer() {
366:                if (this .getAppServerVendor().equals(
367:                        EjbContainerVendor.WEBLOGIC_8_1))
368:                    return true;
369:                else
370:                    return false;
371:            }
372:
373:            public boolean isWebsphereAppServer() {
374:                if (this .getAppServerVendor().equals(
375:                        EjbContainerVendor.WEBSPHERE_5_1))
376:                    return true;
377:                else
378:                    return false;
379:            }
380:
381:            public void fixJarDir(String newDir) {
382:                // Client jars
383:                if (this .clientJarFileNames != null) {
384:                    ArrayList newValues = new ArrayList();
385:                    for (Iterator iter = this .clientJarFileNames.iterator(); iter
386:                            .hasNext();) {
387:                        String oldVal = (String) iter.next();
388:                        String newVal = new File(newDir,
389:                                org.netbeans.modules.visualweb.ejb.util.Util
390:                                        .getFileName(oldVal)).getAbsolutePath();
391:                        newValues.add(newVal);
392:                    }
393:
394:                    this .clientJarFileNames = newValues;
395:                }
396:
397:                // Client wrapper beans jar
398:                if (this .clientWrapperBeanJar != null) {
399:                    File f = new File(newDir,
400:                            org.netbeans.modules.visualweb.ejb.util.Util
401:                                    .getFileName(this .clientWrapperBeanJar));
402:                    this .clientWrapperBeanJar = f.getAbsolutePath();
403:                }
404:
405:                // DesignInfo jar
406:                if (this .designInfoJar != null) {
407:                    File f = new File(newDir,
408:                            org.netbeans.modules.visualweb.ejb.util.Util
409:                                    .getFileName(this .designInfoJar));
410:                    this .designInfoJar = f.getAbsolutePath();
411:                }
412:            }
413:
414:            public String toString() {
415:                StringBuffer buf = new StringBuffer();
416:
417:                // NOI18N
418:                buf.append("EJB Group Name: " + getName() + "\n");
419:                buf.append("ApplicationServerVendor: " + getAppServerVendor()
420:                        + "\n");
421:                buf.append("Server host: " + getServerHost() + "\n");
422:                buf.append("IIOP port: " + getIIOPPort() + "\n");
423:                buf.append("Client Jar files: "
424:                        + getClientJarFiles().toString() + "\n");
425:                buf.append("WrapperBeanJarFile: " + getClientWrapperBeanJar()
426:                        + "\n");
427:                buf.append("DesignInfoJar: " + getDesignInfoJar() + "\n");
428:
429:                if (sessionBeans != null) {
430:                    buf.append("Num of Session beans: " + sessionBeans.size()
431:                            + "\n");
432:                    buf.append(sessionBeans.toString());
433:                }
434:
435:                if (mdbs != null)
436:                    buf.append("Num of MBDs: " + mdbs.size() + "\n");
437:
438:                if (entityBeans != null)
439:                    buf.append("Num of Entity beans: " + entityBeans.size()
440:                            + "\n");
441:
442:                return buf.toString();
443:            }
444:
445:            public Object clone() {
446:                try {
447:                    EjbGroup groupCopy = (EjbGroup) super .clone();
448:
449:                    // Clientjar files
450:                    if (this .clientJarFileNames != null) {
451:                        ArrayList fileNameCopy = new ArrayList();
452:                        for (Iterator iter = this .clientJarFileNames.iterator(); iter
453:                                .hasNext();) {
454:                            String fileName = (String) iter.next();
455:                            fileNameCopy.add(fileName);
456:                        }
457:
458:                        groupCopy.setClientJarFiles(fileNameCopy);
459:                    }
460:
461:                    // Session Beans
462:                    if (this .sessionBeans != null) {
463:                        Collection sbCopy = new HashSet();
464:                        for (Iterator iter = this .sessionBeans.keySet()
465:                                .iterator(); iter.hasNext();) {
466:                            String remote = (String) iter.next();
467:                            sbCopy.add(((EjbInfo) sessionBeans.get(remote))
468:                                    .clone());
469:                        }
470:
471:                        groupCopy.setSessionBeans(sbCopy);
472:                    }
473:
474:                    // Entity Beans
475:                    if (this .entityBeans != null) {
476:                        Collection ebCopy = new ArrayList();
477:                        for (Iterator iter = this .entityBeans.keySet()
478:                                .iterator(); iter.hasNext();) {
479:                            ebCopy.add(((EjbInfo) iter.next()).clone());
480:                        }
481:
482:                        groupCopy.setEntityBeans(ebCopy);
483:                    }
484:
485:                    // MDBs
486:                    if (this .mdbs != null) {
487:                        Collection mbCopy = new ArrayList();
488:                        for (Iterator iter = this .mdbs.keySet().iterator(); iter
489:                                .hasNext();) {
490:                            mbCopy.add(((EjbInfo) iter.next()).clone());
491:                        }
492:
493:                        groupCopy.setMDBs(mbCopy);
494:                    }
495:
496:                    return groupCopy;
497:                } catch (java.lang.CloneNotSupportedException e) {
498:                    return null;
499:                }
500:            }
501:
502:            public void addPropertyChangeListener(
503:                    PropertyChangeListener listener) {
504:                if (propertyChangeListeners == null)
505:                    propertyChangeListeners = new java.util.Vector();
506:
507:                propertyChangeListeners.add(listener);
508:            }
509:
510:            public void removePropertyChangeListener(
511:                    PropertyChangeListener listener) {
512:                if (propertyChangeListeners == null)
513:                    propertyChangeListeners.remove(listener);
514:            }
515:
516:            private void notifyPropertyChangeListeners(String propName,
517:                    Object oldVal, Object newVal) {
518:                if (propertyChangeListeners != null
519:                        && !propertyChangeListeners.isEmpty()) {
520:                    PropertyChangeEvent evt = new PropertyChangeEvent(this ,
521:                            propName, oldVal, newVal);
522:
523:                    for (int i = 0; i < propertyChangeListeners.size(); i++) {
524:                        PropertyChangeListener l = (PropertyChangeListener) propertyChangeListeners
525:                                .get(i);
526:                        l.propertyChange(evt);
527:                    }
528:                }
529:            }
530:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.