From 3cc17d25fd29e7409b6f1224591d57ffe80e9179 Mon Sep 17 00:00:00 2001 From: hengsin Date: Wed, 29 Jan 2020 08:00:36 +0800 Subject: [PATCH] IDEMPIERE-4158 Move Swing Client out of core. Drop restlet dependency, drop webstart and applet stuffs and some minor dependency adjustments. --- org.adempiere.base-feature/feature.xml | 23 +- .../model.generator.launch | 5 - .../packinfolder.app.launch | 5 - .../sign.database.build.launch | 5 - .../synchronize-terminology.app.launch | 5 - .../translation.app.launch | 5 - org.adempiere.base/META-INF/MANIFEST.MF | 6 +- .../src/org/adempiere/util/RestletUtil.java | 68 --- .../src/org/compiere/Adempiere.java | 43 +- .../src/org/compiere/db/CConnection.java | 190 +------- .../src/org/compiere/util/CLogMgt.java | 12 - .../src/org/compiere/util/Env.java | 2 - .../feature.xml | 14 - org.adempiere.extend/SamplePluginTest.launch | 101 ++++- org.adempiere.install/install.app.launch | 1 - .../install.console.app.launch | 1 - org.adempiere.server-feature/feature.xml | 7 - org.adempiere.server-feature/server.product | 1 - .../server.product.functionaltest.launch | 407 +++++++++++++++++- .../server.product.launch | 5 - .../setup/configuration/config.ini | 1 - org.adempiere.server/META-INF/MANIFEST.MF | 10 - org.adempiere.server/WEB-INF/web.xml | 9 - org.adempiere.server/adempiere.jnlp | 31 -- org.adempiere.server/applet.html | 81 ---- org.adempiere.server/build.properties | 2 - .../adempiere/web/server/BasicVerifier.java | 83 ---- .../web/server/ServerApplication.java | 68 --- .../server/command/ExecuteProcessCommand.java | 80 ---- .../server/command/ExecuteTaskCommand.java | 71 --- .../command/ExecuteWorkflowCommand.java | 74 ---- .../server/command/PostDocumentCommand.java | 72 ---- .../web/server/command/ResetCacheCommand.java | 66 --- .../web/server/command/SendEmailCommand.java | 66 --- .../web/server/status/DatabaseResource.java | 53 --- .../web/server/status/VersionResource.java | 36 -- org.adempiere.ui.swing-feature/feature.xml | 7 - .../swingclient.product | 2 - .../swingclient.product.launch | 2 - org.adempiere.ui.swing/META-INF/MANIFEST.MF | 4 - .../OSGI-INF/serverinterface.xml | 8 - .../OSGI-INF/statusinterface.xml | 8 - org.adempiere.ui.swing/build.properties | 8 - .../src/org/adempiere/client/Application.java | 29 -- .../client/ClientSSLContextFactory.java | 234 ---------- .../org/adempiere/client/ServerInterface.java | 208 --------- .../org/adempiere/client/StatusInterface.java | 191 -------- .../src/org/compiere/AdempiereClient.java | 2 +- .../src/org/compiere/apps/AApplet.java | 94 ---- .../src/org/compiere/apps/AEnv.java | 63 +-- .../src/org/compiere/apps/ALogin.java | 11 +- .../src/org/compiere/apps/AMenu.java | 3 - .../src/org/compiere/apps/AStart.html | 26 -- .../src/org/compiere/apps/AStart.java | 153 ------- .../org/compiere/db/CConnectionDialog.java | 99 +---- .../org/compiere/db/CConnectionEditor.java | 13 +- .../org.idempiere.maven.to.p2/pom.xml | 128 ------ .../org.idempiere.p2.targetplatform.target | 12 +- org.idempiere.p2/server.product | 1 - 59 files changed, 546 insertions(+), 2469 deletions(-) delete mode 100644 org.adempiere.base/src/org/adempiere/util/RestletUtil.java delete mode 100644 org.adempiere.server/adempiere.jnlp delete mode 100644 org.adempiere.server/applet.html delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/BasicVerifier.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/ServerApplication.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteProcessCommand.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteTaskCommand.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteWorkflowCommand.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/PostDocumentCommand.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ResetCacheCommand.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/SendEmailCommand.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/status/DatabaseResource.java delete mode 100644 org.adempiere.server/src/main/servlet/org/adempiere/web/server/status/VersionResource.java delete mode 100644 org.adempiere.ui.swing/OSGI-INF/serverinterface.xml delete mode 100644 org.adempiere.ui.swing/OSGI-INF/statusinterface.xml delete mode 100644 org.adempiere.ui.swing/src/org/adempiere/client/ClientSSLContextFactory.java delete mode 100644 org.adempiere.ui.swing/src/org/adempiere/client/ServerInterface.java delete mode 100644 org.adempiere.ui.swing/src/org/adempiere/client/StatusInterface.java delete mode 100644 org.adempiere.ui.swing/src/org/compiere/apps/AApplet.java delete mode 100644 org.adempiere.ui.swing/src/org/compiere/apps/AStart.html delete mode 100644 org.adempiere.ui.swing/src/org/compiere/apps/AStart.java diff --git a/org.adempiere.base-feature/feature.xml b/org.adempiere.base-feature/feature.xml index e2e6a1a678..d230b1a229 100644 --- a/org.adempiere.base-feature/feature.xml +++ b/org.adempiere.base-feature/feature.xml @@ -84,13 +84,6 @@ version="0.0.0" unpack="false"/> - - - - + + diff --git a/org.adempiere.base-feature/model.generator.launch b/org.adempiere.base-feature/model.generator.launch index 8db609cfd0..c95a37a99c 100644 --- a/org.adempiere.base-feature/model.generator.launch +++ b/org.adempiere.base-feature/model.generator.launch @@ -69,7 +69,6 @@ - @@ -350,10 +349,6 @@ - - - - diff --git a/org.adempiere.base-feature/packinfolder.app.launch b/org.adempiere.base-feature/packinfolder.app.launch index a85a1127de..ca907cacac 100644 --- a/org.adempiere.base-feature/packinfolder.app.launch +++ b/org.adempiere.base-feature/packinfolder.app.launch @@ -69,7 +69,6 @@ - @@ -350,10 +349,6 @@ - - - - diff --git a/org.adempiere.base-feature/sign.database.build.launch b/org.adempiere.base-feature/sign.database.build.launch index d22d6b511b..6971021d42 100644 --- a/org.adempiere.base-feature/sign.database.build.launch +++ b/org.adempiere.base-feature/sign.database.build.launch @@ -69,7 +69,6 @@ - @@ -350,10 +349,6 @@ - - - - diff --git a/org.adempiere.base-feature/synchronize-terminology.app.launch b/org.adempiere.base-feature/synchronize-terminology.app.launch index ca840c8b91..ac69cdc620 100644 --- a/org.adempiere.base-feature/synchronize-terminology.app.launch +++ b/org.adempiere.base-feature/synchronize-terminology.app.launch @@ -69,7 +69,6 @@ - @@ -350,10 +349,6 @@ - - - - diff --git a/org.adempiere.base-feature/translation.app.launch b/org.adempiere.base-feature/translation.app.launch index 2b76579701..f132adff2d 100644 --- a/org.adempiere.base-feature/translation.app.launch +++ b/org.adempiere.base-feature/translation.app.launch @@ -69,7 +69,6 @@ - @@ -350,10 +349,6 @@ - - - - diff --git a/org.adempiere.base/META-INF/MANIFEST.MF b/org.adempiere.base/META-INF/MANIFEST.MF index fb14b14cfe..a160efbdc7 100644 --- a/org.adempiere.base/META-INF/MANIFEST.MF +++ b/org.adempiere.base/META-INF/MANIFEST.MF @@ -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 diff --git a/org.adempiere.base/src/org/adempiere/util/RestletUtil.java b/org.adempiere.base/src/org/adempiere/util/RestletUtil.java deleted file mode 100644 index dec3fc5b68..0000000000 --- a/org.adempiere.base/src/org/adempiere/util/RestletUtil.java +++ /dev/null @@ -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 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; - } - } - } -} diff --git a/org.adempiere.base/src/org/compiere/Adempiere.java b/org.adempiere.base/src/org/compiere/Adempiere.java index 900d7e2d50..087ea37d2f 100644 --- a/org.adempiere.base/src/org/compiere/Adempiere.java +++ b/org.adempiere.base/src/org/compiere/Adempiere.java @@ -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(); diff --git a/org.adempiere.base/src/org/compiere/db/CConnection.java b/org.adempiere.base/src/org/compiere/db/CConnection.java index 9caa67a486..5b7f674c45 100644 --- a/org.adempiere.base/src/org/compiere/db/CConnection.java +++ b/org.adempiere.base/src/org/compiere/db/CConnection.java @@ -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 ""; } // 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(); diff --git a/org.adempiere.base/src/org/compiere/util/CLogMgt.java b/org.adempiere.base/src/org/compiere/util/CLogMgt.java index 21595fd9be..54a5d5a6d2 100644 --- a/org.adempiere.base/src/org/compiere/util/CLogMgt.java +++ b/org.adempiere.base/src/org/compiere/util/CLogMgt.java @@ -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 diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index 0ef171534c..52a35e5284 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -164,8 +164,6 @@ public final class Env // reset(true); // final cache reset // - - CConnection.get().setAppServerCredential(null, null); } /** diff --git a/org.adempiere.bundles.external-feature/feature.xml b/org.adempiere.bundles.external-feature/feature.xml index 97a2bfeec3..d039b6072c 100644 --- a/org.adempiere.bundles.external-feature/feature.xml +++ b/org.adempiere.bundles.external-feature/feature.xml @@ -73,20 +73,6 @@ version="0.0.0" unpack="false"/> - - - - + @@ -33,8 +34,104 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.adempiere.install/install.app.launch b/org.adempiere.install/install.app.launch index 1cd00696ca..563dd399d9 100644 --- a/org.adempiere.install/install.app.launch +++ b/org.adempiere.install/install.app.launch @@ -83,7 +83,6 @@ - diff --git a/org.adempiere.install/install.console.app.launch b/org.adempiere.install/install.console.app.launch index cf0d1bb9ca..4bc41e75a7 100644 --- a/org.adempiere.install/install.console.app.launch +++ b/org.adempiere.install/install.console.app.launch @@ -83,7 +83,6 @@ - diff --git a/org.adempiere.server-feature/feature.xml b/org.adempiere.server-feature/feature.xml index 22daf07761..7237430302 100644 --- a/org.adempiere.server-feature/feature.xml +++ b/org.adempiere.server-feature/feature.xml @@ -97,13 +97,6 @@ version="0.0.0" unpack="false"/> - - - diff --git a/org.adempiere.server-feature/server.product.functionaltest.launch b/org.adempiere.server-feature/server.product.functionaltest.launch index 37cb82db23..19135892cf 100644 --- a/org.adempiere.server-feature/server.product.functionaltest.launch +++ b/org.adempiere.server-feature/server.product.functionaltest.launch @@ -12,6 +12,7 @@ + @@ -27,8 +28,410 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.adempiere.server-feature/server.product.launch b/org.adempiere.server-feature/server.product.launch index 23452e429f..0c5c3e522c 100644 --- a/org.adempiere.server-feature/server.product.launch +++ b/org.adempiere.server-feature/server.product.launch @@ -83,7 +83,6 @@ - @@ -377,10 +376,6 @@ - - - - diff --git a/org.adempiere.server-feature/setup/configuration/config.ini b/org.adempiere.server-feature/setup/configuration/config.ini index a945a57992..1e1be726ac 100644 --- a/org.adempiere.server-feature/setup/configuration/config.ini +++ b/org.adempiere.server-feature/setup/configuration/config.ini @@ -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,\ diff --git a/org.adempiere.server/META-INF/MANIFEST.MF b/org.adempiere.server/META-INF/MANIFEST.MF index e49ba8bdc1..ddf90d094b 100644 --- a/org.adempiere.server/META-INF/MANIFEST.MF +++ b/org.adempiere.server/META-INF/MANIFEST.MF @@ -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, diff --git a/org.adempiere.server/WEB-INF/web.xml b/org.adempiere.server/WEB-INF/web.xml index 4e0ea919e4..286d826c1f 100644 --- a/org.adempiere.server/WEB-INF/web.xml +++ b/org.adempiere.server/WEB-INF/web.xml @@ -45,15 +45,6 @@ org.compiere.web.AdempiereMonitor 1 - - default org.eclipse.jetty.servlet.DefaultServlet diff --git a/org.adempiere.server/adempiere.jnlp b/org.adempiere.server/adempiere.jnlp deleted file mode 100644 index 414310cb0c..0000000000 --- a/org.adempiere.server/adempiere.jnlp +++ /dev/null @@ -1,31 +0,0 @@ - - - - Adempiere Client 3.6.0LTS $$context - ADempiere, Inc. - - - Adempiere ERP+CRM ($$context) - Smart Business Solution for Distribution and Service - globally - Adempiere ERP+CRM ($$context) - Adempiere ERP+CRM - Adempiere ERP+CRM ($$context) - - - - - - - - - - - - - - - - - - diff --git a/org.adempiere.server/applet.html b/org.adempiere.server/applet.html deleted file mode 100644 index a8e6c377af..0000000000 --- a/org.adempiere.server/applet.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - -ADempiere Client Applet Start - - - - -

ADempiere Client Applet Start

-

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.
-Applet Start Details -

-

After the ADempiere Client started DO NOT close/use this window as that will crash the application!

- - - - - - - - - - - - - -
Microsoft IE
- - - - - - Internet Explorer: No Java 2 SDK, Standard Edition v 1.5.0 support for APPLET - -
- Non IE Browsers
- - - -
Browsers supporting the EMBED tag
- Code commented out - modify source if required!
- -
Browsers supporting the APPLET tag
- Code commented out - modify source if required!
- -
-

 

- - diff --git a/org.adempiere.server/build.properties b/org.adempiere.server/build.properties index a975cce5e8..91b25bf9d3 100644 --- a/org.adempiere.server/build.properties +++ b/org.adempiere.server/build.properties @@ -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,\ diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/BasicVerifier.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/BasicVerifier.java deleted file mode 100644 index b02627e4f8..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/BasicVerifier.java +++ /dev/null @@ -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; - } - -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/ServerApplication.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/ServerApplication.java deleted file mode 100644 index d1906c99c3..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/ServerApplication.java +++ /dev/null @@ -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; - } -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteProcessCommand.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteProcessCommand.java deleted file mode 100644 index 4263ae8988..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteProcessCommand.java +++ /dev/null @@ -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 map = RestletUtil.toObject(entity); - return new ObjectRepresentation(accept(map)); - } catch (Exception e) { - throw new AdempiereException(e); - } - } - - @Override - public boolean isNegotiated() { - return false; - } - - private ProcessInfo accept(HashMap 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(); - } - } - -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteTaskCommand.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteTaskCommand.java deleted file mode 100644 index a3cf5b482c..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteTaskCommand.java +++ /dev/null @@ -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 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 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(); - } - } -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteWorkflowCommand.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteWorkflowCommand.java deleted file mode 100644 index f4f477b9a8..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ExecuteWorkflowCommand.java +++ /dev/null @@ -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 map = RestletUtil.toObject(entity); - return new ObjectRepresentation(accept(map)); - } catch (Exception e) { - throw new AdempiereException(e); - } - } - - @Override - public boolean isNegotiated() { - return false; - } - - private ProcessInfo accept(HashMap 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(); - } - } -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/PostDocumentCommand.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/PostDocumentCommand.java deleted file mode 100644 index 71a2302f59..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/PostDocumentCommand.java +++ /dev/null @@ -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 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 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; - } -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ResetCacheCommand.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ResetCacheCommand.java deleted file mode 100644 index 97348990bc..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/ResetCacheCommand.java +++ /dev/null @@ -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 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 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(); - } - } -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/SendEmailCommand.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/SendEmailCommand.java deleted file mode 100644 index 6d62bfe1a4..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/command/SendEmailCommand.java +++ /dev/null @@ -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 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 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(); - } - } -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/status/DatabaseResource.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/status/DatabaseResource.java deleted file mode 100644 index b97b14fd35..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/status/DatabaseResource.java +++ /dev/null @@ -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 : ""; - } - -} diff --git a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/status/VersionResource.java b/org.adempiere.server/src/main/servlet/org/adempiere/web/server/status/VersionResource.java deleted file mode 100644 index 10701a555d..0000000000 --- a/org.adempiere.server/src/main/servlet/org/adempiere/web/server/status/VersionResource.java +++ /dev/null @@ -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 ""; - } -} diff --git a/org.adempiere.ui.swing-feature/feature.xml b/org.adempiere.ui.swing-feature/feature.xml index 86067572d9..d06a8d0983 100644 --- a/org.adempiere.ui.swing-feature/feature.xml +++ b/org.adempiere.ui.swing-feature/feature.xml @@ -34,13 +34,6 @@ install-size="0" version="0.0.0"/> - - - - diff --git a/org.adempiere.ui.swing-feature/swingclient.product.launch b/org.adempiere.ui.swing-feature/swingclient.product.launch index c90170e1cf..cb6b9cfd31 100644 --- a/org.adempiere.ui.swing-feature/swingclient.product.launch +++ b/org.adempiere.ui.swing-feature/swingclient.product.launch @@ -368,8 +368,6 @@ - - diff --git a/org.adempiere.ui.swing/META-INF/MANIFEST.MF b/org.adempiere.ui.swing/META-INF/MANIFEST.MF index fefd6b093e..be74ae4112 100644 --- a/org.adempiere.ui.swing/META-INF/MANIFEST.MF +++ b/org.adempiere.ui.swing/META-INF/MANIFEST.MF @@ -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", diff --git a/org.adempiere.ui.swing/OSGI-INF/serverinterface.xml b/org.adempiere.ui.swing/OSGI-INF/serverinterface.xml deleted file mode 100644 index 6b37644416..0000000000 --- a/org.adempiere.ui.swing/OSGI-INF/serverinterface.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/org.adempiere.ui.swing/OSGI-INF/statusinterface.xml b/org.adempiere.ui.swing/OSGI-INF/statusinterface.xml deleted file mode 100644 index e69803a13c..0000000000 --- a/org.adempiere.ui.swing/OSGI-INF/statusinterface.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/org.adempiere.ui.swing/build.properties b/org.adempiere.ui.swing/build.properties index 45f7c5e18a..1fa0422790 100644 --- a/org.adempiere.ui.swing/build.properties +++ b/org.adempiere.ui.swing/build.properties @@ -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,\ diff --git a/org.adempiere.ui.swing/src/org/adempiere/client/Application.java b/org.adempiere.ui.swing/src/org/adempiere/client/Application.java index 9cc3b5f1b0..951e3c24fc 100644 --- a/org.adempiere.ui.swing/src/org/adempiere/client/Application.java +++ b/org.adempiere.ui.swing/src/org/adempiere/client/Application.java @@ -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 list = new ArrayList(); - 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; diff --git a/org.adempiere.ui.swing/src/org/adempiere/client/ClientSSLContextFactory.java b/org.adempiere.ui.swing/src/org/adempiere/client/ClientSSLContextFactory.java deleted file mode 100644 index 078299a515..0000000000 --- a/org.adempiere.ui.swing/src/org/adempiere/client/ClientSSLContextFactory.java +++ /dev/null @@ -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 keyStorePath, - * keyStoreProvider, keyStoreType are all - * null, the SSLContext will be initialised with a - * null array of KeyManagers. Similarly, if - * trustStorePath, trustStoreProvider, - * trustStoreType are all null, a - * null array of TrustManagers 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; - } - -} diff --git a/org.adempiere.ui.swing/src/org/adempiere/client/ServerInterface.java b/org.adempiere.ui.swing/src/org/adempiere/client/ServerInterface.java deleted file mode 100644 index 761693c172..0000000000 --- a/org.adempiere.ui.swing/src/org/adempiere/client/ServerInterface.java +++ /dev/null @@ -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 map = new HashMap(); - 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> entity = new ObjectRepresentation>(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 map = new HashMap(); - 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 entity = new ObjectRepresentation(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 map = new HashMap(); - 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> entity = new ObjectRepresentation>(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 map = new HashMap(); - 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> entity = new ObjectRepresentation>(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 map = new HashMap(); - 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> entity = new ObjectRepresentation>(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 map = new HashMap(); - 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> entity = new ObjectRepresentation>(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 map = new HashMap(); - 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> entity = new ObjectRepresentation>(map); - Representation response = resource.post(entity); - ProcessInfo responseInfo = RestletUtil.toObject(response); - return responseInfo; - } catch (Exception e) { - throw new AdempiereException(e); - } - } - -} diff --git a/org.adempiere.ui.swing/src/org/adempiere/client/StatusInterface.java b/org.adempiere.ui.swing/src/org/adempiere/client/StatusInterface.java deleted file mode 100644 index a9e76d6ba1..0000000000 --- a/org.adempiere.ui.swing/src/org/adempiere/client/StatusInterface.java +++ /dev/null @@ -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); - } - } -} diff --git a/org.adempiere.ui.swing/src/org/compiere/AdempiereClient.java b/org.adempiere.ui.swing/src/org/compiere/AdempiereClient.java index de0703ca57..6480138ef2 100644 --- a/org.adempiere.ui.swing/src/org/compiere/AdempiereClient.java +++ b/org.adempiere.ui.swing/src/org/compiere/AdempiereClient.java @@ -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 diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AApplet.java b/org.adempiere.ui.swing/src/org/compiere/apps/AApplet.java deleted file mode 100644 index bd872c4386..0000000000 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AApplet.java +++ /dev/null @@ -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 diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java b/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java index 6294326000..1b102e809b 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AEnv.java @@ -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 /** diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java b/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java index d0a88fddd5..1e720e6f11 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java @@ -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(); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java index 62934fb15a..b0ea2a3932 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AMenu.java @@ -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); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AStart.html b/org.adempiere.ui.swing/src/org/compiere/apps/AStart.html deleted file mode 100644 index 204c06934f..0000000000 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AStart.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - -Start Applet - - - - -com.accorto.apps.AStart will appear below in a Java enabled browser.
- - - - - - diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AStart.java b/org.adempiere.ui.swing/src/org/compiere/apps/AStart.java deleted file mode 100644 index 9d1779eeef..0000000000 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AStart.java +++ /dev/null @@ -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 diff --git a/org.adempiere.ui.swing/src/org/compiere/db/CConnectionDialog.java b/org.adempiere.ui.swing/src/org/compiere/db/CConnectionDialog.java index 69cbd98dff..b6b3b0d842 100644 --- a/org.adempiere.ui.swing/src/org/compiere/db/CConnectionDialog.java +++ b/org.adempiere.ui.swing/src/org/compiere/db/CConnectionDialog.java @@ -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 dbTypeField = new CComboBox(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; } diff --git a/org.adempiere.ui.swing/src/org/compiere/db/CConnectionEditor.java b/org.adempiere.ui.swing/src/org/compiere/db/CConnectionEditor.java index 917460a454..f9c48710bf 100644 --- a/org.adempiere.ui.swing/src/org/compiere/db/CConnectionEditor.java +++ b/org.adempiere.ui.swing/src/org/compiere/db/CConnectionEditor.java @@ -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()); } diff --git a/org.idempiere.maven.to.p2/org.idempiere.maven.to.p2/pom.xml b/org.idempiere.maven.to.p2/org.idempiere.maven.to.p2/pom.xml index e9a2237ffc..128bb8106a 100644 --- a/org.idempiere.maven.to.p2/org.idempiere.maven.to.p2/pom.xml +++ b/org.idempiere.maven.to.p2/org.idempiere.maven.to.p2/pom.xml @@ -32,7 +32,6 @@ 1.2.1 1.3.3 7.0 - 2.4.1 1.6.3 4.1.0 @@ -52,10 +51,6 @@ zkoss https://mavensync.zkoss.org/maven2 - - restlet-maven - https://maven.restlet.com - @@ -794,129 +789,6 @@ true false - - org.restlet.osgi:org.restlet:${restlet.version} - true - false - true - - - org.restlet.engine.internal.Activator - org.restlet - org.restlet - ${restlet.version} - 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" - 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 - - - - org.restlet.osgi:org.restlet.ext.servlet:${restlet.version} - true - false - true - - org.restlet.ext.servlet - org.restlet.ext.servlet - ${restlet.version} - 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" - 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 - OSGI-INF/*.xml - -