From servicemix-commits-return-596vali@example.com Wed Mar 01 13:23:19 2006 Return-Path: <servicemix-commits-return-596vali@example.com> Delivered-To: vali@example.com Received: (qmail 53886 invoked from network); 1 Mar 2006 13:23:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Mar 2006 13:23:18 -0000 Received: (qmail 61570 invoked by uid 500); 1 Mar 2006 13:24:02 -0000 Delivered-To: vali@example.com Received: (qmail 61473 invoked by uid 500); 1 Mar 2006 13:24:02 -0000 Mailing-List: contact vali@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:vali@example.com> List-Unsubscribe: <mailto:vali@example.com> List-Post: <mailto:vali@example.com> List-Id: <servicemix-commits.geronimo.apache.org> Reply-To: vali@example.com Delivered-To: mailing list vali@example.com Received: (qmail 61440 invoked by uid 99); 1 Mar 2006 13:24:02 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Mar 2006 05:24:02 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 01 Mar 2006 05:24:01 -0800 Received: (qmail 53732 invoked by uid 65534); 1 Mar 2006 13:22:54 -0000 Message-ID: <vali@example.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r382009 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java Date: Wed, 01 Mar 2006 13:22:53 -0000 To: vali@example.com From: vali@example.com X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: gnodet Date: Wed Mar 1 05:22:52 2006 New Revision: 382009 URL: http://svn.apache.org/viewcvs?rev=382009&view=rev Log: When the JdbcAuditor does not automatically start, it should appear in the stopped state Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java?rev=382009&r1=382008&r2=382009&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java Wed Mar 1 05:22:52 2006 @@ -85,6 +85,8 @@ init(getContainer()); if (autoStart) { start(); + } else { + stop(); } } From servicemix-commits-return-597vali@example.com Wed Mar 01 13:39:56 2006 Return-Path: <servicemix-commits-return-597vali@example.com> Delivered-To: vali@example.com Received: (qmail 62760 invoked from network); 1 Mar 2006 13:39:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Mar 2006 13:39:56 -0000 Received: (qmail 91820 invoked by uid 500); 1 Mar 2006 13:40:43 -0000 Delivered-To: vali@example.com Received: (qmail 91782 invoked by uid 500); 1 Mar 2006 13:40:42 -0000 Mailing-List: contact vali@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:vali@example.com> List-Unsubscribe: <mailto:vali@example.com> List-Post: <mailto:vali@example.com> List-Id: <servicemix-commits.geronimo.apache.org> Reply-To: vali@example.com Delivered-To: mailing list vali@example.com Received: (qmail 91773 invoked by uid 99); 1 Mar 2006 13:40:42 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Mar 2006 05:40:42 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 01 Mar 2006 05:40:41 -0800 Received: (qmail 62544 invoked by uid 65534); 1 Mar 2006 13:39:34 -0000 Message-ID: <vali@example.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r382013 - in /incubator/servicemix/trunk: servicemix-http/project.properties servicemix-jms/project.properties Date: Wed, 01 Mar 2006 13:39:33 -0000 To: vali@example.com From: vali@example.com X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: gnodet Date: Wed Mar 1 05:39:32 2006 New Revision: 382013 URL: http://svn.apache.org/viewcvs?rev=382013&view=rev Log: servicemix-http and servicemix-jms are not recognized as binding components Modified: incubator/servicemix/trunk/servicemix-http/project.properties incubator/servicemix/trunk/servicemix-jms/project.properties Modified: incubator/servicemix/trunk/servicemix-http/project.properties URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/project.properties?rev=382013&r1=382012&r2=382013&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-http/project.properties (original) +++ incubator/servicemix/trunk/servicemix-http/project.properties Wed Mar 1 05:39:32 2006 @@ -20,3 +20,4 @@ jbi.component.class.name = org.apache.servicemix.http.HttpComponent jbi.bootstrap.class.name = org.apache.servicemix.http.HttpBootstrap +jbi.component.type=binding-component Modified: incubator/servicemix/trunk/servicemix-jms/project.properties URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-jms/project.properties?rev=382013&r1=382012&r2=382013&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-jms/project.properties (original) +++ incubator/servicemix/trunk/servicemix-jms/project.properties Wed Mar 1 05:39:32 2006 @@ -20,3 +20,4 @@ jbi.component.class.name = org.apache.servicemix.jms.JmsComponent jbi.bootstrap.class.name = org.apache.servicemix.jms.JmsBootstrap +jbi.component.type=binding-component From servicemix-commits-return-598vali@example.com Fri Mar 03 09:29:16 2006 Return-Path: <servicemix-commits-return-598vali@example.com> Delivered-To: vali@example.com Received: (qmail 19301 invoked from network); 3 Mar 2006 09:29:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 3 Mar 2006 09:29:13 -0000 Received: (qmail 22723 invoked by uid 500); 3 Mar 2006 09:29:59 -0000 Delivered-To: vali@example.com Received: (qmail 22673 invoked by uid 500); 3 Mar 2006 09:29:58 -0000 Mailing-List: contact vali@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:vali@example.com> List-Unsubscribe: <mailto:vali@example.com> List-Post: <mailto:vali@example.com> List-Id: <servicemix-commits.geronimo.apache.org> Reply-To: vali@example.com Delivered-To: mailing list vali@example.com Received: (qmail 22664 invoked by uid 99); 3 Mar 2006 09:29:58 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 01:29:58 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 03 Mar 2006 01:29:58 -0800 Received: (qmail 18865 invoked by uid 65534); 3 Mar 2006 09:28:50 -0000 Message-ID: <vali@example.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r382735 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java Date: Fri, 03 Mar 2006 09:28:49 -0000 To: vali@example.com From: vali@example.com X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: gnodet Date: Fri Mar 3 01:28:48 2006 New Revision: 382735 URL: http://svn.apache.org/viewcvs?rev=382735&view=rev Log: Fix problem when using a url with parameters to download the file Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java?rev=382735&r1=382734&r2=382735&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java Fri Mar 3 01:28:48 2006 @@ -107,7 +107,7 @@ */ public static File unpackArchive(File theFile, File targetDir) throws IOException { if (!theFile.exists()) { - throw new IOException(theFile.getAbsolutePath() + " does Not Exist!"); + throw new IOException(theFile.getAbsolutePath() + " does not exist"); } if (!targetDir.exists()) { targetDir.mkdirs(); @@ -141,13 +141,8 @@ targetDir.mkdirs(); } InputStream in = new BufferedInputStream(url.openStream(), DEFAULT_BUFFER_SIZE); - String fileName = url.getFile(); // make sure we get the actual file - int index = fileName.lastIndexOf("/"); - if (index > 0) { - fileName = fileName.substring(index + 1); - } - File zip = new File(targetDir, fileName); + File zip = File.createTempFile("arc", ".zip", targetDir); OutputStream out = new BufferedOutputStream(new FileOutputStream(zip)); copyInputStream(in, out); out.close(); From servicemix-commits-return-599vali@example.com Fri Mar 03 09:37:22 2006 Return-Path: <servicemix-commits-return-599vali@example.com> Delivered-To: vali@example.com Received: (qmail 22548 invoked from network); 3 Mar 2006 09:37:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 3 Mar 2006 09:37:22 -0000 Received: (qmail 31249 invoked by uid 500); 3 Mar 2006 09:38:08 -0000 Delivered-To: vali@example.com Received: (qmail 31220 invoked by uid 500); 3 Mar 2006 09:38:08 -0000 Mailing-List: contact vali@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:vali@example.com> List-Unsubscribe: <mailto:vali@example.com> List-Post: <mailto:vali@example.com> List-Id: <servicemix-commits.geronimo.apache.org> Reply-To: vali@example.com Delivered-To: mailing list vali@example.com Received: (qmail 31211 invoked by uid 99); 3 Mar 2006 09:38:08 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 01:38:08 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 03 Mar 2006 01:38:07 -0800 Received: (qmail 22210 invoked by uid 65534); 3 Mar 2006 09:37:00 -0000 Message-ID: <vali@example.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r382737 - /incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ManagementSupport.java Date: Fri, 03 Mar 2006 09:37:00 -0000 To: vali@example.com From: vali@example.com X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: gnodet Date: Fri Mar 3 01:36:59 2006 New Revision: 382737 URL: http://svn.apache.org/viewcvs?rev=382737&view=rev Log: Fix bad xml generation Modified: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ManagementSupport.java Modified: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ManagementSupport.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ManagementSupport.java?rev=382737&r1=382736&r2=382737&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ManagementSupport.java (original) +++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/ManagementSupport.java Fri Mar 3 01:36:59 2006 @@ -79,7 +79,7 @@ StringBuffer sw = new StringBuffer(); // component-task-result sw.append("<component-task-result "); - sw.append("xmlns=\"http://java.sun.com/xml/ns/jbi/management-message\""); + sw.append("xmlns=\"http://java.sun.com/xml/ns/jbi/management-message\">"); sw.append("\n\t"); // component-name sw.append("<component-name>"); From servicemix-commits-return-600vali@example.com Fri Mar 03 23:33:04 2006 Return-Path: <servicemix-commits-return-600vali@example.com> Delivered-To: vali@example.com Received: (qmail 14895 invoked from network); 3 Mar 2006 23:33:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 3 Mar 2006 23:33:04 -0000 Received: (qmail 33400 invoked by uid 500); 3 Mar 2006 23:33:51 -0000 Delivered-To: vali@example.com Received: (qmail 33347 invoked by uid 500); 3 Mar 2006 23:33:50 -0000 Mailing-List: contact vali@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:vali@example.com> List-Unsubscribe: <mailto:vali@example.com> List-Post: <mailto:vali@example.com> List-Id: <servicemix-commits.geronimo.apache.org> Reply-To: vali@example.com Delivered-To: mailing list vali@example.com Received: (qmail 33337 invoked by uid 99); 3 Mar 2006 23:33:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 15:33:50 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 03 Mar 2006 15:33:50 -0800 Received: (qmail 14734 invoked by uid 65534); 3 Mar 2006 23:32:42 -0000 Message-ID: <vali@example.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r382965 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java Date: Fri, 03 Mar 2006 23:32:42 -0000 To: vali@example.com From: vali@example.com X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: gnodet Date: Fri Mar 3 15:32:40 2006 New Revision: 382965 URL: http://svn.apache.org/viewcvs?rev=382965&view=rev Log: Deactivate endpoint when lw component is shutdown Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java?rev=382965&r1=382964&r2=382965&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/components/util/PojoSupport.java Fri Mar 3 15:32:40 2006 @@ -37,6 +37,7 @@ import javax.jbi.messaging.MessageExchangeFactory; import javax.jbi.messaging.MessagingException; import javax.jbi.messaging.NormalizedMessage; +import javax.jbi.servicedesc.ServiceEndpoint; import javax.management.ObjectName; import javax.xml.namespace.QName; import javax.xml.transform.Source; @@ -54,6 +55,7 @@ private String endpoint; private MessageExchangeFactory exchangeFactory; private String description = "POJO Component"; + private ServiceEndpoint serviceEndpoint; private static final Log log = LogFactory.getLog(PojoSupport.class); @@ -84,10 +86,21 @@ this.context = cc; init(); if (service != null && endpoint != null) { - context.activateEndpoint(service, endpoint); + serviceEndpoint = context.activateEndpoint(service, endpoint); } } + /** + * Shut down the item. The releases resources, preparatory to uninstallation. + * + * @exception javax.jbi.JBIException if the item fails to shut down. + */ + public void shutDown() throws javax.jbi.JBIException { + if (serviceEndpoint != null) { + context.deactivateEndpoint(serviceEndpoint); + } + super.shutDown(); + } // Helper methods //------------------------------------------------------------------------- From servicemix-commits-return-601vali@example.com Sat Mar 04 00:21:42 2006 Return-Path: <servicemix-commits-return-601vali@example.com> Delivered-To: vali@example.com Received: (qmail 34858 invoked from network); 4 Mar 2006 00:21:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 4 Mar 2006 00:21:42 -0000 Received: (qmail 74396 invoked by uid 500); 4 Mar 2006 00:22:29 -0000 Delivered-To: vali@example.com Received: (qmail 74347 invoked by uid 500); 4 Mar 2006 00:22:29 -0000 Mailing-List: contact vali@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:vali@example.com> List-Unsubscribe: <mailto:vali@example.com> List-Post: <mailto:vali@example.com> List-Id: <servicemix-commits.geronimo.apache.org> Reply-To: vali@example.com Delivered-To: mailing list vali@example.com Received: (qmail 74338 invoked by uid 99); 4 Mar 2006 00:22:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 16:22:28 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 03 Mar 2006 16:22:28 -0800 Received: (qmail 34770 invoked by uid 65534); 4 Mar 2006 00:21:20 -0000 Message-ID: <vali@example.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r382978 - /incubator/servicemix/trunk/servicemix-http/project.xml Date: Sat, 04 Mar 2006 00:21:19 -0000 To: vali@example.com From: vali@example.com X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: gnodet Date: Fri Mar 3 16:21:17 2006 New Revision: 382978 URL: http://svn.apache.org/viewcvs?rev=382978&view=rev Log: Add log4j as a test dependency Modified: incubator/servicemix/trunk/servicemix-http/project.xml Modified: incubator/servicemix/trunk/servicemix-http/project.xml URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/project.xml?rev=382978&r1=382977&r2=382978&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-http/project.xml (original) +++ incubator/servicemix/trunk/servicemix-http/project.xml Fri Mar 3 16:21:17 2006 @@ -261,6 +261,13 @@ </properties> </dependency> <dependency> + <id>log4j</id> + <version>${log4j_version}</version> + <properties> + <scope>test</scope> + </properties> + </dependency> + <dependency> <groupId>servicemix</groupId> <artifactId>stax-utils</artifactId> <version>${stax_utils_version}</version> @@ -295,12 +302,18 @@ <build> <unitTest> + <resources> + <resource> + <directory>src/test/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + </resources> <includes> <include>**/*Test.*</include> </includes> <excludes> - <!-- http://jira.activemq.org/jira/browse/AMQ-572 --> - <exclude>**/ServerManagerTest.*</exclude> </excludes> </unitTest> <resources> From servicemix-commits-return-603vali@example.com Sat Mar 04 00:32:43 2006 Return-Path: <servicemix-commits-return-603vali@example.com> Delivered-To: vali@example.com Received: (qmail 38967 invoked from network); 4 Mar 2006 00:32:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 4 Mar 2006 00:32:42 -0000 Received: (qmail 83337 invoked by uid 500); 4 Mar 2006 00:33:27 -0000 Delivered-To: vali@example.com Received: (qmail 83255 invoked by uid 500); 4 Mar 2006 00:33:27 -0000 Mailing-List: contact vali@example.com; run by ezmlm Precedence: bulk List-Help: <mailto:vali@example.com> List-Unsubscribe: <mailto:vali@example.com> List-Post: <mailto:vali@example.com> List-Id: <servicemix-commits.geronimo.apache.org> Reply-To: vali@example.com Delivered-To: mailing list vali@example.com Received: (qmail 83219 invoked by uid 99); 4 Mar 2006 00:33:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Mar 2006 16:33:26 -0800 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO minotaur.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 03 Mar 2006 16:33:21 -0800 Received: (qmail 38619 invoked by uid 65534); 4 Mar 2006 00:32:14 -0000 Message-ID: <vali@example.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r382984 [1/4] - in /incubator/servicemix/trunk/servicemix-core/src: main/java/org/apache/servicemix/jbi/container/ main/java/org/apache/servicemix/jbi/framework/ main/java/org/apache/servicemix/jbi/loaders/ main/java/org/apache/servicemix/j... Date: Sat, 04 Mar 2006 00:31:55 -0000 To: vali@example.com From: vali@example.com X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: gnodet Date: Fri Mar 3 16:31:49 2006 New Revision: 382984 URL: http://svn.apache.org/viewcvs?rev=382984&view=rev Log: Lots of changes: * SM-162: exceptions + xml jbi message * SM-307: do not append container name to working dir * SM-217: ant tasks (use consistent naming for tasks, add failOnError, use the AdminCommandsService) * SM-336: persist hotdeploy state in working dir * SM-295: start real support of SA connections * add mbeans for SAs, SUs and endpoints * channel is not closed when component is shut down * closing the channel should deactivate all endpoints * the channel is not recreated when component is initialized after a shutdown * move all classloader related stuff in its own package * move the stats out of the DeliveryChannel so that they are not lost when the channel is recreated * complete rework of DeploymentService * BaseLifeCycle.setCurrentState must not be public to avoid jmx writable attribute * fix jms/jca flow tests broken due to SM-319 (multiple flows) * rework SA lifecycle Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStats.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBeanImpl.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Endpoint.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointMBean.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyMBean.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceUnitLifeCycle.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceUnitMBean.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/loaders/ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/loaders/ClassLoaderService.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClassLoaderService.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/loaders/ClassLoaderUtil.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClassLoaderUtil.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/loaders/InstallationClassLoader.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationClassLoader.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/loaders/ParentFirstClassLoader.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ParentFirstClassLoader.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/loaders/SelfFirstClassLoader.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SelfFirstClassLoader.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/DeployServiceAssemblyTask.java - copied, changed from r381300, 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/InstallSharedLibraryTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListBindingComponentsTask.java - copied, changed from r381300, 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/ListServiceAssembliesTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListServiceEnginesTask.java - copied, changed from r381300, 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/ListSharedLibrariesTask.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ListLibrariesTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ShutDownServiceAssemblyTask.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ShutDownAssemblyTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/StartServiceAssemblyTask.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/StartAssemblyTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/StopServiceAssemblyTask.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/StopAssemblyTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/UndeployServiceAssemblyTask.java - copied, changed from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/UninstallAssemblyTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/UninstallSharedLibraryTask.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentMessageTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DummyComponent.java Removed: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClassLoaderService.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ClassLoaderUtil.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBeanImpl.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/FrameworkInstallationService.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationClassLoader.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ParentFirstClassLoader.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/SelfFirstClassLoader.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/AssemblyDescriptorTask.java 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/DeployedServiceUnitsTask.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 incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ShutDownAssemblyTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/StartAssemblyTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/StopAssemblyTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/UninstallAssemblyTask.java Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/ComponentEnvironment.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBean.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallerMBeanImpl.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/LocalComponentConnector.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ManagementSupport.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyLifeCycle.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseLifeCycle.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseSystemService.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/InstallComponentTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/JbiTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/ShutDownComponentTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/StartComponentTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/StopComponentTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/task/UninstallComponentTask.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DeliveryChannelImpl.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/Broker.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/LinkedEndpoint.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/DOMUtil.java incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileVersionUtil.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ClassLoaderTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentRegistryTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/AbstractManagementTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/JbiTaskSupport.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/task/JbiTaskTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/messaging/AbstractClusteredTransactionTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/messaging/JcaFlowPersistentTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/messaging/JcaFlowTransactionTest.java incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/messaging/JmsFlowTransactionTest.java Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/ComponentEnvironment.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/ComponentEnvironment.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/ComponentEnvironment.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/ComponentEnvironment.java Fri Mar 3 16:31:49 2006 @@ -116,7 +116,7 @@ statsWriter.println(localConnector.getComponentNameSpace().getName() + ":"); statsWriter.println("inboundExchanges,inboundExchangeRate,outboundExchanges,outboundExchangeRate"); } - MessagingStats stats = localConnector.getDeliveryChannel().getMessagingStats(); + MessagingStats stats = localConnector.getMessagingStats(); long inbound = stats.getInboundExchanges().getCount(); double inboundRate = stats.getInboundExchangeRate().getAveragePerSecond(); long outbound = stats.getOutboundExchanges().getCount(); Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/EnvironmentContext.java Fri Mar 3 16:31:49 2006 @@ -153,7 +153,7 @@ */ public void init(JBIContainer container, String rootDirPath) throws JBIException { super.init(container); - jbiRootDir = new File(rootDirPath, container.getName()); + jbiRootDir = new File(rootDirPath); buildDirectoryStructure(); } @@ -307,7 +307,7 @@ * @return directory for deployment/workspace etc * @throws IOException */ - public File getComponentRootDirectory(String componentName) throws IOException { + public File getComponentRootDirectory(String componentName) { if (getComponentsDir() == null) { return null; } @@ -367,13 +367,13 @@ * @return directory for deployment/workspace etc * @throws IOException */ - public File getSARootDirectory(String saName) throws IOException{ - if(getServiceAssembiliesDirectory()==null){ + public File getSARootDirectory(String saName) { + if (getServiceAssembiliesDirectory() == null) { return null; } - File result=FileUtil.getDirectoryPath(getServiceAssembiliesDirectory(),saName); + File result = FileUtil.getDirectoryPath(getServiceAssembiliesDirectory(), saName); // get the version directory - result=FileVersionUtil.getLatestVersionDirectory(result); + result = FileVersionUtil.getLatestVersionDirectory(result); return result; } @@ -414,7 +414,7 @@ * @return the state file * @throws IOException */ - public File getServiceAssemblyStateFile(String saName) throws IOException { + public File getServiceAssemblyStateFile(String saName) { File result = getSARootDirectory(saName); FileUtil.buildDirectory(result); result = new File(result,"state.xml"); @@ -443,7 +443,7 @@ * @return directory * @throws IOException */ - public File getServiceUnitDirectory(String componentName,String suName) throws IOException { + public File getServiceUnitDirectory(String componentName,String suName) { File result = getComponentRootDirectory(componentName); result = FileUtil.getDirectoryPath(result, "serviceunit"); result = FileUtil.getDirectoryPath(result,suName); @@ -484,29 +484,24 @@ * @param componentName */ public void removeComponentRootDirectory(String componentName) { - try { - File file = getComponentRootDirectory(componentName); - if (file != null) { - if (!FileUtil.deleteFile(file)) { - log.warn("Failed to remove directory structure for component [version]: " + componentName + " [" + file.getName() + ']'); - } - else { - log.info("Removed directory structure for component [version]: " + componentName + " [" + file.getName() + ']'); - File parent = file.getParentFile(); - if (parent.list().length == 0) { - if (!FileUtil.deleteFile(parent)) { - log.warn("Failed to remove root directory for component: " + componentName); - } - else { - log.info("Removed root directory structure for component: " + componentName); - } + File file = getComponentRootDirectory(componentName); + if (file != null) { + if (!FileUtil.deleteFile(file)) { + log.warn("Failed to remove directory structure for component [version]: " + componentName + " [" + file.getName() + ']'); + } + else { + log.info("Removed directory structure for component [version]: " + componentName + " [" + file.getName() + ']'); + File parent = file.getParentFile(); + if (parent.list().length == 0) { + if (!FileUtil.deleteFile(parent)) { + log.warn("Failed to remove root directory for component: " + componentName); + } + else { + log.info("Removed root directory structure for component: " + componentName); } } } } - catch (IOException e) { - log.warn("Failed to remove directory structure for component: " + componentName, e); - } } /** @@ -516,7 +511,7 @@ * @return directory * @throws IOException */ - public File createSharedLibraryDirectory(String name) throws IOException { + public File createSharedLibraryDirectory(String name) { File result = FileUtil.getDirectoryPath(getSharedLibDir(), name); FileUtil.buildDirectory(result); return result; @@ -527,7 +522,7 @@ * @param name * @throws IOException */ - public void removeSharedLibraryDirectory(String name) throws IOException{ + public void removeSharedLibraryDirectory(String name) { File result = FileUtil.getDirectoryPath(getSharedLibDir(), name); FileUtil.deleteFile(result); } @@ -605,6 +600,10 @@ helper.addAttribute(getObjectToManage(), "dumpStats", "Periodically dump Component statistics"); helper.addAttribute(getObjectToManage(), "statsInterval", "Interval (secs) before dumping statistics"); return AttributeInfoHelper.join(super.getAttributeInfos(), helper.getAttributeInfos()); + } + + public File getJbiRootDir() { + return jbiRootDir; } Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java Fri Mar 3 16:31:49 2006 @@ -63,7 +63,6 @@ import org.apache.servicemix.jbi.framework.AdminCommandsService; import org.apache.servicemix.jbi.management.BaseLifeCycle; import org.apache.servicemix.jbi.management.ManagementContext; -import org.apache.servicemix.jbi.messaging.DeliveryChannelImpl; import org.apache.servicemix.jbi.messaging.MessageExchangeImpl; import org.apache.servicemix.jbi.nmr.Broker; import org.apache.servicemix.jbi.nmr.flow.Flow; @@ -784,7 +783,7 @@ Component component = registry.getComponent(cns); LocalComponentConnector lcc = registry.getLocalComponentConnector(cns); if (component != null && lcc != null) { - lcc.getComponentMBean().shutDown(); + lcc.getComponentMBean().shutDown(); lcc.unregisterMbeans(managementContext); registry.deregisterComponent(component); environmentContext.unreregister(lcc); @@ -830,8 +829,7 @@ * @return the LocalComponentConnector */ public LocalComponentConnector getLocalComponentConnector(String componentName) { - ComponentNameSpace cns = new ComponentNameSpace(name, componentName, componentName); - return registry.getLocalComponentConnector(cns); + return registry.getLocalComponentConnector(componentName); } /** @@ -922,7 +920,7 @@ * @throws JBIException */ public ObjectName activateComponent(Component component, ActivationSpec activationSpec) throws JBIException { - return activateComponent(component, "POJO Component", activationSpec, true, true, true); + return activateComponent(component, "POJO Component", activationSpec, true, false, false); } /** @@ -980,16 +978,16 @@ throws JBIException { ObjectName result = null; ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName(), activationSpec.getId()); - log.info("Activating component for: " + cns + " with service: " + activationSpec.getService() + " component: " - + component); - DeliveryChannelImpl dc = new DeliveryChannelImpl(this, activationSpec.getComponentName()); - LocalComponentConnector lcc = registry.registerComponent(cns, description, component, dc, binding, service); + if (log.isDebugEnabled()) { + log.info("Activating component for: " + cns + " with service: " + activationSpec.getService() + " component: " + + component); + } + LocalComponentConnector lcc = registry.registerComponent(cns, description, component, binding, service); if (lcc != null) { - dc.setConnector(lcc); lcc.setPojo(pojo); ComponentEnvironment env = environmentContext.registerComponent(context.getEnvironment(),lcc); env.setInstallRoot(installationDir); - context.activate(component, dc, env, activationSpec); + context.activate(component, env, activationSpec); lcc.setContext(context); lcc.setActivationSpec(activationSpec); @@ -1001,7 +999,7 @@ lcc.getComponentMBean().start(); } } else { - lcc.getComponentMBean().setCurrentState(LifeCycleMBean.SHUTDOWN); + lcc.getComponentMBean().doShutDown(); } result = lcc.registerMBeans(managementContext); } Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsService.java Fri Mar 3 16:31:49 2006 @@ -15,20 +15,20 @@ */ package org.apache.servicemix.jbi.framework; -import org.apache.servicemix.jbi.management.BaseSystemService; -import org.apache.servicemix.jbi.management.OperationInfoHelper; -import org.apache.servicemix.jbi.management.ParameterHelper; - -import javax.jbi.JBIException; -import javax.jbi.management.DeploymentException; -import javax.management.MBeanOperationInfo; -import javax.management.JMException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Properties; +import javax.jbi.JBIException; +import javax.management.JMException; +import javax.management.MBeanOperationInfo; + +import org.apache.servicemix.jbi.management.BaseSystemService; +import org.apache.servicemix.jbi.management.OperationInfoHelper; +import org.apache.servicemix.jbi.management.ParameterHelper; + public class AdminCommandsService extends BaseSystemService implements AdminCommandsServiceMBean { /** @@ -62,12 +62,9 @@ public String installComponent(String file, Properties props) throws Exception { try { container.getInstallationService().install(file); - return success("installComponent", file); - - } catch (DeploymentException e) { - throw new RuntimeException(failure("installComponent", file, null, e)); + return ManagementSupport.createSuccessMessage("installComponent", file); } catch (Exception e) { - throw new RuntimeException(failure("installComponent", file, null, e)); + throw ManagementSupport.failure("installComponent", file, e); } } @@ -82,7 +79,7 @@ if (success) { return success("uninstallComponent", name); } else { - return failure("uninstallComponent", name, "Failed", null); + return failure("uninstallComponent", name, null); } } @@ -107,7 +104,7 @@ if (success) { return success("uninstallSharedLibrary", name); } else { - return failure("uninstallSharedLibrary", name, "Failed", null); + return failure("uninstallSharedLibrary", name, null); } } @@ -127,7 +124,7 @@ lcc.getComponentMBean().start(); return success("startComponent", name); } catch (JBIException e) { - throw new RuntimeException(failure("startComponent", name, null, e)); + throw new RuntimeException(failure("startComponent", name, e)); } } @@ -147,7 +144,7 @@ lcc.getComponentMBean().stop(); return success("stopComponent", name); } catch (JBIException e) { - throw new RuntimeException(failure("stopComponent", name, null, e)); + throw new RuntimeException(failure("stopComponent", name, e)); } } @@ -167,7 +164,7 @@ lcc.getComponentMBean().shutDown(); return success("shutdownComponent", name); } catch (JBIException e) { - throw new RuntimeException(failure("shutdownComponent", name, null, e)); + throw new RuntimeException(failure("shutdownComponent", name, e)); } } @@ -178,13 +175,7 @@ * @return */ public String deployServiceAssembly(String file) throws Exception { - try { - container.getDeploymentService().deploy(file); - return success("installComponent", file); - - } catch (Exception e) { - throw new RuntimeException(failure("deployServiceAssembly", file, null, e)); - } + return container.getDeploymentService().deploy(file); } /** @@ -199,7 +190,7 @@ return success("undeployServiceAssembly", name); } catch (Exception e) { - throw new RuntimeException(failure("undeployServiceAssembly", name, null, e)); + throw new RuntimeException(failure("undeployServiceAssembly", name, e)); } } @@ -215,7 +206,7 @@ return success("startServiceAssembly", name); } catch (Exception e) { - throw new RuntimeException(failure("startServiceAssembly", name, null, e)); + throw new RuntimeException(failure("startServiceAssembly", name, e)); } } @@ -231,7 +222,7 @@ return success("stopServiceAssembly", name); } catch (Exception e) { - throw new RuntimeException(failure("stopServiceAssembly", name, null, e)); + throw new RuntimeException(failure("stopServiceAssembly", name, e)); } } @@ -247,7 +238,7 @@ return success("shutdownServiceAssembly", name); } catch (Exception e) { - throw new RuntimeException(failure("shutdownServiceAssembly", name, null, e)); + throw new RuntimeException(failure("shutdownServiceAssembly", name, e)); } } @@ -265,7 +256,7 @@ return success("installArchive", location); } catch (Exception e) { - throw new RuntimeException(failure("shutdownServiceAssembly", location, null, e)); + throw new RuntimeException(failure("shutdownServiceAssembly", location, e)); } } @@ -279,68 +270,42 @@ * @param serviceAssemblyName * @return list of components in an XML blob */ - public String listComponents(boolean serviceEngines, boolean bindingComponents, String state, String sharedLibraryName, String serviceAssemblyName) throws Exception { - return listAllComponents(serviceEngines, bindingComponents, state, sharedLibraryName, serviceAssemblyName, true); - } - - /** - * Prints information about all JBI components (Service Engine or Binding Component) installed - * - * @param serviceEngines - * @param bindingComponents - * @param state - * @param sharedLibraryName - * @param serviceAssemblyName - * @return - */ - public String listJBIComponents(boolean serviceEngines, boolean bindingComponents, String state, String sharedLibraryName, String serviceAssemblyName) throws Exception { - return listAllComponents(serviceEngines, bindingComponents, state, sharedLibraryName, serviceAssemblyName, false); - } - - /** - * Prints information about all components (Service Engine or Binding Component) installed - * - * @param serviceEngines - * @param bindingComponents - * @param state - * @param sharedLibraryName - * @param serviceAssemblyName - * @return - */ - public String listAllComponents(boolean serviceEngines, boolean bindingComponents, String state, String sharedLibraryName, String serviceAssemblyName, boolean pojo) throws Exception { + public String listComponents(boolean excludeSEs, + boolean excludeBCs, + boolean excludePojos, + String requiredState, + String sharedLibraryName, + String serviceAssemblyName) throws Exception { Collection connectors = container.getRegistry().getLocalComponentConnectors(); List components = new ArrayList(); for (Iterator iter = connectors.iterator(); iter.hasNext();) { LocalComponentConnector lcc = (LocalComponentConnector) iter.next(); - - // If we want SE, and it is not one, skip - if (!serviceEngines && !lcc.isService()) { + // Skip SEs if needed + if (excludeSEs && lcc.isService()) { continue; } - // If we want BC, and it is not one, skip - if (!bindingComponents && !lcc.isBinding()) { + // Skip BCs if needed + if (excludeBCs && lcc.isBinding()) { + continue; + } + // Skip Pojos if needed + if (excludePojos && lcc.isPojo()) { continue; } // Check status - if (state != null && state.length() > 0 && !state.equals(lcc.getComponentMBean().getCurrentState())) { - System.out.println("state passed"); + if (requiredState != null && requiredState.length() > 0 && !requiredState.equals(lcc.getComponentMBean().getCurrentState())) { continue; } - // Check shared library + // TODO: check component dependency on SL if (sharedLibraryName != null && sharedLibraryName.length() > 0 && !container.getInstallationService().containsSharedLibrary(sharedLibraryName)) { continue; } - // Check deployed service assembly + // TODO: check SA dependency on component if (serviceAssemblyName != null && serviceAssemblyName.length() > 0 && !container.getDeploymentService().isSaDeployed(serviceAssemblyName)) { continue; } - - if (lcc.isPojo() && !pojo){ - continue; - } - components.add(lcc); } @@ -369,38 +334,6 @@ } /** - * Prints information about all Pojo components installed - * @return XML string - */ - public String listPojoComponents() throws Exception { - Collection connectors = container.getRegistry().getLocalComponentConnectors(); - List components = new ArrayList(); - for(Iterator iter=connectors.iterator();iter.hasNext();){ - LocalComponentConnector lcc=(LocalComponentConnector) iter.next(); - if(lcc.isPojo()){ - components.add(lcc); - } - } - - 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"); - for (Iterator iter = components.iterator(); iter.hasNext();) { - LocalComponentConnector lcc = (LocalComponentConnector) iter.next(); - buffer.append(" name='" + lcc.getComponentNameSpace().getName() + "'"); - buffer.append(" state='" + lcc.getComponentMBean().getCurrentState() + "'>"); - if (lcc.getPacket().getDescription() != null) { - buffer.append("\t\t<description>"); - buffer.append(lcc.getPacket().getDescription()); - buffer.append("<description>\n"); - } - buffer.append("\t</component-info>\n"); - } - buffer.append("</component-info-list>"); - return buffer.toString(); - } - - /** * Prints information about shared libraries installed. * * @param componentName @@ -430,32 +363,32 @@ result = container.getRegistry().getDeployedServiceAssemblies(); } - List components = new ArrayList(); + List assemblies = new ArrayList(); for (int i = 0; i < result.length; i++) { + ServiceAssemblyLifeCycle sa = container.getRegistry().getServiceAssembly(result[i]); // Check status - if (state != null && state.length() > 0 && !state.equals(container.getRegistry().getServiceAssemblyState(result[i]))) { + if (state != null && state.length() > 0 && !state.equals(sa.getCurrentState())) { continue; } - components.add(result[i]); + assemblies.add(sa); } StringBuffer buffer = new StringBuffer(); buffer.append("<?xml version='1.0'?>\n"); buffer.append("<service-assembly-info-list xmlns='http://java.sun.com/xml/ns/jbi/component-info-list' version='1.0'>\n"); - for (Iterator iter = components.iterator(); iter.hasNext();) { - String name = (String) iter.next(); - + for (Iterator iter = assemblies.iterator(); iter.hasNext();) { + ServiceAssemblyLifeCycle sa = (ServiceAssemblyLifeCycle) iter.next(); buffer.append("\t<service-assembly-info"); - buffer.append(" name='" + name + "'"); - buffer.append(" state='" + container.getRegistry().getServiceAssemblyState(name) + "'/>"); - buffer.append(" <description>" + container.getRegistry().getServiceAssemblyDesc(name) + "</description>"); + buffer.append(" name='" + sa.getName() + "'"); + buffer.append(" state='" + sa.getCurrentState() + "'/>"); + buffer.append(" <description>" + sa.getDescription() + "</description>"); buffer.append("\t</service-assembly-info>\n"); - String[] serviceUnitList = container.getRegistry().getSADeployedServiceUnitList(name); + ServiceUnitLifeCycle[] serviceUnitList = sa.getDeployedSUs(); for (int i = 0; i < serviceUnitList.length; i++) { buffer.append("\t<service-unit-info"); - buffer.append(" name='" + serviceUnitList[i] + "'"); - buffer.append(" state='" + container.getRegistry().getSADeployedServiceUnitDesc(name, serviceUnitList[i]) + "/>"); + buffer.append(" name='" + serviceUnitList[i].getName() + "'"); + buffer.append(" state='" + serviceUnitList[i].getCurrentState() + "/>"); buffer.append("\t</service-unit-info"); } } @@ -464,24 +397,22 @@ return buffer.toString(); } - public String failure(String task, String componentName, String info, Exception e) { + public String failure(String task, String location, Exception e) { ManagementSupport.Message msg = new ManagementSupport.Message(); - msg.setComponent(componentName); msg.setTask(task); msg.setResult("FAILED"); msg.setType("ERROR"); msg.setException(e); - msg.setMessage(info); - return ManagementSupport.createComponentMessage(msg); + msg.setMessage(location); + return ManagementSupport.createFrameworkMessage(msg, (List) null); } - public String success(String task, String componentName) { + public String success(String task, String location) { ManagementSupport.Message msg = new ManagementSupport.Message(); - msg.setComponent(componentName); msg.setTask(task); + msg.setMessage(location); msg.setResult("SUCCESS"); - // TODO: change the generated xml - return ManagementSupport.createComponentMessage(msg); + return ManagementSupport.createFrameworkMessage(msg, (List) null); } public MBeanOperationInfo[] getOperationInfos() throws JMException { @@ -500,7 +431,6 @@ ph = helper.addOperation(getObjectToManage(), "installArchive", 1, "install an archive (component/SA etc)"); ph.setDescription(0, "location", "file name or url to the location"); - ph = helper.addOperation(getObjectToManage(), "startComponent", 1, "start a component"); ph.setDescription(0, "name", "name of component to start"); @@ -527,21 +457,13 @@ ph.setDescription(0, "name", "name of service assembly to shutdown"); ph = helper.addOperation(getObjectToManage(), "listComponents", 5, "list all components installed"); - ph.setDescription(0, "serviceEngines", "if true will list service engines"); - ph.setDescription(1, "bindingComponents", "if true will list binding components"); - ph.setDescription(2, "state", "component state to list, if null will list all"); - ph.setDescription(3, "sharedLibraryName", "shared library name to list"); - ph.setDescription(4, "serviceAssemblyName", "service assembly name to list"); - - ph = helper.addOperation(getObjectToManage(), "listJBIComponents", 5, "list JBI components installed"); - ph.setDescription(0, "serviceEngines", "if true will list service engines"); - ph.setDescription(1, "bindingComponents", "if true will list binding components"); - ph.setDescription(2, "state", "component state to list, if null will list all"); + ph.setDescription(0, "excludeSEs", "if true will exclude service engines"); + ph.setDescription(1, "excludeBCs", "if true will exclude binding components"); + ph.setDescription(1, "excludePojos", "if true will exclude pojos components"); + ph.setDescription(2, "requiredState", "component state to list, if null will list all"); ph.setDescription(3, "sharedLibraryName", "shared library name to list"); ph.setDescription(4, "serviceAssemblyName", "service assembly name to list"); - ph = helper.addOperation(getObjectToManage(), "listPojoComponents", "list all POJO Components"); - ph = helper.addOperation(getObjectToManage(), "listSharedLibraries", 2, "list shared library"); ph.setDescription(0, "componentName", "component name"); ph.setDescription(1, "sharedLibraryName", "shared library name"); @@ -550,11 +472,6 @@ ph.setDescription(0, "state", "service assembly state to list"); ph.setDescription(1, "componentName", "component name"); ph.setDescription(2, "serviceAssemblyName", "service assembly name"); - - - - - return OperationInfoHelper.join(super.getOperationInfos(), helper.getOperationInfos()); } Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AdminCommandsServiceMBean.java Fri Mar 3 16:31:49 2006 @@ -19,7 +19,8 @@ * * @version $Revision: 657 $ */ -public interface AdminCommandsServiceMBean extends LifeCycleMBean{ +public interface AdminCommandsServiceMBean extends LifeCycleMBean { + String installComponent(String file) throws Exception; String installComponent(String file,Properties properties) throws Exception; @@ -48,15 +49,17 @@ String installArchive(String location) throws Exception; - String listComponents(boolean serviceEngines,boolean bindingComponents,String state,String sharedLibraryName, - String serviceAssemblyName) throws Exception; - - String listJBIComponents(boolean serviceEngines,boolean bindingComponents,String state,String sharedLibraryName, - String serviceAssemblyName) throws Exception; - - String listPojoComponents() throws Exception; - - String listSharedLibraries(String componentName,String sharedLibraryName) throws Exception; - - String listServiceAssemblies(String state,String componentName,String serviceAssemblyName) throws Exception; + String listComponents(boolean excludeSEs, + boolean excludeBCs, + boolean excludePojos, + String requiredState, + String sharedLibraryName, + String serviceAssemblyName) throws Exception; + + String listSharedLibraries(String componentName, + String sharedLibraryName) throws Exception; + + String listServiceAssemblies(String state, + String componentName, + String serviceAssemblyName) throws Exception; } Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/AutoDeploymentService.java Fri Mar 3 16:31:49 2006 @@ -15,8 +15,11 @@ */ package org.apache.servicemix.jbi.framework; +import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -61,7 +64,6 @@ public class AutoDeploymentService extends BaseSystemService implements AutoDeploymentServiceMBean { private static final Log log = LogFactory.getLog(AutoDeploymentService.class); - private static final String MONITOR_STATE_FILE = ".state.xml"; private EnvironmentContext environmentContext; protected static final String DESCRIPTOR_FILE = "META-INF/jbi.xml"; private DeploymentService deploymentService; @@ -203,7 +205,6 @@ String componentName = root.getComponent().getIdentification().getName(); entry.type = "component"; entry.name = componentName; - log.info("Uninstalling Component: "+componentName); installationService.unloadInstaller(componentName, true); installationService.install(tmp, root, autoStart); checkPendingSAs(); @@ -221,13 +222,13 @@ if (deploymentService.isSaDeployed(name)) { deploymentService.shutDown(name); deploymentService.undeploy(name); - deploymentService.deploy(tmp,sa); + deploymentService.deployServiceAssembly(tmp, sa); if (autoStart) { deploymentService.start(name); } } else { // see if components are installed - entry.componentNames = deploymentService.getComponentNames(sa); + entry.componentNames = getComponentNames(sa); String missings = null; boolean canDeploy = true; for (Iterator it = entry.componentNames.iterator(); it.hasNext();) { @@ -242,11 +243,12 @@ } } if (canDeploy) { - deploymentService.deploy(tmp, sa); + deploymentService.deployServiceAssembly(tmp, sa); if (autoStart){ deploymentService.start(name); } } else { + // TODO: check that the assembly is not already pending entry.pending = true; log.info("Components " + missings + " are not installed yet - adding ServiceAssembly " + name + " to pending list"); @@ -265,15 +267,26 @@ } } + protected Set getComponentNames(ServiceAssembly sa) { + Set names = null; + if (sa.getServiceUnits() != null && sa.getServiceUnits().length > 0) { + names = new HashSet(); + for (int i = 0; i < sa.getServiceUnits().length; i++) { + names.add(sa.getServiceUnits()[i].getTarget().getComponentName()); + } + } + return names; + } + /** * Remove an archive location * * @param location * @throws DeploymentException */ - public void removeArchive(ArchiveEntry entry) throws DeploymentException{ + public void removeArchive(ArchiveEntry entry) throws DeploymentException { log.info("Attempting to remove archive at: " + entry.location); - try{ + try{ container.getBroker().suspend(); if ("component".equals(entry.type)) { log.info("Uninstalling component: " + entry.name); @@ -287,14 +300,14 @@ installationService.uninstallSharedLibrary(entry.name); } if ("assembly".equals(entry.type)) { - log.info("Removing service assembly " + entry.name); + log.info("Undeploying service assembly " + entry.name); try{ if(deploymentService.isSaDeployed(entry.name)){ deploymentService.shutDown(entry.name); deploymentService.undeploy(entry.name); } } catch(Exception e) { - String errStr="Failed to update service assembly: "+ entry.name; + String errStr = "Failed to update service assembly: "+ entry.name; log.error(errStr,e); throw new DeploymentException(errStr,e); } @@ -327,7 +340,7 @@ deployedSas.add(tmp); try { Descriptor root = AutoDeploymentService.buildDescriptor(tmp); - deploymentService.deploy(tmp, root.getServiceAssembly()); + deploymentService.deployServiceAssembly(tmp, root.getServiceAssembly()); deploymentService.start(root.getServiceAssembly().getIdentification().getName()); } catch (Exception e) { String errStr = "Failed to update Service Assembly: " + tmp.getName(); @@ -348,41 +361,6 @@ } /** - * Check to see if an archive is installed - * - * @param location - * @return the Descriptor if installed - */ - protected Descriptor getInstalledDescriptor(String location) throws JBIException{ - Descriptor result=null; - boolean exists=false; - try{ - File tmp=AutoDeploymentService.unpackLocation(environmentContext.getTmpDir(),location); - Descriptor root=AutoDeploymentService.buildDescriptor(tmp); - if(root.getComponent()!=null){ - String componentName=root.getComponent().getIdentification().getName(); - exists=container.getRegistry().isLocalComponentRegistered(componentName); - }else if(root.getServiceAssembly()!=null){ - ServiceAssembly sa=root.getServiceAssembly(); - String name=sa.getIdentification().getName(); - exists=deploymentService.isSaDeployed(name); - }else if(root.getSharedLibrary()!=null){ - String name=root.getSharedLibrary().getIdentification().getName(); - exists=installationService.containsSharedLibrary(name); - } - if(exists){ - result=root; - }else{ - FileUtil.deleteFile(tmp); - } - }catch(DeploymentException e){ - result=null; - log.error("Could not process "+location,e); - } - return result; - } - - /** * Get an array of MBeanAttributeInfo * * @return array of AttributeInfos @@ -403,62 +381,84 @@ * @return the Descriptor object */ protected static Descriptor buildDescriptor(File tmpDir){ - Descriptor root=null; - File descriptorFile=new File(tmpDir,DESCRIPTOR_FILE); - if(descriptorFile.exists()){ - ClassLoader cl=Thread.currentThread().getContextClassLoader(); - try{ + Descriptor root = null; + File descriptorFile = new File(tmpDir, DESCRIPTOR_FILE); + if (descriptorFile.exists()) { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + try { Thread.currentThread().setContextClassLoader(AutoDeploymentService.class.getClassLoader()); - FileSystemXmlApplicationContext context=new FileSystemXmlApplicationContext("file:///" - +descriptorFile.getAbsolutePath(),Arrays.asList(new Object[] { new XBeanProcessor() })); - root=(Descriptor) context.getBean("jbi"); - }finally{ + FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext( + "file:///" + descriptorFile.getAbsolutePath(), + Arrays.asList(new Object[] { new XBeanProcessor() })); + root = (Descriptor) context.getBean("jbi"); + } finally { Thread.currentThread().setContextClassLoader(cl); } } return root; } + + protected static String getDescriptorAsText(File tmpDir) { + File descriptorFile = new File(tmpDir, DESCRIPTOR_FILE); + if (descriptorFile.exists()) { + try { + ByteArrayOutputStream os = new ByteArrayOutputStream(); + InputStream is = new FileInputStream(descriptorFile); + FileUtil.copyInputStream(is, os); + return os.toString(); + } catch (Exception e) { + log.debug("Error reading jbi descritor: " + descriptorFile, e); + } + } + return null; + } /** - * Unpack a location into a temp file directory + * Unpack a location into a temp file directory. + * If the location does not contain a jbi descritor, no unpacking occurs. * * @param location - * @return tmp directory + * @return tmp directory (if location contains a jbi descriptor) * @throws DeploymentException */ - protected static File unpackLocation(File tmpRoot,String location) throws DeploymentException{ - File tmpDir=null; - try{ - File file=new File(location); - if(file.isDirectory()){ - log.info("Deploying an exploded jar/zip, we will create a temporary jar for it."); + protected static File unpackLocation(File tmpRoot, String location) throws DeploymentException { + File tmpDir = null; + try { + File file = new File(location); + if (file.isDirectory()) { + if (log.isDebugEnabled()) { + log.debug("Deploying an exploded jar/zip, we will create a temporary jar for it."); + } // If we have a directory then we should move it over - File newFile=new File(tmpRoot.getAbsolutePath()+"/exploded.jar"); + File newFile = new File(tmpRoot.getAbsolutePath() + "/exploded.jar"); newFile.delete(); - FileUtil.zipDir(file.getAbsolutePath(),newFile.getAbsolutePath()); - file=newFile; - log.info("Deployment will now work from "+file.getAbsolutePath()); + FileUtil.zipDir(file.getAbsolutePath(), newFile.getAbsolutePath()); + file = newFile; + if (log.isDebugEnabled()) { + log.debug("Deployment will now work from " + file.getAbsolutePath()); + } } - if(!file.exists()){ + if (!file.exists()) { // assume it's a URL try{ - URL url=new URL(location); - String fileName=url.getFile(); - if(fileName==null||(!fileName.endsWith(".zip")&&!fileName.endsWith(".jar"))){ - throw new DeploymentException("Location: "+location+" is not an archive"); + URL url = new URL(location); + String fileName = url.getFile(); + if (fileName == null || (!fileName.endsWith(".zip") && !fileName.endsWith(".jar"))) { + throw new DeploymentException("Location: " + location + " is not an archive"); } - file=FileUtil.unpackArchive(url,tmpRoot); - }catch(MalformedURLException e){ + file = FileUtil.unpackArchive(url,tmpRoot); + } catch (MalformedURLException e) { throw new DeploymentException(e); } } - if(FileUtil.archiveContainsEntry(file,AutoDeploymentService.DESCRIPTOR_FILE)){ - tmpDir=FileUtil.createUniqueDirectory(tmpRoot,file.getName()); - FileUtil.unpackArchive(file,tmpDir); - log.info("Unpacked archive "+location+" to "+tmpDir); + if (FileUtil.archiveContainsEntry(file, AutoDeploymentService.DESCRIPTOR_FILE)) { + tmpDir = FileUtil.createUniqueDirectory(tmpRoot, file.getName()); + FileUtil.unpackArchive(file, tmpDir); + if (log.isDebugEnabled()) { + log.debug("Unpacked archive " + location + " to " + tmpDir); + } } - }catch(IOException e){ - log.error("I/O error installing archive",e); + } catch (IOException e) { throw new DeploymentException(e); } return tmpDir; @@ -554,26 +554,26 @@ } } - private void persistState(File root,Map map){ - try{ - File file = FileUtil.getDirectoryPath(root,MONITOR_STATE_FILE); + private void persistState(File root, Map map) { + try { + File file = new File(environmentContext.getJbiRootDir(), root.getName() + ".xml"); XmlPersistenceSupport.write(file, map); - }catch(IOException e){ - log.error("Failed to persist file state to: "+root,e); + } catch (IOException e) { + log.error("Failed to persist file state to: " + root, e); } } - private Map readState(File root){ + private Map readState(File root) { Map result = new HashMap(); - try{ - File file = FileUtil.getDirectoryPath(root,MONITOR_STATE_FILE); - if(file.exists()) { + try { + File file = new File(environmentContext.getJbiRootDir(), root.getName() + ".xml"); + if (file.exists()) { result = (Map) XmlPersistenceSupport.read(file); - }else { + } else { log.debug("State file doesn't exist: " + file.getPath()); } - }catch(Exception e){ - log.error("Failed to read file state from: "+root,e); + } catch (Exception e) { + log.error("Failed to read file state from: " + root, e); } return result; } Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java Fri Mar 3 16:31:49 2006 @@ -15,16 +15,8 @@ */ package org.apache.servicemix.jbi.framework; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.servicemix.jbi.container.ActivationSpec; -import org.apache.servicemix.jbi.container.ComponentEnvironment; -import org.apache.servicemix.jbi.container.JBIContainer; -import org.apache.servicemix.jbi.container.SubscriptionSpec; -import org.apache.servicemix.jbi.messaging.DeliveryChannelImpl; -import org.apache.servicemix.jbi.servicedesc.InternalEndpoint; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; +import java.util.MissingResourceException; +import java.util.logging.Logger; import javax.jbi.JBIException; import javax.jbi.component.Component; @@ -39,8 +31,15 @@ import javax.resource.spi.work.WorkManager; import javax.xml.namespace.QName; -import java.util.MissingResourceException; -import java.util.logging.Logger; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.servicemix.jbi.container.ActivationSpec; +import org.apache.servicemix.jbi.container.ComponentEnvironment; +import org.apache.servicemix.jbi.container.JBIContainer; +import org.apache.servicemix.jbi.container.SubscriptionSpec; +import org.apache.servicemix.jbi.servicedesc.InternalEndpoint; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentFragment; /** * This context provides access to data needed by all JBI components running in the JBI environment. @@ -77,13 +76,11 @@ * @param spec * @param installRoot */ - public void activate(Component component, DeliveryChannelImpl channel, ComponentEnvironment env, + public void activate(Component component, ComponentEnvironment env, ActivationSpec spec) { this.component = component; - this.deliveryChannel = channel; this.environment = env; this.activationSpec = spec; - channel.setContext(this); activated = true; //activate and subscriptions container.getRegistry().registerSubscriptions(this, spec); @@ -129,7 +126,9 @@ */ public ServiceEndpoint activateEndpoint(QName serviceName, String endpointName) throws JBIException { checkActivated(); - log.info("Component: " + componentName.getName() + " activated endpoint: " + serviceName + " : " + endpointName); + if (log.isDebugEnabled()) { + log.debug("Component: " + componentName.getName() + " activated endpoint: " + serviceName + " : " + endpointName); + } return container.getRegistry().activateEndpoint(this, serviceName, endpointName); } @@ -199,7 +198,7 @@ * @return the Delivery Channel * @throws MessagingException */ - public DeliveryChannel getDeliveryChannel() throws MessagingException { + public DeliveryChannel getDeliveryChannel() { return deliveryChannel; } @@ -301,9 +300,8 @@ /** * @param deliveryChannel The deliveryChannel to set. */ - public void setDeliveryChannel(DeliveryChannelImpl deliveryChannel) { + public void setDeliveryChannel(DeliveryChannel deliveryChannel) { this.deliveryChannel = deliveryChannel; - deliveryChannel.setContext(this); } /** Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBean.java Fri Mar 3 16:31:49 2006 @@ -23,40 +23,6 @@ */ public interface ComponentMBean extends ComponentLifeCycleMBean { - - /** - * Get the Inbound MessageExchange count - * - * @return inbound count - */ - public long getInboundExchangeCount(); - - /** - * Get the Inbound MessageExchange rate (number/sec) - * - * @return the inbound exchange rate - */ - public double getInboundExchangeRate(); - - /** - * Get the Outbound MessageExchange count - * - * @return outbound count - */ - public long getOutboundExchangeCount(); - - /** - * Get the Outbound MessageExchange rate (number/sec) - * - * @return the outbound exchange rate - */ - public double getOutboundExchangeRate(); - - /** - * reset all stats counters - */ - public void reset(); - /** * Is MessageExchange sender throttling enabled ? * @return true if throttling enabled Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java Fri Mar 3 16:31:49 2006 @@ -16,6 +16,7 @@ package org.apache.servicemix.jbi.framework; import javax.jbi.JBIException; +import javax.jbi.management.DeploymentException; import javax.management.JMException; import javax.management.MBeanAttributeInfo; import javax.management.MBeanOperationInfo; @@ -23,6 +24,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.servicemix.jbi.container.JBIContainer; import org.apache.servicemix.jbi.management.AttributeInfoHelper; import org.apache.servicemix.jbi.management.BaseLifeCycle; import org.apache.servicemix.jbi.management.OperationInfoHelper; @@ -35,7 +37,6 @@ private static Log log = LogFactory.getLog(ComponentMBeanImpl.class); private LocalComponentConnector connector; - private ObjectName objectName; /** @@ -61,13 +62,6 @@ } /** - * Get the ObjectName for this mbean - * @return the ObjectName - */ - public ObjectName getObjectName(){ - return objectName; - } - /** * Get the name of the item * @return the name */ @@ -96,7 +90,8 @@ } - public void init() throws JBIException{ + public void init() throws JBIException { + log.info("Initializing component: " + connector.getContext().getComponentName()); connector.init(); super.init(); } @@ -107,6 +102,7 @@ * @exception javax.jbi.JBIException if the item fails to start. */ public void start() throws javax.jbi.JBIException { + log.info("Starting component: " + connector.getContext().getComponentName()); try { doStart(); connector.writeRunningState(); @@ -128,6 +124,7 @@ * @exception javax.jbi.JBIException if the item fails to stop. */ public void stop() throws javax.jbi.JBIException { + log.info("Stopping component: " + connector.getContext().getComponentName()); try { doStop(); connector.writeRunningState(); @@ -149,6 +146,7 @@ * @exception javax.jbi.JBIException if the item fails to shut down. */ public void shutDown() throws javax.jbi.JBIException { + log.info("Shutting down component: " + connector.getContext().getComponentName()); try { doShutDown(); connector.writeRunningState(); @@ -164,6 +162,10 @@ } } + public void setShutdownStateAfterInstall() { + setCurrentState(SHUTDOWN); + } + /** * Start the item - doesn't persist the state * @@ -177,6 +179,8 @@ if (!isStarted()) { connector.getLifeCycle().start(); super.start(); + initServiceAssemblies(); + startServiceAssemblies(); } } @@ -188,10 +192,10 @@ */ public void doStop() throws javax.jbi.JBIException { if (isUnknown() || isStarted()) { + stopServiceAssemblies(); connector.getLifeCycle().stop(); super.stop(); } - } /** @@ -200,11 +204,16 @@ * @exception javax.jbi.JBIException if the item fails to shut down. */ public void doShutDown() throws javax.jbi.JBIException { - doStop(); // Transition from UNKNOWN to SHUTDOWN is done at installation time // In this case or if the component is already shut down, do nothing - if (!getCurrentState().equals(UNKNOWN) && !getCurrentState().equals(SHUTDOWN)) { + if (!isUnknown() && !isShutDown()) { + doStop(); + shutDownServiceAssemblies(); connector.getLifeCycle().shutDown(); + if (connector.getDeliveryChannel() != null) { + connector.getDeliveryChannel().close(); + connector.setDeliveryChannel(null); + } } super.shutDown(); } @@ -228,60 +237,15 @@ /** - * Get the Inbound MessageExchange count - * - * @return inbound count - */ - public long getInboundExchangeCount() { - return connector.getDeliveryChannel().getMessagingStats().getInboundExchanges().getCount(); - } - - /** - * Get the Inbound MessageExchange rate (number/sec) - * - * @return the inbound exchange rate - */ - public double getInboundExchangeRate() { - return connector.getDeliveryChannel().getMessagingStats().getInboundExchangeRate().getAveragePerSecond(); - } - - /** - * Get the Outbound MessageExchange count - * - * @return outbound count - */ - public long getOutboundExchangeCount() { - return connector.getDeliveryChannel().getMessagingStats().getOutboundExchanges().getCount(); - } - - /** - * Get the Outbound MessageExchange rate (number/sec) - * - * @return the outbound exchange rate - */ - public double getOutboundExchangeRate() { - return connector.getDeliveryChannel().getMessagingStats().getOutboundExchangeRate().getAveragePerSecond(); - } - - /** - * reset all stats counters - */ - public void reset() { - connector.getDeliveryChannel().getMessagingStats().getOutboundExchangeRate().reset(); - } - - /** - * @return size of the inbound Queue - */ - public int getInboundQueueSize(){ - return connector.getDeliveryChannel().getQueueSize(); - } - - /** * @return the capacity of the inbound queue */ public int getInboundQueueCapacity(){ - return connector.getDeliveryChannel().getQueueCapacity(); + // TODO: should not be on the delivery channel + if (connector.getDeliveryChannel() != null) { + return connector.getDeliveryChannel().getQueueCapacity(); + } else { + return 0; + } } /** @@ -289,7 +253,10 @@ * @param value */ public void setInboundQueueCapacity(int value){ - connector.getDeliveryChannel().setQueueCapacity(value); + // TODO: should not be on the delivery channel + if (connector.getDeliveryChannel() != null) { + connector.getDeliveryChannel().setQueueCapacity(value); + } } /** @@ -297,7 +264,7 @@ * @return true if throttling enabled */ public boolean isExchangeThrottling(){ - return connector.getDeliveryChannel().isExchangeThrottling(); + return connector.isExchangeThrottling(); } /** @@ -306,7 +273,7 @@ * */ public void setExchangeThrottling(boolean value){ - connector.getDeliveryChannel().setExchangeThrottling(value); + connector.setExchangeThrottling(value); } /** @@ -314,7 +281,7 @@ * @return throttling tomeout (ms) */ public long getThrottlingTimeout(){ - return connector.getDeliveryChannel().getThrottlingTimeout(); + return connector.getThrottlingTimeout(); } /** @@ -322,7 +289,7 @@ * @param value (ms) */ public void setThrottlingTimeout(long value){ - connector.getDeliveryChannel().setThrottlingTimeout(value); + connector.setThrottlingTimeout(value); } /** @@ -331,7 +298,7 @@ * @return interval for throttling */ public int getThrottlingInterval(){ - return connector.getDeliveryChannel().getThrottlingInterval(); + return connector.getThrottlingInterval(); } /** @@ -340,14 +307,14 @@ * @param value */ public void setThrottlingInterval(int value){ - connector.getDeliveryChannel().setThrottlingInterval(value); + connector.setThrottlingInterval(value); } /** * @return the ObjectName for the stats MBean for this Component - or null if it doesn't exist */ public ObjectName getStatsMBeanName(){ - return connector.getStatsMbeanName(); + return connector.getStatsMBeanName(); } /** * Get an array of MBeanAttributeInfo @@ -363,7 +330,7 @@ helper.addAttribute(getObjectToManage(), "throttlingInterval", "exchange intervals before throttling"); helper.addAttribute(getObjectToManage(), "extensionMBeanName", "extension mbean name"); helper.addAttribute(getObjectToManage(), "statsMBeanName", "Statistics mbean name"); - return AttributeInfoHelper.join(super.getAttributeInfos(),helper.getAttributeInfos()); + return AttributeInfoHelper.join(super.getAttributeInfos(), helper.getAttributeInfos()); } /** @@ -374,17 +341,52 @@ */ public MBeanOperationInfo[] getOperationInfos() throws JMException { OperationInfoHelper helper = new OperationInfoHelper(); - helper.addOperation(getObjectToManage(), "reset", "reset statistic counters"); - return OperationInfoHelper.join(super.getOperationInfos(),helper.getOperationInfos()); + return OperationInfoHelper.join(super.getOperationInfos(), helper.getOperationInfos()); } - public void setObjectName(ObjectName objectName) { - this.objectName = objectName; - } - public void firePropertyChanged(String name, Object oldValue, Object newValue) { super.firePropertyChanged(name, oldValue, newValue); } + protected void initServiceAssemblies() throws DeploymentException { + } + + protected void startServiceAssemblies() throws DeploymentException { + } + + protected void stopServiceAssemblies() throws DeploymentException { + Registry registry = connector.getContainer().getRegistry(); + String componentName = connector.getContext().getComponentName(); + String[] sas = registry.getDeployedServiceAssembliesForComponent(componentName); + for (int i = 0; i < sas.length; i++) { + ServiceAssemblyLifeCycle sa = registry.getServiceAssembly(sas[i]); + if (sa.isStarted()) { + try { + sa.stop(false); + // TODO: add sa to a list of pending sa + } catch (Exception e) { + log.error("Error stopping service assembly " + sas[i]); + } + } + } + } + + protected void shutDownServiceAssemblies() throws DeploymentException { + JBIContainer container = connector.getContainer(); + Registry registry = container.getRegistry(); + String componentName = connector.getContext().getComponentName(); + String[] sas = registry.getDeployedServiceAssembliesForComponent(componentName); + for (int i = 0; i < sas.length; i++) { + ServiceAssemblyLifeCycle sa = registry.getServiceAssembly(sas[i]); + if (sa.isStopped()) { + try { + sa.shutDown(false); + // TODO: add sa to a list of pending sa + } catch (Exception e) { + log.error("Error shutting down service assembly " + sas[i]); + } + } + } + } } Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java Fri Mar 3 16:31:49 2006 @@ -15,13 +15,6 @@ */ package org.apache.servicemix.jbi.framework; -import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; - -import org.apache.servicemix.jbi.messaging.DeliveryChannelImpl; - -import javax.jbi.JBIException; -import javax.jbi.component.Component; - import java.util.Collection; import java.util.Collections; import java.util.Iterator; @@ -29,6 +22,11 @@ import java.util.Map; import java.util.Set; +import javax.jbi.JBIException; +import javax.jbi.component.Component; + +import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; + /** * Registry for Components * @@ -62,12 +60,11 @@ public LocalComponentConnector registerComponent(ComponentNameSpace name, String description, Component component, - DeliveryChannelImpl dc, boolean binding, boolean service) { LocalComponentConnector result = null; if (!componentMap.containsKey(component)) { - result = new LocalComponentConnector(name, description, component, dc, binding, service); + result = new LocalComponentConnector(registry.getContainer(), name, description, component, binding, service); componentMap.put(component, result); localIdMap.put(name, result); addComponentConnector(result); @@ -101,6 +98,7 @@ LocalComponentConnector lcc = (LocalComponentConnector) i.next(); lcc.getComponentMBean().doStop(); } + runningStateInitialized = false; } /** @@ -112,9 +110,7 @@ for (Iterator i = getLocalComponentConnectors().iterator();i.hasNext();) { LocalComponentConnector lcc = (LocalComponentConnector) i.next(); lcc.getComponentMBean().persistRunningState(); - lcc.getComponentMBean().doStop(); lcc.getComponentMBean().doShutDown(); - lcc.getDeliveryChannel().close(); } } @@ -239,7 +235,6 @@ return localIdMap.values(); } - /** * * @return Collection of ComponentConnectors held by the registry @@ -247,6 +242,7 @@ public Collection getComponentConnectors() { return idMap.values(); } + /** * @return Returns the containerName. */ Copied: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStats.java (from r381300, incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBeanImpl.java) URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStats.java?p2=incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStats.java&p1=incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBeanImpl.java&r1=381300&r2=382984&rev=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBeanImpl.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStats.java Fri Mar 3 16:31:49 2006 @@ -18,7 +18,7 @@ import javax.management.JMException; import javax.management.MBeanAttributeInfo; import javax.management.MBeanOperationInfo; -import javax.management.ObjectName; + import org.apache.servicemix.jbi.management.AttributeInfoHelper; import org.apache.servicemix.jbi.management.BaseLifeCycle; import org.apache.servicemix.jbi.management.OperationInfoHelper; @@ -26,30 +26,19 @@ /** * Defines basic statistics on the Component */ -public class ComponentStatsMBeanImpl extends BaseLifeCycle implements ComponentStatsMBean { +public class ComponentStats extends BaseLifeCycle implements ComponentStatsMBean { + private LocalComponentConnector connector; - private ObjectName objectName; - /** * Constructor * * @param lcc */ - public ComponentStatsMBeanImpl(LocalComponentConnector lcc) { + public ComponentStats(LocalComponentConnector lcc) { this.connector = lcc; } - - /** - * Get the ObjectName for this mbean - * @return the ObjectName - */ - public ObjectName getObjectName(){ - return objectName; - } - - /** * Get the type of the item * @return the type @@ -57,41 +46,34 @@ public String getType() { return "Component"; } - + public String getSubType() { return "Statistics"; } - + /** * Get the name of the item * @return the name */ - public String getName(){ + public String getName() { return connector.getComponentNameSpace().getName(); } - - /** + + /** * Get the Description of the item * @return the description */ - public String getDescription(){ + public String getDescription() { return "Statistics for " + connector.getComponentPacket().getDescription(); } - - - - - - - /** * Get the Inbound MessageExchange count * * @return inbound count */ public long getInboundExchangeCount() { - return connector.getDeliveryChannel().getMessagingStats().getInboundExchanges().getCount(); + return connector.getMessagingStats().getInboundExchanges().getCount(); } /** @@ -100,7 +82,7 @@ * @return the inbound exchange rate */ public double getInboundExchangeRate() { - return connector.getDeliveryChannel().getMessagingStats().getInboundExchangeRate().getAverageTime(); + return connector.getMessagingStats().getInboundExchangeRate().getAverageTime(); } /** @@ -109,7 +91,7 @@ * @return outbound count */ public long getOutboundExchangeCount() { - return connector.getDeliveryChannel().getMessagingStats().getOutboundExchanges().getCount(); + return connector.getMessagingStats().getOutboundExchanges().getCount(); } /** @@ -118,20 +100,27 @@ * @return the outbound exchange rate */ public double getOutboundExchangeRate() { - return connector.getDeliveryChannel().getMessagingStats().getOutboundExchangeRate().getAverageTime(); + return connector.getMessagingStats().getOutboundExchangeRate().getAverageTime(); } - - /** * @return size of the inbound Queue */ - public int getInboundQueueSize(){ - return connector.getDeliveryChannel().getQueueSize(); + public int getInboundQueueSize() { + if (connector.getDeliveryChannel() != null) { + return connector.getDeliveryChannel().getQueueSize(); + } else { + return 0; + } } - - - + + /** + * Reset all stats counters + */ + public void reset() { + connector.getMessagingStats().reset(); + } + /** * Get an array of MBeanAttributeInfo * @@ -147,7 +136,7 @@ helper.addAttribute(getObjectToManage(), "outboundExchangeRate", "rate of outbound exchanges/sec"); return helper.getAttributeInfos(); } - + /** * Get an array of MBeanOperationInfo * @@ -155,19 +144,8 @@ */ public MBeanOperationInfo[] getOperationInfos() { OperationInfoHelper helper = new OperationInfoHelper(); + helper.addOperation(getObjectToManage(), "reset", "reset statistic counters"); return helper.getOperationInfos(); } - - - /** - * Set the object name - * @param objectName - */ - public void setObjectName(ObjectName objectName) { - this.objectName = objectName; - } - - - } Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBean.java URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBean.java?rev=382984&r1=382983&r2=382984&view=diff ============================================================================== --- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBean.java (original) +++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentStatsMBean.java Fri Mar 3 16:31:49 2006 @@ -55,4 +55,8 @@ */ public int getInboundQueueSize(); + /** + * reset all stats counters + */ + public void reset();
{'source': 'Apache Software Foundation Public Mail Archives'}