Package org.apache.stratos.rest.endpoint.exception

Examples of org.apache.stratos.rest.endpoint.exception.RestAPIException


         }else if(availableMultiTenantCartridges.containsKey(cartridgeType)){
             subscribedCartridge = availableMultiTenantCartridges.get(cartridgeType);
         }else {
             String msg = "Wrong programme sequence";
             throw new RestAPIException(msg);
         }
        //Proper way is copy construrctor
        Cartridge copy = new Cartridge();
        copy.setCartridgeType(subscribedCartridge.getCartridgeType());
        copy.setDescription(subscribedCartridge.getDescription());
View Full Code Here


    public StratosAdminResponse unsubscribe(String alias) throws RestAPIException{
        if(subscribedCartridges.containsKey(alias)){
            subscribedCartridges.remove(alias);
        }else{
            throw new RestAPIException("Unable to un-subscribe");
        }
        StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
        stratosAdminResponse.setMessage("Successfully un-subscribed");
        return stratosAdminResponse;
    }
View Full Code Here

    public StratosAdminResponse addTenant(TenantInfoBean tenantInfoBean) throws RestAPIException{
        try{
            tenantMap.put(tenantInfoBean.getTenantDomain(),tenantInfoBean);
        }catch (Exception e){
            throw new RestAPIException(e.getMessage());
        }
        StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
        stratosAdminResponse.setMessage("Successfully added new Tenant");
        return stratosAdminResponse;
    }
View Full Code Here

        return stratosAdminResponse;
    }

    public TenantInfoBean getTenant(String tenantDomain) throws RestAPIException{
        if(!tenantMap.containsKey(tenantDomain)){
            throw new RestAPIException("Information for tenant: " + tenantDomain + " is not available");
        }
        return tenantMap.get(tenantDomain);
    }
View Full Code Here

        return tenantMap.get(tenantDomain);
    }

    public Cartridge getCartridgeInfo(String alias) throws RestAPIException{
        if(!subscribedCartridges.containsKey(alias)){
            throw new RestAPIException("Cartridge information is not available.");
        }
        return subscribedCartridges.get(alias);
    }
View Full Code Here

        return subscribedCartridges.get(alias);
    }

    public Cartridge getAvailableSingleTenantCartridgeInfo(String cartridgeType) throws RestAPIException{
        if(!availableSingleTenantCartridges.containsKey(cartridgeType)){
            throw new RestAPIException("Cartridge is not available.");
        }
        return availableSingleTenantCartridges.get(cartridgeType);
    }
View Full Code Here

    public StratosAdminResponse  activateTenant(String tenantDomain) throws RestAPIException{
        if(tenantMap.containsKey(tenantDomain)){
            tenantMap.get(tenantDomain).setActive(true);
        } else{
            throw new RestAPIException("Invalid tenant domain");
        }
        StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
        stratosAdminResponse.setMessage("Successfully activated Tenant");
        return stratosAdminResponse;
    }
View Full Code Here

    public StratosAdminResponse deactivateTenant(String tenantDomain) throws RestAPIException{
        if(tenantMap.containsKey(tenantDomain)){
            tenantMap.get(tenantDomain).setActive(false);
        } else{
            throw new RestAPIException("Invalid tenant domain");
        }
        StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
        stratosAdminResponse.setMessage("Successfully deactivated Tenant");
        return stratosAdminResponse;
    }
View Full Code Here

        if(availableSingleTenantCartridges.containsKey(cartridgeType)){
            availableSingleTenantCartridges.remove(cartridgeType);
        } else if(availableMultiTenantCartridges.containsKey(cartridgeType)){
            availableMultiTenantCartridges.remove(cartridgeType);
        } else{
            throw new RestAPIException("invalid cartridge type");
        }
        StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
        stratosAdminResponse.setMessage("Successfully delete cartridge definition");
        return stratosAdminResponse;
    }
View Full Code Here

        return partitionMap.values().toArray(new Partition[0]);
    }

    public Partition getPartition(String partitionId) throws RestAPIException{
        if(!partitionMap.containsKey(partitionId)){
            throw new RestAPIException("There is no partition with the id: " + partitionId);
        }
        return  partitionMap.get(partitionId);
    }
View Full Code Here

TOP

Related Classes of org.apache.stratos.rest.endpoint.exception.RestAPIException

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.