Examples of ContextKey


Examples of ass3.program.core.ChatterContext.ContextKey

  }

  public ContextKey getContextKey() {
    try {
      if (null == ck) {
        ck = new ContextKey(
            InetAddress.getLocalHost().getHostAddress(), this.ip);
      }
      return ck;
    } catch (UnknownHostException e) {
      throw new RuntimeException(e);
View Full Code Here

Examples of ass3.program.core.ChatterContext.ContextKey

    }
    clearLock(clazz);
  }

  public void sendText(String message) {
    ContextKey ck = getContextKey();
    switch (clientState.getCurrentState()) {
    case INIT:
      // Allow the user to indicate bit-length
      send(new PublicKeyRequest(ck.getA(), ck.getB(),
          ConfigLoader.loadInt("key", "ELGAMAL_BITLENGTH")));
      waitForResponse(PublicKeyResponse.class);
      sendText(message);
      break;
    case PUBLIC_KEY_RECEIVED:
      // Allow user to indicate shared key
      send(new ExchSharedKeyRequest(ck.getA(), ck.getB(), ConfigLoader
          .load("key", "AES_KEY").getBytes()));
      waitForResponse(ExchSharedKeyResponse.class);
      sendText(message);
      break;
    case SHARED_KEY_EXCHANGED:
      send(new SendTextRequest(ck.getA(), ck.getB(), message));
      waitForResponse(SendTextResponse.class);
      // Check self state to determine whether need to resend
      if (!(clientState.getCurrentState() == CState.SHARED_KEY_EXCHANGED)) {
        // Error encountered, Resend
        sendText(message);
View Full Code Here

Examples of ass3.program.core.ChatterContext.ContextKey

    super();
  }

  public Message(String from, String to) {
    super();
    this.ck = new ContextKey(from, to);
  }
View Full Code Here

Examples of com.adito.boot.ContextKey

     * @see com.adito.wizard.forms.AbstractWizardForm#init(com.adito.wizard.AbstractWizardSequence)
     */
    public void init(AbstractWizardSequence sequence, HttpServletRequest request) throws Exception {
        try {
            if(sequence.getAttribute(ATTR_SOCKS_PROXY_HOSTNAME, null) == null) {
                socksProxyHostname = Property.getProperty(new ContextKey("proxies.socksProxyHost"));
                if(socksProxyHostname.equals("")) {
                    socksProxyUsername = "";
                    socksProxyPort = "";
                    socksProxyPassword = "";
                }
                else {
                    useSOCKSProxy = true;
                    socksProxyUsername = Property.getProperty(new ContextKey("proxies.socksProxyUser"));
                    socksProxyPassword = Property.getProperty(new ContextKey("proxies.socksProxyPassword"));
                    socksProxyPort = Property.getProperty(new ContextKey("proxies.socksProxyPort"));
                }                   
            }
            else {
                useSOCKSProxy = ((String)sequence.getAttribute(ATTR_USE_SOCKS_PROXY,
                    String.valueOf(Property.getProperty(new ContextKey("webServer.port"))))).equals("true");
                socksProxyHostname = (String)sequence.getAttribute(ATTR_SOCKS_PROXY_HOSTNAME, "");
                socksProxyPort = (String)sequence.getAttribute(ATTR_SOCKS_PROXY_PORT, "");
                socksProxyUsername = (String)sequence.getAttribute(ATTR_SOCKS_PROXY_USERNAME, "");
                socksProxyPassword = (String)sequence.getAttribute(ATTR_SOCKS_PROXY_PASSWORD, "");
            }

            if(sequence.getAttribute(ATTR_HTTP_PROXY_HOSTNAME, null) == null) {
                httpProxyHostname = Property.getProperty(new ContextKey("proxies.http.proxyHost"));
                httpNonProxyHosts = Property.getPropertyList(new ContextKey("proxies.http.nonProxyHosts"));
                if(httpProxyHostname.equals("")) {
                    httpProxyUsername = "";
                    httpProxyPort = "";
                    httpProxyPassword = "";
                    httpNonProxyHosts.clear();
                }
                else {
                    useHTTPProxy = true;
                    httpProxyUsername = Property.getProperty(new ContextKey("proxies.http.proxyUser"));
                    httpProxyPassword = Property.getProperty(new ContextKey("proxies.http.proxyPassword"));
                    httpProxyPort = Property.getProperty(new ContextKey("proxies.http.proxyPort"));
                }                   
            }
            else {
                useHTTPProxy = ((String)sequence.getAttribute(ATTR_USE_HTTP_PROXY,
                    String.valueOf(Property.getPropertyBoolean(new ContextKey("webServer.port"))))).equals("true");
                httpProxyHostname = (String)sequence.getAttribute(ATTR_HTTP_PROXY_HOSTNAME, "");
                httpProxyPort = (String)sequence.getAttribute(ATTR_HTTP_PROXY_PORT, "");
                httpProxyUsername = (String)sequence.getAttribute(ATTR_HTTP_PROXY_USERNAME, "");
                httpProxyPassword = (String)sequence.getAttribute(ATTR_HTTP_PROXY_PASSWORD, "");
                httpNonProxyHosts = (PropertyList)sequence.getAttribute(ATTR_HTTP_NON_PROXY_HOSTS, null);
View Full Code Here

Examples of com.adito.boot.ContextKey

     * @see com.adito.wizard.forms.AbstractWizardForm#init(com.adito.wizard.AbstractWizardSequence,
     *      javax.servlet.http.HttpServletRequest)
     */
    public void init(AbstractWizardSequence sequence, HttpServletRequest request) throws Exception {
        try {
            port = (String) sequence.getAttribute(ATTR_WEB_SERVER_PORT, Property.getProperty(new ContextKey("webServer.port")));
            protocol = (String) sequence.getAttribute(ATTR_WEB_SERVER_PROTOCOL, Property.getProperty(new ContextKey(
                            "webServer.protocol")));
            listeningInterfaces = (String) sequence.getAttribute(ATTR_LISTENING_INTERFACES, Property.getProperty(new ContextKey(
                            "webServer.bindAddress")));
            String validExternalHostnamesAsTextFieldText = (String) sequence.getAttribute(ATTR_VALID_EXTERNAL_HOSTS, Property
                            .getProperty(new SystemConfigKey("webServer.validExternalHostnames")));
            validExternalHostnames.setAsPropertyText(validExternalHostnamesAsTextFieldText);
            invalidHostnameAction = (String) sequence.getAttribute(ATTR_INVALID_HOSTNAME_ACTION, Property
View Full Code Here

Examples of com.adito.boot.ContextKey

             * Configure HTTP proxy. Supported by both Java API and Maverick
             * HTTP.
             */
            SessionInfo sessionInfo = getSessionInfo(request);
            if (useHTTPProxy) {
                Property.setProperty(new ContextKey("proxies.http.proxyHost"), (String) seq.getAttribute(
                    ConfigureProxiesForm.ATTR_HTTP_PROXY_HOSTNAME, ""), sessionInfo);
                Property.setProperty(new ContextKey("proxies.http.proxyPort"), (String) seq.getAttribute(
                    ConfigureProxiesForm.ATTR_HTTP_PROXY_PORT, ""), sessionInfo);
                Property.setProperty(new ContextKey("proxies.http.proxyUser"), (String) seq.getAttribute(
                    ConfigureProxiesForm.ATTR_HTTP_PROXY_USERNAME, ""), sessionInfo);
                Property.setProperty(new ContextKey("proxies.http.proxyPassword"), (String) seq.getAttribute(
                    ConfigureProxiesForm.ATTR_HTTP_PROXY_PASSWORD, ""), sessionInfo);
                Property.setProperty(new ContextKey("proxies.http.nonProxyHosts"), ((PropertyList) seq.getAttribute(
                    ConfigureProxiesForm.ATTR_HTTP_NON_PROXY_HOSTS, null)), sessionInfo);
            } else {
                Property.setProperty(new ContextKey("proxies.http.proxyHost"), "", sessionInfo);
                Property.setProperty(new ContextKey("proxies.http.proxyPort"), 1080, sessionInfo);
                Property.setProperty(new ContextKey("proxies.http.proxyUser"), "", sessionInfo);
                Property.setProperty(new ContextKey("proxies.http.proxyPassword"), "", sessionInfo);
                Property.setProperty(new ContextKey("proxies.http.nonProxyHosts"), PropertyList.EMPTY_LIST, sessionInfo);
            }
            return new WizardActionStatus(WizardActionStatus.COMPLETED_OK, "installation.install.status.proxiesConfigured");
        } catch (Exception e) {
            log.error("Failed to configure web server.", e);
            return new WizardActionStatus(WizardActionStatus.COMPLETED_WITH_ERRORS,
View Full Code Here

Examples of com.adito.boot.ContextKey

        Property.setProperty(new RealmKey("security.userDatabase", r), newDatabase, seq.getSession());
        return new WizardActionStatus(WizardActionStatus.COMPLETED_OK, "installation.install.status.userDatabaseConfigured");
    }

    WizardActionStatus webServer(AbstractWizardSequence seq) {
        Property.setProperty(new ContextKey("webServer.port"),
            (String) seq.getAttribute(WebServerForm.ATTR_WEB_SERVER_PORT, "443"), seq.getSession());
        Property.setProperty(new ContextKey("webServer.protocol"), (String) seq.getAttribute(
            WebServerForm.ATTR_WEB_SERVER_PROTOCOL, "https"), seq.getSession());
        PropertyList l = PropertyList.createFromTextFieldText((String) seq
                        .getAttribute(WebServerForm.ATTR_LISTENING_INTERFACES, ""));
        Property.setProperty(new ContextKey("webServer.bindAddress"), l, seq.getSession());
        l = PropertyList.createFromTextFieldText((String) seq.getAttribute(WebServerForm.ATTR_VALID_EXTERNAL_HOSTS, ""));
        Property.setProperty(new SystemConfigKey("webServer.validExternalHostnames"), l, seq.getSession());
        Property.setProperty(new SystemConfigKey("webServer.invalidHostnameAction"), (String) seq.getAttribute(
            WebServerForm.ATTR_INVALID_HOSTNAME_ACTION, "none"), seq.getSession());
        return new WizardActionStatus(WizardActionStatus.COMPLETED_OK, "installation.install.status.webServerConfigured");
View Full Code Here

Examples of com.adito.boot.ContextKey

            }

            String alias = InstallAction.SERVER_CERTIFICATE;
            String passphrase = (String) seq.getAttribute(SetKeyStorePasswordForm.ATTR_KEY_STORE_PASSWORD, null);
            if (passphrase != null && !passphrase.equals("")) {
                Property.setProperty(new ContextKey("webServer.keystore.sslCertificate.password"), passphrase, seq.getSession());
                mgr.setStorePassword(passphrase);
            }

            mgr.createKeyStore();
            String dname = "cn="
                            + Util.escapeForDNString((String) seq.getAttribute(CreateNewCertificateForm.ATTR_HOSTNAME, ""))
                            + ", ou="
                            + Util.escapeForDNString((String) seq.getAttribute(CreateNewCertificateForm.ATTR_ORGANISATIONAL_UNIT,
                                "")) + ", o="
                            + Util.escapeForDNString((String) seq.getAttribute(CreateNewCertificateForm.ATTR_COMPANY, "")) + ", l="
                            + Util.escapeForDNString((String) seq.getAttribute(CreateNewCertificateForm.ATTR_CITY, "")) + ", st="
                            + Util.escapeForDNString((String) seq.getAttribute(CreateNewCertificateForm.ATTR_STATE, "")) + ", c="
                            + Util.escapeForDNString((String) seq.getAttribute(CreateNewCertificateForm.ATTR_COUNTRY_CODE, ""));
            mgr.createKey(alias, dname);
            Property.setProperty(new ContextKey("webServer.keyStoreType"), KeyStoreManager.TYPE_JKS.getName(), null);
            Property.setProperty(new ContextKey("webServer.alias"), alias, null);

            CoreEvent coreEvent = new CoreEvent(this, CoreEventConstants.KEYSTORE_CERTIFICATE_CREATED, alias, null).addAttribute(
                CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_ALIAS, alias).addAttribute(CreateNewCertificateForm.ATTR_HOSTNAME,
                (String) seq.getAttribute(CreateNewCertificateForm.ATTR_HOSTNAME, "")).addAttribute(
                CreateNewCertificateForm.ATTR_ORGANISATIONAL_UNIT,
View Full Code Here

Examples of com.adito.boot.ContextKey

                  log.error("Could not find first alias", ex);
                }
               
            }

            Property.setProperty(new ContextKey("webServer.alias"), alias, null);
            Property.setProperty(new ContextKey("webServer.keystore.sslCertificate.password"), passphrase, null);
            CoreEvent coreEvent = new CoreEvent(this, CoreEventConstants.KEYSTORE_IMPORTED, null, null).addAttribute(
                CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_ALIAS, alias).addAttribute(CreateNewCertificateForm.ATTR_HOSTNAME,
                (String) seq.getAttribute(CreateNewCertificateForm.ATTR_HOSTNAME, "")).addAttribute(
                CreateNewCertificateForm.ATTR_ORGANISATIONAL_UNIT,
                (String) seq.getAttribute(CreateNewCertificateForm.ATTR_ORGANISATIONAL_UNIT, "")).addAttribute(
View Full Code Here

Examples of com.adito.boot.ContextKey

            }

            // Configure any HTTP / HTTPS / SOCKS proxy servers
            configureProxyServers();

            PropertyList l = contextConfiguration.retrievePropertyList(new ContextKey("webServer.bindAddress"));
            getBootProgressMonitor().updateMessage("Creating server lock");
            getBootProgressMonitor().updateProgress(6);
            serverLock = new ServerLock((String) l.get(0));
            if (serverLock.isLocked()) {
                if (!isSetupMode()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.