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 - - |
-
- 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
keyStorePath
,
- * keyStoreProvider
, keyStoreType
are all
- * null
, the SSLContext will be initialised with a
- * null array of KeyManager
s. Similarly, if
- * trustStorePath
, trustStoreProvider
,
- * trustStoreType
are all null
, a
- * null
array of TrustManager
s will be used.
- *
- * @see SSLContext#init(javax.net.ssl.KeyManager[],
- * javax.net.ssl.TrustManager[], SecureRandom)
- */
- @Override
- public SSLContext createSslContext() throws Exception {
-
- KeyManagerFactory kmf = null;
- if ((this.keyStorePath != null) || (this.keyStoreProvider != null)
- || (this.keyStoreType != null)) {
- /*
- * Loads the key store.
- */
- final KeyStore keyStore = (this.keyStoreProvider != null) ? KeyStore
- .getInstance(
- (this.keyStoreType != null) ? this.keyStoreType
- : KeyStore.getDefaultType(),
- this.keyStoreProvider)
- : KeyStore
- .getInstance((this.keyStoreType != null) ? this.keyStoreType
- : KeyStore.getDefaultType());
- FileInputStream keyStoreInputStream = null;
- try {
- keyStoreInputStream = ((this.keyStorePath != null) && (!"NONE"
- .equals(this.keyStorePath))) ? new FileInputStream(
- this.keyStorePath) : null;
- keyStore.load(keyStoreInputStream, this.keyStorePassword);
- } finally {
- if (keyStoreInputStream != null) {
- keyStoreInputStream.close();
- }
- }
-
- /*
- * Creates the key-manager factory.
- */
- kmf = KeyManagerFactory.getInstance(this.keyManagerAlgorithm);
- kmf.init(keyStore, this.keyStoreKeyPassword);
- }
-
- TrustManagerFactory tmf = null;
- if ((this.trustStorePath != null) || (this.trustStoreProvider != null)
- || (this.trustStoreType != null)) {
- /*
- * Loads the trust store.
- */
- final KeyStore trustStore = (this.trustStoreProvider != null) ? KeyStore
- .getInstance(
- (this.trustStoreType != null) ? this.trustStoreType
- : KeyStore.getDefaultType(),
- this.trustStoreProvider)
- : KeyStore
- .getInstance((this.trustStoreType != null) ? this.trustStoreType
- : KeyStore.getDefaultType());
-
- FileInputStream trustStoreInputStream = null;
- try {
- trustStoreInputStream = ((this.trustStorePath != null) && (!"NONE"
- .equals(this.trustStorePath))) ? new FileInputStream(
- this.trustStorePath) : null;
- trustStore.load(trustStoreInputStream, this.trustStorePassword);
- } finally {
- if (trustStoreInputStream != null) {
- trustStoreInputStream.close();
- }
- }
-
- /*
- * Creates the trust-manager factory.
- */
- tmf = TrustManagerFactory.getInstance(this.trustManagerAlgorithm);
- tmf.init(trustStore);
- }
-
- TrustManager[] trustManagers = null;
- if (tmf != null) {
- trustManagers = tmf.getTrustManagers();
- } else {
- trustManagers = new TrustManager[]{
- new X509TrustManager() {
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- public void checkClientTrusted(
- java.security.cert.X509Certificate[] certs, String authType) {
- }
- public void checkServerTrusted(
- java.security.cert.X509Certificate[] certs, String authType) {
- }
- }
- };
- }
- /*
- * Creates the SSLContext.
- */
- final SSLContext sslContext = SSLContext
- .getInstance(this.secureSocketProtocol);
- SecureRandom sr = null;
- if (this.secureRandomAlgorithm != null) {
- sr = SecureRandom.getInstance(this.secureRandomAlgorithm);
- }
- sslContext.init(kmf != null ? kmf.getKeyManagers() : null, trustManagers, sr);
-
- return sslContext;
- }
-
-}
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