Skip to content
Permalink
Browse files

Merge remote-tracking branches 'upstream/pr/3719', 'upstream/pr/3722'…

…, 'upstream/pr/3723', 'upstream/pr/3726' and 'upstream/pr/3727' into 20190408_002
  • Loading branch information
darranl committed Apr 8, 2019
6 parents a988279 + 6796bfd + 109661f + 4d39cfe + a1cf0e2 + d62581e commit 2f1c7117e0f02c9e8586752b9a068319b1965cfa
@@ -22,14 +22,36 @@
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceTarget;

/**The target of ServiceBuilder for capabilities installations.
/**
* The target of ServiceBuilder for capability installations.
* CapabilityServiceBuilder to be installed on a target should be retrieved by calling one of the {@code addCapability} methods.
* Notice that installation will only take place after {@link CapabilityServiceBuilder#install()} is invoked.
* CapabilityServiceBuilder that are not installed are ignored.
*
* @author Tomaz Cerar (c) 2017 Red Hat Inc.
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public interface CapabilityServiceTarget extends ServiceTarget {

/**
* Gets a builder which can be used to add a capability service into this capability target.
*
* @param capability the capability to be installed
* @param service the service implementing this capability
* @return new capability builder instance
* @throws IllegalArgumentException if capability does not provide a service
* @deprecated use {@link #addCapability(RuntimeCapability)} method instead
*/
@Deprecated
<T> CapabilityServiceBuilder<T> addCapability(final RuntimeCapability<?> capability, final Service<T> service) throws IllegalArgumentException;

/**
* Gets a builder which can be used to add a capability service into this capability target.
*
* @param capability the capability to be installed
* @return new capability builder instance
* @throws IllegalArgumentException if capability does not provide a service
*/
CapabilityServiceBuilder<?> addCapability(final RuntimeCapability<?> capability) throws IllegalArgumentException;

}
@@ -2125,6 +2125,16 @@ synchronized void done() {
}
}

@Override
@SuppressWarnings("unchecked")
public CapabilityServiceBuilder<?> addCapability(final RuntimeCapability<?> capability) throws IllegalArgumentException {
if (capability.isDynamicallyNamed()){
return new CapabilityServiceBuilderImpl(addService(capability.getCapabilityServiceName(targetAddress)), targetAddress);
}else{
return new CapabilityServiceBuilderImpl(addService(capability.getCapabilityServiceName()), targetAddress);
}
}

@Override
protected ServiceTarget getDelegate() {
checkNotInManagementOperation();
@@ -248,4 +248,15 @@ public PlaceholderResourceEntry clone() {
public Set<String> getOrderedChildTypes() {
return Collections.emptySet();
}

@Override
public int hashCode() {
return this.moduleName.hashCode();
}

@Override
public boolean equals(Object object) {
if (!(object instanceof ExtensionResource)) return false;
return this.moduleName.equals(((ExtensionResource) object).moduleName);
}
}
@@ -450,6 +450,17 @@ public boolean isProxy() {
public Resource clone() {
return delegate.clone();
}

@Override
public int hashCode() {
return this.getPathElement().hashCode();
}

@Override
public boolean equals(Object object) {
if (!(object instanceof ResourceEntry)) return false;
return this.getPathElement().equals(((ResourceEntry) object).getPathElement());
}
}

}
@@ -165,5 +165,16 @@ public PathElement getPathElement() {
public PlaceholderResourceEntry clone() {
return this;
}

@Override
public int hashCode() {
return this.path.hashCode();
}

@Override
public boolean equals(Object object) {
if (!(object instanceof ResourceEntry)) return false;
return this.path.equals(((ResourceEntry) object).getPathElement());
}
}
}
@@ -394,5 +394,16 @@ public String getName() {
public PathElement getPathElement() {
return delegate.getPathElement();
}

@Override
public int hashCode() {
return this.getPathElement().hashCode();
}

@Override
public boolean equals(Object object) {
if (!(object instanceof ResourceEntry)) return false;
return this.getPathElement().equals(((ResourceEntry) object).getPathElement());
}
}
}
@@ -52,6 +52,7 @@
<path name="org/wildfly/security/password"/>
<path name="org/wildfly/security/password/interfaces"/>
<path name="org/wildfly/security/password/spec"/>
<path name="org/wildfly/security/password/util"/>
<path name="org/wildfly/security/permission"/>
<path name="org/wildfly/security/sasl/util"/>
<path name="org/wildfly/security/ssl"/>
@@ -113,7 +113,9 @@ public SocketBindingManager getSocketBindings() {

private int calculatePort() {
int port = this.port;
if (!isFixedPort) {
// 0 is a reserved port number indicating usage of system-allocated dynamic ports
// and thus port offset must not be applied
if (!isFixedPort && port != 0) {
port += socketBindings.getPortOffset();
}
return port;
@@ -265,11 +267,11 @@ public void setClientMappings(List<ClientMapping> clientMappings) {
}

/**
* Unlike the {@link #getPort()} method, this method takes into account the port offset, if the port
* is <i>not</i> a fixed port and returns the absolute port number which is the sum of the port offset
* and the (relative) port.
* Unlike the {@link #getPort()} method, this method takes into account the port offset, if the port is <i>not</i> a fixed
* port nor dynamically allocated ephemeral port (port number 0) and returns the absolute port number which is the sum of
* the port offset and the (relative) port.
*
* @return port number configured for this socket binding taking port-offset into account
* @return port number configured for this socket binding taking port-offset into account when appropriate
*/
public int getAbsolutePort() {
return calculatePort();
@@ -151,7 +151,7 @@
<version.com.jcraft.jzlib>1.1.1</version.com.jcraft.jzlib>
<version.commons-io>2.5</version.commons-io>
<version.commons-lang>2.6</version.commons-lang>
<version.io.undertow>2.0.19.Final</version.io.undertow>
<version.io.undertow>2.0.20.Final</version.io.undertow>
<version.javax.inject.javax.inject>1</version.javax.inject.javax.inject>
<version.javax.json.javax-json-api>1.1.2</version.javax.json.javax-json-api>
<version.junit>4.12</version.junit>
@@ -149,7 +149,8 @@ public void testPortOffsetZero() throws Exception {
Assert.assertEquals(8000, socketBinding.getSocketBindings().getPortOffset());
Assert.assertFalse("fixed port", socketBinding.isFixedPort());
Assert.assertEquals(0, socketBinding.getPort());
Assert.assertEquals(8000, socketBinding.getSocketAddress().getPort());
// Port 0 must not be affected by port-offset
Assert.assertEquals(0, socketBinding.getSocketAddress().getPort());
}

/**

0 comments on commit 2f1c711

Please sign in to comment.
You can’t perform that action at this time.