Author: ips
Date: 2008-11-04 10:53:35 -0500 (Tue, 04 Nov 2008)
New Revision: 31
Added:
trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/CreateContentBackedResourceAction.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java
trunk/core/src/main/java/org/jboss/on/embedded/util/
trunk/core/src/main/java/org/jboss/on/embedded/util/ContentUtility.java
Removed:
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/ResourceTypeContentAction.java
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
trunk/core/src/main/java/org/jboss/on/embedded/bean/history/content/ContentServerServiceImpl.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java
trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
trunk/core/src/main/webapp/WEB-INF/pages.xml
trunk/core/src/main/webapp/error.xhtml
trunk/core/src/main/webapp/include/tabMenu.xhtml
trunk/core/src/main/webapp/layout.xhtml
trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml
trunk/core/src/main/webapp/secure/resourceInstanceContent.xhtml
trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml
Log:
add support for EAR/WAR update via the Content tab
(
https://jira.jboss.org/jira/browse/EMBJOPR-22)
Modified: trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java 2008-10-31
13:53:01 UTC (rev 30)
+++ trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -117,6 +117,8 @@
configureMockScenarioLoader();
pluginContainer.initialize();
logLoadedPlugins(pluginContainer);
+ // Add our inventory listener BEFORE initiating Resource discovery.
+ pluginContainer.getInventoryManager().addInventoryEventListener(new
EmbeddedInventoryEventListener());
ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
resourceManager.discoverResources();
LOG.info("Done bootstrapping Administration Console.");
Added: trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java
(rev 0)
+++
trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -0,0 +1,95 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.jboss.on.embedded;
+
+import java.util.Set;
+
+import org.jetbrains.annotations.Nullable;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.pc.inventory.InventoryEventListener;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.ResourceCreationDataType;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.clientapi.agent.PluginContainerException;
+
+/**
+ * @author Ian Springer
+ */
+public class EmbeddedInventoryEventListener implements InventoryEventListener
+{
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ public void resourcesAdded(Set<Resource> resources)
+ {
+ for (Resource resource : resources)
+ {
+ ResourceType resourceType = resource.getResourceType();
+ if (isContentBacked(resourceType))
+ {
+ PackageType creationPackageType = getCreationPackageType(resourceType);
+ if (creationPackageType != null)
+ {
+ try
+ {
+
PluginContainer.getInstance().getContentManager().executeResourcePackageDiscoveryImmediately(
+ resource.getId(), creationPackageType.getName());
+ }
+ catch (PluginContainerException e)
+ {
+ log.error("Failed to discover underlying " +
creationPackageType.getName() + " package for "
+ + resourceType.getName() + " Resource.", e);
+ }
+ }
+ }
+ }
+ }
+
+ public void resourcesRemoved(Set<Resource> resources)
+ {
+ return;
+ }
+
+ public void resourceActivated(Resource resource)
+ {
+ return;
+ }
+
+ private static boolean isContentBacked(ResourceType resourceType)
+ {
+ return resourceType.isCreatable() && resourceType.getCreationDataType()
== ResourceCreationDataType.CONTENT;
+ }
+
+ @Nullable
+ private static PackageType getCreationPackageType(ResourceType resourceType)
+ {
+ Set<PackageType> packageTypes = resourceType.getPackageTypes();
+ for (PackageType packageType : packageTypes)
+ {
+ if (packageType.isCreationData())
+ {
+ return packageType;
+ }
+ }
+ return null;
+ }
+}
Property changes on:
trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Author Id Revision HeadURL
Name: svn:eol-style
+ LF
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/bean/history/content/ContentServerServiceImpl.java
===================================================================
---
trunk/core/src/main/java/org/jboss/on/embedded/bean/history/content/ContentServerServiceImpl.java 2008-10-31
13:53:01 UTC (rev 30)
+++
trunk/core/src/main/java/org/jboss/on/embedded/bean/history/content/ContentServerServiceImpl.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -44,7 +44,6 @@
public class ContentServerServiceImpl implements ContentServerService
{
-
private final Log log = LogFactory.getLog(ContentServerServiceImpl.class);
private ContentHistoryManager historyBean;
@@ -76,42 +75,12 @@
public long downloadPackageBitsForChildResource(int parentResourceId, String
resourceTypeName, PackageDetailsKey packageDetailsKey, OutputStream outputStream)
{
- log.debug("In downloadPackageBitsForChildResource()");
- long bitSize;
- String fileName = packageDetailsKey.getName();
- File file = new File(fileName);
- InputStream inputStream = null;
- try
- {
- inputStream = new BufferedInputStream(new FileInputStream(file));
- byte[] fileBytes = new byte[(int)file.length()];
- bitSize = inputStream.read(fileBytes);
- inputStream.close();
- outputStream.write(fileBytes);
- }
- catch (IOException e)
- {
- log.error("Unable to download package bits for " + resourceTypeName
+ " child Resource.", e);
- bitSize = -1;
- }
- finally
- {
- if (inputStream != null)
- try
- {
- inputStream.close();
- }
- catch (IOException e)
- {
- log.error("Failed to close input stream.", e);
- }
- }
- return bitSize;
+ return downloadPackageBits(packageDetailsKey, outputStream);
}
public long downloadPackageBitsGivenResource(int resourceId, PackageDetailsKey
packageDetailsKey, OutputStream outputStream)
{
- return 0;
+ return downloadPackageBits(packageDetailsKey, outputStream);
}
public long downloadPackageBitsRangeGivenResource(int resourceId, PackageDetailsKey
packageDetailsKey, OutputStream outputStream, long startByte, long endByte)
@@ -155,4 +124,37 @@
{
historyBean.addContentHistory(report);
}
+
+ private long downloadPackageBits(PackageDetailsKey packageDetailsKey, OutputStream
outputStream) {
+ log.debug("Downloading package bits for " + packageDetailsKey +
"...");
+ long bitSize;
+ String fileName = packageDetailsKey.getName();
+ File file = new File(fileName);
+ InputStream inputStream = null;
+ try
+ {
+ inputStream = new BufferedInputStream(new FileInputStream(file));
+ byte[] fileBytes = new byte[(int)file.length()];
+ bitSize = inputStream.read(fileBytes);
+ inputStream.close();
+ outputStream.write(fileBytes);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to download package bits for " +
"" + " child Resource.", e);
+ }
+ finally
+ {
+ if (inputStream != null)
+ try
+ {
+ inputStream.close();
+ }
+ catch (IOException e)
+ {
+ log.error("Failed to close input stream.", e);
+ }
+ }
+ return bitSize;
+ }
}
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java 2008-10-31
13:53:01 UTC (rev 30)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -34,7 +34,7 @@
*
* @author Charles Crouch
*/
-// Make this application scoped so each user doesn't trigger their own discovery
+// Make this application-scoped so each user doesn't trigger their own discovery.
@Scope(ScopeType.APPLICATION)
@Name("discoveryAction")
public class DiscoveryAction {
@@ -73,7 +73,6 @@
private void doAutodiscovery() {
log.debug("DiscoveryAction doAutodiscovery");
-
ResourceManagerFactory.resourceManager().discoverServicesAsync();
- }
+ }
}
Added:
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java
===================================================================
---
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java
(rev 0)
+++
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -0,0 +1,117 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.jboss.on.embedded.ui.content;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.FileOutputStream;
+
+import javax.faces.application.FacesMessage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.faces.FacesMessages;
+
+import org.jboss.on.embedded.ui.NavigationAction;
+import org.jboss.on.embedded.BootstrapAction;
+
+/**
+ * @author Ian Springer
+ */
+public abstract class AbstractFileUploadAction {
+ protected static final String SUCCESS_OUTCOME = "success";
+ protected static final String FAILURE_OUTCOME = "failure";
+
+ protected static final String PACKAGE_ARCHITECTURE = "no-arch";
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ private String fileName;
+ private byte[] file;
+ private String fileContentType;
+
+ /**
+ * FacesMessages is a Seam Component that will handle the success/fail messages
across a page redirect.
+ */
+ @In
+ protected transient FacesMessages facesMessages;
+
+ @In
+ protected NavigationAction navigationAction;
+
+ @In
+ private BootstrapAction bootstrapAction;
+
+ protected File writeTempFile()
+ throws IOException
+ {
+ File tempFile;
+ File tempDir = this.bootstrapAction.getTempDir();
+ try {
+
+ tempDir.mkdirs(); // just in case the temp dir got deleted since this webapp
was last deployed
+ tempFile = new File(tempDir, this.fileName);
+ log.debug("Writing temp file to " + tempFile + "...");
+ if (tempFile.exists())
+ tempFile.delete();
+ FileOutputStream fos = new FileOutputStream(tempFile);
+ fos.write(this.file);
+ fos.close();
+ }
+ catch (IOException e) {
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
+ "content.resourceInstance.create.unableToCreateTempFile");
+ log.error("Unable to save uploaded file to temp directory " +
tempDir + ".", e);
+ throw e;
+ }
+ return tempFile;
+ }
+
+ public String getFileName()
+ {
+ return fileName;
+ }
+
+ public void setFileName(String fileName)
+ {
+ this.fileName = fileName;
+ }
+
+ public byte[] getFile()
+ {
+ return file;
+ }
+
+ public void setFile(byte[] file)
+ {
+ this.file = file;
+ }
+
+ public String getFileContentType()
+ {
+ return fileContentType;
+ }
+
+ public void setFileContentType(String fileContentType)
+ {
+ this.fileContentType = fileContentType;
+ }
+}
Property changes on:
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Author Id Revision HeadURL
Name: svn:eol-style
+ LF
Copied:
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/CreateContentBackedResourceAction.java
(from rev 27,
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/ResourceTypeContentAction.java)
===================================================================
---
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/CreateContentBackedResourceAction.java
(rev 0)
+++
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/CreateContentBackedResourceAction.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -0,0 +1,148 @@
+/*
+ * Embedded Jopr Project
+ * Copyright (C) 2006-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.jboss.on.embedded.ui.content;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.faces.application.FacesMessage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.End;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+
+import org.rhq.core.clientapi.agent.inventory.CreateResourceResponse;
+import org.rhq.core.clientapi.server.plugin.content.ContentSourcePackageDetailsKey;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+
+import org.jboss.on.embedded.manager.ResourceManager;
+import org.jboss.on.embedded.manager.ResourceManagerFactory;
+import org.jboss.on.embedded.ui.nav.JONTreeNode;
+import org.jboss.on.embedded.ui.nav.ResourceTypeTreeNode;
+import org.jboss.on.embedded.util.ContentUtility;
+
+/**
+ * A Seam action for creating a content-backed Resource (e.g. a WAR or an EAR).
+ *
+ * @author Ian Springer
+ */
+@Name("createContentBackedResourceAction")
+(a)Scope(ScopeType.CONVERSATION)
+public class CreateContentBackedResourceAction extends AbstractFileUploadAction {
+ private static final String INITIAL_PACKAGE_VERSION = "1.0";
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ private final ResourceManager resourceManager =
ResourceManagerFactory.resourceManager();
+
+ @Out
+ private ConfigurationDefinition configurationDefinition;
+
+ @Out
+ private Configuration configuration;
+
+ @Out
+ private ResourceType resourceType;
+
+ private PackageType packageType;
+
+ @Begin(join = true)
+ public String init()
+ {
+ JONTreeNode selectedNode = this.navigationAction.getSelectedNode();
+ ResourceTypeTreeNode resourceTypeTreeNode = (ResourceTypeTreeNode)selectedNode;
+ this.resourceType = resourceTypeTreeNode.getResourceType();
+
+ this.packageType = ContentUtility.getCreationPackageType(this.resourceType);
+ if (this.packageType == null)
+ {
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
"content.resourceInstance.create.resourceTypeHasNoCreationPackageType");
+ return FAILURE_OUTCOME;
+ }
+
+ this.configurationDefinition =
this.packageType.getDeploymentConfigurationDefinition();
+ this.configuration =
ContentUtility.getDefaultDeploymentConfiguration(this.packageType);
+
+ return SUCCESS_OUTCOME;
+ }
+
+ @End(ifOutcome={"success"})
+ public String createContentBackedResource()
+ {
+ if (getFileName() == null)
+ {
+ // NOTE: This check is necessary, because the "required" attribute
of the Seam FileUpload component doesn't
+ // work.
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
+ "content.resourceInstance.create.noFileSelected");
+ return FAILURE_OUTCOME;
+ }
+ log.debug("Creating content-backed " + this.resourceType + "
Resource " + getFileName() + "...");
+
+ File tempFile;
+ try
+ {
+ tempFile = writeTempFile();
+ }
+ catch (IOException e)
+ {
+ return FAILURE_OUTCOME;
+ }
+
+ PackageDetailsKey key = new ContentSourcePackageDetailsKey(tempFile.getPath(),
INITIAL_PACKAGE_VERSION, this.packageType.getName(),
+ PACKAGE_ARCHITECTURE, this.resourceType.getName(),
this.resourceType.getPlugin());
+ ResourcePackageDetails detail = new ResourcePackageDetails(key);
+ detail.setDeploymentTimeConfiguration(this.configuration);
+
+ Configuration pluginConfiguration = null;
+
+ JONTreeNode currentNode = navigationAction.getSelectedNode();
+ Resource ancestorResource = currentNode.getClosestResource();
+
+ final String resourceName = getFileName();
+ CreateResourceResponse createResourceResponse =
this.resourceManager.createResource(resourceName,
+ this.resourceType, ancestorResource, pluginConfiguration, detail);
+ switch (createResourceResponse.getStatus())
+ {
+ case SUCCESS:
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO,
"content.resourceInstance.create.success",
+ getFileName());
+ return SUCCESS_OUTCOME;
+ default:
+ String cause = (createResourceResponse.getErrorMessage() != null) ?
+ createResourceResponse.getErrorMessage() : "unknown";
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
"content.resourceInstance.create.failure",
+ getFileName(), cause);
+ return FAILURE_OUTCOME;
+ }
+ }
+}
Deleted:
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/ResourceTypeContentAction.java
===================================================================
---
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/ResourceTypeContentAction.java 2008-10-31
13:53:01 UTC (rev 30)
+++
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/ResourceTypeContentAction.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -1,245 +0,0 @@
-/*
- * Embedded Jopr Project
- * Copyright (C) 2006-2008 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.jboss.on.embedded.ui.content;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Set;
-
-import javax.faces.application.FacesMessage;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jetbrains.annotations.Nullable;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.End;
-import org.jboss.seam.annotations.web.RequestParameter;
-import org.jboss.seam.faces.FacesMessages;
-
-import org.rhq.core.clientapi.server.plugin.content.ContentSourcePackageDetailsKey;
-import org.rhq.core.clientapi.agent.inventory.CreateResourceResponse;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.content.PackageDetailsKey;
-import org.rhq.core.domain.content.PackageType;
-import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
-import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
-
-import org.jboss.on.embedded.manager.ResourceManager;
-import org.jboss.on.embedded.manager.ResourceManagerFactory;
-import org.jboss.on.embedded.ui.NavigationAction;
-import org.jboss.on.embedded.ui.nav.JONTreeNode;
-import org.jboss.on.embedded.ui.nav.ResourceTypeTreeNode;
-import org.jboss.on.embedded.BootstrapAction;
-
-/**
- * A Seam action for creating a content-backed Resource (e.g. a WAR or an EAR).
- *
- * @author Ian Springer
- */
-@Name("resourceTypeContentAction")
-(a)Scope(ScopeType.CONVERSATION)
-public class ResourceTypeContentAction
-{
- private static final String SUCCESS_OUTCOME = "success";
- private static final String FAILURE_OUTCOME = "failure";
-
- private final Log log = LogFactory.getLog(ResourceTypeContentAction.class);
-
- private final ResourceManager resourceManager =
ResourceManagerFactory.resourceManager();
-
- private String fileName;
-
- private byte[] file;
-
- private String fileContentType;
-
- @Out
- private ConfigurationDefinition configurationDefinition;
-
- @Out
- private Configuration configuration;
-
- @In
- NavigationAction navigationAction;
-
- @In
- BootstrapAction bootstrapAction;
-
- /**
- * facesMessages is a Seam Component that will handle the success/fail messages
across a page redirect
- */
- @In
- private transient FacesMessages facesMessages;
-
- @RequestParameter
- String selectedResourceTypeName;
-
- private ResourceType resourceType;
-
- private PackageType packageType;
-
- @Begin(join = true)
- public String init()
- {
- ResourceTypeTreeNode resourceTypeTreeNode =
(ResourceTypeTreeNode)this.navigationAction.getSelectedNode();
- this.resourceType = resourceTypeTreeNode.getResourceType();
- this.packageType = getCreationPackageType(this.resourceType);
- if (this.packageType == null)
- {
- facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
"content.resourceInstance.create.resourceTypeHasNoCreationPackageType");
- return FAILURE_OUTCOME;
- }
- this.configurationDefinition =
this.packageType.getDeploymentConfigurationDefinition();
- if (this.configurationDefinition != null)
- {
- if (this.configurationDefinition.getDefaultTemplate() != null)
- //noinspection ConstantConditions
- this.configuration =
this.configurationDefinition.getDefaultTemplate().getConfiguration();
- else
- this.configuration = new Configuration();
- }
- return SUCCESS_OUTCOME;
- }
-
- @End(ifOutcome={"success"})
- public String createContentBackedResource()
- {
- if (this.fileName == null)
- {
- // NOTE: This check is necessary, because the "required" attribute
of the Seam FileUpload component doesn't
- // work.
- facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
- "content.resourceInstance.create.noFileSelected");
- return FAILURE_OUTCOME;
- }
- log.debug("Creating content-backed " + this.resourceType + "
Resource " + this.fileName + "...");
- File tempDir = this.bootstrapAction.getTempDir();
- tempDir.mkdirs(); // just in case the temp dir got deleted since this webapp was
last deployed
-
- File tempFile;
- try
- {
- tempFile = writeTempFile(tempDir);
- }
- catch (IOException e)
- {
- facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
- "content.resourceInstance.create.unableToCreateTempFile");
- log.error("Unable to save uploaded file to temp directory " +
tempDir + ".", e);
- return FAILURE_OUTCOME;
- }
-
- final String version = "1.0";
- final String architectureName = "no-arch";
-
- PackageDetailsKey key = new ContentSourcePackageDetailsKey(tempFile.getPath(),
version, this.packageType.getName(),
- architectureName, this.resourceType.getName(),
this.resourceType.getPlugin());
- ResourcePackageDetails detail = new ResourcePackageDetails(key);
- detail.setDeploymentTimeConfiguration(this.configuration);
-
- Configuration pluginConfiguration = null;
-
- JONTreeNode currentNode = navigationAction.getSelectedNode();
- Resource ancestorResource = currentNode.getClosestResource();
-
- final String resourceName = this.fileName;
- CreateResourceResponse createResourceResponse =
this.resourceManager.createResource(resourceName,
- this.resourceType, ancestorResource, pluginConfiguration, detail);
- switch (createResourceResponse.getStatus())
- {
- case SUCCESS:
- facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO,
"content.resourceInstance.create.success",
- this.fileName);
- return SUCCESS_OUTCOME;
- default:
- String cause = (createResourceResponse.getErrorMessage() != null) ?
- createResourceResponse.getErrorMessage() : "unknown";
- facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
"content.resourceInstance.create.failure",
- this.fileName, cause);
- return FAILURE_OUTCOME;
- }
- }
-
- private File writeTempFile(File tempDir)
- throws IOException
- {
- File tempFile = new File(tempDir, this.fileName);
- log.debug("Writing temp file to " + tempFile + "...");
- if (tempFile.exists())
- tempFile.delete();
- FileOutputStream fos = new FileOutputStream(tempFile);
- fos.write(this.file);
- fos.close();
- return tempFile;
- }
-
- @Nullable
- private static PackageType getCreationPackageType(ResourceType resourceType)
- {
- Set<PackageType> packageTypes = resourceType.getPackageTypes();
- for (PackageType packageType : packageTypes)
- {
- if (packageType.isCreationData())
- {
- return packageType;
- }
- }
- return null;
- }
-
- public String getFileName()
- {
- return fileName;
- }
-
- public void setFileName(String fileName)
- {
- this.fileName = fileName;
- }
-
- public byte[] getFile()
- {
- return file;
- }
-
- public void setFile(byte[] file)
- {
- this.file = file;
- }
-
- public String getFileContentType()
- {
- return fileContentType;
- }
-
- public void setFileContentType(String fileContentType)
- {
- this.fileContentType = fileContentType;
- }
-}
Copied:
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java
(from rev 27,
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/ResourceTypeContentAction.java)
===================================================================
---
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java
(rev 0)
+++
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -0,0 +1,170 @@
+/*
+ * Embedded Jopr Project
+ * Copyright (C) 2006-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.jboss.on.embedded.ui.content;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.faces.application.FacesMessage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Begin;
+import org.jboss.seam.annotations.End;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+
+import org.rhq.core.clientapi.agent.PluginContainerException;
+import org.rhq.core.clientapi.server.plugin.content.ContentSourcePackageDetailsKey;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.ContentDiscoveryReport;
+import org.rhq.core.domain.content.transfer.DeployPackagesRequest;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.pc.content.ContentManager;
+
+import org.jboss.on.embedded.ui.nav.JONTreeNode;
+import org.jboss.on.embedded.ui.nav.ResourceTreeNode;
+import org.jboss.on.embedded.util.ContentUtility;
+
+/**
+ * A Seam action for updating the file backing a content-backed Resource (e.g. a WAR or
an EAR).
+ *
+ * @author Ian Springer
+ */
+@Name("updateBackingContentAction")
+(a)Scope(ScopeType.CONVERSATION)
+public class UpdateBackingContentAction extends AbstractFileUploadAction {
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ @Out
+ private ResourceType resourceType;
+
+ @Out
+ private Resource resource;
+
+ @Out
+ private PackageType packageType;
+
+ @Out
+ private ResourcePackageDetails packageDetails;
+
+ @Begin(join = true)
+ public String init()
+ {
+ JONTreeNode selectedNode = this.navigationAction.getSelectedNode();
+ ResourceTreeNode resourceTreeNode = (ResourceTreeNode)selectedNode;
+ this.resource = resourceTreeNode.getResource();
+ this.resourceType = resource.getResourceType();
+
+ this.packageType = ContentUtility.getCreationPackageType(this.resourceType);
+ if (this.packageType == null)
+ {
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
"content.resourceInstance.create.resourceTypeHasNoCreationPackageType");
+ return FAILURE_OUTCOME;
+ }
+
+ try {
+ this.packageDetails = getBackingPackage();
+ }
+ catch (Exception e) {
+ facesMessages.add(FacesMessage.SEVERITY_ERROR, e.getLocalizedMessage());
+ return FAILURE_OUTCOME;
+ }
+
+ return SUCCESS_OUTCOME;
+ }
+
+ @End(ifOutcome={"success"})
+ public String updateBackingContent() {
+ if (getFileName() == null) {
+ // NOTE: This check is necessary, because the "required" attribute
of the Seam FileUpload component doesn't
+ // work.
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_ERROR,
+ "content.resourceInstance.create.noFileSelected");
+ return FAILURE_OUTCOME;
+ }
+ if (!getFileName().equals(this.packageDetails.getFileName())) {
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_WARN,
+ "content.resourceInstance.update.wrongFileName",
this.packageType.getDisplayName(),
+ this.packageDetails.getFileName());
+ return FAILURE_OUTCOME;
+ }
+ log.debug("Updating content-backed " + this.resourceType + "
Resource " + getFileName() + "...");
+
+ File tempFile;
+ try
+ {
+ tempFile = writeTempFile();
+ }
+ catch (IOException e)
+ {
+ return FAILURE_OUTCOME;
+ }
+
+ // TODO: Allow user to specify version?
+ String version = String.valueOf(System.currentTimeMillis());
+ PackageDetailsKey key = new ContentSourcePackageDetailsKey(tempFile.getPath(),
version, this.packageType.getName(),
+ PACKAGE_ARCHITECTURE, this.resourceType.getName(),
this.resourceType.getPlugin());
+ ResourcePackageDetails detail = new ResourcePackageDetails(key);
+
//detail.setDeploymentTimeConfiguration(this.packageDetails.getDeploymentTimeConfiguration());
+
+ Set<ResourcePackageDetails> packageDetails = new
HashSet<ResourcePackageDetails>();
+ packageDetails.add(detail);
+ DeployPackagesRequest deployPackagesRequest = new DeployPackagesRequest(1,
this.resource.getId(), packageDetails);
+
+ ContentManager contentManager =
PluginContainer.getInstance().getContentManager();
+ try {
+ contentManager.deployPackagesImmediately(deployPackagesRequest);
+ }
+ catch (PluginContainerException e) {
+ facesMessages.add(FacesMessage.SEVERITY_ERROR, e.getLocalizedMessage());
+ return FAILURE_OUTCOME;
+ }
+
+ facesMessages.add(FacesMessage.SEVERITY_INFO, "{0} {1} updated.",
this.packageType.getDisplayName(),
+ this.packageDetails.getFileName());
+ return SUCCESS_OUTCOME;
+ }
+
+ public ResourcePackageDetails getBackingPackage() throws Exception {
+ ContentDiscoveryReport report = null;
+ try {
+ report =
PluginContainer.getInstance().getContentManager().executeResourcePackageDiscoveryImmediately(
+ this.resource.getId(), this.packageType.getName());
+ if (report.getDeployedPackages().size() != 1) {
+ throw new
Exception("ContentManager.executeResourcePackageDiscoveryImmediately() returned more
than one package.");
+ }
+ }
+ catch (PluginContainerException e) {
+ log.error("Failed to discover underlying " +
this.packageType.getName() + " package for "
+ + this.resourceType.getName() + " Resource.", e);
+ }
+ return report.getDeployedPackages().iterator().next();
+ }
+}
\ No newline at end of file
Property changes on:
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/core/src/main/java/org/jboss/on/embedded/util/ContentUtility.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/util/ContentUtility.java
(rev 0)
+++ trunk/core/src/main/java/org/jboss/on/embedded/util/ContentUtility.java 2008-11-04
15:53:35 UTC (rev 31)
@@ -0,0 +1,73 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.jboss.on.embedded.util;
+
+import java.util.Set;
+
+import org.jetbrains.annotations.Nullable;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.ResourceCreationDataType;
+
+/**
+ * @author Ian Springer
+ */
+public abstract class ContentUtility
+{
+ private ContentUtility()
+ {
+ }
+
+ public static boolean isContentBacked(ResourceType resourceType)
+ {
+ return resourceType.isCreatable() && resourceType.getCreationDataType()
== ResourceCreationDataType.CONTENT;
+ }
+
+ @Nullable
+ public static PackageType getCreationPackageType(ResourceType resourceType)
+ {
+ Set<PackageType> packageTypes = resourceType.getPackageTypes();
+ for (PackageType packageType : packageTypes)
+ {
+ if (packageType.isCreationData())
+ {
+ return packageType;
+ }
+ }
+ return null;
+ }
+
+ @Nullable
+ public static Configuration getDefaultDeploymentConfiguration(PackageType
packageType){
+ ConfigurationDefinition configurationDefinition =
packageType.getDeploymentConfigurationDefinition();
+ Configuration configuration = null;
+ if (configurationDefinition != null)
+ {
+ if (configurationDefinition.getDefaultTemplate() != null)
+ //noinspection ConstantConditions
+ configuration =
configurationDefinition.getDefaultTemplate().getConfiguration();
+ else
+ configuration = new Configuration();
+ }
+ return configuration;
+ }
+}
Property changes on:
trunk/core/src/main/java/org/jboss/on/embedded/util/ContentUtility.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Author Id Revision HeadURL
Name: svn:eol-style
+ LF
Modified: trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2008-10-31 13:53:01 UTC
(rev 30)
+++ trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2008-11-04 15:53:35 UTC
(rev 31)
@@ -74,6 +74,8 @@
resource.add.button.save=Save
resource.add.button.cancel=Cancel
+resource.content.button.update=Update
+
component.dataPaginator.firstpage=First
component.dataPaginator.lastpage=Last
component.dataPaginator.previouspage=Prev
@@ -150,13 +152,16 @@
content.resourceInstance.version=Version
#Messages for resourceContentCreate.xhtml
-content.resourceInstance.create=Enter the filename you wish to deploy:
+content.resourceInstance.create=Enter the absolute path to the local file you wish to
deploy, specify deployment options, then click Continue.
content.resourceInstance.create.noFileSelected=Please enter a file to upload.
content.resourceInstance.create.resourceTypeHasNoCreationPackageType=Unable to create
resources of this type. The resource type does not define a creation package type.
content.resourceInstance.create.unableToCreateTempFile=Unable to create temp file from
file upload.
content.resourceInstance.create.success=Resource {0} created successfully!
content.resourceInstance.create.failure=Failed to create Resource {0} - cause: {1}
+#Messages for resourceInstanceContent.xhtml
+content.resourceInstance.update.wrongFileName=The specified file must have the same name
as the existing deployed {0} ({1}).
+
exception.heading=Internal Error
exception.paragraph1=The application has encountered an error.
exception.paragraph2a=Please return to the
Modified: trunk/core/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/pages.xml 2008-10-31 13:53:01 UTC (rev 30)
+++ trunk/core/src/main/webapp/WEB-INF/pages.xml 2008-11-04 15:53:35 UTC (rev 31)
@@ -70,7 +70,7 @@
</page>
<page view-id="/secure/resourceTypeSummary.xhtml">
- <navigation from-action="#{resourceTypeContentAction.init()}">
+ <navigation
from-action="#{createContentBackedResourceAction.init()}">
<rule if-outcome="success">
<redirect
view-id="/secure/resourceContentCreate.xhtml"/>
</rule>
@@ -159,17 +159,6 @@
</navigation>
</page>
- <page view-id="/secure/viewContent.xhtml">
- <param name="path"
value="#{navigationAction.currentPath}"/>
-
- <!-- run this method before rendering the page-->
- <action execute="#{contentDisplayAction.getContent()}"/>
-
- <navigation from-action="#{contentDisplayAction.getContent()}">
- <render view-id="/secure/resourceInstanceContent.xhtml"/>
- </navigation>
- </page>
-
<page view-id="/secure/resourceInstanceMetrics.xhtml">
<param name="path"
value="#{navigationAction.currentPath}"/>
@@ -181,6 +170,11 @@
</navigation>
</page>
+ <page view-id="/secure/resourceInstanceContent.xhtml">
+ <!-- Run this method before rendering the page. -->
+ <action execute="#{updateBackingContentAction.init()}"/>
+ </page>
+
<page view-id="*">
<action execute="#{debugAction.init()}"/>
<action execute="#{discoveryAction.checkAutodiscovery()}"/>
Modified: trunk/core/src/main/webapp/error.xhtml
===================================================================
--- trunk/core/src/main/webapp/error.xhtml 2008-10-31 13:53:01 UTC (rev 30)
+++ trunk/core/src/main/webapp/error.xhtml 2008-11-04 15:53:35 UTC (rev 31)
@@ -32,7 +32,7 @@
<div id="errorbox">
<h1>#{messages['exception.heading']}</h1>
<p>#{messages['exception.paragraph1']}</p>
- <p>#{messages['exception.paragraph2a']} <a
href="index.xhtml">#{messages['exception.paragraph2b']}</a>
#{messages['exception.paragraph2c']}</p>
+ <p>#{messages['exception.paragraph2a']} <a
href="index.html">#{messages['exception.paragraph2b']}</a>
#{messages['exception.paragraph2c']}</p>
<h3 style="padding-top: 12px; border-bottom: 1px solid
#e6eaef;">Error details:</h3>
<div id="codebox">
<a4j:repeat
value="#{org.jboss.seam.debug.contexts.exceptionCauses}" var="cause"
rowKeyVar="rowKey">
Modified: trunk/core/src/main/webapp/include/tabMenu.xhtml
===================================================================
--- trunk/core/src/main/webapp/include/tabMenu.xhtml 2008-10-31 13:53:01 UTC (rev 30)
+++ trunk/core/src/main/webapp/include/tabMenu.xhtml 2008-11-04 15:53:35 UTC (rev 31)
@@ -147,7 +147,7 @@
<h:panelGroup layout="block"
rendered="#{activeTab ne 'content' and
navigationAction.enabledTabs.contains('content')}">
<li>
- <s:link styleClass=""
view="/secure/viewContent.xhtml" propagation="end">
+ <s:link styleClass=""
view="/secure/resourceInstanceContent.xhtml" propagation="end">
#{messages['tab.menu.content']}
</s:link>
</li>
Modified: trunk/core/src/main/webapp/layout.xhtml
===================================================================
--- trunk/core/src/main/webapp/layout.xhtml 2008-10-31 13:53:01 UTC (rev 30)
+++ trunk/core/src/main/webapp/layout.xhtml 2008-11-04 15:53:35 UTC (rev 31)
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
~ Embedded Jopr Project
~ Copyright (C) 2006-2008 Red Hat, Inc.
Modified: trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml 2008-10-31 13:53:01 UTC
(rev 30)
+++ trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml 2008-11-04 15:53:35 UTC
(rev 31)
@@ -30,7 +30,7 @@
<ui:composition template="/layout.xhtml">
<!-- page title -->
- <ui:define
name="pagetitle">#{messages['resource.add.pageTitlePrefix']}
#{param.selectedResourceTypeName}</ui:define>
+ <ui:define
name="pagetitle">#{messages['resource.add.pageTitlePrefix']}
#{resourceType.name}</ui:define>
<!-- body -->
<ui:define name="body">
<div class="notabmenubox">
@@ -41,12 +41,11 @@
<hr/>
<h:form enctype="multipart/form-data">
<h:panelGrid styleClass="formstyle">
- <input type="hidden"
name="selectedResourceTypeName"
value="#{param.selectedResourceTypeName}"/>
<s:fileUpload id="file"
- data="#{resourceTypeContentAction.file}"
-
fileName="#{resourceTypeContentAction.fileName}"
+
data="#{createContentBackedResourceAction.file}"
+
fileName="#{createContentBackedResourceAction.fileName}"
accept="application/zip,application/war,application/ear,application/jar"
-
contentType="#{resourceTypeContentAction.fileContentType}"
+
contentType="#{createContentBackedResourceAction.fileContentType}"
required="true"/>
<onc:config
configurationDefinition="#{configurationDefinition}"
configuration="#{configuration}"
@@ -54,7 +53,7 @@
nullConfigurationMessage="null
Configuration!"/>
<h:panelGrid columns="2"
cellspacing="9">
<h:commandButton
value="#{messages['resource.add.button.continue']}"
-
action="#{resourceTypeContentAction.createContentBackedResource()}"
+
action="#{createContentBackedResourceAction.createContentBackedResource()}"
styleClass="buttonmed"/>
<s:button
value="#{messages['resource.add.button.cancel']}"
view="/secure/summary.xhtml"
Modified: trunk/core/src/main/webapp/secure/resourceInstanceContent.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceInstanceContent.xhtml 2008-10-31 13:53:01
UTC (rev 30)
+++ trunk/core/src/main/webapp/secure/resourceInstanceContent.xhtml 2008-11-04 15:53:35
UTC (rev 31)
@@ -32,7 +32,7 @@
<f:view>
<ui:composition template="/layout.xhtml">
- <ui:define
name="pagetitle">#{resource.resource.name}</ui:define>
+ <ui:define name="pagetitle">#{resource.name}</ui:define>
<ui:define name="tabmenu">
<ui:include src="/include/tabMenu.xhtml">
@@ -40,50 +40,36 @@
</ui:include>
</ui:define>
+ <!-- body -->
<ui:define name="body">
- <div class="tabmenubox">
+ <div class="notabmenubox">
<ui:include
src="../include/displayGlobalMessages.xhtml"/>
-
+ <h:panelGroup layout="block" rendered="#{not empty
packageDetails.location}"
+ styleClass="instructionalText">
+ <b>File Path:</b> #{packageDetails.location}
+ </h:panelGroup>
+ <h:panelGroup layout="block" rendered="#{not empty
packageDetails.fileSize}"
+ styleClass="instructionalText">
+ <b>File Size:</b> #{packageDetails.fileSize} bytes
+ </h:panelGroup>
+ <hr/>
<div class="instructionalText">
- #{messages['content.resourceInstance.pageDescription']}
+ To update the #{packageType.displayName}, specify a local file path
then click Update. Note, the
+ specified file must be named #{packageDetails.fileName}.
</div>
-
- <rich:dataTable
- styleClass="internalTable"
- width="100%"
- id="dataTable"
- rowClasses="oddRow,evenRow"
- columnClasses="rich-table-cell"
- var="content"
- value="#{contentDetails}">
-
- <f:facet name="header">
- <rich:columnGroup>
-
<rich:column>#{messages['content.resourceInstance.name']}</rich:column>
-
<rich:column>#{messages['content.resourceInstance.architecture']}</rich:column>
-
<rich:column>#{messages['content.resourceInstance.packagetype']}</rich:column>
-
<rich:column>#{messages['content.resourceInstance.version']}</rich:column>
- </rich:columnGroup>
- </f:facet>
-
- <rich:columnGroup styleClass="">
- <rich:column>
- <h:outputText value="#{content.name}"/>
- </rich:column>
- <rich:column>
- <h:outputText
value="#{content.architectureName}"/>
- </rich:column>
- <rich:column>
- <h:outputText
value="#{content.packageTypeName}"/>
- </rich:column>
- <rich:column>
- <h:outputText value="#{content.version}"/>
- </rich:column>
- </rich:columnGroup>
- <f:facet name="footer"><h:graphicImage
value="images/spacer.gif"/>
- </f:facet>
- </rich:dataTable>
-
+ <h:form enctype="multipart/form-data">
+ <h:panelGrid styleClass="formstyle">
+ <s:fileUpload id="file"
+
data="#{updateBackingContentAction.file}"
+
fileName="#{updateBackingContentAction.fileName}"
+
accept="application/zip,application/war,application/ear,application/jar"
+
contentType="#{updateBackingContentAction.fileContentType}"
+ required="true"/>
+ <h:commandButton
value="#{messages['resource.content.button.update']}"
+
action="#{updateBackingContentAction.updateBackingContent()}"
+ styleClass="buttonmed"/>
+ </h:panelGrid>
+ </h:form>
</div>
</ui:define>
Modified: trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml 2008-10-31 13:53:01 UTC
(rev 30)
+++ trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml 2008-11-04 15:53:35 UTC
(rev 31)
@@ -59,10 +59,8 @@
</s:button>
<s:button rendered="#{resourceType.creationDataType eq
'CONTENT'}"
- action="#{resourceTypeContentAction.init()}"
-
value="#{messages['summary.resourceType.addNew']}"
styleClass="buttonmed">
- <f:param name="selectedResourceTypeName"
value="#{resourceType.name}"/>
- </s:button>
+
action="#{createContentBackedResourceAction.init()}"
+
value="#{messages['summary.resourceType.addNew']}"
styleClass="buttonmed"/>
</h:form>
<h:outputLabel rendered="#{!resourceType.creatable}"
value="#{messages['resourcetype.no.action']}"/>