Search in sources :

Example 1 with RemoteClient

use of lucee.runtime.config.RemoteClient in project Lucee by lucee.

the class Admin method doGetRemoteClient.

private void doGetRemoteClient() throws PageException {
    String url = getString("admin", action, "url");
    RemoteClient[] clients = config.getRemoteClients();
    RemoteClient client;
    for (int i = 0; i < clients.length; i++) {
        client = clients[i];
        if (client.getUrl().equalsIgnoreCase(url)) {
            Struct sct = new StructImpl();
            ProxyData pd = client.getProxyData();
            sct.setEL("label", client.getLabel());
            sct.setEL("usage", client.getUsage());
            sct.setEL("securityKey", client.getSecurityKey());
            sct.setEL("adminPassword", client.getAdminPassword());
            sct.setEL("ServerUsername", client.getServerUsername());
            sct.setEL("ServerPassword", client.getServerPassword());
            sct.setEL("type", client.getType());
            sct.setEL("url", client.getUrl());
            sct.setEL("proxyServer", pd == null ? "" : StringUtil.emptyIfNull(pd.getServer()));
            sct.setEL("proxyUsername", pd == null ? "" : StringUtil.emptyIfNull(pd.getUsername()));
            sct.setEL("proxyPassword", pd == null ? "" : StringUtil.emptyIfNull(pd.getPassword()));
            sct.setEL("proxyPort", pd == null ? "" : (pd.getPort() == -1 ? "" : Caster.toString(pd.getPort())));
            pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
            return;
        }
    }
    throw new ApplicationException("there is no remote client with url [" + url + "]");
}
Also used : StructImpl(lucee.runtime.type.StructImpl) ProxyData(lucee.runtime.net.proxy.ProxyData) ApplicationException(lucee.runtime.exp.ApplicationException) RemoteClient(lucee.runtime.config.RemoteClient) Struct(lucee.runtime.type.Struct)

Example 2 with RemoteClient

use of lucee.runtime.config.RemoteClient in project Lucee by lucee.

the class Admin method doGetRemoteClients.

private void doGetRemoteClients() throws PageException {
    RemoteClient[] clients = config.getRemoteClients();
    RemoteClient client;
    ProxyData pd;
    lucee.runtime.type.Query qry = new QueryImpl(new String[] { "label", "usage", "securityKey", "adminPassword", "serverUsername", "serverPassword", "type", "url", "proxyServer", "proxyUsername", "proxyPassword", "proxyPort" }, clients.length, "query");
    int row = 0;
    for (int i = 0; i < clients.length; i++) {
        client = clients[i];
        pd = client.getProxyData();
        row = i + 1;
        qry.setAt("label", row, client.getLabel());
        qry.setAt("usage", row, client.getUsage());
        qry.setAt("securityKey", row, client.getSecurityKey());
        qry.setAt("adminPassword", row, client.getAdminPassword());
        qry.setAt("ServerUsername", row, client.getServerUsername());
        qry.setAt("ServerPassword", row, client.getServerPassword());
        qry.setAt("type", row, client.getType());
        qry.setAt("url", row, client.getUrl());
        qry.setAt("proxyServer", row, pd == null ? "" : pd.getServer());
        qry.setAt("proxyUsername", row, pd == null ? "" : pd.getUsername());
        qry.setAt("proxyPassword", row, pd == null ? "" : pd.getPassword());
        qry.setAt("proxyPort", row, pd == null ? "" : Caster.toString(pd.getPort()));
    }
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
}
Also used : QueryImpl(lucee.runtime.type.QueryImpl) ProxyData(lucee.runtime.net.proxy.ProxyData) RemoteClient(lucee.runtime.config.RemoteClient) Query(lucee.runtime.type.Query)

Example 3 with RemoteClient

use of lucee.runtime.config.RemoteClient in project Lucee by lucee.

the class Admin method doVerifyRemoteClient.

private void doVerifyRemoteClient() throws PageException {
    // SNSN
    /*
		 * SerialNumber sn = config.getSerialNumber(); if(sn.getVersion()==SerialNumber.VERSION_COMMUNITY) throw new
		 * SecurityException("can not verify remote client with "+sn.getStringVersion()+" version of Lucee");
		 */
    ProxyData pd = null;
    String proxyServer = getString("proxyServer", null);
    if (!StringUtil.isEmpty(proxyServer)) {
        String proxyUsername = getString("proxyUsername", null);
        String proxyPassword = getString("proxyPassword", null);
        int proxyPort = getInt("proxyPort", -1);
        pd = new ProxyDataImpl();
        pd.setServer(proxyServer);
        if (!StringUtil.isEmpty(proxyUsername))
            pd.setUsername(proxyUsername);
        if (!StringUtil.isEmpty(proxyPassword))
            pd.setPassword(proxyPassword);
        if (proxyPort != -1)
            pd.setPort(proxyPort);
    }
    RemoteClient client = new RemoteClientImpl(getString("admin", action, "label"), type == TYPE_WEB ? "web" : "server", getString("admin", action, "url"), getString("serverUsername", null), getString("serverPassword", null), getString("admin", action, "adminPassword"), pd, getString("admin", action, "securityKey"), getString("admin", action, "usage"));
    Struct attrColl = new StructImpl();
    attrColl.setEL("action", "connect");
    try {
        new RemoteClientTask(null, client, attrColl, getCallerId(), "synchronisation").execute(config);
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
        throw Caster.toPageException(t);
    }
}
Also used : ProxyData(lucee.runtime.net.proxy.ProxyData) StructImpl(lucee.runtime.type.StructImpl) RemoteClientImpl(lucee.runtime.config.RemoteClientImpl) RemoteClient(lucee.runtime.config.RemoteClient) ProxyDataImpl(lucee.runtime.net.proxy.ProxyDataImpl) Struct(lucee.runtime.type.Struct) RemoteClientTask(lucee.runtime.spooler.remote.RemoteClientTask)

Aggregations

RemoteClient (lucee.runtime.config.RemoteClient)3 ProxyData (lucee.runtime.net.proxy.ProxyData)3 Struct (lucee.runtime.type.Struct)2 StructImpl (lucee.runtime.type.StructImpl)2 RemoteClientImpl (lucee.runtime.config.RemoteClientImpl)1 ApplicationException (lucee.runtime.exp.ApplicationException)1 ProxyDataImpl (lucee.runtime.net.proxy.ProxyDataImpl)1 RemoteClientTask (lucee.runtime.spooler.remote.RemoteClientTask)1 Query (lucee.runtime.type.Query)1 QueryImpl (lucee.runtime.type.QueryImpl)1