All Downloads are FREE. Search and download functionalities are using the official Maven repository.

brooklyn.entity.basic.Attributes Maven / Gradle / Ivy

There is a newer version: 0.7.0-M1
Show newest version
package brooklyn.entity.basic;

import java.util.List;
import java.util.Map;

import brooklyn.entity.Entity;
import brooklyn.event.AttributeSensor;
import brooklyn.event.Sensor;
import brooklyn.event.basic.BasicAttributeSensor;
import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
import brooklyn.event.basic.BasicNotificationSensor;
import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
import brooklyn.event.basic.Sensors;
import brooklyn.location.PortRange;
import brooklyn.location.basic.PortRanges;

import com.google.common.collect.ImmutableList;

/**
 * This interface should be used to access {@link Sensor} definitions.
 */
public interface Attributes {
    
    BasicNotificationSensor LOCATION_CHANGED = new BasicNotificationSensor(
            Void.class, "entity.locationChanged", "Indicates that an entity's location has been changed");


    /**
     * Application information sensors.
     * 
     * @deprecated since 0.5; see {@link BrooklynConfigKeys#SUGGESTED_VERSION}
     */
    @Deprecated
    AttributeSensor VERSION = Sensors.newStringSensor( "version", "Version information");

    BasicAttributeSensorAndConfigKey DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey(
            String.class, "download.url", "URL pattern for downloading the installer (will substitute things like ${version} automatically)");

    BasicAttributeSensorAndConfigKey> DOWNLOAD_ADDON_URLS = new BasicAttributeSensorAndConfigKey(
            Map.class, "download.addon.urls", "URL patterns for downloading named add-ons (will substitute things like ${version} automatically)");

    /*
     * JMX attributes.
     */

    /** chosen by java itself by default; setting this will only have any effect if using an agent 
     * @deprecated since 0.6.0 use keys from UsesJmx */
    @Deprecated
    PortAttributeSensorAndConfigKey JMX_PORT = new PortAttributeSensorAndConfigKey(
            "jmx.direct.port", "JMX direct/private port (e.g. JMX RMI server port, but not RMI registry port)", PortRanges.fromString("31001+")) {
        protected Integer convertConfigToSensor(PortRange value, Entity entity) {
            // TODO when using JmxAgentModes.NONE we should *not* convert, but leave it null
            // (e.g. to prevent a warning in e.g. ActiveMQIntegrationTest)
            // however supporting that means moving these keys to UsesJmx (which would be a good thing in any case)
            return super.convertConfigToSensor(value, entity);
        }
    };
    
    /** well-known port used by Java itself to start the RMI registry where JMX private port can be discovered;
     * ignored if using JMXMP agent 
     * @deprecated since 0.6.0 use keys from UsesJmx */
    @Deprecated
    PortAttributeSensorAndConfigKey RMI_REGISTRY_PORT = new PortAttributeSensorAndConfigKey(
            "rmi.registry.port", "RMI registry port, used for discovering JMX (private) port", PortRanges.fromString("1099, 19099+"));
    /** @deprecated since 0.6.0 use RMI_REGISTRY_PORT */ @Deprecated
    PortAttributeSensorAndConfigKey RMI_SERVER_PORT = RMI_REGISTRY_PORT;

    /** Currently only used to connect; not used to set up JMX (so only applies where systems set this up themselves)
     * @deprecated since 0.6.0 use keys from UsesJmx */
    @Deprecated
    BasicAttributeSensorAndConfigKey JMX_USER = new BasicAttributeSensorAndConfigKey(
            String.class, "jmx.user", "JMX username");
    
    /** Currently only used to connect; not used to set up JMX (so only applies where systems set this up themselves)
     * @deprecated since 0.6.0 use keys from UsesJmx */
    @Deprecated
    BasicAttributeSensorAndConfigKey JMX_PASSWORD = new BasicAttributeSensorAndConfigKey(
            String.class, "jmx.password", "JMX password");
    
    /** @deprecated since 0.6.0 use keys from UsesJmx */
    @Deprecated
    BasicAttributeSensorAndConfigKey JMX_CONTEXT = new BasicAttributeSensorAndConfigKey(
            String.class, "jmx.context", "JMX context path", "jmxrmi");
    
    /** @deprecated since 0.6.0 use keys from UsesJmx */
    @Deprecated
    BasicAttributeSensorAndConfigKey JMX_SERVICE_URL = new BasicAttributeSensorAndConfigKey(
            String.class, "jmx.service.url", "The URL for connecting to the MBean Server");
    
    /*
     * Port number attributes.
     */

    AttributeSensor> PORT_NUMBERS = new BasicAttributeSensor(
            List.class, "port.list", "List of port numbers");
    
    AttributeSensor>> PORT_SENSORS = new BasicAttributeSensor(
            List.class, "port.list.sensors", "List of port number attributes");

    PortAttributeSensorAndConfigKey HTTP_PORT = new PortAttributeSensorAndConfigKey(
            "http.port", "HTTP port", ImmutableList.of(8080,"18080+"));
    
    PortAttributeSensorAndConfigKey HTTPS_PORT = new PortAttributeSensorAndConfigKey(
            "https.port", "HTTP port (with SSL/TLS)", ImmutableList.of(8443,"18443+"));
                    
    PortAttributeSensorAndConfigKey SSH_PORT = new PortAttributeSensorAndConfigKey("ssh.port", "SSH port", 22);
    PortAttributeSensorAndConfigKey SMTP_PORT = new PortAttributeSensorAndConfigKey("smtp.port", "SMTP port", 25);
    PortAttributeSensorAndConfigKey DNS_PORT = new PortAttributeSensorAndConfigKey("dns.port", "DNS port", 53);
    PortAttributeSensorAndConfigKey AMQP_PORT = new PortAttributeSensorAndConfigKey("amqp.port", "AMQP port", "5672+");

    /*
     * Location/connection attributes.
     */

    AttributeSensor HOSTNAME = Sensors.newStringSensor( "host.name", "Host name");
    AttributeSensor ADDRESS = Sensors.newStringSensor( "host.address", "Host IP address");
    AttributeSensor SUBNET_HOSTNAME = Sensors.newStringSensor( "host.subnet.hostname", "Host name as known internally in " +
    		"the subnet where it is running (if different to host.name)");
    AttributeSensor SUBNET_ADDRESS = Sensors.newStringSensor( "host.subnet.address", "Host address as known internally in " +
            "the subnet where it is running (if different to host.name)");
	
    /*
     * Lifecycle attributes
     */
    AttributeSensor SERVICE_UP = Sensors.newBooleanSensor("service.isUp", 
            "Whether the service is active and availability (confirmed and monitored)");
    
    AttributeSensor SERVICE_STATE = Sensors.newSensor(Lifecycle.class,
            "service.state", "Expected lifecycle state of the service");

    /*
     * Other metadata (optional)
     */
    
    AttributeSensor PID = Sensors.newIntegerSensor("pid", "Process ID for the previously launched instance");

    AttributeSensor LOG_FILE_LOCATION = new BasicAttributeSensor(
            String.class, "log.location", "Log file location");
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy