Source Code Cross Referenced for DeleteChannelBean.java in  » Portal » Open-Portal » com » sun » portal » admin » console » desktop » 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 » Portal » Open Portal » com.sun.portal.admin.console.desktop 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: DeleteChannelBean.java,v 1.11 2005/10/21 01:29:27 cathywu Exp $
003:         * Copyright 2005 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.admin.console.desktop;
014:
015:        import java.util.List;
016:        import java.util.Set;
017:        import java.util.ArrayList;
018:        import java.util.Iterator;
019:        import java.util.LinkedList;
020:        import java.util.logging.Level;
021:
022:        //JMX
023:        import javax.management.ObjectName;
024:        import javax.management.MBeanException;
025:        import javax.faces.event.ValueChangeEvent;
026:
027:        import com.sun.web.ui.model.Option;
028:
029:        import com.sun.portal.admin.common.util.AdminClientUtil;
030:        import com.sun.portal.admin.common.PSMBeanException;
031:        import com.sun.portal.admin.console.fabric.ListPortalsBean;
032:
033:        /**
034:         * @author cathywu
035:         */
036:        public class DeleteChannelBean extends ChannelContainerBaseBean {
037:            private List channels;
038:            private List containers;
039:            private Object[] channelList;
040:            private String actionStatus;
041:
042:            public DeleteChannelBean() {
043:                //setup channels 
044:                if (channels == null) {
045:                    channels = fetchChannels();
046:                    setChannelOrContainer(CHANNEL);
047:                }
048:
049:            }
050:
051:            public void refreshChannels(ValueChangeEvent event) {
052:                String val = (String) event.getNewValue();
053:
054:                if (val.equals(CONTAINER)) {
055:                    channels = fetchContainers();
056:                } else {
057:                    channels = fetchChannels();
058:                }
059:            }
060:
061:            public List getChannels() {
062:                if (getDisplayError() == Boolean.TRUE) {
063:                    setDisplayError(Boolean.FALSE);
064:                }
065:
066:                String cdn = (String) getCurrentDN();
067:                String cpid = (String) getSessionAttribute(ListPortalsBean.ATTR_SELECTED_PORTAL);
068:                log(Level.INFO, "DeleteChannelBean.getChannels(), dn: " + dn
069:                        + "current dn: " + cdn);
070:                log(Level.INFO, "DeleteChannelBean.getChannels(), portal: "
071:                        + portalId + "current portal: " + cpid);
072:
073:                if (!dn.equals(cdn) || (getRegenerate() == true)
074:                        || !cpid.equals(portalId)) {
075:                    dn = cdn;
076:                    portalId = cpid;
077:                    if (getChannelOrContainer().equals(CHANNEL)) {
078:                        channels = fetchChannels();
079:                    } else {
080:                        channels = fetchContainers();
081:                    }
082:
083:                }
084:                return channels;
085:            }
086:
087:            /**
088:             * Channel methods
089:             */
090:            public Object[] getSelectedList() {
091:                if (getDisplayError() == Boolean.TRUE) {
092:                    setDisplayError(Boolean.FALSE);
093:                }
094:                return new Object[0];
095:            }
096:
097:            public void setSelectedList(Object[] val) {
098:                channelList = new Object[val.length];
099:                for (int i = 0; i < val.length; i++) {
100:                    channelList[i] = val[i];
101:                }
102:            }
103:
104:            /**
105:             * Containers methods
106:             */
107:            private List fetchContainers() {
108:                LinkedList path = new LinkedList();
109:                path.addFirst(getDomain());
110:                path.addFirst(portalId);
111:                path.addFirst(AdminClientUtil.DISPLAYPROFILE_MBEAN);
112:
113:                List options = new ArrayList();
114:
115:                try {
116:                    // Get the current selected container
117:                    String parentContainer = getTreeContainer();
118:
119:                    Object[] params = { dn, Boolean.TRUE };
120:                    String[] signature = { "java.lang.String",
121:                            "java.lang.Boolean" };
122:
123:                    ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
124:                            AdminClientUtil.DISPLAYPROFILE_MBEAN_TYPE, path);
125:                    Set cs = (Set) mbsc.invoke(on, "getExistingContainers",
126:                            params, signature);
127:                    Iterator i = cs.iterator();
128:                    while (i.hasNext()) {
129:                        String cName = (String) i.next();
130:                        // If the FQCN of the channel contains the parent name and
131:                        // is not same as the parent then add it to the list of 
132:                        // containers that can be deleted at the current node
133:                        if (parentContainer != null) {
134:                            if (cName.startsWith(parentContainer)
135:                                    && !cName.equals(parentContainer)
136:                                    && !parentContainer.equals("_root")) {
137:                                options.add(new Option(cName, cName));
138:                            }
139:                        } else {
140:                            // If parentContainer is null then the tree thats being 
141:                            // displayed is the DP XML Tree
142:                            options.add(new Option(cName, cName));
143:                        }
144:                    }
145:                    setRegenerate(false);
146:                } catch (Exception e) {
147:                    setupAlert(
148:                            null,
149:                            "error.deleteContainer.summary",
150:                            "error.deleteContainer.getContainers.failed.checkLogs",
151:                            "error", null, composeLogMessage(e));
152:                    log(
153:                            Level.SEVERE,
154:                            "Exception in DeleteContainerBean.setupContainers()",
155:                            e);
156:                }
157:                return options;
158:            }
159:
160:            /**
161:             * Channels methods
162:             */
163:            private List fetchChannels() {
164:
165:                List options = new ArrayList();
166:
167:                try {
168:                    // Get the current selected container            
169:                    String parentContainer = getTreeContainer();
170:
171:                    Object[] params = { dn, Boolean.TRUE };
172:                    String[] signature = { "java.lang.String",
173:                            "java.lang.Boolean" };
174:
175:                    ObjectName on = AdminClientUtil
176:                            .getDisplayProfileMBeanObjectName(getDomain(),
177:                                    portalId);
178:                    Set cs = (Set) mbsc.invoke(on, "getExistingChannels",
179:                            params, signature);
180:                    Iterator i = cs.iterator();
181:                    while (i.hasNext()) {
182:                        String cName = (String) i.next();
183:                        // If the FQCN of the channel contains the parent then
184:                        // it should be displayed.
185:                        if (parentContainer != null
186:                                && !parentContainer.equals("_root")) {
187:
188:                            if (cName.startsWith(parentContainer)) {
189:                                options.add(new Option(cName, cName));
190:                            }
191:                        } else {
192:                            // If parentContainer is null then the tree thats being 
193:                            // displayed is the DP XML Tree
194:                            options.add(new Option(cName, cName));
195:                        }
196:                    }
197:                    setRegenerate(false);
198:                } catch (MBeanException me) {
199:                    log(
200:                            Level.SEVERE,
201:                            "DeleteChannelBean.fetchChannels(): Failed to get existing channels due to MBeanException ",
202:                            me);
203:                    String alertDetailKey = null;
204:                    String message = null;
205:
206:                    if (me.getCause() instanceof  PSMBeanException) {
207:                        alertDetailKey = ((PSMBeanException) me.getCause())
208:                                .getErrorKey();
209:                        message = composeLogMessage(((PSMBeanException) me
210:                                .getCause()));
211:                    } else {
212:                        alertDetailKey = "error.deleteChannel.getChannels.failed.checkLogs";
213:                        message = composeLogMessage(me);
214:                    }
215:
216:                    setupAlert(null, "error.deleteChannel.summary",
217:                            alertDetailKey, "error",
218:                            "error.deleteChannel.getChannels.failed.checkLogs",
219:                            message);
220:                } catch (Exception e) {
221:                    setupAlert(null, "error.deleteChannel.summary",
222:                            "error.deleteChannel.getChannels.failed.checkLogs",
223:                            "error", null, composeLogMessage(e));
224:                    log(Level.SEVERE,
225:                            "Exception in DeleteChannelBean.fetchChannels()", e);
226:                }
227:                return options;
228:            }
229:
230:            /**
231:             * deleteChannel methods
232:             * This method is used by both DeleteChannelBean and 
233:             * DeleteContainerBean.
234:             */
235:            public String deleteChannel(Object[] cl) {
236:                if (cl.length == 0) {
237:                    log(Level.INFO,
238:                            "DeleteChannelBean.deleteChannel(), channel list empty");
239:                    setupAlert(null, "error.deleteChannel.summary",
240:                            "error.deleteChannel.empty.channellist", "error",
241:                            null, null);
242:                    return "done";
243:                }
244:
245:                String cn = null;
246:                try {
247:
248:                    ObjectName on = AdminClientUtil
249:                            .getDisplayProfileMBeanObjectName(
250:                                    AdminClientUtil.DEFAULT_DOMAIN, portalId);
251:
252:                    for (int i = 0; i < cl.length; i++) {
253:                        String parent = "";
254:                        cn = (String) cl[i];
255:
256:                        int ind = cn.lastIndexOf("/");
257:
258:                        if (ind != -1) {
259:                            parent = cn.substring(0, ind);
260:                            cn = cn.substring(ind + 1, cn.length());
261:                        }
262:                        log(Level.INFO,
263:                                "DeleteChannelBean.deleteChannel(), channel name: "
264:                                        + cn);
265:                        log(Level.INFO,
266:                                "DeleteChannelBean.deleteChannel(), parent: "
267:                                        + parent);
268:
269:                        Object[] params = { dn, cn, parent };
270:                        String[] signature = { "java.lang.String",
271:                                "java.lang.String", "java.lang.String" };
272:
273:                        log(Level.INFO,
274:                                "DeleteChannelBean.deleteChannel(), current dn: "
275:                                        + dn);
276:                        log(Level.INFO,
277:                                "DeleteChannelBean.deleteChannel(), current portal: "
278:                                        + portalId);
279:
280:                        mbsc.invoke(on, "deleteChannel", params, signature);
281:                    }
282:
283:                    setupAlert(null, "deleteChannel.summary",
284:                            "deleteChannel.completed", "information", null,
285:                            null);
286:                    setCancelText((String) rbMap.get("close.button"));
287:                    //re-generate channels
288:                    setRegenerate(true);
289:                } catch (MBeanException me) {
290:                    log(Level.SEVERE,
291:                            "DeleteChannelBean.deleteChannel(): Failed to delete channel "
292:                                    + cn + " due to MBeanException ", me);
293:                    String alertDetailKey = null;
294:                    Object[] tokens = null;
295:                    String message = null;
296:
297:                    if (me.getCause() instanceof  PSMBeanException) {
298:                        alertDetailKey = ((PSMBeanException) me.getCause())
299:                                .getErrorKey();
300:                        tokens = ((PSMBeanException) me.getCause()).getTokens();
301:                        message = composeLogMessage(((PSMBeanException) me
302:                                .getCause()));
303:                    } else {
304:                        alertDetailKey = "error.deleteChannel.failed.checkLogs";
305:                        tokens = new Object[] { cn };
306:                        message = composeLogMessage(me);
307:                    }
308:
309:                    setupAlert(tokens, "error.createChannel.summary",
310:                            alertDetailKey, "error",
311:                            "error.createChannel.failed.checkLogs", message);
312:                } catch (Exception e) {
313:                    setupAlert(null, "error.deleteChannel.summary",
314:                            "error.deleteChannel.failed", "error", null,
315:                            composeLogMessage(e));
316:                    log(Level.SEVERE,
317:                            "Exception in DeleteChannelBean.deleteChannel()", e);
318:                }
319:
320:                return "done";
321:            }
322:
323:            /**
324:             * ActionStatus
325:             */
326:            public String getActionStatus() {
327:                return actionStatus;
328:            }
329:
330:            public void setActionStatus(String status) {
331:                actionStatus = status;
332:            }
333:
334:            /**
335:             * deleteChannel methods
336:             */
337:            public String beginDeleteChannel() {
338:                deleteChannel(channelList);
339:                setActionStatus("complete");
340:
341:                return null;
342:            }
343:
344:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.