Source Code Cross Referenced for BaseImportExportHandler.java in  » EJB-Server-geronimo » plugins » org » apache » geronimo » console » car » 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 » EJB Server geronimo » plugins » org.apache.geronimo.console.car 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */package org.apache.geronimo.console.car;
017:
018:        import java.io.IOException;
019:        import java.net.URL;
020:
021:        import javax.portlet.PortletRequest;
022:        import javax.portlet.PortletException;
023:        import javax.portlet.PortletSession;
024:        import javax.portlet.RenderRequest;
025:        import javax.security.auth.login.FailedLoginException;
026:
027:        import org.apache.geronimo.console.MultiPageAbstractHandler;
028:        import org.apache.geronimo.system.plugin.model.PluginListType;
029:        import org.apache.geronimo.system.plugin.model.PluginType;
030:        import org.apache.geronimo.system.plugin.model.PluginArtifactType;
031:        import org.apache.geronimo.system.plugin.PluginInstaller;
032:        import org.apache.geronimo.system.plugin.PluginInstallerGBean;
033:        import org.apache.geronimo.kernel.config.NoSuchStoreException;
034:
035:        /**
036:         * The base class for all handlers for this portlet
037:         *
038:         * @version $Rev: 627838 $ $Date: 2008-02-14 10:54:30 -0800 (Thu, 14 Feb 2008) $
039:         */
040:        public abstract class BaseImportExportHandler extends
041:                MultiPageAbstractHandler {
042:            protected static final String CONFIG_LIST_SESSION_KEY = "console.plugins.ConfigurationList";
043:            protected static final String CONFIG_LIST_REPO_SESSION_KEY = "console.plugins.ConfigurationListRepo";
044:            protected static final String SERVER_CONFIG_LIST_SESSION_KEY = "console.plugins.ServerConfigurationList";
045:            public static final String DOWNLOAD_RESULTS_SESSION_KEY = "console.plugins.DownloadResults";
046:            protected static final String INDEX_MODE = "index";
047:            protected static final String ADD_REPO_MODE = "addRepository";
048:            protected static final String LIST_MODE = "list";
049:            protected static final String DOWNLOAD_MODE = "download";
050:            protected static final String VIEW_FOR_DOWNLOAD_MODE = "viewForDownload";
051:            protected static final String DOWNLOAD_STATUS_MODE = "downloadStatus";
052:            protected static final String RESULTS_MODE = "results";
053:            protected static final String CONFIGURE_EXPORT_MODE = "configure";
054:            protected static final String CONFIRM_EXPORT_MODE = "confirm";
055:            protected static final String UPDATE_REPOS_MODE = "updateList";
056:            protected static final String ASSEMBLY_CONFIRM_MODE = "assemblyConfirm";
057:            protected static final String LIST_SERVER_MODE = "listServer";
058:            protected static final String ASSEMBLY_VIEW_MODE = "assemblyView";
059:
060:            protected BaseImportExportHandler(String mode, String viewName) {
061:                super (mode, viewName);
062:            }
063:
064:            protected PluginListType getRepoPluginList(PortletRequest request,
065:                    PluginInstaller pluginInstaller, String repo, String user,
066:                    String pass) throws IOException, PortletException {
067:                PortletSession session = request.getPortletSession(true);
068:                PluginListType list = (PluginListType) session
069:                        .getAttribute(CONFIG_LIST_SESSION_KEY);
070:                String listRepo = (String) session
071:                        .getAttribute(CONFIG_LIST_REPO_SESSION_KEY);
072:
073:                if (list == null || !repo.equals(listRepo)) {
074:                    try {
075:                        list = pluginInstaller.listPlugins(new URL(repo), user,
076:                                pass);
077:                    } catch (FailedLoginException e) {
078:                        throw new PortletException(
079:                                "Invalid login for repository '" + repo + "'",
080:                                e);
081:                    }
082:                    session.setAttribute(CONFIG_LIST_SESSION_KEY, list);
083:                    session.setAttribute(CONFIG_LIST_REPO_SESSION_KEY, repo);
084:                }
085:                return list;
086:            }
087:
088:            protected PluginListType getServerPluginList(
089:                    PortletRequest request, PluginInstaller pluginInstaller)
090:                    throws PortletException {
091:                PluginListType data = (PluginListType) request
092:                        .getPortletSession(true).getAttribute(
093:                                SERVER_CONFIG_LIST_SESSION_KEY);
094:                if (data == null) {
095:                    try {
096:                        data = pluginInstaller
097:                                .createPluginListForRepositories(null);
098:                    } catch (NoSuchStoreException e) {
099:                        throw new PortletException("Server in unknown state", e);
100:                    }
101:                }
102:                return data;
103:            }
104:
105:            protected PluginListType getPluginsFromIds(String[] configIds,
106:                    PluginListType list) throws PortletException {
107:                PluginListType installList = new PluginListType();
108:                for (String configId : configIds) {
109:                    PluginType plugin = null;
110:                    for (PluginType metadata : list.getPlugin()) {
111:                        for (PluginArtifactType testInstance : metadata
112:                                .getPluginArtifact()) {
113:                            if (PluginInstallerGBean.toArtifact(
114:                                    testInstance.getModuleId()).toString()
115:                                    .equals(configId)) {
116:                                plugin = PluginInstallerGBean.copy(metadata,
117:                                        testInstance);
118:                                installList.getPlugin().add(plugin);
119:                                break;
120:                            }
121:                        }
122:                    }
123:                    if (plugin == null) {
124:                        throw new PortletException(
125:                                "No configuration found for '" + configId + "'");
126:                    }
127:                }
128:                return installList;
129:            }
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.