Search in sources :

Example 31 with Validator

use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.

the class SystemMonitor method scheduleSystemMonitoring.

/**
     * Schedule some system monitors.
     * <br>No statistics collection will be triggered until the startMonitor method is called.
     *
     * @param monitoredHost the host to monitor
     * @param systemReadingTypes what kind of data to collect. Use some of the following constants:
     * <ul>
     * <li>SystemMonitor.MONITOR_CPU.*
     * <li>SystemMonitor.MONITOR_MEMORY.*
     * <li>SystemMonitor.MONITOR_VIRTUAL_MEMORY.*
     * <li>SystemMonitor.MONITOR_IO.*
     * <li>SystemMonitor.MONITOR_NETWORK_INTERFACES.*
     * <li>SystemMonitor.MONITOR_NETSTAT.*
     * <li>SystemMonitor.MONITOR_TCP.*
     * </ul>
     */
@PublicAtsApi
public void scheduleSystemMonitoring(@Validate(name = "monitoredHost", type = ValidationType.STRING_SERVER_WITH_PORT) String monitoredHost, @Validate(name = "systemReadingTypes", type = ValidationType.NOT_NULL) String[] systemReadingTypes) {
    // validate input parameters
    monitoredHost = HostUtils.getAtsAgentIpAndPort(monitoredHost);
    new Validator().validateMethodParameters("Could not schedule monitoring system statistics on '" + monitoredHost + "'", new Object[] { monitoredHost, systemReadingTypes });
    Set<FullReadingBean> readingTypes = requestedReadingTypesPerHosts.get(monitoredHost);
    if (readingTypes == null) {
        readingTypes = new HashSet<FullReadingBean>();
    }
    readingTypes.addAll(ReadingTypes.expandSystemReadings(systemReadingTypes));
    requestedReadingTypesPerHosts.put(monitoredHost, readingTypes);
    monitoredHosts.add(monitoredHost);
}
Also used : FullReadingBean(com.axway.ats.common.performance.monitor.beans.FullReadingBean) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 32 with Validator

use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.

the class SystemOperations method isListening.

/**
    * Check if some process is listening on some port on some host. 
    * Note that we cannot give the name of the listening process.
    * 
    * @param host host address
    * @param port port number
    * @param timeout timeout value in milliseconds
    * @return <code>true</code> if the address is listening on this port
    * @throws SystemOperationException when the target host is unknown
    */
@PublicAtsApi
public boolean isListening(@Validate(name = "host", type = ValidationType.STRING_NOT_EMPTY) String host, @Validate(name = "port", type = ValidationType.NUMBER_PORT_NUMBER) int port, @Validate(name = "timeout", type = ValidationType.NUMBER_POSITIVE) int timeout) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { host, port, timeout });
    // execute action
    ISystemOperations operations = getOperationsImplementationFor(atsAgent);
    return operations.isListening(host, port, timeout);
}
Also used : ISystemOperations(com.axway.ats.core.system.model.ISystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 33 with Validator

use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.

the class RegistryOperations method setLongValue.

/**
     * Applies a Long(REG_QWORD) value on the specified key.
     *
     * The key will be created if does not exist.
     * The key type will be changed if needed.
     *
     * @param keyPath path to the key
     * @param keyName name of the key
     * @param keyValue the new key value
     */
@PublicAtsApi
public void setLongValue(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName, @Validate(name = "keyValue", type = ValidationType.NONE) long keyValue) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
    registryOperationsImpl.setLongValue(rootKey, keyPath, keyName, keyValue);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 34 with Validator

use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.

the class RegistryOperations method setBinaryValue.

/**
     * Applies a Binary(REG_BINARY) value on the specified key.
     *
     * The key will be created if does not exist.
     * The key type will be changed if needed.
     *
     * @param keyPath path to the key
     * @param keyName name of the key
     * @param keyValue the new key value
     */
@PublicAtsApi
public void setBinaryValue(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName, @Validate(name = "keyValue", type = ValidationType.NOT_NULL) byte[] keyValue) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
    registryOperationsImpl.setBinaryValue(rootKey, keyPath, keyName, keyValue);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 35 with Validator

use of com.axway.ats.core.validation.Validator in project ats-framework by Axway.

the class RegistryOperations method setStringValue.

/**
     * Applies a String(REG_SZ) value on the specified key.
     *
     * The key will be created if does not exist.
     * The key type will be changed if needed.
     *
     * @param keyPath path to the key
     * @param keyName name of the key
     * @param keyValue the new key value
     */
@PublicAtsApi
public void setStringValue(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName, @Validate(name = "keyValue", type = ValidationType.NOT_NULL) String keyValue) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
    registryOperationsImpl.setStringValue(rootKey, keyPath, keyName, keyValue);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

Validator (com.axway.ats.core.validation.Validator)67 PublicAtsApi (com.axway.ats.common.PublicAtsApi)66 IFileSystemOperations (com.axway.ats.core.filesystem.model.IFileSystemOperations)45 LocalFileSystemOperations (com.axway.ats.core.filesystem.LocalFileSystemOperations)6 ISystemOperations (com.axway.ats.core.system.model.ISystemOperations)4 FullReadingBean (com.axway.ats.common.performance.monitor.beans.FullReadingBean)3 MachineDescriptionOperations (com.axway.ats.agent.components.monitoring.operations.clients.MachineDescriptionOperations)1 InternalProcessOperations (com.axway.ats.agent.components.system.operations.clients.InternalProcessOperations)1 AgentException (com.axway.ats.agent.core.exceptions.AgentException)1 FileMatchInfo (com.axway.ats.common.filesystem.FileMatchInfo)1 ProcessExecutorException (com.axway.ats.common.process.ProcessExecutorException)1 DbAccessFactory (com.axway.ats.log.autodb.DbAccessFactory)1 DbWriteAccess (com.axway.ats.log.autodb.DbWriteAccess)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1