public void removeRepositoryInfo(RepositoryInfo info) { if (getRepositoryInfoById(info.getId()) != null) { Preferences pref = getPreferences(); pref.remove(KEY_ID + "." + info.getId()); pref.remove(KEY_TYPE + "." + info.getId()); pref.remove(KEY_NAME + "." + info.getId()); pref.remove(KEY_PATH + "." + info.getId()); pref.remove(KEY_REPO_URL + "." + info.getId()); pref.remove(KEY_INDEX_URL + "." + info.getId()); pref.putBoolean(KEY_REMOVED + "." + info.getId(), true); } }
public RepositoryInfo getRepositoryInfoById(String id) { for (RepositoryInfo ri : getRepositoryInfos()) { if (ri.getId().equals(id)) { return ri; } } return null; }
private void checkIndexAvailability(final RepositoryInfo... ids) throws MutexException { assert MUTEX.isWriteAccess(); for (RepositoryInfo id : ids) { LOGGER.finer("Checking Context.. :"+id.getId());//NOI18N File file = new File(getDefaultIndexLocation(), id.getId()); if (!file.exists() || file.listFiles().length <= 0) { LOGGER.finer("Index Not Available :"+id +" At :"+file.getAbsolutePath());//NOI18N indexRepo(id); } LOGGER.finer("Index Available :"+id+" At :"+file.getAbsolutePath());//NOI18N } }
private void unloadIndexingContext(final RepositoryInfo... repos) throws IOException { assert MUTEX.isWriteAccess(); for (RepositoryInfo repo : repos) { LOGGER.finer("Unloading Context :" + repo.getId());//NOI18N IndexingContext ic = indexer.getIndexingContexts().get(repo.getId()); if (ic != null) { indexer.removeIndexingContext(ic, false); } } }
/** * To be used from modules adding default instances of repositories. * Such repository will only be really added if not present yet and not removed by user. * @param info */ public synchronized void addDefaultRepositoryInfo(RepositoryInfo info) { Preferences pref = getPreferences(); if (pref.getBoolean(KEY_REMOVED + "." + info.getId(), false)) { //user removed the setting. return; } if (getRepositoryInfoById(info.getId()) != null) { //user possibly changed the setting.. return; } addOrModifyRepositoryInfo(info); }
/** * * @param info */ public synchronized void addOrModifyRepositoryInfo(RepositoryInfo info) { Preferences pref = getPreferences(); pref.put(KEY_ID + "." + info.getId(), info.getId()); pref.put(KEY_TYPE + "." + info.getId(), info.getType()); pref.put(KEY_NAME + "." + info.getId(), info.getName()); if (info.getRepositoryPath() != null) { pref.put(KEY_PATH + "." + info.getId(), info.getRepositoryPath()); } else { pref.remove(KEY_PATH + "." + info.getId()); } if (info.getRepositoryUrl() != null) { pref.put(KEY_REPO_URL + "." + info.getId(), info.getRepositoryUrl()); } else { pref.remove(KEY_REPO_URL + "." + info.getId()); } if (info.getIndexUpdateUrl() != null) { pref.put(KEY_INDEX_URL + "." + info.getId(), info.getIndexUpdateUrl()); } else { pref.remove(KEY_INDEX_URL + "." + info.getId()); } pref.remove(KEY_REMOVED + "." + info.getId()); //todo fire repository added }
@Override public String getShortDescription() { StringBuffer buffer = new StringBuffer(); buffer.append("<html>");//NOI18N buffer.append(NbBundle.getMessage(RepositoryNode.class, "LBL_REPO_ID", info.getId()));//NOI18N buffer.append(NbBundle.getMessage(RepositoryNode.class, "LBL_REPO_Name", info.getName()));//NOI18N //show repo url if available if (info.getRepositoryUrl() != null) { buffer.append(NbBundle.getMessage(RepositoryNode.class, "LBL_REPO_Url", info.getRepositoryUrl()));//NOI18N } //show index url if available if (info.getIndexUpdateUrl() != null) { buffer.append(NbBundle.getMessage(RepositoryNode.class, "LBL_REPO_Index_Url", info.getIndexUpdateUrl()));//NOI18N } buffer.append("</html>");//NOI18N return buffer.toString(); }
IndexingContext indexingContext = indexingContexts.get(repo.getId()); if (indexingContext == null) { LOGGER.warning("Indexing context chould not be created :"+repo.getId());//NOI18N return null; LOGGER.finer("Indexing Remote Repository :"+repo.getId());//NOI18N RemoteIndexTransferListener listener = new RemoteIndexTransferListener(repo); try { LOGGER.finer("Indexing Local Repository :"+repo.getId());//NOI18N indexer.scan(indexingContext, new RepositoryIndexerListener(indexer, indexingContext, false), true); unloadIndexingContext(repo); RepositoryPreferences.getInstance().setLastIndexUpdate(repo.getId(), new Date()); fireChangeIndex();
private void loadIndexingContext(final RepositoryInfo... repoids) throws IOException, UnsupportedExistingLuceneIndexException { assert MUTEX.isWriteAccess(); for (RepositoryInfo info : repoids) { LOGGER.finer("Loading Context :" + info.getId());//NOI18N if (info.isLocal() || info.isRemoteDownloadable()) { indexer.addIndexingContext( // info.getId(), // context id info.getId(), // repository id info.isLocal() ? new File(info.getRepositoryPath()) : null, // repository folder new File(getDefaultIndexLocation(), info.getId()), // index folder info.isRemoteDownloadable() ? info.getRepositoryUrl() : null, // repositoryUrl info.isRemoteDownloadable() ? info.getIndexUpdateUrl() : null, // index update url NB_INDEX); } } }
public void modify(RepositoryInfo info) { modify = true; txtRepoId.setEditable(false); txtRepoId.setText(info.getId()); txtRepoName.setText(info.getName()); comType.setSelectedItem(info.getType()); if (info.isLocal()) { jraLocal.setSelected(true); txtRepoPath.setText(info.getRepositoryPath()); jraLocalActionPerformed(null); } else if (info.isRemoteDownloadable()) { jraRemote.setSelected(true); txtRepoUrl.setText(info.getRepositoryUrl()); txtIndexUrl.setText(info.getIndexUpdateUrl()); jraRemoteActionPerformed(null); } }
boolean run = false; if (freq == RepositoryPreferences.FREQ_STARTUP) { LOGGER.finer("Index At Startup :"+ri.getId());//NOI18N run = true; } else if (freq == RepositoryPreferences.FREQ_ONCE_DAY && checkDiff(ri.getId(),86400000L)) { LOGGER.finer("Index Once a Day :"+ri.getId());//NOI18N run = true; } else if (freq == RepositoryPreferences.FREQ_ONCE_WEEK && checkDiff(ri.getId(),604800000L)) { LOGGER.finer("Index once a Week :"+ri.getId());//NOI18N run = true;
public RepositoryNode(RepositoryInfo info) { super(new GroupListChildren(info)); this.info = info; setName(info.getId()); setDisplayName(info.getName()); }
boolean unload = true; try { IndexingContext context = indexer.getIndexingContexts().get(repo.getId()); Set<String> all = indexer.getAllGroups(context); if (all.size() > 0) {
public List<Archetype> getArchetypes() { List<Archetype> lst = new ArrayList<Archetype>(); List<RepositoryInfo> infos = RepositoryPreferences.getInstance().getRepositoryInfos(); for (RepositoryInfo info : infos) { if (RepositoryPreferences.LOCAL_REPO_ID.equals(info.getId())) { continue; } List<NBVersionInfo> archs = RepositoryQueries.findArchetypes(info); if (archs == null) { continue; } for (NBVersionInfo art : archs) { //TODO FINDout how to get contain matadata // boolean ng = artifact.getFiles().contains("META-INF/maven/archetype-metadata.xml"); Archetype arch = ("maven-archetype".equalsIgnoreCase(art.getPackaging())) ? //NOI18N new Archetype(true, true) : new Archetype(); arch.setArtifactId(art.getArtifactId()); arch.setGroupId(art.getGroupId()); arch.setVersion(art.getVersion()); arch.setName(art.getProjectName()); arch.setDescription(art.getProjectDescription()); arch.setRepository(info.getRepositoryUrl()); lst.add(arch); } } return lst; } }