Java Code Examples for org.apache.brooklyn.core.entity.lifecycle.Lifecycle#CREATED

The following examples show how to use org.apache.brooklyn.core.entity.lifecycle.Lifecycle#CREATED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityAdjuncts.java    From brooklyn-server with Apache License 2.0 6 votes vote down vote up
@Beta
public static Lifecycle inferAdjunctStatus(EntityAdjunct a) {
    if (a.isRunning()) return Lifecycle.RUNNING;
    if (a.isDestroyed()) return Lifecycle.DESTROYED;
    
    // adjuncts don't currently support an "error" state; though that would be useful!
    
    if (a instanceof Policy) {
        if (((Policy)a).isSuspended()) return Lifecycle.STOPPED;
        return Lifecycle.CREATED;
    }
    if (a instanceof Feed) {
        if (((Feed)a).isSuspended()) return Lifecycle.STOPPED;
        if (((Feed)a).isActivated()) return Lifecycle.STARTING;
        return Lifecycle.CREATED;
    }

    // Enricher doesn't support suspend so if not running or destroyed then
    // it is just created
    return Lifecycle.CREATED;
}
 
Example 2
Source File: SoftwareProcessImpl.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
protected void onUpdated() {
    Boolean up = entity.getAttribute(SERVICE_UP);
    Lifecycle state = entity.getAttribute(SERVICE_STATE_ACTUAL);
    if (up == null || up) {
        entity.sensors().set(ServiceStateLogic.SERVICE_NOT_UP_DIAGNOSTICS, ImmutableMap.<String, Object>of());
    } else if (state == null || state == Lifecycle.CREATED || state == Lifecycle.STARTING) {
        // not yet started; do nothing
    } else if (state == Lifecycle.STOPPING || state == Lifecycle.STOPPED || state == Lifecycle.DESTROYED) {
        // stopping/stopped, so expect not to be up; get rid of the diagnostics.
        entity.sensors().set(ServiceStateLogic.SERVICE_NOT_UP_DIAGNOSTICS, ImmutableMap.<String, Object>of());
    } else {
        ((SoftwareProcess)entity).populateServiceNotUpDiagnostics();
    }
}
 
Example 3
Source File: SoftwareProcessImpl.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@Override 
public void onManagementStarting() {
    super.onManagementStarting();
    
    Lifecycle state = getAttribute(SERVICE_STATE_ACTUAL);
    if (state == null || state == Lifecycle.CREATED) {
        // Expect this is a normal start() sequence (i.e. start() will subsequently be called)
        sensors().set(SERVICE_UP, false);
        ServiceStateLogic.setExpectedState(this, Lifecycle.CREATED);
        // force actual to be created because this is expected subsequently
        sensors().set(SERVICE_STATE_ACTUAL, Lifecycle.CREATED);
    }
}
 
Example 4
Source File: SoftwareProcessImpl.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@Override 
public void onManagementStarted() {
    super.onManagementStarted();
    
    Lifecycle state = getAttribute(SERVICE_STATE_ACTUAL);
    if (state != null && state != Lifecycle.CREATED) {
        postRebind();
    }
}
 
Example 5
Source File: CloudFoundryEntityImpl.java    From SeaCloudsPlatform with Apache License 2.0 5 votes vote down vote up
@Override
public void onManagementStarting() {
    super.onManagementStarting();

    Lifecycle state = getAttribute(SERVICE_STATE_ACTUAL);
    if (state == null || state == Lifecycle.CREATED) {
        // Expect this is a normal start() sequence (i.e. start() will subsequently be called)
        setAttribute(SERVICE_UP, false);
        ServiceStateLogic.setExpectedState(this, Lifecycle.CREATED);
        // force actual to be created because this is expected subsequently
        setAttribute(SERVICE_STATE_ACTUAL, Lifecycle.CREATED);
    }
}
 
Example 6
Source File: CloudFoundryEntityImpl.java    From SeaCloudsPlatform with Apache License 2.0 5 votes vote down vote up
@Override
public void onManagementStarted() {
    super.onManagementStarted();

    Lifecycle state = getAttribute(SERVICE_STATE_ACTUAL);
    if (state != null && state != Lifecycle.CREATED) {
        postRebind();
    }
}
 
Example 7
Source File: OpenShiftEntityImpl.java    From SeaCloudsPlatform with Apache License 2.0 5 votes vote down vote up
@Override
public void onManagementStarting() {
    super.onManagementStarting();

    Lifecycle state = getAttribute(SERVICE_STATE_ACTUAL);
    if (state == null || state == Lifecycle.CREATED) {
        // Expect this is a normal start() sequence (i.e. start() will subsequently be called)
        setAttribute(SERVICE_UP, false);
        ServiceStateLogic.setExpectedState(this, Lifecycle.CREATED);
        // force actual to be created because this is expected subsequently
        setAttribute(SERVICE_STATE_ACTUAL, Lifecycle.CREATED);
    }
}
 
Example 8
Source File: OpenShiftEntityImpl.java    From SeaCloudsPlatform with Apache License 2.0 5 votes vote down vote up
@Override
public void onManagementStarted() {
    super.onManagementStarted();

    Lifecycle state = getAttribute(SERVICE_STATE_ACTUAL);
    if (state != null && state != Lifecycle.CREATED) {
        postRebind();
    }
}