use of javax.jnlp.UnavailableServiceException in project adempiere by adempiere.
the class Adempiere method getCodeBase.
// setSupportEMail
/**
* Get JNLP CodeBase
* @return code base or null
*/
public static URL getCodeBase() {
try {
BasicService bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
URL url = bs.getCodeBase();
return url;
} catch (UnavailableServiceException ue) {
return null;
}
}
use of javax.jnlp.UnavailableServiceException in project adempiere by adempiere.
the class Ini method saveWebStartProperties.
private static void saveWebStartProperties() {
PersistenceService ps;
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);
s_prop.store(os, "Adempiere");
os.flush();
os.close();
} catch (Throwable t) {
log.log(Level.SEVERE, "Cannot save Properties to " + getCodeBase() + " - " + t.toString());
return;
}
}
use of javax.jnlp.UnavailableServiceException in project adempiere by adempiere.
the class Ini method loadWebStartProperties.
// loadProperties
private static boolean loadWebStartProperties() {
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;
log.log(Level.SEVERE, e.toString());
return false;
}
FileContents fc = null;
try {
fc = ps.get(getCodeBase());
} catch (MalformedURLException e) {
log.log(Level.SEVERE, e.toString());
return false;
} catch (FileNotFoundException e) {
try {
ps.create(getCodeBase(), 16 * 1024);
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();
s_prop.load(is);
is.close();
} catch (Throwable t) {
log.log(Level.SEVERE, t.toString());
loadOK = false;
}
if (!loadOK || s_prop.getProperty(P_TODAY, "").equals("")) {
firstTime = true;
if (isShowLicenseDialog())
if (!IniDialog.accept())
System.exit(-1);
checkProperties();
}
// Save if not exist or could not be read
if (!loadOK || firstTime)
saveWebStartProperties();
s_loaded = true;
s_propertyFileName = getCodeBase().toString();
return firstTime;
}
use of javax.jnlp.UnavailableServiceException in project adempiere by adempiere.
the class Ini method getCodeBase.
/**
* Get JNLP CodeBase
* @return code base or null
*/
public static URL getCodeBase() {
try {
BasicService bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
URL url = bs.getCodeBase();
return url;
} catch (UnavailableServiceException ue) {
return null;
}
}
Aggregations