IDEMPIERE-4158 Move Swing Client out of core. Drop restlet dependency, drop webstart and applet stuffs and some minor dependency adjustments.

This commit is contained in:
hengsin 2020-01-29 08:00:36 +08:00
parent 55dc83de87
commit 3cc17d25fd
59 changed files with 546 additions and 2469 deletions

View File

@ -84,13 +84,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.restlet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.apache.ant"
download-size="0"
@ -445,14 +438,6 @@
fragment="true"
unpack="false"/>
<plugin
id="groovy-swing"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>
<plugin
id="groovy-xml"
download-size="0"
@ -524,4 +509,12 @@
version="0.0.0"
unpack="false"/>
<plugin
id="groovy-sql"
download-size="0"
install-size="0"
version="0.0.0"
fragment="true"
unpack="false"/>
</feature>

View File

@ -69,7 +69,6 @@
<setEntry value="groovy-json@default:false"/>
<setEntry value="groovy-jsr223@default:false"/>
<setEntry value="groovy-nio@default:false"/>
<setEntry value="groovy-swing@default:false"/>
<setEntry value="groovy-xml@default:false"/>
<setEntry value="groovy@default:default"/>
<setEntry value="jakarta.jws-api@default:default"/>
@ -350,10 +349,6 @@
<setEntry value="org.objectweb.asm.tree*7.0.0.v20181030-2244@default:default"/>
<setEntry value="org.objectweb.asm.tree*7.0.0@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.0.5.v201605172130@default:true"/>
<setEntry value="org.restlet*2.4.1@default:true"/>
<setEntry value="org.restlet.ext.servlet*2.0.5.v201605172130@default:default"/>
<setEntry value="org.restlet.ext.servlet*2.4.1@default:default"/>
<setEntry value="org.sat4j.core@default:default"/>
<setEntry value="org.sat4j.pb@default:default"/>
<setEntry value="org.springframework.spring-jcl@default:default"/>

View File

@ -69,7 +69,6 @@
<setEntry value="groovy-json@default:false"/>
<setEntry value="groovy-jsr223@default:false"/>
<setEntry value="groovy-nio@default:false"/>
<setEntry value="groovy-swing@default:false"/>
<setEntry value="groovy-xml@default:false"/>
<setEntry value="groovy@default:default"/>
<setEntry value="jakarta.jws-api@default:default"/>
@ -350,10 +349,6 @@
<setEntry value="org.objectweb.asm.tree*7.0.0.v20181030-2244@default:default"/>
<setEntry value="org.objectweb.asm.tree*7.0.0@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.0.5.v201605172130@default:true"/>
<setEntry value="org.restlet*2.4.1@default:true"/>
<setEntry value="org.restlet.ext.servlet*2.0.5.v201605172130@default:default"/>
<setEntry value="org.restlet.ext.servlet*2.4.1@default:default"/>
<setEntry value="org.sat4j.core@default:default"/>
<setEntry value="org.sat4j.pb@default:default"/>
<setEntry value="org.springframework.spring-jcl@default:default"/>

View File

@ -69,7 +69,6 @@
<setEntry value="groovy-json@default:false"/>
<setEntry value="groovy-jsr223@default:false"/>
<setEntry value="groovy-nio@default:false"/>
<setEntry value="groovy-swing@default:false"/>
<setEntry value="groovy-xml@default:false"/>
<setEntry value="groovy@default:default"/>
<setEntry value="jakarta.jws-api@default:default"/>
@ -350,10 +349,6 @@
<setEntry value="org.objectweb.asm.tree*7.0.0.v20181030-2244@default:default"/>
<setEntry value="org.objectweb.asm.tree*7.0.0@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.0.5.v201605172130@default:true"/>
<setEntry value="org.restlet*2.4.1@default:true"/>
<setEntry value="org.restlet.ext.servlet*2.0.5.v201605172130@default:default"/>
<setEntry value="org.restlet.ext.servlet*2.4.1@default:default"/>
<setEntry value="org.sat4j.core@default:default"/>
<setEntry value="org.sat4j.pb@default:default"/>
<setEntry value="org.springframework.spring-jcl@default:default"/>

View File

@ -69,7 +69,6 @@
<setEntry value="groovy-json@default:false"/>
<setEntry value="groovy-jsr223@default:false"/>
<setEntry value="groovy-nio@default:false"/>
<setEntry value="groovy-swing@default:false"/>
<setEntry value="groovy-xml@default:false"/>
<setEntry value="groovy@default:default"/>
<setEntry value="jakarta.jws-api@default:default"/>
@ -350,10 +349,6 @@
<setEntry value="org.objectweb.asm.tree*7.0.0.v20181030-2244@default:default"/>
<setEntry value="org.objectweb.asm.tree*7.0.0@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.0.5.v201605172130@default:true"/>
<setEntry value="org.restlet*2.4.1@default:true"/>
<setEntry value="org.restlet.ext.servlet*2.0.5.v201605172130@default:default"/>
<setEntry value="org.restlet.ext.servlet*2.4.1@default:default"/>
<setEntry value="org.sat4j.core@default:default"/>
<setEntry value="org.sat4j.pb@default:default"/>
<setEntry value="org.springframework.spring-jcl@default:default"/>

View File

@ -69,7 +69,6 @@
<setEntry value="groovy-json@default:false"/>
<setEntry value="groovy-jsr223@default:false"/>
<setEntry value="groovy-nio@default:false"/>
<setEntry value="groovy-swing@default:false"/>
<setEntry value="groovy-xml@default:false"/>
<setEntry value="groovy@default:default"/>
<setEntry value="jakarta.jws-api@default:default"/>
@ -350,10 +349,6 @@
<setEntry value="org.objectweb.asm.tree*7.0.0.v20181030-2244@default:default"/>
<setEntry value="org.objectweb.asm.tree*7.0.0@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.0.5.v201605172130@default:true"/>
<setEntry value="org.restlet*2.4.1@default:true"/>
<setEntry value="org.restlet.ext.servlet*2.0.5.v201605172130@default:default"/>
<setEntry value="org.restlet.ext.servlet*2.4.1@default:default"/>
<setEntry value="org.sat4j.core@default:default"/>
<setEntry value="org.sat4j.pb@default:default"/>
<setEntry value="org.springframework.spring-jcl@default:default"/>

View File

@ -98,11 +98,7 @@ Import-Package: com.google.zxing,
org.osgi.service.component.runtime.dto;version="1.3.0",
org.osgi.service.event;version="1.2.0",
org.osgi.util.promise;version="1.0.0",
org.osgi.util.tracker;version="1.5.0",
org.restlet,
org.restlet.data,
org.restlet.representation,
org.restlet.util
org.osgi.util.tracker;version="1.5.0"
Eclipse-BuddyPolicy: registered
Eclipse-ExtensibleAPI: true
Bundle-Activator: org.adempiere.base.BaseActivator

View File

@ -1,68 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.util;
import java.io.ObjectInputStream;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.restlet.representation.InputRepresentation;
import org.restlet.representation.ObjectRepresentation;
import org.restlet.representation.Representation;
import org.restlet.util.WrapperRepresentation;
/**
* Utility method for restlet support.
* @author hengsin
*
*/
public class RestletUtil {
public final static CLogger log = CLogger.getCLogger(RestletUtil.class);
/**
* Convert response or request representation to java object.
* @param entity
* @return T
*/
@SuppressWarnings("unchecked")
public static <T> T toObject(Representation entity) {
ObjectInputStream ois = null;
try {
if (entity instanceof WrapperRepresentation) {
entity = ((WrapperRepresentation)entity).getWrappedRepresentation();
}
if (entity instanceof ObjectRepresentation<?>) {
ObjectRepresentation<?> or = (ObjectRepresentation<?>) entity;
return (T) or.getObject();
} else if (entity instanceof InputRepresentation) {
InputRepresentation ir = (InputRepresentation) entity;
ois = new ObjectInputStream(ir.getStream());
return (T) ois.readObject();
} else {
return null;
}
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
return null;
}
finally{
if (ois != null) {
try {
ois.close();
} catch (Exception e2) {}
ois = null;
}
}
}
}

View File

@ -26,9 +26,6 @@ import java.util.Properties;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.logging.Level;
import javax.jnlp.BasicService;
import javax.jnlp.ServiceManager;
import javax.jnlp.UnavailableServiceException;
import javax.swing.ImageIcon;
import javax.swing.event.EventListenerList;
@ -476,44 +473,6 @@ public final class Adempiere
s_supportEmail = email;
} // 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;
}
} // getCodeBase
/**
* @return True if client is started using web start
*/
public static boolean isWebStartClient()
{
return getCodeBase() != null;
}
/**
* Get JNLP CodeBase Host
* @return code base or null
*/
public static String getCodeBaseHost()
{
URL url = getCodeBase();
if (url == null)
return null;
return url.getHost();
} // getCodeBase
public static synchronized boolean isStarted()
{
return (log != null);
@ -585,7 +544,7 @@ public final class Adempiere
}
// Set Default Database Connection from Ini
DB.setDBTarget(CConnection.get(getCodeBaseHost()));
DB.setDBTarget(CConnection.get());
createThreadPool();

View File

@ -27,9 +27,7 @@ import javax.sql.DataSource;
import javax.swing.JOptionPane;
import org.adempiere.base.Service;
import org.compiere.Adempiere;
import org.compiere.interfaces.Server;
import org.compiere.interfaces.Status;
import org.compiere.util.CLogger;
import org.compiere.util.Ini;
@ -56,52 +54,28 @@ public class CConnection implements Serializable, Cloneable
* Get/Set default client/server Connection
* @return Connection Descriptor
*/
public static CConnection get ()
public synchronized static CConnection get ()
{
return get(null);
if (s_cc == null)
{
String attributes = Ini.getProperty (Ini.P_CONNECTION);
s_cc = new CConnection (null);
s_cc.setAttributes (attributes);
if (log.isLoggable(Level.FINE)) log.fine(s_cc.toString());
}
return s_cc;
} // get
/**
* Get/Set default client/server Connection
* @param apps_host optional apps host for new connections
* @return Connection Descriptor
* @deprecated
*/
public synchronized static CConnection get (String apps_host)
{
if (s_cc == null)
{
String attributes = Ini.getProperty (Ini.P_CONNECTION);
if (attributes == null || attributes.length () == 0)
{
//hengsin, zero setup for webstart client
CConnection cc = null;
if (apps_host != null && Adempiere.isWebStartClient())
{
cc = new CConnection(apps_host);
if (cc.testAppsServer() == null)
{
s_cc = cc;
Ini.setProperty(Ini.P_CONNECTION, cc.toStringLong());
Ini.saveProperties(Ini.isClient());
}
}
if (s_cc == null)
{
if (cc == null) cc = new CConnection(apps_host);
s_cc = cc;
Ini.setProperty(Ini.P_CONNECTION, cc.toStringLong());
Ini.saveProperties(Ini.isClient());
}
}
else
{
s_cc = new CConnection (null);
s_cc.setAttributes (attributes);
}
if (log.isLoggable(Level.FINE)) log.fine(s_cc.toString());
}
return s_cc;
return get();
} // get
@ -195,12 +169,9 @@ public class CConnection implements Serializable, Cloneable
private AdempiereDatabase m_db = null;
/** ConnectionException */
private Exception m_dbException = null;
private Exception m_appsException = null;
/** Database Connection */
private boolean m_okDB = false;
/** Apps Server Connection */
private boolean m_okApps = false;
/** Info */
private String[] m_info = new String[2];
@ -210,14 +181,10 @@ public class CConnection implements Serializable, Cloneable
/** DataSource */
private DataSource m_ds = null;
/** Server Session */
private Server m_server = null;
/** DB Info */
private String m_dbInfo = null;
private int m_webPort;
private int m_sslPort;
private boolean m_queryAppsServer;
private SecurityPrincipal securityPrincipal;
/*************************************************************************
* Get Name
@ -263,7 +230,6 @@ public class CConnection implements Serializable, Cloneable
{
m_apps_host = apps_host;
m_name = toString ();
m_okApps = false;
}
/**
@ -338,58 +304,13 @@ public class CConnection implements Serializable, Cloneable
}
}
/**
* Is Application Server OK
* @param tryContactAgain try to contact again
* @return true if Apps Server exists
*/
public boolean isAppsServerOK (boolean tryContactAgain)
{
if (!tryContactAgain && m_queryAppsServer)
return m_okApps;
if (getAppServerCredential() == null)
{
m_okApps = false;
return m_okApps;
}
m_queryAppsServer = true;
try
{
Status status = Service.locator().locate(Status.class).getService();
m_version = status.getDateVersion();
}
catch (Throwable t)
{
m_okApps = false;
}
return m_okApps;
} // isAppsOK
/**
* Test ApplicationServer
* @return Exception or null
*/
public synchronized Exception testAppsServer ()
{
m_appsException = null;
queryAppsServerInfo();
return getAppsServerException ();
} // testAppsServer
/**
* Get Server
* @return Server
*/
public Server getServer()
{
if (m_server == null)
{
m_server = Service.locator().locate(Server.class).getService();
}
return m_server;
return Service.locator().locate(Server.class).getService();
} // getServer
@ -1110,15 +1031,8 @@ public class CConnection implements Serializable, Cloneable
sb.append (" - ").append (m_info[1] != null ? m_info[1] : "")
.append ("\n").append (getDatabase ().toString ());
if (Ini.isClient())
{
sb.append ("\nAppsServerOK=").append (isAppsServerOK (false))
.append (", DatabaseOK=").append (isDatabaseOK ());
}
else
{
sb.append ("\nDatabaseOK=").append (isDatabaseOK ());
}
sb.append ("\nDatabaseOK=").append (isDatabaseOK ());
return sb.toString ();
} // getInfo
@ -1304,67 +1218,6 @@ public class CConnection implements Serializable, Cloneable
return null;
} // getInitialContext
/**
* Query Application Server Status.
* update okApps
* @return true ik OK
*/
private boolean queryAppsServerInfo ()
{
m_okApps = false;
m_queryAppsServer = true;
if (getAppsHost().equalsIgnoreCase("MyAppsServer")) {
log.warning (getAppsHost() + " ignored");
return m_okApps; // false
}
Status status = Service.locator().locate(Status.class).getService();
try {
updateInfoFromServer(status);
m_okApps = true;
} catch (Exception e) {
m_appsException = e;
}
return m_okApps;
} // setAppsServerInfo
/**
* Get Last Exception of Apps Server Connection attempt
* @return Exception or null
*/
public synchronized Exception getAppsServerException ()
{
return m_appsException;
} // getAppsServerException
/**
* Update Connection Info from Apps Server
* @param svr Apps Server Status
* @throws Exception
*/
private void updateInfoFromServer (Status svr) throws Exception
{
if (svr == null)
throw new IllegalArgumentException ("AppsServer was NULL");
setType (svr.getDbType());
setDbHost (svr.getDbHost());
setDbPort (svr.getDbPort ());
setDbName (svr.getDbName ());
setDbUid (svr.getDbUid ());
setDbPwd (svr.getDbPwd ());
setBequeath (false);
//
setFwHost (svr.getFwHost ());
setFwPort (svr.getFwPort ());
if (getFwHost() == null || getFwHost().length () == 0)
setViaFirewall (false);
m_version = svr.getDateVersion ();
if (log.isLoggable(Level.CONFIG)) log.config("Server=" + getDbHost() + ", DB=" + getDbName());
} // update Info
/**
* Convert Statement
* @param origStatement original statement (Oracle notation)
@ -1419,19 +1272,6 @@ public class CConnection implements Serializable, Cloneable
return "<?" + transactionIsolation + "?>";
} // getTransactionIsolationInfo
public void setAppServerCredential(String identity, char[] secret)
{
securityPrincipal = new SecurityPrincipal();
securityPrincipal.identity = identity;
securityPrincipal.secret= secret;
m_server = null;
}
public SecurityPrincipal getAppServerCredential()
{
return securityPrincipal;
}
@Override
public Object clone() throws CloneNotSupportedException {
CConnection c = (CConnection)super.clone();

View File

@ -669,18 +669,6 @@ public class CLogMgt
// Host
sb.append(cc.getAppsHost());
if (Ini.isClient())
{
sb.append(" (");
// Server
if (!cc.getAppsHost().equalsIgnoreCase("MyAppsServer") && cc.isAppsServerOK(false))
sb.append(CConnection.get().getServerVersion());
else
sb.append(getMsg("NotActive"));
//
sb.append(")\n ");
}
//
return sb.toString();
} // getServerInfo

View File

@ -164,8 +164,6 @@ public final class Env
//
reset(true); // final cache reset
//
CConnection.get().setAppServerCredential(null, null);
}
/**

View File

@ -73,20 +73,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.restlet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.restlet.ext.servlet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.apache.poi.poi"
download-size="0"

View File

@ -12,6 +12,7 @@
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="false"/>
<setAttribute key="deselected_workspace_bundles"/>
<booleanAttribute key="includeOptional" value="false"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
@ -33,8 +34,104 @@
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
<stringAttribute key="selected_target_plugins" value="bcprov@default:default,com.diffplug.osgi.extension.sun.misc@default:false,com.google.zxing.core@default:default,com.ibm.icu@default:default,com.itextpdf@default:default,com.jaspersoft.studio.bundles.barbecue@default:default,com.sun.activation.jakarta.activation@default:default,com.sun.mail.smtp@default:default,groovy-console@default:false,groovy-datetime@default:false,groovy-json@default:false,groovy-jsr223@default:false,groovy-nio@default:false,groovy-swing@default:false,groovy-xml@default:false,groovy@default:default,jakarta.mail.api@default:default,jakarta.xml.bind-api@default:default,javax.annotation-api@default:default,javax.inject@default:default,javax.jms@default:default,javax.transaction@default:false,net.sf.supercsv.super-csv@default:default,org.apache.activemq.activemq-core@default:default,org.apache.activemq.kahadb@default:default,org.apache.ant@default:default,org.apache.batik.constants@default:default,org.apache.batik.css@default:default,org.apache.batik.i18n@default:default,org.apache.batik.util@default:default,org.apache.commons.collections@default:default,org.apache.commons.io@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.felix.scr@1:true,org.apache.geronimo.specs.geronimo-j2ee-management_1.1_spec@default:default,org.apache.poi.poi-ooxml@default:default,org.apache.poi.poi@default:default,org.apache.servicemix.bundles.cglib@default:default,org.apache.xmlgraphics@default:default,org.cryptacular@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.jetty.osgi-servlet-api@default:default,org.eclipse.jetty.osgi.alpn.fragment@default:false,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.jfree.chart@default:default,org.jfree.jcommon@default:default,org.junit@default:default,org.krysalis.barcode4j@default:default,org.passay@default:default,org.restlet@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default,slf4j.api@default:default,slf4j.jcl@default:false"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.apache.ecs@default:default,org.compiere.db.postgresql.provider@default:default,org.idempiere.hazelcast.service.config@default:false,org.idempiere.hazelcast.service@default:default"/>
<setAttribute key="selected_target_bundles">
<setEntry value="bcprov@default:default"/>
<setEntry value="com.diffplug.osgi.extension.sun.misc@default:false"/>
<setEntry value="com.google.zxing.core@default:default"/>
<setEntry value="com.ibm.icu*58.2.0.v20181010-1334@default:default"/>
<setEntry value="com.ibm.icu*62.1.0.v20180727-1652@default:default"/>
<setEntry value="com.ibm.icu*63.1.0.v20181030-1705@default:default"/>
<setEntry value="com.ibm.icu*63.1.0@default:default"/>
<setEntry value="com.itextpdf@default:default"/>
<setEntry value="com.jaspersoft.studio.bundles.barbecue@default:default"/>
<setEntry value="com.sun.activation.jakarta.activation@default:default"/>
<setEntry value="com.sun.mail.smtp@default:default"/>
<setEntry value="groovy-console@default:false"/>
<setEntry value="groovy-datetime@default:false"/>
<setEntry value="groovy-json@default:false"/>
<setEntry value="groovy-jsr223@default:false"/>
<setEntry value="groovy-nio@default:false"/>
<setEntry value="groovy-swing@default:false"/>
<setEntry value="groovy-xml@default:false"/>
<setEntry value="groovy@default:default"/>
<setEntry value="jakarta.mail.api@default:default"/>
<setEntry value="jakarta.xml.bind-api@default:default"/>
<setEntry value="javax.annotation-api@default:default"/>
<setEntry value="javax.inject@default:default"/>
<setEntry value="javax.jms@default:default"/>
<setEntry value="javax.transaction@default:false"/>
<setEntry value="net.sf.supercsv.super-csv@default:default"/>
<setEntry value="org.apache.activemq.activemq-core@default:default"/>
<setEntry value="org.apache.activemq.kahadb@default:default"/>
<setEntry value="org.apache.ant*1.10.5.v20180808-0324@default:default"/>
<setEntry value="org.apache.ant*1.9.6.v201510161327@default:default"/>
<setEntry value="org.apache.batik.constants*1.10.0.v20180703-1553@default:default"/>
<setEntry value="org.apache.batik.constants*1.9.1.v20180227-1645@default:default"/>
<setEntry value="org.apache.batik.css*1.10.0.v20180703-1553@default:default"/>
<setEntry value="org.apache.batik.css*1.9.1.v20180313-1559@default:default"/>
<setEntry value="org.apache.batik.css*1.9.1.v20181015-1528@default:default"/>
<setEntry value="org.apache.batik.i18n*1.10.0.v20180703-1553@default:default"/>
<setEntry value="org.apache.batik.i18n*1.9.1.v20180227-1645@default:default"/>
<setEntry value="org.apache.batik.util*1.10.0.v20180703-1553@default:default"/>
<setEntry value="org.apache.batik.util*1.9.1.v20180227-1645@default:default"/>
<setEntry value="org.apache.batik.util*1.9.1.v20180703-1553@default:default"/>
<setEntry value="org.apache.commons.collections@default:default"/>
<setEntry value="org.apache.commons.io*2.2.0.v201405211200@default:default"/>
<setEntry value="org.apache.commons.io*2.6.0@default:default"/>
<setEntry value="org.apache.commons.logging*1.1.1.v201101211721@default:default"/>
<setEntry value="org.apache.commons.logging*1.2.0.v20180409-1502@default:default"/>
<setEntry value="org.apache.commons.net@default:default"/>
<setEntry value="org.apache.felix.scr@1:true"/>
<setEntry value="org.apache.geronimo.specs.geronimo-j2ee-management_1.1_spec@default:default"/>
<setEntry value="org.apache.poi.poi-ooxml@default:default"/>
<setEntry value="org.apache.poi.poi@default:default"/>
<setEntry value="org.apache.servicemix.bundles.cglib@default:default"/>
<setEntry value="org.apache.xmlgraphics*1.4.0.v201301251218@default:default"/>
<setEntry value="org.apache.xmlgraphics*2.2.0.v20180410-1551@default:default"/>
<setEntry value="org.apache.xmlgraphics*2.2.0.v20180809-1640@default:default"/>
<setEntry value="org.cryptacular@default:default"/>
<setEntry value="org.eclipse.ant.core@default:default"/>
<setEntry value="org.eclipse.core.commands@default:default"/>
<setEntry value="org.eclipse.core.contenttype@default:default"/>
<setEntry value="org.eclipse.core.expressions@default:default"/>
<setEntry value="org.eclipse.core.jobs@default:default"/>
<setEntry value="org.eclipse.core.runtime@default:true"/>
<setEntry value="org.eclipse.core.variables@default:default"/>
<setEntry value="org.eclipse.equinox.app@default:default"/>
<setEntry value="org.eclipse.equinox.common@2:true"/>
<setEntry value="org.eclipse.equinox.ds@1:true"/>
<setEntry value="org.eclipse.equinox.event@default:default"/>
<setEntry value="org.eclipse.equinox.preferences@default:default"/>
<setEntry value="org.eclipse.equinox.registry@default:default"/>
<setEntry value="org.eclipse.jetty.osgi-servlet-api@default:default"/>
<setEntry value="org.eclipse.jetty.osgi.alpn.fragment@default:false"/>
<setEntry value="org.eclipse.osgi*3.13.200.v20181116-1621@-1:true"/>
<setEntry value="org.eclipse.osgi*3.13.200.v20181130-2106@-1:true"/>
<setEntry value="org.eclipse.osgi.compatibility.state@default:false"/>
<setEntry value="org.eclipse.osgi.services@default:default"/>
<setEntry value="org.eclipse.osgi.util@default:default"/>
<setEntry value="org.hamcrest.core@default:default"/>
<setEntry value="org.jfree.chart@default:default"/>
<setEntry value="org.jfree.jcommon@default:default"/>
<setEntry value="org.junit@default:default"/>
<setEntry value="org.krysalis.barcode4j@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.w3c.css.sac@default:default"/>
<setEntry value="org.w3c.dom.events@default:default"/>
<setEntry value="org.w3c.dom.smil@default:default"/>
<setEntry value="org.w3c.dom.svg@default:default"/>
<setEntry value="slf4j.api@default:default"/>
<setEntry value="slf4j.jcl@default:false"/>
</setAttribute>
<setAttribute key="selected_workspace_bundles">
<setEntry value="org.adempiere.base@default:default"/>
<setEntry value="org.adempiere.extend@default:false"/>
<setEntry value="org.adempiere.install@default:default"/>
<setEntry value="org.apache.ecs@default:default"/>
<setEntry value="org.compiere.db.postgresql.provider@default:default"/>
<setEntry value="org.idempiere.hazelcast.service.config@default:false"/>
<setEntry value="org.idempiere.hazelcast.service@default:default"/>
</setAttribute>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>

View File

@ -83,7 +83,6 @@
<setEntry value="org.junit@default:default"/>
<setEntry value="org.krysalis.barcode4j@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.4.1@default:default"/>
<setEntry value="slf4j.api@default:default"/>
<setEntry value="slf4j.jcl@default:false"/>
</setAttribute>

View File

@ -83,7 +83,6 @@
<setEntry value="org.junit@default:default"/>
<setEntry value="org.krysalis.barcode4j@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.4.1@default:default"/>
<setEntry value="slf4j.api@default:default"/>
<setEntry value="slf4j.jcl@default:false"/>
</setAttribute>

View File

@ -97,13 +97,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="org.restlet.ext.servlet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="javax.persistence"
download-size="0"

View File

@ -66,7 +66,6 @@
<plugin id="org.idempiere.felix.webconsole" autoStart="true" startLevel="0" />
<plugin id="org.mortbay.jasper.apache-el" autoStart="true" startLevel="0" />
<plugin id="org.mortbay.jasper.apache-jsp" autoStart="true" startLevel="0" />
<plugin id="org.restlet" autoStart="true" startLevel="0" />
<property name="org.eclipse.update.reconcile" value="false" />
<property name="osgi.instance.area.default" value="@config.dir/../workspace" />
<property name="osgi.compatibility.bootdelegation" value="true" />

File diff suppressed because one or more lines are too long

View File

@ -83,7 +83,6 @@
<setEntry value="groovy-json@default:false"/>
<setEntry value="groovy-jsr223@default:false"/>
<setEntry value="groovy-nio@default:false"/>
<setEntry value="groovy-swing@default:false"/>
<setEntry value="groovy-xml@default:false"/>
<setEntry value="groovy@default:default"/>
<setEntry value="jakarta.jws-api@default:default"/>
@ -377,10 +376,6 @@
<setEntry value="org.objectweb.asm.tree*7.0.0.v20181030-2244@default:default"/>
<setEntry value="org.objectweb.asm.tree*7.0.0@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.0.5.v201605172130@default:true"/>
<setEntry value="org.restlet*2.4.1@default:true"/>
<setEntry value="org.restlet.ext.servlet*2.0.5.v201605172130@default:default"/>
<setEntry value="org.restlet.ext.servlet*2.4.1@default:default"/>
<setEntry value="org.sat4j.core@default:default"/>
<setEntry value="org.sat4j.pb@default:default"/>
<setEntry value="org.springframework.spring-jcl@default:default"/>

View File

@ -11,7 +11,6 @@ osgi.bundles=org.eclipse.equinox.ds@1:start,\
org.hamcrest.core,\
org.junit,\
org.adempiere.install,\
org.restlet,\
org.apache.servicemix.bundles.cglib,\
com.sun.mail.gimap,\
com.sun.mail.imap,\

View File

@ -26,16 +26,6 @@ Import-Package: javax.jms;version="1.1.0",
org.osgi.service.component.annotations;version="1.3.0",
org.osgi.service.event;version="1.4.0",
org.osgi.util.tracker;version="1.5.0",
org.restlet,
org.restlet.data,
org.restlet.ext.servlet,
org.restlet.ext.servlet.internal,
org.restlet.representation,
org.restlet.resource,
org.restlet.routing,
org.restlet.security,
org.restlet.service,
org.restlet.util,
org.w3c.dom
Export-Package: org.adempiere.server,
org.compiere.ldap,

View File

@ -45,15 +45,6 @@
<servlet-class>org.compiere.web.AdempiereMonitor</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Restlet adapter -->
<!-- <servlet>
<servlet-name>RestletServlet</servlet-name>
<servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
<init-param>
<param-name>org.restlet.application</param-name>
<param-value>org.adempiere.web.server.ServerApplication</param-value>
</init-param>
</servlet> -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>

View File

@ -1,31 +0,0 @@
<?xml version = "1.0" encoding = "UTF-8"?>
<jnlp spec = "1.6+" version = "3.6.0LTS"
codebase = "$$context/adempiereHome"
href = "$$context/adempiere.jnlp">
<information>
<title>Adempiere Client 3.6.0LTS $$context</title>
<vendor>ADempiere, Inc.</vendor>
<homepage href = "http://www.adempiere.org"/>
<offline-allowed/>
<description>Adempiere ERP+CRM ($$context) - Smart Business Solution for Distribution and Service - globally</description>
<description kind = "short">Adempiere ERP+CRM ($$context)</description>
<description kind = "one-line">Adempiere ERP+CRM</description>
<description kind = "tooltip">Adempiere ERP+CRM ($$context)</description>
<icon href = "$$context/iD32.gif"/>
<shortcut online="true">
<desktop/>
<menu submenu="Adempiere 3.6.0LTS $$context"/>
</shortcut>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version = "1.6+" href = "http://java.sun.com/products/autodl/j2se" initial-heap-size = "32m" max-heap-size = "512m"/>
<jar href = "Adempiere.jar" main = "true" download = "eager"/>
<jar href = "AdempiereCLib.jar" main = "false" download = "eager"/>
<jar href = "CompiereJasperReqs.jar" main = "false" download = "eager"/>
<property name="adempiereJNLP" value="$$context"/>
</resources>
<application-desc main-class = "org.compiere.Adempiere"/>
</jnlp>

View File

@ -1,81 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ADempiere Client Applet Start</title>
<link href="standard.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.warning {
color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<h1>ADempiere Client Applet Start</h1>
<p> Due to Browser incompatibilities, here is a list of different ways to start the Adempiere Java Client from a Browser.
This requires that your browser supports Java. <br/>
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/using_tags.html" target="_blank">Applet Start Details</a>
</p>
<p class="warning">After the ADempiere Client started DO NOT close/use this window as that will crash the application!</p>
<table width="*" border="1" cellspacing="5" cellpadding="5">
<tr>
<td> Microsoft IE <br />
<object classid="clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA"
width="200" height="100"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0">
<param name="code" value="org/adempiere/apps/AApplet.class" />
<param name="codebase" value="/admin/adempiereHome/" />
<param name="archive" value="Adempiere.jar,AdempiereCLib.jar"/>
<param name="type" value="application/x-java-applet;jpi-version=1.5.0" />
Internet Explorer: No Java 2 SDK, Standard Edition v 1.5.0 support for APPLET
</object>
</td>
</tr>
<tr>
<td><!--[if !IE]> -->
Non IE Browsers <br />
<object classid="java:org/adempiere/apps/AApplet.class"
archive="Adempiere.jar,AdempiereCLib.jar"
codebase="/admin/adempiereHome/"
width="200" height="100">
</object>
<!-- <![endif]-->
</td>
</tr>
<tr>
<td> Browsers supporting the EMBED tag <br />
Code commented out - modify source if required! <br />
<!-- start (add the < before the tag) --
embed type="application/x-java-applet;jpi-version=1.5.0"
width="200" height="100"
code="org/adempiere/apps/AApplet.class"
codebase="/admin/adempiereHome/"
archive="Adempiere.jar AdempiereCLib.jar"
pluginspage="http://java.sun.com/j2se/1.5/download.html">
<noembed>
Browsers supporting the EMBED tag: No Java 2 SDK, Standard Edition v 1.5.0 support for APPLET
</noembed>
</embed>
<!-- end -->
</td>
</tr>
<tr>
<td> Browsers supporting the APPLET tag <br />
Code commented out - modify source if required! <br />
<!-- start (add the < before the tag) --
applet code="org/adempiere/apps/AApplet.class"
archive="Adempiere.jar,AdempiereCLib.jar"
codebase="/admin/adempiereHome/"
width="200" height="200">
Browsers supporting the APPLET tag: No Java 2 SDK, Standard Edition v 1.5.0 support for APPLET
</applet>
<!-- end -->
</td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>

View File

@ -4,10 +4,8 @@ bin.includes = META-INF/,\
iDempiere120x60.gif,\
iD32.gif,\
idempiere.html,\
adempiere.jnlp,\
idempiere_logo.png,\
idempiere_logo2.gif,\
applet.html,\
favicon.ico,\
footer_bar.gif,\
header_banner.jpg,\

View File

@ -1,83 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.model.MSession;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Login;
import org.restlet.security.SecretVerifier;
/**
* Http basic authentication implementation. Support authentication using session token or
* userid+password
* @author hengsin
*/
public class BasicVerifier extends SecretVerifier {
private final static CLogger log = CLogger.getCLogger(BasicVerifier.class);
/* (non-Javadoc)
* @see org.restlet.security.SecretVerifier#verify(java.lang.String, char[])
*/
@Override
public int verify(String identity, char[] password)
throws IllegalArgumentException {
//authenticate with session token
if (identity.startsWith("AD_Session_ID#"))
{
String sessionId = identity.substring("AD_Session_ID#".length());
int AD_Session_ID = 0;
try
{
AD_Session_ID = Integer.parseInt(sessionId);
}
catch (Exception e)
{
log.log(Level.WARNING, "Invalid session token: " + identity);
return RESULT_INVALID;
}
MSession session = new MSession(Env.getCtx(), AD_Session_ID, null);
if (session.getAD_Session_ID() != AD_Session_ID)
{
log.log(Level.WARNING, "Session not exists in database: " + identity);
return RESULT_INVALID;
}
if (session.isProcessed())
{
log.log(Level.WARNING, "Session have logout: " + identity);
return RESULT_INVALID;
}
if (!session.isActive())
{
log.log(Level.WARNING, "Session isActive=false: " + identity);
return RESULT_INVALID;
}
if (!session.getWebSession().equals(new String(password)))
{
log.log(Level.WARNING, "Session token doesn't match. identity=" + identity + ", token="+new String(password));
}
return RESULT_VALID;
}
//authenticate with userid+password
Login login = new Login(new Properties());
KeyNamePair[] roles = login.getRoles(identity, new String(password));
return (roles != null && roles.length > 0) ? RESULT_VALID : RESULT_INVALID;
}
}

View File

@ -1,68 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server;
import org.adempiere.web.server.command.ExecuteProcessCommand;
import org.adempiere.web.server.command.ExecuteTaskCommand;
import org.adempiere.web.server.command.ExecuteWorkflowCommand;
import org.adempiere.web.server.command.PostDocumentCommand;
import org.adempiere.web.server.command.ResetCacheCommand;
import org.adempiere.web.server.command.SendEmailCommand;
import org.adempiere.web.server.status.DatabaseResource;
import org.adempiere.web.server.status.VersionResource;
import org.restlet.Application;
import org.restlet.Restlet;
import org.restlet.data.ChallengeScheme;
import org.restlet.routing.Router;
import org.restlet.security.ChallengeAuthenticator;
/**
* Restlet application for /command and /status service.
* @author hengsin
*/
public class ServerApplication extends Application {
/**
* Creates a root Restlet that will receive all incoming calls.
*/
@Override
public synchronized Restlet createInboundRoot() {
// Create a router Restlet that routes each call to a new instance of HelloWorldResource.
Router router = new Router(getContext());
// Defines command route
// The command handler discovery can be refactor to use equinox extension in future to make this
// extensible
router.attach("/command/postDocument", PostDocumentCommand.class);
router.attach("/command/executeProcess", ExecuteProcessCommand.class);
router.attach("/command/executeWorkflow", ExecuteWorkflowCommand.class);
router.attach("/command/executeTask", ExecuteTaskCommand.class);
router.attach("/command/sendEmail", SendEmailCommand.class);
router.attach("/command/resetCache", ResetCacheCommand.class);
// Defines config route
router.attach("/status/version/{type}", VersionResource.class);
router.attach("/status/database/{property}", DatabaseResource.class);
// Authenticate the whole hierarchy of URIs
ChallengeAuthenticator guard = new ChallengeAuthenticator(getContext(),
ChallengeScheme.HTTP_BASIC, "adempiere realm");
guard.setVerifier(new BasicVerifier());
guard.setOptional(false);
guard.setNext(router);
return guard;
}
}

View File

@ -1,80 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server.command;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.RestletUtil;
import org.adempiere.util.ServerContext;
import org.compiere.interfaces.impl.ServerBean;
import org.compiere.model.MRole;
import org.compiere.process.ProcessInfo;
import org.compiere.util.Env;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
import org.restlet.representation.ObjectRepresentation;
import org.restlet.representation.Representation;
/**
* Command to execute java or db process ( AD_Process )
* @author hengsin
*
*/
public class ExecuteProcessCommand extends ServerResource {
@Override
protected Representation post(Representation entity)
throws ResourceException {
try {
HashMap<String, Serializable> map = RestletUtil.toObject(entity);
return new ObjectRepresentation<Serializable>(accept(map));
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public boolean isNegotiated() {
return false;
}
private ProcessInfo accept(HashMap<String, Serializable> entity) {
Properties context = (Properties) entity.get("context");
ProcessInfo pi = (ProcessInfo) entity.get("processInfo");
String procedureName = (String) entity.get("procedureName");
MRole role = MRole.get(context, Env.getAD_Role_ID(context), Env.getAD_User_ID(context), false);
Boolean access = role.getProcessAccess(pi.getAD_Process_ID());
if (access == null || !access.booleanValue()) {
throw new AdempiereException("Access denied.");
}
ServerBean bean = new ServerBean();
try
{
ServerContext.setCurrentInstance(context);
if (procedureName != null && procedureName.trim().length() > 0)
return bean.dbProcess(context, pi, procedureName);
else
return bean.process(context, pi);
}
finally
{
ServerContext.dispose();
}
}
}

View File

@ -1,71 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server.command;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.RestletUtil;
import org.adempiere.util.ServerContext;
import org.compiere.interfaces.impl.ServerBean;
import org.compiere.model.MRole;
import org.compiere.util.Env;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
/**
* Command to execute task ( AD_Task )
* @author hengsin
*/
public class ExecuteTaskCommand extends ServerResource {
@Override
protected Representation post(Representation entity)
throws ResourceException {
try {
HashMap<String, Serializable> map = RestletUtil.toObject(entity);
return new StringRepresentation(accept(map));
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public boolean isNegotiated() {
return false;
}
private String accept(HashMap<String, Serializable> entity) {
Properties context = (Properties) entity.get("context");
int AD_Task_ID = (Integer) entity.get("AD_Task_ID");
MRole role = MRole.get(context, Env.getAD_Role_ID(context), Env.getAD_User_ID(context), false);
if (!role.getTaskAccess(AD_Task_ID)) {
throw new AdempiereException("Access denied.");
}
ServerBean bean = new ServerBean();
try
{
ServerContext.setCurrentInstance(context);
return bean.executeTask(context, AD_Task_ID);
}
finally
{
ServerContext.dispose();
}
}
}

View File

@ -1,74 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server.command;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.RestletUtil;
import org.adempiere.util.ServerContext;
import org.compiere.interfaces.impl.ServerBean;
import org.compiere.model.MRole;
import org.compiere.process.ProcessInfo;
import org.compiere.util.Env;
import org.restlet.representation.ObjectRepresentation;
import org.restlet.representation.Representation;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
/**
* Command to execute workflow ( AD_Workflow )
* @author hengsin
*/
public class ExecuteWorkflowCommand extends ServerResource {
@Override
protected Representation post(Representation entity)
throws ResourceException {
try {
HashMap<String, Serializable> map = RestletUtil.toObject(entity);
return new ObjectRepresentation<Serializable>(accept(map));
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public boolean isNegotiated() {
return false;
}
private ProcessInfo accept(HashMap<String, Serializable> entity) {
Properties context = (Properties) entity.get("context");
ProcessInfo pi = (ProcessInfo) entity.get("processInfo");
int AD_Workflow_ID = (Integer) entity.get("AD_Workflow_ID");
MRole role = MRole.get(context, Env.getAD_Role_ID(context), Env.getAD_User_ID(context), false);
if (!role.getWorkflowAccess(AD_Workflow_ID)) {
throw new AdempiereException("Access denied.");
}
ServerBean bean = new ServerBean();
try
{
ServerContext.setCurrentInstance(context);
return bean.workflow(context, pi, AD_Workflow_ID);
}
finally
{
ServerContext.dispose();
}
}
}

View File

@ -1,72 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server.command;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.RestletUtil;
import org.adempiere.util.ServerContext;
import org.compiere.interfaces.impl.ServerBean;
import org.compiere.util.Env;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
/**
* Command to post accounting document.
* @author hengsin
*/
public class PostDocumentCommand extends ServerResource {
@Override
protected Representation post(Representation entity)
throws ResourceException {
try {
HashMap<String, Serializable> map = RestletUtil.toObject(entity);
return new StringRepresentation(accept(map));
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public boolean isNegotiated() {
return false;
}
private String accept(HashMap<String, Serializable> entity) {
String msg = null;
Properties context = (Properties) entity.get("context");
int AD_Client_ID = Env.getAD_Client_ID(context);
int AD_Table_ID = (Integer) entity.get("AD_Table_ID");
int Record_ID = (Integer) entity.get("Record_ID");
boolean force = (Boolean) entity.get("force");
ServerBean bean = new ServerBean();
try
{
ServerContext.setCurrentInstance(context);
msg = bean.postImmediate(context, AD_Client_ID, AD_Table_ID, Record_ID, force);
}
finally
{
ServerContext.dispose();
}
return msg;
}
}

View File

@ -1,66 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server.command;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.RestletUtil;
import org.adempiere.util.ServerContext;
import org.compiere.interfaces.impl.ServerBean;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
/**
* Command to reset cache at server.
* @author hengsin
*/
public class ResetCacheCommand extends ServerResource {
@Override
protected Representation post(Representation entity)
throws ResourceException {
try {
HashMap<String, Serializable> map = RestletUtil.toObject(entity);
int i = accept(map);
return new StringRepresentation(Integer.toString(i));
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public boolean isNegotiated() {
return false;
}
private int accept(HashMap<String, Serializable> entity) {
Properties context = (Properties) entity.get("context");
int Record_ID = (Integer) entity.get("Record_ID");
String tableName = (String) entity.get("tableName");
ServerBean bean = new ServerBean();
try
{
ServerContext.setCurrentInstance(context);
return bean.cacheReset(context, tableName, Record_ID);
}
finally
{
ServerContext.dispose();
}
}
}

View File

@ -1,66 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server.command;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.RestletUtil;
import org.adempiere.util.ServerContext;
import org.compiere.interfaces.impl.ServerBean;
import org.compiere.util.EMail;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Post;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
/**
* Command to send email from server.
* @author hengsin
*/
public class SendEmailCommand extends ServerResource {
@Post
public Representation sendEmail(Representation entity)
throws ResourceException {
try {
HashMap<String, Serializable> map = RestletUtil.toObject(entity);
return new StringRepresentation(accept(map));
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public boolean isNegotiated() {
return false;
}
private String accept(HashMap<String, Serializable> entity) {
Properties context = (Properties) entity.get("context");
EMail email = (EMail) entity.get("email");
ServerBean bean = new ServerBean();
try
{
ServerContext.setCurrentInstance(context);
return bean.sendEMail(context, email);
}
finally
{
ServerContext.dispose();
}
}
}

View File

@ -1,53 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server.status;
import org.compiere.interfaces.impl.StatusBean;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
/**
* Implement support for remote database connection property query.
* @author hengsin
*
*/
public class DatabaseResource extends ServerResource {
@Get
public String represent() {
StatusBean status = new StatusBean();
String property = (String) getRequestAttributes().get("property");
String value = "";
if ("type".equalsIgnoreCase(property))
value = status.getDbType();
else if ("host".equals(property))
value = status.getDbHost();
else if ("port".equals(property))
value = Integer.toString(status.getDbPort());
else if ("name".equals(property))
value = status.getDbName();
else if ("url".equals(property))
value = status.getConnectionURL();
else if ("uid".equals(property))
value = status.getDbUid();
else if ("password".equals(property))
value = status.getDbPwd();
else if ("fwhost".equals(property))
value = status.getFwHost();
else if ("fwport".equals(property))
value = Integer.toString(status.getFwPort());
return value != null ? value : "";
}
}

View File

@ -1,36 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.web.server.status;
import org.compiere.interfaces.impl.StatusBean;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
/**
* Implement remote version property query support.
* @author hengsin
*
*/
public class VersionResource extends ServerResource {
@Get
public String represent() {
String type = (String) getRequestAttributes().get("type");
if ("date".equalsIgnoreCase(type))
return new StatusBean().getDateVersion();
else if ("main".equalsIgnoreCase(type))
return new StatusBean().getMainVersion();
else
return "";
}
}

View File

@ -34,13 +34,6 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.restlet.ext.servlet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.core"
download-size="0"

View File

@ -42,8 +42,6 @@
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="3" />
<plugin id="org.eclipse.osgi.services" autoStart="true" startLevel="3" />
<plugin id="org.idempiere.hazelcast.service" autoStart="true" startLevel="0" />
<plugin id="org.restlet" autoStart="true" startLevel="0" />
<plugin id="org.restlet.ext.net" autoStart="true" startLevel="0" />
</configurations>
</product>

View File

@ -368,8 +368,6 @@
<setEntry value="org.objectweb.asm.commons*7.0.0.v20181030-2244@default:default"/>
<setEntry value="org.objectweb.asm.tree*7.0.0.v20181030-2244@default:default"/>
<setEntry value="org.passay@default:default"/>
<setEntry value="org.restlet*2.4.1@default:default"/>
<setEntry value="org.restlet.ext.servlet*2.4.1@default:default"/>
<setEntry value="org.sat4j.core@default:default"/>
<setEntry value="org.sat4j.pb@default:default"/>
<setEntry value="org.slf4j.apis.jcl@default:default"/>

View File

@ -70,8 +70,6 @@ Export-Package: com.jgoodies.looks,
org.jdesktop.swingx.util
Require-Bundle: org.adempiere.base;bundle-version="0.0.0",
org.adempiere.ui;bundle-version="0.0.0",
org.restlet;bundle-version="0.0.0",
org.restlet.ext.servlet;bundle-version="0.0.0",
org.jfree.chart;bundle-version="1.0.19",
org.jfree.jcommon;bundle-version="1.0.23"
Eclipse-ExtensibleAPI: true
@ -84,12 +82,10 @@ Import-Package: groovy.beans;version="2.5.3",
groovy.inspect;version="2.5.3",
groovy.inspect.swingui;version="2.5.3",
groovy.io;version="2.5.3",
groovy.jmx.builder;version="2.5.3",
groovy.json;version="2.5.3",
groovy.lang;version="2.5.3",
groovy.model;version="2.5.3",
groovy.security;version="2.5.3",
groovy.servlet;version="2.5.3",
groovy.sql;version="2.5.3",
groovy.swing;version="2.5.3",
groovy.swing.binding;version="2.5.3",

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.client.ServerInterface">
<implementation class="org.adempiere.client.ServerInterface"/>
<service>
<provide interface="org.compiere.interfaces.Server"/>
</service>
<property name="service.ranking" type="Integer" value="1"/>
</scr:component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.client.StatusInterface">
<implementation class="org.adempiere.client.StatusInterface"/>
<service>
<provide interface="org.compiere.interfaces.Status"/>
</service>
<property name="service.ranking" type="Integer" value="1"/>
</scr:component>

View File

@ -1,14 +1,6 @@
bin.includes = META-INF/,\
plugin.xml,\
OSGI-INF/,\
OSGI-INF/defaultpaymentformfactory.xml,\
OSGI-INF/defaultprintshippinglabel.xml,\
OSGI-INF/defaultcreatefromfactory.xml,\
OSGI-INF/resourcefinder.xml,\
OSGI-INF/defaultinfofactory.xml,\
OSGI-INF/defaulteditorfactory.xml,\
OSGI-INF/reportviewerprovider.xml,\
OSGI-INF/defaultformfactory.xml,\
.,\
lib/jpedal.jar,\
lib/looks.jar,\

View File

@ -1,46 +1,17 @@
package org.adempiere.client;
import java.util.ArrayList;
import java.util.List;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
import org.compiere.Adempiere;
import org.compiere.util.CLogger;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.restlet.Client;
import org.restlet.Context;
import org.restlet.data.Protocol;
import org.restlet.engine.connector.HttpClientHelper;
public class Application implements IApplication {
private static CLogger log = CLogger.getCLogger(Application.class);
public static Context context = null;
public Object start(IApplicationContext ctx) throws Exception {
log.info("Starting client");
// A HOSTNAME VERIFIER THAT ACCEPTS EVERY HOSTS
HostnameVerifier myhostnameverifier = new HostnameVerifier() {
@Override
public boolean verify(String urlHostName, SSLSession session) {
return true;
}
};
//
//start restlet context
context = new Context();
context.getAttributes().put("sslContextFactory", new ClientSSLContextFactory());
context.getAttributes().put("hostnameVerifier", myhostnameverifier);
List<Protocol> list = new ArrayList<Protocol>();
list.add(Protocol.HTTPS);
Client client = new Client(context, list, HttpClientHelper.class.getName());
context.setClientDispatcher(client);
client.start();
Adempiere.startup(true);
org.compiere.AdempiereClient.main(new String[]{});
return IApplication.EXIT_OK;

View File

@ -1,234 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.client;
import java.io.FileInputStream;
import java.security.KeyStore;
import java.security.SecureRandom;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import org.restlet.engine.ssl.DefaultSslContextFactory;
/**
* Temporary workaround to support ssl connection to server with self signed certificate.
* @author hengsin
*
*/
public class ClientSSLContextFactory extends DefaultSslContextFactory {
/**
* Name of the KeyManager algorithm.
*/
private volatile String keyManagerAlgorithm = System.getProperty(
"ssl.KeyManagerFactory.algorithm",
KeyManagerFactory.getDefaultAlgorithm());
/**
* Password for the key in the keystore (as a String).
*/
private volatile char[] keyStoreKeyPassword = (System.getProperty(
"javax.net.ssl.keyPassword",
System.getProperty("javax.net.ssl.keyStorePassword")) != null) ? System
.getProperty("javax.net.ssl.keyPassword",
System.getProperty("javax.net.ssl.keyStorePassword"))
.toCharArray() : null;
/**
* Password for the keystore (as a String).
*/
private volatile char[] keyStorePassword = (System
.getProperty("javax.net.ssl.keyStorePassword") != null) ? System
.getProperty("javax.net.ssl.keyStorePassword").toCharArray() : null;
/**
* Path to the KeyStore file.
*/
private volatile String keyStorePath = System
.getProperty("javax.net.ssl.keyStore");
/**
* Name of the keystore provider.
*/
private volatile String keyStoreProvider = System
.getProperty("javax.net.ssl.keyStoreProvider");
/**
* KeyStore type of the keystore.
*/
private volatile String keyStoreType = System
.getProperty("javax.net.ssl.keyStoreType");
/**
* Name of the SecureRandom algorithm.
*/
private volatile String secureRandomAlgorithm = null;
/**
* Name of the protocol to use when creating the SSLContext.
*/
private volatile String secureSocketProtocol = "TLS";
/**
* Name of the TrustManager algorithm.
*/
private volatile String trustManagerAlgorithm = System.getProperty(
"ssl.TrustManagerFactory.algorithm",
TrustManagerFactory.getDefaultAlgorithm());
/**
* Password for the trust store keystore.
*/
private volatile char[] trustStorePassword = (System
.getProperty("javax.net.ssl.trustStorePassword") != null) ? System
.getProperty("javax.net.ssl.trustStorePassword").toCharArray()
: null;
/**
* Path to the trust store (keystore) file.
*/
private volatile String trustStorePath = System
.getProperty("javax.net.ssl.trustStore");
/**
* Name of the trust store (keystore) provider.
*/
private volatile String trustStoreProvider = System
.getProperty("javax.net.ssl.trustStoreProvider");
/**
* KeyStore type of the trust store.
*/
private volatile String trustStoreType = System
.getProperty("javax.net.ssl.trustStoreType");
/**
* Creates a configured and initialised SSLContext from the values set via
* the various setters of this class. If <code>keyStorePath</code>,
* <code>keyStoreProvider</code>, <code>keyStoreType</code> are all
* <code>null</code>, the SSLContext will be initialised with a
* <code>null</core> array of <code>KeyManager</code>s. Similarly, if
* <code>trustStorePath</code>, <code>trustStoreProvider</code>,
* <code>trustStoreType</code> are all <code>null</code>, a
* <code>null</code> array of <code>TrustManager</code>s will be used.
*
* @see SSLContext#init(javax.net.ssl.KeyManager[],
* javax.net.ssl.TrustManager[], SecureRandom)
*/
@Override
public SSLContext createSslContext() throws Exception {
KeyManagerFactory kmf = null;
if ((this.keyStorePath != null) || (this.keyStoreProvider != null)
|| (this.keyStoreType != null)) {
/*
* Loads the key store.
*/
final KeyStore keyStore = (this.keyStoreProvider != null) ? KeyStore
.getInstance(
(this.keyStoreType != null) ? this.keyStoreType
: KeyStore.getDefaultType(),
this.keyStoreProvider)
: KeyStore
.getInstance((this.keyStoreType != null) ? this.keyStoreType
: KeyStore.getDefaultType());
FileInputStream keyStoreInputStream = null;
try {
keyStoreInputStream = ((this.keyStorePath != null) && (!"NONE"
.equals(this.keyStorePath))) ? new FileInputStream(
this.keyStorePath) : null;
keyStore.load(keyStoreInputStream, this.keyStorePassword);
} finally {
if (keyStoreInputStream != null) {
keyStoreInputStream.close();
}
}
/*
* Creates the key-manager factory.
*/
kmf = KeyManagerFactory.getInstance(this.keyManagerAlgorithm);
kmf.init(keyStore, this.keyStoreKeyPassword);
}
TrustManagerFactory tmf = null;
if ((this.trustStorePath != null) || (this.trustStoreProvider != null)
|| (this.trustStoreType != null)) {
/*
* Loads the trust store.
*/
final KeyStore trustStore = (this.trustStoreProvider != null) ? KeyStore
.getInstance(
(this.trustStoreType != null) ? this.trustStoreType
: KeyStore.getDefaultType(),
this.trustStoreProvider)
: KeyStore
.getInstance((this.trustStoreType != null) ? this.trustStoreType
: KeyStore.getDefaultType());
FileInputStream trustStoreInputStream = null;
try {
trustStoreInputStream = ((this.trustStorePath != null) && (!"NONE"
.equals(this.trustStorePath))) ? new FileInputStream(
this.trustStorePath) : null;
trustStore.load(trustStoreInputStream, this.trustStorePassword);
} finally {
if (trustStoreInputStream != null) {
trustStoreInputStream.close();
}
}
/*
* Creates the trust-manager factory.
*/
tmf = TrustManagerFactory.getInstance(this.trustManagerAlgorithm);
tmf.init(trustStore);
}
TrustManager[] trustManagers = null;
if (tmf != null) {
trustManagers = tmf.getTrustManagers();
} else {
trustManagers = new TrustManager[]{
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
}
}
};
}
/*
* Creates the SSLContext.
*/
final SSLContext sslContext = SSLContext
.getInstance(this.secureSocketProtocol);
SecureRandom sr = null;
if (this.secureRandomAlgorithm != null) {
sr = SecureRandom.getInstance(this.secureRandomAlgorithm);
}
sslContext.init(kmf != null ? kmf.getKeyManagers() : null, trustManagers, sr);
return sslContext;
}
}

View File

@ -1,208 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.client;
import java.io.Serializable;
import java.net.URI;
import java.util.HashMap;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.RestletUtil;
import org.compiere.db.CConnection;
import org.compiere.db.SecurityPrincipal;
import org.compiere.interfaces.Server;
import org.compiere.process.ProcessInfo;
import org.compiere.util.EMail;
import org.restlet.Context;
import org.restlet.data.ChallengeResponse;
import org.restlet.data.ChallengeScheme;
import org.restlet.resource.ClientResource;
import org.restlet.representation.ObjectRepresentation;
import org.restlet.representation.Representation;
/**
* Server interface using restlet. Use ssl and http basic authentication.
* @author hengsin
*/
public class ServerInterface implements Server {
private ClientResource createClientResource(URI uri) {
Context context = getContext();
ClientResource resource = new ClientResource(context, uri);
resource.setChallengeResponse(createChallengeResponse());
return resource;
}
private ChallengeResponse createChallengeResponse()
{
SecurityPrincipal principal = CConnection.get().getAppServerCredential();
ChallengeResponse cr = new ChallengeResponse(ChallengeScheme.HTTP_BASIC, principal.identity, principal.secret);
return cr;
}
private Context getContext() {
return Application.context;
}
/* (non-Javadoc)
* @see org.compiere.interfaces.Server#postImmediate(java.util.Properties, int, int, int, boolean)
*/
@Override
public String postImmediate(Properties ctx, int AD_Client_ID,
int AD_Table_ID, int Record_ID, boolean force) {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("AD_Table_ID", AD_Table_ID);
map.put("Record_ID", Record_ID);
map.put("force", force);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/postDocument", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
/* (non-Javadoc)
* @see org.compiere.interfaces.Server#process(java.util.Properties, org.compiere.process.ProcessInfo)
*/
@Override
public ProcessInfo process(Properties ctx, ProcessInfo pi) {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("processInfo", pi);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/executeProcess", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<Serializable> entity = new ObjectRepresentation<Serializable>(map);
Representation response = resource.post(entity);
ProcessInfo responseInfo = RestletUtil.toObject(response);
return responseInfo;
} catch (Exception e) {
throw new AdempiereException(e);
}
}
/* (non-Javadoc)
* @see org.compiere.interfaces.Server#workflow(java.util.Properties, org.compiere.process.ProcessInfo, int)
*/
@Override
public ProcessInfo workflow(Properties ctx, ProcessInfo pi,
int AD_Workflow_ID) {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("AD_Workflow_ID", AD_Workflow_ID);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/executeWorkflow", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
ProcessInfo responseInfo = RestletUtil.toObject(response);
return responseInfo;
} catch (Exception e) {
throw new AdempiereException(e);
}
}
/* (non-Javadoc)
* @see org.compiere.interfaces.Server#sendEMail(java.util.Properties, org.compiere.util.EMail)
*/
@Override
public String sendEMail(Properties ctx, EMail email) {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("email", email);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/sendEmail", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
/* (non-Javadoc)
* @see org.compiere.interfaces.Server#executeTask(java.util.Properties, int)
*/
@Override
public String executeTask(Properties ctx, int AD_Task_ID) {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("AD_Task_ID", AD_Task_ID);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/executeTask", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
/* (non-Javadoc)
* @see org.compiere.interfaces.Server#cacheReset(java.util.Properties, java.lang.String, int)
*/
@Override
public int cacheReset(Properties ctx, String tableName, int Record_ID) {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("tableName", tableName);
map.put("Record_ID", Record_ID);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/resetCache", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
return response != null ? Integer.parseInt(response.getText()) : 0;
} catch (Exception e) {
throw new AdempiereException(e);
}
}
/* (non-Javadoc)
* @see org.compiere.interfaces.Server#dbProcess(java.util.Properties, org.compiere.process.ProcessInfo, java.lang.String)
*/
@Override
public ProcessInfo dbProcess(Properties ctx, ProcessInfo processInfo,
String procedureName) {
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("context", ctx);
map.put("processInfo", processInfo);
map.put("procedureName", procedureName);
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/command/executeProcess", null, null);
ClientResource resource = createClientResource(uri);
ObjectRepresentation<HashMap<String, Serializable>> entity = new ObjectRepresentation<HashMap<String,Serializable>>(map);
Representation response = resource.post(entity);
ProcessInfo responseInfo = RestletUtil.toObject(response);
return responseInfo;
} catch (Exception e) {
throw new AdempiereException(e);
}
}
}

View File

@ -1,191 +0,0 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin 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. *
*****************************************************************************/
package org.adempiere.client;
import java.net.URI;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.db.CConnection;
import org.compiere.db.SecurityPrincipal;
import org.compiere.interfaces.Status;
import org.restlet.Context;
import org.restlet.data.ChallengeResponse;
import org.restlet.data.ChallengeScheme;
import org.restlet.representation.Representation;
import org.restlet.resource.ClientResource;
/**
* Status interface using restlet. Use ssl and http basic authentication.
* @author hengsin
*
*/
public class StatusInterface implements Status {
private ClientResource createClientResource(URI uri) {
Context context = getContext();
ClientResource resource = new ClientResource(context, uri);
resource.setChallengeResponse(createChallengeResponse());
return resource;
}
private ChallengeResponse createChallengeResponse()
{
SecurityPrincipal principal = CConnection.get().getAppServerCredential();
if (principal != null)
{
ChallengeResponse cr = new ChallengeResponse(ChallengeScheme.HTTP_BASIC, principal.identity, principal.secret);
return cr;
}
else
{
return null;
}
}
private Context getContext() {
return Application.context;
}
@Override
public String getDateVersion() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/version/date", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
e.printStackTrace();
throw new AdempiereException(e);
}
}
@Override
public String getMainVersion() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/version/main", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public String getDbType() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/type", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public String getDbHost() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/host", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public int getDbPort() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/port", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return Integer.parseInt(response.getText());
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public String getDbName() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/name", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public String getConnectionURL() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/url", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public String getDbUid() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/uid", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public String getDbPwd() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/password", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public String getFwHost() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/fwhost", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return response != null ? response.getText() : "";
} catch (Exception e) {
throw new AdempiereException(e);
}
}
@Override
public int getFwPort() {
try {
URI uri = new URI("https", null, CConnection.get().getAppsHost(), CConnection.get().getSSLPort(), "/server/status/database/fwport", null, null);
ClientResource resource = createClientResource(uri);
Representation response = resource.get();
return Integer.parseInt(response.getText());
} catch (Exception e) {
throw new AdempiereException(e);
}
}
}

View File

@ -93,7 +93,7 @@ public final class AdempiereClient
}
// Set Default Database Connection from Ini
DB.setDBTarget(CConnection.get(Adempiere.getCodeBaseHost()));
DB.setDBTarget(CConnection.get());
if (isClient) // don't test connection
return false; // need to call

View File

@ -1,94 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.apps;
import java.applet.Applet;
import java.awt.HeadlessException;
import java.awt.TextArea;
import org.compiere.Adempiere;
import org.compiere.util.Env;
import org.compiere.util.Splash;
/**
* Application Applet
*
* @author Jorg Janke
* @version $Id: AApplet.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
*/
public class AApplet extends Applet
{
/**
*
*/
private static final long serialVersionUID = 3725929727697509228L;
/**
* Adempiere Application Applet
* @throws java.awt.HeadlessException
*/
public AApplet () throws HeadlessException
{
super ();
} // AApplet
/**************************************************************************
* init
*/
public void init ()
{
super.init ();
TextArea ta = new TextArea(Adempiere.getSummary());
add (ta);
} // init
/**
* start
*/
public void start ()
{
super.start ();
showStatus(Adempiere.getSummary());
//
@SuppressWarnings("unused")
Splash splash = Splash.getSplash();
Adempiere.startup(true); // needs to be here for UI
@SuppressWarnings("unused")
AMenu menu = new AMenu();
} // start
/**
* stop
*/
public void stop ()
{
super.stop ();
} // stop
/**
* destroy
*/
public void destroy ()
{
super.destroy ();
Env.exitEnv(0);
} // destroy
} // AApplet

View File

@ -58,7 +58,6 @@ import org.compiere.model.MTable;
import org.compiere.swing.CButton;
import org.compiere.swing.CFrame;
import org.compiere.swing.CMenuItem;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -805,49 +804,9 @@ public final class AEnv
/** Workflow Menu */
private static int s_workflow_Window_ID = 0;
/** Server Re-tries */
private static int s_serverTries = 0;
/** Server Session */
private static Server s_server = null;
/** Logger */
private static CLogger log = CLogger.getCLogger(AEnv.class);
/**
* Is AppsServer Active ?
* @return true if active
*/
public static boolean isServerActive()
{
boolean contactAgain = s_server == null && s_serverTries == 0;
boolean ok = CConnection.get().isAppsServerOK(contactAgain);
if (ok)
{
s_serverTries = 0;
return true;
}
if (s_serverTries > 1) // try twice
return false;
// Try to connect
CLogMgt.enable(false);
try
{
s_serverTries++;
if (log.isLoggable(Level.CONFIG)) log.config("try #" + s_serverTries);
ok = CConnection.get().isAppsServerOK(true);
if (ok)
s_serverTries = 0;
}
catch (Exception ex)
{
ok = false;
s_server = null;
}
CLogMgt.enable(true);
//
return ok;
} // isServerActive
/**
* Get Server Version
* @return Apps Server Version
@ -886,24 +845,18 @@ public final class AEnv
{
if (log.isLoggable(Level.CONFIG)) log.config("TableName=" + tableName + ", Record_ID=" + Record_ID);
// try to get from Server when enabled
if (isServerActive())
try
{
log.config("trying server");
try
Server server = CConnection.get().getServer();
if (server != null)
{
Server server = CConnection.get().getServer();
if (server != null)
{
server.cacheReset(Env.getRemoteCallCtx(Env.getCtx()), tableName, Record_ID);
}
}
catch (Exception e)
{
log.log(Level.SEVERE, "ex", e);
s_server = null;
server.cacheReset(Env.getRemoteCallCtx(Env.getCtx()), tableName, Record_ID);
}
}
catch (Exception e)
{
log.log(Level.SEVERE, "ex", e);
}
} // cacheReset
/**

View File

@ -465,7 +465,7 @@ public final class ALogin extends CDialog
*/
public boolean initLogin()
{
m_cc = CConnection.get(Adempiere.getCodeBaseHost());
m_cc = CConnection.get();
hostField.setValue(m_cc);
if ( Ini.isPropertyBool(Ini.P_VALIDATE_CONNECTION_ON_STARTUP)) {
@ -507,14 +507,6 @@ public final class ALogin extends CDialog
}
} // processWindowEvent
private void validateAppServer() {
m_user = userTextField.getText();
m_pwd = passwordField.getPassword();
m_cc.setAppServerCredential(m_user, m_pwd);
m_cc.testAppsServer();
}
private void connectToDatabase() {
//Check connection
DB.setDBTarget(m_cc);
@ -529,7 +521,6 @@ public final class ALogin extends CDialog
private void validateConnection()
{
m_connectionOK = -1;
validateAppServer();
//make sure connecting to new database
DB.closeTarget();

View File

@ -56,7 +56,6 @@ import org.adempiere.plaf.AdempierePLAF;
import org.compiere.Adempiere;
import org.compiere.apps.wf.WFActivity;
import org.compiere.apps.wf.WFPanel;
import org.compiere.db.CConnection;
import org.compiere.grid.tree.VTreePanel;
import org.compiere.model.MRole;
import org.compiere.model.MSession;
@ -110,7 +109,6 @@ public final class AMenu extends CFrame
public AMenu ()
{
super();
if (log.isLoggable(Level.INFO)) log.info("CodeBase=" + Adempiere.getCodeBase());
UIManager.put( "ClassLoader", this.getClass().getClassLoader());
@ -130,7 +128,6 @@ public final class AMenu extends CFrame
session.setWebSession(UUID.randomUUID().toString());
session.setDescription(session.getDescription() + " " + "Swing Client");
session.saveEx();
CConnection.get().setAppServerCredential("AD_Session_ID#"+session.getAD_Session_ID(), session.getWebSession().toCharArray());
// Setting close operation/listener - teo_sarca [ 1684168 ]
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

View File

@ -1,26 +0,0 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>
Start Applet
</TITLE>
</HEAD>
<BODY>
com.accorto.apps.AStart will appear below in a Java enabled browser.<BR>
<APPLET
CODEBASE = "."
CODE = "com.accorto.apps.AStart.class"
NAME = "TestApplet"
WIDTH = 400
HEIGHT = 300
HSPACE = 0
VSPACE = 0
ALIGN = top
>
</APPLET>
</BODY>
</HTML>

View File

@ -1,153 +0,0 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.apps;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.UIManager;
/**
* Applet Start
*
* @author Jorg Janke
* @version $Id: AStart.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
*/
public final class AStart extends JApplet
{
/**
*
*/
private static final long serialVersionUID = 2871413592908347578L;
boolean isStandalone = false;
/**
* Get a parameter value
*/
public String getParameter(String key, String def)
{
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
/**
* Construct the applet
*/
public AStart()
{
}
/**
* Initialize the applet
*/
public void init()
{
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
/**
* Component initialization
*/
private void jbInit() throws Exception
{
this.setSize(new Dimension(400,300));
}
/**
* Start the applet
*/
public void start()
{
}
/**
* Stop the applet
*/
public void stop()
{
}
/**
* Destroy the applet
*/
public void destroy()
{
}
/**
* Get Applet information
*/
public String getAppletInfo()
{
return "Start Applet";
}
/**
* Get parameter info
*/
public String[][] getParameterInfo()
{
return null;
}
public void setStandAlone(boolean ok)
{
isStandalone=ok;
}
/**
* Main method
*/
public static void main(String[] args)
{
AStart applet = new AStart();
applet.isStandalone = true;
JFrame frame = new JFrame();
//EXIT_ON_CLOSE == 3
frame.setDefaultCloseOperation(3);
frame.setTitle("Start Applet");
frame.getContentPane().add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(400,320);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
}
//static initializer for setting look & feel
static
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
}
catch(Exception e)
{
}
}
} // AStert

View File

@ -33,9 +33,7 @@ import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import org.adempiere.client.ClientCredentialDialog;
import org.adempiere.plaf.AdempierePLAF;
import org.compiere.apps.AEnv;
import org.compiere.swing.CButton;
import org.compiere.swing.CCheckBox;
import org.compiere.swing.CComboBox;
@ -44,7 +42,6 @@ import org.compiere.swing.CLabel;
import org.compiere.swing.CPanel;
import org.compiere.swing.CTextField;
import org.compiere.util.CLogger;
import org.compiere.util.Ini;
/**
* Connection Dialog.
@ -127,12 +124,6 @@ public class CConnectionDialog extends CDialog implements ActionListener
private CLabel dbTypeLabel = new CLabel();
private CComboBox<Object> dbTypeField = new CComboBox<Object>(Database.getDatabaseNames());
private CCheckBox cbBequeath = new CCheckBox();
private CLabel appsHostLabel = new CLabel();
private CTextField appsHostField = new CTextField();
private CLabel sslPortLabel = new CLabel();
private CTextField sslPortField = new CTextField();
private CButton bTestApps = new CButton();
//private CCheckBox cbOverwrite = new CCheckBox();
private CLabel dbUidLabel = new CLabel();
private CTextField dbUidField = new CTextField();
private JPasswordField dbPwdField = new JPasswordField();
@ -169,12 +160,6 @@ public class CConnectionDialog extends CDialog implements ActionListener
sidField.setColumns(30);
fwPortField.setColumns(10);
cbBequeath.setText(res.getString("BequeathConnection"));
appsHostLabel.setText(res.getString("AppsHost"));
appsHostField.setColumns(30);
sslPortLabel.setText(res.getString("AppsPort"));
sslPortField.setColumns(10);
bTestApps.setText(res.getString("TestApps"));
bTestApps.setHorizontalAlignment(JLabel.LEFT);
//cbOverwrite.setText(res.getString("Overwrite"));
dbUidLabel.setText(res.getString("DBUidPwd"));
dbUidField.setColumns(10);
@ -188,19 +173,6 @@ public class CConnectionDialog extends CDialog implements ActionListener
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0));
centerPanel.add(nameField, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0));
centerPanel.add(appsHostLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
centerPanel.add(appsHostField, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
centerPanel.add(sslPortLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
centerPanel.add(sslPortField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
//
centerPanel.add(bTestApps, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 12, 0), 0, 0));
//centerPanel.add(cbOverwrite, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0
//,GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 5, 0, 12), 0, 0));
// DB
centerPanel.add(dbTypeLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
@ -240,9 +212,6 @@ public class CConnectionDialog extends CDialog implements ActionListener
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 12, 0), 0, 0));
//
nameField.addActionListener(this);
appsHostField.addActionListener(this);
sslPortField.addActionListener(this);
bTestApps.addActionListener(this);
//
dbTypeField.addActionListener(this);
hostField.addActionListener(this);
@ -254,19 +223,7 @@ public class CConnectionDialog extends CDialog implements ActionListener
fwPortField.addActionListener(this);
bTestDB.addActionListener(this);
bOK.addActionListener(this);
bCancel.addActionListener(this);
// Server
if (!Ini.isClient())
{
appsHostLabel.setVisible(false);
appsHostField.setVisible(false);
sslPortLabel.setVisible(false);
sslPortField.setVisible(false);
bTestApps.setVisible(false);
}
else // Client
cbBequeath.setVisible(false);
bCancel.addActionListener(this);
} // jbInit
/**
@ -352,21 +309,8 @@ public class CConnectionDialog extends CDialog implements ActionListener
updateCConnection();
//
if (src == bTestApps)
{
ClientCredentialDialog ccd = new ClientCredentialDialog(this);
ccd.setModal(true);
AEnv.showCenterWindow(this, ccd);
if (ccd.isOKpressed())
{
m_cc.setAppServerCredential(ccd.getUserId(), ccd.getPassword());
cmd_testApps();
}
}
// Database Selection Changed
else if (src == dbTypeField)
if (src == dbTypeField)
{
m_cc.setType((String)dbTypeField.getSelectedItem());
dbPortField.setText(String.valueOf(m_cc.getDbPort()));
@ -385,17 +329,7 @@ public class CConnectionDialog extends CDialog implements ActionListener
} // actionPerformed
private void updateCConnection() {
if (Ini.isClient())
{
//hengsin: avoid unnecessary requery of application server status
if (!appsHostField.getText().equals(m_cc.getAppsHost()))
m_cc.setAppsHost(appsHostField.getText());
if (!sslPortField.getText().equals(Integer.toString(m_cc.getSSLPort())))
m_cc.setSSLPort(sslPortField.getText());
}
else
m_cc.setAppsHost("localhost");
m_cc.setAppsHost("localhost");
//
m_cc.setType((String)dbTypeField.getSelectedItem());
m_cc.setDbHost(hostField.getText());
@ -416,14 +350,8 @@ public class CConnectionDialog extends CDialog implements ActionListener
{
m_updating = true;
nameField.setText(m_cc.getName());
appsHostField.setText(m_cc.getAppsHost());
sslPortField.setText(String.valueOf(m_cc.getSSLPort()));
//
bTestApps.setIcon(getStatusIcon(m_cc.isAppsServerOK(false)));
// bTestApps.setToolTipText(m_cc.getRmiUri());
//cbOverwrite.setVisible(m_cc.isAppsServerOK(false));
boolean rw = !m_cc.isAppsServerOK(false);
boolean rw = true;
//
dbTypeLabel.setReadWrite(rw);
dbTypeField.setReadWrite(rw);
@ -494,25 +422,6 @@ public class CConnectionDialog extends CDialog implements ActionListener
setBusy (false);
} // cmd_testDB
/**
* Test Application connection
*/
private void cmd_testApps()
{
setBusy (true);
m_cc.setAppsHost(appsHostField.getText());
m_cc.setSSLPort(sslPortField.getText());
Exception e = m_cc.testAppsServer();
if (e != null)
{
JOptionPane.showMessageDialog(this,
e.getLocalizedMessage(),
res.getString("ServerNotActive") + " - " + m_cc.getAppsHost(),
JOptionPane.ERROR_MESSAGE);
}
setBusy (false);
} // cmd_testApps
public boolean isCancel() {
return isCancel;
}

View File

@ -62,11 +62,6 @@ public class CConnectionEditor extends JComponent
m_text.setEditable(false);
m_text.setBorder(null);
m_text.addMouseListener(ml);
m_server.setIcon(new ImageIcon(getClass().getResource("Server16.gif")));
m_server.setFocusable(false);
m_server.setBorder(null);
m_server.setOpaque(true);
m_server.addMouseListener(ml);
m_db.setIcon(new ImageIcon(getClass().getResource("Database16.gif")));
m_db.setFocusable(false);
m_db.setBorder(null);
@ -75,7 +70,6 @@ public class CConnectionEditor extends JComponent
LookAndFeel.installBorder(this, "TextField.border");
//
setLayout(new BorderLayout(0,0));
add(m_server, BorderLayout.WEST);
add(m_text, BorderLayout.CENTER);
add(m_db, BorderLayout.EAST);
} // CConnectionEditor
@ -84,8 +78,6 @@ public class CConnectionEditor extends JComponent
private JTextField m_text = new JTextField(10);
/** DB Button Element */
private JLabel m_db = new JLabel ();
/** Host Button Element */
private JLabel m_server = new JLabel();
/** The Value */
private CConnection m_value = null;
/** ReadWrite */
@ -154,7 +146,6 @@ public class CConnectionEditor extends JComponent
*/
public void setBackground (Color color)
{
m_server.setBackground(color);
m_text.setBackground(color);
m_db.setBackground(color);
} // setBackground
@ -208,12 +199,10 @@ public class CConnectionEditor extends JComponent
if (m_value == null)
return;
// Text
if (m_value.isAppsServerOK(false) || m_value.isDatabaseOK())
if (m_value.isDatabaseOK())
{
m_text.setForeground(AdempierePLAF.getTextColor_OK());
setBackground(false);
if (!m_value.isAppsServerOK(false))
m_server.setBackground(AdempierePLAF.getFieldBackground_Error());
if (!m_value.isDatabaseOK())
m_db.setBackground(AdempierePLAF.getFieldBackground_Error());
}

View File

@ -32,7 +32,6 @@
<activation.version>1.2.1</activation.version>
<annotation.version>1.3.3</annotation.version>
<asm.version>7.0</asm.version>
<restlet.version>2.4.1</restlet.version>
<javamail.version>1.6.3</javamail.version>
<poi.version>4.1.0</poi.version>
</properties>
@ -52,10 +51,6 @@
<id>zkoss</id>
<url>https://mavensync.zkoss.org/maven2</url>
</repository>
<repository>
<id>restlet-maven</id>
<url>https://maven.restlet.com</url>
</repository>
</repositories>
<build>
@ -794,129 +789,6 @@
<source>true</source>
<transitive>false</transitive>
</artifact>
<artifact>
<id>org.restlet.osgi:org.restlet:${restlet.version}</id>
<source>true</source>
<transitive>false</transitive>
<override>true</override>
<!-- manefest isn't complete, so take from release of 2.3.12
https://github.com/restlet/restlet-framework-java/issues/1321-->
<instructions>
<Bundle-Activator>org.restlet.engine.internal.Activator</Bundle-Activator>
<Bundle-Name>org.restlet</Bundle-Name>
<Bundle-SymbolicName>org.restlet</Bundle-SymbolicName>
<Bundle-Version>${restlet.version}</Bundle-Version>
<Export-Package>org.restlet;uses:="org.restlet.engine.application,org.re
stlet.resource,org.restlet.util,org.restlet.engine,org.restlet.routing,
org.restlet.service,org.restlet.engine.resource,org.restlet.security,or
g.restlet.data,org.restlet.engine.connector,org.restlet.representation,
org.restlet.engine.component,org.restlet.engine.util",org.restlet.data;
uses:="org.restlet.engine.util,org.restlet.util,org.restlet,org.restlet
.engine.security,org.restlet.representation,org.restlet.engine,org.rest
let.routing,org.restlet.engine.io,org.restlet.security,org.restlet.engi
ne.header",org.restlet.engine;uses:="org.restlet.routing,org.restlet.da
ta,org.restlet,org.restlet.representation,org.restlet.engine.log,org.re
stlet.engine.security,org.restlet.engine.io,org.restlet.engine.util,org
.restlet.engine.converter,org.restlet.engine.connector,org.restlet.engi
ne.local,org.restlet.service,org.restlet.util",org.restlet.engine.adapt
er;uses:="org.restlet,org.restlet.data,org.restlet.representation,org.r
estlet.util,org.restlet.engine.header,org.restlet.engine,org.restlet.se
rvice,org.restlet.engine.connector,org.restlet.engine.util,org.restlet.
engine.security,org.restlet.engine.io",org.restlet.engine.application;u
ses:="org.restlet.data,org.restlet,org.restlet.routing,org.restlet.serv
ice,org.restlet.util,org.restlet.engine,org.restlet.representation,org.
restlet.engine.util,org.restlet.engine.io,org.restlet.engine.resource,o
rg.restlet.engine.header",org.restlet.engine.component;uses:="org.restl
et.routing,org.restlet.data,org.restlet,org.restlet.util,org.restlet.en
gine.util,org.restlet.service,org.restlet.engine.log,org.restlet.engine
,org.restlet.resource,org.restlet.representation,javax.xml.parsers,org.
w3c.dom,org.xml.sax",org.restlet.engine.connector;uses:="org.restlet,or
g.restlet.representation,org.restlet.util,org.restlet.service,org.restl
et.data,org.restlet.engine,org.restlet.engine.util,org.restlet.engine.l
ocal,org.restlet.engine.adapter,javax.net.ssl,com.sun.net.httpserver,or
g.restlet.engine.ssl,org.restlet.engine.log",org.restlet.engine.convert
er;uses:="org.restlet.data,org.restlet.resource,org.restlet.representat
ion,org.restlet.engine.resource,org.restlet.engine,org.restlet,org.rest
let.engine.application,org.restlet.engine.util",org.restlet.engine.head
er;uses:="org.restlet.data,org.restlet.util,org.restlet.representation,
org.restlet.engine.util,org.restlet,org.restlet.engine.security",org.re
stlet.engine.internal;uses:="org.osgi.framework,org.restlet,org.restlet
.engine",org.restlet.engine.io;uses:="org.restlet.representation,org.re
stlet,org.restlet.engine.util,org.restlet.data,org.restlet.engine,org.r
estlet.util",org.restlet.engine.local;uses:="org.restlet.service,org.re
stlet.data,org.restlet.representation,org.restlet,org.restlet.resource,
org.restlet.engine.util,org.restlet.engine.io,org.restlet.util,org.rest
let.engine.connector",org.restlet.engine.log;uses:="org.restlet.engine.
io,org.restlet.engine.util,org.restlet,org.restlet.routing,org.restlet.
service,org.restlet.data,org.restlet.engine",org.restlet.engine.resourc
e;uses:="org.restlet.engine.util,org.restlet,org.restlet.service,org.re
stlet.data,org.restlet.resource,org.restlet.representation,org.restlet.
engine.connector,org.restlet.engine.application",org.restlet.engine.sec
urity;uses:="org.restlet.data,org.restlet.util,org.restlet,org.restlet.
engine,org.restlet.engine.header,org.restlet.engine.util,org.restlet.se
curity",org.restlet.engine.ssl;uses:="javax.net.ssl,org.restlet.data,or
g.restlet.util,org.restlet,org.restlet.engine",org.restlet.engine.util;
uses:="org.restlet.data,org.restlet.engine.io,org.restlet.representatio
n,org.restlet,org.restlet.util,org.restlet.service,org.restlet.engine.l
og,org.w3c.dom.ls,org.xml.sax.helpers,org.xml.sax,org.restlet.engine,or
g.restlet.engine.security,org.restlet.routing",org.restlet.representati
on;uses:="org.restlet.data,org.restlet.engine.io,org.restlet,org.restle
t.util,org.restlet.engine,org.restlet.engine.util",org.restlet.resource
;uses:="org.restlet.representation,org.restlet,org.restlet.util,org.res
tlet.engine,org.restlet.service,org.restlet.data,org.restlet.engine.uti
l,org.restlet.engine.resource,org.restlet.engine.connector,org.restlet.
engine.local,org.restlet.security",org.restlet.routing;uses:="org.restl
et.data,org.restlet.representation,org.restlet,org.restlet.util,org.res
tlet.resource,org.restlet.engine.header",org.restlet.security;uses:="or
g.restlet.routing,org.restlet.data,org.restlet,javax.security.auth.x500
,org.restlet.engine.security,org.restlet.util,org.restlet.engine.util",
org.restlet.service;uses:="org.restlet.data,org.restlet.representation,
org.restlet.engine.application,org.restlet,org.restlet.resource,org.res
tlet.engine.converter,org.restlet.engine,org.restlet.routing,org.restle
t.engine.util,org.restlet.engine.log,org.restlet.engine.resource",org.r
estlet.util;uses:="org.restlet.representation,org.restlet.data,org.rest
let.engine.io,org.restlet,org.restlet.engine.util,org.restlet.routing,o
rg.restlet.service"</Export-Package>
<Import-Package>com.sun.net.httpserver;resolution:=optional,javax.net.ss
l;resolution:=optional,javax.security.auth.x500;resolution:=optional,ja
vax.xml.parsers;resolution:=optional,org.osgi.framework;resolution:=opt
ional,org.w3c.dom;resolution:=optional,org.w3c.dom.ls;resolution:=optio
nal,org.xml.sax;resolution:=optional,org.xml.sax.helpers;resolution:=op
tional</Import-Package>
</instructions>
</artifact>
<artifact>
<id>org.restlet.osgi:org.restlet.ext.servlet:${restlet.version}</id>
<source>true</source>
<transitive>false</transitive>
<override>true</override>
<instructions>
<Bundle-Name>org.restlet.ext.servlet</Bundle-Name>
<Bundle-SymbolicName>org.restlet.ext.servlet</Bundle-SymbolicName>
<Bundle-Version>${restlet.version}</Bundle-Version>
<Export-Package>org.restlet.ext.servlet;uses:="javax.servlet,org.restlet
.ext.osgi,org.restlet,org.osgi.service.log,org.osgi.service.http,org.re
stlet.representation,org.restlet.ext.servlet.internal,org.restlet.util,
org.restlet.engine,org.restlet.engine.adapter,org.restlet.routing,org.r
estlet.service,org.restlet.data,org.restlet.engine.component,javax.serv
let.http",org.restlet.ext.servlet.internal;uses:="javax.servlet,org.res
tlet.data,org.restlet.engine.io,org.restlet.representation,org.restlet,
org.restlet.util,org.restlet.engine.adapter,javax.servlet.http,org.rest
let.engine.connector,org.restlet.service,org.restlet.engine.local"</Export-Package>
<Import-Package>javax.servlet;resolution:=optional,javax.servlet.http;re
solution:=optional,org.osgi.service.http;resolution:=optional,org.osgi.
service.log;resolution:=optional,org.restlet;resolution:=optional,org.r
estlet.data;resolution:=optional,org.restlet.engine;resolution:=optiona
l,org.restlet.engine.adapter;resolution:=optional,org.restlet.engine.co
mponent;resolution:=optional,org.restlet.engine.connector;resolution:=o
ptional,org.restlet.engine.io;resolution:=optional,org.restlet.engine.l
ocal;resolution:=optional,org.restlet.ext.osgi;resolution:=optional,org
.restlet.representation;resolution:=optional,org.restlet.routing;resolu
tion:=optional,org.restlet.service;resolution:=optional,org.restlet.uti
l;resolution:=optional</Import-Package>
<Service-Component>OSGI-INF/*.xml</Service-Component>
</instructions>
</artifact>
</artifacts>
</feature>
<!-- zk public zk osgi on zip format download from sourceforge, so

View File

@ -13,7 +13,7 @@
<unit id="org.eclipse.sdk.tests.feature.group" version="4.10.0.v20181206-1038"/>
<unit id="org.eclipse.swt.tools.feature.feature.group" version="3.107.200.v20181122-0742"/>
<unit id="org.eclipse.test.feature.group" version="3.7.500.v20181114-1814"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.10"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.10"/>
<unit id="org.eclipse.ecf.core.feature.feature.group" version="1.5.3.v20181012-2020"/>
<unit id="org.eclipse.ecf.core.feature.source.feature.group" version="1.5.3.v20181012-2020"/>
<unit id="org.eclipse.ecf.core.ssl.feature.feature.group" version="1.1.100.v20180301-0201"/>
@ -552,10 +552,6 @@
<unit id="org.pushingpixels.trident.source" version="1.2.0.v201305152020"/>
<unit id="org.quartz" version="1.8.3.v20110329-1420"/>
<unit id="org.quartz.source" version="1.8.3.v20110329-1420"/>
<unit id="org.restlet" version="2.0.5.v201605172130"/>
<unit id="org.restlet.ext.servlet" version="2.0.5.v201605172130"/>
<unit id="org.restlet.ext.servlet.source" version="2.0.5.v201605172130"/>
<unit id="org.restlet.source" version="2.0.5.v201605172130"/>
<unit id="org.sat4j.core" version="2.3.5.v201308161310"/>
<unit id="org.sat4j.pb" version="2.3.5.v201404071733"/>
<unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
@ -605,7 +601,7 @@
<unit id="org.yaml.snakeyaml" version="1.14.0.v201604211500"/>
<unit id="scannotation" version="1.0.2.v201205170710"/>
<unit id="scannotation.source" version="1.0.2.v201205170710"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20181128170323/repository"/>
<repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20181128170323/repository"/>
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
<unit id="com.google.gson.source" version="2.8.2.v20180104-1110"/>
<unit id="com.google.guava" version="21.0.0.v20170206-1425"/>
@ -1231,10 +1227,6 @@
<unit id="org.objectweb.asm.util.source" version="7.0.0"/>
<unit id="org.passay" version="1.3.1"/>
<unit id="org.passay.source" version="1.3.1"/>
<unit id="org.restlet" version="2.4.1"/>
<unit id="org.restlet.ext.servlet" version="2.4.1"/>
<unit id="org.restlet.ext.servlet.source" version="2.4.1"/>
<unit id="org.restlet.source" version="2.4.1"/>
<unit id="org.springframework.spring-jcl" version="5.1.1.RELEASE"/>
<unit id="org.springframework.spring-jcl.source" version="5.1.1.RELEASE"/>
<unit id="org.w3c.dom.svg.patch" version="1.1.0.b02"/>

View File

@ -66,7 +66,6 @@
<plugin id="org.idempiere.felix.webconsole" autoStart="true" startLevel="0" />
<plugin id="org.mortbay.jasper.apache-el" autoStart="true" startLevel="0" />
<plugin id="org.mortbay.jasper.apache-jsp" autoStart="true" startLevel="0" />
<plugin id="org.restlet" autoStart="true" startLevel="0" />
<property name="org.eclipse.update.reconcile" value="false" />
<property name="osgi.instance.area.default" value="@config.dir/../workspace" />
<property name="eclipse.product" value="org.adempiere.server.product" />