[jboss-cvs] JBossAS SVN: r93976 - in branches/Branch_5_x: system/src/main/org/jboss/system/server/profileservice/repository and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Sep 24 04:47:58 EDT 2009
Author: emuckenhuber
Date: 2009-09-24 04:47:58 -0400 (Thu, 24 Sep 2009)
New Revision: 93976
Modified:
branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java
branches/Branch_5_x/system/src/main/org/jboss/system/tools/ProfileServiceDeploymentRepositoryAdapter.java
branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java
Log:
JBAS-7286
Modified: branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml
===================================================================
--- branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml 2009-09-24 08:12:05 UTC (rev 93975)
+++ branches/Branch_5_x/profileservice/src/resources/hdscanner-jboss-beans.xml 2009-09-24 08:47:58 UTC (rev 93976)
@@ -28,6 +28,7 @@
<parameter><inject bean="ProfileService"/></parameter>
<parameter><inject bean="StructureModificationChecker"/></parameter>
</constructor>
+ <property name="profileRepository"><inject bean="ProfileRepositoryFactory" /></property>
</bean>
</deployment>
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java 2009-09-24 08:12:05 UTC (rev 93975)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/TypedProfileRepository.java 2009-09-24 08:47:58 UTC (rev 93976)
@@ -141,4 +141,45 @@
this.repositoryFactories.remove(type);
}
+ /**
+ * InCallback to register a repository bean.
+ *
+ * @param repository the deploymentRepository to register
+ */
+ public void registerDeploymentRepository(AbstractDeploymentRepository repository)
+ {
+ if(repository == null)
+ throw new IllegalArgumentException("null deployment repository");
+ ProfileKey repositoryKey = repository.getProfileKey();
+ if(repositoryKey == null)
+ throw new IllegalArgumentException("null profile key");
+ if(this.repositories.containsKey(repositoryKey))
+ throw new IllegalStateException("duplicate repository " + repositoryKey);
+
+ this.repositories.put(repositoryKey, repository);
+ }
+
+ /**
+ * UnInCallback to unregister a repository bean.
+ *
+ * @param repository the deploymentRepository to unregister
+ */
+ public void unregisterDeploymentRepository(AbstractDeploymentRepository repository)
+ {
+ if(repository == null)
+ throw new IllegalArgumentException("null deployment repository");
+ ProfileKey repositoryKey = repository.getProfileKey();
+ if(repositoryKey == null)
+ throw new IllegalArgumentException("null profile key");
+
+ this.unregisterDeploymentRepository(repositoryKey);
+ }
+
+ public void unregisterDeploymentRepository(ProfileKey repositoryKey)
+ {
+ if(repositoryKey == null)
+ throw new IllegalArgumentException("null profile key");
+ this.repositories.remove(repositoryKey);
+ }
+
}
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/tools/ProfileServiceDeploymentRepositoryAdapter.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/tools/ProfileServiceDeploymentRepositoryAdapter.java 2009-09-24 08:12:05 UTC (rev 93975)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/tools/ProfileServiceDeploymentRepositoryAdapter.java 2009-09-24 08:47:58 UTC (rev 93976)
@@ -21,6 +21,7 @@
*/
package org.jboss.system.tools;
+import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -42,6 +43,8 @@
import org.jboss.profileservice.spi.ProfileService;
import org.jboss.system.server.profileservice.hotdeploy.Scanner;
import org.jboss.system.server.profileservice.repository.HotDeploymentRepository;
+import org.jboss.system.server.profileservice.repository.TypedProfileRepository;
+import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
/**
@@ -57,6 +60,7 @@
private Scanner scanner;
private ProfileService ps;
+ private TypedProfileRepository repositories;
private StructureModificationChecker checker;
private DeploymentScannerProfile profile;
@@ -74,6 +78,16 @@
this.ps = ps;
this.checker = checker;
}
+
+ public TypedProfileRepository getProfileRepository()
+ {
+ return repositories;
+ }
+
+ public void setProfileRepository(TypedProfileRepository repositories)
+ {
+ this.repositories = repositories;
+ }
/**
* Create profile.
@@ -112,6 +126,9 @@
log.debug("Activating deployment scanner profile " + profileName);
this.ps.activateProfile(profileName);
this.ps.validateProfile(profileName);
+ // Expose the profile to the DeploymentManager
+ if(this.repositories != null)
+ this.repositories.registerDeploymentRepository(profile);
}
public void resume()
@@ -129,6 +146,9 @@
*/
public void stopProfile()
{
+ // Unregister the profile
+ if(this.repositories != null)
+ this.repositories.unregisterDeploymentRepository(profile);
try
{
// Deactivate
@@ -259,7 +279,7 @@
return super.getModifiedDeployments();
}
-
+
@Override
protected void checkForAdditions(List<ModificationInfo> modified) throws Exception
{
@@ -314,6 +334,49 @@
newCache.put(applicationDir, files);
}
+ @Override
+ protected List<String> findDeploymentContent(String name)
+ {
+ // FIXME this should not be done here
+ // Try to find the VirtualFile, as we only add real file urls
+ VirtualFile cached = getCachedVirtualFile(name);
+ if(cached != null)
+ {
+ try {
+ name = cached.toURI().toString();
+ } catch(Exception ignore) { }
+ return Collections.singletonList(name);
+ }
+
+ List<String> contents = new ArrayList<String>();
+ for(URI uri : this.uris)
+ {
+ String cacheName = uri.toString();
+ String fixedName = cacheName;
+ if(cacheName.endsWith("/"))
+ fixedName = cacheName.substring(0, cacheName.length() -1);
+
+ if(fixedName.endsWith(name))
+ {
+ VirtualFile vf = getCachedVirtualFile(cacheName);
+ if(vf != null)
+ {
+ try {
+ contents.add(vf.toURI().toString());
+ } catch(Exception ignore) { }
+ }
+ }
+ }
+ return contents;
+ }
+
+ @Override
+ public ProfileDeployment removeDeployment(String vfsPath) throws Exception
+ {
+ // We don't remove the actual deployment content
+ return super.removeDeployment(vfsPath, false);
+ }
+
public ProfileKey getKey()
{
return profileName;
Modified: branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java
===================================================================
--- branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java 2009-09-24 08:12:05 UTC (rev 93975)
+++ branches/Branch_5_x/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java 2009-09-24 08:47:58 UTC (rev 93976)
@@ -246,7 +246,6 @@
return null;
}
- @Override
public void stop() throws IllegalStateException, Exception
{
this.shutdown();
More information about the jboss-cvs-commits
mailing list