You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2012/07/12 22:20:11 UTC
svn commit: r1360908 - in /geronimo/server/branches/3.0:
framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/eba/
framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/
p...
Author: gawor
Date: Thu Jul 12 20:20:11 2012
New Revision: 1360908
URL: http://svn.apache.org/viewvc?rev=1360908&view=rev
Log:
GERONIMO-6370: Additional functions 1) to get publish location of an application bundle, 2) to get application bundle id using the symbolic name and version
Modified:
geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/eba/EBADeploymentManager.java
geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java
geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java
Modified: geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/eba/EBADeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/eba/EBADeploymentManager.java?rev=1360908&r1=1360907&r2=1360908&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/eba/EBADeploymentManager.java (original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/eba/EBADeploymentManager.java Thu Jul 12 20:20:11 2012
@@ -28,6 +28,10 @@ public interface EBADeploymentManager {
public long[] getEBAContentBundleIds(AbstractName applicationGBeanName) throws Exception;
+ public long getEBAContentBundleId(AbstractName applicationGBeanName, String symbolicName, String version) throws Exception;
+
+ public File getEBAContentBundlePublishLocation(AbstractName applicationGBeanName, String symbolicName, String version) throws Exception;
+
public String getEBAContentBundleSymbolicName(AbstractName applicationGBeanName, long bundleId) throws Exception;
public void updateEBAContent(AbstractName applicationGBeanName, long bundleId, File bundleFile) throws Exception;
Modified: geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java?rev=1360908&r1=1360907&r2=1360908&view=diff
==============================================================================
--- geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java (original)
+++ geronimo/server/branches/3.0/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/ExtendedDeploymentManager.java Thu Jul 12 20:20:11 2012
@@ -285,17 +285,30 @@ public abstract class ExtendedDeployment
public long[] getEBAContentBundleIds(AbstractName applicationGBeanName) throws Exception {
long[] ids = (long[])kernel.getAttribute(applicationGBeanName, "applicationContentBundleIds");
-
return ids;
}
- public String getEBAContentBundleSymbolicName(AbstractName applicationGBeanName, long bundleId) throws Exception {
- Object name = kernel.invoke(applicationGBeanName, "getApplicationContentBundleSymbolicName", new Object[]{bundleId}, new String[]{long.class.getName()});
- if (name!=null) return (String)name;
-
- return null;
+ public long getEBAContentBundleId(AbstractName applicationGBeanName, String symbolicName, String version) throws Exception {
+ Object[] arguments = new Object[] {symbolicName, version};
+ String[] argumentTypes = new String[] {String.class.getName(), String.class.getName()};
+ Object result = kernel.invoke(applicationGBeanName, "getApplicationContentBundleId", arguments, argumentTypes);
+ return (result == null) ? -1 : (Long) result;
+ }
+
+ public File getEBAContentBundlePublishLocation(AbstractName applicationGBeanName, String symbolicName, String version) throws Exception {
+ Object[] arguments = new Object[] {symbolicName, version};
+ String[] argumentTypes = new String[] {String.class.getName(), String.class.getName()};
+ Object result = kernel.invoke(applicationGBeanName, "getApplicationContentBundlePublishLocation", arguments, argumentTypes);
+ return (File) result;
}
+ public String getEBAContentBundleSymbolicName(AbstractName applicationGBeanName, long bundleId) throws Exception {
+ Object[] arguments = new Object[] {bundleId};
+ String[] argumentTypes = new String[] {long.class.getName()};
+ Object name = kernel.invoke(applicationGBeanName, "getApplicationContentBundleSymbolicName", arguments, argumentTypes);
+ return (String) name;
+ }
+
/**
* Only support local bundle update
*/
Modified: geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java?rev=1360908&r1=1360907&r2=1360908&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java (original)
+++ geronimo/server/branches/3.0/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java Thu Jul 12 20:20:11 2012
@@ -135,8 +135,39 @@ public class ApplicationGBean implements
}
return ids;
}
+
+ public long getApplicationContentBundleId(String symbolicName, String version) {
+ Bundle bundle = findBundle(symbolicName, version);
+ return (bundle == null) ? -1 : bundle.getBundleId();
+ }
+
+ public File getApplicationContentBundlePublishLocation(String symbolicName, String version) {
+ Bundle bundle = findBundle(symbolicName, version);
+ if (bundle == null) {
+ return null;
+ }
+ File file = BundleUtils.toFile(bundle);
+ return (file != null && file.isDirectory()) ? file : null;
+ }
- private Bundle getBundle(long bundleId) {
+ private Bundle findBundle(String symbolicName, String version) {
+ if (symbolicName != null) {
+ for (Bundle content : applicationBundles) {
+ if (symbolicName.equals(content.getSymbolicName())) {
+ if (version == null) {
+ // if no version specified, return first one that matches
+ return content;
+ } else if (version.equals(content.getVersion().toString())) {
+ // version specified - match exactly
+ return content;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private Bundle findBundle(long bundleId) {
for (Bundle content : applicationBundles) {
if (content.getBundleId() == bundleId) {
return content;
@@ -146,7 +177,7 @@ public class ApplicationGBean implements
}
public String getApplicationContentBundleSymbolicName(long bundleId) {
- Bundle bundle = getBundle(bundleId);
+ Bundle bundle = findBundle(bundleId);
return (bundle != null) ? bundle.getSymbolicName() : null;
}
@@ -157,7 +188,7 @@ public class ApplicationGBean implements
* @param file new contents of the bundle.
*/
public synchronized void updateApplicationContent(long bundleId, File file) throws Exception {
- Bundle targetBundle = getBundle(bundleId);
+ Bundle targetBundle = findBundle(bundleId);
if (targetBundle == null) {
throw new IllegalArgumentException("Could not find bundle with id " + bundleId + " in the application");
}
@@ -174,7 +205,7 @@ public class ApplicationGBean implements
* @param updateArchive indicates if the application archive file should be updated with the changes.
*/
public synchronized boolean hotSwapApplicationContent(long bundleId, File changesFile, boolean updateArchive) throws Exception {
- Bundle targetBundle = getBundle(bundleId);
+ Bundle targetBundle = findBundle(bundleId);
if (targetBundle == null) {
throw new IllegalArgumentException("Could not find bundle with id " + bundleId + " in the application");
}