Package com.mongodb

Examples of com.mongodb.MongoException$Network


     * @throws IOException    on problems reading the new entry's {@link java.io.InputStream}.
     * @throws MongoException
     */
    public int saveChunks( long chunkSize ) throws IOException {
        if (_outputStream != null)
            throw new MongoException( "cannot mix OutputStream and regular save()" );
        if ( _savedChunks )
            throw new MongoException( "chunks already saved!" );

        if ( chunkSize <= 0) {
            throw new MongoException("chunkSize must be greater than zero");
        }

        if ( _chunkSize != chunkSize ) {
            _chunkSize = chunkSize;
            _buffer = new byte[(int) _chunkSize];
View Full Code Here


     *
     * @throws MongoException
     */
    public void save(){
        if ( _fs == null )
            throw new MongoException( "need _fs" );
        _fs._filesCollection.save( this );
    }
View Full Code Here

     *
     * @throws MongoException
     */
    public void validate(){
        if ( _fs == null )
            throw new MongoException( "no _fs" );
        if ( _md5 == null )
            throw new MongoException( "no _md5 stored" );
       
        DBObject cmd = new BasicDBObject( "filemd5" , _id );
        cmd.put( "root" , _fs._bucketName );
        DBObject res = _fs._db.command( cmd );
        if ( res != null && res.containsField( "md5" ) ) {
            String m = res.get( "md5" ).toString();
            if ( m.equals( _md5 ) )
                return;
            throw new MongoException( "md5 differ.  mine [" + _md5 + "] theirs [" + m + "]" );
        }

        // no md5 from the server
        throw new MongoException( "no md5 returned from server: " + res );

    }
View Full Code Here

    final Boolean updatedExisting = (Boolean) result
        .getField("updatedExisting");
    if (result.getN() == 0 && result.getError() == null) {
      throw new UpdateConflictException(timestamp);
    } else if (result.getN() != 1) {
      throw new MongoException(result.getError()+ " <--- "+properties);
    }
    timestamp = now;
    return updatedExisting;
  }
View Full Code Here

    final int port = getPort()// store in variable to protect against change by subclass
    ArgumentChecker.notNull(host, "host");
    try {
      return new MongoClient(host, port);
    } catch (UnknownHostException ex) {
      throw new MongoException(ex.getMessage(), ex);
    }
  }
View Full Code Here

TOP

Related Classes of com.mongodb.MongoException$Network

Copyright © 2018 www.massapicom. 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.