Examples of StorageException


Examples of org.apache.lucene.gdata.storage.StorageException

    /**
     * @see org.apache.lucene.gdata.storage.Storage#deleteEntry(org.apache.lucene.gdata.data.ServerBaseEntry)
     */
    public void deleteEntry(ServerBaseEntry entry) throws StorageException {
        if (entry == null)
            throw new StorageException("Can not delete entry -- is null");
        if (entry.getFeedId() == null)
            throw new StorageException(
                    "can not delete entry -- feed id is null");
        if (entry.getId() == null)
            throw new StorageException("Can not delete entry -- id is null");
        if (LOG.isDebugEnabled())
            LOG.debug("delete entry for feed: " + entry.getFeedId()
                    + " entry ID: " + entry.getId());
        DB4oEntry persistentEntry = getInternalEntry(entry.getId());
        // lock the entry to prevent concurrent access
        createSemaphore(entry.getId());
        refreshPersistentObject(persistentEntry);
        if(persistentEntry.getVersion() != entry.getVersion())
            throw new ModificationConflictException(
                    "Current version does not match given version  -- currentVersion: "+persistentEntry.getVersion()+"; given Version: "+entry.getVersion() );
        BaseFeed<BaseFeed, BaseEntry> feed = getFeedOnly(entry.getFeedId(),entry.getServiceType());
        refreshPersistentObject(feed);
        DateTime time = DateTime.now();
        if (persistentEntry.getEntry().getUpdated() != null)
            time.setTzShift(persistentEntry.getEntry().getUpdated().getTzShift());
        feed.setUpdated(time);
        try {
            //delete the entry
            this.container.delete(persistentEntry.getEntry());
            this.container.delete(persistentEntry);
            this.container.set(feed);
            this.container.commit();
           
        } catch (Exception e) {
            LOG
                    .error("Error occured on persisting changes -- rollback changes");
            this.container.rollback();
            throw new StorageException("Can not persist changes -- "
                    + e.getMessage(), e);
        } finally {
            releaseSemaphore(entry.getId());
        }
    }
View Full Code Here

Examples of org.apache.lucene.gdata.storage.StorageException

    /**
     * @see org.apache.lucene.gdata.storage.Storage#updateEntry(org.apache.lucene.gdata.data.ServerBaseEntry)
     */
    public BaseEntry updateEntry(ServerBaseEntry entry) throws StorageException {
        if (entry == null)
            throw new StorageException("Can not update entry -- is null");
        if (entry.getFeedId() == null)
            throw new StorageException(
                    "can not delete entry -- feed id is null");
        if (entry.getId() == null)
            throw new StorageException("Can not delete entry -- id is null");

        DB4oEntry persistentEntry = getInternalEntry(entry.getId());
        // lock the entry to prevent concurrent access
        createSemaphore(entry.getId());
        refreshPersistentObject(persistentEntry);
        if(persistentEntry.getVersion() != entry.getVersion())
            throw new ModificationConflictException(
                    "Current version does not match given version  -- currentVersion: "+persistentEntry.getVersion()+"; given Version: "+entry.getVersion() );
       
        setUpdated(entry, persistentEntry);
        BaseFeed<BaseFeed, BaseEntry> feed = getFeedOnly(entry.getFeedId(),entry.getServiceType());
        refreshPersistentObject(feed);
        BaseEntry retVal = entry.getEntry();
        DB4oEntry newEntry = new DB4oEntry();
        newEntry.setEntry(retVal);
        newEntry.setUpdateTime(entry.getUpdated().getValue());
        newEntry.setFeedId(feed.getId());
        // increment Version
        newEntry.setVersion((entry.getVersion())+1);

        setUpdated(entry, feed);
        try {
            this.container.set(feed);
            this.container.set(newEntry);
            this.container.delete(persistentEntry.getEntry());
            this.container.delete(persistentEntry);
            this.container.commit();
        } catch (Exception e) {
            LOG
                    .error("Error occured on persisting changes -- rollback changes");
            this.container.rollback();
            throw new StorageException("Can not persist changes -- "
                    + e.getMessage(), e);
        } finally {
            releaseSemaphore(entry.getId());
        }
        return retVal;
View Full Code Here

Examples of org.apache.lucene.gdata.storage.StorageException

     * @see org.apache.lucene.gdata.storage.Storage#getFeed(org.apache.lucene.gdata.data.ServerBaseFeed)
     */
    @SuppressWarnings("unchecked")
    public BaseFeed getFeed(ServerBaseFeed feed) throws StorageException {
        if (feed.getId() == null)
            throw new StorageException("can not get feed -- feed id is null");
        if (feed.getStartIndex() < 1)
            feed.setStartIndex(1);
        if (feed.getItemsPerPage() < 0)
            feed.setItemsPerPage(25);

View Full Code Here

Examples of org.apache.struts2.showcase.exception.StorageException

    return intStore(object.getClass(), object);
  }

  public Serializable merge(IdEntity object) throws StorageException {
    if (object == null) {
      throw new StorageException("Cannot merge null object");
    }
    if (object.getId() == null || get(object.getClass(), object.getId()) == null) {
      return create(object);
    } else {
      return update(object).getId();
View Full Code Here

Examples of org.geowebcache.storage.StorageException

    }

    private Long getOrInsert(String key, Map<String, Long> map, int maxSize, String table)
            throws StorageException {
        if (key.length() > 254) {
            throw new StorageException("Value is too big for table " + table + ":" + key);
        }

        Long res = null;
        try {
            res = doSelect(table, key);
View Full Code Here

Examples of org.geowebcache.storage.StorageException

        try {
            wrpr = new JDBCMBWrapper(driverClass, jdbcString, username, password,
                    useConnectionPooling, maxConnections);
        } catch (SQLException se) {
            enabled = false;
            throw new StorageException(se.getMessage());
        }

        if (enabled) {
            idCache = new JDBCMBIdCache(wrpr);
        } else {
View Full Code Here

Examples of org.geowebcache.storage.StorageException

        if (wrpr.driverClass.equals("org.h2.Driver")) {
            // TODO
            // wrpr.getConnection().getMetaData().get
            // DeleteDbFiles.execute(findTempDir(), TESTDB_NAME, true);
            // } else {
            throw new StorageException("clear() has not been implemented for " + wrpr.driverClass);
        }

    }
View Full Code Here

Examples of org.geowebcache.storage.StorageException

   
    public FilePathFilter(TileRange trObj) throws StorageException {
        this.tr = trObj;
       
        if(tr.gridSetId == null) {
            throw new StorageException("Specifying the grid set id is currently mandatory.");
        }
      
        gridSetPrefix = FilePathGenerator.filteredGridSetId(tr.gridSetId);

        if(tr.mimeType != null) {
View Full Code Here

Examples of org.geowebcache.storage.StorageException

    public FileBlobStore(String rootPath) throws StorageException {
        path = rootPath;
        File fh = new File(path);

        if (!fh.exists() || !fh.isDirectory() || !fh.canWrite()) {
            throw new StorageException(path + " is not writable directory.");
        }
        stagingArea = new File(path, "_gwc_in_progress_deletes_");
        createDeleteExecutorService();
        issuePendingDeletes();
    }
View Full Code Here

Examples of org.geowebcache.storage.StorageException

        if (!layerPath.exists() || !layerPath.canWrite()) {
            log.info(layerPath + " does not exist or is not writable");
            return false;
        }
        if (!stagingArea.exists() && !stagingArea.mkdirs()) {
            throw new StorageException("Can't create staging directory for deletes: "
                    + stagingArea.getAbsolutePath());
        }
        String dirName = FilePathGenerator.filteredLayerName(layerName);
        File tmpFolder = new File(stagingArea, dirName);
        int tries = 0;
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.