-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: How to locate the IndexBase forder with relative path??
PostPosted: Mon Dec 08, 2008 12:53 pm 
Newbie

Joined: Mon Dec 08, 2008 12:44 pm
Posts: 1
I use below to config the hibernate, and it creat a "WEB-INF/Index" forder in the root of Tomcat!

Quote:
<property name="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</property>
<property name="hibernate.search.default.indexBase">WEB-INF/Index</property>


How can i locate the IndexBase forder with the relative path of the root of my site such as in the WEB-INF/Index?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2008 3:58 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I am not quite sure what you want to achieve here, so I just have a few comments.

Generally, if a relative path is specified for indexBase it is relative to where the java app has been started from. In Tomcat's case it is probably the bin directory of the installation. The value itself can be accessed in Java using the user.dir system property.

However, I would not recommend using a relative path for indexBase since the user.dir might change depending on the container you are using and the startup scripts. If relative, I would make sure that the indexBase is separated from the web application using Search (I assume that's what you are trying to do). You seem to be assuming that your war file gets extracted, but that does not have to be the case. Web applications can also be run directly from the packaged jar. Personally, I think it is bad practice to do any file based operations in the deploy directory.

I recommend using absolute file names and maybe filter the correct path into the configuration files at build time. Using filters allows to have separate values for things like development vs production environments.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2008 5:28 am 
Beginner
Beginner

Joined: Thu Jun 21, 2007 1:47 pm
Posts: 46
Hi,

Could you clarify what you mean by "Using filters allows to have separate values for things like development vs production environments." ?

Currently I'm always targetting the same container (glassfish) and I can predict the working directory so I just use relative paths. However, it might be nice to use these "filters" you mentioned - I haven't heard of these so it might be useful for other things, too!

Thanks,
Dobes


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2008 5:42 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I am referring to resource filtering as you for example can do with Maven (Maven resource filtering). Of course the same can be done with Ant or any other build system. Depending on a flag, profile, property you replace certain placeholder tokens in your resource file with specific values.

How exactly you do this depends on your build tools and setup.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2008 6:33 am 
Beginner
Beginner

Joined: Thu Jun 21, 2007 1:47 pm
Posts: 46
Oh I see. I'm using eclipse - I don't think it supports this feature, sadly.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2008 6:42 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Only eclipse? Do you not have a command line build setup as well? Just running the build from Eclipse only has numerous disadvantages. I think best practise is to have a Ant or Maven based build and use Eclipse or Idea (or whatever IDE) for development.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2008 7:05 am 
Beginner
Beginner

Joined: Thu Jun 21, 2007 1:47 pm
Posts: 46
Yes, just eclipse. I haven't run into many problems with it.. In fact, my attempts to use ant or maven have been more problematic, the learning curve for maven seems to be too great for me to bother, with good tools already at my disposal.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.