Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#117: added new cmdlet and added output type #118

Merged
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
74 changes: 38 additions & 36 deletions src/net/Documentation/articles/usagePS.md
Original file line number Diff line number Diff line change
@@ -86,42 +86,44 @@ _jnetps_ accepts the following cmdlets:
* ClassName

From version 1.5.0 new JMX comlets are available:
* **Add-NotificationListener**:
* **Get-DefaultDomain**:
* **Get-Domains**:
* **Get-IsMXBeanInterface**:
* **Get-JMXConnector**:
* **Get-MBeanCount**:
* **Get-MBeanInfo**:
* **Get-QueryNames**:
* **Get-QueryClassattr**:
* **Get-QueryValueExp**:
* **Invoke-QueryAnd**:
* **Invoke-QueryAnySubString**:
* **Invoke-QueryAttr**:
* **Invoke-QueryBetween**:
* **Invoke-QueryDiv**:
* **Invoke-QueryEq**:
* **Invoke-QueryFinalSubString**:
* **Invoke-QueryGeq**:
* **Invoke-QueryGt**:
* **Invoke-QueryIn**:
* **Invoke-QueryInitialSubString**:
* **Invoke-QueryIsInstanceOf**:
* **Invoke-QueryLeq**:
* **Invoke-QueryLt**:
* **Invoke-QueryMatch**:
* **Invoke-QueryMinus**:
* **Invoke-QueryNot**:
* **Invoke-QueryOr**:
* **Invoke-QueryPlus**:
* **Invoke-QueryTimes**:
* **New-JMXServiceURL**:
* **New-MBeanProxy**:
* **New-MXBeanProxy**:
* **New-NotificationListener**:
* **New-ObjectName**:
* **Remove-NotificationListener**:
* **Add-NotificationListener**: adds a notification listener and filter on a JMXConnector
* **Get-DefaultDomain**: get default domain from a JMXConnector
* **Get-Domains**: get all domains from a JMXConnector
* **Get-IsMXBeanInterface**: verify if the class name is an MBean interface
* **Get-JMXConnector**: get a JMXConnector
* **Get-MBeanCount**: get the number of MBean from a JMXConnector
* **Get-MBeanInfo**: get the MBeanInfo from an ObjectName using a JMXConnector
* **Get-QueryNames**: get the ObjectNames using a JMXConnector
* **Invoke-QueryAnd**: execute Query.And
* **Invoke-QueryAnySubString**: execute Query.AnySubString
* **Invoke-QueryAttr**: execute Query.Attr
* **Invoke-QueryBetween**: execute Query.Between
* **Invoke-QueryClassattr**: execute Query.Classattr
* **Invoke-QueryDiv**: execute Query.Div
* **Invoke-QueryEq**: execute Query.Eq
* **Invoke-QueryFinalSubString**: execute Query.FinalSubString
* **Invoke-QueryGeq**: execute Query.Geq
* **Invoke-QueryGt**: execute Query.Gt
* **Invoke-QueryIn**: execute Query.In
* **Invoke-QueryInitialSubString**: execute Query.nitialSubString
* **Invoke-QueryIsInstanceOf**: execute Query.IsInstanceOf
* **Invoke-QueryLeq**: execute Query.Leq
* **Invoke-QueryLt**: execute Query.Lt
* **Invoke-QueryMatch**: execute Query.Match
* **Invoke-QueryMinus**: execute Query.Minus
* **Invoke-QueryNot**: execute Query.Not
* **Invoke-QueryOr**: execute Query.Or
* **Invoke-QueryPlus**: execute Query.Plus
* **Invoke-QueryTimes**: execute Query.Times
* **Invoke-QueryValue**: execute Query.Value
* **New-AttributeChangeNotificationFilter**: create a new AttributeChangeNotificationFilter to be used in Add-NotificationListener
* **New-JMXServiceURL**: create a new JMXServiceURL to be used in Get-JMXConnector
* **New-MBeanProxy**: get a MBeanProxy from a JMXConnector
* **New-MXBeanProxy**: get a MXBeanProxy from a JMXConnector
* **New-NotificationFilterSupport**: create a new NotificationFilterSupport to be used in Add-NotificationListener
* **New-NotificationListener**: create a new NotificationListener to be used in Add-NotificationListener
* **New-ObjectName**: create a new ObjectName to be used in Get-JMXConnector
* **Remove-NotificationListener**: removes a notification listener and filter from a JMXConnector

### JVM identification

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2023 MASES s.r.l.
*
* 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.
*
* Refer to LICENSE for more information.
*/

using Java.Util;

namespace JavaX.Management.Relation
{
public class MBeanServerNotificationFilter : NotificationFilterSupport
{
public override string ClassName => "javax.management.relation.MBeanServerNotificationFilter";

public MBeanServerNotificationFilter() { }

protected MBeanServerNotificationFilter(params object[] args) : base(args) { }

/// <summary>
/// Disables any <see cref="MBeanServerNotification"/>s(all <see cref="ObjectName"/>s are deselected).
/// </summary>
public void DisableAllObjectNames() => IExecute("disableAllObjectNames");
/// <summary>
/// Disables <see cref="MBeanServerNotification"/>s concerning given <see cref="ObjectName"/>.
/// </summary>
public void DisableObjectName(ObjectName objectName) => IExecute("disableObjectName", objectName);
/// <summary>
/// Enables all <see cref="MBeanServerNotification"/>s(all <see cref="ObjectName"/>s are selected).
/// </summary>
public void EnableAllObjectNames() => IExecute("enableAllObjectNames");
/// <summary>
/// Enables <see cref="MBeanServerNotification"/>s concerning given <see cref="ObjectName"/>.
/// </summary>
public void EnableObjectName(ObjectName objectName) => IExecute("enableObjectName", objectName);
/// <summary>
/// Gets all the <see cref="ObjectName"/>s disabled.
/// </summary>
public Vector<ObjectName> DisabledObjectNames => IExecute<Vector<ObjectName>>("getDisabledObjectNames");
/// <summary>
/// Gets all the <see cref="ObjectName"/>s enabled.
/// </summary>
public Vector<ObjectName> EnabledObjectNames => IExecute<Vector<ObjectName>>("getEnabledObjectNames");
}
}
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/GetClassForNameCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet
{
[Cmdlet(VerbsCommon.Get, "ClassForName")]
[OutputType(typeof(Class))]
public class GetClassForNameCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Add, "NotificationListener")]
[OutputType(typeof(void))]
public class AddNotificationListenerCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/GetDefaultDomainCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "DefaultDomain")]
[OutputType(typeof(string))]
public class GetDefaultDomainCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/GetDomainsCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "Domains")]
[OutputType(typeof(string[]))]
public class GetDomainsCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "IsMXBeanInterface")]
[OutputType(typeof(bool))]
public class GetIsMXBeanInterfaceCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/GetJMXConnectorCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "JMXConnector")]
[OutputType(typeof(JMXConnector))]
public class GetJMXConnectorCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/GetMBeanCountCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "MBeanCount")]
[OutputType(typeof(int))]
public class GetMBeanCountCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/GetMBeanInfoCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "MBeanInfo")]
[OutputType(typeof(MBeanInfo))]
public class GetMBeanInfoCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/GetQueryNamesCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "QueryNames")]
[OutputType(typeof(System.Collections.Generic.List<ObjectName>))]
public class GetQueryNamesCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryAndCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryAnd")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryAndCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryAnySubString")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryAnySubStringCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryAttrCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryAttr")]
[OutputType(typeof(AttributeValueExp))]
public class InvokeQueryAttrCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryBetween")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryBetweenCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -22,8 +22,9 @@

namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "QueryClassattr")]
public class GetQueryClassattrCmdletCommand : JNetPSCmdlet<JNetPSCore>
[Cmdlet(VerbsLifecycle.Invoke, "QueryClassattr")]
[OutputType(typeof(AttributeValueExp))]
public class InvokeQueryClassattrCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
// This method will be called for each input received from the pipeline to this cmdlet; if no input is received, this method is not called
protected override void ProcessCommand()
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryDivCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryDiv")]
[OutputType(typeof(ValueExp))]
public class InvokeQueryDivCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryEqCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryEq")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryEqCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryFinalSubString")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryFinalSubStringCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryGeqCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryGeq")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryGeqCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryGtCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryGt")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryGtCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryInCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryIn")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryInCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryInitialSubString")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryInitialSubStringCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryIsInstanceOf")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryIsInstanceOfCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryLeqCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryLeq")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryLeqCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryLtCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryLt")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryLtCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryMatchCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryMatch")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryMatchCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryMinusCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryMinus")]
[OutputType(typeof(ValueExp))]
public class InvokeQueryMinusCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryNotCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryNot")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryNotCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryOrCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryOr")]
[OutputType(typeof(QueryExp))]
public class InvokeQueryOrCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryPlusCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryPlus")]
[OutputType(typeof(ValueExp))]
public class InvokeQueryPlusCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
1 change: 1 addition & 0 deletions src/net/JNetPS/Cmdlet/JMX/InvokeQueryTimesCmdletCommand.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsLifecycle.Invoke, "QueryTimes")]
[OutputType(typeof(ValueExp))]
public class InvokeQueryTimesCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Original file line number Diff line number Diff line change
@@ -23,8 +23,9 @@

namespace MASES.JNetPS.Cmdlet.JMX
{
[Cmdlet(VerbsCommon.Get, "QueryValueExp")]
public class GetQueryValueExpCmdletCommand : JNetPSCmdlet<JNetPSCore>
[Cmdlet(VerbsLifecycle.Invoke, "QueryValue")]
[OutputType(typeof(ValueExp))]
public class InvokeQueryValueCmdletCommand : JNetPSCmdlet<JNetPSCore>
{
[Parameter(
Position = 0,
Loading