* move thread local context implementation to core.
This commit is contained in:
parent
1a9a979dcc
commit
043080586d
|
@ -47,5 +47,6 @@ Require-Bundle: org.adempiere.tools;bundle-version="1.0.0",
|
|||
com.springsource.javax.jms;bundle-version="1.1.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Eclipse-ExtensibleAPI: true
|
||||
Import-Package: org.eclipse.core.runtime;version="3.4.0"
|
||||
Import-Package: net.sf.cglib.proxy,
|
||||
org.eclipse.core.runtime;version="3.4.0"
|
||||
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
/******************************************************************************
|
||||
* Product: Posterita Ajax UI *
|
||||
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
|
||||
* or via info@posterita.org or http://www.posterita.org/ *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.adempiere.util;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Language;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
|
||||
* @date Feb 25, 2007
|
||||
* @version $Revision: 0.10 $
|
||||
*/
|
||||
public final class ServerContext
|
||||
{
|
||||
/**
|
||||
* generated serial version Id
|
||||
*/
|
||||
private static final long serialVersionUID = -8274580404204046413L;
|
||||
|
||||
private ServerContext()
|
||||
{
|
||||
}
|
||||
|
||||
private static InheritableThreadLocal<Properties> context = new InheritableThreadLocal<Properties>() {
|
||||
protected Properties initialValue()
|
||||
{
|
||||
Properties ctx = new Properties();
|
||||
ctx.put(Env.LANGUAGE, Language.getBaseAD_Language());
|
||||
return ctx;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get server context for current thread
|
||||
* @return Properties
|
||||
*/
|
||||
public static Properties getCurrentInstance()
|
||||
{
|
||||
return (Properties)context.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* dispose server context for current thread
|
||||
*/
|
||||
public static void dispose()
|
||||
{
|
||||
context.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set server context for current thread
|
||||
* @param ctx
|
||||
*/
|
||||
public static void setCurrentInstance(Properties ctx)
|
||||
{
|
||||
context.set(ctx);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2008 Low Heng Sin *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.sf.cglib.proxy.InvocationHandler;
|
||||
|
||||
/**
|
||||
* Intercaptor for Server context properties that delegate to the threadlocal instance
|
||||
* @author Low Heng Sin
|
||||
*
|
||||
*/
|
||||
public class ServerContextCallback implements InvocationHandler, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Object invoke(Object proxy, Method method, Object[] args)
|
||||
throws Throwable {
|
||||
Properties context = ServerContext.getCurrentInstance();
|
||||
//optimize for the 2 most common access
|
||||
if (method.getName().equals("getProperty")) {
|
||||
Class<?>[] types = method.getParameterTypes();
|
||||
if (types != null && types.length == 1 && types[0] == String.class &&
|
||||
args != null && args.length == 1 && args[0] instanceof String) {
|
||||
return context.getProperty((String)args[0]);
|
||||
}
|
||||
else if (types != null && types.length == 2 && types[0] == String.class &&
|
||||
types[1] == String.class && args != null && args[0] instanceof String &&
|
||||
args[1] instanceof String)
|
||||
return context.getProperty((String)args[0], (String)args[1]);
|
||||
}
|
||||
Method m = context.getClass().getMethod(method.getName(), method.getParameterTypes());
|
||||
return m.invoke(context, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2007 Adempiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*
|
||||
* Copyright (C) 2007 Low Heng Sin hengsin@avantz.com
|
||||
* _____________________________________________
|
||||
*****************************************************************************/
|
||||
package org.adempiere.util;
|
||||
|
||||
import java.util.Properties;
|
||||
import net.sf.cglib.proxy.Enhancer;
|
||||
|
||||
import org.compiere.util.ContextProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Low Heng Sin
|
||||
*
|
||||
*/
|
||||
public class ServerContextProvider implements ContextProvider {
|
||||
|
||||
private final static ServerContextCallback callback = new ServerContextCallback();
|
||||
private final static Properties context = (Properties) Enhancer.create(Properties.class, callback);
|
||||
|
||||
public final static ServerContextProvider INSTANCE = new ServerContextProvider();
|
||||
|
||||
private ServerContextProvider() {}
|
||||
|
||||
/**
|
||||
* Get server context proxy
|
||||
*/
|
||||
public Properties getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show url at zk desktop
|
||||
*/
|
||||
public void showURL(String url) {
|
||||
ServerContextURLHandler handler = (ServerContextURLHandler) getContext().get(ServerContextURLHandler.SERVER_CONTEXT_URL_HANDLER);
|
||||
if (handler != null)
|
||||
handler.showURL(url);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package org.adempiere.util;
|
||||
|
||||
public interface ServerContextURLHandler {
|
||||
public final static String SERVER_CONTEXT_URL_HANDLER = "SERVER_CONTEXT_URL_HANDLER";
|
||||
public void showURL(String url);
|
||||
}
|
|
@ -22,7 +22,6 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -32,8 +31,6 @@ import javax.jnlp.UnavailableServiceException;
|
|||
import javax.swing.ImageIcon;
|
||||
|
||||
import org.adempiere.base.Core;
|
||||
import org.adempiere.base.IResourceFinder;
|
||||
import org.adempiere.base.Service;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MSystem;
|
||||
|
@ -47,7 +44,6 @@ import org.compiere.util.Ini;
|
|||
import org.compiere.util.Login;
|
||||
import org.compiere.util.SecureEngine;
|
||||
import org.compiere.util.SecureInterface;
|
||||
//import org.compiere.util.Splash;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
|
@ -80,7 +76,6 @@ public final class Adempiere
|
|||
static private final String s_file32x32 = "images/AD32.gif";
|
||||
/** 100*30 Product Image. */
|
||||
static private final String s_file100x30 = "images/AD10030.png";
|
||||
// static private final String s_file100x30HR = "images/AD10030HR.png";
|
||||
/** 48*15 Product Image. */
|
||||
static private final String s_file48x15 = "images/Adempiere.png";
|
||||
static private final String s_file48x15HR = "images/AdempiereHR.png";
|
||||
|
|
|
@ -48,6 +48,7 @@ import javax.swing.SwingUtilities;
|
|||
|
||||
import org.adempiere.base.Core;
|
||||
import org.adempiere.base.IResourceFinder;
|
||||
import org.adempiere.util.ServerContextProvider;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLookupCache;
|
||||
|
@ -72,12 +73,14 @@ public final class Env
|
|||
/** Logging */
|
||||
private static CLogger s_log = CLogger.getCLogger(Env.class);
|
||||
|
||||
private static ContextProvider contextProvider = new DefaultContextProvider();
|
||||
private final static ContextProvider clientContextProvider = new DefaultContextProvider();
|
||||
|
||||
/**
|
||||
* @param provider
|
||||
* @deprecated
|
||||
*/
|
||||
public static void setContextProvider(ContextProvider provider)
|
||||
{
|
||||
contextProvider = provider;
|
||||
getCtx().put(LANGUAGE, Language.getBaseAD_Language());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,9 +211,16 @@ public final class Env
|
|||
*/
|
||||
public static final Properties getCtx()
|
||||
{
|
||||
return contextProvider.getContext();
|
||||
return getContextProvider().getContext();
|
||||
} // getCtx
|
||||
|
||||
public static ContextProvider getContextProvider() {
|
||||
if (Ini.isClient())
|
||||
return clientContextProvider;
|
||||
else
|
||||
return ServerContextProvider.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Context
|
||||
* @param ctx context
|
||||
|
@ -1562,7 +1572,7 @@ public final class Env
|
|||
public static void startBrowser (String url)
|
||||
{
|
||||
s_log.info(url);
|
||||
contextProvider.showURL(url);
|
||||
getContextProvider().showURL(url);
|
||||
} // startBrowser
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,10 +52,10 @@ import org.compiere.model.ModelValidationEngine;
|
|||
* Load & Save INI Settings from property file
|
||||
* Initiated in Adempiere.startup
|
||||
* Settings activated in ALogin.getIni
|
||||
*
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id$
|
||||
*
|
||||
*
|
||||
* @author Teo Sarca, www.arhipac.ro
|
||||
* <li>FR [ 1658127 ] Select charset encoding on import
|
||||
* <li>FR [ 2406123 ] Ini.saveProperties fails if target directory does not exist
|
||||
|
@ -63,7 +63,7 @@ import org.compiere.model.ModelValidationEngine;
|
|||
public final class Ini implements Serializable
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3666529972922769528L;
|
||||
|
||||
|
@ -103,16 +103,16 @@ public final class Ini implements Serializable
|
|||
|
||||
private static final String DEFAULT_UI_LOOK = AdempiereLookAndFeel.NAME;
|
||||
/** UI Theme */
|
||||
|
||||
private static final String DEFAULT_UI_THEME = AdempiereThemeInnova.NAME;
|
||||
|
||||
private static final String DEFAULT_UI_THEME = AdempiereThemeInnova.NAME;
|
||||
/** UI Theme */
|
||||
public static final String P_UI_THEME = "UITheme";
|
||||
|
||||
/** Flat Color UI
|
||||
|
||||
/** Flat Color UI
|
||||
public static final String P_UI_FLAT = "UIFlat";
|
||||
private static final boolean DEFAULT_UI_FLAT = false;
|
||||
*/
|
||||
|
||||
|
||||
/** Auto Save */
|
||||
public static final String P_A_COMMIT = "AutoCommit";
|
||||
private static final boolean DEFAULT_A_COMMIT = true;
|
||||
|
@ -167,11 +167,11 @@ public final class Ini implements Serializable
|
|||
/** Validate connection on startup */
|
||||
public static final String P_VALIDATE_CONNECTION_ON_STARTUP = "ValidateConnectionOnStartup";
|
||||
private static final boolean DEFAULT_VALIDATE_CONNECTION_ON_STARTUP = false;
|
||||
|
||||
|
||||
/** Single instance per window id **/
|
||||
public static final String P_SINGLE_INSTANCE_PER_WINDOW = "SingleInstancePerWindow";
|
||||
public static final boolean DEFAULT_SINGLE_INSTANCE_PER_WINDOW = false;
|
||||
|
||||
|
||||
/** Open new windows as maximized **/
|
||||
public static final String P_OPEN_WINDOW_MAXIMIZED = "OpenWindowMaximized";
|
||||
public static final boolean DEFAULT_OPEN_WINDOW_MAXIMIZED = false;
|
||||
|
@ -180,7 +180,7 @@ public final class Ini implements Serializable
|
|||
private static final String DEFAULT_WARNING = "Do_not_change_any_of_the_data_as_they_will_have_undocumented_side_effects.";
|
||||
private static final String P_WARNING_de = "WarningD";
|
||||
private static final String DEFAULT_WARNING_de ="Einstellungen_nicht_aendern,_da_diese_undokumentierte_Nebenwirkungen_haben.";
|
||||
|
||||
|
||||
/** Charset */
|
||||
public static final String P_CHARSET = "Charset";
|
||||
/** Charser Default Value */
|
||||
|
@ -188,17 +188,17 @@ public final class Ini implements Serializable
|
|||
|
||||
/** Load tab fields meta data using background thread **/
|
||||
public static final String P_LOAD_TAB_META_DATA_BG = "LoadTabMetaDataBackground";
|
||||
|
||||
|
||||
public static final String DEFAULT_LOAD_TAB_META_DATA_BG = "N";
|
||||
|
||||
|
||||
/** Ini Properties */
|
||||
private static final String[] PROPERTIES = new String[] {
|
||||
P_UID, P_PWD, P_TRACELEVEL, P_TRACEFILE,
|
||||
P_UID, P_PWD, P_TRACELEVEL, P_TRACEFILE,
|
||||
P_LANGUAGE, P_INI,
|
||||
P_CONNECTION, P_STORE_PWD,
|
||||
P_UI_LOOK, P_UI_THEME, /* P_UI_FLAT,*/
|
||||
P_A_COMMIT, P_A_LOGIN, P_A_NEW,
|
||||
P_ADEMPIERESYS, P_LOGMIGRATIONSCRIPT, P_SHOW_ACCT, P_SHOW_TRL,
|
||||
P_A_COMMIT, P_A_LOGIN, P_A_NEW,
|
||||
P_ADEMPIERESYS, P_LOGMIGRATIONSCRIPT, P_SHOW_ACCT, P_SHOW_TRL,
|
||||
P_SHOW_ADVANCED, P_CACHE_WINDOW,
|
||||
P_CONTEXT, P_TEMP_DIR,
|
||||
P_ROLE, P_CLIENT, P_ORG, P_PRINTER, P_WAREHOUSE, P_TODAY,
|
||||
|
@ -216,7 +216,7 @@ public final class Ini implements Serializable
|
|||
DEFAULT_CONNECTION, DEFAULT_STORE_PWD?"Y":"N",
|
||||
DEFAULT_UI_LOOK, DEFAULT_UI_THEME, /* DEFAULT_UI_FLAT?"Y":"N", */
|
||||
DEFAULT_A_COMMIT?"Y":"N", DEFAULT_A_LOGIN?"Y":"N", DEFAULT_A_NEW?"Y":"N",
|
||||
DEFAULT_ADEMPIERESYS?"Y":"N", DEFAULT_LOGMIGRATIONSCRIPT?"Y":"N", DEFAULT_SHOW_ACCT?"Y":"N", DEFAULT_SHOW_TRL?"Y":"N",
|
||||
DEFAULT_ADEMPIERESYS?"Y":"N", DEFAULT_LOGMIGRATIONSCRIPT?"Y":"N", DEFAULT_SHOW_ACCT?"Y":"N", DEFAULT_SHOW_TRL?"Y":"N",
|
||||
DEFAULT_SHOW_ADVANCED?"Y":"N", DEFAULT_CACHE_WINDOW?"Y":"N",
|
||||
DEFAULT_CONTEXT, DEFAULT_TEMP_DIR,
|
||||
DEFAULT_ROLE, DEFAULT_CLIENT, DEFAULT_ORG, DEFAULT_PRINTER, DEFAULT_WAREHOUSE, DEFAULT_TODAY.toString(),
|
||||
|
@ -230,11 +230,11 @@ public final class Ini implements Serializable
|
|||
|
||||
/** Container for Properties */
|
||||
private static Properties s_prop = new Properties();
|
||||
|
||||
|
||||
private static String s_propertyFileName = null;
|
||||
|
||||
|
||||
/** Logger */
|
||||
private static Logger log = null;
|
||||
private static Logger log = Logger.getLogger(Ini.class.getName());
|
||||
|
||||
/**
|
||||
* Save INI parameters to disk
|
||||
|
@ -301,16 +301,16 @@ public final class Ini implements Serializable
|
|||
boolean loadOK = true;
|
||||
boolean firstTime = false;
|
||||
s_prop = new Properties();
|
||||
|
||||
PersistenceService ps;
|
||||
|
||||
try {
|
||||
ps = (PersistenceService)ServiceManager.lookup("javax.jnlp.PersistenceService");
|
||||
} catch (UnavailableServiceException e) {
|
||||
ps = null;
|
||||
PersistenceService ps;
|
||||
|
||||
try {
|
||||
ps = (PersistenceService)ServiceManager.lookup("javax.jnlp.PersistenceService");
|
||||
} catch (UnavailableServiceException e) {
|
||||
ps = null;
|
||||
log.log(Level.SEVERE, e.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
FileContents fc = null;
|
||||
try {
|
||||
|
@ -324,16 +324,16 @@ public final class Ini implements Serializable
|
|||
ps.setTag(getCodeBase(), PersistenceService.DIRTY);
|
||||
fc = ps.get(getCodeBase());
|
||||
} catch (Exception e1) {
|
||||
|
||||
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.log(Level.SEVERE, e.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
InputStream is = fc.getInputStream();
|
||||
InputStream is = fc.getInputStream();
|
||||
s_prop.load(is);
|
||||
is.close();
|
||||
}
|
||||
|
@ -351,28 +351,28 @@ public final class Ini implements Serializable
|
|||
}
|
||||
|
||||
checkProperties();
|
||||
|
||||
|
||||
// Save if not exist or could not be read
|
||||
if (!loadOK || firstTime)
|
||||
saveWebStartProperties();
|
||||
s_loaded = true;
|
||||
s_propertyFileName = getCodeBase().toString();
|
||||
|
||||
|
||||
return firstTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void saveWebStartProperties() {
|
||||
PersistenceService ps;
|
||||
PersistenceService ps;
|
||||
|
||||
try {
|
||||
ps = (PersistenceService)ServiceManager.lookup("javax.jnlp.PersistenceService");
|
||||
} catch (UnavailableServiceException e) {
|
||||
ps = null;
|
||||
try {
|
||||
ps = (PersistenceService)ServiceManager.lookup("javax.jnlp.PersistenceService");
|
||||
} catch (UnavailableServiceException e) {
|
||||
ps = null;
|
||||
log.log(Level.SEVERE, e.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
OutputStream os = ps.get(getCodeBase()).getOutputStream(true);
|
||||
|
@ -385,7 +385,7 @@ public final class Ini implements Serializable
|
|||
log.log(Level.SEVERE, "Cannot save Properties to " + getCodeBase() + " - " + t.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -396,16 +396,16 @@ public final class Ini implements Serializable
|
|||
{
|
||||
try
|
||||
{
|
||||
BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
|
||||
BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
|
||||
URL url = bs.getCodeBase();
|
||||
return url;
|
||||
}
|
||||
catch(UnavailableServiceException ue)
|
||||
}
|
||||
catch(UnavailableServiceException ue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
} // getCodeBase
|
||||
|
||||
|
||||
/**
|
||||
* @return True if client is started using web start
|
||||
*/
|
||||
|
@ -413,7 +413,7 @@ public final class Ini implements Serializable
|
|||
{
|
||||
return getCodeBase() != null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load INI parameters from filename.
|
||||
* Logger is on default level (INFO)
|
||||
|
@ -457,14 +457,14 @@ public final class Ini implements Serializable
|
|||
}
|
||||
|
||||
checkProperties();
|
||||
|
||||
|
||||
// Save if not exist or could not be read
|
||||
if (!loadOK || firstTime)
|
||||
saveProperties(true);
|
||||
s_loaded = true;
|
||||
log.info(filename + " #" + s_prop.size());
|
||||
s_propertyFileName = filename;
|
||||
|
||||
|
||||
return firstTime;
|
||||
} // loadProperties
|
||||
|
||||
|
@ -507,7 +507,7 @@ public final class Ini implements Serializable
|
|||
}
|
||||
}
|
||||
} // deleteProperties
|
||||
|
||||
|
||||
/**
|
||||
* Load property and set to default, if not existing
|
||||
*
|
||||
|
@ -564,7 +564,7 @@ public final class Ini implements Serializable
|
|||
return base + ADEMPIERE_PROPERTY_FILE;
|
||||
} // getFileName
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Set Property
|
||||
* @param key Key
|
||||
|
@ -627,7 +627,7 @@ public final class Ini implements Serializable
|
|||
if (retStr == null || retStr.length() == 0)
|
||||
return "";
|
||||
//
|
||||
String value = SecureEngine.decrypt(retStr);
|
||||
String value = SecureEngine.decrypt(retStr);
|
||||
// log.finer(key + "=" + value);
|
||||
if (value == null)
|
||||
return "";
|
||||
|
@ -652,7 +652,7 @@ public final class Ini implements Serializable
|
|||
{
|
||||
return getProperty (P_CACHE_WINDOW).equals("Y");
|
||||
} // isCacheWindow
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get Properties
|
||||
*
|
||||
|
@ -670,7 +670,7 @@ public final class Ini implements Serializable
|
|||
public static String getAsString()
|
||||
{
|
||||
StringBuffer buf = new StringBuffer ("Ini[");
|
||||
Enumeration e = s_prop.keys();
|
||||
Enumeration<?> e = s_prop.keys();
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
String key = (String)e.nextElement();
|
||||
|
@ -681,7 +681,7 @@ public final class Ini implements Serializable
|
|||
return buf.toString();
|
||||
} // toString
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/** System environment prefix */
|
||||
|
@ -711,13 +711,10 @@ public final class Ini implements Serializable
|
|||
*/
|
||||
public static void setClient (boolean client)
|
||||
{
|
||||
if (log != null) //already initialized
|
||||
return;
|
||||
s_client = client;
|
||||
CLogMgt.initialize(client);
|
||||
log = Logger.getLogger(Ini.class.getName());
|
||||
} // setClient
|
||||
|
||||
|
||||
/**
|
||||
* Set show license dialog for new setup
|
||||
* @param b
|
||||
|
@ -726,7 +723,7 @@ public final class Ini implements Serializable
|
|||
{
|
||||
s_license_dialog = b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is show license dialog for new setup
|
||||
* @return boolean
|
||||
|
@ -734,8 +731,8 @@ public final class Ini implements Serializable
|
|||
public static boolean isShowLicenseDialog()
|
||||
{
|
||||
return s_license_dialog;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Are the properties loaded?
|
||||
* @return true if properties loaded.
|
||||
|
@ -763,7 +760,7 @@ public final class Ini implements Serializable
|
|||
// teo_sarca: if you uncomment the line below you will get an NPE when generating models
|
||||
//log.fine( "Not found 'java:comp/env/"+ADEMPIERE_HOME+"' in Initial Context. " +e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (env == null || "".equals(env) ) // Fallback
|
||||
env = File.separator + "Adempiere";
|
||||
|
@ -789,7 +786,7 @@ public final class Ini implements Serializable
|
|||
String ch = getAdempiereHome();
|
||||
if (ch != null)
|
||||
return ch;
|
||||
|
||||
|
||||
File[] roots = File.listRoots();
|
||||
for (int i = 0; i < roots.length; i++)
|
||||
{
|
||||
|
@ -798,7 +795,7 @@ public final class Ini implements Serializable
|
|||
File[] subs = roots[i].listFiles();
|
||||
if (subs == null)
|
||||
continue;
|
||||
for (int j = 0; j < subs.length; j++)
|
||||
for (int j = 0; j < subs.length; j++)
|
||||
{
|
||||
if (!subs[j].isDirectory())
|
||||
continue;
|
||||
|
@ -816,7 +813,7 @@ public final class Ini implements Serializable
|
|||
}
|
||||
return ch;
|
||||
} // findAdempiereHome
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Get Window Dimension
|
||||
* @param AD_Window_ID window no
|
||||
|
@ -842,9 +839,9 @@ public final class Ini implements Serializable
|
|||
}
|
||||
return null;
|
||||
} // getWindowDimension
|
||||
|
||||
|
||||
/**
|
||||
* Set Window Dimension
|
||||
* Set Window Dimension
|
||||
* @param AD_Window_ID window
|
||||
* @param windowDimension dimension - null to remove
|
||||
*/
|
||||
|
@ -859,7 +856,7 @@ public final class Ini implements Serializable
|
|||
else
|
||||
s_prop.remove(key);
|
||||
} // setWindowDimension
|
||||
|
||||
|
||||
/**
|
||||
* Get Window Location
|
||||
* @param AD_Window_ID window id
|
||||
|
@ -885,7 +882,7 @@ public final class Ini implements Serializable
|
|||
}
|
||||
return null;
|
||||
} // getWindowLocation
|
||||
|
||||
|
||||
/**
|
||||
* Set Window Location
|
||||
* @param AD_Window_ID window
|
||||
|
@ -902,7 +899,7 @@ public final class Ini implements Serializable
|
|||
else
|
||||
s_prop.remove(key);
|
||||
} // setWindowLocation
|
||||
|
||||
|
||||
/**
|
||||
* Get Divider Location
|
||||
* @return location
|
||||
|
@ -922,7 +919,7 @@ public final class Ini implements Serializable
|
|||
}
|
||||
return 0;
|
||||
} // getDividerLocation
|
||||
|
||||
|
||||
/**
|
||||
* Set Divider Location
|
||||
* @param dividerLocation location
|
||||
|
@ -945,7 +942,7 @@ public final class Ini implements Serializable
|
|||
col.toArray(arr);
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get current charset
|
||||
* @return current charset
|
||||
|
@ -961,8 +958,8 @@ public final class Ini implements Serializable
|
|||
}
|
||||
return Charset.defaultCharset();
|
||||
}
|
||||
|
||||
public static String getPropertyFileName()
|
||||
|
||||
public static String getPropertyFileName()
|
||||
{
|
||||
return s_propertyFileName;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue