Search in sources :

Example 1 with Provider

use of com.att.cdp.zones.Provider in project AJSC by att.

the class AbstractService method checkOpen.

/**
 * This method checks to see if the open flag has been cleared (indicating that the context has been closed). If the
 * context has been closed, then an exception is thrown indicating that the context has been closed and cannot be
 * used. If the open flag has not been cleared, indicating that the context is still usable, the method simply
 * returns to the caller.
 *
 * @throws ContextClosedException
 *             IFF the context has been closed.
 */
protected void checkOpen() throws ContextClosedException {
    if (!context.isOpen()) {
        Provider provider = context.getProvider();
        String msg = EELFResourceManager.format(Msg.PROVIDER_CONTEXT_IS_CLOSED, provider.getName());
        appLogger.error(msg);
        throw new ContextClosedException(msg);
    }
}
Also used : ContextClosedException(com.att.cdp.exceptions.ContextClosedException) Provider(com.att.cdp.zones.Provider)

Example 2 with Provider

use of com.att.cdp.zones.Provider in project AJSC by att.

the class AbstractService method checkLogin.

/**
 * This method checks to see if the client has successfully logged in to the provider before attempting to make a
 * service request. If the client is logged in, the method returns silently. If not, then an exception is thrown.
 *
 * @throws NotLoggedInException
 *             If the client is not logged in.
 */
public void checkLogin() throws NotLoggedInException {
    if (!context.isLoggedIn()) {
        Provider provider = context.getProvider();
        String msg = EELFResourceManager.format(Msg.NOT_LOGGED_INTO_PROVIDER, provider.getName());
        appLogger.error(msg);
        throw new NotLoggedInException(msg);
    }
}
Also used : NotLoggedInException(com.att.cdp.exceptions.NotLoggedInException) Provider(com.att.cdp.zones.Provider)

Example 3 with Provider

use of com.att.cdp.zones.Provider in project AJSC by att.

the class AbstractVolume method getVolumes.

/**
 * This is a default implementation that is correct for all providers other than VMware. The VMware provider
 * overrides this method. Any other providers that want to implement this method may also override it if needed.
 *
 *    getVolumes methods gives a list of volumes for a particular model
 */
@Override
public List<Volume> getVolumes(Server server) throws ZoneException {
    Context context = getContext();
    Provider provider = context.getProvider();
    throw new NotSupportedException(String.format("Provider %s does not support getVolumebyServer Id using  a model", provider.getName()));
}
Also used : Context(com.att.cdp.zones.Context) NotSupportedException(com.att.cdp.exceptions.NotSupportedException) Provider(com.att.cdp.zones.Provider)

Example 4 with Provider

use of com.att.cdp.zones.Provider in project AJSC by att.

the class AbstractVolume method updateVolume.

/**
 * This is a default implementation that is correct for all providers other than VMware. The VMware provider
 * overrides this method. Any other providers that want to implement this method may also override it if needed.
 *
 *    updateVolume method is used to update the size of the volume (only increase)
 */
@Override
public Volume updateVolume(Volume template, Server server) throws ZoneException {
    Context context = getContext();
    Provider provider = context.getProvider();
    throw new NotSupportedException(String.format("Provider %s does not support updateVolume using a volume object as a model", provider.getName()));
}
Also used : Context(com.att.cdp.zones.Context) NotSupportedException(com.att.cdp.exceptions.NotSupportedException) Provider(com.att.cdp.zones.Provider)

Example 5 with Provider

use of com.att.cdp.zones.Provider in project AJSC by att.

the class AbstractNetwork method createPort.

/**
 * This method is implemented here until it can be implemented for all providers. This allows the specific providers
 * to be updated incrementally to add this capability. TODO Add this capability to all providers. Currently only
 * implemented in OpenStack.
 *
 * @see com.att.cdp.zones.NetworkService#createPort(com.att.cdp.zones.model.Subnet, com.att.cdp.zones.model.Port)
 */
@Override
public Port createPort(Subnet subnet, Port model) throws ZoneException {
    Context context = getContext();
    Provider provider = context.getProvider();
    throw new NotSupportedException(String.format("Provider %s does not support createPort using a Port object as a model", provider.getName()));
}
Also used : Context(com.att.cdp.zones.Context) NotSupportedException(com.att.cdp.exceptions.NotSupportedException) Provider(com.att.cdp.zones.Provider)

Aggregations

Provider (com.att.cdp.zones.Provider)5 NotSupportedException (com.att.cdp.exceptions.NotSupportedException)3 Context (com.att.cdp.zones.Context)3 ContextClosedException (com.att.cdp.exceptions.ContextClosedException)1 NotLoggedInException (com.att.cdp.exceptions.NotLoggedInException)1