method to initialize a update of the CFML Engine. checks if there is a new Version and update it
when a new version is available

@param password
@return has updated
@throws IOException
@throws ServletException
429185
public boolean removeUpdate(final Password password) throws IOException, ServletException {
	if (!singelton.can(CFMLEngine.CAN_UPDATE, password)) throw new IOException("access denied to update CFMLEngine");
	return removeUpdate();
    }
13443
public synchronized static CFMLEngine getInstance(final ServletConfig config) throws ServletException {

	if (singelton != null) {
	    if (factory == null) factory = singelton.getCFMLEngineFactory(); // not sure if this ever is done, but it does not hurt
	    return singelton;
	}

	if (factory == null) factory = new CFMLEngineFactory(config);

	// read init param from config
	factory.readInitParam(config);

	factory.initEngineIfNecessary();
	singelton.addServletConfig(config);

	// add listener for update
	// factory.addListener(singelton);
	return singelton;
    }
1186880
@Override
    public void init() throws ServletException {
        super.init();

        // GET
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
            Operation.list, new ListOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.tree, new TreeOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.query, new QueryOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.filterList, new ListFiltersOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.json,
                Operation.coverage, new CoverageOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.zip,
                Operation.download, new DownloadOperation());
        operations.setOperation(ServletOperationSet.Method.GET, Extension.html,
                Operation.download, new DownloadOperation());

        // POST
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.service, new ServiceOperation());

        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.create, new CreateOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.update, new UpdateOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.upload, new UploadOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.install, new InstallOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
            Operation.uninstall, new UninstallOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.json,
                Operation.deploy, new ServiceOperation());

        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterChange, new ChangeFilterOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterAdd, new AddFilterOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterRemove, new RemoveFilterOperation());
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterMoveUp, new MoveFilterOperation(true));
        operations.setOperation(ServletOperationSet.Method.POST, Extension.html,
                Operation.filterMoveDown, new MoveFilterOperation(false));

        // PUT
        operations.setOperation(ServletOperationSet.Method.PUT, Extension.json,
                Operation.update, new JsonUpdateOperation());

        // DELETE
        operations.setOperation(ServletOperationSet.Method.DELETE, Extension.json,
                Operation.delete, new DeleteOperation());
    }
1048084
@Override
    public void setPassword(final String password) {
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
            SibTr.debug(this, TRACE, "setPassword", "***");
        }
        _password = password;
    }
244305
public static CFMLEngine getInstance(final ServletConfig config, final EngineChangeListener listener) throws ServletException {
	getInstance(config);

	// add listener for update
	factory.addListener(listener);

	// read init param from config
	factory.readInitParam(config);

	factory.initEngineIfNecessary();
	singelton.addServletConfig(config);

	// make the FDController visible for the FDClient
	FDControllerFactory.makeVisible();

	return singelton;
    }
287638
public void tryLogin(String protocol,
                         String host,
                         int port,
                         String context,
                         String user,
                         String pass) throws Exception {

        try {
            logger.info("Logging in...");
            // get a FedoraClient
            String baseURL = protocol + "://" + host + ":" + port + "/" + context;
            FedoraClient fc = new FedoraClient(baseURL, user, pass);

            // attempt to connect via REST
            String serverVersion = fc.getServerVersion();

            // ensure client is compatible with server, warn if not
            List<String> compatibleVersions =
                    FedoraClient.getCompatibleServerVersions();
            if (!compatibleVersions.contains(serverVersion)) {
                StringBuffer endText = new StringBuffer();
                if (compatibleVersions.size() == 1) {
                    // version A
                    endText.append("version " + compatibleVersions.get(0));
                } else {
                    // versions A and B
                    // versions A, B, and C
                    endText.append("versions ");
                    for (int i = 0; i < compatibleVersions.size(); i++) {
                        if (i > 0) {
                            if (i == compatibleVersions.size() - 1) {
                                if (i > 1) {
                                    endText.append(",");
                                }
                                endText.append(" and ");
                            } else {
                                endText.append(", ");
                            }
                        }
                        endText.append(compatibleVersions.get(i));
                    }
                }
                System.err.println("WARNING: Server version is "
                        + serverVersion + ".  This client is "
                        + "only designed to work with " + endText.toString());
            }

            // set SOAP stubs for Administrator
            Administrator.APIA = fc.getAPIAMTOM();
            Administrator.APIM = fc.getAPIMMTOM();

        } catch (Exception e) {
            if (e.getMessage().indexOf("Unauthorized") != -1
                    || e.getMessage().indexOf("Unrecognized") != -1) {
                throw new IOException("Bad username or password.");
            } else {
                if (e.getMessage() != null) {
                    throw new IOException(e.getClass().getName() + ": "
                            + e.getMessage());
                } else {
                    throw new IOException(e.getClass().getName());
                }
            }
        }
    }
642431
protected void updateText()
	{
		this.text.setLength(0);
		this.text.append(password.toString().replaceAll("(?s).", String.valueOf(passwordChar)));
		guiText.setText(text.toString());
	}
1295887
public AuthenticationConfigurationBuilder password(String password) {
      this.password = password != null ? password.toCharArray() : null;
      return enable();
   }
567760
public static void updateFileFromUrl(final String sourceUrl, final String destinationFilePath,
                                         final String username, final String password) throws
        UpdateException {
        updateFileFromUrl(sourceUrl, destinationFilePath, username, password, URLFileUpdater.factory());
    }
1286748
public static void init(final String username, final String password) {
        Twilio.setUsername(username);
        Twilio.setPassword(password);
    }
648250
private boolean _update(final Identification id) throws IOException, ServletException {

	final File newLucee = downloadCore(id);
	if (newLucee == null) return false;

	if (singelton != null) singelton.reset();

	final Version v = null;
	try {

	    bundleCollection = BundleLoader.loadBundles(this, getFelixCacheDirectory(), getBundleDirectory(), newLucee, bundleCollection);
	    final CFMLEngine e = getEngine(bundleCollection);
	    if (e == null) throw new IOException("can't load engine");
	    version = e.getInfo().getVersion();
	    // engine = e;
	    setEngine(e);
	    // e.reset();
	    callListeners(e);

	    ConfigServer cs = getConfigServer(e);
	    if (cs != null) {
		Log log = cs.getLog("deploy");
		log.info("loader", "Lucee Version [" + v + "] installed");
	    }

	}
	catch (final Exception e) {
	    System.gc();
	    try {
		newLucee.delete();
	    }
	    catch (final Exception ee) {}
	    log(e);
	    e.printStackTrace();
	    return false;
	}

	log(Logger.LOG_DEBUG, "Version (" + v + ")installed");
	return true;
    }
1361902
@SuppressFBWarnings(value = "DM_DEFAULT_ENCODING", justification = "Open TODO item for wider rework")
    @Override
    protected void eol(byte[] bytes, int len) throws IOException {
        String line = new String(bytes, 0, len);
        if(passwordsAsPattern != null) {
            line = passwordsAsPattern.matcher(line).replaceAll(MASKED_PASSWORD);
        }
        logger.write(line.getBytes());
    }
474242
public void init(ServletConfig config)
        throws ServletException
    {
        super.init(config);

        try {
            if (_homeImpl != null) {
            }
            else if (getInitParameter("home-class") != null) {
                String className = getInitParameter("home-class");

                Class<?> homeClass = loadClass(className);

                _homeImpl = homeClass.newInstance();

                init(_homeImpl);
            }
            else if (getInitParameter("service-class") != null) {
                String className = getInitParameter("service-class");

                Class<?> homeClass = loadClass(className);

                _homeImpl = homeClass.newInstance();

                init(_homeImpl);
            }
            else {
                if (getClass().equals(HessianServlet.class))
                    throw new ServletException("server must extend HessianServlet");

                _homeImpl = this;
            }

            if (_homeAPI != null) {
            }
            else if (getInitParameter("home-api") != null) {
                String className = getInitParameter("home-api");

                _homeAPI = loadClass(className);
            }
            else if (getInitParameter("api-class") != null) {
                String className = getInitParameter("api-class");

                _homeAPI = loadClass(className);
            }
            else if (_homeImpl != null) {
                _homeAPI = findRemoteAPI(_homeImpl.getClass());

                if (_homeAPI == null)
                    _homeAPI = _homeImpl.getClass();

                _homeAPI = _homeImpl.getClass();
            }

            if (_objectImpl != null) {
            }
            else if (getInitParameter("object-class") != null) {
                String className = getInitParameter("object-class");

                Class<?> objectClass = loadClass(className);

                _objectImpl = objectClass.newInstance();

                init(_objectImpl);
            }

            if (_objectAPI != null) {
            }
            else if (getInitParameter("object-api") != null) {
                String className = getInitParameter("object-api");

                _objectAPI = loadClass(className);
            }
            else if (_objectImpl != null)
                _objectAPI = _objectImpl.getClass();

            _homeSkeleton = new HessianSkeleton(_homeImpl, _homeAPI);

            if (_objectAPI != null)
                _homeSkeleton.setObjectClass(_objectAPI);

            if (_objectImpl != null) {
                _objectSkeleton = new HessianSkeleton(_objectImpl, _objectAPI);
                _objectSkeleton.setHomeClass(_homeAPI);
            }
            else
                _objectSkeleton = _homeSkeleton;

            if ("true".equals(getInitParameter("debug"))) {
            }

            if ("false".equals(getInitParameter("send-collection-type")))
                setSendCollectionType(false);
        } catch (ServletException e) {
            throw e;
        } catch (Exception e) {
            throw new ServletException(e);
        }
    }
583638
@SuppressWarnings("unchecked")
    public void init() throws ServletException {
	// Method re-written for PQ47469
	String servlets = getRequiredInitParameter(PARAM_SERVLET_PATHS);
	StringTokenizer sTokenizer = new StringTokenizer(servlets);
	Vector servletChainPath = new Vector();

	while (sTokenizer.hasMoreTokens() == true) {
		String path = sTokenizer.nextToken().trim();
			
		if (path.length() > 0) {
			servletChainPath.addElement(path);
		}
	}

	int chainLength = servletChainPath.size();

	if (chainLength > 0) {
		this.chainPath = new String[chainLength];
			
		for (int index = 0; index < chainLength; ++index) {
			this.chainPath[index] = (String)servletChainPath.elementAt(index);
		}
	}

    }
1258803
private synchronized boolean _restart() throws ServletException {
	if (singelton != null) singelton.reset();

	initEngine();

	ConfigServer cs = getConfigServer(singelton);
	if (cs != null) {
	    Log log = cs.getLog("application");
	    log.info("loader", "Lucee restarted");
	}
	System.gc();
	return true;
    }
1297179
def _init_file(self):
        
        self.keyring_key = self._get_new_password()
        # set a reference password, used to check that the password provided
        #  matches for subsequent checks.
        self.set_password('keyring-setting',
                          'password reference',
                          'password reference value')
        self._write_config_value('keyring-setting',
                                 'scheme',
                                 self.scheme)
        self._write_config_value('keyring-setting',
                                 'version',
                                 self.version)
394086
public void init()
        throws ServletException
    {
        _env= new EnvList();
        _cmdPrefix=getInitParameter("commandPrefix");

        String tmp = getInitParameter("cgibinResourceBase");
        if (tmp==null)
            tmp = getServletContext().getRealPath("/");

        if(log.isDebugEnabled())log.debug("CGI: CGI bin "+tmp);

        if (tmp==null)
        {
            log.warn("CGI: no CGI bin !");
            throw new ServletException();
        }

        File dir = new File(tmp);
        if (!dir.exists())
        {
            log.warn("CGI: CGI bin does not exist - "+dir);
            throw new ServletException();
        }

        if (!dir.canRead())
        {
            log.warn("CGI: CGI bin is not readable - "+dir);
            throw new ServletException();
        }

        if (!dir.isDirectory())
        {
            log.warn("CGI: CGI bin is not a directory - "+dir);
            throw new ServletException();
        }

        try
        {
            _docRoot=dir.getCanonicalFile();
            if(log.isDebugEnabled())log.debug("CGI: CGI bin accepted - "+_docRoot);
        }
        catch (IOException e)
        {
            log.warn("CGI: CGI bin failed - "+dir);
            e.printStackTrace();
            throw new ServletException();
        }

        _path=getInitParameter("Path");
        if(log.isDebugEnabled())log.debug("CGI: PATH accepted - "+_path);
        if (_path != null)
            _env.set("PATH", _path);

        Enumeration e= getInitParameterNames();
        while (e.hasMoreElements())
        {
            String n= (String)e.nextElement();
            if (n != null && n.startsWith("ENV_"))
                _env.set(n.substring(4),getInitParameter(n));
        }
    }