[jboss-cvs] JBossAS SVN: r83745 - trunk/cluster/src/main/org/jboss/ha/singleton.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Feb 1 09:46:31 EST 2009
Author: emuckenhuber
Date: 2009-02-01 09:46:30 -0500 (Sun, 01 Feb 2009)
New Revision: 83745
Removed:
trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java
Modified:
trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java
Log:
update profileservice-spi and changes to use a ProfileDeployment instead of VFSDeployment
Deleted: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java 2009-02-01 14:43:17 UTC (rev 83744)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonDeploymentScanner.java 2009-02-01 14:46:30 UTC (rev 83745)
@@ -1,229 +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.ha.singleton;
-
-import java.net.URI;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.Profile;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.system.server.profileservice.VFSScanner;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * VFSScanner that exposes methods whereby an HASingletonController
- * can trigger the deployment or undeployment.
- *
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class HASingletonDeploymentScanner extends VFSScanner implements HASingletonDeploymentScannerMBean
-{
- private static final DeploymentPhase DEPLOYMENT_PHASE = DeploymentPhase.APPLICATION;
-
- private DeploymentManager deploymentManager;
-
- private boolean deployed;
-
- private ProfileKey activeProfile;
-
- private Set<String> uploadedNames = new LinkedHashSet<String>();
-
- /**
- * Create a new HASingletonDeploymentScanner.
- *
- */
- public HASingletonDeploymentScanner()
- {
- super();
- }
-
- // ---------------------------------------------------------- Properties
-
-
- @Override
- public void setProfileService(ProfileService profileService)
- {
- super.setProfileService(profileService);
- if (profileService != null)
- {
- // In case someone forgot to dependency inject DeploymentManager
- // AND we're lucky enough that the DeploymentManager is already
- // installed into the ProfileService
- if (this.deploymentManager == null)
- {
- this.deploymentManager = profileService.getDeploymentManager();
- }
- }
- else
- {
- this.deploymentManager = null;
- }
- }
-
- public DeploymentManager getDeploymentManager()
- {
- return deploymentManager;
- }
-
- public void setDeploymentManager(DeploymentManager deploymentManager)
- {
- this.deploymentManager = deploymentManager;
- }
-
- // ----------------------------------------------------------------- Public
-
- /**
- * Deploy the content under the given URIs. Called by the
- * HASingletonController when we become the singleton master.
- *
- * @param uris comma delimited list of URIs containing content to deploy
- */
- public synchronized void deploySingletons(String uris) throws Exception
- {
- if (!this.deployed)
- {
- if (this.deploymentManager == null)
- {
- throw new IllegalStateException("Configuration must either provide " +
- "a ProfileService with a DeploymentManager or directly inject a DeploymentManager");
- }
-
- StringTokenizer tokenizer = new StringTokenizer(uris, ",");
- while (tokenizer.hasMoreTokens())
- {
- String uri = tokenizer.nextToken();
- uri = uri.trim();
- addURI(new URI(uri));
- }
-
- scan();
-
- String[] allUploaded = getAllUploadedNames();
- if (allUploaded.length > 0) // JBAS-6441
- {
- DeploymentProgress progress = this.deploymentManager.start(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- }
-
- this.deployed = true;
- }
- }
-
- /**
- * Undeploy the content under the given URIs. Called by the
- * HASingletonController when we are no longer the singleton master.
- *
- * @param uris comma delimited list of URIs containing content to deploy
- */
- public synchronized void undeploySingletons(String uris) throws Exception
- {
- if (this.deployed)
- {
- if (this.deploymentManager == null)
- {
- throw new IllegalStateException("Configuration must either provide " +
- "a ProfileService with a DeploymentManager or directly inject a DeploymentManager");
- }
-
- StringTokenizer tokenizer = new StringTokenizer(uris, ",");
- while (tokenizer.hasMoreTokens())
- {
- String uri = tokenizer.nextToken();
- uri = uri.trim();
- removeURI(new URI(uri));
- }
-
- scan();
-
- String[] allUploaded = getAllUploadedNames();
-
- this.uploadedNames.clear();
-
- if (allUploaded.length > 0) // JBAS-6441
- {
- DeploymentProgress progress = this.deploymentManager.stop(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- progress = this.deploymentManager.undeploy(DEPLOYMENT_PHASE, allUploaded);
- progress.run();
- }
-
- this.deployed = false;
- }
- }
-
- // ---------------------------------------------------- Protected Overrides
-
- @Override
- protected VFSDeployment add(Profile profile, VirtualFile file) throws Exception
- {
- VFSDeployment deployment = createDeployment(file);
-
- activateProfile(profile.getKey());
-
- String name = file.getPathName();
- DeploymentProgress progress = this.deploymentManager.distribute(name, DEPLOYMENT_PHASE, file.toURL(), true);
- progress.run();
-
- String[] repoNames = progress.getDeploymentID().getRepositoryNames();
- if (repoNames != null)
- {
- for (String repoName : repoNames)
- {
- uploadedNames.add(repoName);
- }
- }
-
- return deployment;
- }
-
- @Override
- protected void remove(Profile profile, String name) throws Exception
- {
- // we deal with everything at the end of undeploySingletons
- }
-
- // ---------------------------------------------------------------- Private
-
- private void activateProfile(ProfileKey key) throws Exception
- {
- if (activeProfile != key)
- {
- this.deploymentManager.loadProfile(key, false);
- activeProfile = key;
- }
- }
-
- private String[] getAllUploadedNames()
- {
- String[] result = new String[this.uploadedNames.size()];
- return this.uploadedNames.toArray(result);
- }
-
-}
Modified: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java 2009-02-01 14:43:17 UTC (rev 83744)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java 2009-02-01 14:46:30 UTC (rev 83745)
@@ -166,8 +166,7 @@
releaseProfile();
}
- Profile profile = profSvc.getProfile(profKey);
- profSvc.unregisterProfile(profile);
+ profSvc.unregisterProfile(profKey);
}
catch (NoSuchProfileException e)
{
More information about the jboss-cvs-commits
mailing list