You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2007/08/13 18:21:46 UTC
svn commit: r565397 [1/3] - in /geronimo/server/trunk:
applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/
applications/console/geronimo-console-standard/
applications/console/geronimo-console-standard/src/main/java/org/apache...
Author: vamsic007
Date: Mon Aug 13 09:21:44 2007
New Revision: 565397
URL: http://svn.apache.org/viewvc?view=rev&rev=565397
Log:
GERONIMO-3254 Admin Console Wizard to auto generate geronimo-web.xml
and dependencies GERONIMO-3394, GERONIMO-3395, GERONIMO-3396, GERONIMO-3397, GERONIMO-3398
o First commit of "Create Plan" portlet code.
o Thanks to Shiva Kumar H R for this work.
Added:
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/AbstractHandler.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/CreatePlanPortlet.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DependenciesHandler.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DeployStatusHandler.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DisplayPlanHandler.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/EnvironmentHandler.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/GetArchiveHandler.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR77_Util.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR88_Util.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/ReferencesHandler.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/SecurityHandler.java (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configcreator/
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configcreator/dependencies.jsp (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configcreator/deployStatus.jsp (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configcreator/displayPlan.jsp (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configcreator/environment.jsp (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configcreator/getArchive.jsp (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configcreator/references.jsp (with props)
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configcreator/security.jsp (with props)
geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/jsr88/MessageDestination.java (with props)
Modified:
geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/pageregistry.xml
geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/portletentityregistry.xml
geronimo/server/trunk/applications/console/geronimo-console-standard/pom.xml
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/jmsmanager/wizard/AbstractHandler.java
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/util/PortletManager.java
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/portlet.xml
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/web.xml
geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
geronimo/server/trunk/modules/geronimo-test-ddbean/src/main/java/org/apache/geronimo/deployment/tools/loader/WebDeployable.java
geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web/deployment/WebAppDConfigBean.java
geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
Modified: geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/pageregistry.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/pageregistry.xml?view=diff&rev=565397&r1=565396&r2=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/pageregistry.xml (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/pageregistry.xml Mon Aug 13 09:21:44 2007
@@ -374,6 +374,21 @@
</fragment>
</fragment>
+ <fragment name="create" type="page">
+ <navigation>
+ <title>Create Plan</title>
+ <description>ico_list_16x16.gif Create Geronimo deployment plan for your Application</description>
+ </navigation>
+
+ <fragment name="row1" type="row">
+ <fragment name="col1" type="column">
+ <fragment name="p1" type="portlet">
+ <property name="portlet" value="5.82"/>
+ </fragment>
+ </fragment>
+ </fragment>
+ </fragment>
+
<fragment name="ear" type="page">
<navigation>
<title>Application EARs</title>
Modified: geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/portletentityregistry.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/portletentityregistry.xml?view=diff&rev=565397&r1=565396&r2=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/portletentityregistry.xml (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-framework/src/main/webapp/WEB-INF/data/portletentityregistry.xml Mon Aug 13 09:21:44 2007
@@ -171,5 +171,8 @@
<portlet id="81">
<definition-id>console-standard.CertificationAuthority</definition-id>
</portlet>
+ <portlet id="82">
+ <definition-id>console-standard.CreatePlan</definition-id>
+ </portlet>
</application>
</portlet-entity-registry>
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/pom.xml?view=diff&rev=565397&r1=565396&r2=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/pom.xml (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/pom.xml Mon Aug 13 09:21:44 2007
@@ -135,6 +135,14 @@
<scope>provided</scope>
</dependency>
+ <!-- Required by Create Plan Portlet-->
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-web-2.5-builder</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
<build>
Added: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/AbstractHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/AbstractHandler.java?view=auto&rev=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/AbstractHandler.java (added)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/AbstractHandler.java Mon Aug 13 09:21:44 2007
@@ -0,0 +1,495 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.console.configcreator;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageAbstractHandler;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.deployment.xbeans.PatternType;
+import org.apache.geronimo.xbeans.geronimo.security.GerDistinguishedNameType;
+import org.apache.geronimo.xbeans.geronimo.security.GerLoginDomainPrincipalType;
+import org.apache.geronimo.xbeans.geronimo.security.GerPrincipalType;
+import org.apache.geronimo.xbeans.geronimo.security.GerRealmPrincipalType;
+import org.apache.geronimo.xbeans.geronimo.security.GerRoleType;
+import org.apache.geronimo.xbeans.geronimo.security.GerSecurityType;
+import org.apache.geronimo.xbeans.geronimo.security.GerSubjectInfoType;
+import org.apache.xmlbeans.XmlException;
+
+/**
+ * Base class for portlet helpers
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractHandler extends MultiPageAbstractHandler {
+ private final static Log log = LogFactory.getLog(AbstractHandler.class);
+
+ protected final static String GET_ARCHIVE_MODE = "index";
+ // 'mode' of initial portlet must be one of "index" or "list"
+
+ protected final static String ENVIRONMENT_MODE = "environment";
+
+ protected final static String REFERENCES_MODE = "references";
+
+ protected final static String SECURITY_MODE = "security";
+
+ protected final static String DEPENDENCIES_MODE = "dependencies";
+
+ protected final static String DISPLAY_PLAN_MODE = "displayPlan";
+
+ protected final static String DEPLOY_STATUS_MODE = "deployStatus";
+
+ protected final static String WAR_CONFIG_DATA_ID = "org.apache.geronimo.configcreator.warConfigData";
+
+ protected final static String DATA_PARAMETER = "data";
+
+ protected final static String MODULE_URI_PARAMETER = "moduleURI";
+
+ protected final static String UPLOADED_WAR_URI_PARAMETER = "uploadedWarUri";
+
+ protected final static String DEPLOYMENT_PLAN_PARAMETER = "deploymentPlan";
+
+ protected final static String CONTEXT_ROOT_PARAMETER = "contextRoot";
+
+ protected final static String ARTIFACT_ID_PARAMETER = "artifactId";
+
+ protected final static String GROUP_ID_PARAMETER = "groupId";
+
+ protected final static String VERSION_PARAMETER = "version";
+
+ protected final static String TYPE_PARAMETER = "type";
+
+ protected final static String HIDDEN_CLASSES_PARAMETER = "hiddenClasses";
+
+ protected final static String NON_OVERRIDABLE_CLASSES_PARAMETER = "nonOverridableClasses";
+
+ protected final static String INVERSE_CLASSLOADING_PARAMETER = "inverseClassLoading";
+
+ protected final static String EJB_REF_PREFIX = "ejbRef";
+
+ protected final static String EJB_LOCAL_REF_PREFIX = "ejbLocalRef";
+
+ protected final static String JMS_CONNECTION_FACTORY_REF_PREFIX = "jmsConnectionFactoryRef";
+
+ protected final static String JMS_DESTINATION_REF_PREFIX = "jmsDestinationRef";
+
+ protected final static String MESSAGE_DESTINATION_PREFIX = "messageDestination";
+
+ protected final static String JDBC_POOL_REF_PREFIX = "jdbcPoolRef";
+
+ protected final static String REF_NAME = "refName";
+
+ protected final static String REF_LINK = "refLink";
+
+ protected final static String DEPENDENCY_PREFIX = "dependency";
+
+ protected final static String ARCHIVE_NOT_SUPPORTED_PARAMETER = "archiveNotSupported";
+
+ protected final static String REFERENCE_NOT_RESOLVED_PARAMETER = "referenceNotResolved";
+
+ protected final static String DEPLOYED_EJBS_PARAMETER = "deployedEjbs";
+
+ protected final static String DEPLOYED_JDBC_CONNECTION_POOLS_PARAMETER = "deployedJdbcConnectionPools";
+
+ protected final static String DEPLOYED_JMS_CONNECTION_FACTORIES_PARAMETER = "deployedJmsConnectionFactories";
+
+ protected final static String DEPLOYED_JMS_DESTINATIONS_PARAMETER = "deployedJmsDestinations";
+
+ protected final static String DEPLOYED_SECURITY_REALMS_PARAMETER = "deployedSecurityRealms";
+
+ protected final static String COMMON_LIBS_PARAMETER = "commonLibs";
+
+ protected final static String SELECTED_LIBS_PARAMETER = "selectedLibs";
+
+ protected final static String DEPLOY_ABBR_STATUS_PARAMETER = "abbrStatusMessage";
+
+ protected final static String DEPLOY_FULL_STATUS_PARAMETER = "fullStatusMessage";
+
+ public AbstractHandler(String mode, String viewName) {
+ super(mode, viewName);
+ }
+
+ public static class WARConfigModel implements MultiPageModel {
+ public WARConfigModel(PortletRequest request) {
+ }
+
+ public void save(ActionResponse response, PortletSession session) {
+ }
+ }
+
+ public WARConfigData getSessionData(PortletRequest request) {
+ return (WARConfigData) request.getPortletSession().getAttribute(WAR_CONFIG_DATA_ID);
+ }
+
+ public void setNewSessionData(PortletRequest request) {
+ request.getPortletSession().setAttribute(WAR_CONFIG_DATA_ID, new WARConfigData());
+ }
+
+ public static class WARConfigData {
+ private String uploadedWarUri;
+
+ private String deploymentPlan;
+
+ private String contextRoot;
+
+ private String artifactId;
+
+ private String groupId;
+
+ private String version;
+
+ private String type;
+
+ private String hiddenClasses;
+
+ private String nonOverridableClasses;
+
+ private boolean inverseClassLoading;
+
+ private List ejbRefs = new ArrayList();
+
+ private List ejbLocalRefs = new ArrayList();
+
+ private List jdbcPoolRefs = new ArrayList();
+
+ private List jmsConnectionFactoryRefs = new ArrayList();
+
+ private List jmsDestinationRefs = new ArrayList();
+
+ private List messageDestinations = new ArrayList();
+
+ private List dependencies = new ArrayList();
+
+ private boolean referenceNotResolved;
+
+ private String securityRealmName;
+
+ private GerSecurityType security = null;
+
+ public WARConfigData() {
+ }
+
+ public void readEnvironmentData(PortletRequest request) {
+ contextRoot = request.getParameter(CONTEXT_ROOT_PARAMETER);
+ artifactId = request.getParameter(ARTIFACT_ID_PARAMETER);
+ groupId = request.getParameter(GROUP_ID_PARAMETER);
+ version = request.getParameter(VERSION_PARAMETER);
+ type = request.getParameter(TYPE_PARAMETER);
+ hiddenClasses = request.getParameter(HIDDEN_CLASSES_PARAMETER);
+ nonOverridableClasses = request.getParameter(NON_OVERRIDABLE_CLASSES_PARAMETER);
+ inverseClassLoading = "true".equalsIgnoreCase(request
+ .getParameter(INVERSE_CLASSLOADING_PARAMETER)) ? true : false;
+ }
+
+ public void readReferencesData(PortletRequest request) {
+ readParameters(EJB_REF_PREFIX, ejbRefs, request);
+ readParameters(EJB_LOCAL_REF_PREFIX, ejbLocalRefs, request);
+ readParameters(JMS_CONNECTION_FACTORY_REF_PREFIX, jmsConnectionFactoryRefs, request);
+ readParameters(JMS_DESTINATION_REF_PREFIX, jmsDestinationRefs, request);
+ readParameters(MESSAGE_DESTINATION_PREFIX, messageDestinations, request);
+ readParameters(JDBC_POOL_REF_PREFIX, jdbcPoolRefs, request);
+ }
+
+ private void readParameters(String prefix1, List list, PortletRequest request) {
+ list.clear();
+ Map map = request.getParameterMap();
+ int index = 0;
+ while (true) {
+ String prefix2 = prefix1 + "." + (index++) + ".";
+ if (!map.containsKey(prefix2 + REF_NAME)) {
+ break;
+ }
+ ReferenceData data = new ReferenceData();
+ data.load(request, prefix2);
+ list.add(data);
+ }
+ }
+
+ public void readSecurityData(PortletRequest request) {
+ securityRealmName = request.getParameter("securityRealmName");
+ readSecurityParameters(request);
+ }
+
+ private void readSecurityParameters(PortletRequest request) {
+ Map map = request.getParameterMap();
+ GerRoleType[] roles = security.getRoleMappings().getRoleArray();
+ for (int index = 0; index < roles.length; index++) {
+ String prefix1 = "security.roleMappings" + "." + index + ".";
+ GerRoleType role = roles[index];
+
+ int lastIndex = Integer.parseInt(request.getParameter(prefix1 + "principal.lastIndex"));
+ for (int i = 0; i < lastIndex; i++) {
+ String prefix2 = prefix1 + "principal" + "." + i + ".";
+ if (!map.containsKey(prefix2 + "name")) {
+ continue;
+ }
+ GerPrincipalType principal = role.addNewPrincipal();
+ principal.setName(request.getParameter(prefix2 + "name"));
+ principal.setClass1(request.getParameter(prefix2 + "class"));
+ }
+
+ lastIndex = Integer.parseInt(request.getParameter(prefix1 + "loginDomainPrincipal.lastIndex"));
+ for (int i = 0; i < lastIndex; i++) {
+ String prefix2 = prefix1 + "loginDomainPrincipal" + "." + i + ".";
+ if (!map.containsKey(prefix2 + "name")) {
+ continue;
+ }
+ GerLoginDomainPrincipalType loginDomainPrincipal = role.addNewLoginDomainPrincipal();
+ loginDomainPrincipal.setName(request.getParameter(prefix2 + "name"));
+ loginDomainPrincipal.setClass1(request.getParameter(prefix2 + "class"));
+ loginDomainPrincipal.setDomainName(request.getParameter(prefix2 + "domainName"));
+ }
+
+ lastIndex = Integer.parseInt(request.getParameter(prefix1 + "realmPrincipal.lastIndex"));
+ for (int i = 0; i < lastIndex; i++) {
+ String prefix2 = prefix1 + "realmPrincipal" + "." + i + ".";
+ if (!map.containsKey(prefix2 + "name")) {
+ continue;
+ }
+ GerRealmPrincipalType realmPrincipal = role.addNewRealmPrincipal();
+ realmPrincipal.setName(request.getParameter(prefix2 + "name"));
+ realmPrincipal.setClass1(request.getParameter(prefix2 + "class"));
+ realmPrincipal.setDomainName(request.getParameter(prefix2 + "domainName"));
+ realmPrincipal.setRealmName(request.getParameter(prefix2 + "realmName"));
+ }
+
+ lastIndex = Integer.parseInt(request.getParameter(prefix1 + "distinguishedName.lastIndex"));
+ for (int i = 0; i < lastIndex; i++) {
+ String prefix2 = prefix1 + "distinguishedName" + "." + i + ".";
+ if (!map.containsKey(prefix2 + "name")) {
+ continue;
+ }
+ GerDistinguishedNameType distinguishedName = role.addNewDistinguishedName();
+ distinguishedName.setName(request.getParameter(prefix2 + "name"));
+ }
+
+ String prefix2 = prefix1 + "runAsSubject" + ".";
+ if (map.containsKey(prefix2 + "realm")) {
+ GerSubjectInfoType runAsSubject = role.addNewRunAsSubject();
+ runAsSubject.setRealm(request.getParameter(prefix2 + "realm"));
+ runAsSubject.setId(request.getParameter(prefix2 + "id"));
+ }
+ }
+ String prefix = "security" + "." + "defaultSubject" + ".";
+ if (map.containsKey(prefix + "realm")) {
+ GerSubjectInfoType runAsSubject = security.addNewDefaultSubject();
+ runAsSubject.setRealm(request.getParameter(prefix + "realm"));
+ runAsSubject.setId(request.getParameter(prefix + "id"));
+ }
+ String parameterName = "security" + "." + "credentialStoreRef";
+ if (map.containsKey(parameterName)) {
+ try {
+ PatternType pattern = PatternType.Factory.parse(request.getParameter(parameterName));
+ security.setCredentialStoreRef(pattern);
+ } catch (XmlException e) {
+ e.printStackTrace();
+ }
+ }
+ parameterName = "security" + "." + "doasCurrentCaller";
+ if ("true".equalsIgnoreCase(request.getParameter(parameterName))) {
+ security.setDoasCurrentCaller(true);
+ }
+ parameterName = "security" + "." + "useContextHandler";
+ if ("true".equalsIgnoreCase(request.getParameter(parameterName))) {
+ security.setUseContextHandler(true);
+ }
+ parameterName = "security" + "." + "defaultRole";
+ security.setDefaultRole(request.getParameter(parameterName));
+ }
+
+ public String getContextRoot() {
+ return contextRoot;
+ }
+
+ public void setContextRoot(String contextRoot) {
+ this.contextRoot = contextRoot;
+ }
+
+ public String getArtifactId() {
+ return artifactId;
+ }
+
+ public void setArtifactId(String artifactId) {
+ this.artifactId = artifactId;
+ }
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getHiddenClasses() {
+ return hiddenClasses;
+ }
+
+ public void setHiddenClasses(String hiddenClasses) {
+ this.hiddenClasses = hiddenClasses;
+ }
+
+ public String getNonOverridableClasses() {
+ return nonOverridableClasses;
+ }
+
+ public void setNonOverridableClasses(String nonOverridableClasses) {
+ this.nonOverridableClasses = nonOverridableClasses;
+ }
+
+ public boolean isInverseClassLoading() {
+ return inverseClassLoading;
+ }
+
+ public void setInverseClassLoading(boolean inverseClassLoading) {
+ this.inverseClassLoading = inverseClassLoading;
+ }
+
+ public List getDependencies() {
+ return dependencies;
+ }
+
+ public List getEjbLocalRefs() {
+ return ejbLocalRefs;
+ }
+
+ public List getEjbRefs() {
+ return ejbRefs;
+ }
+
+ public List getJdbcPoolRefs() {
+ return jdbcPoolRefs;
+ }
+
+ public List getJmsConnectionFactoryRefs() {
+ return jmsConnectionFactoryRefs;
+ }
+
+ public List getJmsDestinationRefs() {
+ return jmsDestinationRefs;
+ }
+
+ public List getMessageDestinations() {
+ return messageDestinations;
+ }
+
+ public boolean isReferenceNotResolved() {
+ return referenceNotResolved;
+ }
+
+ public void setReferenceNotResolved(boolean referenceNotResolved) {
+ this.referenceNotResolved = referenceNotResolved;
+ }
+
+ public String getUploadedWarUri() {
+ return uploadedWarUri;
+ }
+
+ public void setUploadedWarUri(String uploadedWarUri) {
+ this.uploadedWarUri = uploadedWarUri;
+ }
+
+ public String getDeploymentPlan() {
+ return deploymentPlan;
+ }
+
+ public void setDeploymentPlan(String deploymentPlan) {
+ this.deploymentPlan = deploymentPlan;
+ }
+
+ public String getSecurityRealmName() {
+ return securityRealmName;
+ }
+
+ public void setSecurityRealmName(String securityRealmName) {
+ this.securityRealmName = securityRealmName;
+ }
+
+ public GerSecurityType getSecurity() {
+ return security;
+ }
+
+ public void setSecurity(GerSecurityType security) {
+ this.security = security;
+ }
+ }
+
+ public static class ReferenceData {
+ private String refName;
+
+ private String refLink;
+
+ public ReferenceData() {
+ }
+
+ public ReferenceData(String refName) {
+ this.refName = refName;
+ }
+
+ public void load(PortletRequest request, String prefix) {
+ refName = request.getParameter(prefix + REF_NAME);
+ refLink = request.getParameter(prefix + REF_LINK);
+ }
+
+ public void save(ActionResponse response, String prefix) {
+ if (!isEmpty(refName))
+ response.setRenderParameter(prefix + REF_NAME, refName);
+ if (!isEmpty(refLink))
+ response.setRenderParameter(prefix + REF_LINK, refLink);
+ }
+
+ public String getRefName() {
+ return refName;
+ }
+
+ public void setRefName(String refName) {
+ this.refName = refName;
+ }
+
+ public String getRefLink() {
+ return refLink;
+ }
+
+ public void setRefLink(String refLink) {
+ this.refLink = refLink;
+ }
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/AbstractHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/AbstractHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/AbstractHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/CreatePlanPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/CreatePlanPortlet.java?view=auto&rev=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/CreatePlanPortlet.java (added)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/CreatePlanPortlet.java Mon Aug 13 09:21:44 2007
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.console.configcreator;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.console.MultiPagePortlet;
+
+/**
+ * A portlet for Create Deployment Plan Portlet.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CreatePlanPortlet extends MultiPagePortlet {
+ public void init(PortletConfig config) throws PortletException {
+ super.init(config);
+ addHelper(new GetArchiveHandler(), config);
+ addHelper(new EnvironmentHandler(), config);
+ addHelper(new ReferencesHandler(), config);
+ addHelper(new SecurityHandler(), config);
+ addHelper(new DependenciesHandler(), config);
+ addHelper(new DisplayPlanHandler(), config);
+ addHelper(new DeployStatusHandler(), config);
+ }
+
+ protected String getModelJSPVariableName() {
+ return "model";
+ }
+
+ protected MultiPageModel getModel(PortletRequest request) {
+ return new AbstractHandler.WARConfigModel(request);
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/CreatePlanPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/CreatePlanPortlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/CreatePlanPortlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DependenciesHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DependenciesHandler.java?view=auto&rev=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DependenciesHandler.java (added)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DependenciesHandler.java Mon Aug 13 09:21:44 2007
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.console.configcreator;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * A handler for ...
+ *
+ * @version $Rev$ $Date$
+ */
+public class DependenciesHandler extends AbstractHandler {
+ private static final Log log = LogFactory.getLog(DependenciesHandler.class);
+
+ public DependenciesHandler() {
+ super(DEPENDENCIES_MODE, "/WEB-INF/view/configcreator/dependencies.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ WARConfigData data = getSessionData(request);
+ request.setAttribute(DATA_PARAMETER, data);
+ List commonLibs = JSR77_Util.getCommonLibs(request);
+ List addedDependencies = data.getDependencies();
+ //addedDependencies will be a subset of commonLibs
+ //sort commonLibs so that addedDependencies show up towards the beginning
+ commonLibs.removeAll(addedDependencies);
+ Collections.sort(commonLibs);
+ Collections.sort(addedDependencies);
+ commonLibs.addAll(0, addedDependencies);
+ request.setAttribute(COMMON_LIBS_PARAMETER, commonLibs);
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ WARConfigData data = getSessionData(request);
+ data.getDependencies().clear();
+ String[] selectedJars = request.getParameterValues(SELECTED_LIBS_PARAMETER);
+ for (int i = 0; selectedJars != null && i < selectedJars.length; i++) {
+ data.getDependencies().add(selectedJars[i]);
+ }
+ return DISPLAY_PLAN_MODE + "-before";
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DependenciesHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DependenciesHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DependenciesHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DeployStatusHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DeployStatusHandler.java?view=auto&rev=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DeployStatusHandler.java (added)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DeployStatusHandler.java Mon Aug 13 09:21:44 2007
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.console.configcreator;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * A handler for ...
+ *
+ * @version $Rev$ $Date$
+ */
+public class DeployStatusHandler extends AbstractHandler {
+ private static final Log log = LogFactory.getLog(DisplayPlanHandler.class);
+
+ public DeployStatusHandler() {
+ super(DEPLOY_STATUS_MODE, "/WEB-INF/view/configcreator/deployStatus.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ WARConfigData data = getSessionData(request);
+ try {
+ File moduleFile = new File(new URI(data.getUploadedWarUri()));
+
+ File planFile = File.createTempFile("console-deployment", ".xml");
+ planFile.deleteOnExit();
+ FileWriter out = new FileWriter(planFile);
+ out.write(data.getDeploymentPlan());
+ out.close();
+
+ String[] status = JSR88_Util.deploy(request, moduleFile, planFile);
+ request.setAttribute(DEPLOY_ABBR_STATUS_PARAMETER, status[0]);
+ request.setAttribute(DEPLOY_FULL_STATUS_PARAMETER, status[1]);
+ } catch (URISyntaxException e) {
+ log.error(e.getMessage(), e);
+ }
+ request.setAttribute(DATA_PARAMETER, data);
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ return "";
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DeployStatusHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DeployStatusHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DeployStatusHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DisplayPlanHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DisplayPlanHandler.java?view=auto&rev=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DisplayPlanHandler.java (added)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DisplayPlanHandler.java Mon Aug 13 09:21:44 2007
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.console.configcreator;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.enterprise.deploy.model.exceptions.DDBeanCreateException;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * A handler for ...
+ *
+ * @version $Rev$ $Date$
+ */
+public class DisplayPlanHandler extends AbstractHandler {
+ private static final Log log = LogFactory.getLog(DisplayPlanHandler.class);
+
+ public DisplayPlanHandler() {
+ super(DISPLAY_PLAN_MODE, "/WEB-INF/view/configcreator/displayPlan.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ WARConfigData data = getSessionData(request);
+ try {
+ String plan = JSR88_Util.createDeploymentPlan(request, data, new URL(data.getUploadedWarUri()));
+ data.setDeploymentPlan(plan);
+ } catch (DDBeanCreateException e) {
+ log.error(e.getMessage(), e);
+ } catch (InvalidModuleException e) {
+ log.error(e.getMessage(), e);
+ } catch (ConfigurationException e) {
+ log.error(e.getMessage(), e);
+ }
+ request.setAttribute(DATA_PARAMETER, data);
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ WARConfigData data = getSessionData(request);
+ data.setDeploymentPlan(request.getParameter(DEPLOYMENT_PLAN_PARAMETER));
+ return DEPLOY_STATUS_MODE;
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DisplayPlanHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DisplayPlanHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/DisplayPlanHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/EnvironmentHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/EnvironmentHandler.java?view=auto&rev=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/EnvironmentHandler.java (added)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/EnvironmentHandler.java Mon Aug 13 09:21:44 2007
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.console.configcreator;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * A handler for ...
+ *
+ * @version $Rev$ $Date$
+ */
+public class EnvironmentHandler extends AbstractHandler {
+ private static final Log log = LogFactory.getLog(EnvironmentHandler.class);
+
+ public EnvironmentHandler() {
+ super(ENVIRONMENT_MODE, "/WEB-INF/view/configcreator/environment.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ WARConfigData data = getSessionData(request);
+ request.setAttribute(DATA_PARAMETER, data);
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ WARConfigData data = getSessionData(request);
+ data.readEnvironmentData(request);
+ if (data.getEjbRefs().size() > 0 || data.getEjbLocalRefs().size() > 0 || data.getJdbcPoolRefs().size() > 0
+ || data.getJmsConnectionFactoryRefs().size() > 0 || data.getJmsDestinationRefs().size() > 0) {
+ return REFERENCES_MODE + "-before";
+ }
+ if (data.getSecurity() != null) {
+ return SECURITY_MODE + "-before";
+ }
+ return DEPENDENCIES_MODE + "-before";
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/EnvironmentHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/EnvironmentHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/EnvironmentHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/GetArchiveHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/GetArchiveHandler.java?view=auto&rev=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/GetArchiveHandler.java (added)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/GetArchiveHandler.java Mon Aug 13 09:21:44 2007
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.console.configcreator;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * A handler for ...
+ *
+ * @version $Rev$ $Date$
+ */
+public class GetArchiveHandler extends AbstractHandler {
+ private static final Log log = LogFactory.getLog(GetArchiveHandler.class);
+
+ public GetArchiveHandler() {
+ super(GET_ARCHIVE_MODE, "/WEB-INF/view/configcreator/getArchive.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ setNewSessionData(request);
+ if ("true".equals(request.getParameter(ARCHIVE_NOT_SUPPORTED_PARAMETER))) {
+ request.setAttribute(ARCHIVE_NOT_SUPPORTED_PARAMETER, "true");
+ }
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model)
+ throws PortletException, IOException {
+ WARConfigData data = getSessionData(request);
+ FileItem fileItem = (FileItem) getUploadFiles().get(MODULE_URI_PARAMETER);
+
+ String fileName = fileItem.getName();
+ if (fileName == null || fileName.length() <= 0) {
+ return getMode();
+ }
+
+ // TODO Is there a better way of checking whether the archive is a WAR or not?
+ int i = fileName.length() - 4;
+ if (!fileName.substring(i).equalsIgnoreCase(".war")) {
+ response.setRenderParameter(ARCHIVE_NOT_SUPPORTED_PARAMETER, "true");
+ return getMode();
+ }
+
+ File uploadedFile = uploadFile(fileItem);
+ data.setUploadedWarUri(uploadedFile.toURI().toString());
+
+ String str = getBasename(fileItem.getName().trim());
+ String warName = str.substring(0, str.length() - 4);
+ data.setContextRoot(warName);
+ data.setGroupId("default");
+ data.setArtifactId(warName);
+ data.setVersion("1.0");
+ data.setType("war");
+ data.setHiddenClasses("");
+ data.setNonOverridableClasses("");
+ data.setInverseClassLoading(false);
+
+ try {
+ JSR88_Util.parseWarReferences(request, data, uploadedFile.toURL());
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ return getMode();
+ }
+
+ return ENVIRONMENT_MODE + "-before";
+ }
+
+ private File uploadFile(FileItem fileItem) throws PortletException, IOException {
+ File tempDir = File.createTempFile("geronimo-planCreator", ".tmpdir");
+ tempDir.delete();
+ tempDir.mkdir();
+ tempDir.deleteOnExit();
+ String fileName = getBasename(fileItem.getName().trim());
+ File file = new File(tempDir, fileName);
+ file.deleteOnExit();
+ try {
+ fileItem.write(file);
+ } catch (Exception e) {
+ throw new PortletException(e);
+ }
+ return file;
+ }
+
+ private String getBasename(String fileName) {
+ // Firefox sends basename, IE sends full path
+ int index = fileName.lastIndexOf('\\');
+ if (index != -1) {
+ return fileName.substring(index + 1);
+ }
+ return fileName;
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/GetArchiveHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/GetArchiveHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/GetArchiveHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR77_Util.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR77_Util.java?view=auto&rev=565397
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR77_Util.java (added)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR77_Util.java Mon Aug 13 09:21:44 2007
@@ -0,0 +1,216 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.console.configcreator;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.SortedSet;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.portlet.PortletRequest;
+
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.repository.ListableRepository;
+import org.apache.geronimo.management.EJBModule;
+import org.apache.geronimo.management.geronimo.JCAAdminObject;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
+import org.apache.geronimo.management.geronimo.SecurityRealm;
+
+/**
+ * Util class for JSR-77 related functions
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSR77_Util {
+
+ public static class ReferredData {
+ private String displayName;
+
+ private String patternName;
+
+ public ReferredData(String displayName, String patternName) {
+ this.displayName = displayName;
+ this.patternName = patternName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getPatternName() {
+ return patternName;
+ }
+
+ public void setPatternName(String patternName) {
+ this.patternName = patternName;
+ }
+ }
+
+ protected static List getDeployedEJBs(PortletRequest request) {
+ List ejbList = new ArrayList();
+ EJBModule[] ejbModules = PortletManager.getManagementHelper(request).getEJBModules(
+ PortletManager.getCurrentServer(request));
+ for (int i = 0; ejbModules != null && i < ejbModules.length; i++) {
+ String[] ejbObjectNames = ejbModules[i].getEjbs();
+ for (int j = 0; j < ejbObjectNames.length; j++) {
+ try {
+ ObjectName objectName = ObjectName.getInstance(ejbObjectNames[j]);
+ String ejbName = objectName.getKeyProperty(NameFactory.J2EE_NAME);
+ String configurationName;
+ if ("null".equalsIgnoreCase(objectName.getKeyProperty(NameFactory.J2EE_APPLICATION))) {
+ configurationName = objectName.getKeyProperty(NameFactory.EJB_MODULE) + "/";
+ } else {
+ configurationName = objectName.getKeyProperty(NameFactory.J2EE_APPLICATION) + "/"
+ + objectName.getKeyProperty(NameFactory.EJB_MODULE);
+ }
+ ReferredData data = new ReferredData(ejbName + " (" + configurationName + ")",
+ configurationName + "/" + ejbName);
+ ejbList.add(data);
+ } catch (MalformedObjectNameException e) {
+ // log.error(e.getMessage(), e);
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ // log.error(e.getMessage(), e);
+ e.printStackTrace();
+ }
+ }
+ }
+ return ejbList;
+ }
+
+ protected static List getJMSConnectionFactories(PortletRequest request) {
+ // TODO this is a duplicate of the code from
+ // org.apache.geronimo.console.jmsmanager.wizard.ListScreenHandler.populateExistingList()
+ // TODO need to eliminate this duplicate code probably by putting it in a common place
+ List connectionFactories = new ArrayList();
+
+ // Get the list of connection factories
+ ResourceAdapterModule[] modules = PortletManager.getOutboundRAModules(request, new String[] {
+ "javax.jms.ConnectionFactory", "javax.jms.QueueConnectionFactory",
+ "javax.jms.TopicConnectionFactory", });
+ try {
+ for (int i = 0; i < modules.length; i++) {
+ ResourceAdapterModule module = modules[i];
+ String configurationName = PortletManager.getConfigurationFor(request,
+ PortletManager.getNameFor(request, module)).toString()
+ + "/";
+
+ JCAManagedConnectionFactory[] factories = PortletManager.getOutboundFactoriesForRA(request,
+ module, new String[] { "javax.jms.ConnectionFactory", "javax.jms.QueueConnectionFactory",
+ "javax.jms.TopicConnectionFactory", });
+ for (int j = 0; j < factories.length; j++) {
+ JCAManagedConnectionFactory factory = factories[j];
+ String factoryName = ObjectName.getInstance(factory.getObjectName()).getKeyProperty(
+ NameFactory.J2EE_NAME);
+ ReferredData data = new ReferredData(factoryName + " (" + configurationName + ")",
+ configurationName + "/" + factoryName);
+ connectionFactories.add(data);
+ }
+ }
+ } catch (MalformedObjectNameException e) {
+ // log.error(e.getMessage(), e);
+ }
+ return connectionFactories;
+ }
+
+ protected static List getJMSDestinations(PortletRequest request) {
+ // TODO this is a duplicate of the code from
+ // org.apache.geronimo.console.jmsmanager.wizard.ListScreenHandler.populateExistingList()
+ // TODO need to eliminate this duplicate code probably by putting it in a common place
+ List jmsDestinations = new ArrayList();
+
+ // Get the list of connection factories
+ ResourceAdapterModule[] modules = PortletManager.getOutboundRAModules(request, new String[] {
+ "javax.jms.ConnectionFactory", "javax.jms.QueueConnectionFactory",
+ "javax.jms.TopicConnectionFactory", });
+ try {
+ for (int i = 0; i < modules.length; i++) {
+ ResourceAdapterModule module = modules[i];
+ String configurationName = PortletManager.getConfigurationFor(request,
+ PortletManager.getNameFor(request, module)).toString()
+ + "/";
+
+ JCAAdminObject[] admins = PortletManager.getAdminObjectsForRA(request, module, new String[] {
+ "javax.jms.Queue", "javax.jms.Topic" });
+ for (int j = 0; j < admins.length; j++) {
+ JCAAdminObject admin = admins[j];
+ String destinationName = ObjectName.getInstance(admin.getObjectName()).getKeyProperty(
+ NameFactory.J2EE_NAME);
+ ReferredData data = new ReferredData(destinationName + " (" + configurationName + ")",
+ configurationName + "/" + destinationName);
+ jmsDestinations.add(data);
+ }
+ }
+ } catch (MalformedObjectNameException e) {
+ // log.error(e.getMessage(), e);
+ }
+ return jmsDestinations;
+ }
+
+ protected static List getJDBCConnectionPools(PortletRequest request) {
+ // TODO this is a duplicate of the code from
+ // org.apache.geronimo.console.databasemanager.wizard.DatabasePoolPortlet.populatePoolList()
+ // TODO need to eliminate this duplicate code probably by putting it in a common place
+ List list = new ArrayList();
+ ResourceAdapterModule[] modules = PortletManager.getOutboundRAModules(request, "javax.sql.DataSource");
+ for (int i = 0; i < modules.length; i++) {
+ ResourceAdapterModule module = modules[i];
+ JCAManagedConnectionFactory[] databases = PortletManager.getOutboundFactoriesForRA(request, module,
+ "javax.sql.DataSource");
+ for (int j = 0; j < databases.length; j++) {
+ JCAManagedConnectionFactory db = databases[j];
+ AbstractName dbName = PortletManager.getManagementHelper(request).getNameFor(db);
+ String poolName = (String) dbName.getName().get(NameFactory.J2EE_NAME);
+ String configurationName = dbName.getArtifact().toString() + "/";
+ ReferredData data = new ReferredData(poolName + " (" + configurationName + ")", configurationName
+ + "/" + poolName);
+ list.add(data);
+ }
+ }
+ return list;
+ }
+
+ protected static List getCommonLibs(PortletRequest request) {
+ // TODO this is a duplicate of the code from
+ // org.apache.geronimo.console.repository.RepositoryViewPortlet.doView()
+ // TODO need to eliminate this duplicate code probably by putting it in a common place
+ List list = new ArrayList();
+ ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();
+ for (int i = 0; i < repos.length; i++) {
+ ListableRepository repo = repos[i];
+ final SortedSet artifacts = repo.list();
+ for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
+ String fileName = iterator.next().toString();
+ list.add(fileName);
+ }
+ }
+ return list;
+ }
+
+ public static SecurityRealm[] getDeployedSecurityRealms(PortletRequest request) {
+ return PortletManager.getCurrentServer(request).getSecurityRealms();
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR77_Util.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR77_Util.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configcreator/JSR77_Util.java
------------------------------------------------------------------------------
svn:mime-type = text/plain