Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2011-03-11 11:24:57 -0500
committerChristopher Frost2011-03-11 11:24:57 -0500
commitfff538d6c2ab1113f5cfb666788f3d13e068f381 (patch)
tree94d4f4ad826a24144818ddd492e39247c3240764
parent8f662da298766ba663140514fcd177af1c2098a5 (diff)
downloadorg.eclipse.virgo.kernel-337846-RescanRepo.tar.gz
org.eclipse.virgo.kernel-337846-RescanRepo.tar.xz
org.eclipse.virgo.kernel-337846-RescanRepo.zip
337846 Proposed fix to rescan watched repos before any artifact install or refresh337846-RescanRepo
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java44
1 files changed, 42 insertions, 2 deletions
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
index b3498220..748f6c0e 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
@@ -12,9 +12,19 @@
package org.eclipse.virgo.kernel.deployer.core.internal;
import java.io.File;
+import java.lang.management.ManagementFactory;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.JMX;
+import javax.management.MBeanException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
import org.osgi.framework.Version;
@@ -42,6 +52,7 @@ import org.eclipse.virgo.kernel.install.environment.InstallEnvironment;
import org.eclipse.virgo.kernel.install.environment.InstallEnvironmentFactory;
import org.eclipse.virgo.kernel.install.pipeline.Pipeline;
import org.eclipse.virgo.medic.eventlog.EventLogger;
+import org.eclipse.virgo.repository.management.Repository;
import org.eclipse.virgo.util.common.Tree;
import org.eclipse.virgo.util.io.PathReference;
@@ -133,6 +144,7 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
}
private DeploymentIdentity doInstall(URI normalisedUri, DeploymentOptions deploymentOptions) throws DeploymentException {
+ updateWatchedRepositories();
synchronized (this.monitor) {
InstallArtifact existingArtifact = this.ram.get(normalisedUri);
@@ -549,13 +561,41 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
}
private void stopArtifact(InstallArtifact installArtifact) throws DeploymentException {
-
installArtifact.stop();
-
}
private void uninstallArtifact(InstallArtifact installArtifact) throws DeploymentException {
installArtifact.uninstall();
}
+
+ private void updateWatchedRepositories(){
+ MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
+ try {
+ Set<ObjectName> objectNames = mBeanServer.queryNames(new ObjectName("org.eclipse.virgo.kernel:type=Repository,*"), null);
+ for (ObjectName objectName : objectNames) {
+ Repository repo = JMX.newMXBeanProxy(mBeanServer, objectName, Repository.class);
+ if(repo != null && "Watched".equals(repo.type())){
+ try {
+ mBeanServer.invoke(objectName, "forceCheck", new Object[0], new String[0]);
+ } catch (InstanceNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ReflectionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (MBeanException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ } catch (MalformedObjectNameException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (NullPointerException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
}

Back to the top