public void storeResource( Resource resource ) throws XMLDBException { if( !(resource instanceof LocalXMLResource) ) throw new XMLDBException( ErrorCodes.NOT_IMPLEMENTED ); final LocalXMLResource res = (LocalXMLResource)resource; final String name = res.getDocumentId(); LOG.debug( "storing document " + name ); DBBroker broker = null; try { broker = brokerPool.get(user);  Observer observer; for(Iterator i = observers.iterator(); i.hasNext(); ) { observer = (Observer)i.next(); collection.addObserver( observer ); } DocumentImpl newDoc; if(res.file != null) newDoc = collection.addDocument(broker, name, new InputSource(res.file.getAbsolutePath())); else if(res.root != null) newDoc = collection.addDocument(broker, name, res.root); else newDoc = collection.addDocument(broker, name, res.content); res.document = newDoc;  } catch ( Exception e ) { e.printStackTrace(); throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage(), e ); } finally { brokerPool.release( broker ); } needsSync = true; }
public void storeResource(Resource resource) throws XMLDBException { if (resource.getResourceType().equals("XMLResource")) { LOG.debug("storing document " + resource.getId()); storeXMLResource((LocalXMLResource) resource); } else if (resource.getResourceType().equals("BinaryResource")) { LOG.debug("storing binary resource " + resource.getId()); storeBinaryResource((LocalBinaryResource) resource); } else throw new XMLDBException(ErrorCodes.UNKNOWN_RESOURCE_TYPE, "unknown resource type: " + resource.getResourceType()); needsSync = true; }
	public void storeResource( Resource resource ) throws XMLDBException {			if( !(resource instanceof LocalXMLResource) )				throw new XMLDBException( ErrorCodes.NOT_IMPLEMENTED );			final LocalXMLResource res = (LocalXMLResource)resource;			final String name = res.getDocumentId();			LOG.debug( "storing document " + name );			DBBroker broker = null;			try {				broker = brokerPool.get(user);				//broker.flush();				Observer observer;				for(Iterator i = observers.iterator(); i.hasNext(); ) {					observer = (Observer)i.next();					collection.addObserver( observer );				}				DocumentImpl newDoc;				if(res.file != null)					newDoc = collection.addDocument(broker, name, 						new InputSource(res.file.getAbsolutePath()));				else if(res.root != null)					newDoc = collection.addDocument(broker, name, res.root);				else					newDoc = collection.addDocument(broker, name, res.content);				res.document = newDoc;				//broker.flush();			} catch ( Exception e ) {				e.printStackTrace();				throw new XMLDBException( ErrorCodes.VENDOR_ERROR,					e.getMessage(),					e );			} finally {				brokerPool.release( broker );			}			needsSync = true;		}