[jboss-cvs] JBossAS SVN: r83389 - trunk/cluster/src/main/org/jboss/ha/singleton.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 23 18:45:48 EST 2009
Author: emuckenhuber
Date: 2009-01-23 18:45:48 -0500 (Fri, 23 Jan 2009)
New Revision: 83389
Modified:
trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java
trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java
Log:
fix profile based ha-singleton prototype
Modified: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java 2009-01-23 23:45:05 UTC (rev 83388)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileActivator.java 2009-01-23 23:45:48 UTC (rev 83389)
@@ -206,7 +206,7 @@
{
try
{
- this.profileService.releaseProfile(getProfileKey());
+ this.profileService.deactivateProfile(getProfileKey());
}
catch (NoSuchProfileException e)
{
Modified: trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java 2009-01-23 23:45:05 UTC (rev 83388)
+++ trunk/cluster/src/main/org/jboss/ha/singleton/HASingletonProfileManager.java 2009-01-23 23:45:48 UTC (rev 83389)
@@ -24,7 +24,10 @@
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jboss.profileservice.spi.NoSuchProfileException;
@@ -34,8 +37,12 @@
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.AbstractProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.BasicProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.BasicSubProfileMetaData;
+import org.jboss.system.server.profile.repository.metadata.HotDeploymentProfileSourceMetaData;
+import org.jboss.system.server.profile.repository.metadata.ImmutableProfileSourceMetaData;
import org.jboss.system.server.profileservice.repository.AbstractProfileFactory;
-import org.jboss.system.server.profileservice.repository.DefaultDeploymentRepositoryFactory;
/**
* Extends {@link HASingletonProfileActivator} by actually creating and
@@ -138,12 +145,20 @@
URI[] rootURIs = uriList.toArray(new URI[uriList.size()]);
// TODO add dependencies on bootstrap profiles
String[] rootSubProfiles = new String[0];
- ProfileMetaData metadata = createProfileMetaData(DefaultDeploymentRepositoryFactory.MUTABLE_TYPE, rootURIs, rootSubProfiles);
+ // Create a hotdeployment profile
+ ProfileMetaData metadata = createProfileMetaData(true, rootURIs, rootSubProfiles);
- Profile profile = profileFactory.createProfile(getProfileKey(), metadata);
+ Profile profile = createProfileHack(getProfileKey(), metadata);
getProfileService().registerProfile(profile);
}
+ private Profile createProfileHack(ProfileKey key, ProfileMetaData metadata) throws Exception
+ {
+ Map<ProfileKey, Profile> profiles = new HashMap<ProfileKey, Profile>();
+ profileFactory.createProfile(profiles, Collections.EMPTY_LIST, key, metadata);
+ return profiles.get(key);
+ }
+
/**
* Unregisters the profile registered in {@link #start()}.
*/
@@ -183,24 +198,22 @@
* @param subProfiles a list of profile dependencies.
* @return the profile meta data.
*/
- private ProfileMetaData createProfileMetaData(String repositoryType, URI[] uris, String[] subProfiles)
+ private ProfileMetaData createProfileMetaData(boolean hotDeployment, URI[] uris, String[] subProfiles)
{
// Create profile
- ProfileMetaData metaData = new ProfileMetaData();
+ BasicProfileMetaData metaData = new BasicProfileMetaData();
metaData.setDomain(getProfileDomain());
metaData.setServer(getProfileServer());
metaData.setName(getProfileName());
// Create profile sources
- List<ProfileSourceMetaData> sources = new ArrayList<ProfileSourceMetaData>();
- for(URI uri : uris)
- sources.add(createSource(repositoryType, uri));
- metaData.setSources(sources);
+ ProfileSourceMetaData source = createSource(uris, hotDeployment);
+ metaData.setSource(source);
List<SubProfileMetaData> profileList = new ArrayList<SubProfileMetaData>();
for(String subProfile : subProfiles)
{
- SubProfileMetaData md = new SubProfileMetaData();
+ BasicSubProfileMetaData md = new BasicSubProfileMetaData();
md.setName(subProfile);
profileList.add(md);
}
@@ -216,11 +229,21 @@
* @param uri the uri
* @return the profile source meta data.
*/
- private ProfileSourceMetaData createSource(String type, URI uri)
+ protected ProfileSourceMetaData createSource(URI[] uris, boolean hotDeployment)
{
- ProfileSourceMetaData source = new ProfileSourceMetaData();
- source.setType(type);
- source.setSource(uri.toString());
+ AbstractProfileSourceMetaData source = null;
+ if(hotDeployment)
+ {
+ source = new HotDeploymentProfileSourceMetaData();
+ }
+ else
+ {
+ source = new ImmutableProfileSourceMetaData();
+ }
+ List<String> sources = new ArrayList<String>();
+ for(URI uri : uris)
+ sources.add(uri.toString());
+ source.setSources(sources);
return source;
}
More information about the jboss-cvs-commits
mailing list