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


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2005 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:         * Initial developer: Benoit Pelletier
022:         * --------------------------------------------------------------------------
023:         * $Id: DiscoveryCluster.java 9305 2006-08-02 09:11:31Z pelletib $
024:         * --------------------------------------------------------------------------
025:         */package org.objectweb.jonas.ant.cluster;
026:
027:        import java.io.File;
028:        import java.util.Iterator;
029:
030:        import org.objectweb.jonas.ant.jonasbase.BaseTaskItf;
031:        import org.objectweb.jonas.ant.jonasbase.Discovery;
032:
033:        /**
034:         * Define DiscoveryCluster task
035:         * @author Benoit Pelletier
036:         */
037:        public class DiscoveryCluster extends ClusterTasks {
038:
039:            /**
040:             * Info for the logger
041:             */
042:            private static final String INFO = "[DiscoveryCluster] ";
043:
044:            /**
045:             * greeting ports range
046:             */
047:            private String[] greetingPortRange = null;
048:
049:            /**
050:             * source ports range
051:             */
052:            private String[] sourcePortRange = null;
053:
054:            /**
055:             * multicast port
056:             */
057:            private String mcastPort = null;
058:
059:            /**
060:             * multicast addr
061:             */
062:            private String mcastAddr = null;
063:
064:            /**
065:             * ind of master node
066:             */
067:            private int masterNode = -1;
068:
069:            /**
070:             * jonas_root
071:             */
072:            private String jonasRoot = null;
073:
074:            /**
075:             * domain name
076:             */
077:            private String domainName = null;
078:
079:            /**
080:             * protocol
081:             */
082:            private String protocol = null;
083:
084:            /**
085:             * carol ports range
086:             */
087:            private String[] carolPortRange = null;
088:
089:            /**
090:             * domain desc
091:             */
092:            private String domainDesc = null;
093:
094:            /**
095:             * cluster name
096:             */
097:            private String clusterName = null;
098:
099:            /**
100:             * cluster desc
101:             */
102:            private String clusterDesc = null;
103:
104:            /**
105:             * nodes name
106:             */
107:            private String clusterNodesName = null;
108:
109:            /**
110:             * number of Web nodes within the cluster
111:             */
112:            private int clusterWebNodesNb = 0;
113:
114:            /**
115:             * number of Ejb nodes within the cluster
116:             */
117:            private int clusterEjbNodesNb = 0;
118:
119:            /**
120:             * cluster daemon name
121:             */
122:            private String cdName = null;
123:
124:            /**
125:             * cluster daemon protocol
126:             */
127:            private String cdProtocol = null;
128:
129:            /**
130:             * cluster daemon port
131:             */
132:            private String cdPort = null;
133:
134:            /**
135:             * Default constructor
136:             */
137:            public DiscoveryCluster() {
138:                super ();
139:            }
140:
141:            /**
142:             * Set master node
143:             * @param masterNode inf of the master node
144:             */
145:            public void setMasterNode(int masterNode) {
146:                this .masterNode = masterNode;
147:            }
148:
149:            /**
150:             * Set mcastPort
151:             * @param mcastPort multicast port to set
152:             */
153:            public void setMcastPort(String mcastPort) {
154:                this .mcastPort = mcastPort;
155:            }
156:
157:            /**
158:             * Set mcastAddr
159:             * @param mcastAddr multicast address to set
160:             */
161:            public void setMcastAddr(String mcastAddr) {
162:                this .mcastAddr = mcastAddr;
163:            }
164:
165:            /**
166:             * Set greeting ports range
167:             * @param portRange ports range
168:             */
169:            public void setGreetingPortRange(String portRange) {
170:                this .greetingPortRange = portRange.split(",");
171:
172:            }
173:
174:            /**
175:             * Set source ports range
176:             * @param portRange ports range
177:             */
178:            public void setSourcePortRange(String portRange) {
179:                this .sourcePortRange = portRange.split(",");
180:
181:            }
182:
183:            /**
184:             * Set domainName
185:             * @param domainName domain name
186:             */
187:            public void setDomainName(String domainName) {
188:                this .domainName = domainName;
189:            }
190:
191:            /**
192:             * Set domainDesc
193:             * @param domainDesc domain desc
194:             */
195:            public void setDomainDesc(String domainDesc) {
196:                this .domainDesc = domainDesc;
197:            }
198:
199:            /**
200:             * Set clusterName
201:             * @param clusterName cluster name
202:             */
203:            public void setClusterName(String clusterName) {
204:                this .clusterName = clusterName;
205:            }
206:
207:            /**
208:             * Set clusterDesc
209:             * @param clusterDesc cluster desc
210:             */
211:            public void setClusterDesc(String clusterDesc) {
212:                this .clusterDesc = clusterDesc;
213:            }
214:
215:            /**
216:             * Generates the discovery tasks for each JOnAS's instances
217:             */
218:            public void generatesTasks() {
219:
220:                int portInd = 0;
221:
222:                for (int i = getDestDirSuffixIndFirst(); i <= getDestDirSuffixIndLast(); i++) {
223:
224:                    String destDir = getDestDir(getDestDirPrefix(), i);
225:                    log(INFO + "tasks generation for " + destDir);
226:                    // creation of the Discovery tasks
227:                    Discovery discovery = new Discovery();
228:
229:                    if (i == masterNode) {
230:                        discovery.setJonasRoot(jonasRoot);
231:                        discovery.setSourcePort(sourcePortRange[portInd]);
232:                        discovery.setDomainName(domainName);
233:                        discovery.setDomainDesc(domainDesc);
234:                        discovery.setDomainCluster(clusterName, clusterDesc,
235:                                clusterNodesName, clusterWebNodesNb
236:                                        + clusterEjbNodesNb, protocol,
237:                                carolPortRange, cdName, getCdUrl());
238:                    }
239:                    discovery.setGreetingPort(greetingPortRange[portInd]);
240:                    discovery.setMcastPort(mcastPort);
241:                    discovery.setMcastAddr(mcastAddr);
242:
243:                    // set destDir for each task
244:                    for (Iterator it = discovery.getTasks().iterator(); it
245:                            .hasNext();) {
246:                        BaseTaskItf task = (BaseTaskItf) it.next();
247:                        task.setDestDir(new File(destDir));
248:                    }
249:
250:                    addTasks(discovery);
251:
252:                    portInd++;
253:
254:                }
255:            }
256:
257:            /**
258:             * set the name prefix for the cluster nodes
259:             * @param clusterNodesName prefix of the nodes names in the cluster
260:             */
261:            public void setClusterNodesName(String clusterNodesName) {
262:                this .clusterNodesName = clusterNodesName;
263:            }
264:
265:            /**
266:             * Set the number of Web nodes within the cluster
267:             * @param clusterWebNodesNb number of Web nodes within the cluster
268:             */
269:            public void setClusterWebNodesNb(int clusterWebNodesNb) {
270:                this .clusterWebNodesNb = clusterWebNodesNb;
271:            }
272:
273:            /**
274:             * Set the number of Web nodes within the cluster
275:             * @param clusterEjbNodesNb number of Web nodes within the cluster
276:             */
277:            public void setClusterEjbNodesNb(int clusterEjbNodesNb) {
278:                this .clusterEjbNodesNb = clusterEjbNodesNb;
279:            }
280:
281:            /**
282:             * Set the protocol used by the server nodes
283:             * @param protocol protocol
284:             */
285:            public void setProtocol(String protocol) {
286:                this .protocol = protocol;
287:            }
288:
289:            /**
290:             * Set the name used by the cluster daemon
291:             * @param cdName cdName
292:             */
293:            public void setCdName(String cdName) {
294:                this .cdName = cdName;
295:            }
296:
297:            /**
298:             * Set the protocol used by the cluster daemon
299:             * @param cdProtocol cdProtocol
300:             */
301:            public void setCdProtocol(String cdProtocol) {
302:                this .cdProtocol = cdProtocol;
303:            }
304:
305:            /**
306:             * Set the port used by the cluster daemon
307:             * @param cdPort cdPort
308:             */
309:            public void setCdPort(String cdPort) {
310:                this .cdPort = cdPort;
311:            }
312:
313:            /**
314:             * Build the cluster daemon JRM remote url
315:             * @return url
316:             */
317:            public String getCdUrl() {
318:
319:                String url = "service:jmx:rmi://localhost/jndi/rmi://localhost:"
320:                        + cdPort + "/" + cdProtocol + "connector_" + cdName;
321:                return url;
322:            }
323:
324:            /**
325:             * set the carol port range
326:             * @param carolPortRange carol port range
327:             */
328:            public void setCarolPortRange(String carolPortRange) {
329:                this .carolPortRange = carolPortRange.split(",");
330:            }
331:
332:            /**
333:             * Set JONAS ROOT
334:             * @param jonasRoot directory
335:             */
336:            public void setJonasRoot(String jonasRoot) {
337:                this.jonasRoot = jonasRoot;
338:            }
339:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.