activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r389528 - in /incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean: BrokerServiceGBeanImpl.java DataSourceReference.java
Date Tue, 28 Mar 2006 16:03:32 GMT
Author: chirino
Date: Tue Mar 28 08:03:28 2006
New Revision: 389528

URL: http://svn.apache.org/viewcvs?rev=389528&view=rev
Log:
Adding back ability to configure the data directory and datasource.

Added:
    incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java
Modified:
    incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java

Modified: incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java?rev=389528&r1=389527&r2=389528&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java
(original)
+++ incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/BrokerServiceGBeanImpl.java
Tue Mar 28 08:03:28 2006
@@ -18,13 +18,18 @@
 
 import java.net.URI;
 
+import javax.sql.DataSource;
+
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.store.DefaultPersistenceAdapterFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
 
 /**
  * Default implementation of the ActiveMQ Message Server
@@ -38,10 +43,13 @@
     private String brokerName;
     private String brokerUri;
     private BrokerService brokerService;
+    private ServerInfo serverInfo;
+    private String dataDirectory;
+    private DataSourceReference dataSource;
 
     public BrokerServiceGBeanImpl() {
     }
-
+    
     public synchronized BrokerService getBrokerContainer() {
         return brokerService;
     }
@@ -52,8 +60,11 @@
         	try {
     	        if (brokerService == null) {
     	            brokerService = createContainer();
-    	            brokerService.start();
     	        }
+                DefaultPersistenceAdapterFactory persistenceFactory = brokerService.getPersistenceFactory();
+                persistenceFactory.setDataDirectory(serverInfo.resolve(dataDirectory));
+                persistenceFactory.setDataSource((DataSource) dataSource.$getResource());
+                brokerService.start();
         	} finally {
             	Thread.currentThread().setContextClassLoader(old);
         	}
@@ -95,8 +106,11 @@
 
     static {
         GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ActiveMQ Message Broker", BrokerServiceGBeanImpl.class,
"JMSServer");
+        infoFactory.addReference("serverInfo", ServerInfo.class);
         infoFactory.addAttribute("brokerName", String.class, true);
         infoFactory.addAttribute("brokerUri", String.class, true);
+        infoFactory.addAttribute("dataDirectory", String.class, true);
+        infoFactory.addReference("dataSource", DataSourceReference.class);
         infoFactory.addInterface(BrokerServiceGBean.class);
         // infoFactory.setConstructor(new String[]{"brokerName, brokerUri"});
         GBEAN_INFO = infoFactory.getBeanInfo();
@@ -123,6 +137,30 @@
 
     public void setBrokerUri(String brokerUri) {
         this.brokerUri = brokerUri;
+    }
+
+    public ServerInfo getServerInfo() {
+        return serverInfo;
+    }
+
+    public void setServerInfo(ServerInfo serverInfo) {
+        this.serverInfo = serverInfo;
+    }
+
+    public String getDataDirectory() {
+        return dataDirectory;
+    }
+
+    public void setDataDirectory(String dataDir) {
+        this.dataDirectory = dataDir;
+    }
+
+    public DataSourceReference getDataSource() {
+        return dataSource;
+    }
+
+    public void setDataSource(DataSourceReference dataSource) {
+        this.dataSource = dataSource;
     }
 
 	

Added: incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java?rev=389528&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java
(added)
+++ incubator/activemq/trunk/activemq-gbean/src/main/java/org/apache/activemq/gbean/DataSourceReference.java
Tue Mar 28 08:03:28 2006
@@ -0,0 +1,21 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.activemq.gbean;
+
+public interface DataSourceReference {
+    public Object $getResource();
+}



Mime
View raw message