From 92975645552041e639181aed18fbe5f94ca9cbc1 Mon Sep 17 00:00:00 2001 From: ragnarok <ragnarok> Date: Sun, 9 Oct 2005 03:47:12 +0000 Subject: [PATCH] * getName, getLocation -> getByName, getByLocation --- .../java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java | 4 ++-- apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java | 8 ++++---- apps/syndie/java/src/net/i2p/syndie/sml/RSSRenderer.java | 6 +++--- .../java/src/net/i2p/syndie/web/ArchiveViewerBean.java | 8 ++++---- apps/syndie/java/src/net/i2p/syndie/web/PostBean.java | 2 +- .../java/src/net/i2p/syndie/web/RemoteArchiveBean.java | 2 +- apps/syndie/jsp/_bodyindex.jsp | 2 +- apps/syndie/jsp/addresses.jsp | 8 ++++---- apps/syndie/jsp/post.jsp | 4 ++-- apps/syndie/jsp/remote.jsp | 2 +- core/java/src/net/i2p/client/naming/PetNameDB.java | 4 ++-- .../src/net/i2p/client/naming/PetNameNamingService.java | 4 ++-- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java index a4d70bfc34..c528d86587 100644 --- a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java +++ b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLPreviewRenderer.java @@ -105,7 +105,7 @@ public class HTMLPreviewRenderer extends HTMLRenderer { String knownName = null; if (_user != null) - knownName = _user.getPetNameDB().getLocation(a.location).getName(); + knownName = _user.getPetNameDB().getByLocation(a.location).getName(); if (knownName != null) { _postBodyBuffer.append(' ').append(getSpan("summDetailAddrKnown")); _postBodyBuffer.append(sanitizeString(knownName)).append("</span>"); @@ -134,7 +134,7 @@ public class HTMLPreviewRenderer extends HTMLRenderer { _postBodyBuffer.append("\">").append(sanitizeString(a.name)).append("</a>"); if (a.description != null) _postBodyBuffer.append(": ").append(getSpan("summDetailArchiveDesc")).append(sanitizeString(a.description)).append("</span>"); - if (null == _user.getPetNameDB().getLocation(a.location)) { + if (null == _user.getPetNameDB().getByLocation(a.location)) { _postBodyBuffer.append(" <a ").append(getClass("summDetailArchiveBookmark")).append(" href=\""); _postBodyBuffer.append(getBookmarkURL(a.name, a.location, a.locationSchema, "syndiearchive")); _postBodyBuffer.append("\">bookmark</a>"); diff --git a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java index cb54d1c40b..0909a229a6 100644 --- a/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java +++ b/apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java @@ -468,7 +468,7 @@ public class HTMLRenderer extends EventReceiverImpl { if ( (schema == null) || (location == null) ) return; PetName pn = null; if (_user != null) - pn = _user.getPetNameDB().getLocation(location); + pn = _user.getPetNameDB().getByLocation(location); if (pn != null) { _bodyBuffer.append(getSpan("addr")).append(sanitizeString(anchorText)).append("</span>"); _bodyBuffer.append(getSpan("addrKnownName")).append("(").append(sanitizeString(pn.getName())).append(")</span>"); @@ -633,7 +633,7 @@ public class HTMLRenderer extends EventReceiverImpl { PetName pn = null; if (_user != null) - pn = _user.getPetNameDB().getLocation(a.location); + pn = _user.getPetNameDB().getByLocation(a.location); if (pn != null) { _postBodyBuffer.append(' ').append(getSpan("summDetailAddrKnown")); _postBodyBuffer.append(sanitizeString(pn.getName())).append("</span>"); @@ -662,7 +662,7 @@ public class HTMLRenderer extends EventReceiverImpl { _postBodyBuffer.append("\">").append(sanitizeString(a.name)).append("</a>"); if (a.description != null) _postBodyBuffer.append(": ").append(getSpan("summDetailArchiveDesc")).append(sanitizeString(a.description)).append("</span>"); - if (null == _user.getPetNameDB().getLocation(a.location)) { + if (null == _user.getPetNameDB().getByLocation(a.location)) { _postBodyBuffer.append(" <a ").append(getClass("summDetailArchiveBookmark")).append(" href=\""); _postBodyBuffer.append(getBookmarkURL(a.name, a.location, a.locationSchema, "syndiearchive")); _postBodyBuffer.append("\">bookmark it</a>"); @@ -767,7 +767,7 @@ public class HTMLRenderer extends EventReceiverImpl { PetName pn = null; if ( (_entry != null) && (_user != null) ) - pn = _user.getPetNameDB().getLocation(_entry.getURI().getKeyHash().toBase64()); + pn = _user.getPetNameDB().getByLocation(_entry.getURI().getKeyHash().toBase64()); //if (knownName != null) // _preBodyBuffer.append("Pet name: ").append(sanitizeString(knownName)).append(" "); diff --git a/apps/syndie/java/src/net/i2p/syndie/sml/RSSRenderer.java b/apps/syndie/java/src/net/i2p/syndie/sml/RSSRenderer.java index 86414c57c1..07732f20d5 100644 --- a/apps/syndie/java/src/net/i2p/syndie/sml/RSSRenderer.java +++ b/apps/syndie/java/src/net/i2p/syndie/sml/RSSRenderer.java @@ -27,7 +27,7 @@ public class RSSRenderer extends HTMLRenderer { out.write(" <link>" + urlPrefix + sanitizeXML(getEntryURL()) + "</link>\n"); out.write(" <guid isPermalink=\"false\">" + urlPrefix + entry.getURI().toString() + "</guid>\n"); out.write(" <pubDate>" + getRFC822Date(entry.getURI().getEntryId()) + "</pubDate>\n"); - PetName pn = user.getPetNameDB().getLocation(entry.getURI().getKeyHash().toBase64()); + PetName pn = user.getPetNameDB().getByLocation(entry.getURI().getKeyHash().toBase64()); String author = pn.getName(); if (author == null) { BlogInfo info = archive.getBlogInfo(entry.getURI()); @@ -196,7 +196,7 @@ public class RSSRenderer extends HTMLRenderer { if ( (schema == null) || (location == null) ) return; PetName pn = null; if (_user != null) - pn = _user.getPetNameDB().getLocation(location); + pn = _user.getPetNameDB().getByLocation(location); if (pn != null) { _bodyBuffer.append(sanitizeString(anchorText)); } else { @@ -254,7 +254,7 @@ public class RSSRenderer extends HTMLRenderer { PetName pn = null; if (_user != null) - pn = _user.getPetNameDB().getLocation(a.location); + pn = _user.getPetNameDB().getByLocation(a.location); if (pn == null) { StringBuffer url = new StringBuffer(128); url.append("addresses.jsp?network="); diff --git a/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java b/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java index c0e64de46a..6b7fe835e7 100644 --- a/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java +++ b/apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java @@ -100,7 +100,7 @@ public class ArchiveViewerBean { for (int i = 0; i < index.getNewestBlogCount(); i++) { Hash cur = index.getNewestBlog(i); - PetName pn = user.getPetNameDB().getLocation(cur.toBase64()); + PetName pn = user.getPetNameDB().getByLocation(cur.toBase64()); String knownName = null; if (pn != null) { knownName = pn.getName(); @@ -127,7 +127,7 @@ public class ArchiveViewerBean { Set blogs = index.getUniqueBlogs(); for (Iterator iter = blogs.iterator(); iter.hasNext(); ) { Hash cur = (Hash)iter.next(); - PetName pn = user.getPetNameDB().getLocation(cur.toBase64()); + PetName pn = user.getPetNameDB().getByLocation(cur.toBase64()); String knownName = null; if (pn != null) { knownName = pn.getName(); @@ -492,7 +492,7 @@ public class ArchiveViewerBean { PetNameDB db = user.getPetNameDB(); for (Iterator iter = db.getNames().iterator(); iter.hasNext(); ) { String name = (String)iter.next(); - PetName pn = db.getName(name); + PetName pn = db.getByName(name); if ("syndie".equals(pn.getNetwork()) && "syndieblog".equals(pn.getProtocol()) && pn.isMember(group)) { byte pnLoc[] = Base64.decode(pn.getLocation()); if (pnLoc != null) { @@ -515,7 +515,7 @@ public class ArchiveViewerBean { BlogURI uri = (BlogURI)uris.get(i); Hash k = uri.getKeyHash(); if (k == null) continue; - PetName pn = user.getPetNameDB().getLocation(k.toBase64()); + PetName pn = user.getPetNameDB().getByLocation(k.toBase64()); if ( (pn != null) && (pn.isMember("Ignore")) ) { uris.remove(i); i--; diff --git a/apps/syndie/java/src/net/i2p/syndie/web/PostBean.java b/apps/syndie/java/src/net/i2p/syndie/web/PostBean.java index 53e911d378..c274715b18 100644 --- a/apps/syndie/java/src/net/i2p/syndie/web/PostBean.java +++ b/apps/syndie/java/src/net/i2p/syndie/web/PostBean.java @@ -99,7 +99,7 @@ public class PostBean { if (_log.shouldLog(Log.DEBUG)) _log.debug("Posted the entry " + uri.toString() + " (archive = " + _archive + ")"); if ( (uri != null) && BlogManager.instance().authorizeRemote(_user) ) { - PetName pn = _user.getPetNameDB().getName(_archive); + PetName pn = _user.getPetNameDB().getByName(_archive); if (_log.shouldLog(Log.DEBUG)) _log.debug("Archive to petname? " + pn + " (protocol: " + (pn != null ? pn.getProtocol() : "") + ")"); if ( (pn != null) && ("syndiearchive".equals(pn.getProtocol())) ) { diff --git a/apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java b/apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java index 300605eb24..40447f11cb 100644 --- a/apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java +++ b/apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java @@ -62,7 +62,7 @@ public class RemoteArchiveBean { private boolean ignoreBlog(User user, Hash blog) { PetNameDB db = user.getPetNameDB(); - PetName pn = db.getLocation(blog.toBase64()); + PetName pn = db.getByLocation(blog.toBase64()); return ( (pn!= null) && (pn.isMember("Ignore")) ); } diff --git a/apps/syndie/jsp/_bodyindex.jsp b/apps/syndie/jsp/_bodyindex.jsp index ed3f51cb20..d997bbd2c0 100644 --- a/apps/syndie/jsp/_bodyindex.jsp +++ b/apps/syndie/jsp/_bodyindex.jsp @@ -11,7 +11,7 @@ if (user.getAuthenticated() && (null != request.getParameter("action")) ) { group = "Ignore"; boolean unignore = ("Unignore blog".equals(request.getParameter("action"))); - PetName pn = user.getPetNameDB().getLocation(blog); + PetName pn = user.getPetNameDB().getByLocation(blog); String name = null; if (pn != null) name = pn.getName(); if (name == null) diff --git a/apps/syndie/jsp/addresses.jsp b/apps/syndie/jsp/addresses.jsp index 941c2c4a8a..5e9835efe6 100644 --- a/apps/syndie/jsp/addresses.jsp +++ b/apps/syndie/jsp/addresses.jsp @@ -20,7 +20,7 @@ if (!user.getAuthenticated()) { String action = request.getParameter("action"); if ( (action != null) && ("Change".equals(action)) ) { String oldPetname = request.getParameter("petname"); - PetName cur = names.getName(oldPetname); + PetName cur = names.getByName(oldPetname); if (cur != null) { cur.setName(request.getParameter("name")); cur.setNetwork(request.getParameter("network")); @@ -43,7 +43,7 @@ if (!user.getAuthenticated()) { %><span class="b_addrMsgOk">Address updated</span><% } } else if ( (action != null) && ("Add".equals(action)) ) { - PetName cur = names.getName(request.getParameter("name")); + PetName cur = names.getByName(request.getParameter("name")); if (cur != null) { %><span class="b_addrMsgErr">Address already exists</span><% } else { cur = new PetName(); cur.setName(request.getParameter("name")); @@ -63,7 +63,7 @@ if (!user.getAuthenticated()) { %><span class="b_addrMsgOk">Address added</span><% } } else if ( (action != null) && ("Delete".equals(action)) ) { - PetName cur = names.getName(request.getParameter("name")); + PetName cur = names.getByName(request.getParameter("name")); if (cur != null) { if ( ("syndiearchive".equals(cur.getProtocol())) && (BlogManager.instance().authorizeRemote(user)) ) { BlogManager.instance().unscheduleSyndication(cur.getLocation()); @@ -90,7 +90,7 @@ if (!user.getAuthenticated()) { <% StringBuffer buf = new StringBuffer(128); for (Iterator iter = sorted.iterator(); iter.hasNext(); ) { - PetName name = names.getName((String)iter.next()); + PetName name = names.getByName((String)iter.next()); buf.append("<tr class=\"b_addrDetail\"><form action=\"addresses.jsp\" method=\"POST\">"); buf.append("<input type=\"hidden\" name=\"petname\" value=\"").append(name.getName()).append("\" />"); buf.append("<td class=\"b_addrName\"><input class=\"b_addrName\" type=\"text\" size=\"20\" name=\"name\" value=\"").append(name.getName()).append("\" /></td>"); diff --git a/apps/syndie/jsp/post.jsp b/apps/syndie/jsp/post.jsp index 3b751a74cd..86c19d92a7 100644 --- a/apps/syndie/jsp/post.jsp +++ b/apps/syndie/jsp/post.jsp @@ -66,7 +66,7 @@ if (!user.getAuthenticated()) { PetNameDB db = user.getPetNameDB(); if (entryHeaders == null) entryHeaders = ""; for (Iterator iter = db.getNames().iterator(); iter.hasNext(); ) { - PetName pn = db.getName((String)iter.next()); + PetName pn = db.getByName((String)iter.next()); if ( (pn != null) && (pn.getIsPublic()) ) { entryHeaders = entryHeaders + '\n' + HTMLRenderer.HEADER_PETNAME + ": " + pn.getName() + "\t" + pn.getNetwork() + "\t" + pn.getProtocol() + "\t" + pn.getLocation(); @@ -107,7 +107,7 @@ PetNameDB db = user.getPetNameDB(); TreeSet names = new TreeSet(); for (Iterator iter = db.getNames().iterator(); iter.hasNext(); ) { String name = (String)iter.next(); - PetName pn = db.getName(name); + PetName pn = db.getByName(name); if ("syndiearchive".equals(pn.getProtocol())) names.add(pn.getName()); } diff --git a/apps/syndie/jsp/remote.jsp b/apps/syndie/jsp/remote.jsp index 7e7ad680c0..0f79cbaa56 100644 --- a/apps/syndie/jsp/remote.jsp +++ b/apps/syndie/jsp/remote.jsp @@ -45,7 +45,7 @@ for (Iterator iter = user.getPetNameDB().iterator(); iter.hasNext(); ) { String location = request.getParameter("location"); String pn = request.getParameter("archivepetname"); if ( (pn != null) && (pn.trim().length() > 0) ) { - PetName pnval = user.getPetNameDB().getName(pn); + PetName pnval = user.getPetNameDB().getByName(pn); if (pnval != null) location = pnval.getLocation(); } remote.fetchIndex(user, request.getParameter("schema"), location, request.getParameter("proxyhost"), request.getParameter("proxyport")); diff --git a/core/java/src/net/i2p/client/naming/PetNameDB.java b/core/java/src/net/i2p/client/naming/PetNameDB.java index 255f98bfb0..ed34586cd5 100644 --- a/core/java/src/net/i2p/client/naming/PetNameDB.java +++ b/core/java/src/net/i2p/client/naming/PetNameDB.java @@ -16,7 +16,7 @@ public class PetNameDB { _names = Collections.synchronizedMap(new HashMap()); } - public PetName getName(String name) { return (PetName)_names.get(name); } + public PetName getByName(String name) { return (PetName)_names.get(name); } public void add(PetName pn) { _names.put(pn.getName(), pn); } public void clear() { _names.clear(); } public boolean contains(PetName pn) { return _names.containsValue(pn); } @@ -38,7 +38,7 @@ public class PetNameDB { return rv; } - public PetName getLocation(String location) { + public PetName getByLocation(String location) { if (location == null) return null; synchronized (_names) { for (Iterator iter = iterator(); iter.hasNext(); ) { diff --git a/core/java/src/net/i2p/client/naming/PetNameNamingService.java b/core/java/src/net/i2p/client/naming/PetNameNamingService.java index 5c820533b0..fb57a3c022 100644 --- a/core/java/src/net/i2p/client/naming/PetNameNamingService.java +++ b/core/java/src/net/i2p/client/naming/PetNameNamingService.java @@ -51,7 +51,7 @@ public class PetNameNamingService extends NamingService { } public Destination lookup(String hostname) { - PetName name = _petnameDb.getName(hostname); + PetName name = _petnameDb.getByName(hostname); if (name != null && name.getNetwork().equalsIgnoreCase("i2p")) { return lookupBase64(name.getLocation()); } else { @@ -60,6 +60,6 @@ public class PetNameNamingService extends NamingService { } public String reverseLookup(Destination dest) { - return _petnameDb.getLocation(dest.toBase64()).getName(); + return _petnameDb.getByLocation(dest.toBase64()).getName(); } } -- GitLab