Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.activemq.broker.jmx;

import java.net.URISyntaxException;

import org.apache.activemq.network.NetworkConnector;

public class NetworkConnectorView implements NetworkConnectorViewMBean {
Expand All @@ -37,6 +39,20 @@ public void stop() throws Exception {
connector.stop();
}

@Override
public String getUri() {
return connector.getUri() != null ? connector.getUri().toString() : "";
}

@Override
public String getLocalUri() {
try {
return connector.getLocalUri() != null ? connector.getLocalUri().toString() : "";
} catch (URISyntaxException e) {
return "";
}
}

@Override
public String getName() {
return connector.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

public interface NetworkConnectorViewMBean extends Service {

String getUri();

String getLocalUri();

String getName();

int getMessageTTL();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public void setRemoteTransport(Transport remoteTransport) {
this.remoteTransport = remoteTransport;
}

// Satisfies the abstract getUri() contract from NetworkConnector; delegates to getRemoteURI()
@Override
public URI getUri() {
return getRemoteURI();
}

public URI getRemoteURI() {
return remoteURI;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public NetworkConnector(URI localURI) {
this.localURI = localURI;
}

public abstract URI getUri();

public URI getLocalUri() throws URISyntaxException {
return localURI;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public void testBridgeRegistration() throws Exception {

assertNotNull(nc);
assertEquals("NC", nc.getName());
assertEquals("static:(tcp://localhost:61617)", nc.getUri());
assertNotNull(nc.getLocalUri());
}

@Test
Expand Down
Loading