pnever 2005/01/19 07:19:52 Modified: proposals/tamino/src/store/org/apache/slide/store/tamino/datastore XDescriptorsAccessor.java proposals/tamino/src/store/org/apache/slide/store/tamino/servlet XWebdavServlet.java Log: Fixed some problems for Linux-Version of TWS Revision Changes Path 1.3 +18 -14 jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/datastore/XDescriptorsAccessor.java Index: XDescriptorsAccessor.java =================================================================== RCS file: /home/cvs/jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/datastore/XDescriptorsAccessor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- XDescriptorsAccessor.java 15 Dec 2004 10:38:27 -0000 1.2 +++ XDescriptorsAccessor.java 19 Jan 2005 15:19:52 -0000 1.3 @@ -45,6 +45,7 @@ import org.apache.slide.store.tamino.jdomobjects.XJdom; import org.apache.slide.store.tamino.jdomobjects.XUuri; import org.apache.slide.store.tamino.jdomobjects.XmlStream; +import org.apache.slide.store.ResourceId; import org.apache.slide.structure.ObjectNode; import org.apache.slide.util.XException; import org.apache.slide.util.XUri; @@ -78,18 +79,21 @@ this.tsdLanguage = tsdLanguage; } - public String getSchemaVersion() throws XDatastoreException { - Element el; + public String getSchemaVersion() throws XException { + Element el = null; + try { + el = doReadDescriptorsDocument("/"+contentCollection+"/"); + } catch (XException e) {} - el = xqueryOptElement("(input()/" + contentCollection + ")[1]"); if (el == null) { - System.out.println("TODO: schema version unkown"); - // TODO: version is unkown?! - // check SchemaDocument instead of instances? - return XGlobals.SCHEMA_VERSION; - } else { - return el.getAttributeValue (XJdom.A_DTD_VERSION); + try { + el = doReadDescriptorsDocument(ResourceId.RESOURCE_ID_SCHEMA+"/"+contentCollection+"/"); + } catch (XException e) {} } + + return (el != null + ? el.getAttributeValue(XJdom.A_DTD_VERSION) + : XGlobals.SCHEMA_VERSION); } //-- crud, without read/query @@ -212,7 +216,7 @@ XUri storeUri = XUuri.extractStoreUri(xUri); XUri xPath = xUri.suburi(storeUri.size()); String storeUuri = XUuri.getStoreUuri(useBinding, storeUri); - + XUri currentUri = storeUri; String currentUuri = storeUuri; XDescriptors currentDesc = readDescriptorsByUuri(currentUuri); 1.5 +43 -40 jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/servlet/XWebdavServlet.java Index: XWebdavServlet.java =================================================================== RCS file: /home/cvs/jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/servlet/XWebdavServlet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XWebdavServlet.java 15 Sep 2004 14:58:26 -0000 1.4 +++ XWebdavServlet.java 19 Jan 2005 15:19:52 -0000 1.5 @@ -57,17 +57,17 @@ ** @version $Revision$ **/ public class XWebdavServlet extends WebdavServlet implements IMonitorable { - + private static final String LOGNAME = LoggerUtil.getThisClassName(); private static final String CLASSNAME = new ClassName(LOGNAME).getPlainName(); private static Logger logger = LoggerFactory.getLogger(LOGNAME); - + /** Product information **/ protected final static String PRODUCT_INFORMATION = "Product Information"; - + /** product information */ protected String version = null; - + /** the name */ protected String monName = null; /** the parent */ @@ -76,7 +76,7 @@ protected List monChildren = new ArrayList(); /** the Monitor object */ protected Monitor monitor = null; - + // monitoring counters and timers... /** method -> counterName*/ private Map counterNames = new HashMap(); @@ -86,9 +86,9 @@ private Map timerNames = new HashMap(); /** timerName -> timer*/ private Map timers = new HashMap(); - - - + + + /** * Overwrites in order to init monitoring. * @exception ServletException servlet error @@ -96,41 +96,43 @@ public void init() throws ServletException { if( logger.isLoggable(Level.FINE) ) logger.entering( CLASSNAME, "init" ); - + // monitoring variables //this.monName = "WebdavServlet"; this.monName = "WebDAV Servlet"; // this.monParent = ...; no parent monitorable // this.monChildren.add( ... ); // no children this.monitor = Monitor.getMonitor( this, true ); // this comes last!! - displaceRoot=true - + try { version = Env.get().getVersion(); } catch (IOException e) { throw new ServletException("error obtaining product version", e); } - + monitor.registerProperty( PRODUCT_INFORMATION ); printVersion(); - - XUuri.initStoreScopes(getInitParameter("namespace")); + + if (XUuri.getScopes() == null) { + XUuri.initStoreScopes(getInitParameter("namespace")); + } super.init(); - + if( logger.isLoggable(Level.FINE) ) logger.exiting( CLASSNAME, "init" ); } - + private void printVersion() { Class cl; - + System.out.println( version); cl = DocumentBuilderFactory.newInstance().getClass(); System.out.println("Xerces Name: " + Misc.getXercesName()); System.out.println(cl.getName() + " loaded from " + Misc.locateClasspathItem(cl)); } - + /** * Destroy servlet. */ @@ -139,7 +141,7 @@ super.destroy(); XUuri.clearScopes(); } - + /** * Get counter for method */ @@ -154,10 +156,10 @@ result = monitor.getCounter( name ); counters.put( name, result ); } - + return result; } - + /** * Get counter for method */ @@ -172,11 +174,11 @@ result = monitor.getTimer( name ); timers.put( name, result ); } - + return result; } - - + + /** * Overwrites in order to perform monitoring. * @param req http servlet request @@ -188,7 +190,7 @@ throws ServletException, IOException { if( logger.isLoggable(Level.FINE) ) logger.entering( CLASSNAME, "service", new Object[]{req.getMethod(),req.getRequestURI()} ); - + String m = req.getMethod(); counter(m).increment(); Object timerId = timer(m).start(); @@ -204,19 +206,19 @@ return; } } - + super.service( req, resp ); - + timer(m).stop(timerId); - + if( logger.isLoggable(Level.FINE) ) logger.exiting( CLASSNAME, "service" ); } - + //------------------------------------------------------------- // IMonitorable interface // ------------------------------------------------------------ - + /** ** Return the name of this monitorable. ** @@ -226,7 +228,7 @@ public String getMonName() { return monName; } - + /** ** Get the parent monitorable. ** @@ -236,7 +238,7 @@ public IMonitorable getMonParent() { return monParent; } - + /** ** Get child monitorables. ** @@ -246,7 +248,7 @@ public List getMonChildren() { return monChildren; } - + /** ** Get the Monitor object. ** @@ -256,7 +258,7 @@ public IMonitor getMonitor() { return monitor; } - + /** ** Get the value of a registered property. ** @param prop property name @@ -265,14 +267,15 @@ **/ public Object getMonProperty( String prop ) { Object result = null; - + if (PRODUCT_INFORMATION.equals (prop)) { result = version; } - + return result; } - + } +
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]