Tuesday, April 28, 2009

Mirena Softened Cervix



When the Hibernate Search index in the file system stores (FSDirectoryProvider), this typically is defined in the persistence.xml (in the use of JPA). Here you can only use a relative path to the index directory from which the Java application was started specify (eg $ TOMCAT_HOME / bin) or you are an absolute path. After the persistence.xml is normally part of the delivered application, an absolute path is not really in question (a typical scenario: Development on Windows - C: \\ app \\ luceneIdx; Livedeployment Linux - / usr / local / app / luceneIdx). A relative path is however not necessarily beautiful - / usr/share/jboss/jboss-4.2.3GA/bin/luceneIdx ...
my opinion would be nice to a relative path to the AppServer with the definition here is in the source code (XML configuration, there really is enough already ...)

Attached to define a few ways the path for Hibernate Search:






\u0026lt;property name = "hibernate.search.default.indexBase" value = "luceneIdx "/>





start parameters



-Dhibernate.search.default.indexBase = D: / luceneIdx

When starting the VM can also specify the index, Hibernate Search will then use this. Thus, for each environment (Windows, Linux) defines an absolute directory
JBoss MBean SystemProperties


\u0026lt;mbean code = "org.jboss.varia.property.SystemPropertiesService"


name = "jboss.util: type = Service, name = SystemProperties>



<!-- Load properties from each of the given comma separated URLs -->


     <attribute name="URLList">     

./conf/lucene.properties


</attribute>

      

</mbean>


Lucene.properties

      
hibernate.search.default.indexBase=D:/luceneIdx3

 The definition of Hibernate Search Index Directory is being held in a property file (accessed through the System Properties JBoss MBean) that may be different style for each server environment. The configuration is in the application, the property file can be different on each server.   
Self
directory provider

   package com.nobiscum.provobis.search; 
import java.io.File;
import java.util.Enumeration;
import java.util.Properties;

import org.hibernate.search.backend.configuration.MaskedProperty;

 import org.hibernate.search.engine.SearchFactoryImplementor;   import org.hibernate.search.store.FSDirectoryProvider;   
/**
* <p>
* This DirectoryProvider use the <i><jboss.server.data.dir>/luceneIdx</i> directory to store the
* Apache Lucene filesystem index.<br>

* For example the path looks like <i><JBOSS_HOME>/server/provobis/data/luceneIdx</i>

* </p>

  * <p>   * To use the FSRelativePathDirectoryProvider put following line in <code>persistence.xml</code><br>    *  
* <pre>
* <property name="hibernate.search.default.directory_provider"
* value="com.nobiscum.provobis.search.FSRelativePathDirectoryProvider" />
* </pre>

*

* </p>

  *    * @author mre   * @see FSDirectoryProvider 
*/
public class FSRelativePathDirectoryProvider extends FSDirectoryProvider {
@Override

public void initialize(String directoryProviderName, Properties properties,

SearchFactoryImplementor searchFactoryImplementor) {

         // copy is necessary, see method description.          Properties p = copyProperties(properties);   
// XXX AppServer dependency
String indexBase = System.getProperty("jboss.server.data.dir");
indexBase += File.separator + "luceneIdx";

p.put("indexBase", indexBase);

super.initialize(directoryProviderName, p, searchFactoryImplementor);
}

/**

      * The <code>properties</code> parameter is not a {@link Properties} themselve, but rather a       * subclass ({@link  MaskedProperty}. The {@link MaskedProperty} is read-only, less methods are       * implemented, the most throw an UnsupportedOperationException. 
* <p>
* To manipulate the properties, a new <i>normal</i> {@link Properties} object is created. The
* values from the given properties are all copied into the new one.
*

* @param properties

* existing properties object
* @return new properties object, that contains all values from <code>properties</code>

*/

private Properties copyProperties(Properties properties) { newProperties Properties = new Properties ();
\u0026lt;Object> Enumeration keys = properties.keys ();
if (keys.hasMoreElements ()) {String key

= (String) keys.nextElement ();

String newProperties return

 };; properties.getProperty value = (key);  newProperties.put (key, value) 
}}






Here is the path relative to the JBoss data directory.


find a nice solution as I ;-)




Thursday, April 2, 2009

Flatulence Newborn Babies





jQuery Thickbox supporting primarily the dialog handling HTTP GET. This is understandable since the API so the slideshow corner comes in usually by new pictures
a href
be requested and displayed in a dialog box.


If you want to use the API, however, in a web application for use of web2.0 dialog boxes (layers), it happens frequently that you want to post data from the dialog box and then want to display another dialog box.


scenario:


Login Box
à
link (a href) I forgot my password I forgot my password box

à à

email address and query and Server Post
à
Email verschickien with newly generated password's
à
login box.


Here is that code must be on the Submit button. ...





$ (document) ready (function () {
$ ("# btn_send") click (function () {$
ajax ({
type: "POST", url
: $ ( .? "width = 400" '# rememberPasswordForm') attr ('action')








+,
dataType: "html",
data. $ ('# rememberPasswordForm'), serialize () ,
success: function (data) {



/ / set content to DIABOX and reinitalize thickbox
$ ("# TB_ajaxContent") html (data);.

tb_position ();

$ ("# TB_load) . remove ();

tb_init ("# TB_ajaxContent a.thickbox"); $ ("# TB_window) css ({display:" block "});. ); $ ( .. btn_close ") click (tb_remove);

});



The interesting part here is the callback function (success: function (data) ...). In it, the Thickbox code for displaying the returned page is located. Here, besides the representation not incorporated the initialization, so that in the "new" dialog box and the Thickbox functions are available.