Пример #1
0
 /**
  * Instantiates a new XML resource type.
  *
  * @param agent the agent
  * @param resourceType the resource type
  */
 public XmlResourceType(CollectionAgent agent, ResourceType resourceType) {
   m_agent = agent;
   m_resourceType = resourceType.getName();
   instantiatePersistenceSelectorStrategy(
       resourceType.getPersistenceSelectorStrategy().getClazz());
   instantiateStorageStrategy(resourceType.getStorageStrategy().getClazz());
   m_storageStrategy.setParameters(resourceType.getStorageStrategy().getParameters());
   m_persistenceSelectorStrategy.setParameters(
       resourceType.getPersistenceSelectorStrategy().getParameters());
 }
Пример #2
0
 /**
  * Instantiate storage strategy.
  *
  * @param className the class name
  */
 private void instantiateStorageStrategy(String className) {
   Class<?> cinst;
   try {
     cinst = Class.forName(className);
   } catch (ClassNotFoundException e) {
     throw new ObjectRetrievalFailureException(
         StorageStrategy.class, className, "Could not load class", e);
   }
   try {
     m_storageStrategy = (StorageStrategy) cinst.newInstance();
   } catch (InstantiationException e) {
     throw new ObjectRetrievalFailureException(
         StorageStrategy.class, className, "Could not instantiate", e);
   } catch (IllegalAccessException e) {
     throw new ObjectRetrievalFailureException(
         StorageStrategy.class, className, "Could not instantiate", e);
   }
   m_storageStrategy.setResourceTypeName(m_resourceType);
   if (m_agent != null) m_storageStrategy.setStorageStrategyService(m_agent);
 }