gmx

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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MBeanArgs

type MBeanArgs struct {
	Value             string
	JavaType          string
	JavaContainerType string
}

MBeanArgs is the container for the operation arguments. If you have an MBean defined as the following

getValue(String name)

Then you will want to structure your args like

  MBeanArgs{
    Value: "theNameOfTheStringYouAreFetching",
	JavaType: "java.lang.String"
  }

If the intent is to execute a command that accepts a list or a map, then the JavaContainerType will need to be defined The JavaType will be the inner type that is being sent, whereas the container type will be the container. For example:

  MBeanArgs{
    Value: "[\"foo\", \"bar\"]",
	JavaType: "java.lang.String",
	JavaContainerType: "java.util.List"
  }

type MBeanAttributeManager

type MBeanAttributeManager interface {

	// Get will fetch an attribute by a given name for the given bean across all connections
	// The args are required in order to be able to deserialize lists from attributes
	//
	// JavaType and JavaContainerType are only required for Lists/Sets/Maps and any other generic collections
	// Value is not used here
	Get(domain string, beanName string, attributeName string, args MBeanArgs) (map[uuid.UUID]string, map[uuid.UUID]error)

	// Put will change the given attribute across all connections
	// The args are required in order to be able to serialize data being sent to the attribute
	Put(domain string, beanName string, attributeName string, args MBeanArgs) (map[uuid.UUID]string, map[uuid.UUID]error)

	// GetByID will execute Get against the one given ID.
	// The args are required in order to be able to deserialize lists from attributes
	//
	// JavaType and JavaContainerType are only required for Lists/Sets/Maps and any other generic collections
	// Value is not used here
	GetByID(id uuid.UUID, domain string, beanName string, attributeName string, args MBeanArgs) (string, error)

	// PutByID will execute Put against the one given ID.
	// The args are required in order to be able to serialize data being sent to the attribute
	PutByID(id uuid.UUID, domain string, beanName string, attributeName string, args MBeanArgs) (string, error)
}

MBeanAttributeManager is a type that will be responsible for managing attributes of a given mbean

type MBeanClient

type MBeanClient interface {
	// Initialize will initialize the client:
	// This starts the JVM and registers all basic class and interface handlers
	// Basic handlers are: Integer, Double, String, Float, Boolean, Long, List, Set, Map<String, Object>
	Initialize() error

	// Close will close all connections that have been created and then shut down the JVM
	Close()

	// RegisterClassHandler will register a new class handler
	// This is needed if executing operations or retrieving/updating attributes
	// that require more complex objects. The default handlers only include primitives and strings
	RegisterClassHandler(typeName string, handler extensions.IHandler)

	// RegisterInterfaceHandler will register a new interface handler
	// In the event no class handler is found for a given type, we will then scan the available
	// interfaces implemented by the type. This will then check all the included handlers to determine
	// how to convert between go and jni
	RegisterInterfaceHandler(typeName string, handler extensions.InterfaceHandler)

	// RegisterBean will create a new mbean connection defined by the hostname and port
	// The reference to this connection is stored for the life of the operator
	RegisterConnection(hostname string, port int) (*uuid.UUID, error)

	// This will return the type that is responsible for executing operations
	GetOperator() MBeanOperator

	// This will return the attribute manager
	GetAttributeManager() MBeanAttributeManager
}

MBeanClient is an interface that describes the functions needed to fully operate against MBeans over JMXRMI

func CreateClient

func CreateClient() MBeanClient

CreateClient is a method that will create an unbound MBeanClient This means that it will consume as many native threads as there are connected mbeans

func CreateClientWithLimitation

func CreateClientWithLimitation(limit uint) MBeanClient

CreateClientWithLimitation is a method that will create a bound MBeanClient This will only use as many native threads as provided by limit

type MBeanOperator

type MBeanOperator interface {

	// ExecuteAgainstID will execute an operation against the given id. This will only target the provided ID
	ExecuteAgainstID(id uuid.UUID, domain string, name string, operation string, args ...MBeanArgs) (string, error)

	// ExecuteAgainstAll will execute an operation against *all* connected beans.
	// These are ran in their own go routines. If there concerns/desired constraints please define MaxNumberOfGoRoutines
	ExecuteAgainstAll(domain string, name string, operation string, args ...MBeanArgs) (map[uuid.UUID]string, map[uuid.UUID]error)
}

MBeanOperator is a type that is responsible for executing operations against a defined mbean

type MockMBeanAttributeManager

type MockMBeanAttributeManager struct {
	mock.Mock
}

MockMBeanAttributeManager is an autogenerated mock type for the MBeanAttributeManager type

func NewMockMBeanAttributeManager

func NewMockMBeanAttributeManager(t mockConstructorTestingTNewMockMBeanAttributeManager) *MockMBeanAttributeManager

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

func (*MockMBeanAttributeManager) Get

func (_m *MockMBeanAttributeManager) Get(domain string, beanName string, attributeName string, args MBeanArgs) (map[uuid.UUID]string, map[uuid.UUID]error)

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

func (*MockMBeanAttributeManager) GetByID added in v1.1.2

func (_m *MockMBeanAttributeManager) GetByID(id uuid.UUID, domain string, beanName string, attributeName string, args MBeanArgs) (string, error)

GetByID provides a mock function with given fields: id, domain, beanName, attributeName, args

func (*MockMBeanAttributeManager) Put

func (_m *MockMBeanAttributeManager) Put(domain string, beanName string, attributeName string, args MBeanArgs) (map[uuid.UUID]string, map[uuid.UUID]error)

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

func (*MockMBeanAttributeManager) PutByID added in v1.1.2

func (_m *MockMBeanAttributeManager) PutByID(id uuid.UUID, domain string, beanName string, attributeName string, args MBeanArgs) (string, error)

PutByID provides a mock function with given fields: id, domain, beanName, attributeName, args

type MockMBeanClient

type MockMBeanClient struct {
	mock.Mock
}

MockMBeanClient is an autogenerated mock type for the MBeanClient type

func NewMockMBeanClient

func NewMockMBeanClient(t mockConstructorTestingTNewMockMBeanClient) *MockMBeanClient

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

func (*MockMBeanClient) Close

func (_m *MockMBeanClient) Close()

Close provides a mock function with given fields:

func (*MockMBeanClient) GetAttributeManager

func (_m *MockMBeanClient) GetAttributeManager() MBeanAttributeManager

GetAttributeManager provides a mock function with given fields:

func (*MockMBeanClient) GetOperator

func (_m *MockMBeanClient) GetOperator() MBeanOperator

GetOperator provides a mock function with given fields:

func (*MockMBeanClient) Initialize

func (_m *MockMBeanClient) Initialize() error

Initialize provides a mock function with given fields:

func (*MockMBeanClient) RegisterClassHandler

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

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

func (*MockMBeanClient) RegisterConnection added in v1.2.1

func (_m *MockMBeanClient) RegisterConnection(hostname string, port int) (*uuid.UUID, error)

RegisterConnection provides a mock function with given fields: hostname, port

func (*MockMBeanClient) RegisterInterfaceHandler

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

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

type MockMBeanOperator

type MockMBeanOperator struct {
	mock.Mock
}

MockMBeanOperator is an autogenerated mock type for the MBeanOperator type

func NewMockMBeanOperator

func NewMockMBeanOperator(t mockConstructorTestingTNewMockMBeanOperator) *MockMBeanOperator

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

func (*MockMBeanOperator) ExecuteAgainstAll

func (_m *MockMBeanOperator) ExecuteAgainstAll(domain string, name string, operation string, args ...MBeanArgs) (map[uuid.UUID]string, map[uuid.UUID]error)

ExecuteAgainstAll provides a mock function with given fields: domain, name, operation, args

func (*MockMBeanOperator) ExecuteAgainstID

func (_m *MockMBeanOperator) ExecuteAgainstID(id uuid.UUID, domain string, name string, operation string, args ...MBeanArgs) (string, error)

ExecuteAgainstID provides a mock function with given fields: id, domain, name, operation, args

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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