forked from wildfly/wildfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WFLY-490] Update the current management model to JMX integration to …
…hide the entire management model representation if access is prevented. (Previously errors were being reported to the client and remaining functionality of JMX clients such as jconsole was subsequently broken)
- Loading branch information
1 parent
3124219
commit ea95a10
Showing
4 changed files
with
121 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,10 +48,6 @@ | |
|
||
/** | ||
* An MBeanServer wrapper that exposes the ModelController via JMX. | ||
* <p/> | ||
* <b>Note:</b> This only gets invoked when connecting via JConsole | ||
* if you connect via a remote process URL. If you connect to a 'Local Process' the platform MBean | ||
* Server is used directly. | ||
* | ||
* @author <a href="[email protected]">Kabir Khan</a> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
* | ||
* @author <a href="[email protected]">Kabir Khan</a> | ||
*/ | ||
public class SecurityActions { | ||
class SecurityActions { | ||
static ClassLoader getClassLoader(final Class<?> clazz) { | ||
return ! WildFlySecurityManager.isChecking() ? clazz.getClassLoader() : doPrivileged(new GetClassLoaderAction(clazz)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,21 +23,35 @@ | |
|
||
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import org.jboss.as.controller.ModelController; | ||
import org.jboss.as.controller.ModelController.OperationTransactionControl; | ||
import org.jboss.as.controller.OperationContext; | ||
import org.jboss.as.controller.OperationDefinition; | ||
import org.jboss.as.controller.OperationFailedException; | ||
import org.jboss.as.controller.OperationStepHandler; | ||
import org.jboss.as.controller.PathAddress; | ||
import org.jboss.as.controller.PathElement; | ||
import org.jboss.as.controller.ProxyController; | ||
import org.jboss.as.controller.SimpleOperationDefinitionBuilder; | ||
import org.jboss.as.controller.UnauthorizedException; | ||
import org.jboss.as.controller.access.constraint.management.AccessConstraintDefinition; | ||
import org.jboss.as.controller.descriptions.DescriptionProvider; | ||
import org.jboss.as.controller.registry.AliasEntry; | ||
import org.jboss.as.controller.registry.AttributeAccess; | ||
import org.jboss.as.controller.registry.ImmutableManagementResourceRegistration; | ||
import org.jboss.as.controller.registry.OperationEntry; | ||
import org.jboss.as.controller.registry.OperationEntry.Flag; | ||
import org.jboss.as.controller.registry.Resource; | ||
import org.jboss.as.server.ServerMessages; | ||
import org.jboss.dmr.ModelNode; | ||
|
||
/** | ||
* Ugly hack to be able to get the root resurce and registration. | ||
* Ugly hack to be able to get the root resource and registration. | ||
* | ||
* @author <a href="[email protected]">Kabir Khan</a> | ||
*/ | ||
|
@@ -68,7 +82,11 @@ public void execute(OperationContext context, ModelNode operation) throws Operat | |
if (threadResource == null || threadResource != ResourceAndRegistration.NULL) { | ||
throw ServerMessages.MESSAGES.internalUseOnly(); | ||
} | ||
try { | ||
resource.set(new ResourceAndRegistration(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true), context.getResourceRegistration())); | ||
} catch (UnauthorizedException e) { | ||
resource.set(new ResourceAndRegistration(Resource.Factory.create(), new EmptyResourceRegistration())); | ||
} | ||
context.stepCompleted(); | ||
} | ||
|
||
|
@@ -105,4 +123,98 @@ public ImmutableManagementResourceRegistration getRegistration() { | |
return registry; | ||
} | ||
} | ||
|
||
private static class EmptyResourceRegistration implements ImmutableManagementResourceRegistration { | ||
|
||
@Override | ||
public boolean isRuntimeOnly() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isRemote() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isAlias() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public AliasEntry getAliasEntry() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public OperationStepHandler getOperationHandler(PathAddress address, String operationName) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public DescriptionProvider getOperationDescription(PathAddress address, String operationName) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Set<Flag> getOperationFlags(PathAddress address, String operationName) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public OperationEntry getOperationEntry(PathAddress address, String operationName) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Set<String> getAttributeNames(PathAddress address) { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public AttributeAccess getAttributeAccess(PathAddress address, String attributeName) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Set<String> getChildNames(PathAddress address) { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public Set<PathElement> getChildAddresses(PathAddress address) { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public DescriptionProvider getModelDescription(PathAddress address) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Map<String, OperationEntry> getOperationDescriptions(PathAddress address, boolean inherited) { | ||
return Collections.emptyMap(); | ||
} | ||
|
||
@Override | ||
public ProxyController getProxyController(PathAddress address) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Set<ProxyController> getProxyControllers(PathAddress address) { | ||
return Collections.emptySet(); | ||
} | ||
|
||
@Override | ||
public ImmutableManagementResourceRegistration getSubModel(PathAddress address) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<AccessConstraintDefinition> getAccessConstraints() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
} | ||
} |