Author: norman
Date: Fri Nov 5 12:36:57 2010
New Revision: 1031541
URL: http://svn.apache.org/viewvc?rev=1031541&view=rev
Log:
Cleanup imports
Added:
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/RestrictingRMISocketFactory.java
Modified:
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java
james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobStrategy.java
Modified:
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java?rev=1031541&r1=1031540&r2=1031541&view=diff
==============================================================================
---
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java
(original)
+++
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/Main.java
Fri Nov 5 12:36:57 2010
@@ -18,12 +18,19 @@
****************************************************************/
package org.apache.james.container.spring;
+import java.io.IOException;
+import java.rmi.server.RMISocketFactory;
+
/**
* Bootstraps James using a Spring container
*/
public class Main {
- public static void main(String[] args) {
+ public static void main(String[] args) throws IOException {
+ // Make sure we can bind jmx sockets to a specific ipaddress
+ // https://issues.apache.org/jira/browse/JAMES-1104
+ RMISocketFactory.setSocketFactory(new RestrictingRMISocketFactory());
+
final JamesServerApplicationContext context = new
JamesServerApplicationContext(new String[] { "spring-beans.xml" });
context.registerShutdownHook();
}
Added:
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/RestrictingRMISocketFactory.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/RestrictingRMISocketFactory.java?rev=1031541&view=auto
==============================================================================
---
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/RestrictingRMISocketFactory.java
(added)
+++
james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/RestrictingRMISocketFactory.java
Fri Nov 5 12:36:57 2010
@@ -0,0 +1,56 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you 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.james.container.spring;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.rmi.server.RMISocketFactory;
+
+public class RestrictingRMISocketFactory extends RMISocketFactory {
+
+ private String address;
+
+ public RestrictingRMISocketFactory() {
+ address = System.getProperty("james.jmx.address");
+ if (address == null) {
+ address = "localhost";
+ }
+ }
+
+ /**
+ * Create a {...@link ServerSocket} which is bound to an specific address
and the given port.
+ * The address can be specified by the System Property james.jmx.address.
If none is given it will use
+ * localhost
+ */
+ public ServerSocket createServerSocket(int port) throws IOException {
+ ServerSocket socket = new ServerSocket();
+ socket.bind(new InetSocketAddress(address, port));
+ return socket;
+ }
+
+ /**
+ * Create a new {...@link Socket} for the given host and port
+ */
+ public Socket createSocket(String host, int port) throws IOException {
+ return new Socket(host, port);
+ }
+
+}
Modified:
james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobStrategy.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobStrategy.java?rev=1031541&r1=1031540&r2=1031541&view=diff
==============================================================================
---
james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobStrategy.java
(original)
+++
james/server/trunk/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobStrategy.java
Fri Nov 5 12:36:57 2010
@@ -18,7 +18,7 @@
****************************************************************/
package org.apache.james.queue.activemq;
-import java.io.File;
+import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -34,8 +34,6 @@ import org.apache.activemq.blob.BlobDown
import org.apache.activemq.blob.BlobTransferPolicy;
import org.apache.activemq.blob.BlobUploadStrategy;
import org.apache.activemq.command.ActiveMQBlobMessage;
-import org.apache.commons.io.FileUtils;
-import org.apache.james.core.NonClosingSharedInputStream;
import org.apache.james.services.FileSystem;
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]