Examples of DataStore


Examples of org.apache.cloudstack.engine.subsystem.api.storage.DataStore

        DataCenterVO dc = _dcDao.findById(host.getDataCenterId());
        if (dc == null || !dc.isLocalStorageEnabled()) {
            return null;
        }
        DataStore store;
        try {
            StoragePoolVO pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), pInfo.getHost(), pInfo.getHostPath(),
                    pInfo.getUuid());
            if (pool == null && host.getHypervisorType() == HypervisorType.VMware) {
                // perform run-time upgrade. In versions prior to 2.2.12, there
                // is a bug that we don't save local datastore info (host path
                // is empty), this will cause us
                // not able to distinguish multiple local datastores that may be
                // available on the host, to support smooth migration, we
                // need to perform runtime upgrade here
                if (pInfo.getHostPath().length() > 0) {
                    pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), pInfo.getHost(), "", pInfo.getUuid());
                }
            }
            DataStoreProvider provider = this.dataStoreProviderMgr.getDefaultPrimaryDataStoreProvider();
            DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
            if (pool == null) {
                Map<String, Object> params = new HashMap<String, Object>();
                String name = (host.getName() + " Local Storage");
                params.put("zoneId", host.getDataCenterId());
                params.put("clusterId", host.getClusterId());
                params.put("podId", host.getPodId());
                params.put("url", pInfo.getPoolType().toString() + "://" + pInfo.getHost() + "/" + pInfo.getHostPath());
                params.put("name", name);
                params.put("localStorage", true);
                params.put("details", pInfo.getDetails());
                params.put("uuid", pInfo.getUuid());
                params.put("providerName", provider.getName());

                store = lifeCycle.initialize(params);
            } else {
                store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
            }

            HostScope scope = new HostScope(host.getId(), host.getClusterId(), host.getDataCenterId());
            lifeCycle.attachHost(store, scope, pInfo);
        } catch (Exception e) {
            s_logger.warn("Unable to setup the local storage pool for " + host, e);
            throw new ConnectionException(true, "Unable to setup the local storage pool for " + host, e);
        }

        return dataStoreMgr.getDataStore(store.getId(), DataStoreRole.Primary);
    }
View Full Code Here

Examples of org.apache.derby.impl.io.vfmem.DataStore

     * @return {@code true} if the database was deleted, {@code false} otherwise
     */
    public static boolean purgeDatabase(final String dbName) {
        // TODO: Should we check if the database is booted / active?
        synchronized (DATABASES) {
            DataStore store = (DataStore)DATABASES.remove(dbName);
            if (store != null) {
                // Delete everything.
                store.purge();
                return true;
            }
            return false;
        }
    }
View Full Code Here

Examples of org.apache.gora.store.DataStore

   * Gets the data store object initialized.
   * @param conf Configuration
   * @return DataStore created
   */
  public DataStore createDataStore(Configuration conf) {
    DataStore dsCreated = null;
    try {
      dsCreated = GoraUtils.createSpecificDataStore(conf, getDatastoreClass(),
          getKeyClass(), getPersistentClass());
    } catch (GoraException e) {
      getLogger().error("Error creating data store.");
View Full Code Here

Examples of org.apache.jackrabbit.core.data.DataStore

                    Node child = children.item(i);
                    if (child.getNodeType() == Node.ELEMENT_NODE
                            && DATA_STORE_ELEMENT.equals(child.getNodeName())) {
                        BeanConfig bc =
                            parseBeanConfig(parent, DATA_STORE_ELEMENT);
                        DataStore store = (DataStore) bc.newInstance();
                        store.init(directory);
                        return store;
                    }
                }
                return null;
            }
View Full Code Here

Examples of org.apache.juddi.datastore.DataStore

    String generic = request.getGeneric();
    AuthInfo authInfo = request.getAuthInfo();
    Vector assertionVector = request.getPublisherAssertionVector();

    // aquire a jUDDI datastore instance
    DataStore dataStore = DataStoreFactory.getDataStore();

    try
    {
      dataStore.beginTrans();

      // validate authentication parameters
      Publisher publisher = getPublisher(authInfo,dataStore);
      String publisherID = publisher.getPublisherID();

      // validate request parameters & execute
      // Per UDDI v2.0 specification, the tModelKey in a passed publisherAssertion CANNOT be null or blank.  An invalidKeyPassed error must be thrown.
      if (assertionVector != null) {
        for (int i = 0; i < assertionVector.size(); i++) {
          PublisherAssertion publisherAssertion = (PublisherAssertion)assertionVector.elementAt(i);
          if (publisherAssertion != null) {
            KeyedReference kr = publisherAssertion.getKeyedReference();
            if (kr != null) {
              if (kr.getTModelKey() == null || kr.getTModelKey().length() == 0) {
                //throw new InvalidKeyPassedException("tModelKey must be provided in KeyedReference for publisherAssertion: fromKey=" +
              //                                   publisherAssertion.getFromKey() + "; toKey=" + publisherAssertion.getToKey());
              throw new InvalidKeyPassedException("tModelKey must be provided in KeyedReference for publisherAssertion: fromKey=");

              }
            }
          }
         
        }
      }
      // nothing that requires validation has been identified

      // set the PublisherAssertions
      Vector savedAssertionsVector = dataStore.setAssertions(publisherID,assertionVector);

      dataStore.commit();

      PublisherAssertions assertions = new PublisherAssertions();
      assertions.setGeneric(generic);
      assertions.setOperator(Config.getOperator());
      assertions.setPublisherAssertionVector(savedAssertionsVector);
      return assertions;
    }
    catch(InvalidKeyPassedException ivkex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(ivkex);
      throw (RegistryException)ivkex;
    }
    catch(RegistryException regex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(regex);
      throw (RegistryException)regex;
    }
    catch(Exception ex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(ex);
      throw new RegistryException(ex);
    }
    finally
    {
      if (dataStore != null)
        dataStore.release();
    }
  }
View Full Code Here

Examples of org.apache.juddi.datastore.DataStore

    String generic = request.getGeneric();
    // AuthInfo authInfo = request.getAuthInfo();
    // Vector bindingKeyVector = request.getSubscriptionKeyVector();

    // aquire a jUDDI datastore instance
    DataStore dataStore = DataStoreFactory.getDataStore();

    try
    {
      dataStore.beginTrans();

      // TODO (UDDI v3) Implement delete_subscription business logic.
     
      dataStore.commit();
    }
    catch(InvalidKeyPassedException ex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.info(ex);
      throw (RegistryException)ex;
    }
    catch(UserMismatchException ex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.info(ex);
      throw (RegistryException)ex;
    }
    catch(RegistryException regex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(regex);
      throw (RegistryException)regex;
    }
    catch(Exception ex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(ex);
      throw new RegistryException(ex);
    }
    finally
    {
      if (dataStore != null)
        dataStore.release();
    }

    // We didn't encounter any problems so let's create an
    // E_SUCCESS Result, embed it in a DispositionReport
    // and return it.
View Full Code Here

Examples of org.apache.juddi.datastore.DataStore

    GetTModelDetail request = (GetTModelDetail)regObject;
    String generic = request.getGeneric();
    Vector keyVector = request.getTModelKeyVector();

    // aquire a jUDDI datastore instance
    DataStore dataStore = DataStoreFactory.getDataStore();

    try
    {
      dataStore.beginTrans();

      for (int i=0; i<keyVector.size(); i++)
      {
        String tModelKey = (String)keyVector.elementAt(i);

        // If the a TModel doesn't exist hrow an InvalidKeyPassedException.
        if ((tModelKey == null) || (tModelKey.length() == 0) ||
            (!dataStore.isValidTModelKey(tModelKey)))
          throw new InvalidKeyPassedException("get_tModelDetail: "+
              "tModelKey");
      }

      Vector tModelVector = new Vector();

      for (int i=0; i<keyVector.size(); i++)
      {
        String tModelKey = (String)keyVector.elementAt(i);
        tModelVector.add(dataStore.fetchTModel(tModelKey));
      }

      dataStore.commit();

      // create a new TModelDetail and stuff the new tModelVector into it.
      TModelDetail detail = new TModelDetail();
      detail.setGeneric(generic);
      detail.setTModelVector(tModelVector);
      detail.setOperator(Config.getOperator());
      return detail;
    }
    catch(InvalidKeyPassedException keyex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.info(keyex.getMessage());
      throw (RegistryException)keyex;
    }
    catch(RegistryException regex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(regex);
      throw (RegistryException)regex;
    }
    catch(Exception ex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(ex);
      throw new RegistryException(ex);
    }
    finally
    {
      if (dataStore != null)
        dataStore.release();
    }
  }
View Full Code Here

Examples of org.apache.juddi.datastore.DataStore

    GetServiceDetail request = (GetServiceDetail)regObject;
    String generic = request.getGeneric();
    Vector keyVector = request.getServiceKeyVector();

    // aquire a jUDDI datastore instance
    DataStore dataStore = DataStoreFactory.getDataStore();

    try
    {
      dataStore.beginTrans();

      for (int i=0; i<keyVector.size(); i++)
      {
        String serviceKey = (String)keyVector.elementAt(i);

        // If the a BusinessService doesn't exist hrow an InvalidKeyPassedException.
        if ((serviceKey == null) || (serviceKey.length() == 0) ||
            (!dataStore.isValidServiceKey(serviceKey)))
          throw new InvalidKeyPassedException("get_serviceDetail: "
              + "serviceKey");
      }

      Vector serviceVector = new Vector();

      for (int i=0; i<keyVector.size(); i++)
      {
        String serviceKey = (String)keyVector.elementAt(i);
        serviceVector.add(dataStore.fetchService(serviceKey));
      }

      dataStore.commit();

      // create a new ServiceDetail and stuff the new serviceVector into it.
      ServiceDetail detail = new ServiceDetail();
      detail.setGeneric(generic);
      detail.setOperator(Config.getOperator());
      detail.setBusinessServiceVector(serviceVector);
      return detail;
    }
    catch(InvalidKeyPassedException keyex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.info(keyex.getMessage());
      throw (RegistryException)keyex;
    }
    catch(RegistryException regex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(regex);
      throw (RegistryException)regex;
    }
    catch(Exception ex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(ex);
      throw new RegistryException(ex);
    }
    finally
    {
      if (dataStore != null)
        dataStore.release();
    }
  }
View Full Code Here

Examples of org.apache.juddi.datastore.DataStore

    GetBusinessDetail request = (GetBusinessDetail)regObject;
    String generic = request.getGeneric();
    Vector businessKeyVector = request.getBusinessKeyVector();

    // aquire a jUDDI datastore instance
    DataStore dataStore = DataStoreFactory.getDataStore();

    try
    {
      dataStore.beginTrans();

      for (int i=0; i<businessKeyVector.size(); i++)
      {
        String businessKey = (String)businessKeyVector.elementAt(i);

        // If the a BusinessEntity doesn't exist throw an InvalidKeyPassedException.
        if ((businessKey == null) || (businessKey.length() == 0) ||
            (!dataStore.isValidBusinessKey(businessKey)))
          throw new InvalidKeyPassedException("get_businessDetail: "+
            "businessKey");
      }

      Vector businessVector = new Vector();

      for (int i=0; i<businessKeyVector.size(); i++)
      {
        String businessKey = (String)businessKeyVector.elementAt(i);
        businessVector.addElement(dataStore.fetchBusiness(businessKey));
      }

      dataStore.commit();

      // create a new BusinessDetail and stuff the new businessVector into it.
      BusinessDetail detail = new BusinessDetail();
      detail.setGeneric(generic);
      detail.setOperator(Config.getOperator());
      detail.setBusinessEntityVector(businessVector);
      return detail;
    }
    catch(InvalidKeyPassedException keyex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.info(keyex.getMessage());
      throw (RegistryException)keyex;
    }
    catch(RegistryException regex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(regex);
      throw (RegistryException)regex;
    }
    catch(Exception ex)
    {
      try { dataStore.rollback(); } catch(Exception e) { }
      log.error(ex);
      throw new RegistryException(ex);
    }
    finally
    {
      dataStore.release();
    }
  }
View Full Code Here

Examples of org.apache.mahout.classifier.bayes.Datastore

  public void initClassifierContext() {
    try {
      //<start id="mahout.bayes.setup"/>
      BayesParameters p = new BayesParameters();
      p.set("basePath", modelDir.getCanonicalPath());
      Datastore ds = new InMemoryBayesDatastore(p);
      Algorithm a  = new BayesAlgorithm();
      ClassifierContext ctx = new ClassifierContext(a,ds);
      ctx.initialize();
      //<end id="mahout.bayes.setup"/>
      synchronized (swapContext) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.