[jboss-cvs] JBossAS SVN: r84499 - in trunk: system/src/main/org/jboss/system/server/profileservice and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 20 04:06:42 EST 2009
Author: emuckenhuber
Date: 2009-02-20 04:06:42 -0500 (Fri, 20 Feb 2009)
New Revision: 84499
Modified:
trunk/server/src/etc/conf/default/bootstrap/profile.xml
trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java
Log:
externalize the default profile key handling
Modified: trunk/server/src/etc/conf/default/bootstrap/profile.xml
===================================================================
--- trunk/server/src/etc/conf/default/bootstrap/profile.xml 2009-02-20 08:14:05 UTC (rev 84498)
+++ trunk/server/src/etc/conf/default/bootstrap/profile.xml 2009-02-20 09:06:42 UTC (rev 84499)
@@ -28,15 +28,22 @@
<property name="attachmentStoreRoot">${jboss.server.data.dir}/attachments</property>
<property name="profileFactory"><inject bean="ProfileFactory" /></property>
</bean>
+
+ <!-- The default profile key -->
+ <bean name="DefaultProfileKey" class="org.jboss.profileservice.spi.ProfileKey">
+ <constructor><parameter>${jboss.server.name}</parameter></constructor>
+ </bean>
<!-- The ProfileService -->
<bean name="ProfileService" class="org.jboss.system.server.profileservice.repository.AbstractProfileService">
<constructor><parameter><inject bean="jboss.kernel:service=KernelController" /></parameter></constructor>
<property name="deployer"><inject bean="ProfileServiceDeployer" /></property>
+ <property name="defaultProfile"><inject bean="DefaultProfileKey" /></property>
</bean>
<!-- The Bootstrap implementation that loads the Profile from the ProfileService -->
<bean name="ProfileServiceBootstrap" class="org.jboss.system.server.profileservice.ProfileServiceBootstrap">
+ <property name="profileKey"><inject bean="DefaultProfileKey" /></property>
<property name="mainDeployer"><inject bean="MainDeployer" /></property>
<property name="profileService"><inject bean="ProfileService" /></property>
<property name="mof"><inject bean="ManagedObjectFactory" /></property>
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-20 08:14:05 UTC (rev 84498)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-02-20 09:06:42 UTC (rev 84499)
@@ -89,9 +89,6 @@
/** The log */
private static final Logger log = Logger.getLogger(ProfileServiceBootstrap.class);
- /** The name of the profile that is being booted */
- protected String profileName;
-
/** The root profile key. */
protected ProfileKey profileKey;
@@ -152,13 +149,14 @@
this.profileService = profileService;
}
- public String getProfileName()
+ public ProfileKey getProfileKey()
{
- return profileName;
+ return profileKey;
}
- public void setProfileName(String profileName)
+
+ public void setProfileKey(ProfileKey profileKey)
{
- this.profileName = profileName;
+ this.profileKey = profileKey;
}
public ManagedObjectFactory getMof()
@@ -219,10 +217,9 @@
// Expose the bootstrap ManagedDeployments
initBootstrapMDs(server);
- // Load the profile
- if(profileName == null)
- profileName = server.getConfig().getServerName();
- this.profileKey = new ProfileKey(profileName);
+ // Load the profiles
+ if(this.profileKey == null)
+ this.profileKey = new ProfileKey(server.getConfig().getServerName());
Map<String, Object> metaData = server.getMetaData();
ProfileMetaData pmd = (ProfileMetaData) metaData.get(ProfileMetaData.class.getName());
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-20 08:14:05 UTC (rev 84498)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/AbstractProfileService.java 2009-02-20 09:06:42 UTC (rev 84499)
@@ -58,6 +58,9 @@
public class AbstractProfileService implements ProfileService, ControllerContextActions
{
+ /** The default profile. */
+ private ProfileKey defaultProfile;
+
/** The registered profiles. */
private Map<ProfileKey, ProfileContext> registeredProfiles = new ConcurrentHashMap<ProfileKey, ProfileContext>();
@@ -93,6 +96,16 @@
this.controller = new ScopedProfileServiceController(controller);
}
+ public ProfileKey getDefaultProfile()
+ {
+ return defaultProfile;
+ }
+
+ public void setDefaultProfile(ProfileKey defaultProfile)
+ {
+ this.defaultProfile = defaultProfile;
+ }
+
public MainDeployerAdapter getDeployer()
{
return deployer;
@@ -182,9 +195,12 @@
ProfileContext profile = null;
if(this.activeProfiles.contains(key))
- {
profile = (ProfileContext) controller.getInstalledContext(key);
- }
+
+ // If the key is a default key, fallback to the injected default key
+ if(key.isDefaultKey() && this.defaultProfile != null)
+ profile = (ProfileContext) controller.getInstalledContext(this.defaultProfile);
+
if(profile == null)
throw new NoSuchProfileException("Profile not installed: " + key);
return profile.getProfile();
More information about the jboss-cvs-commits
mailing list