mbean

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STRING = "java/lang/String"
	OBJECT = "java/lang/Object"
	FLOAT  = "java/lang/Float"
)

a collection of JNI representations of java primitive types these will be the boxed representations, not the true primitive

Variables

This section is empty.

Functions

func Close added in v1.1.4

func Close(env *jnigi.Env, connection *jnigi.ObjectRef)

Close is a method that will clean up all of the MBeans resources It will close the JMX method within the JVM as well as deleting the connection from the JNI resources

Types

type BeanExecutor

type BeanExecutor interface {
	RegisterClassHandler(typeName string, handler extensions.IHandler) error
	RegisterInterfaceHandler(typeName string, handler extensions.InterfaceHandler) error
	Execute(operation Operation) (string, error)
	Get(domainName string, beanName string, attributeName string, args OperationArgs) (string, error)
	Put(domainName string, beanName string, attributeName string, args OperationArgs) (string, error)
	WithEnvironment(env *jnigi.Env) BeanExecutor
	GetEnv() *jnigi.Env
	OpenConnection(jndiURI string) (*jnigi.ObjectRef, error)
}

BeanExecutor is the interface used around this package. This is how an execution is performed. This will always rely on the MBean Client's environment Close will handle any types of cleanup that is related directly to MBean operations

for example: cleaning up the JMX connection and deleting the reference

type Client

type Client struct {
	JmxURI            string
	Env               *jnigi.Env
	ClassHandlers     sync.Map
	InterfaceHandlers sync.Map
}

Client is the overarching type that will facilitate JMX connections JmxConnection is the living connection that was created when `CreateMBeanConnection` was called to create the Client Env is the environment that belongs to this bean, this will not always match the JVM env!

func (*Client) Execute

func (mbean *Client) Execute(operation Operation) (string, error)

Execute is the orchestration for a JMX command execution.

func (*Client) Get

func (mbean *Client) Get(domainName string, beanName string, attributeName string, args OperationArgs) (string, error)

Get is the method that will fetch the attribute given by the name The return value must be able to be converted to the java representation that the server is expecting If this is a complex type, then a handler will need to be defined

func (*Client) GetEnv

func (mbean *Client) GetEnv() *jnigi.Env

GetEnv will expose the underlying environment that the client is associated with

func (*Client) OpenConnection added in v1.1.4

func (mbean *Client) OpenConnection(jndiURI string) (*jnigi.ObjectRef, error)

OpenConnection is a method that will establish a new connection against the given URI

func (*Client) Put

func (mbean *Client) Put(domainName string, beanName string, attributeName string, args OperationArgs) (string, error)

Put is the method that will set the declared attribute to the given value The value must be able to be converted to the java representation that the server is expecting If this is a custom type, then a handler will need to be defined

func (*Client) RegisterClassHandler

func (mbean *Client) RegisterClassHandler(typeName string, handler extensions.IHandler) error

RegisterClassHandler will register the given class handlers For a class handler to be valid it must implement a form of IClassHandler

func (*Client) RegisterInterfaceHandler

func (mbean *Client) RegisterInterfaceHandler(typeName string, handler extensions.InterfaceHandler) error

RegisterInterfaceHandler will register the given class handlers For a class handler to be valid it must implement a form of IClassHandler

func (*Client) WithEnvironment

func (mbean *Client) WithEnvironment(env *jnigi.Env) BeanExecutor

WithEnvironment allos the client to spin up a new client using a new environment This is handy when using the same JmxConnection in sub threads

type MockBeanExecutor

type MockBeanExecutor struct {
	mock.Mock
}

MockBeanExecutor is an autogenerated mock type for the BeanExecutor type

func NewMockBeanExecutor

func NewMockBeanExecutor(t mockConstructorTestingTNewMockBeanExecutor) *MockBeanExecutor

NewMockBeanExecutor creates a new instance of MockBeanExecutor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockBeanExecutor) Execute

func (_m *MockBeanExecutor) Execute(operation Operation) (string, error)

Execute provides a mock function with given fields: operation

func (*MockBeanExecutor) Get

func (_m *MockBeanExecutor) Get(domainName string, beanName string, attributeName string, args OperationArgs) (string, error)

Get provides a mock function with given fields: domainName, beanName, attributeName, args

func (*MockBeanExecutor) GetEnv

func (_m *MockBeanExecutor) GetEnv() *jnigi.Env

GetEnv provides a mock function with given fields:

func (*MockBeanExecutor) OpenConnection added in v1.1.4

func (_m *MockBeanExecutor) OpenConnection(jndiURI string) (*jnigi.ObjectRef, error)

OpenConnection provides a mock function with given fields: jndiURI

func (*MockBeanExecutor) Put

func (_m *MockBeanExecutor) Put(domainName string, beanName string, attributeName string, args OperationArgs) (string, error)

Put provides a mock function with given fields: domainName, beanName, attributeName, args

func (*MockBeanExecutor) RegisterClassHandler

func (_m *MockBeanExecutor) RegisterClassHandler(typeName string, handler extensions.IHandler) error

RegisterClassHandler provides a mock function with given fields: typeName, handler

func (*MockBeanExecutor) RegisterInterfaceHandler

func (_m *MockBeanExecutor) RegisterInterfaceHandler(typeName string, handler extensions.InterfaceHandler) error

RegisterInterfaceHandler provides a mock function with given fields: typeName, handler

func (*MockBeanExecutor) WithEnvironment

func (_m *MockBeanExecutor) WithEnvironment(env *jnigi.Env) BeanExecutor

WithEnvironment provides a mock function with given fields: env

type Operation

type Operation struct {
	Domain    string
	Name      string
	Operation string
	Args      []OperationArgs
}

Operation is the operation that is being performed Domain is the fully qualified name of the MBean `org.example` Name is the name of the mbean itself `game` Operation is the name of the operation that is attempted to be interacted with `getString` Args are the optional argument array that is for the operation

type OperationArgs

type OperationArgs struct {
	Value             string
	JavaType          string
	JavaContainerType string
}

OperationArgs is the type that holds data about the arguments used for MBean operations Value is the value that is being entered in string form JavaType is the fully qualified java type `java.lang.String` JavaContainerType is the fully qualified type of the container that will be holding JavaType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL