[jboss-cvs] JBossAS SVN: r85618 - in branches/Branch_5_x/profileservice/src: main/org/jboss/profileservice/management/upload/remoting and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Mar 8 12:09:31 EDT 2009
Author: emuckenhuber
Date: 2009-03-08 12:09:31 -0400 (Sun, 08 Mar 2009)
New Revision: 85618
Modified:
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties
branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml
Log:
only return profiles with a deploymentRepository as available profiles from deploymentManager
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java 2009-03-08 12:58:29 UTC (rev 85617)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentManagerImpl.java 2009-03-08 16:09:31 UTC (rev 85618)
@@ -36,12 +36,12 @@
import org.jboss.deployers.spi.management.deploy.DeploymentStatus.CommandType;
import org.jboss.logging.Logger;
import org.jboss.profileservice.management.upload.remoting.StreamingDeploymentTarget;
-import org.jboss.profileservice.spi.MutableProfile;
+import org.jboss.profileservice.spi.DeploymentRepository;
import org.jboss.profileservice.spi.NoSuchProfileException;
-import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.ProfileRepository;
import org.jboss.remoting.InvokerLocator;
+import org.jboss.system.server.profileservice.repository.MutableDeploymentRepository;
/**
* The remoting base DeploymentManager implementation.
@@ -57,10 +57,10 @@
/** The bundle name. */
private static final String BUNDLE_NAME = "org.jboss.profileservice.management.upload.messages"; //$NON-NLS-1$
+
+ /** The profile repository. */
+ private ProfileRepository profileRepository;
- /** The profile service. */
- private ProfileService ps;
-
/** The default profile key to upload contents. */
private ProfileKey defaultKey;
/** The loaded profile key. */
@@ -94,13 +94,14 @@
this.defaultKey = defaultKey;
}
- public ProfileService getProfileService()
+ public ProfileRepository getProfileRepository()
{
- return this.ps;
+ return profileRepository;
}
- public void setProfileService(ProfileService ps)
+
+ public void setProfileRepository(ProfileRepository profileRepository)
{
- this.ps = ps;
+ this.profileRepository = profileRepository;
}
public InvokerLocator getLocator()
@@ -122,21 +123,23 @@
}
/**
- * Get the mutable profile keys.
+ * Get the available profiles with a DeploymentRepository.
*/
public Collection<ProfileKey> getProfiles()
{
Collection<ProfileKey> mutableProfiles = new HashSet<ProfileKey>();
- for( ProfileKey key : this.ps.getActiveProfileKeys())
+ for(ProfileKey key : this.profileRepository.getProfileKeys())
{
// Exclude the transient profile
if(key.equals(AbstractTransientProfileManager.TRANSIENT_PROFILE_KEY))
continue;
-
+
try
{
- Profile profile = this.ps.getActiveProfile(key);
- if(profile.isMutable())
+ // TODO this should not be needed once there are different implementations used for profiles.
+ DeploymentRepository repo = this.profileRepository.getProfileDeploymentRepository(key);
+ // TODO we can only use MutableDeploymentRepositories as target for now.
+ if(repo instanceof MutableDeploymentRepository)
mutableProfiles.add(key);
}
catch(NoSuchProfileException ignore)
@@ -200,11 +203,11 @@
if(key.isDefaultKey() && this.defaultKey != null)
key = this.defaultKey;
- // Get the mutable profile
- MutableProfile profile = getProfile(key);
+ // Check if we have a associated DeploymentRepository
+ checkProfile(key);
// Set the key
- this.activeProfileKey = profile.getKey();
+ this.activeProfileKey = key;
}
public void releaseProfile()
@@ -278,23 +281,21 @@
}
/**
- * Get a mutable profile
+ * Check if the Profile has a associated DeploymentRepository.
+ * This will be needed by the DeployHandler to add the deployment content.
*
* @param key the profile key
- * @return the mutable profile
* @throws NoSuchProfileException if the profile does not exist or is not mutable
*/
- public MutableProfile getProfile(ProfileKey key) throws NoSuchProfileException
+ public void checkProfile(ProfileKey key) throws NoSuchProfileException
{
- Profile profile = this.ps.getActiveProfile(key);
- if(profile.isMutable() == false)
+ if(getProfiles().contains(key) == false)
{
formatter.applyPattern(i18n.getString("DeploymentManager.NoMutableProfileException")); //$NON-NLS-1$
- Object[] args = {};
+ Object[] args = { key };
String msg = formatter.format(args);
throw new NoSuchProfileException(msg);
}
- return (MutableProfile) profile;
}
/**
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties 2009-03-08 12:58:29 UTC (rev 85617)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/messages.properties 2009-03-08 16:09:31 UTC (rev 85618)
@@ -1,3 +1,4 @@
# resource bundle for the DeploymentManager
+DeploymentManager.NoProfileLoadedException=No profile loaded.
DeploymentManager.NoSuchProfileException=Failed to find profile for key: {0}
DeploymentManager.NoMutableProfileException=Profile does not support deployment actions: {0}
\ No newline at end of file
Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java 2009-03-08 12:58:29 UTC (rev 85617)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java 2009-03-08 16:09:31 UTC (rev 85618)
@@ -34,7 +34,6 @@
import org.jboss.deployers.spi.management.deploy.DeploymentID;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
import org.jboss.profileservice.management.upload.SerializableDeploymentID;
import org.jboss.profileservice.spi.DeploymentRepository;
import org.jboss.profileservice.spi.NoSuchProfileException;
@@ -150,7 +149,7 @@
}
else
{
- Map payload = request.getRequestPayload();
+ Map<?, ?> payload = request.getRequestPayload();
DeploymentID dtID = (DeploymentID) payload.get("DeploymentTargetID");
log.debug("invoke, payload: "+payload+", parameter: "+parameter);
try
Modified: branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml 2009-03-08 12:58:29 UTC (rev 85617)
+++ branches/Branch_5_x/profileservice/src/resources/profileservice-jboss-beans.xml 2009-03-08 16:09:31 UTC (rev 85618)
@@ -125,7 +125,7 @@
</parameter>
</uninstall>
<property name="defaultProfileKey"><inject bean="ApplicationsProfileKey"/></property>
- <property name="profileService"><inject bean="ProfileService"/></property>
+ <property name="profileRepository"><inject bean="ProfileRepositoryFactory"/></property>
<property name="locator"><inject bean="ConnectorMBean" property="invokerLocator"/></property>
<property name="remotingSubsystem">DeploymentManager</property>
</bean>
More information about the jboss-cvs-commits
mailing list