You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by jg...@apache.org on 2006/02/20 04:18:22 UTC
svn commit: r379004 - in
/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task:
DeployedAssembliesTask.java InstallAssemblyTask.java ListComponentTask.java
ListEnginesTask.java ListLibrariesTask.java
Author: jgapuz
Date: Sun Feb 19 19:18:19 2006
New Revision: 379004
URL: http://svn.apache.org/viewcvs?rev=379004&view=rev
Log:
- fixed ListEnginesTask, ListComponentTask, ListLibrariesTask and DeployedAssembliesTask.
- change archivepath to file to make InstallAssemblyTask.java JBI complaint.
Modified:
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/DeployedAssembliesTask.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/InstallAssemblyTask.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListComponentTask.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListEnginesTask.java
incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListLibrariesTask.java
Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/DeployedAssembliesTask.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/DeployedAssembliesTask.java?rev=379004&r1=379003&r2=379004&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/DeployedAssembliesTask.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/DeployedAssembliesTask.java Sun Feb 19 19:18:19 2006
@@ -18,6 +18,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tools.ant.BuildException;
+import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean;
import javax.jbi.management.DeploymentServiceMBean;
@@ -30,6 +31,57 @@
*/
public class DeployedAssembliesTask extends JbiTask {
private static final Log log = LogFactory.getLog(DeployedAssembliesTask.class);
+ private String state;
+ private String componentName;
+ private String serviceAssemblyName;
+
+ /**
+ *
+ * @return the state
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ *
+ * @param state Sets the state
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ /**
+ *
+ * @return the component name
+ */
+ public String getComponentName() {
+ return componentName;
+ }
+
+ /**
+ *
+ * @param componentName Sets the component name
+ */
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ /**
+ *
+ * @return service assembly name
+ */
+ public String getServiceAssemblyName() {
+ return serviceAssemblyName;
+ }
+
+ /**
+ *
+ * @param serviceAssemblynname Sets the service assembly name
+ */
+ public void setServiceAssemblyName(String serviceAssemblynname) {
+ this.serviceAssemblyName = serviceAssemblynname;
+ }
/**
* execute the task
@@ -38,13 +90,9 @@
*/
public void execute() throws BuildException {
try {
- DeploymentServiceMBean is = getDeploymentService();
- String[] sas = is.getDeployedServiceAssemblies();
- if (sas != null) {
- for (int i = 0;i < sas.length;i++) {
- System.out.println(sas[i]);
- }
- }
+ AdminCommandsServiceMBean acs = getAdminCommandsService();
+ String result = acs.listServiceAssemblies(this.getState(), this.getComponentName(), this.getServiceAssemblyName());
+ System.out.println(result);
}
catch (IOException e) {
log.error("Caught an exception getting deployed assemblies", e);
Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/InstallAssemblyTask.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/InstallAssemblyTask.java?rev=379004&r1=379003&r2=379004&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/InstallAssemblyTask.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/InstallAssemblyTask.java Sun Feb 19 19:18:19 2006
@@ -31,19 +31,19 @@
*/
public class InstallAssemblyTask extends JbiTask {
private static final Log log = LogFactory.getLog(InstallAssemblyTask.class);
- private String archivePath; //archivePath to install
+ private String file; //archivePath to install
/**
* @return Returns the archivePath.
*/
- public String getArchivePath() {
- return archivePath;
+ public String getFile() {
+ return file;
}
/**
- * @param archivePath The archivePath to set.
+ * @param file The archivePath to set.
*/
- public void setArchivePath(String archivePath) {
- this.archivePath = archivePath;
+ public void setFile(String file) {
+ this.file = file;
}
/**
@@ -51,13 +51,13 @@
* @throws BuildException
*/
public void execute() throws BuildException{
- if (archivePath == null){
+ if (file == null){
throw new BuildException("null archivePath - archivePath should be an archive");
}
- if (archivePath.endsWith(".zip") || archivePath.endsWith(".jar")){
+ if (file.endsWith(".zip") || file.endsWith(".jar")){
try {
DeploymentServiceMBean is = getDeploymentService();
- is.deploy(archivePath);
+ is.deploy(file);
}
catch (IOException e) {
log.error("Caught an exception getting the installation service",e);
@@ -72,7 +72,7 @@
throw new BuildException(e);
}
}else {
- throw new BuildException("archivePath: " + archivePath + " is not an archive");
+ throw new BuildException("archivePath: " + file + " is not an archive");
}
}
}
Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListComponentTask.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListComponentTask.java?rev=379004&r1=379003&r2=379004&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListComponentTask.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListComponentTask.java Sun Feb 19 19:18:19 2006
@@ -18,6 +18,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.management.ManagementContextMBean;
+import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean;
import org.apache.tools.ant.BuildException;
import javax.management.ObjectName;
@@ -26,10 +27,78 @@
/**
* ListComponentTask
*
- * @version
+ * @version $Revision:
*/
public class ListComponentTask extends JbiTask {
private static final Log log = LogFactory.getLog(DeployedAssembliesTask.class);
+ private String sharedLibraryName;
+ private String serviceAssemblyName;
+ private String bindingComponentName;
+ private String state;
+
+ /**
+ *
+ * @return shared library name
+ */
+ public String getSharedLibraryName() {
+ return sharedLibraryName;
+ }
+
+ /**
+ *
+ * @param sharedLibraryName
+ */
+ public void setSharedLibraryName(String sharedLibraryName) {
+ this.sharedLibraryName = sharedLibraryName;
+ }
+
+ /**
+ *
+ * @return service assembly name
+ */
+ public String getServiceAssemblyName() {
+ return serviceAssemblyName;
+ }
+
+ /**
+ *
+ * @param serviceAssemblyName
+ */
+ public void setServiceAssemblyName(String serviceAssemblyName) {
+ this.serviceAssemblyName = serviceAssemblyName;
+ }
+
+ /**
+ *
+ * @return binding component name
+ */
+ public String getBindingComponentName() {
+ return bindingComponentName;
+ }
+
+ /**
+ *
+ * @param bindingComponentName
+ */
+ public void setBindingComponentName(String bindingComponentName) {
+ this.bindingComponentName = bindingComponentName;
+ }
+
+ /**
+ *
+ * @return component state
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ *
+ * @param state Sets the component state
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
/**
* execute the task
@@ -38,29 +107,17 @@
*/
public void execute() throws BuildException {
try {
- ManagementContextMBean is = getManagementContext();
- ObjectName[] objName = is.getBindingComponents();
-
- StringBuffer buffer = new StringBuffer();
- buffer.append("<?xml version='1.0'?>\n");
- buffer.append("<component-info-list xmlns='http://java.sun.com/xml/ns/jbi/component-info-list' version='1.0'>\n");
-
- if (objName != null) {
- for (int i = 0; i < objName.length; i++) {
- buffer.append("\t<component-info>");
- buffer.append(" <name>" + objName[i].getKeyProperty("name") + "</name>");
- buffer.append("\t</component-info>\n");
- }
- }
- buffer.append("</component-info-list>");
- System.out.println(buffer.toString());
-
+ AdminCommandsServiceMBean acs;
+ acs = getAdminCommandsService();
+ String result = acs.listComponents(false, true, this.getState(), this.getSharedLibraryName(), this.getServiceAssemblyName());
+ System.out.println(result);
} catch (IOException e) {
- log.error("Caught an exception getting deployed service units", e);
+ log.error("Caught an exception getting the admin commands service", e);
throw new BuildException("exception " + e);
} catch (Exception e) {
- log.error("Caught an exception getting deployed service units", e);
+ log.error("Error listing component", e);
throw new BuildException("exception " + e);
}
+
}
}
Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListEnginesTask.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListEnginesTask.java?rev=379004&r1=379003&r2=379004&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListEnginesTask.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListEnginesTask.java Sun Feb 19 19:18:19 2006
@@ -18,6 +18,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.management.ManagementContextMBean;
+import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean;
import org.apache.tools.ant.BuildException;
import javax.management.ObjectName;
@@ -26,10 +27,62 @@
/**
* ListEnginesTask
*
- * @version
+ * @version $Revision:
*/
public class ListEnginesTask extends JbiTask {
private static final Log log = LogFactory.getLog(ListEnginesTask.class);
+ private String state;
+ private String serviceAssemblyName;
+ private String sharedLibraryName;
+
+ /**
+ *
+ * @return the state
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ *
+ * @param state Sets the state
+ */
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ /**
+ *
+ * @return service assembly name
+ */
+ public String getServiceAssemblyName() {
+ return serviceAssemblyName;
+ }
+
+ /**
+ *
+ * @param serviceAssemblyName the service assembly name to set
+ */
+ public void setServiceAssemblyName(String serviceAssemblyName) {
+ this.serviceAssemblyName = serviceAssemblyName;
+ }
+
+ /**
+ *
+ * @return The shared library name
+ */
+ public String getSharedLibraryName() {
+ return sharedLibraryName;
+ }
+
+ /**
+ *
+ * @param sharedLibraryName Sets the shared library name
+ */
+ public void setSharedLibraryName(String sharedLibraryName) {
+ this.sharedLibraryName = sharedLibraryName;
+ }
+
/**
* execute the task
@@ -38,24 +91,9 @@
*/
public void execute() throws BuildException {
try {
- ManagementContextMBean is = getManagementContext();
- ObjectName[] objName = is.getEngineComponents();
-
- StringBuffer buffer = new StringBuffer();
- buffer.append("<?xml version='1.0'?>\n");
- buffer.append("<component-info-list xmlns='http://java.sun.com/xml/ns/jbi/component-info-list' version='1.0'>\n");
-
- if (objName != null) {
- for (int i = 0; i < objName.length; i++) {
- buffer.append("\t<component-info");
- buffer.append(" type='service-engine'>\n");
- buffer.append(" <name>" + objName[i].getKeyProperty("name") + "</name>");
- buffer.append("\t</component-info>\n");
- }
- }
- buffer.append("</component-info-list>");
- System.out.println(buffer.toString());
-
+ AdminCommandsServiceMBean acs = getAdminCommandsService();
+ String result = acs.listComponents(true, false, this.getState(), this.getSharedLibraryName(), this.getServiceAssemblyName());
+ System.out.println(result);
} catch (IOException e) {
log.error("Caught an exception getting deployed assemblies", e);
throw new BuildException(e);
Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListLibrariesTask.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListLibrariesTask.java?rev=379004&r1=379003&r2=379004&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListLibrariesTask.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListLibrariesTask.java Sun Feb 19 19:18:19 2006
@@ -21,6 +21,7 @@
import org.apache.servicemix.jbi.management.ManagementContextMBean;
import org.apache.servicemix.jbi.management.task.JbiTask;
import org.apache.servicemix.jbi.management.task.DeployedAssembliesTask;
+import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean;
import javax.management.ObjectName;
import java.io.IOException;
@@ -28,10 +29,44 @@
/**
* ListLibrariesTask
*
- * @version
+ * @version $Revision:
*/
public class ListLibrariesTask extends JbiTask {
private static final Log log = LogFactory.getLog(DeployedAssembliesTask.class);
+ private String componentName;
+ private String sharedLibraryName;
+
+ /**
+ *
+ * @return component name
+ */
+ public String getComponentName() {
+ return componentName;
+ }
+
+ /**
+ *
+ * @param componentName The component name to set
+ */
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ /**
+ *
+ * @return shared library name
+ */
+ public String getSharedLibraryName() {
+ return sharedLibraryName;
+ }
+
+ /**
+ *
+ * @param sharedLibraryName the shared library name to set
+ */
+ public void setSharedLibraryName(String sharedLibraryName) {
+ this.sharedLibraryName = sharedLibraryName;
+ }
/**
* execute the task
@@ -40,26 +75,15 @@
*/
public void execute() throws BuildException {
try {
-
- ManagementContextMBean is = getManagementContext();
- ObjectName[] objName = is.getSystemServices();
-
- StringBuffer buffer = new StringBuffer();
- buffer.append("<?xml version='1.0'?>\n");
- buffer.append("<component-info-list xmlns='http://java.sun.com/xml/ns/jbi/component-info-list' version='1.0'>\n");
-
- if (objName != null) {
- for (int i = 0; i < objName.length; i++) {
- buffer.append("\t<component-info>");
- buffer.append(" <name>" + objName[i].getKeyProperty("name") + "</name>");
- buffer.append("\t</component-info>\n");
- }
- }
- buffer.append("</component-info-list>");
- System.out.println(buffer.toString());
-
+ AdminCommandsServiceMBean acs;
+ acs = getAdminCommandsService();
+ String result = acs.listSharedLibraries(this.getComponentName(), this.getSharedLibraryName());
+ System.out.println(result);
} catch (IOException e) {
- log.error("Caught an exception getting deployed assemblies", e);
+ log.error("Caught an exception getting admin commands service", e);
+ throw new BuildException(e);
+ } catch (Exception e) {
+ log.error("Error listing shared libraries", e);
throw new BuildException(e);
}
}