String user = null; String password = null;  if(session != null && request.isRequestedSessionIdValid()) { user = (String)session.getAttribute("user"); password = (String)session.getAttribute("password"); } if(user == null) user = defaultUser; if(password == null) password = defaultPassword; System.out.println("user = " + user + "; password = " + password);
	public void generate()		throws IOException, SAXException, ProcessingException {		if (inputSource == null)			throw new ProcessingException("No input source");		Request request = ObjectModelHelper.getRequest(objectModel);		Session session = request.getSession(createSession);				try {			Collection collection = DatabaseManager.getCollection(collectionURI, user, password);			if(collection == null) {				if(getLogger().isErrorEnabled())					getLogger().error("Collection " + collectionURI + " not found");				throw new ProcessingException("Collection " + collectionURI + " not found");			}			XQueryService service = (XQueryService)				collection.getService("XQueryService", "1.0");			service.setProperty(Serializer.GENERATE_DOC_EVENTS, "false");						service.declareVariable("request", request);			service.declareVariable("session", session);						String uri = inputSource.getURI();			CompiledExpression expr;			CachedExpression cached;			synchronized(cache) {				cached = (CachedExpression)cache.get(uri);				if(cached != null) {					// check if source is valid or should be reloaded					int valid = cached.validity.isValid();					if(valid == SourceValidity.UNKNOWN)						valid = cached.validity.isValid(inputSource.getValidity());					if(valid != SourceValidity.VALID) {						cache.remove(uri);						cached = null;					}				}				if(cached == null) {					String xquery = readQuery();					expr = service.compile(xquery);					cached = new CachedExpression(inputSource.getValidity(), expr);					cache.put(uri, cached);				} else					expr = cached.expr;			}			if(mapRequestParams)				mapRequestParams(request, service);			ResourceSet result = service.execute(expr);			            XMLResource resource;			this.contentHandler.startDocument();			for(long i = 0; i < result.getSize(); i++) {				resource = (XMLResource) result.getResource(i);				resource.getContentAsSAX(this.contentHandler);			}			this.contentHandler.endDocument();		} catch (XMLDBException e) {			throw new ProcessingException("XMLDBException occurred: " + e.getMessage(), e);		}	}