Package com.abiquo.ssm.exception

Examples of com.abiquo.ssm.exception.PluginException


    @Override
    public StoragePluginMetadata getPluginMetadata() throws PluginException
    {
        if (!this.getClass().isAnnotationPresent(Plugin.class))
        {
            throw new PluginException("Missing @Plugin annotation in " + this.getClass().getName());
        }

        Plugin pluginInfo = this.getClass().getAnnotation(Plugin.class);

        if (pluginInfo.type() == null)
        {
            throw new PluginException("Plugin type can not be null in " + this.getClass().getName());
        }

        StoragePluginMetadata metadata = new StoragePluginMetadata();
        metadata.setDefaultIscsiPort(pluginInfo.defaultIscsiPort());
        metadata.setDefaultManagementPort(pluginInfo.defaultManagementPort());
        metadata.setRequiresAuthentication(pluginInfo.requiresAuthentication());
        metadata.setType(pluginInfo.type());

        try
        {
            Method[] methods = StoragePlugin.class.getMethods();
            for (Method methodDefinition : methods)
            {
                if (methodDefinition.isAnnotationPresent(Provides.class))
                {
                    Method implMethod =
                        this.getClass().getMethod(methodDefinition.getName(),
                            methodDefinition.getParameterTypes());

                    if (!implMethod.isAnnotationPresent(UnsupportedOp.class))
                    {
                        Provides provides = methodDefinition.getAnnotation(Provides.class);
                        metadata.getSupportedOperations().add(provides.value());
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw new PluginException("Could not get the list of supported operations for plugin: "
                + this.getClass().getName());
        }

        return metadata;
    }
View Full Code Here


    public Pool getPool(final Device device, final String poolName) throws PluginException
    {
        Pool pool = pools.get(poolName);
        if (pool == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting pool");
        }
        return pool;
    }
View Full Code Here

        throws PluginException
    {
        Volume volume = volumes.get(uuid);
        if (volume == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }
        return volume;
    }
View Full Code Here

    public Volume createVolume(final Device device, final Pool pool, final Volume volume)
        throws PluginException
    {
        if (volumes.get(volume.getUuid()) != null)
        {
            throw new PluginException("Volume already exists");
        }

        Volume created = new Volume();
        created.setUuid(volume.getUuid());
        created.setSizeInMB(volume.getSizeInMB());
View Full Code Here

    public void deleteVolume(final Device device, final Pool pool, final String uuid)
        throws PluginException
    {
        if (volumes.get(uuid) == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }

        Volume removed = volumes.remove(uuid);

        // Update the available size in the pool
View Full Code Here

    public Volume resizeVolume(final Device device, final Pool pool, final Volume volume)
        throws PluginException
    {
        if (volumes.get(volume.getUuid()) == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }

        Volume original = volumes.get(volume.getUuid());
        Volume resize = new Volume();
        resize.setUuid(original.getUuid());
View Full Code Here

    public Pool getPool(final Device device, final String poolName) throws PluginException
    {
        Pool pool = pools.get(poolName);
        if (pool == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting pool");
        }
        return pool;
    }
View Full Code Here

        throws PluginException
    {
        Volume volume = volumes.get(uuid);
        if (volume == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }
        return volume;
    }
View Full Code Here

    public Volume createVolume(final Device device, final Pool pool, final Volume volume)
        throws PluginException
    {
        if (volumes.get(volume.getUuid()) != null)
        {
            throw new PluginException("Volume already exists");
        }

        Volume created = new Volume();
        created.setUuid(volume.getUuid());
        created.setSizeInMB(volume.getSizeInMB());
View Full Code Here

    public void deleteVolume(final Device device, final Pool pool, final String uuid)
        throws PluginException
    {
        if (volumes.get(uuid) == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }

        Volume removed = volumes.remove(uuid);

        // Update the available size in the pool
View Full Code Here

TOP

Related Classes of com.abiquo.ssm.exception.PluginException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.