IDEMPIERE-4202 Remove java web start code and libraries

This commit is contained in:
hengsin 2020-03-10 18:20:04 +08:00
parent 1ec0689c78
commit d79c6de5e5
10 changed files with 23 additions and 235 deletions

View File

@ -10,7 +10,6 @@
<classpathentry exported="true" kind="lib" path="lib/bsh.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-validator.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cron4j.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jnlp.jar"/>
<classpathentry exported="true" kind="lib" path="lib/avalon-framework-api.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -7,7 +7,6 @@ Bundle-ClassPath: .,
lib/bsh.jar,
lib/commons-validator.jar,
lib/cron4j.jar,
lib/jnlp.jar,
lib/avalon-framework-api.jar
Export-Package: bsh,
bsh.classpath,
@ -20,7 +19,6 @@ Export-Package: bsh,
bsh.util,
com.akunagroup.uk.postcode,
it.sauronsoftware.cron4j,
javax.jnlp,
org.adempiere.apps.graph,
org.adempiere.base,
org.adempiere.base.equinox,

View File

@ -23,8 +23,7 @@ bin.includes = plugin.xml,\
lib/avalon-framework-api.jar,\
lib/bsh.jar,\
lib/commons-validator.jar,\
lib/cron4j.jar,\
lib/jnlp.jar
lib/cron4j.jar
src.includes = schema/
source.. = src/
output.. = target/classes/

View File

@ -38,11 +38,6 @@
<artifactId>commons-validator</artifactId>
<version>1.6</version>
</artifactItem>
<artifactItem>
<groupId>javax.jnlp</groupId>
<artifactId>jnlp</artifactId>
<version>1.5.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-api</artifactId>

View File

@ -22,12 +22,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.sql.Timestamp;
import java.util.Collection;
@ -35,12 +30,6 @@ import java.util.Enumeration;
import java.util.Properties;
import java.util.logging.Level;
import javax.jnlp.BasicService;
import javax.jnlp.FileContents;
import javax.jnlp.PersistenceService;
import javax.jnlp.ServiceManager;
import javax.jnlp.UnavailableServiceException;
import org.compiere.model.ModelValidationEngine;
/**
@ -238,35 +227,28 @@ public final class Ini implements Serializable
ModelValidationEngine.get().beforeSaveProperties();
}
if (isWebStartClient())
String fileName = getFileName (tryUserHome);
FileOutputStream fos = null;
try
{
saveWebStartProperties();
File f = new File(fileName);
f.getAbsoluteFile().getParentFile().mkdirs(); // Create all dirs if not exist - teo_sarca FR [ 2406123 ]
fos = new FileOutputStream(f);
s_prop.store(fos, "Adempiere");
fos.flush();
fos.close();
}
else
catch (Exception e)
{
String fileName = getFileName (tryUserHome);
FileOutputStream fos = null;
try
{
File f = new File(fileName);
f.getAbsoluteFile().getParentFile().mkdirs(); // Create all dirs if not exist - teo_sarca FR [ 2406123 ]
fos = new FileOutputStream(f);
s_prop.store(fos, "Adempiere");
fos.flush();
fos.close();
}
catch (Exception e)
{
log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + e.toString());
return;
}
catch (Throwable t)
{
log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + t.toString());
return;
}
if (log.isLoggable(Level.FINER)) log.finer(fileName);
log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + e.toString());
return;
}
catch (Throwable t)
{
log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + t.toString());
return;
}
if (log.isLoggable(Level.FINER)) log.finer(fileName);
} // save
/**
@ -277,133 +259,10 @@ public final class Ini implements Serializable
{
if (reload || s_prop.size() == 0)
{
if (isWebStartClient())
{
loadWebStartProperties();
}
else
{
loadProperties(getFileName(s_client));
}
loadProperties(getFileName(s_client));
}
} // 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
{
if (fc != null) {
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;
}
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;
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;
}
}
/**
* 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;
}
} // getCodeBase
/**
* @return True if client is started using web start
*/
public static boolean isWebStartClient()
{
return getCodeBase() != null;
}
/**
* Load INI parameters from filename.
* Logger is on default level (INFO)

View File

@ -10,7 +10,5 @@
<classpathentry kind="src" path="src/main/server/"/>
<classpathentry kind="src" path="src/main/servlet/"/>
<classpathentry kind="src" path="src/main/home/"/>
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/jnlp-jardiff.jar"/>
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/jnlp-servlet.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -9,9 +9,7 @@ Require-Bundle: org.adempiere.base;bundle-version="0.0.0",
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=11))"
Web-ContextPath: /
Bundle-ClassPath: .,
WEB-INF/lib/jnlp-jardiff.jar,
WEB-INF/lib/jnlp-servlet.jar
Bundle-ClassPath: .
Import-Package: javax.jms;version="1.1.0",
javax.mail;version="1.5",
javax.servlet;version="3.0.0",

View File

@ -22,16 +22,6 @@
<filter-name>idempiereMonitorFilter</filter-name>
<url-pattern>/idempiereMonitor/*</url-pattern>
</filter-mapping>
<servlet>
<display-name>JNLP Download Servlet</display-name>
<servlet-name>JnlpDownloadServlet</servlet-name>
<servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>INFORMATIONAL</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- <servlet>
<description>iDempiere Server Status Info</description>
<display-name>Server Status</display-name>
@ -53,10 +43,6 @@
<param-value>false</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>JnlpDownloadServlet</servlet-name>
<url-pattern>*.jnlp</url-pattern>
</servlet-mapping>
<!-- <servlet-mapping>
<servlet-name>StatusInfo</servlet-name>
<url-pattern>/statusInfo</url-pattern>
@ -72,18 +58,6 @@
<session-config>
<session-timeout>15</session-timeout>
</session-config>
<mime-mapping>
<extension>jar</extension>
<mime-type>application/x-java-archive</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jardiff</extension>
<mime-type>application/x-java-archive-diff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>jnlp</extension>
<mime-type>application/x-java-jnlp-file</mime-type>
</mime-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>admin</web-resource-name>

View File

@ -25,9 +25,7 @@ bin.includes = META-INF/,\
OSGI-INF/workflowprocessorfactory.xml,\
OSGI-INF/,\
resources/,\
idempiere.jsp,\
WEB-INF/lib/jnlp-jardiff.jar,\
WEB-INF/lib/jnlp-servlet.jar
idempiere.jsp
output.. = target/classes/
source.. = src/main/server/,\
src/main/servlet/,\

View File

@ -46,37 +46,7 @@
<arg>java.naming/com.sun.jndi.ldap=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>javax.samples.jnlp</groupId>
<artifactId>jnlp-jardiff</artifactId>
<version>1.6.0</version>
</artifactItem>
<artifactItem>
<groupId>javax.samples.jnlp</groupId>
<artifactId>jnlp-servlet</artifactId>
<version>1.6.0</version>
</artifactItem>
</artifactItems>
<outputDirectory>WEB-INF/lib</outputDirectory>
<stripVersion>true</stripVersion>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugin>
</plugins>
</build>
</project>