[jboss-cvs] JBossAS SVN: r84894 - in trunk: connector/src/main/org/jboss/resource/deployers/management and 14 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 27 16:02:34 EST 2009
Author: emuckenhuber
Date: 2009-02-27 16:02:33 -0500 (Fri, 27 Feb 2009)
New Revision: 84894
Added:
trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java
trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java
Removed:
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java
Modified:
trunk/component-matrix/pom.xml
trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java
trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
trunk/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java
trunk/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
trunk/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractDeploymentManager.java
trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
trunk/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java
trunk/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
trunk/profileservice/src/resources/profileservice-jboss-beans.xml
trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java
trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java
trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
trunk/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java
trunk/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java
trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java
trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
[JBAS-6472] update to jboss-integration.alpha5, use deploymentManager to deploy deploymentTemplates
Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/component-matrix/pom.xml 2009-02-27 21:02:33 UTC (rev 84894)
@@ -67,7 +67,7 @@
<version.org.jboss.ejb3.proxy.clustered.client>1.0.0</version.org.jboss.ejb3.proxy.clustered.client>
<version.org.jboss.ejb3.security.client>1.0.0</version.org.jboss.ejb3.security.client>
<version.org.jboss.ejb3>1.1.1</version.org.jboss.ejb3>
- <version.org.jboss.integration>6.0.0.Alpha4</version.org.jboss.integration>
+ <version.org.jboss.integration>6.0.0.Alpha5</version.org.jboss.integration>
<version.org.jboss.jbossxb>2.0.0.GA</version.org.jboss.jbossxb>
<version.org.jboss.jpa>1.0.0-CR1</version.org.jboss.jpa>
<version.org.jboss.logbridge>1.0.0.CR1</version.org.jboss.logbridge>
Modified: trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/connector/src/main/org/jboss/resource/deployers/management/DsDataSourceTemplate.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -23,8 +23,7 @@
import java.io.File;
import java.io.FileWriter;
-import java.io.Serializable;
-import java.net.URI;
+
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
@@ -45,6 +44,7 @@
import org.jboss.resource.metadata.mcf.NoTxDataSourceDeploymentMetaData;
import org.jboss.resource.metadata.mcf.TxConnectionFactoryDeploymentMetaData;
import org.jboss.resource.metadata.mcf.XADataSourceDeploymentMetaData;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
/**
@@ -57,18 +57,42 @@
public class DsDataSourceTemplate
implements DeploymentTemplate
{
+ /** The logger. */
private static final Logger log = Logger.getLogger(DsDataSourceTemplate.class);
+ /** The file suffix. */
+ private static final String FILE_SUFFIX = "-ds.xml";
+
+ /** The deployment template info. */
private DeploymentTemplateInfo info;
+
- @SuppressWarnings("deprecation")
- public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName, DeploymentTemplateInfo values) throws Exception
+ public String getDeploymentName(String deploymentBaseName)
{
- String dsName = deploymentBaseName+"-ds.xml";
- URI dsXmlURI = new URI(root.toURI()+dsName);
- File dsXml = new File(dsXmlURI.getPath());
+ if(deploymentBaseName == null)
+ throw new IllegalArgumentException("Null base name.");
+
+ if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
+ deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
+
+ return deploymentBaseName;
+ }
+
+ public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName,
+ DeploymentTemplateInfo values)
+ throws Exception
+ {
+ return applyTemplate(values);
+ }
+
+ public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception
+ {
+ // Create a temp file
+ File dsXml = File.createTempFile(getClass().getSimpleName(), FILE_SUFFIX);
+ // Write template
writeTemplate(dsXml, values);
- return root.findChild(dsName);
+ // Return virtual file
+ return VFS.getRoot(dsXml.toURI());
}
public DeploymentTemplateInfo getInfo()
Added: trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java (rev 0)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/AbstractTemplateCreator.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -0,0 +1,195 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.profileservice.management;
+
+import java.net.URL;
+
+import org.jboss.deployers.spi.management.DeploymentTemplate;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * A basic template creator, which applies and distributes the template.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractTemplateCreator
+{
+
+ /** The deployment manager. */
+ private DeploymentManager deploymentMgr;
+
+ /** The default profile key. */
+ private ProfileKey defaultKey = new ProfileKey(ProfileKey.DEFAULT);
+
+ public DeploymentManager getDeploymentManager()
+ {
+ return deploymentMgr;
+ }
+
+ public void setDeploymentManager(DeploymentManager deploymentMgr)
+ {
+ this.deploymentMgr = deploymentMgr;
+ }
+
+ public ProfileKey getDefaulProfiletKey()
+ {
+ return defaultKey;
+ }
+
+ public void setDefaultProfileKey(ProfileKey defaultKey)
+ {
+ this.defaultKey = defaultKey;
+ }
+
+ public void applyTemplate(DeploymentTemplate template, String deploymentBaseName, DeploymentTemplateInfo info)
+ throws Exception
+ {
+ if(template == null)
+ throw new IllegalArgumentException("Null deployment template.");
+ if(deploymentBaseName == null)
+ throw new IllegalArgumentException("Null deployment name.");
+ if(info == null)
+ throw new IllegalArgumentException("Null deployment template info.");
+
+ // Load the deployment manager
+ this.deploymentMgr.loadProfile(defaultKey, false);
+ // The virtual file
+ VirtualFile base = null;
+ try
+ {
+ // Apply the template
+ String deploymentName = template.getDeploymentName(deploymentBaseName);
+ if(deploymentName == null)
+ throw new IllegalStateException("getDeploymentName returned a null value.");
+ base = template.applyTemplate(info);
+ if(base == null)
+ throw new IllegalStateException("applyTemplate returned null virtual file.");
+
+ // Deploy the deployment
+ String[] repositoryNames = null;
+ try
+ {
+ // Distribute
+ repositoryNames = distribute(deploymentName, base.toURL());
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ // Try to remove
+ if(repositoryNames != null)
+ remove(repositoryNames);
+ }
+ catch(Exception ignore) { }
+ // Rethrow
+ throw e;
+ }
+
+ try
+ {
+ // Start the deployment
+ start(repositoryNames);
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ // Try to stop
+ stop(repositoryNames);
+ }
+ catch(Exception ignore)
+ {
+ //
+ }
+ try
+ {
+ // Try to remove
+ remove(repositoryNames);
+ }
+ catch(Exception ignore)
+ {
+ //
+ }
+ // Rethrow
+ throw e;
+ }
+ }
+ finally
+ {
+ // Release the deployment manager
+ this.deploymentMgr.releaseProfile(defaultKey, true);
+
+ // Remove the temp file
+ if(base != null)
+ base.delete();
+ }
+ }
+
+ protected String[] distribute(String name, URL url) throws Exception
+ {
+ DeploymentProgress progress = this.deploymentMgr.distribute(name, url, true);
+ progress.run();
+
+ //
+ checkComplete(progress);
+
+ return progress.getDeploymentID().getRepositoryNames();
+ }
+
+ protected void start(String[] names) throws Exception
+ {
+ DeploymentProgress progress = this.deploymentMgr.start(names);
+ progress.run();
+
+ checkComplete(progress);
+ }
+
+ protected void stop(String[] names) throws Exception
+ {
+ DeploymentProgress progress = this.deploymentMgr.stop(names);
+ progress.run();
+
+ checkComplete(progress);
+ }
+
+ protected void remove(String[] names) throws Exception
+ {
+ DeploymentProgress progress = this.deploymentMgr.remove(names);
+ progress.run();
+
+ checkComplete(progress);
+ }
+
+ protected void checkComplete(DeploymentProgress progress) throws Exception
+ {
+ if(progress.getDeploymentStatus().isFailed())
+ {
+ throw new RuntimeException("Failed to process template.", progress.getDeploymentStatus().getFailure());
+ }
+ }
+
+}
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.lang.annotation.Annotation;
-import java.net.URI;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -45,12 +44,11 @@
import org.jboss.aspects.remoting.Remoting;
import org.jboss.aspects.security.SecurityClientInterceptor;
import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.management.DeploymentTemplate;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.NameMatcher;
import org.jboss.deployers.spi.management.RuntimeComponentDispatcher;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.logging.Logger;
import org.jboss.managed.api.ComponentType;
import org.jboss.managed.api.DeploymentTemplateInfo;
@@ -80,7 +78,6 @@
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.MetaValueFactory;
import org.jboss.metatype.api.values.SimpleValue;
-import org.jboss.profileservice.spi.AttachmentStore;
import org.jboss.profileservice.spi.NoSuchDeploymentException;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
@@ -88,9 +85,7 @@
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.remoting.InvokerLocator;
-import org.jboss.system.server.profileservice.repository.DefaultProfileDeploymentFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
/**
* The default ManagementView implementation.
@@ -102,69 +97,63 @@
* @version $Revision$
*/
@ManagementObject(name="ManagementView", componentType=@ManagementComponent(type="MCBean", subtype="*"))
-public class ManagementViewImpl implements ManagementView
+public class ManagementViewImpl extends AbstractTemplateCreator implements ManagementView
{
+ /** The logger. */
private static Logger log = Logger.getLogger(ManagementViewImpl.class);
private static final String BUNDLE_NAME = "org.jboss.profileservice.management.messages"; //$NON-NLS-1$
-
- /** The deployment factory */
- private VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
/** The ProfileService for loading profiles */
private ProfileService ps;
- /** The currently loaded profile */
- private Profile activeProfile;
- /** The last modified profiles */
+ /** The last modified cache for loaded profiles */
private Map<ProfileKey, Long> lastModified = new HashMap<ProfileKey, Long>();
+ /** Force a reload of ManagementView. */
+ private boolean forceReload;
- private volatile boolean forceReload;
-
- /** The MainDeployer used to process profile changes */
+ /** The MainDeployer only used to get the ManagedDeployments */
private MainDeployer mainDeployer;
- /** The attachment store. */
+ /** The attachment store to persist the component changes. */
private AttachmentStore store;
- private InvokerLocator locator;
-
/** The deployment templates that have been registered with the MV */
private HashMap<String, DeploymentTemplate> templates = new HashMap<String, DeploymentTemplate>();
+
/** The internationalization resource bundle */
private ResourceBundle i18n;
/** the Locale for the i18n messages */
private Locale currentLocale;
/** The formatter used for i18n messages */
private MessageFormat formatter = new MessageFormat("");
+
/** An index of ManagedComponent by ComponentType */
private HashMap<ComponentType, Set<ManagedComponent>> compByCompType = new HashMap<ComponentType, Set<ManagedComponent>>();
/** id/type key to ManagedObject map */
private Map<String, ManagedObject> moRegistry = new HashMap<String, ManagedObject>();
- /** The deployment name to ManagedDeployment map */
- private Map<String, ManagedDeployment> managedDeployments = new HashMap<String, ManagedDeployment>();
- /** The bootstrap deployment name to ManagedDeployment map */
- private Map<String, ManagedDeployment> bootstrapManagedDeployments = Collections.emptyMap();
/** The ManagedPropertys with unresolved ManagementObjectRefs */
private Map<String, Set<ManagedProperty>> unresolvedRefs = new HashMap<String, Set<ManagedProperty>>();
+ /** A map of runtime ManagedObjects needing to be merged with their matching ManagedObject. */
+ private Map<String, ManagedObject> runtimeMOs = new HashMap<String, ManagedObject>();
+ /** The bootstrap deployment name to ManagedDeployment map */
+ private Map<String, ManagedDeployment> bootstrapManagedDeployments = Collections.emptyMap();
+ /** The deployment name to ManagedDeployment map */
+ private Map<String, ManagedDeployment> managedDeployments = new HashMap<String, ManagedDeployment>();
+ /** The root deployments to resolve the deployment name. */
+ private List<String> rootDeployments = new ArrayList<String>();
+
@Deprecated
private Map<String, ProfileKey> deploymentsToProfile = new HashMap<String, ProfileKey>();
- /** A map of runtime ManagedObjects needing to be merged with their
- * matching ManagedObject.
- */
- private Map<String, ManagedObject> runtimeMOs = new HashMap<String, ManagedObject>();
+ /** The state mappings. */
private Map<String, String> stateMappings = new HashMap<String, String>();
+
/** The dispatcher handles ManagedOperation dispatches */
private RuntimeComponentDispatcher dispatcher;
+ private InvokerLocator locator;
private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
-
- /** The template root */
- private VirtualFile templateRoot = null;
- public ManagementViewImpl(URI uri) throws IOException
+ public ManagementViewImpl() throws IOException
{
- if(uri == null)
- throw new IllegalArgumentException("Null template root uri.");
- this.templateRoot = VFS.getRoot(uri);
currentLocale = Locale.getDefault();
formatter.setLocale(currentLocale);
@@ -180,63 +169,13 @@
stateMappings.put("Start", RunState.STARTING.name());
stateMappings.put("Installed", RunState.RUNNING.name());
}
-
- /**
- * Load and associate the given profile with the ManagementView
- * for future operations. This must be called before the other ManagementView
- * operations may be used. Currently there can only be one actively loaded
- * profile against which a client is performing management operations.
- *
- * @param key - the profile to load
- * @throws NoSuchProfileException
- */
- @Deprecated
- public void loadProfile(ProfileKey key)
- throws NoSuchProfileException
- {
- if(key == null)
- throw new IllegalArgumentException("Null profile key.");
-
- // Force reload
- if(activeProfile == null)
- {
- this.forceReload = true;
- }
- else
- {
- if(activeProfile.getKey().equals(key) == false)
- this.forceReload = true;
- }
-
- try
- {
- activeProfile = ps.getActiveProfile(key);
- }
- catch(NoSuchProfileException e)
- {
- formatter.applyPattern(i18n.getString("ManagementView.NoSuchProfileException")); //$NON-NLS-1$
- Object[] args = {key};
- String msg = formatter.format(args);
- throw new NoSuchProfileException(msg);
- }
- }
- public void load()
+ public synchronized void load()
{
- // TODO there should be no need for an active profile
- try
- {
- loadProfile(new ProfileKey(ProfileKey.DEFAULT));
- }
- catch(Exception e)
- {
- log.warn("failed to load default profile", e);
- }
-
// If the profile is not modified do nothing
if(isReload() == false)
{
- log.debug("Not reloading profiles");
+ log.debug("Not reloading profiles.");
return;
}
this.forceReload = false;
@@ -281,6 +220,7 @@
this.runtimeMOs.clear();
this.unresolvedRefs.clear();
this.lastModified.clear();
+ this.rootDeployments.clear();
this.deploymentsToProfile.clear();
}
@@ -370,6 +310,10 @@
if(profile != null)
deploymentsToProfile.put(name, profile);
+ // Add root deployments
+ if(level == 0)
+ this.rootDeployments.add(name);
+
// Process children
List<ManagedDeployment> mdChildren = md.getChildren();
if(mdChildren != null && mdChildren.isEmpty() == false)
@@ -660,7 +604,6 @@
public void setProfileService(ProfileService ps)
{
this.ps = ps;
- log.debug("setProfileService: "+ps);
}
public InvokerLocator getLocator()
@@ -691,7 +634,6 @@
public void setMainDeployer(MainDeployer mainDeployer)
{
this.mainDeployer = mainDeployer;
- log.debug("setMainDeployer: "+mainDeployer);
}
public MetaValueFactory getMetaValueFactory()
@@ -823,7 +765,7 @@
// Check the file name
if(md == null)
{
- for(String deployment : this.managedDeployments.keySet())
+ for(String deployment : this.rootDeployments)
{
String fixedDeploymentName = deployment;
if(deployment.endsWith("/"))
@@ -960,134 +902,21 @@
// Create a deployment base from the template
if( log.isTraceEnabled() )
- log.trace("applyTemplate, profile="+activeProfile+", deploymentBaseName="+deploymentBaseName +", info="+info);
+ log.trace("applyTemplate, deploymentBaseName="+deploymentBaseName +", info="+info);
+ // Create, distribute and start a deployment template
+ super.applyTemplate(template, deploymentBaseName, info);
- // FIXME this should not be done in this way!
- VirtualFile vf = template.applyTemplate(templateRoot, deploymentBaseName, info);
- VFSDeployment ctx = deploymentFactory.createVFSDeployment(vf);
-
- // FIXME
- ProfileDeployment d = DefaultProfileDeploymentFactory.getInstance().createProfileDeployment(vf);
- activeProfile.addDeployment(d);
-
- mainDeployer.addDeployment(ctx);
- // Seems useless, what was the original point of this?
- template.updateTemplateDeployment(ctx, info);
- mainDeployer.process();
+ // Force a reload
+ this.forceReload = true;
-
- /* Scan through the template properties to see if there is a
- property with an ManagementObjectID annotation that needs
- to be used to update the associated ManagedObject name.
- */
- for(ManagedProperty prop : info.getProperties().values())
- {
- // Skip null values
- if( prop.getValue() == null )
- continue;
- Map<String, Annotation> pannotations = prop.getAnnotations();
- if (pannotations != null)
- {
- ManagementObjectID id = (ManagementObjectID) pannotations.get(ManagementObjectID.class.getName());
- if (id != null)
- {
- Object refName = getRefName(prop.getValue());
- if (refName == null)
- refName = id.name();
- String name = "" + refName;
- log.debug("Updating template ManagedObject name to:"+name+" from property: "+prop);
- ManagedObject mo = prop.getManagedObject();
- if(mo instanceof MutableManagedObject)
- {
- MutableManagedObject mmo = (MutableManagedObject) mo;
- mmo.setName(name);
- }
- else
- {
- formatter.applyPattern(i18n.getString("ManagementView.InvalidTemplatePropertyMO")); //$NON-NLS-1$
- Object[] args = {prop.getName()};
- String msg = formatter.format(args);
- throw new IllegalArgumentException(msg);
- }
- }
- }
- }
-
- // Now apply the managed properties to get the deployment ManagedObjects
- Map<String, ManagedObject> mos = mainDeployer.getManagedObjects(ctx.getName());
- log.debug("applyTemplate, profile="+activeProfile+", deploymentBaseName="+deploymentBaseName+", :"+mos);
- // Map the
- String propName = info.getRootManagedPropertyName();
- if(propName != null)
- {
- // Flatten out the root objects
- ManagedObject rootMO = mos.get(ctx.getName());
- if(rootMO != null)
- flattenRootObject(rootMO, propName, mos);
- }
- for(ManagedProperty prop : info.getProperties().values())
- {
- // Skip null values
- if( prop.getValue() == null )
- continue;
-
- ManagedObject mo = prop.getManagedObject();
- if (mo == null)
- throw new IllegalArgumentException("Null managed object: " + prop);
-
- ManagedObject ctxMO = mos.get(mo.getName());
- if( ctxMO == null )
- {
- formatter.applyPattern(i18n.getString("ManagementView.InvalidTemplateKey")); //$NON-NLS-1$
- Object[] args = {mo.getName()};
- String msg = formatter.format(args);
- throw new IllegalArgumentException(msg);
- }
- ManagedProperty ctxProp = ctxMO.getProperty(prop.getName());
- // Check for a mapped name
- if( ctxProp == null )
- {
- String mappedName = prop.getMappedName();
- if( mappedName != null )
- ctxProp = ctxMO.getProperty(mappedName);
- }
- if( ctxProp == null )
- {
- formatter.applyPattern(i18n.getString("ManagementView.InvalidTemplateProperty")); //$NON-NLS-1$
- Object[] args = {prop.getName()};
- String msg = formatter.format(args);
- throw new IllegalArgumentException(msg);
- }
- // The property value must be a MetaValue
- Object value = prop.getValue();
- if ((value instanceof MetaValue) == false)
- {
- formatter.applyPattern(i18n.getString("ManagementView.InvalidPropertyValue")); //$NON-NLS-1$
- Object[] args = {prop.getName(), value.getClass()};
- String msg = formatter.format(args);
- throw new IllegalArgumentException(msg);
- }
- MetaValue metaValue = (MetaValue)value;
- ctxProp.setValue(metaValue);
-
- // todo - should this also dispatch to runtime component?
- Object componentName = getComponentName(ctxProp);
- if (componentName != null)
- dispatcher.set(componentName, ctxProp.getName(), metaValue);
- }
}
-
- /**
- * Process the changes made to the profile.
- *
- * @throws Exception
- */
- public void process() throws Exception
+
+ public void process() throws DeploymentException
{
mainDeployer.process();
mainDeployer.checkComplete();
- forceReload = true;
+ this.forceReload = true;
}
/**
@@ -1186,7 +1015,14 @@
// Persist the changed values
this.store.updateDeployment(compDeployment, serverComp);
+ // Force reload
+ this.forceReload = true;
}
+
+ public void removeComponent(ManagedComponent comp) throws Exception
+ {
+ // FIXME
+ }
/**
* Get the component name from managed property.
@@ -1325,11 +1161,6 @@
return opProxies;
}
- private ManagedDeployment getManagedDeployment(ProfileDeployment ctx)
- throws Exception
- {
- return mainDeployer.getManagedDeployment(ctx.getName());
- }
/**
* Take the root managed object and the associated deployment unit
* managed object map, and look to the root MO for a collection type
@@ -1421,6 +1252,11 @@
return delegate.getParameters();
}
}
+
+ private ManagedDeployment getManagedDeployment(ProfileDeployment ctx) throws DeploymentException
+ {
+ return mainDeployer.getManagedDeployment(ctx.getName());
+ }
private Profile getProfileForDeployment(String name) throws Exception
{
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/templates/DsXmlDataSourceTemplate.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -23,7 +23,6 @@
import java.io.File;
import java.io.FileWriter;
-import java.net.URI;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
@@ -38,6 +37,7 @@
import org.jboss.metatype.api.values.CompositeValue;
import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.util.xml.DOMWriter;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
@@ -49,14 +49,31 @@
*
* @author Scott.Stark at jboss.org
* @author adrian at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class DsXmlDataSourceTemplate
implements DeploymentTemplate
{
+ /** The logger. */
private static final Logger log = Logger.getLogger(DsXmlDataSourceTemplate.class);
+
+ /** The file suffix. */
+ private static final String FILE_SUFFIX = "-ds.xml";
+
+ /** The deployment template info. */
private DeploymentTemplateInfo info;
+ public String getDeploymentName(String deploymentBaseName)
+ {
+ if(deploymentBaseName == null)
+ throw new IllegalArgumentException("Null base name.");
+
+ if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
+ deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
+
+ return deploymentBaseName;
+ }
+
/**
* Creates a root/{deploymentBaseName}-ds.xml base descriptor.
*/
@@ -64,13 +81,19 @@
DeploymentTemplateInfo values)
throws Exception
{
- String dsName = deploymentBaseName+"-ds.xml";
- URI dsXmlURI = new URI(root.toURI()+dsName);
- File dsXml = new File(dsXmlURI.getPath());
+ return applyTemplate(values);
+ }
+
+ public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception
+ {
+ // Create a temp file
+ File dsXml = File.createTempFile(getClass().getSimpleName(), FILE_SUFFIX);
+ // Write template
writeTemplate(dsXml, values);
- return root.findChild(dsName);
+ // Return virtual file
+ return VFS.getRoot(dsXml.toURI());
}
-
+
/**
* There is no update of the ctx by this template since the data model
* is driven from the descriptor created by applyTemplate.
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/templates/JmsDestinationTemplate.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -23,10 +23,10 @@
import java.io.File;
import java.io.FileWriter;
-import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;
@@ -34,12 +34,14 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
+
import org.jboss.deployers.spi.management.DeploymentTemplate;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedProperty;
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
/**
@@ -51,7 +53,22 @@
public class JmsDestinationTemplate
implements DeploymentTemplate
{
+
+ /** The file suffix. */
+ private static final String FILE_SUFFIX = "-service.xml";
+
private DeploymentTemplateInfo info;
+
+ public String getDeploymentName(String deploymentBaseName)
+ {
+ if(deploymentBaseName == null)
+ throw new IllegalArgumentException("Null base name.");
+
+ if(deploymentBaseName.endsWith(FILE_SUFFIX) == false)
+ deploymentBaseName = deploymentBaseName + FILE_SUFFIX;
+
+ return deploymentBaseName;
+ }
public DeploymentTemplateInfo getInfo()
{
@@ -63,14 +80,21 @@
this.info = info;
}
- public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName, DeploymentTemplateInfo values)
+ public VirtualFile applyTemplate(VirtualFile root, String deploymentBaseName,
+ DeploymentTemplateInfo values)
throws Exception
{
- String dsName = deploymentBaseName + "-service.xml";
- URI dsXmlURI = new URI(root.toURI() + dsName);
- File dsXml = new File(dsXmlURI.getPath());
+ return applyTemplate(values);
+ }
+
+ public VirtualFile applyTemplate(DeploymentTemplateInfo values) throws Exception
+ {
+ // Create a temp file
+ File dsXml = File.createTempFile(getClass().getSimpleName(), FILE_SUFFIX);
+ // Write template
writeTemplate(dsXml, values);
- return root.findChild(dsName);
+ // Return virtual file
+ return VFS.getRoot(dsXml.toURI());
}
public void updateTemplateDeployment(VFSDeployment ctx, DeploymentTemplateInfo values) throws Exception
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractDeploymentManager.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractDeploymentManager.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/upload/AbstractDeploymentManager.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -146,7 +146,6 @@
*
* @return the transient profile meta data
*/
- @SuppressWarnings("deprecation")
protected ProfileMetaData createTransientProfileMetaData()
{
// Source
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -24,6 +24,7 @@
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -36,6 +37,7 @@
import org.jboss.profileservice.management.upload.remoting.DeployHandler;
import org.jboss.profileservice.management.upload.remoting.StreamingDeploymentTarget;
import org.jboss.profileservice.spi.DeploymentRepository;
+import org.jboss.profileservice.spi.MutableProfile;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
@@ -57,7 +59,7 @@
private static final String BUNDLE_NAME = "org.jboss.profileservice.management.upload.messages"; //$NON-NLS-1$
/** The currently loaded profile */
- private Profile activeProfile;
+ private MutableProfile activeProfile;
/** The profile repository. */
private ProfileRepository profileRepository;
@@ -176,15 +178,16 @@
return targets.get(0).getRepositoryNames(names);
}
- public boolean isRedeploySupported()
+ public boolean isRedeploySupported(ProfileKey key) throws NoSuchProfileException
{
+ // FIXME
return false;
}
public void loadProfile(ProfileKey key, boolean allowHotDeployments)
throws Exception
{
- activeProfile = ps.getProfile(key);
+ activeProfile = getProfile(key);
if( activeProfile == null )
{
formatter.applyPattern(i18n.getString("DeploymentManager.NoSuchProfileException")); //$NON-NLS-1$
@@ -205,7 +208,7 @@
public void releaseProfile(ProfileKey key, boolean allowHotDeployments)
throws Exception
{
- activeProfile = ps.getProfile(key);
+ activeProfile = getProfile(key);
if( activeProfile == null )
{
formatter.applyPattern(i18n.getString("DeploymentManager.NoSuchProfileException")); //$NON-NLS-1$
@@ -286,6 +289,19 @@
return new DeploymentProgressImpl(targets, deployment, type);
}
+ public MutableProfile getProfile(ProfileKey key) throws NoSuchProfileException
+ {
+ Profile profile = this.ps.getActiveProfile(key);
+ if(profile.isMutable() == false)
+ {
+ formatter.applyPattern(i18n.getString("DeploymentManager.NoProfileLoadedException")); //$NON-NLS-1$
+ Object[] args = {};
+ String msg = formatter.format(args);
+ throw new NoSuchProfileException(msg);
+ }
+ return (MutableProfile) profile;
+ }
+
/**
* TODO: should the targets include cluster info
* @param name
@@ -299,5 +315,11 @@
targets.add(hostTarget);
return targets;
}
+
+ public Collection<ProfileKey> getProfiles()
+ {
+ // FIXME
+ return this.ps.getActiveProfileKeys();
+ }
}
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/upload/SerializableDeploymentID.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -27,6 +27,7 @@
import java.util.Arrays;
import org.jboss.deployers.spi.management.deploy.DeploymentID;
+import org.jboss.profileservice.spi.ProfileKey;
/**
* @author Scott.Stark at jboss.org
@@ -48,10 +49,12 @@
{
this(deployment.getNames(), deployment.getDescription());
}
+
public SerializableDeploymentID(String name, String description)
{
this(new String[]{name}, description);
}
+
public SerializableDeploymentID(String[] names, String description)
{
this.deploymentNames = names;
@@ -75,6 +78,15 @@
this.repositoryNames = names;
}
+ /**
+ * The target profile for the deployment.
+ * For further use.
+ */
+ public ProfileKey getProfile()
+ {
+ return null;
+ }
+
public String getDescription()
{
return description;
@@ -93,7 +105,6 @@
{
return copyContent;
}
-
public void setCopyContent(boolean copyContent)
{
this.copyContent = copyContent;
@@ -126,7 +137,9 @@
if(getRepositoryNames() != getNames())
buffer.append(", repositoryNames=").append(Arrays.toString(getRepositoryNames()));
buffer.append(", copyContent=").append(copyContent);
- buffer.append(", description=").append(description);
+ if(description != null)
+ buffer.append(", description=").append(description);
return buffer.toString();
}
+
}
Modified: trunk/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/profileservice/src/main/org/jboss/profileservice/remoting/ProfileServiceInvocationHandler.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -21,8 +21,6 @@
*/
package org.jboss.profileservice.remoting;
-import java.security.Principal;
-
import org.jboss.aop.joinpoint.InvocationResponse;
import org.jboss.aspects.remoting.AOPRemotingInvocationHandler;
import org.jboss.deployers.spi.management.ManagementView;
@@ -39,7 +37,7 @@
* @see AOPRemotingInvocationHandler
*
* @author Scott.Stark at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public class ProfileServiceInvocationHandler extends AOPRemotingInvocationHandler
implements ServerInvocationHandler
Modified: trunk/profileservice/src/resources/profileservice-jboss-beans.xml
===================================================================
--- trunk/profileservice/src/resources/profileservice-jboss-beans.xml 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/profileservice/src/resources/profileservice-jboss-beans.xml 2009-02-27 21:02:33 UTC (rev 84894)
@@ -100,7 +100,6 @@
The ManagementView plugin
-->
<bean name="ManagementView" class="org.jboss.profileservice.management.ManagementViewImpl">
- <constructor><parameter><inject bean="BootstrapProfileFactory" property="templateRoot" /></parameter></constructor>
<install bean="ProfileService" method="setViewManager">
<parameter>
<this/>
@@ -114,6 +113,8 @@
<property name="mainDeployer"><inject bean="MainDeployer"/></property>
<property name="profileService"><inject bean="ProfileService"/></property>
<property name="attachmentStore"><inject bean="AttachmentStore" /></property>
+ <property name="deploymentManager"><inject bean="DeploymentManager"/></property>
+ <property name="defaultProfileKey"><inject bean="DefaultProfileKey"/></property>
<property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
<property name="dispatcher"><inject bean="RuntimeComponentDispatcher"/></property>
<property name="bootstrapManagedDeployments"><inject bean="ProfileServiceBootstrap" property="bootstrapMDs"/></property>
Modified: trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profile/repository/AbstractProfile.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -28,6 +28,7 @@
import org.jboss.profileservice.spi.DeploymentRepository;
import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.MutableProfile;
import org.jboss.profileservice.spi.NoSuchDeploymentException;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileDeployment;
@@ -40,7 +41,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class AbstractProfile implements Profile
+public class AbstractProfile implements MutableProfile
{
/** The profile key */
@@ -84,7 +85,7 @@
this.hotdeployEnabled = flag;
}
- public ProfileDeployment getDeployment(String name) throws Exception, NoSuchDeploymentException
+ public ProfileDeployment getDeployment(String name) throws NoSuchDeploymentException
{
if(name == null)
throw new IllegalArgumentException("Null name.");
@@ -96,7 +97,7 @@
return this.repository.getDeploymentNames();
}
- public Collection<ProfileDeployment> getDeployments() throws Exception
+ public Collection<ProfileDeployment> getDeployments()
{
return this.repository.getDeployments();
}
@@ -184,5 +185,10 @@
{
//
}
+
+ public boolean isMutable()
+ {
+ return true;
+ }
}
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -68,6 +68,7 @@
import org.jboss.metatype.api.values.ArrayValueSupport;
import org.jboss.metatype.api.values.EnumValue;
import org.jboss.metatype.api.values.EnumValueSupport;
+import org.jboss.profileservice.spi.MutableProfile;
import org.jboss.profileservice.spi.NoSuchProfileException;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
@@ -253,8 +254,8 @@
}
// Mark the profile as ready for hotdeployment if supported
Profile activeProfile = profileService.getActiveProfile(profileKey);
- if( activeProfile != null )
- activeProfile.enableModifiedDeploymentChecks(true);
+ if( activeProfile != null && activeProfile.isMutable())
+ ((MutableProfile)activeProfile).enableModifiedDeploymentChecks(true);
}
public void prepareShutdown(Server server)
Added: trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/attachments/AttachmentStore.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.system.server.profileservice.attachments;
+
+import java.net.URI;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.profileservice.spi.ProfileDeployment;
+
+/**
+ * The AttachmentStore.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface AttachmentStore
+{
+
+ /**
+ * Get the uri where the attachments are stored.
+ *
+ * @return the attachment store root.
+ */
+ URI getAttachmentStoreRoot();
+
+ /**
+ * Persist the changes of the managed component.
+ *
+ * @param deployment the profile deployment.
+ * @param comp the managed component.
+ * @throws Exception
+ */
+ void updateDeployment(ProfileDeployment deployment, ManagedComponent comp) throws Exception;
+
+ /**
+ * Create the deployment with the persisted attachments.
+ *
+ * @param deployment the profile deployment.
+ * @return the mc deployment.
+ * @throws Exception
+ */
+ Deployment loadDeploymentData(ProfileDeployment deployment) throws Exception;
+
+}
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -32,6 +32,7 @@
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
import org.jboss.profileservice.spi.ModificationInfo;
+import org.jboss.profileservice.spi.MutableProfile;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileDeployment;
import org.jboss.profileservice.spi.ProfileKey;
@@ -262,17 +263,20 @@
boolean modified = false;
for(ProfileKey key : activeProfiles)
{
- Profile activeProfile = profileService.getActiveProfile(key);
- if( activeProfile == null )
+ Profile profile = profileService.getActiveProfile(key);
+ if( profile == null || profile.isMutable() == false)
{
if( trace )
log.trace("End deployment scan, no activeProfile");
return;
}
+ MutableProfile activeProfile = (MutableProfile) profile;
// Current workaround for JBAS-4206
if(firstProfile == null)
firstProfile = activeProfile;
+
+
Collection<ModificationInfo> modifiedDeployments = activeProfile.getModifiedDeployments();
for(ModificationInfo info : modifiedDeployments)
{
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractAttachmentStore.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -49,9 +49,9 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedObject;
-import org.jboss.profileservice.spi.AttachmentStore;
import org.jboss.profileservice.spi.ProfileDeployment;
import org.jboss.system.server.profileservice.attachments.AttachmentMetaData;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
import org.jboss.system.server.profileservice.attachments.DeploymentClassPathMetaData;
import org.jboss.system.server.profileservice.attachments.DeploymentStructureMetaData;
import org.jboss.system.server.profileservice.attachments.LazyPredeterminedManagedObjects;
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractDeploymentRepository.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -133,6 +133,8 @@
throw new IllegalArgumentException("Null deployment");
this.applicationCtxs.put(vfsPath, d);
+ if(d.getRoot() != null)
+ this.applicationVFCache.put(d.getName(), d.getRoot());
updateLastModfied();
}
@@ -141,9 +143,14 @@
if(vfsPath == null)
throw new IllegalArgumentException("Null vfsPath");
- ProfileDeployment deployment = this.applicationCtxs.remove(vfsPath);
- if(deployment != null)
- updateLastModfied();
+ // Get the deployment
+ ProfileDeployment deployment = getDeployment(vfsPath);
+ // Remove the entries
+ this.applicationCtxs.remove(deployment.getName());
+ this.applicationVFCache.remove(deployment.getName());
+ // Update last modified
+ updateLastModfied();
+ // Return
return deployment;
}
@@ -217,21 +224,20 @@
ProfileDeployment ctx = this.applicationCtxs.get(vfsPath);
if(ctx == null)
{
- List<String> names = findDeploymentName(vfsPath);
+ List<String> names = findDeploymentContent(vfsPath);
if(names.size() == 1)
{
ctx = this.applicationCtxs.get(names.get(0));
}
else if(names.size() > 1)
{
- log.debug("Multiple deployments found for: "+vfsPath+", available: " + names);
- throw new NoSuchDeploymentException(vfsPath);
+ throw new NoSuchDeploymentException("Multiple deployments found for: "+vfsPath+", available: " + names);
}
}
if(ctx == null)
{
- log.debug("Failed to find application for: "+vfsPath+", available: " + applicationCtxs.values());
- throw new NoSuchDeploymentException(vfsPath);
+ log.debug("Failed to find application for: "+vfsPath+", available: " + applicationCtxs.keySet());
+ throw new NoSuchDeploymentException("Failed to find deployment in profile: "+ key + " filename: " + vfsPath);
}
return ctx;
}
@@ -251,7 +257,7 @@
return this.lastModified;
}
- public VirtualFile getDeploymentContent(String name) throws IOException, URISyntaxException
+ public VirtualFile getDeploymentContent(String name) throws IOException
{
if(name == null)
throw new IllegalArgumentException("Null name");
@@ -260,18 +266,15 @@
VirtualFile vf = this.applicationVFCache.get(name);
if(vf == null)
{
- for(String cacheName : this.applicationVFCache.keySet())
+ List<String> matchingNames = findDeploymentContent(name);
+ if(matchingNames.size() == 1)
{
- String fixedName = cacheName;
- if(cacheName.endsWith("/"))
- fixedName = cacheName.substring(0, cacheName.length() -1);
-
- if(fixedName.endsWith(name))
- {
- vf = this.applicationVFCache.get(cacheName);
- break;
- }
+ vf = this.applicationVFCache.get(matchingNames.get(0));
}
+ else if(matchingNames.size() > 1)
+ {
+ throw new FileNotFoundException("Multiple names found for name: " + name + ", available " + matchingNames);
+ }
}
if(vf == null)
throw new FileNotFoundException("Failed to find content in profile: "+ key + " filename: " + name);
@@ -287,14 +290,14 @@
Collection<String> tmp = new HashSet<String>();
for(String name : names)
{
- if(this.applicationCtxs.containsKey(name))
+ if(this.applicationVFCache.containsKey(name))
{
tmp.add(name);
}
else
{
// Try to find the name
- List<String> deploymentNames = findDeploymentName(name);
+ List<String> deploymentNames = findDeploymentContent(name);
if(deploymentNames != null)
tmp.addAll(deploymentNames);
}
@@ -302,19 +305,21 @@
return tmp.toArray(new String[tmp.size()]);
}
- protected List<String> findDeploymentName(String name)
+ protected List<String> findDeploymentContent(String name)
{
- List<String> tmp = new ArrayList<String>();
- for(ProfileDeployment d : this.applicationCtxs.values())
+ List<String> contents = new ArrayList<String>();
+ for(String cacheName : this.applicationVFCache.keySet())
{
- VirtualFile vf = d.getRoot();
- if(vf != null)
+ String fixedName = cacheName;
+ if(cacheName.endsWith("/"))
+ fixedName = cacheName.substring(0, cacheName.length() -1);
+
+ if(fixedName.endsWith(name))
{
- if(vf.getName().equals(name))
- tmp.add(d.getName());
+ contents.add(cacheName);
}
}
- return tmp;
+ return contents;
}
public int lockDeploymentContent(String vfsPath)
Added: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileAction.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.system.server.profileservice.repository;
+
+import org.jboss.logging.Logger;
+import org.jboss.profileservice.spi.Profile;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileAction
+{
+ /** The logger. */
+ protected final Logger log = Logger.getLogger(getClass());
+
+ public abstract void install(Profile profile) throws Exception;
+
+ public abstract void uninstall(Profile profile) throws Exception;
+
+ /**
+ * Install.
+ *
+ * @param context the profile context.
+ * @throws Exception
+ */
+ public void install(ProfileContext context) throws Exception
+ {
+ Profile profile = context.getProfile();
+ if(profile == null)
+ return;
+
+ // Install
+ install(profile);
+ }
+
+ /**
+ * Uninstall.
+ *
+ * @param context the profile context.
+ */
+ public void uninstall(ProfileContext context)
+ {
+ Profile profile = context.getProfile();
+ if(profile == null)
+ return;
+
+ try
+ {
+ // Uninstall
+ uninstall(profile);
+ }
+ catch (Throwable t)
+ {
+ log.error("Error when uninstalling profile: " + profile, t);
+ }
+ }
+}
+
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileFactory.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -47,6 +47,12 @@
/** The deployment repository factory. */
private ProfileRepository profileRepository;
+ public String[] getTypes()
+ {
+ // For further use
+ return null;
+ }
+
public ProfileRepository getProfileRepository()
{
return profileRepository;
Deleted: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.system.server.profileservice.repository;
-
-import org.jboss.logging.Logger;
-import org.jboss.profileservice.spi.Profile;
-
-/**
- * A abstract profile lifecycle action.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public abstract class AbstractProfileLifeCycleAction
-{
-
- /** The logger. */
- protected final Logger log = Logger.getLogger(getClass());
-
- public abstract void install(Profile profile) throws Exception;
-
- public abstract void uninstall(Profile profile) throws Exception;
-
- /**
- * Install.
- *
- * @param context the profile context.
- * @throws Exception
- */
- public void install(ProfileContext context) throws Exception
- {
- Profile profile = context.getProfile();
- if(profile == null)
- return;
-
- // Install
- install(profile);
- }
-
- /**
- * Uninstall.
- *
- * @param context the profile context.
- */
- public void uninstall(ProfileContext context)
- {
- Profile profile = context.getProfile();
- if(profile == null)
- return;
-
- try
- {
- // Uninstall
- uninstall(profile);
- }
- catch (Throwable t)
- {
- log.error("Error when uninstalling profile: " + profile, t);
- }
- }
-
-}
Copied: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java (from rev 84725, trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java)
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileLifeCycleAction.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.system.server.profileservice.repository;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.jboss.profileservice.spi.Profile;
+
+/**
+ * A abstract profile lifecycle action.
+ * TODO use jboss-reflect for this.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractProfileLifeCycleAction extends AbstractProfileAction
+{
+ private static final Class<?>[] methodTypes = new Class[0];
+ private static final Object[] args = new Object[0];
+
+ protected abstract String getInstallMethod();
+ protected abstract String getUninstallMethod();
+
+ @Override
+ public void install(Profile profile) throws Exception
+ {
+ invoke(profile, getInstallMethod());
+ }
+
+ @Override
+ public void uninstall(Profile profile) throws Exception
+ {
+ invoke(profile, getUninstallMethod());
+ }
+
+ protected static void invoke(Profile profile, String method) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
+ {
+ Method m = null;
+ try
+ {
+ m = profile.getClass().getMethod(method, methodTypes);
+ }
+ catch(NoSuchMethodException ignore)
+ {
+ return;
+ }
+ boolean isAccessible = m.isAccessible();
+ try
+ {
+ m.setAccessible(true);
+ m.invoke(profile, args);
+ }
+ finally
+ {
+ m.setAccessible(isAccessible);
+ }
+ }
+}
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -47,6 +47,7 @@
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.util.JBossStringBuilder;
/**
@@ -83,7 +84,7 @@
public static final ControllerState DEPLOY_STATE = new ControllerState("Deploy");
/** The profileActions. */
- private Map<ControllerState, AbstractProfileLifeCycleAction> profileActions = new HashMap<ControllerState, AbstractProfileLifeCycleAction>();
+ private Map<ControllerState, AbstractProfileAction> profileActions = new HashMap<ControllerState, AbstractProfileAction>();
/** The Logger. */
private final static Logger log = Logger.getLogger(AbstractProfileService.class);
@@ -218,8 +219,9 @@
if(this.deployer == null)
throw new IllegalStateException("Null main deployer.");
- // FIXME
+ // FIXME this should be moved to static actions
this.profileActions.put(ControllerState.CREATE, new ProfileCreateAction());
+ this.profileActions.put(ControllerState.START, new ProfileStartAction());
this.profileActions.put(DEPLOY_STATE, new ProfileDeployAction(deployer));
this.profileActions.put(ControllerState.INSTALLED, new ProfileInstallAction());
}
@@ -235,6 +237,21 @@
}
/**
+ * Create and register a profile.
+ *
+ * @param metaData the profile meta data.
+ * @throws Exception
+ */
+ public ProfileKey createProfile(ProfileMetaData metaData) throws Exception
+ {
+ if(metaData == null)
+ throw new IllegalArgumentException("Null meta data");
+
+ // FIXME
+ throw new IllegalStateException("NYI");
+ }
+
+ /**
* Register a Profile.
*
* @param profile the profile.
@@ -333,7 +350,7 @@
if(context instanceof ProfileContext == false)
return;
// TODO
- AbstractProfileLifeCycleAction action = this.profileActions.get(toState);
+ AbstractProfileAction action = this.profileActions.get(toState);
if(action != null)
action.install((ProfileContext) context);
}
@@ -343,7 +360,7 @@
if(context instanceof ProfileContext == false)
return;
// TODO
- AbstractProfileLifeCycleAction action = this.profileActions.get(fromState);
+ AbstractProfileAction action = this.profileActions.get(fromState);
if(action != null)
action.uninstall((ProfileContext) context);
}
@@ -545,7 +562,7 @@
/**
* A simple lifecycle action to add/remove a profile to the activeProfiles.
*/
- private class ProfileInstallAction extends AbstractProfileLifeCycleAction
+ private class ProfileInstallAction extends AbstractProfileAction
{
public void install(Profile profile) throws Exception
{
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/MainDeployerAdapter.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -24,8 +24,8 @@
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.profileservice.spi.AttachmentStore;
import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
/**
* A basic adapter for the MainDeployer.
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/MutableDeploymentRepository.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -262,7 +262,7 @@
VirtualFile root = deployment.getRoot();
if(root.delete() == false)
throw new IOException("Failed to delete: " + root);
- return super.removeDeployment(vfsPath);
+ return super.removeDeployment(deployment.getName());
}
public void remove() throws Exception
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileContext.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -31,6 +31,7 @@
import org.jboss.dependency.spi.DependencyItem;
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
/**
* The ProfileServiceContext.
@@ -40,7 +41,10 @@
*/
public class ProfileContext extends AbstractControllerContext
{
-
+
+ /** The profile meta data. */
+ private ProfileMetaData metaData;
+
/** The profile. */
private Profile profile;
@@ -57,7 +61,19 @@
setMode(ControllerMode.ON_DEMAND);
createDependencies(profile.getKey(), profile.getSubProfiles());
this.profile = profile;
+ // The profile
+ setTarget(profile);
}
+
+ public ProfileContext(ProfileKey key, ProfileMetaData metaData, ControllerContextActions actions)
+ {
+ super(key, actions);
+
+ if(this.metaData == null)
+ throw new IllegalArgumentException("Null meta data.");
+
+ this.metaData = metaData;
+ }
public Profile getProfile()
{
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileCreateAction.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -21,7 +21,6 @@
*/
package org.jboss.system.server.profileservice.repository;
-import org.jboss.profileservice.spi.Profile;
/**
* Basic profile create/destroy action.
@@ -32,30 +31,24 @@
public class ProfileCreateAction extends AbstractProfileLifeCycleAction
{
/** The instance. */
- private static final AbstractProfileLifeCycleAction INSTANCE = new ProfileCreateAction();
+ private static final ProfileCreateAction INSTANCE = new ProfileCreateAction();
- public static AbstractProfileLifeCycleAction getInstance()
+ public static ProfileCreateAction getInstance()
{
return INSTANCE;
}
@Override
- public void install(Profile profile) throws Exception
+ protected String getInstallMethod()
{
- // Internally create a profile
- if(log.isTraceEnabled())
- log.trace("creating profile: " + profile);
- profile.create();
+ return "create";
}
-
+
@Override
- public void uninstall(Profile profile)
+ protected String getUninstallMethod()
{
- // Internally destroy a profile
- if(log.isTraceEnabled())
- log.trace("destroying profile: " + profile);
- profile.destroy();
+ return "destroy";
}
-
+
}
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileDeployAction.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -33,7 +33,7 @@
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class ProfileDeployAction extends AbstractProfileLifeCycleAction
+public class ProfileDeployAction extends AbstractProfileAction
{
/** The profile deployment deployer. */
Added: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java (rev 0)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileStartAction.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.system.server.profileservice.repository;
+
+/**
+ * Basic start/stop action.
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileStartAction extends AbstractProfileLifeCycleAction
+{
+
+ /** The instance. */
+ private static final AbstractProfileLifeCycleAction INSTANCE = new ProfileStartAction();
+
+ public static AbstractProfileLifeCycleAction getInstance()
+ {
+ return INSTANCE;
+ }
+
+ @Override
+ protected String getInstallMethod()
+ {
+ return "start";
+ }
+
+ @Override
+ protected String getUninstallMethod()
+ {
+ return "stop";
+ }
+
+}
Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockAttachmentStore.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -27,8 +27,8 @@
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.managed.api.ManagedComponent;
-import org.jboss.profileservice.spi.AttachmentStore;
import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
/**
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/test/AbstractProfileServiceTestBase.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -28,9 +28,9 @@
import org.jboss.bootstrap.spi.Server;
import org.jboss.bootstrap.spi.ServerConfig;
import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.profileservice.spi.AttachmentStore;
import org.jboss.profileservice.spi.DeploymentRepositoryFactory;
import org.jboss.profileservice.spi.ProfileRepository;
+import org.jboss.system.server.profileservice.attachments.AttachmentStore;
import org.jboss.system.server.profileservice.repository.AbstractProfileFactory;
import org.jboss.test.BaseTestCase;
import org.jboss.test.server.profileservice.support.MockAttachmentStore;
Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/test/BootstrapProfileFactoryUnitTestCase.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -22,6 +22,7 @@
package org.jboss.test.server.profileservice.test;
import java.io.File;
+import java.lang.reflect.Method;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -101,7 +102,25 @@
// when loading the filtered repository in serverBaseDir.
for(Profile profile : profiles)
{
- profile.create();
+ Method m = null;
+ try
+ {
+ m = profile.getClass().getMethod("create", new Class[0]);
+ }
+ catch(NoSuchMethodException ignore)
+ {
+ return;
+ }
+ boolean isAccessible = m.isAccessible();
+ try
+ {
+ m.setAccessible(true);
+ m.invoke(profile, new Object[0]);
+ }
+ finally
+ {
+ m.setAccessible(isAccessible);
+ }
}
// TODO assert metadata
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/AbstractProfileServiceTest.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -87,22 +87,12 @@
stop(deployMgr, uploadedNames);
throw e;
}
- catch(Error e)
- {
- stop(deployMgr, uploadedNames);
- throw e;
- }
}
catch(Exception e)
{
undeploy(deployMgr, uploadedNames);
throw e;
}
- catch(Error e)
- {
- undeploy(deployMgr, uploadedNames);
- throw e;
- }
return uploadedNames;
}
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/ConnectionFactoryOverrideTestCase.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -57,7 +57,6 @@
// TODO test more properties.
managementView.updateComponent(component);
- managementView.process();
}
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -65,13 +65,11 @@
property.setValue(SimpleValueSupport.wrap(3000));
mgtView.updateComponent(component);
- mgtView.process();
}
catch(Throwable e)
{
getLog().error("Caugt exception: ", e);
- undeployPackage(new String[] {deploymentName});
throw e;
}
}
@@ -97,13 +95,11 @@
property.setValue(SimpleValueSupport.wrap(3000));
mgtView.updateComponent(component);
- mgtView.process();
}
catch(Throwable e)
{
getLog().error("Caugt exception: ", e);
- undeployPackage(new String[] {deploymentName});
throw e;
}
}
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/ProfileServiceOverrideTestCase.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -88,7 +88,6 @@
// update component
mgtView.updateComponent(mc);
- mgtView.process();
// See if the changes are reflected in the managedView after a reload
@@ -167,7 +166,6 @@
// updateComponent and process()
mgtView.updateComponent(mc);
- mgtView.process();
//
// Update 2nd DataSource
@@ -199,7 +197,6 @@
// updateComponent and process()
mgtView.updateComponent(mc);
- mgtView.process();
// See if the changes are reflected in the managedView after a reload
mgtView = getManagementView();
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/AbstractProfileServiceTest.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -56,6 +56,7 @@
{
super(name);
}
+
/**
* @return the ProfileKey.name to use when loading the profile
*/
@@ -75,11 +76,13 @@
{
DeploymentProgress progress = deployMgr.stop(names);
progress.run();
+ assertFalse("failed: " + progress.getDeploymentStatus().getFailure(), progress.getDeploymentStatus().isFailed());
}
finally
{
DeploymentProgress progress = deployMgr.remove(names);
progress.run();
+ assertFalse("failed: " + progress.getDeploymentStatus().getFailure(), progress.getDeploymentStatus().isFailed());
}
}
@@ -102,7 +105,6 @@
}
mgtView.applyTemplate(deploymentName, info);
- mgtView.process();
// reload the view
activeView = null;
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java 2009-02-27 19:34:50 UTC (rev 84893)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java 2009-02-27 21:02:33 UTC (rev 84894)
@@ -925,7 +925,6 @@
}
mgtView.applyTemplate(deploymentName, dsInfo);
- mgtView.process();
// reload the view
activeView = null;
More information about the jboss-cvs-commits
mailing list