[ 
https://issues.apache.org/jira/browse/STRATOS-418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13895456#comment-13895456
 ] 

Nirmal Fernando commented on STRATOS-418:
-----------------------------------------

Fixed in 172c86ccade592df37c16c3c3ed19806e372021a

> Refactor IaaS abstract class definition 
> ----------------------------------------
>
>                 Key: STRATOS-418
>                 URL: https://issues.apache.org/jira/browse/STRATOS-418
>             Project: Stratos
>          Issue Type: Improvement
>          Components: Cloud Controller
>    Affects Versions: 4.0.0 M7
>            Reporter: Nirmal Fernando
>            Assignee: Nirmal Fernando
>            Priority: Critical
>             Fix For: 4.0.0 Alpha
>
>
> It's time to refactor the IaaS abstract definition, since we have added more 
> and more operations and it could be optimized. 
> New Iaas definition is like this:
> /**
>  * All IaaSes that are going to support by Cloud Controller, should extend 
> this abstract class.
>  */
> public abstract class Iaas {
>       /**
>        * Reference to the corresponding {@link IaasProvider}
>        */
>       private IaasProvider iaasProvider;
>       
>       public Iaas(IaasProvider iaasProvider) {
>               this.setIaasProvider(iaasProvider);
>       }
>       
>       public IaasProvider getIaasProvider() {
>               return iaasProvider;
>       }
>       public void setIaasProvider(IaasProvider iaasProvider) {
>               this.iaasProvider = iaasProvider;
>       }
>       
>     /**
>      * This should build the {@link ComputeService} object and the {@link 
> Template} object,
>      * using the information from {@link IaasProvider} and should set the 
> built 
>      * {@link ComputeService} object in the {@link 
> IaasProvider#setComputeService(ComputeService)}
>      * and also should set the built {@link Template} object in the 
>      * {@link IaasProvider#setTemplate(Template)}.
>      */
>     public abstract void buildComputeServiceAndTemplate();
>     
>     /**
>      * This method provides a way to set payload that can be obtained from 
> {@link IaasProvider#getPayload()}
>      * in the {@link Template} of this IaaS.
>      */
>     public abstract void setDynamicPayload();
>     
>     /**
>      * This will obtain an IP address from the allocated list and associate 
> that IP with this node.
>      * @param node Node to be associated with an IP.
>      * @return associated public IP.
>      */
>     public abstract String associateAddress(NodeMetadata node);
>     
>     /**
>      * This will deallocate/release the given IP address back to pool.
>      * @param iaasInfo corresponding {@link IaasProvider}
>      * @param ip public IP address to be released.
>      */
>     public abstract void releaseAddress(String ip);
>     
>     /**
>      * This method should create a Key Pair corresponds to a given public key 
> in the respective region having the name given.
>      * Also should override the value of the key pair in the {@link Template} 
> of this IaaS.
>      * @param region region that the key pair will get created.
>      * @param keyPairName name of the key pair. NOTE: Jclouds adds a prefix : 
> <code>jclouds#</code>
>      * @param publicKey public key, from which the key pair will be created.
>      * @return whether the key pair creation is successful or not.
>      */
>     public abstract boolean createKeyPairFromPublicKey(String region, String 
> keyPairName, String publicKey);
>     
>     /**
>      * Validate a given region name against a particular IaaS.
>      * If a particular IaaS doesn't have a concept called region, it can 
> simply throw {@link InvalidRegionException}.
>      * @param region name of the region.
>      * @return whether the region is valid.
>      * @throws InvalidRegionException if the region is invalid.
>      */
>     public abstract boolean isValidRegion(String region) throws 
> InvalidRegionException;
>     
>     /**
>      * Validate a given zone name against a particular region in an IaaS.
>      * If a particular IaaS doesn't have a concept called zone, it can simply 
> throw {@link InvalidZoneException}.
>      * @param region region of the IaaS that the zone belongs to.
>      * @param zone 
>      * @return whether the zone is valid in the given region or not.
>      * @throws InvalidZoneException if the zone is invalid in a given region.
>      */
>     public abstract boolean isValidZone(String region, String zone) throws 
> InvalidZoneException;
>     
>     /**
>      * Validate a given host id against a particular zone in an IaaS.
>      * If a particular IaaS doesn't have a concept called hosts, it can 
> simply throw {@link InvalidHostException}.
>      * @param zone zone of the IaaS that the host belongs to.
>      * @param host
>      * @return whether the host is valid in the given zone or not.
>      * @throws InvalidHostException if the host is invalid in a given zone.
>      */
>     public abstract boolean isValidHost(String zone, String host) throws 
> InvalidHostException;
>     
>     /**
>      * provides the {@link PartitionValidator} corresponds to this particular 
> IaaS.
>      * @return {@link PartitionValidator}
>      */
>     public abstract PartitionValidator getPartitionValidator();
>     /**
>      * Builds only the jclouds {@link Template}
>      */
>     public abstract void buildTemplate();
>     
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to