/** * Saves the ServerInfo Registry if the current configuration allows a persistant Registry ! * * <p>By default this is false, but when MyVle is initialized by the VBrowser the persistant * ServerInfo Registry will be enabled. */ public void save() { // Check new Configuration Manager ! ConfigManager confMan = this.context.getConfigManager(); if (confMan.getUsePersistantUserConfiguration() == false) return; VRL loc = confMan.getServerRegistryLocation(); // is synchronized will return consistant list of configs ArrayList<AttributeSet> sets = this.getInfoAttrSets(); // ResourceLoader loader=new ResourceLoader(context); XMLData xmlifier = new XMLData(); xmlifier.setVAttributeElementName("vlet:ServerInfoProperty"); xmlifier.setVAttributeSetElementName("vlet:ServerInfo"); // xmlifier.setPersistanteNodeElementName("vlet:ServerInfo2"); // No // Nodes! try { // bootstrap warning: use default ResourceLoader here: VRS might not be initialized! ResourceLoader writer = new ResourceLoader(); String xmlString = xmlifier.createXMLString(XML_SERVER_CONFIG_HEADER_TAG, sets, XML_SERVER_CONFIG_HEADER); writer.writeTextTo(loc.toURI(), xmlString); this.isSaved = true; } catch (Exception e) { // check persistant user configuration: logger.logException(ClassLogger.ERROR, e, "Couldn't save ServerInfo registry to:%s\n", loc); // but continue! } }
/** Checks whether the persistent Server Info Registry is loaded and load it if necessary. */ private void checkIsLoaded() { // use serverInfos as Mutex synchronized (this.serverInfos) { // Check new Configuration Manager ! ConfigManager confMan = this.context.getConfigManager(); if (confMan.getUsePersistantUserConfiguration() == false) return; if (this.isLoaded == true) return; try { load(); } catch (VrsException e) { logger.logException(ClassLogger.WARN, e, "Couldn't load ServerInfo Registry!\n"); } } }