On Tue, Jun 25, 2013 at 11:06:36PM +0000, Edison Su wrote:
> I would say, the adapter thing is the legacy stuff, all the storage
> plugins will be managed by DataStoreProviderManager. But as you
> said, we can group plugins into one place by using spring's syntax,
> such as:

> <bean id="storageProviders"
>       class="org.apach.***.datastoreproviderManagerImpl">
>     <property name="providerList">
>         <list>
>             <ref local="providerOne"/>
>             <ref local="providerTwo"/>
>         </list>
>     </property>
> </bean>
>           

I tried something like this:
In applicationContext beanfactory:
<bean id="dataStoreProviderManager"
        
class="org.apache.cloudstack.storage.datastore.provider.DataStoreProviderManagerImpl">
    <property name="primaryDataStoreProviderMgr">
      <ref bean="primaryDataStoreProviderMgr"/>
    </property>
    <property name="imageStoreProviderMgr">
      <ref bean="imageStoreProviderMgr"/>
    </property>
    <property name="providers">
      <ref bean="storageProviders"/>
    </property>
  </bean>

Since I'm trying to separate storageProviders as plugins I tried putting them
in the componentContext.xml so I didn't use a <ref local="">. But there's a 
problem

DataStoreProvider
 | PrimaryDataStoreProvider
 | ImageDataStoreProvider

All the above are interfaces, so I can't inject them using beans and group all
vendor-specific PrimaryDataStoreProviders (Solidfire, Default etc) and the
imageStores (S3, Swift, NFS). 

Shouldn't they become abstract classes with getter/setter for the List<?> 
providers 
to be injected into the ProviderManager?

PS: I'm no spring expert, just RTFM-ing to figure out the best way.

-- 
Prasanna.,

------------------------
Powered by BigRock.com

Reply via email to