repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java | SipApplicationSessionImpl.notifySipApplicationSessionListeners | public void notifySipApplicationSessionListeners(SipApplicationSessionEventType sipApplicationSessionEventType) {
List<SipApplicationSessionListener> listeners =
sipContext.getListeners().getSipApplicationSessionListeners();
if(listeners.size() > 0) {
ClassLoader oldClassLoader = java.lang.Thread.currentT... | java | public void notifySipApplicationSessionListeners(SipApplicationSessionEventType sipApplicationSessionEventType) {
List<SipApplicationSessionListener> listeners =
sipContext.getListeners().getSipApplicationSessionListeners();
if(listeners.size() > 0) {
ClassLoader oldClassLoader = java.lang.Thread.currentT... | [
"public",
"void",
"notifySipApplicationSessionListeners",
"(",
"SipApplicationSessionEventType",
"sipApplicationSessionEventType",
")",
"{",
"List",
"<",
"SipApplicationSessionListener",
">",
"listeners",
"=",
"sipContext",
".",
"getListeners",
"(",
")",
".",
"getSipApplicati... | Notifies the listeners that a lifecycle event occured on that sip application session
@param sipApplicationSessionEventType the type of event that happened | [
"Notifies",
"the",
"listeners",
"that",
"a",
"lifecycle",
"event",
"occured",
"on",
"that",
"sip",
"application",
"session"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java#L176-L209 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java | SipApplicationSessionImpl.getSipSessions | public Set<MobicentsSipSession> getSipSessions(boolean internal) {
Set<MobicentsSipSession> retSipSessions = new HashSet<MobicentsSipSession>();
if(sipSessions != null) {
for(SipSessionKey sipSessionKey : sipSessions) {
MobicentsSipSession sipSession = sipContext.getSipManager().getSipSession(sipSessionK... | java | public Set<MobicentsSipSession> getSipSessions(boolean internal) {
Set<MobicentsSipSession> retSipSessions = new HashSet<MobicentsSipSession>();
if(sipSessions != null) {
for(SipSessionKey sipSessionKey : sipSessions) {
MobicentsSipSession sipSession = sipContext.getSipManager().getSipSession(sipSessionK... | [
"public",
"Set",
"<",
"MobicentsSipSession",
">",
"getSipSessions",
"(",
"boolean",
"internal",
")",
"{",
"Set",
"<",
"MobicentsSipSession",
">",
"retSipSessions",
"=",
"new",
"HashSet",
"<",
"MobicentsSipSession",
">",
"(",
")",
";",
"if",
"(",
"sipSessions",
... | to avoid serialization issues | [
"to",
"avoid",
"serialization",
"issues"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java#L497-L526 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java | SipApplicationSessionImpl.addServletTimer | public void addServletTimer(ServletTimer servletTimer){
if(servletTimers == null) {
servletTimers = new ConcurrentHashMap<String, ServletTimer>(1);
}
servletTimers.putIfAbsent(servletTimer.getId(), servletTimer);
} | java | public void addServletTimer(ServletTimer servletTimer){
if(servletTimers == null) {
servletTimers = new ConcurrentHashMap<String, ServletTimer>(1);
}
servletTimers.putIfAbsent(servletTimer.getId(), servletTimer);
} | [
"public",
"void",
"addServletTimer",
"(",
"ServletTimer",
"servletTimer",
")",
"{",
"if",
"(",
"servletTimers",
"==",
"null",
")",
"{",
"servletTimers",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"ServletTimer",
">",
"(",
"1",
")",
";",
"}",
"servl... | Add a servlet timer to this application session
@param servletTimer the servlet timer to add | [
"Add",
"a",
"servlet",
"timer",
"to",
"this",
"application",
"session"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java#L599-L604 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java | SipApplicationSessionImpl.removeServletTimer | public void removeServletTimer(ServletTimer servletTimer, boolean updateAppSessionReadyToInvalidateState){
if(servletTimers != null) {
servletTimers.remove(servletTimer.getId());
}
if(updateAppSessionReadyToInvalidateState) {
updateReadyToInvalidateState();
}
} | java | public void removeServletTimer(ServletTimer servletTimer, boolean updateAppSessionReadyToInvalidateState){
if(servletTimers != null) {
servletTimers.remove(servletTimer.getId());
}
if(updateAppSessionReadyToInvalidateState) {
updateReadyToInvalidateState();
}
} | [
"public",
"void",
"removeServletTimer",
"(",
"ServletTimer",
"servletTimer",
",",
"boolean",
"updateAppSessionReadyToInvalidateState",
")",
"{",
"if",
"(",
"servletTimers",
"!=",
"null",
")",
"{",
"servletTimers",
".",
"remove",
"(",
"servletTimer",
".",
"getId",
"(... | Remove a servlet timer from this application session
@param servletTimer the servlet timer to remove | [
"Remove",
"a",
"servlet",
"timer",
"from",
"this",
"application",
"session"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipApplicationSessionImpl.java#L609-L616 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/MarketplaceListing.java | MarketplaceListing.jsonify | public JSONObject jsonify() {
JSONObject ret = new JSONObject();
ret.put("title", getTitle());
ret.put("category", getCategory());
ret.put("subcategory", getSubCategory());
ret.put("description", getDescription());
if (null != this._extraAttributes && !this._extraAttributes.isEmpty()) {
re... | java | public JSONObject jsonify() {
JSONObject ret = new JSONObject();
ret.put("title", getTitle());
ret.put("category", getCategory());
ret.put("subcategory", getSubCategory());
ret.put("description", getDescription());
if (null != this._extraAttributes && !this._extraAttributes.isEmpty()) {
re... | [
"public",
"JSONObject",
"jsonify",
"(",
")",
"{",
"JSONObject",
"ret",
"=",
"new",
"JSONObject",
"(",
")",
";",
"ret",
".",
"put",
"(",
"\"title\"",
",",
"getTitle",
"(",
")",
")",
";",
"ret",
".",
"put",
"(",
"\"category\"",
",",
"getCategory",
"(",
... | Return a JSON representation of this object
@return JSONObject | [
"Return",
"a",
"JSON",
"representation",
"of",
"this",
"object"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/MarketplaceListing.java#L132-L142 | train |
RestComm/sip-servlets | sip-servlets-examples/diameter-ro-rf/src/main/java/org/mobicents/servlet/sip/example/diameter/rorf/RoClientImpl.java | RoClientImpl.getRoSession | private ClientCCASession getRoSession() throws InternalException {
return ((ISessionFactory) super.sessionFactory).getNewAppSession(null, roAppId, ClientCCASession.class, null);
} | java | private ClientCCASession getRoSession() throws InternalException {
return ((ISessionFactory) super.sessionFactory).getNewAppSession(null, roAppId, ClientCCASession.class, null);
} | [
"private",
"ClientCCASession",
"getRoSession",
"(",
")",
"throws",
"InternalException",
"{",
"return",
"(",
"(",
"ISessionFactory",
")",
"super",
".",
"sessionFactory",
")",
".",
"getNewAppSession",
"(",
"null",
",",
"roAppId",
",",
"ClientCCASession",
".",
"class... | Creates a new Ro Client Session
@return
@throws InternalException | [
"Creates",
"a",
"new",
"Ro",
"Client",
"Session"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/diameter-ro-rf/src/main/java/org/mobicents/servlet/sip/example/diameter/rorf/RoClientImpl.java#L164-L166 | train |
RestComm/sip-servlets | sip-servlets-examples/diameter-ro-rf/src/main/java/org/mobicents/servlet/sip/example/diameter/rorf/RoClientImpl.java | RoClientImpl.createCCR | private JCreditControlRequest createCCR(int ccRequestType, String subscriptionId, String serviceContextId) throws Exception {
ClientCCASession roSession = roSessions.get(serviceContextId);
// Create Credit-Control-Request
JCreditControlRequest ccr = createCreditControlRequest(roSession.getSessions().ge... | java | private JCreditControlRequest createCCR(int ccRequestType, String subscriptionId, String serviceContextId) throws Exception {
ClientCCASession roSession = roSessions.get(serviceContextId);
// Create Credit-Control-Request
JCreditControlRequest ccr = createCreditControlRequest(roSession.getSessions().ge... | [
"private",
"JCreditControlRequest",
"createCCR",
"(",
"int",
"ccRequestType",
",",
"String",
"subscriptionId",
",",
"String",
"serviceContextId",
")",
"throws",
"Exception",
"{",
"ClientCCASession",
"roSession",
"=",
"roSessions",
".",
"get",
"(",
"serviceContextId",
... | Create a Ro CCR message, with the selected Request Type and Service Context ID
@param ccRequestType
@param serviceContextId
@return
@throws Exception | [
"Create",
"a",
"Ro",
"CCR",
"message",
"with",
"the",
"selected",
"Request",
"Type",
"and",
"Service",
"Context",
"ID"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/diameter-ro-rf/src/main/java/org/mobicents/servlet/sip/example/diameter/rorf/RoClientImpl.java#L267-L519 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipListenersHolder.java | SipListenersHolder.clean | public void clean() {
this.sipApplicationSessionAttributeListeners.clear();
this.sipApplicationSessionBindingListeners.clear();
this.sipApplicationSessionActivationListeners.clear();
this.sipApplicationSessionListeners.clear();
this.sipSessionActivationListeners.clear();
this.sipSessionAttributeListeners... | java | public void clean() {
this.sipApplicationSessionAttributeListeners.clear();
this.sipApplicationSessionBindingListeners.clear();
this.sipApplicationSessionActivationListeners.clear();
this.sipApplicationSessionListeners.clear();
this.sipSessionActivationListeners.clear();
this.sipSessionAttributeListeners... | [
"public",
"void",
"clean",
"(",
")",
"{",
"this",
".",
"sipApplicationSessionAttributeListeners",
".",
"clear",
"(",
")",
";",
"this",
".",
"sipApplicationSessionBindingListeners",
".",
"clear",
"(",
")",
";",
"this",
".",
"sipApplicationSessionActivationListeners",
... | Empty vectors to allow garbage collection | [
"Empty",
"vectors",
"to",
"allow",
"garbage",
"collection"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipListenersHolder.java#L395-L413 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java | ProxyBranchImpl.onBranchTerminated | public void onBranchTerminated() {
if(outgoingRequest != null) {
String txid = ((ViaHeader) outgoingRequest.getMessage().getHeader(ViaHeader.NAME)).getBranch();
proxy.removeTransaction(txid);
}
} | java | public void onBranchTerminated() {
if(outgoingRequest != null) {
String txid = ((ViaHeader) outgoingRequest.getMessage().getHeader(ViaHeader.NAME)).getBranch();
proxy.removeTransaction(txid);
}
} | [
"public",
"void",
"onBranchTerminated",
"(",
")",
"{",
"if",
"(",
"outgoingRequest",
"!=",
"null",
")",
"{",
"String",
"txid",
"=",
"(",
"(",
"ViaHeader",
")",
"outgoingRequest",
".",
"getMessage",
"(",
")",
".",
"getHeader",
"(",
"ViaHeader",
".",
"NAME",... | This will be called when we are sure this branch will not succeed and we moved on to other branches. | [
"This",
"will",
"be",
"called",
"when",
"we",
"are",
"sure",
"this",
"branch",
"will",
"not",
"succeed",
"and",
"we",
"moved",
"on",
"to",
"other",
"branches",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java#L285-L290 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java | ProxyBranchImpl.start | public void start() {
if(logger.isDebugEnabled()) {
logger.debug("start");
}
if(started) {
throw new IllegalStateException("Proxy branch alredy started!");
}
if(canceled) {
throw new IllegalStateException("Proxy branch was cancelled, you must create a new branch!");
}
if(timedOut) {
throw n... | java | public void start() {
if(logger.isDebugEnabled()) {
logger.debug("start");
}
if(started) {
throw new IllegalStateException("Proxy branch alredy started!");
}
if(canceled) {
throw new IllegalStateException("Proxy branch was cancelled, you must create a new branch!");
}
if(timedOut) {
throw n... | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"start\"",
")",
";",
"}",
"if",
"(",
"started",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Proxy br... | After the branch is initialized, this method proxies the initial request to the
specified destination. Subsequent requests are proxied through proxySubsequentRequest | [
"After",
"the",
"branch",
"is",
"initialized",
"this",
"method",
"proxies",
"the",
"initial",
"request",
"to",
"the",
"specified",
"destination",
".",
"Subsequent",
"requests",
"are",
"proxied",
"through",
"proxySubsequentRequest"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java#L426-L507 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java | ProxyBranchImpl.cancelTimer | public void cancelTimer() {
synchronized (cTimerLock) {
if (proxyTimeoutTask != null && proxyBranchTimerStarted) {
proxyTimeoutTask.cancel();
proxyTimeoutTask = null;
proxyBranchTimerStarted = false;
}
}
} | java | public void cancelTimer() {
synchronized (cTimerLock) {
if (proxyTimeoutTask != null && proxyBranchTimerStarted) {
proxyTimeoutTask.cancel();
proxyTimeoutTask = null;
proxyBranchTimerStarted = false;
}
}
} | [
"public",
"void",
"cancelTimer",
"(",
")",
"{",
"synchronized",
"(",
"cTimerLock",
")",
"{",
"if",
"(",
"proxyTimeoutTask",
"!=",
"null",
"&&",
"proxyBranchTimerStarted",
")",
"{",
"proxyTimeoutTask",
".",
"cancel",
"(",
")",
";",
"proxyTimeoutTask",
"=",
"nul... | Stop the C Timer. | [
"Stop",
"the",
"C",
"Timer",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java#L1126-L1134 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java | ProxyBranchImpl.cancel1xxTimer | public void cancel1xxTimer() {
if (proxy1xxTimeoutTask != null && proxyBranch1xxTimerStarted) {
proxy1xxTimeoutTask.cancel();
proxy1xxTimeoutTask = null;
proxyBranch1xxTimerStarted = false;
}
} | java | public void cancel1xxTimer() {
if (proxy1xxTimeoutTask != null && proxyBranch1xxTimerStarted) {
proxy1xxTimeoutTask.cancel();
proxy1xxTimeoutTask = null;
proxyBranch1xxTimerStarted = false;
}
} | [
"public",
"void",
"cancel1xxTimer",
"(",
")",
"{",
"if",
"(",
"proxy1xxTimeoutTask",
"!=",
"null",
"&&",
"proxyBranch1xxTimerStarted",
")",
"{",
"proxy1xxTimeoutTask",
".",
"cancel",
"(",
")",
";",
"proxy1xxTimeoutTask",
"=",
"null",
";",
"proxyBranch1xxTimerStarted... | Stop the Extension Timer for 1xx. | [
"Stop",
"the",
"Extension",
"Timer",
"for",
"1xx",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/proxy/ProxyBranchImpl.java#L1139-L1145 | train |
RestComm/sip-servlets | containers/sip-servlets-catalina-8/src/main/java/org/mobicents/servlet/sip/catalina/NodeCreateRule.java | NodeCreateRule.begin | @Override
public void begin(String namespaceURI, String name, Attributes attributes)
throws Exception {
XMLReader xmlReader = getDigester().getXMLReader();
Document doc = documentBuilder.newDocument();
NodeBuilder builder = null;
if (nodeType == Node.ELEMENT_NODE) {
... | java | @Override
public void begin(String namespaceURI, String name, Attributes attributes)
throws Exception {
XMLReader xmlReader = getDigester().getXMLReader();
Document doc = documentBuilder.newDocument();
NodeBuilder builder = null;
if (nodeType == Node.ELEMENT_NODE) {
... | [
"@",
"Override",
"public",
"void",
"begin",
"(",
"String",
"namespaceURI",
",",
"String",
"name",
",",
"Attributes",
"attributes",
")",
"throws",
"Exception",
"{",
"XMLReader",
"xmlReader",
"=",
"getDigester",
"(",
")",
".",
"getXMLReader",
"(",
")",
";",
"D... | Implemented to replace the content handler currently in use by a
NodeBuilder.
@param namespaceURI the namespace URI of the matching element, or an
empty string if the parser is not namespace aware or the element has
no namespace
@param name the local name if the parser is namespace aware, or just
the element name othe... | [
"Implemented",
"to",
"replace",
"the",
"content",
"handler",
"currently",
"in",
"use",
"by",
"a",
"NodeBuilder",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-catalina-8/src/main/java/org/mobicents/servlet/sip/catalina/NodeCreateRule.java#L394-L424 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.friends_areFriends | public T friends_areFriends(int userId1, int userId2)
throws FacebookException, IOException {
return this.callMethod(FacebookMethod.FRIENDS_ARE_FRIENDS,
new Pair<String, CharSequence>("uids1", Integer.toString(userId1)),
new Pair<String, CharSequence>("uids2... | java | public T friends_areFriends(int userId1, int userId2)
throws FacebookException, IOException {
return this.callMethod(FacebookMethod.FRIENDS_ARE_FRIENDS,
new Pair<String, CharSequence>("uids1", Integer.toString(userId1)),
new Pair<String, CharSequence>("uids2... | [
"public",
"T",
"friends_areFriends",
"(",
"int",
"userId1",
",",
"int",
"userId2",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"FRIENDS_ARE_FRIENDS",
",",
"new",
"Pair",
"<",
"Stri... | Retrieves whether two users are friends.
@param userId1
@param userId2
@return T
@see <a href="http://wiki.developers.facebook.com/index.php/Friends.areFriends">
Developers Wiki: Friends.areFriends</a> | [
"Retrieves",
"whether",
"two",
"users",
"are",
"friends",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L166-L171 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.profile_getFBML | public T profile_getFBML(Integer userId)
throws FacebookException, IOException {
return this.callMethod(FacebookMethod.PROFILE_GET_FBML,
new Pair<String, CharSequence>("uid", Integer.toString(userId)));
} | java | public T profile_getFBML(Integer userId)
throws FacebookException, IOException {
return this.callMethod(FacebookMethod.PROFILE_GET_FBML,
new Pair<String, CharSequence>("uid", Integer.toString(userId)));
} | [
"public",
"T",
"profile_getFBML",
"(",
"Integer",
"userId",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"PROFILE_GET_FBML",
",",
"new",
"Pair",
"<",
"String",
",",
"CharSequence",
... | Gets the FBML for a user's profile, including the content for both the profile box
and the profile actions.
@param userId the user whose profile FBML to set
@return a T containing FBML markup | [
"Gets",
"the",
"FBML",
"for",
"a",
"user",
"s",
"profile",
"including",
"the",
"content",
"for",
"both",
"the",
"profile",
"box",
"and",
"the",
"profile",
"actions",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L207-L212 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.handleFeedImages | protected void handleFeedImages(List<Pair<String, CharSequence>> params,
Collection<IFeedImage> images) {
if (images != null && images.size() > 4) {
throw new IllegalArgumentException("At most four images are allowed, got " +
Integer.t... | java | protected void handleFeedImages(List<Pair<String, CharSequence>> params,
Collection<IFeedImage> images) {
if (images != null && images.size() > 4) {
throw new IllegalArgumentException("At most four images are allowed, got " +
Integer.t... | [
"protected",
"void",
"handleFeedImages",
"(",
"List",
"<",
"Pair",
"<",
"String",
",",
"CharSequence",
">",
">",
"params",
",",
"Collection",
"<",
"IFeedImage",
">",
"images",
")",
"{",
"if",
"(",
"images",
"!=",
"null",
"&&",
"images",
".",
"size",
"(",... | Adds image parameters to a list of parameters
@param params
@param images | [
"Adds",
"image",
"parameters",
"to",
"a",
"list",
"of",
"parameters"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L256-L275 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.feed_publishTemplatizedAction | public boolean feed_publishTemplatizedAction(Integer actorId, CharSequence titleTemplate)
throws FacebookException, IOException {
if (null != actorId && actorId != this._userId) {
throw new IllegalArgumentException("Actor ID parameter is deprecated");
}
return feed_publishTemplatizedAction(titleTe... | java | public boolean feed_publishTemplatizedAction(Integer actorId, CharSequence titleTemplate)
throws FacebookException, IOException {
if (null != actorId && actorId != this._userId) {
throw new IllegalArgumentException("Actor ID parameter is deprecated");
}
return feed_publishTemplatizedAction(titleTe... | [
"public",
"boolean",
"feed_publishTemplatizedAction",
"(",
"Integer",
"actorId",
",",
"CharSequence",
"titleTemplate",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"if",
"(",
"null",
"!=",
"actorId",
"&&",
"actorId",
"!=",
"this",
".",
"_userId",
"... | Publishes a Mini-Feed story describing an action taken by a user, and
publishes aggregating News Feed stories to the friends of that user.
Stories are identified as being combinable if they have matching templates and substituted values.
@param actorId deprecated
@param titleTemplate markup (up to 60 chars, tags exclud... | [
"Publishes",
"a",
"Mini",
"-",
"Feed",
"story",
"describing",
"an",
"action",
"taken",
"by",
"a",
"user",
"and",
"publishes",
"aggregating",
"News",
"Feed",
"stories",
"to",
"the",
"friends",
"of",
"that",
"user",
".",
"Stories",
"are",
"identified",
"as",
... | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L386-L392 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.groups_getMembers | public T groups_getMembers(Number groupId)
throws FacebookException, IOException {
assert (null != groupId);
return this.callMethod(FacebookMethod.GROUPS_GET_MEMBERS,
new Pair<String, CharSequence>("gid", groupId.toString()));
} | java | public T groups_getMembers(Number groupId)
throws FacebookException, IOException {
assert (null != groupId);
return this.callMethod(FacebookMethod.GROUPS_GET_MEMBERS,
new Pair<String, CharSequence>("gid", groupId.toString()));
} | [
"public",
"T",
"groups_getMembers",
"(",
"Number",
"groupId",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"(",
"null",
"!=",
"groupId",
")",
";",
"return",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"GROUPS_GET_MEMBERS",
",... | Retrieves the membership list of a group
@param groupId the group id
@return a T containing four membership lists of
'members', 'admins', 'officers', and 'not_replied' | [
"Retrieves",
"the",
"membership",
"list",
"of",
"a",
"group"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L566-L571 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.events_getMembers | public T events_getMembers(Number eventId)
throws FacebookException, IOException {
assert (null != eventId);
return this.callMethod(FacebookMethod.EVENTS_GET_MEMBERS,
new Pair<String, CharSequence>("eid", eventId.toString()));
} | java | public T events_getMembers(Number eventId)
throws FacebookException, IOException {
assert (null != eventId);
return this.callMethod(FacebookMethod.EVENTS_GET_MEMBERS,
new Pair<String, CharSequence>("eid", eventId.toString()));
} | [
"public",
"T",
"events_getMembers",
"(",
"Number",
"eventId",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"(",
"null",
"!=",
"eventId",
")",
";",
"return",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"EVENTS_GET_MEMBERS",
",... | Retrieves the membership list of an event
@param eventId event id
@return T consisting of four membership lists corresponding to RSVP status, with keys
'attending', 'unsure', 'declined', and 'not_replied' | [
"Retrieves",
"the",
"membership",
"list",
"of",
"an",
"event"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L589-L594 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.fql_query | public T fql_query(CharSequence query)
throws FacebookException, IOException {
assert (null != query);
return this.callMethod(FacebookMethod.FQL_QUERY,
new Pair<String, CharSequence>("query", query));
} | java | public T fql_query(CharSequence query)
throws FacebookException, IOException {
assert (null != query);
return this.callMethod(FacebookMethod.FQL_QUERY,
new Pair<String, CharSequence>("query", query));
} | [
"public",
"T",
"fql_query",
"(",
"CharSequence",
"query",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"(",
"null",
"!=",
"query",
")",
";",
"return",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"FQL_QUERY",
",",
"new",
"... | Retrieves the results of a Facebook Query Language query
@param query : the FQL query statement
@return varies depending on the FQL query | [
"Retrieves",
"the",
"results",
"of",
"a",
"Facebook",
"Query",
"Language",
"query"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L611-L616 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.photos_getTags | public T photos_getTags(Collection<Long> photoIds)
throws FacebookException, IOException {
return this.callMethod(FacebookMethod.PHOTOS_GET_TAGS,
new Pair<String, CharSequence>("pids", delimit(photoIds)));
} | java | public T photos_getTags(Collection<Long> photoIds)
throws FacebookException, IOException {
return this.callMethod(FacebookMethod.PHOTOS_GET_TAGS,
new Pair<String, CharSequence>("pids", delimit(photoIds)));
} | [
"public",
"T",
"photos_getTags",
"(",
"Collection",
"<",
"Long",
">",
"photoIds",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"PHOTOS_GET_TAGS",
",",
"new",
"Pair",
"<",
"String",
... | Retrieves the tags for the given set of photos.
@param photoIds The list of photos from which to extract photo tags.
@return the created album | [
"Retrieves",
"the",
"tags",
"for",
"the",
"given",
"set",
"of",
"photos",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L809-L813 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.groups_get | public T groups_get(Integer userId, Collection<Long> groupIds)
throws FacebookException, IOException {
boolean hasGroups = (null != groupIds && !groupIds.isEmpty());
if (null != userId)
return hasGroups ?
this.callMethod(FacebookMethod.GROUPS_GET, new Pair<String, CharSequence>("uid", use... | java | public T groups_get(Integer userId, Collection<Long> groupIds)
throws FacebookException, IOException {
boolean hasGroups = (null != groupIds && !groupIds.isEmpty());
if (null != userId)
return hasGroups ?
this.callMethod(FacebookMethod.GROUPS_GET, new Pair<String, CharSequence>("uid", use... | [
"public",
"T",
"groups_get",
"(",
"Integer",
"userId",
",",
"Collection",
"<",
"Long",
">",
"groupIds",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"boolean",
"hasGroups",
"=",
"(",
"null",
"!=",
"groupIds",
"&&",
"!",
"groupIds",
".",
"isEm... | Retrieves the groups associated with a user
@param userId Optional: User associated with groups.
A null parameter will default to the session user.
@param groupIds Optional: group ids to query.
A null parameter will get all groups for the user.
@return array of groups | [
"Retrieves",
"the",
"groups",
"associated",
"with",
"a",
"user"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L823-L835 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.fbml_refreshRefUrl | public boolean fbml_refreshRefUrl(URL url)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.FBML_REFRESH_REF_URL,
new Pair<String, CharSequence>("url", url.toString())));
} | java | public boolean fbml_refreshRefUrl(URL url)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.FBML_REFRESH_REF_URL,
new Pair<String, CharSequence>("url", url.toString())));
} | [
"public",
"boolean",
"fbml_refreshRefUrl",
"(",
"URL",
"url",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"extractBoolean",
"(",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"FBML_REFRESH_REF_URL",
",",
"new",
"Pair",
"<",
"Str... | Recaches the referenced url.
@param url the URL to refresh
@return boolean indicating whether the refresh succeeded | [
"Recaches",
"the",
"referenced",
"url",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L898-L902 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.users_getInfo | public T users_getInfo(Collection<Integer> userIds, EnumSet<ProfileField> fields)
throws FacebookException, IOException {
// assertions test for invalid params
assert (userIds != null);
assert (fields != null);
assert (!fields.isEmpty());
return this.callMethod(FacebookMethod.USERS_GET_INFO,
... | java | public T users_getInfo(Collection<Integer> userIds, EnumSet<ProfileField> fields)
throws FacebookException, IOException {
// assertions test for invalid params
assert (userIds != null);
assert (fields != null);
assert (!fields.isEmpty());
return this.callMethod(FacebookMethod.USERS_GET_INFO,
... | [
"public",
"T",
"users_getInfo",
"(",
"Collection",
"<",
"Integer",
">",
"userIds",
",",
"EnumSet",
"<",
"ProfileField",
">",
"fields",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"// assertions test for invalid params",
"assert",
"(",
"userIds",
"!=... | Retrieves the requested info fields for the requested set of users.
@param userIds a collection of user IDs for which to fetch info
@param fields a set of ProfileFields
@return a T consisting of a list of users, with each user element
containing the requested fields. | [
"Retrieves",
"the",
"requested",
"info",
"fields",
"for",
"the",
"requested",
"set",
"of",
"users",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L923-L933 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.users_getLoggedInUser | public int users_getLoggedInUser()
throws FacebookException, IOException {
T result = this.callMethod(FacebookMethod.USERS_GET_LOGGED_IN_USER);
return extractInt(result);
} | java | public int users_getLoggedInUser()
throws FacebookException, IOException {
T result = this.callMethod(FacebookMethod.USERS_GET_LOGGED_IN_USER);
return extractInt(result);
} | [
"public",
"int",
"users_getLoggedInUser",
"(",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"T",
"result",
"=",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"USERS_GET_LOGGED_IN_USER",
")",
";",
"return",
"extractInt",
"(",
"result",
")",... | Retrieves the user ID of the user logged in to this API session
@return the Facebook user ID of the logged-in user | [
"Retrieves",
"the",
"user",
"ID",
"of",
"the",
"user",
"logged",
"in",
"to",
"this",
"API",
"session"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L939-L943 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.auth_getUserId | public int auth_getUserId(String authToken)
throws FacebookException, IOException {
/*
* Get the session information if we don't have it; this will populate
* the user ID as well.
*/
if (null == this._sessionKey)
auth_getSession(authToken);
return this._userId;
} | java | public int auth_getUserId(String authToken)
throws FacebookException, IOException {
/*
* Get the session information if we don't have it; this will populate
* the user ID as well.
*/
if (null == this._sessionKey)
auth_getSession(authToken);
return this._userId;
} | [
"public",
"int",
"auth_getUserId",
"(",
"String",
"authToken",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"/*\n * Get the session information if we don't have it; this will populate\n\t * the user ID as well.\n\t */",
"if",
"(",
"null",
"==",
"this",
"."... | Call this function to get the user ID.
@return The ID of the current session's user, or -1 if none. | [
"Call",
"this",
"function",
"to",
"get",
"the",
"user",
"ID",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L950-L959 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.users_hasAppPermission | public boolean users_hasAppPermission(CharSequence permission)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.USERS_HAS_APP_PERMISSION,
new Pair<String, CharSequence>("ext_perm", permission)));
} | java | public boolean users_hasAppPermission(CharSequence permission)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.USERS_HAS_APP_PERMISSION,
new Pair<String, CharSequence>("ext_perm", permission)));
} | [
"public",
"boolean",
"users_hasAppPermission",
"(",
"CharSequence",
"permission",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"extractBoolean",
"(",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"USERS_HAS_APP_PERMISSION",
",",
"new",... | Retrieves whether the logged-in user has granted the specified permission
to this application.
@param permission an extended permission (e.g. FacebookExtendedPerm.MARKETPLACE,
"photo_upload")
@return boolean indicating whether the user has the permission
@see FacebookExtendedPerm
@see <a href="http://wiki.developers.fa... | [
"Retrieves",
"whether",
"the",
"logged",
"-",
"in",
"user",
"has",
"granted",
"the",
"specified",
"permission",
"to",
"this",
"application",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1000-L1004 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.users_setStatus | public boolean users_setStatus(String status)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.USERS_SET_STATUS,
new Pair<String, CharSequence>("status", status)));
} | java | public boolean users_setStatus(String status)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.USERS_SET_STATUS,
new Pair<String, CharSequence>("status", status)));
} | [
"public",
"boolean",
"users_setStatus",
"(",
"String",
"status",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"extractBoolean",
"(",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"USERS_SET_STATUS",
",",
"new",
"Pair",
"<",
"Stri... | Sets the logged-in user's Facebook status.
Requires the status_update extended permission.
@return whether the status was successfully set
@see #users_hasAppPermission
@see FacebookExtendedPerm#STATUS_UPDATE
@see <a href="http://wiki.developers.facebook.com/index.php/Users.setStatus">
Developers Wiki: Users.setStatus</... | [
"Sets",
"the",
"logged",
"-",
"in",
"user",
"s",
"Facebook",
"status",
".",
"Requires",
"the",
"status_update",
"extended",
"permission",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1015-L1019 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.users_clearStatus | public boolean users_clearStatus()
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.USERS_SET_STATUS,
new Pair<String, CharSequence>("clear", "1")));
} | java | public boolean users_clearStatus()
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.USERS_SET_STATUS,
new Pair<String, CharSequence>("clear", "1")));
} | [
"public",
"boolean",
"users_clearStatus",
"(",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"extractBoolean",
"(",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"USERS_SET_STATUS",
",",
"new",
"Pair",
"<",
"String",
",",
"CharSeq... | Clears the logged-in user's Facebook status.
Requires the status_update extended permission.
@return whether the status was successfully cleared
@see #users_hasAppPermission
@see FacebookExtendedPerm#STATUS_UPDATE
@see <a href="http://wiki.developers.facebook.com/index.php/Users.setStatus">
Developers Wiki: Users.setSt... | [
"Clears",
"the",
"logged",
"-",
"in",
"user",
"s",
"Facebook",
"status",
".",
"Requires",
"the",
"status_update",
"extended",
"permission",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1030-L1034 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.notifications_send | public void notifications_send(Collection<Integer> recipientIds, CharSequence notification)
throws FacebookException, IOException {
assert (null != notification);
ArrayList<Pair<String, CharSequence>> args = new ArrayList<Pair<String, CharSequence>>(3);
if (null != recipientIds && !recipientIds.isEmpty(... | java | public void notifications_send(Collection<Integer> recipientIds, CharSequence notification)
throws FacebookException, IOException {
assert (null != notification);
ArrayList<Pair<String, CharSequence>> args = new ArrayList<Pair<String, CharSequence>>(3);
if (null != recipientIds && !recipientIds.isEmpty(... | [
"public",
"void",
"notifications_send",
"(",
"Collection",
"<",
"Integer",
">",
"recipientIds",
",",
"CharSequence",
"notification",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"(",
"null",
"!=",
"notification",
")",
";",
"ArrayList",
"<... | Send a notification message to the specified users on behalf of the logged-in user.
@param recipientIds the user ids to which the message is to be sent. if empty,
notification will be sent to logged-in user.
@param notification the FBML to be displayed on the notifications page; only a stripped-down
set of FBML tags t... | [
"Send",
"a",
"notification",
"message",
"to",
"the",
"specified",
"users",
"on",
"behalf",
"of",
"the",
"logged",
"-",
"in",
"user",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1156-L1165 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.photos_addTags | public T photos_addTags(Long photoId, Collection<PhotoTag> tags)
throws FacebookException, IOException {
assert (photoId > 0);
assert (null != tags && !tags.isEmpty());
JSONArray jsonTags = new JSONArray();
for (PhotoTag tag : tags) {
jsonTags.add(tag.jsonify());
}
return this.callMe... | java | public T photos_addTags(Long photoId, Collection<PhotoTag> tags)
throws FacebookException, IOException {
assert (photoId > 0);
assert (null != tags && !tags.isEmpty());
JSONArray jsonTags = new JSONArray();
for (PhotoTag tag : tags) {
jsonTags.add(tag.jsonify());
}
return this.callMe... | [
"public",
"T",
"photos_addTags",
"(",
"Long",
"photoId",
",",
"Collection",
"<",
"PhotoTag",
">",
"tags",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"(",
"photoId",
">",
"0",
")",
";",
"assert",
"(",
"null",
"!=",
"tags",
"&&",
... | Adds several tags to a photo.
@param photoId The photo id of the photo to be tagged.
@param tags A list of PhotoTags.
@return a list of booleans indicating whether the tag was successfully added. | [
"Adds",
"several",
"tags",
"to",
"a",
"photo",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1364-L1377 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.events_get | public T events_get(Integer userId, Collection<Long> eventIds, Long startTime, Long endTime)
throws FacebookException, IOException {
ArrayList<Pair<String, CharSequence>> params =
new ArrayList<Pair<String, CharSequence>>(FacebookMethod.EVENTS_GET.numParams());
boolean hasUserId = null != userId && 0... | java | public T events_get(Integer userId, Collection<Long> eventIds, Long startTime, Long endTime)
throws FacebookException, IOException {
ArrayList<Pair<String, CharSequence>> params =
new ArrayList<Pair<String, CharSequence>>(FacebookMethod.EVENTS_GET.numParams());
boolean hasUserId = null != userId && 0... | [
"public",
"T",
"events_get",
"(",
"Integer",
"userId",
",",
"Collection",
"<",
"Long",
">",
"eventIds",
",",
"Long",
"startTime",
",",
"Long",
"endTime",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"ArrayList",
"<",
"Pair",
"<",
"String",
",... | Returns all visible events according to the filters specified. This may be used to find all events of a user, or to query specific eids.
@param eventIds filter by these event ID's (optional)
@param userId filter by this user only (optional)
@param startTime UTC lower bound (optional)
@param endTime UTC upper bound (opt... | [
"Returns",
"all",
"visible",
"events",
"according",
"to",
"the",
"filters",
"specified",
".",
"This",
"may",
"be",
"used",
"to",
"find",
"all",
"events",
"of",
"a",
"user",
"or",
"to",
"query",
"specific",
"eids",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1391-L1410 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.profile_setFBML | public boolean profile_setFBML(CharSequence fbmlMarkup, Integer userId)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.PROFILE_SET_FBML,
new Pair<String, CharSequence>("uid", Integer.toString(userId)),
... | java | public boolean profile_setFBML(CharSequence fbmlMarkup, Integer userId)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.PROFILE_SET_FBML,
new Pair<String, CharSequence>("uid", Integer.toString(userId)),
... | [
"public",
"boolean",
"profile_setFBML",
"(",
"CharSequence",
"fbmlMarkup",
",",
"Integer",
"userId",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"extractBoolean",
"(",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"PROFILE_SET_FBML"... | Sets the FBML for a user's profile, including the content for both the profile box
and the profile actions.
@param userId the user whose profile FBML to set
@param fbmlMarkup refer to the FBML documentation for a description of the markup and its role in various contexts
@return a boolean indicating whether the FBML wa... | [
"Sets",
"the",
"FBML",
"for",
"a",
"user",
"s",
"profile",
"including",
"the",
"content",
"for",
"both",
"the",
"profile",
"box",
"and",
"the",
"profile",
"actions",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1421-L1426 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.profile_setProfileFBML | public boolean profile_setProfileFBML(CharSequence fbmlMarkup)
throws FacebookException, IOException {
return profile_setFBML(fbmlMarkup, /* profileActionFbmlMarkup */null, /* mobileFbmlMarkup */null,
/* profileId */null);
} | java | public boolean profile_setProfileFBML(CharSequence fbmlMarkup)
throws FacebookException, IOException {
return profile_setFBML(fbmlMarkup, /* profileActionFbmlMarkup */null, /* mobileFbmlMarkup */null,
/* profileId */null);
} | [
"public",
"boolean",
"profile_setProfileFBML",
"(",
"CharSequence",
"fbmlMarkup",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"profile_setFBML",
"(",
"fbmlMarkup",
",",
"/* profileActionFbmlMarkup */",
"null",
",",
"/* mobileFbmlMarkup */",
"null"... | Sets the FBML for a profile box on the logged-in user's profile.
@param fbmlMarkup refer to the FBML documentation for a description of the markup and its role in various contexts
@return a boolean indicating whether the FBML was successfully set
@see <a href="http://wiki.developers.facebook.com/index.php/Profile.setFB... | [
"Sets",
"the",
"FBML",
"for",
"a",
"profile",
"box",
"on",
"the",
"logged",
"-",
"in",
"user",
"s",
"profile",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1435-L1439 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.profile_setProfileActionFBML | public boolean profile_setProfileActionFBML(CharSequence fbmlMarkup)
throws FacebookException, IOException {
return profile_setFBML( /* profileFbmlMarkup */null, fbmlMarkup, /* mobileFbmlMarkup */null,
/* profileId */null);
} | java | public boolean profile_setProfileActionFBML(CharSequence fbmlMarkup)
throws FacebookException, IOException {
return profile_setFBML( /* profileFbmlMarkup */null, fbmlMarkup, /* mobileFbmlMarkup */null,
/* profileId */null);
} | [
"public",
"boolean",
"profile_setProfileActionFBML",
"(",
"CharSequence",
"fbmlMarkup",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"profile_setFBML",
"(",
"/* profileFbmlMarkup */",
"null",
",",
"fbmlMarkup",
",",
"/* mobileFbmlMarkup */",
"null"... | Sets the FBML for profile actions for the logged-in user.
@param fbmlMarkup refer to the FBML documentation for a description of the markup and its role in various contexts
@return a boolean indicating whether the FBML was successfully set
@see <a href="http://wiki.developers.facebook.com/index.php/Profile.setFBML">
D... | [
"Sets",
"the",
"FBML",
"for",
"profile",
"actions",
"for",
"the",
"logged",
"-",
"in",
"user",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1448-L1452 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.profile_setMobileFBML | public boolean profile_setMobileFBML(CharSequence fbmlMarkup)
throws FacebookException, IOException {
return profile_setFBML( /* profileFbmlMarkup */null, /* profileActionFbmlMarkup */null, fbmlMarkup,
/* profileId */null);
} | java | public boolean profile_setMobileFBML(CharSequence fbmlMarkup)
throws FacebookException, IOException {
return profile_setFBML( /* profileFbmlMarkup */null, /* profileActionFbmlMarkup */null, fbmlMarkup,
/* profileId */null);
} | [
"public",
"boolean",
"profile_setMobileFBML",
"(",
"CharSequence",
"fbmlMarkup",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"profile_setFBML",
"(",
"/* profileFbmlMarkup */",
"null",
",",
"/* profileActionFbmlMarkup */",
"null",
",",
"fbmlMarkup"... | Sets the FBML for the logged-in user's profile on mobile devices.
@param fbmlMarkup refer to the FBML documentation for a description of the markup and its role in various contexts
@return a boolean indicating whether the FBML was successfully set
@see <a href="http://wiki.developers.facebook.com/index.php/Profile.setF... | [
"Sets",
"the",
"FBML",
"for",
"the",
"logged",
"-",
"in",
"user",
"s",
"profile",
"on",
"mobile",
"devices",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1461-L1465 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.profile_setFBML | public boolean profile_setFBML(CharSequence profileFbmlMarkup, CharSequence profileActionFbmlMarkup)
throws FacebookException, IOException {
return profile_setFBML(profileFbmlMarkup, profileActionFbmlMarkup, /* mobileFbmlMarkup */null, /* profileId */null);
} | java | public boolean profile_setFBML(CharSequence profileFbmlMarkup, CharSequence profileActionFbmlMarkup)
throws FacebookException, IOException {
return profile_setFBML(profileFbmlMarkup, profileActionFbmlMarkup, /* mobileFbmlMarkup */null, /* profileId */null);
} | [
"public",
"boolean",
"profile_setFBML",
"(",
"CharSequence",
"profileFbmlMarkup",
",",
"CharSequence",
"profileActionFbmlMarkup",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"profile_setFBML",
"(",
"profileFbmlMarkup",
",",
"profileActionFbmlMarkup"... | Sets the FBML for the profile box and profile actions for the logged-in user.
Refer to the FBML documentation for a description of the markup and its role in various contexts.
@param profileFbmlMarkup the FBML for the profile box
@param profileActionFbmlMarkup the FBML for the profile actions
@return a boolean indicati... | [
"Sets",
"the",
"FBML",
"for",
"the",
"profile",
"box",
"and",
"profile",
"actions",
"for",
"the",
"logged",
"-",
"in",
"user",
".",
"Refer",
"to",
"the",
"FBML",
"documentation",
"for",
"a",
"description",
"of",
"the",
"markup",
"and",
"its",
"role",
"in... | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1515-L1518 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.photos_getAlbums | public T photos_getAlbums(Collection<Long> albumIds)
throws FacebookException, IOException {
return photos_getAlbums(null, /*userId*/albumIds);
} | java | public T photos_getAlbums(Collection<Long> albumIds)
throws FacebookException, IOException {
return photos_getAlbums(null, /*userId*/albumIds);
} | [
"public",
"T",
"photos_getAlbums",
"(",
"Collection",
"<",
"Long",
">",
"albumIds",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"photos_getAlbums",
"(",
"null",
",",
"/*userId*/",
"albumIds",
")",
";",
"}"
] | Retrieves album metadata for a list of album IDs.
@param albumIds the ids of albums whose metadata is to be retrieved
@return album objects
@see <a href="http://wiki.developers.facebook.com/index.php/Photos.getAlbums">
Developers Wiki: Photos.getAlbums</a> | [
"Retrieves",
"album",
"metadata",
"for",
"a",
"list",
"of",
"album",
"IDs",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1774-L1777 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.fbml_refreshImgSrc | public boolean fbml_refreshImgSrc(URL imageUrl)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.FBML_REFRESH_IMG_SRC,
new Pair<String, CharSequence>("url",
... | java | public boolean fbml_refreshImgSrc(URL imageUrl)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.FBML_REFRESH_IMG_SRC,
new Pair<String, CharSequence>("url",
... | [
"public",
"boolean",
"fbml_refreshImgSrc",
"(",
"URL",
"imageUrl",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"extractBoolean",
"(",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"FBML_REFRESH_IMG_SRC",
",",
"new",
"Pair",
"<",
... | Recaches the image with the specified imageUrl.
@param imageUrl the image URL to refresh
@return boolean indicating whether the refresh succeeded | [
"Recaches",
"the",
"image",
"with",
"the",
"specified",
"imageUrl",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1824-L1829 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.auth_createToken | public String auth_createToken()
throws FacebookException, IOException {
T d = this.callMethod(FacebookMethod.AUTH_CREATE_TOKEN);
return extractString(d);
} | java | public String auth_createToken()
throws FacebookException, IOException {
T d = this.callMethod(FacebookMethod.AUTH_CREATE_TOKEN);
return extractString(d);
} | [
"public",
"String",
"auth_createToken",
"(",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"T",
"d",
"=",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"AUTH_CREATE_TOKEN",
")",
";",
"return",
"extractString",
"(",
"d",
")",
";",
"}"
] | Call this function and store the result, using it to generate the
appropriate login url and then to retrieve the session information.
@return an authentication token | [
"Call",
"this",
"function",
"and",
"store",
"the",
"result",
"using",
"it",
"to",
"generate",
"the",
"appropriate",
"login",
"url",
"and",
"then",
"to",
"retrieve",
"the",
"session",
"information",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1907-L1911 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.marketplace_createListing | public Long marketplace_createListing(Boolean showOnProfile, MarketplaceListing attrs)
throws FacebookException, IOException {
T result =
this.callMethod(FacebookMethod.MARKETPLACE_CREATE_LISTING,
new Pair<String, CharSequence>("show_on_profile", showOnProfile ? "1" : "0"),
... | java | public Long marketplace_createListing(Boolean showOnProfile, MarketplaceListing attrs)
throws FacebookException, IOException {
T result =
this.callMethod(FacebookMethod.MARKETPLACE_CREATE_LISTING,
new Pair<String, CharSequence>("show_on_profile", showOnProfile ? "1" : "0"),
... | [
"public",
"Long",
"marketplace_createListing",
"(",
"Boolean",
"showOnProfile",
",",
"MarketplaceListing",
"attrs",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"T",
"result",
"=",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"MARKETPLACE_CRE... | Create a marketplace listing
@param showOnProfile whether the listing can be shown on the user's profile
@param attrs the properties of the listing
@return the id of the created listing
@see MarketplaceListing
@see <a href="http://wiki.developers.facebook.com/index.php/Marketplace.createListing">
Developers Wiki: marke... | [
"Create",
"a",
"marketplace",
"listing"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1929-L1937 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.marketplace_removeListing | public boolean marketplace_removeListing(Long listingId, CharSequence status)
throws FacebookException, IOException {
assert MARKETPLACE_STATUS_DEFAULT.equals(status) || MARKETPLACE_STATUS_SUCCESS.equals(status) ||
MARKETPLACE_STATUS_NOT_SUCCESS.equals(status) : "Invalid status: " + status;
T result ... | java | public boolean marketplace_removeListing(Long listingId, CharSequence status)
throws FacebookException, IOException {
assert MARKETPLACE_STATUS_DEFAULT.equals(status) || MARKETPLACE_STATUS_SUCCESS.equals(status) ||
MARKETPLACE_STATUS_NOT_SUCCESS.equals(status) : "Invalid status: " + status;
T result ... | [
"public",
"boolean",
"marketplace_removeListing",
"(",
"Long",
"listingId",
",",
"CharSequence",
"status",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"MARKETPLACE_STATUS_DEFAULT",
".",
"equals",
"(",
"status",
")",
"||",
"MARKETPLACE_STATUS_S... | Remove a marketplace listing
@param listingId the listing to be removed
@param status MARKETPLACE_STATUS_DEFAULT, MARKETPLACE_STATUS_SUCCESS, or MARKETPLACE_STATUS_NOT_SUCCESS
@return boolean indicating whether the listing was removed
@see <a href="http://wiki.developers.facebook.com/index.php/Marketplace.removeListing... | [
"Remove",
"a",
"marketplace",
"listing"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1980-L1990 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.marketplace_getSubCategories | public T marketplace_getSubCategories(CharSequence category)
throws FacebookException, IOException {
return this.callMethod(FacebookMethod.MARKETPLACE_GET_SUBCATEGORIES,
new Pair<String, CharSequence>("category", category));
} | java | public T marketplace_getSubCategories(CharSequence category)
throws FacebookException, IOException {
return this.callMethod(FacebookMethod.MARKETPLACE_GET_SUBCATEGORIES,
new Pair<String, CharSequence>("category", category));
} | [
"public",
"T",
"marketplace_getSubCategories",
"(",
"CharSequence",
"category",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"MARKETPLACE_GET_SUBCATEGORIES",
",",
"new",
"Pair",
"<",
"Str... | Get the subcategories available for a category.
@param category a category, e.g. "HOUSING"
@return a T listing the marketplace sub-categories
@see <a href="http://wiki.developers.facebook.com/index.php/Marketplace.getSubCategories">
Developers Wiki: marketplace.getSubCategories</a> | [
"Get",
"the",
"subcategories",
"available",
"for",
"a",
"category",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2010-L2014 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.pages_isAppAdded | public boolean pages_isAppAdded(Long pageId)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.PAGES_IS_APP_ADDED,
new Pair<String,CharSequence>("page_id", pageId.toString())));
} | java | public boolean pages_isAppAdded(Long pageId)
throws FacebookException, IOException {
return extractBoolean(this.callMethod(FacebookMethod.PAGES_IS_APP_ADDED,
new Pair<String,CharSequence>("page_id", pageId.toString())));
} | [
"public",
"boolean",
"pages_isAppAdded",
"(",
"Long",
"pageId",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"extractBoolean",
"(",
"this",
".",
"callMethod",
"(",
"FacebookMethod",
".",
"PAGES_IS_APP_ADDED",
",",
"new",
"Pair",
"<",
"Str... | Checks whether a page has added the application
@param pageId the ID of the page
@return true if the page has added the application
@see <a href="http://wiki.developers.facebook.com/index.php/Pages.isAppAdded">
Developers Wiki: Pages.isAppAdded</a> | [
"Checks",
"whether",
"a",
"page",
"has",
"added",
"the",
"application"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2172-L2176 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.admin_setAppProperties | public boolean admin_setAppProperties(ApplicationPropertySet properties)
throws FacebookException, IOException {
if (null == properties || properties.isEmpty()) {
throw new IllegalArgumentException("expecting a non-empty set of application properties");
}
return extractBoolean(this.callMethod(Fac... | java | public boolean admin_setAppProperties(ApplicationPropertySet properties)
throws FacebookException, IOException {
if (null == properties || properties.isEmpty()) {
throw new IllegalArgumentException("expecting a non-empty set of application properties");
}
return extractBoolean(this.callMethod(Fac... | [
"public",
"boolean",
"admin_setAppProperties",
"(",
"ApplicationPropertySet",
"properties",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"if",
"(",
"null",
"==",
"properties",
"||",
"properties",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
... | Sets several property values for an application. The properties available
are analogous to the ones editable via the Facebook Developer application.
A session is not required to use this method.
@param properties an ApplicationPropertySet that is translated into
a single JSON String.
@return a boolean indicating whethe... | [
"Sets",
"several",
"property",
"values",
"for",
"an",
"application",
".",
"The",
"properties",
"available",
"are",
"analogous",
"to",
"the",
"ones",
"editable",
"via",
"the",
"Facebook",
"Developer",
"application",
".",
"A",
"session",
"is",
"not",
"required",
... | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L2229-L2237 | train |
RestComm/sip-servlets | sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java | DefaultApplicationRouterParser.init | public void init() {
// load the configuration file
String darConfigurationFileLocation = getDarConfigurationFileLocation();
if (log.isDebugEnabled()) {
log.debug("Default Application Router file Location : " + darConfigurationFileLocation);
}
File darConfigurat... | java | public void init() {
// load the configuration file
String darConfigurationFileLocation = getDarConfigurationFileLocation();
if (log.isDebugEnabled()) {
log.debug("Default Application Router file Location : " + darConfigurationFileLocation);
}
File darConfigurat... | [
"public",
"void",
"init",
"(",
")",
"{",
"// load the configuration file\r",
"String",
"darConfigurationFileLocation",
"=",
"getDarConfigurationFileLocation",
"(",
")",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"... | Load the configuration file as defined in JSR289 Appendix C ie as a system property "javax.servlet.sip.dar"
@throws IllegalArgumentException if anything goes wrong when trying to load the configuration file | [
"Load",
"the",
"configuration",
"file",
"as",
"defined",
"in",
"JSR289",
"Appendix",
"C",
"ie",
"as",
"a",
"system",
"property",
"javax",
".",
"servlet",
".",
"sip",
".",
"dar"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java#L76-L120 | train |
RestComm/sip-servlets | sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java | DefaultApplicationRouterParser.parse | public Map<String, List<? extends SipApplicationRouterInfo>> parse() throws ParseException {
Map<String, List<? extends SipApplicationRouterInfo>> sipApplicationRoutingInfo = new HashMap<String, List<? extends SipApplicationRouterInfo>>();
Iterator darEntriesIterator = properties.entrySet().iterator... | java | public Map<String, List<? extends SipApplicationRouterInfo>> parse() throws ParseException {
Map<String, List<? extends SipApplicationRouterInfo>> sipApplicationRoutingInfo = new HashMap<String, List<? extends SipApplicationRouterInfo>>();
Iterator darEntriesIterator = properties.entrySet().iterator... | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"?",
"extends",
"SipApplicationRouterInfo",
">",
">",
"parse",
"(",
")",
"throws",
"ParseException",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"?",
"extends",
"SipApplicationRouterInfo",
">",
">",
"sipAppl... | Parse the global default application router file from the loaded properties file from the init method
@return a Map of key as sip method and value as a list of SipApplicationRouterInfo
@throws ParseException if anything goes wrong during the parsing | [
"Parse",
"the",
"global",
"default",
"application",
"router",
"file",
"from",
"the",
"loaded",
"properties",
"file",
"from",
"the",
"init",
"method"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java#L128-L142 | train |
RestComm/sip-servlets | sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java | DefaultApplicationRouterParser.parse | public Map<String, List<? extends SipApplicationRouterInfo>> parse(String configuration) throws ParseException {
Properties tempProperties = new Properties();
// tempProperties.load(new StringReader(configuration)); // This needs Java 1.6
ByteArrayInputStream stringStream = new ByteArrayInput... | java | public Map<String, List<? extends SipApplicationRouterInfo>> parse(String configuration) throws ParseException {
Properties tempProperties = new Properties();
// tempProperties.load(new StringReader(configuration)); // This needs Java 1.6
ByteArrayInputStream stringStream = new ByteArrayInput... | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"?",
"extends",
"SipApplicationRouterInfo",
">",
">",
"parse",
"(",
"String",
"configuration",
")",
"throws",
"ParseException",
"{",
"Properties",
"tempProperties",
"=",
"new",
"Properties",
"(",
")",
";",
"// ... | Same method as above, but loads DAR configuration from a string.
@param configuration
@return
@throws ParseException | [
"Same",
"method",
"as",
"above",
"but",
"loads",
"DAR",
"configuration",
"from",
"a",
"string",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java#L151-L163 | train |
RestComm/sip-servlets | sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java | DefaultApplicationRouterParser.parse | public Map<String, List<? extends SipApplicationRouterInfo>> parse(Properties properties) throws ParseException {
this.properties = properties;
return parse();
} | java | public Map<String, List<? extends SipApplicationRouterInfo>> parse(Properties properties) throws ParseException {
this.properties = properties;
return parse();
} | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"?",
"extends",
"SipApplicationRouterInfo",
">",
">",
"parse",
"(",
"Properties",
"properties",
")",
"throws",
"ParseException",
"{",
"this",
".",
"properties",
"=",
"properties",
";",
"return",
"parse",
"(",
... | Same method as above, but loads DAR configuration from properties.
@param configuration
@return
@throws ParseException | [
"Same",
"method",
"as",
"above",
"but",
"loads",
"DAR",
"configuration",
"from",
"properties",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java#L172-L175 | train |
RestComm/sip-servlets | containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/SipServletImpl.java | SipServletImpl.registerJMX | protected void registerJMX(StandardContext ctx) {
ObjectName oname;
String parentName = ctx.getName();
parentName = ("".equals(parentName)) ? "/" : parentName;
String hostName = ctx.getParent().getName();
hostName = (hostName==null) ? "DEFAULT" : hostName;
String ... | java | protected void registerJMX(StandardContext ctx) {
ObjectName oname;
String parentName = ctx.getName();
parentName = ("".equals(parentName)) ? "/" : parentName;
String hostName = ctx.getParent().getName();
hostName = (hostName==null) ? "DEFAULT" : hostName;
String ... | [
"protected",
"void",
"registerJMX",
"(",
"StandardContext",
"ctx",
")",
"{",
"ObjectName",
"oname",
";",
"String",
"parentName",
"=",
"ctx",
".",
"getName",
"(",
")",
";",
"parentName",
"=",
"(",
"\"\"",
".",
"equals",
"(",
"parentName",
")",
")",
"?",
"... | copied over from super class changing the JMX name being registered j2eeType is now SipServlet instead of Servlet | [
"copied",
"over",
"from",
"super",
"class",
"changing",
"the",
"JMX",
"name",
"being",
"registered",
"j2eeType",
"is",
"now",
"SipServlet",
"instead",
"of",
"Servlet"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-catalina-7/src/main/java/org/mobicents/servlet/sip/catalina/SipServletImpl.java#L125-L158 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryFacade.java | SipFactoryFacade.checkHandler | private void checkHandler(SipServletRequest request) {
MobicentsSipSession sipSessionImpl = (MobicentsSipSession)request.getSession();
if(sipSessionImpl.getHandler() == null) {
try {
sipSessionImpl.setHandler(sipContext.getServletHandler());
// ((SipApplicationSessionImpl)sipSessionImpl.getApplicationSess... | java | private void checkHandler(SipServletRequest request) {
MobicentsSipSession sipSessionImpl = (MobicentsSipSession)request.getSession();
if(sipSessionImpl.getHandler() == null) {
try {
sipSessionImpl.setHandler(sipContext.getServletHandler());
// ((SipApplicationSessionImpl)sipSessionImpl.getApplicationSess... | [
"private",
"void",
"checkHandler",
"(",
"SipServletRequest",
"request",
")",
"{",
"MobicentsSipSession",
"sipSessionImpl",
"=",
"(",
"MobicentsSipSession",
")",
"request",
".",
"getSession",
"(",
")",
";",
"if",
"(",
"sipSessionImpl",
".",
"getHandler",
"(",
")",
... | set the handler for this request if none already exists.
The handler will be the main servlet of the sip context
@param request the session of this request will have its handler set. | [
"set",
"the",
"handler",
"for",
"this",
"request",
"if",
"none",
"already",
"exists",
".",
"The",
"handler",
"will",
"be",
"the",
"main",
"servlet",
"of",
"the",
"sip",
"context"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryFacade.java#L178-L189 | train |
RestComm/sip-servlets | sip-servlets-examples/shopping-demo-jsr309/business/src/main/java/org/jboss/mobicents/seam/model/Order.java | Order.round | private BigDecimal round(BigDecimal amount) {
return new BigDecimal(amount.movePointRight(2).add(new BigDecimal(".5")).toBigInteger()).movePointLeft(2);
} | java | private BigDecimal round(BigDecimal amount) {
return new BigDecimal(amount.movePointRight(2).add(new BigDecimal(".5")).toBigInteger()).movePointLeft(2);
} | [
"private",
"BigDecimal",
"round",
"(",
"BigDecimal",
"amount",
")",
"{",
"return",
"new",
"BigDecimal",
"(",
"amount",
".",
"movePointRight",
"(",
"2",
")",
".",
"add",
"(",
"new",
"BigDecimal",
"(",
"\".5\"",
")",
")",
".",
"toBigInteger",
"(",
")",
")"... | round a positive big decimal to 2 decimal points | [
"round",
"a",
"positive",
"big",
"decimal",
"to",
"2",
"decimal",
"points"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/shopping-demo-jsr309/business/src/main/java/org/jboss/mobicents/seam/model/Order.java#L217-L219 | train |
RestComm/sip-servlets | sip-servlets-examples/diameter-event-charging/src/main/java/org/mobicents/servlet/sip/example/DiameterEventChargingSipServlet.java | DiameterEventChargingSipServlet.doDiameterCharging | private long doDiameterCharging(String sessionId, String userId, Long cost, boolean refund)
{
try
{
logger.info( "Creating Diameter Charging " + (refund ? "Refund" : "Debit") + " Request UserId[" + userId + "], Cost[" + cost + "]..." );
Request req = (Request) diameterBaseClient.createAccount... | java | private long doDiameterCharging(String sessionId, String userId, Long cost, boolean refund)
{
try
{
logger.info( "Creating Diameter Charging " + (refund ? "Refund" : "Debit") + " Request UserId[" + userId + "], Cost[" + cost + "]..." );
Request req = (Request) diameterBaseClient.createAccount... | [
"private",
"long",
"doDiameterCharging",
"(",
"String",
"sessionId",
",",
"String",
"userId",
",",
"Long",
"cost",
",",
"boolean",
"refund",
")",
"{",
"try",
"{",
"logger",
".",
"info",
"(",
"\"Creating Diameter Charging \"",
"+",
"(",
"refund",
"?",
"\"Refund... | Method for doing the Charging, either it's a debit or a refund.
@param sessionId the Session-Id for the Diameter Message
@param userId the User-Id of the client in the Diameter Server
@param cost the Cost (or Refund value) of the service
@param refund boolean indicating if it's a refund or not
@return a long with the ... | [
"Method",
"for",
"doing",
"the",
"Charging",
"either",
"it",
"s",
"a",
"debit",
"or",
"a",
"refund",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/diameter-event-charging/src/main/java/org/mobicents/servlet/sip/example/DiameterEventChargingSipServlet.java#L245-L267 | train |
RestComm/sip-servlets | containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/startup/SipStandardContext.java | SipStandardContext.addSipApplicationListener | public void addSipApplicationListener(String listener) {
if(logger.isDebugEnabled()) {
logger.debug("addSipApplicationListener " + getName());
}
sipApplicationListeners.add(listener);
fireContainerEvent("addSipApplicationListener", listener);
// FIXME - add instance if already started?
... | java | public void addSipApplicationListener(String listener) {
if(logger.isDebugEnabled()) {
logger.debug("addSipApplicationListener " + getName());
}
sipApplicationListeners.add(listener);
fireContainerEvent("addSipApplicationListener", listener);
// FIXME - add instance if already started?
... | [
"public",
"void",
"addSipApplicationListener",
"(",
"String",
"listener",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"addSipApplicationListener \"",
"+",
"getName",
"(",
")",
")",
";",
"}",
"sipAp... | Add a new Listener class name to the set of Listeners
configured for this application.
@param listener Java class name of a listener class | [
"Add",
"a",
"new",
"Listener",
"class",
"name",
"to",
"the",
"set",
"of",
"Listeners",
"configured",
"for",
"this",
"application",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-as7/src/main/java/org/mobicents/servlet/sip/startup/SipStandardContext.java#L882-L892 | train |
RestComm/sip-servlets | sip-servlets-examples/shopping-demo-jsr309/business/src/main/java/org/jboss/mobicents/seam/actions/FullTextSearchAction.java | FullTextSearchAction.addAllToCart | public void addAllToCart()
{
for (Product item : searchResults) {
Boolean selected = searchSelections.get(item);
if (selected != null && selected) {
searchSelections.put(item, false);
cart.addProduct(item, 1);
}
}
} | java | public void addAllToCart()
{
for (Product item : searchResults) {
Boolean selected = searchSelections.get(item);
if (selected != null && selected) {
searchSelections.put(item, false);
cart.addProduct(item, 1);
}
}
} | [
"public",
"void",
"addAllToCart",
"(",
")",
"{",
"for",
"(",
"Product",
"item",
":",
"searchResults",
")",
"{",
"Boolean",
"selected",
"=",
"searchSelections",
".",
"get",
"(",
"item",
")",
";",
"if",
"(",
"selected",
"!=",
"null",
"&&",
"selected",
")",... | Add many items to cart | [
"Add",
"many",
"items",
"to",
"cart"
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/shopping-demo-jsr309/business/src/main/java/org/jboss/mobicents/seam/actions/FullTextSearchAction.java#L201-L210 | train |
RestComm/sip-servlets | containers/tomcat-8/src/main/java/org/mobicents/servlet/sip/startup/SipStandardContext.java | SipStandardContext.postWorkDirectory | private void postWorkDirectory() {
// Acquire (or calculate) the work directory path
String workDir = getWorkDir();
if (workDir == null || workDir.length() == 0) {
// Retrieve our parent (normally a host) name
String hostName = null;
String engineName = null... | java | private void postWorkDirectory() {
// Acquire (or calculate) the work directory path
String workDir = getWorkDir();
if (workDir == null || workDir.length() == 0) {
// Retrieve our parent (normally a host) name
String hostName = null;
String engineName = null... | [
"private",
"void",
"postWorkDirectory",
"(",
")",
"{",
"// Acquire (or calculate) the work directory path",
"String",
"workDir",
"=",
"getWorkDir",
"(",
")",
";",
"if",
"(",
"workDir",
"==",
"null",
"||",
"workDir",
".",
"length",
"(",
")",
"==",
"0",
")",
"{"... | Set the appropriate context attribute for our work directory. | [
"Set",
"the",
"appropriate",
"context",
"attribute",
"for",
"our",
"work",
"directory",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/tomcat-8/src/main/java/org/mobicents/servlet/sip/startup/SipStandardContext.java#L557-L622 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookSignatureUtil.java | FacebookSignatureUtil.verifySignature | public static boolean verifySignature(EnumMap<FacebookParam, CharSequence> params, String secret) {
if (null == params || params.isEmpty() )
return false;
CharSequence sigParam = params.remove(FacebookParam.SIGNATURE);
return (null == sigParam) ? false : verifySignature(params, secret, sigParam.toStri... | java | public static boolean verifySignature(EnumMap<FacebookParam, CharSequence> params, String secret) {
if (null == params || params.isEmpty() )
return false;
CharSequence sigParam = params.remove(FacebookParam.SIGNATURE);
return (null == sigParam) ? false : verifySignature(params, secret, sigParam.toStri... | [
"public",
"static",
"boolean",
"verifySignature",
"(",
"EnumMap",
"<",
"FacebookParam",
",",
"CharSequence",
">",
"params",
",",
"String",
"secret",
")",
"{",
"if",
"(",
"null",
"==",
"params",
"||",
"params",
".",
"isEmpty",
"(",
")",
")",
"return",
"fals... | Verifies that a signature received matches the expected value.
Removes FacebookParam.SIGNATURE from params if present.
@param params a map of parameters and their values, such as one
obtained from extractFacebookParams; expected to the expected signature
as the FacebookParam.SIGNATURE parameter
@param secret
@return a ... | [
"Verifies",
"that",
"a",
"signature",
"received",
"matches",
"the",
"expected",
"value",
".",
"Removes",
"FacebookParam",
".",
"SIGNATURE",
"from",
"params",
"if",
"present",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookSignatureUtil.java#L146-L151 | train |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/utils/Inet6Util.java | Inet6Util.isValidIPV4Address | public static boolean isValidIPV4Address(String value) {
int periods = 0;
int i = 0;
int length = value.length();
if (length > 15)
return false;
char c = 0;
String word = "";
for (i = 0; i < length; i++) {
c = value.charAt(i);
... | java | public static boolean isValidIPV4Address(String value) {
int periods = 0;
int i = 0;
int length = value.length();
if (length > 15)
return false;
char c = 0;
String word = "";
for (i = 0; i < length; i++) {
c = value.charAt(i);
... | [
"public",
"static",
"boolean",
"isValidIPV4Address",
"(",
"String",
"value",
")",
"{",
"int",
"periods",
"=",
"0",
";",
"int",
"i",
"=",
"0",
";",
"int",
"length",
"=",
"value",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
">",
"15",
")",
"re... | Takes a string and parses it to see if it is a valid IPV4 address.
@return true, if the string represents an IPV4 address in dotted
notation, false otherwise | [
"Takes",
"a",
"string",
"and",
"parses",
"it",
"to",
"see",
"if",
"it",
"is",
"a",
"valid",
"IPV4",
"address",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/utils/Inet6Util.java#L193-L228 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java | FacebookJsonRestClient.extractString | public String extractString(Object val) {
try {
return (String) val;
} catch (ClassCastException cce) {
logException(cce);
return null;
}
} | java | public String extractString(Object val) {
try {
return (String) val;
} catch (ClassCastException cce) {
logException(cce);
return null;
}
} | [
"public",
"String",
"extractString",
"(",
"Object",
"val",
")",
"{",
"try",
"{",
"return",
"(",
"String",
")",
"val",
";",
"}",
"catch",
"(",
"ClassCastException",
"cce",
")",
"{",
"logException",
"(",
"cce",
")",
";",
"return",
"null",
";",
"}",
"}"
] | Extracts a String from a result consisting entirely of a String.
@param val
@return the String | [
"Extracts",
"a",
"String",
"from",
"a",
"result",
"consisting",
"entirely",
"of",
"a",
"String",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java#L105-L112 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java | FacebookJsonRestClient.parseCallResult | protected Object parseCallResult(InputStream data, IFacebookMethod method)
throws FacebookException, IOException {
Object json = JSONValue.parse(new InputStreamReader(data));
if (isDebug()) {
log(method.methodName() + ": " + (null != json ? json.toString() : "null"));
}
if (json instanceof JS... | java | protected Object parseCallResult(InputStream data, IFacebookMethod method)
throws FacebookException, IOException {
Object json = JSONValue.parse(new InputStreamReader(data));
if (isDebug()) {
log(method.methodName() + ": " + (null != json ? json.toString() : "null"));
}
if (json instanceof JS... | [
"protected",
"Object",
"parseCallResult",
"(",
"InputStream",
"data",
",",
"IFacebookMethod",
"method",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"Object",
"json",
"=",
"JSONValue",
".",
"parse",
"(",
"new",
"InputStreamReader",
"(",
"data",
")"... | Parses the result of an API call from JSON into Java Objects.
@param data an InputStream with the results of a request to the Facebook servers
@param method the method
@return a Java Object
@throws FacebookException if <code>data</code> represents an error
@throws IOException if <code>data</code> is not readable
@see J... | [
"Parses",
"the",
"result",
"of",
"an",
"API",
"call",
"from",
"JSON",
"into",
"Java",
"Objects",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java#L151-L167 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java | FacebookJsonRestClient.extractURL | protected URL extractURL(Object url)
throws IOException {
if (!(url instanceof String)) {
return null;
}
return (null == url || "".equals(url)) ? null : new URL( (String) url);
} | java | protected URL extractURL(Object url)
throws IOException {
if (!(url instanceof String)) {
return null;
}
return (null == url || "".equals(url)) ? null : new URL( (String) url);
} | [
"protected",
"URL",
"extractURL",
"(",
"Object",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"(",
"url",
"instanceof",
"String",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"null",
"==",
"url",
"||",
"\"\"",
".",
"equals",
... | Extracts a URL from a result that consists of a URL only.
For JSON, that result is simply a String.
@param url
@return the URL | [
"Extracts",
"a",
"URL",
"from",
"a",
"result",
"that",
"consists",
"of",
"a",
"URL",
"only",
".",
"For",
"JSON",
"that",
"result",
"is",
"simply",
"a",
"String",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java#L175-L181 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java | FacebookJsonRestClient.extractBoolean | protected boolean extractBoolean(Object val) {
try {
return (Boolean) val;
} catch (ClassCastException cce) {
logException(cce);
return false;
}
} | java | protected boolean extractBoolean(Object val) {
try {
return (Boolean) val;
} catch (ClassCastException cce) {
logException(cce);
return false;
}
} | [
"protected",
"boolean",
"extractBoolean",
"(",
"Object",
"val",
")",
"{",
"try",
"{",
"return",
"(",
"Boolean",
")",
"val",
";",
"}",
"catch",
"(",
"ClassCastException",
"cce",
")",
"{",
"logException",
"(",
"cce",
")",
";",
"return",
"false",
";",
"}",
... | Extracts a Boolean from a result that consists of a Boolean only.
@param val
@return the Boolean | [
"Extracts",
"a",
"Boolean",
"from",
"a",
"result",
"that",
"consists",
"of",
"a",
"Boolean",
"only",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java#L202-L209 | train |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java | FacebookJsonRestClient.extractLong | protected Long extractLong(Object val) {
try {
return (Long) val;
} catch (ClassCastException cce) {
logException(cce);
return null;
}
} | java | protected Long extractLong(Object val) {
try {
return (Long) val;
} catch (ClassCastException cce) {
logException(cce);
return null;
}
} | [
"protected",
"Long",
"extractLong",
"(",
"Object",
"val",
")",
"{",
"try",
"{",
"return",
"(",
"Long",
")",
"val",
";",
"}",
"catch",
"(",
"ClassCastException",
"cce",
")",
"{",
"logException",
"(",
"cce",
")",
";",
"return",
"null",
";",
"}",
"}"
] | Extracts a Long from a result that consists of an Long only.
@param val
@return the Integer | [
"Extracts",
"a",
"Long",
"from",
"a",
"result",
"that",
"consists",
"of",
"an",
"Long",
"only",
"."
] | fd7011d2803ab1d205b140768a760c8c69e0c997 | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookJsonRestClient.java#L216-L223 | train |
davidmoten/geo | geo-mem/src/main/java/com/github/davidmoten/geo/mem/Geomem.java | Geomem.add | public void add(double lat, double lon, long time, T t, Optional<R> id) {
Info<T, R> info = new Info<T, R>(lat, lon, time, t, id);
add(info);
} | java | public void add(double lat, double lon, long time, T t, Optional<R> id) {
Info<T, R> info = new Info<T, R>(lat, lon, time, t, id);
add(info);
} | [
"public",
"void",
"add",
"(",
"double",
"lat",
",",
"double",
"lon",
",",
"long",
"time",
",",
"T",
"t",
",",
"Optional",
"<",
"R",
">",
"id",
")",
"{",
"Info",
"<",
"T",
",",
"R",
">",
"info",
"=",
"new",
"Info",
"<",
"T",
",",
"R",
">",
"... | Adds a record to the in-memory store with the given position and time and
id.
@param lat
latitude
@param lon
longitude
@param time
time in epoch ms
@param t
object
@param id
identifier | [
"Adds",
"a",
"record",
"to",
"the",
"in",
"-",
"memory",
"store",
"with",
"the",
"given",
"position",
"and",
"time",
"and",
"id",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo-mem/src/main/java/com/github/davidmoten/geo/mem/Geomem.java#L205-L208 | train |
davidmoten/geo | geo-mem/src/main/java/com/github/davidmoten/geo/mem/Geomem.java | Geomem.add | public void add(Info<T, R> info) {
String hash = GeoHash.encodeHash(info.lat(), info.lon());
addToMap(mapByGeoHash, info, hash);
addToMapById(mapById, info, hash);
} | java | public void add(Info<T, R> info) {
String hash = GeoHash.encodeHash(info.lat(), info.lon());
addToMap(mapByGeoHash, info, hash);
addToMapById(mapById, info, hash);
} | [
"public",
"void",
"add",
"(",
"Info",
"<",
"T",
",",
"R",
">",
"info",
")",
"{",
"String",
"hash",
"=",
"GeoHash",
".",
"encodeHash",
"(",
"info",
".",
"lat",
"(",
")",
",",
"info",
".",
"lon",
"(",
")",
")",
";",
"addToMap",
"(",
"mapByGeoHash",... | Adds a record to the in-memory store with the given position, time and
id.
@param info
info record to add | [
"Adds",
"a",
"record",
"to",
"the",
"in",
"-",
"memory",
"store",
"with",
"the",
"given",
"position",
"time",
"and",
"id",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo-mem/src/main/java/com/github/davidmoten/geo/mem/Geomem.java#L217-L222 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/Base32.java | Base32.decodeBase32 | public static long decodeBase32(String hash) {
boolean isNegative = hash.startsWith("-");
int startIndex = isNegative ? 1 : 0;
long base = 1;
long result = 0;
for (int i = hash.length() - 1; i >= startIndex; i--) {
int j = getCharIndex(hash.charAt(i));
res... | java | public static long decodeBase32(String hash) {
boolean isNegative = hash.startsWith("-");
int startIndex = isNegative ? 1 : 0;
long base = 1;
long result = 0;
for (int i = hash.length() - 1; i >= startIndex; i--) {
int j = getCharIndex(hash.charAt(i));
res... | [
"public",
"static",
"long",
"decodeBase32",
"(",
"String",
"hash",
")",
"{",
"boolean",
"isNegative",
"=",
"hash",
".",
"startsWith",
"(",
"\"-\"",
")",
";",
"int",
"startIndex",
"=",
"isNegative",
"?",
"1",
":",
"0",
";",
"long",
"base",
"=",
"1",
";"... | Returns the conversion of a base32 geohash to a long.
@param hash
geohash as a string
@return long representation of hash | [
"Returns",
"the",
"conversion",
"of",
"a",
"base32",
"geohash",
"to",
"a",
"long",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/Base32.java#L86-L99 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.createBorders | private static Map<Direction, Map<Parity, String>> createBorders() {
Map<Direction, Map<Parity, String>> m = createDirectionParityMap();
m.get(Direction.RIGHT).put(Parity.EVEN, "bcfguvyz");
m.get(Direction.LEFT).put(Parity.EVEN, "0145hjnp");
m.get(Direction.TOP).put(Parity.EVEN, "prxz")... | java | private static Map<Direction, Map<Parity, String>> createBorders() {
Map<Direction, Map<Parity, String>> m = createDirectionParityMap();
m.get(Direction.RIGHT).put(Parity.EVEN, "bcfguvyz");
m.get(Direction.LEFT).put(Parity.EVEN, "0145hjnp");
m.get(Direction.TOP).put(Parity.EVEN, "prxz")... | [
"private",
"static",
"Map",
"<",
"Direction",
",",
"Map",
"<",
"Parity",
",",
"String",
">",
">",
"createBorders",
"(",
")",
"{",
"Map",
"<",
"Direction",
",",
"Map",
"<",
"Parity",
",",
"String",
">",
">",
"m",
"=",
"createDirectionParityMap",
"(",
")... | Returns a map to be used in hash border calculations.
@return map of borders | [
"Returns",
"a",
"map",
"to",
"be",
"used",
"in",
"hash",
"border",
"calculations",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L68-L78 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.createDirectionParityMap | private static Map<Direction, Map<Parity, String>> createDirectionParityMap() {
Map<Direction, Map<Parity, String>> m = newHashMap();
m.put(Direction.BOTTOM, GeoHash.<Parity, String> newHashMap());
m.put(Direction.TOP, GeoHash.<Parity, String> newHashMap());
m.put(Direction.LEFT, GeoHash... | java | private static Map<Direction, Map<Parity, String>> createDirectionParityMap() {
Map<Direction, Map<Parity, String>> m = newHashMap();
m.put(Direction.BOTTOM, GeoHash.<Parity, String> newHashMap());
m.put(Direction.TOP, GeoHash.<Parity, String> newHashMap());
m.put(Direction.LEFT, GeoHash... | [
"private",
"static",
"Map",
"<",
"Direction",
",",
"Map",
"<",
"Parity",
",",
"String",
">",
">",
"createDirectionParityMap",
"(",
")",
"{",
"Map",
"<",
"Direction",
",",
"Map",
"<",
"Parity",
",",
"String",
">",
">",
"m",
"=",
"newHashMap",
"(",
")",
... | Create a direction and parity map for use in adjacent hash calculations.
@return map | [
"Create",
"a",
"direction",
"and",
"parity",
"map",
"for",
"use",
"in",
"adjacent",
"hash",
"calculations",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L102-L109 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.addOddParityEntries | private static void addOddParityEntries(Map<Direction, Map<Parity, String>> m) {
m.get(Direction.BOTTOM).put(Parity.ODD, m.get(Direction.LEFT).get(Parity.EVEN));
m.get(Direction.TOP).put(Parity.ODD, m.get(Direction.RIGHT).get(Parity.EVEN));
m.get(Direction.LEFT).put(Parity.ODD, m.get(Direction.B... | java | private static void addOddParityEntries(Map<Direction, Map<Parity, String>> m) {
m.get(Direction.BOTTOM).put(Parity.ODD, m.get(Direction.LEFT).get(Parity.EVEN));
m.get(Direction.TOP).put(Parity.ODD, m.get(Direction.RIGHT).get(Parity.EVEN));
m.get(Direction.LEFT).put(Parity.ODD, m.get(Direction.B... | [
"private",
"static",
"void",
"addOddParityEntries",
"(",
"Map",
"<",
"Direction",
",",
"Map",
"<",
"Parity",
",",
"String",
">",
">",
"m",
")",
"{",
"m",
".",
"get",
"(",
"Direction",
".",
"BOTTOM",
")",
".",
"put",
"(",
"Parity",
".",
"ODD",
",",
... | Puts odd parity entries in the map m based purely on the even entries.
@param m
map | [
"Puts",
"odd",
"parity",
"entries",
"in",
"the",
"map",
"m",
"based",
"purely",
"on",
"the",
"even",
"entries",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L121-L126 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.neighbours | public static List<String> neighbours(String hash) {
List<String> list = new ArrayList<String>();
String left = adjacentHash(hash, Direction.LEFT);
String right = adjacentHash(hash, Direction.RIGHT);
list.add(left);
list.add(right);
list.add(adjacentHash(hash, Direction.T... | java | public static List<String> neighbours(String hash) {
List<String> list = new ArrayList<String>();
String left = adjacentHash(hash, Direction.LEFT);
String right = adjacentHash(hash, Direction.RIGHT);
list.add(left);
list.add(right);
list.add(adjacentHash(hash, Direction.T... | [
"public",
"static",
"List",
"<",
"String",
">",
"neighbours",
"(",
"String",
"hash",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"String",
"left",
"=",
"adjacentHash",
"(",
"hash",
",",
"D... | Returns a list of the 8 surrounding hashes for a given hash in order
left,right,top,bottom,left-top,left-bottom,right-top,right-bottom.
@param hash
source
@return a list of neighbour hashes | [
"Returns",
"a",
"list",
"of",
"the",
"8",
"surrounding",
"hashes",
"for",
"a",
"given",
"hash",
"in",
"order",
"left",
"right",
"top",
"bottom",
"left",
"-",
"top",
"left",
"-",
"bottom",
"right",
"-",
"top",
"right",
"-",
"bottom",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L280-L293 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.encodeHash | public static String encodeHash(LatLong p, int length) {
return encodeHash(p.getLat(), p.getLon(), length);
} | java | public static String encodeHash(LatLong p, int length) {
return encodeHash(p.getLat(), p.getLon(), length);
} | [
"public",
"static",
"String",
"encodeHash",
"(",
"LatLong",
"p",
",",
"int",
"length",
")",
"{",
"return",
"encodeHash",
"(",
"p",
".",
"getLat",
"(",
")",
",",
"p",
".",
"getLon",
"(",
")",
",",
"length",
")",
";",
"}"
] | Returns a geohash of given length for the given WGS84 point.
@param p
point
@param length
length of hash
@return hash at point of given length | [
"Returns",
"a",
"geohash",
"of",
"given",
"length",
"for",
"the",
"given",
"WGS84",
"point",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L318-L320 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.fromLongToString | static String fromLongToString(long hash) {
int length = (int) (hash & 0xf);
if (length > 12 || length < 1)
throw new IllegalArgumentException("invalid long geohash " + hash);
char[] geohash = new char[length];
for (int pos = 0; pos < length; pos++) {
geohash[pos]... | java | static String fromLongToString(long hash) {
int length = (int) (hash & 0xf);
if (length > 12 || length < 1)
throw new IllegalArgumentException("invalid long geohash " + hash);
char[] geohash = new char[length];
for (int pos = 0; pos < length; pos++) {
geohash[pos]... | [
"static",
"String",
"fromLongToString",
"(",
"long",
"hash",
")",
"{",
"int",
"length",
"=",
"(",
"int",
")",
"(",
"hash",
"&",
"0xf",
")",
";",
"if",
"(",
"length",
">",
"12",
"||",
"length",
"<",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
... | Takes a hash represented as a long and returns it as a string.
@param hash
the hash, with the length encoded in the 4 least significant
bits
@return the string encoded geohash | [
"Takes",
"a",
"hash",
"represented",
"as",
"a",
"long",
"and",
"returns",
"it",
"as",
"a",
"string",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L369-L379 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.refineInterval | private static void refineInterval(double[] interval, int cd, int mask) {
if ((cd & mask) != 0)
interval[0] = (interval[0] + interval[1]) / 2;
else
interval[1] = (interval[0] + interval[1]) / 2;
} | java | private static void refineInterval(double[] interval, int cd, int mask) {
if ((cd & mask) != 0)
interval[0] = (interval[0] + interval[1]) / 2;
else
interval[1] = (interval[0] + interval[1]) / 2;
} | [
"private",
"static",
"void",
"refineInterval",
"(",
"double",
"[",
"]",
"interval",
",",
"int",
"cd",
",",
"int",
"mask",
")",
"{",
"if",
"(",
"(",
"cd",
"&",
"mask",
")",
"!=",
"0",
")",
"interval",
"[",
"0",
"]",
"=",
"(",
"interval",
"[",
"0",... | Refines interval by a factor or 2 in either the 0 or 1 ordinate.
@param interval
two entry array of double values
@param cd
used with mask
@param mask
used with cd | [
"Refines",
"interval",
"by",
"a",
"factor",
"or",
"2",
"in",
"either",
"the",
"0",
"or",
"1",
"ordinate",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L464-L469 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.hashLengthToCoverBoundingBox | public static int hashLengthToCoverBoundingBox(double topLeftLat, double topLeftLon,
double bottomRightLat, double bottomRightLon) {
boolean isEven = true;
double minLat = -90.0, maxLat = 90;
double minLon = -180.0, maxLon = 180.0;
for (int bits = 0; bits < MAX_HASH_LENGTH *... | java | public static int hashLengthToCoverBoundingBox(double topLeftLat, double topLeftLon,
double bottomRightLat, double bottomRightLon) {
boolean isEven = true;
double minLat = -90.0, maxLat = 90;
double minLon = -180.0, maxLon = 180.0;
for (int bits = 0; bits < MAX_HASH_LENGTH *... | [
"public",
"static",
"int",
"hashLengthToCoverBoundingBox",
"(",
"double",
"topLeftLat",
",",
"double",
"topLeftLon",
",",
"double",
"bottomRightLat",
",",
"double",
"bottomRightLon",
")",
"{",
"boolean",
"isEven",
"=",
"true",
";",
"double",
"minLat",
"=",
"-",
... | Returns the maximum length of hash that covers the bounding box. If no
hash can enclose the bounding box then 0 is returned.
@param topLeftLat
latitude of top left point (north west)
@param topLeftLon
longitude of top left point (north west)
@param bottomRightLat
latitude of bottom right point (south east)
@param bott... | [
"Returns",
"the",
"maximum",
"length",
"of",
"hash",
"that",
"covers",
"the",
"bounding",
"box",
".",
"If",
"no",
"hash",
"can",
"enclose",
"the",
"bounding",
"box",
"then",
"0",
"is",
"returned",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L485-L519 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.hashContains | public static boolean hashContains(String hash, double lat, double lon) {
LatLong centre = decodeHash(hash);
return Math.abs(centre.getLat() - lat) <= heightDegrees(hash.length()) / 2
&& Math.abs(to180(centre.getLon() - lon)) <= widthDegrees(hash.length()) / 2;
} | java | public static boolean hashContains(String hash, double lat, double lon) {
LatLong centre = decodeHash(hash);
return Math.abs(centre.getLat() - lat) <= heightDegrees(hash.length()) / 2
&& Math.abs(to180(centre.getLon() - lon)) <= widthDegrees(hash.length()) / 2;
} | [
"public",
"static",
"boolean",
"hashContains",
"(",
"String",
"hash",
",",
"double",
"lat",
",",
"double",
"lon",
")",
"{",
"LatLong",
"centre",
"=",
"decodeHash",
"(",
"hash",
")",
";",
"return",
"Math",
".",
"abs",
"(",
"centre",
".",
"getLat",
"(",
... | Returns true if and only if the bounding box corresponding to the hash
contains the given lat and long.
@param hash
hash to test containment in
@param lat
latitude
@param lon
longitude
@return true if and only if the hash contains the given lat and long | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"the",
"bounding",
"box",
"corresponding",
"to",
"the",
"hash",
"contains",
"the",
"given",
"lat",
"and",
"long",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L533-L537 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.coverBoundingBox | public static Coverage coverBoundingBox(double topLeftLat, final double topLeftLon,
final double bottomRightLat, final double bottomRightLon, final int length) {
return new Coverage(coverBoundingBoxLongs(topLeftLat, topLeftLon, bottomRightLat,
bottomRightLon, length));
} | java | public static Coverage coverBoundingBox(double topLeftLat, final double topLeftLon,
final double bottomRightLat, final double bottomRightLon, final int length) {
return new Coverage(coverBoundingBoxLongs(topLeftLat, topLeftLon, bottomRightLat,
bottomRightLon, length));
} | [
"public",
"static",
"Coverage",
"coverBoundingBox",
"(",
"double",
"topLeftLat",
",",
"final",
"double",
"topLeftLon",
",",
"final",
"double",
"bottomRightLat",
",",
"final",
"double",
"bottomRightLon",
",",
"final",
"int",
"length",
")",
"{",
"return",
"new",
"... | Returns the hashes of given length that are required to cover the given
bounding box.
@param topLeftLat
latitude of top left point (north west)
@param topLeftLon
longitude of top left point (north west)
@param bottomRightLat
latitude of bottom right point (south east)
@param bottomRightLon
longitude of bottom right po... | [
"Returns",
"the",
"hashes",
"of",
"given",
"length",
"that",
"are",
"required",
"to",
"cover",
"the",
"given",
"bounding",
"box",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L615-L619 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.calculateWidthDegrees | private static double calculateWidthDegrees(int n) {
double a;
if (n % 2 == 0)
a = -1;
else
a = -0.5;
double result = 180 / Math.pow(2, 2.5 * n + a);
return result;
} | java | private static double calculateWidthDegrees(int n) {
double a;
if (n % 2 == 0)
a = -1;
else
a = -0.5;
double result = 180 / Math.pow(2, 2.5 * n + a);
return result;
} | [
"private",
"static",
"double",
"calculateWidthDegrees",
"(",
"int",
"n",
")",
"{",
"double",
"a",
";",
"if",
"(",
"n",
"%",
"2",
"==",
"0",
")",
"a",
"=",
"-",
"1",
";",
"else",
"a",
"=",
"-",
"0.5",
";",
"double",
"result",
"=",
"180",
"/",
"M... | Returns the width in degrees of the region represented by a geohash of
length n.
@param n length of geohash
@return width in degrees | [
"Returns",
"the",
"width",
"in",
"degrees",
"of",
"the",
"region",
"represented",
"by",
"a",
"geohash",
"of",
"length",
"n",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L755-L763 | train |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.gridAsString | public static String gridAsString(String hash, int fromRight, int fromBottom, int toRight,
int toBottom) {
return gridAsString(hash, fromRight, fromBottom, toRight, toBottom,
Collections.<String> emptySet());
} | java | public static String gridAsString(String hash, int fromRight, int fromBottom, int toRight,
int toBottom) {
return gridAsString(hash, fromRight, fromBottom, toRight, toBottom,
Collections.<String> emptySet());
} | [
"public",
"static",
"String",
"gridAsString",
"(",
"String",
"hash",
",",
"int",
"fromRight",
",",
"int",
"fromBottom",
",",
"int",
"toRight",
",",
"int",
"toBottom",
")",
"{",
"return",
"gridAsString",
"(",
"hash",
",",
"fromRight",
",",
"fromBottom",
",",
... | Returns a String of lines of hashes to represent the relative positions
of hashes on a map.
@param hash reference hash
@param fromRight
top left of the grid in hashes to the right (can be negative).
@param fromBottom
top left of the grid in hashes to the bottom (can be
negative).
@param toRight
bottom righth of the gr... | [
"Returns",
"a",
"String",
"of",
"lines",
"of",
"hashes",
"to",
"represent",
"the",
"relative",
"positions",
"of",
"hashes",
"on",
"a",
"map",
"."
] | e90d2f406133cd9b60d54a3e6bdb7423d7fcce37 | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L806-L810 | train |
mikereedell/sunrisesunsetlib-java | src/main/java/com/luckycatlabs/sunrisesunset/dto/Location.java | Location.setLocation | public void setLocation(String latitude, String longitude) {
this.latitude = new BigDecimal(latitude);
this.longitude = new BigDecimal(longitude);
} | java | public void setLocation(String latitude, String longitude) {
this.latitude = new BigDecimal(latitude);
this.longitude = new BigDecimal(longitude);
} | [
"public",
"void",
"setLocation",
"(",
"String",
"latitude",
",",
"String",
"longitude",
")",
"{",
"this",
".",
"latitude",
"=",
"new",
"BigDecimal",
"(",
"latitude",
")",
";",
"this",
".",
"longitude",
"=",
"new",
"BigDecimal",
"(",
"longitude",
")",
";",
... | Sets the coordinates of the location object.
@param latitude
the latitude, in degrees, of this location. North latitude is positive, south negative.
@param longitude
the longitude, in degrees, of this location. East longitude is positive, east negative. | [
"Sets",
"the",
"coordinates",
"of",
"the",
"location",
"object",
"."
] | 6e6de23f1d11429eef58de2541582cbde9b85b92 | https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/dto/Location.java#L76-L79 | train |
mikereedell/sunrisesunsetlib-java | src/main/java/com/luckycatlabs/sunrisesunset/calculator/SolarEventCalculator.java | SolarEventCalculator.getLongitudeHour | private BigDecimal getLongitudeHour(Calendar date, Boolean isSunrise) {
int offset = 18;
if (isSunrise) {
offset = 6;
}
BigDecimal dividend = BigDecimal.valueOf(offset).subtract(getBaseLongitudeHour());
BigDecimal addend = divideBy(dividend, BigDecimal.valueOf(24));
... | java | private BigDecimal getLongitudeHour(Calendar date, Boolean isSunrise) {
int offset = 18;
if (isSunrise) {
offset = 6;
}
BigDecimal dividend = BigDecimal.valueOf(offset).subtract(getBaseLongitudeHour());
BigDecimal addend = divideBy(dividend, BigDecimal.valueOf(24));
... | [
"private",
"BigDecimal",
"getLongitudeHour",
"(",
"Calendar",
"date",
",",
"Boolean",
"isSunrise",
")",
"{",
"int",
"offset",
"=",
"18",
";",
"if",
"(",
"isSunrise",
")",
"{",
"offset",
"=",
"6",
";",
"}",
"BigDecimal",
"dividend",
"=",
"BigDecimal",
".",
... | Computes the longitude time, t in the algorithm.
@return longitudinal time in <code>BigDecimal</code> form. | [
"Computes",
"the",
"longitude",
"time",
"t",
"in",
"the",
"algorithm",
"."
] | 6e6de23f1d11429eef58de2541582cbde9b85b92 | https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/calculator/SolarEventCalculator.java#L148-L157 | train |
mikereedell/sunrisesunsetlib-java | src/main/java/com/luckycatlabs/sunrisesunset/calculator/SolarEventCalculator.java | SolarEventCalculator.getMeanAnomaly | private BigDecimal getMeanAnomaly(BigDecimal longitudeHour) {
BigDecimal meanAnomaly = multiplyBy(new BigDecimal("0.9856"), longitudeHour).subtract(new BigDecimal("3.289"));
return setScale(meanAnomaly);
} | java | private BigDecimal getMeanAnomaly(BigDecimal longitudeHour) {
BigDecimal meanAnomaly = multiplyBy(new BigDecimal("0.9856"), longitudeHour).subtract(new BigDecimal("3.289"));
return setScale(meanAnomaly);
} | [
"private",
"BigDecimal",
"getMeanAnomaly",
"(",
"BigDecimal",
"longitudeHour",
")",
"{",
"BigDecimal",
"meanAnomaly",
"=",
"multiplyBy",
"(",
"new",
"BigDecimal",
"(",
"\"0.9856\"",
")",
",",
"longitudeHour",
")",
".",
"subtract",
"(",
"new",
"BigDecimal",
"(",
... | Computes the mean anomaly of the Sun, M in the algorithm.
@return the suns mean anomaly, M, in <code>BigDecimal</code> form. | [
"Computes",
"the",
"mean",
"anomaly",
"of",
"the",
"Sun",
"M",
"in",
"the",
"algorithm",
"."
] | 6e6de23f1d11429eef58de2541582cbde9b85b92 | https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/calculator/SolarEventCalculator.java#L164-L167 | train |
mikereedell/sunrisesunsetlib-java | src/main/java/com/luckycatlabs/sunrisesunset/SunriseSunsetCalculator.java | SunriseSunsetCalculator.getSunrise | public static Calendar getSunrise(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees) {
SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone);
return solarEventCalculator.computeSunriseCalendar(new Zenith(90 - d... | java | public static Calendar getSunrise(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees) {
SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone);
return solarEventCalculator.computeSunriseCalendar(new Zenith(90 - d... | [
"public",
"static",
"Calendar",
"getSunrise",
"(",
"double",
"latitude",
",",
"double",
"longitude",
",",
"TimeZone",
"timeZone",
",",
"Calendar",
"date",
",",
"double",
"degrees",
")",
"{",
"SolarEventCalculator",
"solarEventCalculator",
"=",
"new",
"SolarEventCalc... | Computes the sunrise for an arbitrary declination.
@param latitude
@param longitude
Coordinates for the location to compute the sunrise/sunset for.
@param timeZone
timezone to compute the sunrise/sunset times in.
@param date
<code>Calendar</code> object containing the date to compute the official sunset for.
@param de... | [
"Computes",
"the",
"sunrise",
"for",
"an",
"arbitrary",
"declination",
"."
] | 6e6de23f1d11429eef58de2541582cbde9b85b92 | https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/SunriseSunsetCalculator.java#L256-L259 | train |
mikereedell/sunrisesunsetlib-java | src/main/java/com/luckycatlabs/sunrisesunset/SunriseSunsetCalculator.java | SunriseSunsetCalculator.getSunset | public static Calendar getSunset(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees) {
SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone);
return solarEventCalculator.computeSunsetCalendar(new Zenith(90 - deg... | java | public static Calendar getSunset(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees) {
SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone);
return solarEventCalculator.computeSunsetCalendar(new Zenith(90 - deg... | [
"public",
"static",
"Calendar",
"getSunset",
"(",
"double",
"latitude",
",",
"double",
"longitude",
",",
"TimeZone",
"timeZone",
",",
"Calendar",
"date",
",",
"double",
"degrees",
")",
"{",
"SolarEventCalculator",
"solarEventCalculator",
"=",
"new",
"SolarEventCalcu... | Computes the sunset for an arbitrary declination.
@param latitude
@param longitude
Coordinates for the location to compute the sunrise/sunset for.
@param timeZone
timezone to compute the sunrise/sunset times in.
@param date
<code>Calendar</code> object containing the date to compute the official sunset for.
@param deg... | [
"Computes",
"the",
"sunset",
"for",
"an",
"arbitrary",
"declination",
"."
] | 6e6de23f1d11429eef58de2541582cbde9b85b92 | https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/SunriseSunsetCalculator.java#L277-L280 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/PluginImpl.java | PluginImpl.closeRegisteredConnections | private static synchronized void closeRegisteredConnections() {
for (Connection connection : activeConnections) {
LOGGER.log(Level.INFO, "Forcing connection to {0}:{1} closed.",
new Object[]{connection.getHostname(), connection.getPort()});
// force closed just in cas... | java | private static synchronized void closeRegisteredConnections() {
for (Connection connection : activeConnections) {
LOGGER.log(Level.INFO, "Forcing connection to {0}:{1} closed.",
new Object[]{connection.getHostname(), connection.getPort()});
// force closed just in cas... | [
"private",
"static",
"synchronized",
"void",
"closeRegisteredConnections",
"(",
")",
"{",
"for",
"(",
"Connection",
"connection",
":",
"activeConnections",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Forcing connection to {0}:{1} closed.\"",
"... | Closes all the registered connections. | [
"Closes",
"all",
"the",
"registered",
"connections",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/PluginImpl.java#L67-L75 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/JavaProvider.java | JavaProvider.getJavas | public List<String> getJavas(SlaveComputer computer, TaskListener listener, Connection connection) {
return getJavas(listener,connection);
} | java | public List<String> getJavas(SlaveComputer computer, TaskListener listener, Connection connection) {
return getJavas(listener,connection);
} | [
"public",
"List",
"<",
"String",
">",
"getJavas",
"(",
"SlaveComputer",
"computer",
",",
"TaskListener",
"listener",
",",
"Connection",
"connection",
")",
"{",
"return",
"getJavas",
"(",
"listener",
",",
"connection",
")",
";",
"}"
] | Returns the list of possible places where java executable might exist.
@return
Can be empty but never null. Absolute path to the possible locations of Java. | [
"Returns",
"the",
"list",
"of",
"possible",
"places",
"where",
"java",
"executable",
"might",
"exist",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/JavaProvider.java#L58-L60 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.cleanupConnection | private void cleanupConnection(TaskListener listener) {
// we might be called multiple times from multiple finally/catch block,
if (connection!=null) {
connection.close();
connection = null;
listener.getLogger().println(Messages.SSHLauncher_ConnectionClosed(getTimest... | java | private void cleanupConnection(TaskListener listener) {
// we might be called multiple times from multiple finally/catch block,
if (connection!=null) {
connection.close();
connection = null;
listener.getLogger().println(Messages.SSHLauncher_ConnectionClosed(getTimest... | [
"private",
"void",
"cleanupConnection",
"(",
"TaskListener",
"listener",
")",
"{",
"// we might be called multiple times from multiple finally/catch block, ",
"if",
"(",
"connection",
"!=",
"null",
")",
"{",
"connection",
".",
"close",
"(",
")",
";",
"connection",
"=",
... | Called to terminate the SSH connection. Used liberally when we back out from an error. | [
"Called",
"to",
"terminate",
"the",
"SSH",
"connection",
".",
"Used",
"liberally",
"when",
"we",
"back",
"out",
"from",
"an",
"error",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L507-L514 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.verifyNoHeaderJunk | private void verifyNoHeaderJunk(TaskListener listener) throws IOException, InterruptedException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
connection.exec("exit 0",baos);
final String s;
//TODO: Seems we need to retrieve the encoding from the connection destination
... | java | private void verifyNoHeaderJunk(TaskListener listener) throws IOException, InterruptedException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
connection.exec("exit 0",baos);
final String s;
//TODO: Seems we need to retrieve the encoding from the connection destination
... | [
"private",
"void",
"verifyNoHeaderJunk",
"(",
"TaskListener",
"listener",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"connection",
".",
"exec",
"(",
"\"exit 0\"",... | Makes sure that SSH connection won't produce any unwanted text, which will interfere with sftp execution. | [
"Makes",
"sure",
"that",
"SSH",
"connection",
"won",
"t",
"produce",
"any",
"unwanted",
"text",
"which",
"will",
"interfere",
"with",
"sftp",
"execution",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L562-L578 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.startAgent | private void startAgent(SlaveComputer computer, final TaskListener listener, String java,
String workingDirectory) throws IOException {
session = connection.openSession();
expandChannelBufferSize(session,listener);
String cmd = "cd \"" + workingDirectory + "\" && " + ... | java | private void startAgent(SlaveComputer computer, final TaskListener listener, String java,
String workingDirectory) throws IOException {
session = connection.openSession();
expandChannelBufferSize(session,listener);
String cmd = "cd \"" + workingDirectory + "\" && " + ... | [
"private",
"void",
"startAgent",
"(",
"SlaveComputer",
"computer",
",",
"final",
"TaskListener",
"listener",
",",
"String",
"java",
",",
"String",
"workingDirectory",
")",
"throws",
"IOException",
"{",
"session",
"=",
"connection",
".",
"openSession",
"(",
")",
... | Starts the agent process.
@param computer The computer.
@param listener The listener.
@param java The full path name of the java executable to use.
@param workingDirectory The working directory from which to start the java process.
@throws IOException If something goes wrong. | [
"Starts",
"the",
"agent",
"process",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L590-L619 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.copyAgentJar | private void copyAgentJar(TaskListener listener, String workingDirectory) throws IOException, InterruptedException {
String fileName = workingDirectory + SLASH_AGENT_JAR;
listener.getLogger().println(Messages.SSHLauncher_StartingSFTPClient(getTimestamp()));
SFTPClient sftpClient = null;
... | java | private void copyAgentJar(TaskListener listener, String workingDirectory) throws IOException, InterruptedException {
String fileName = workingDirectory + SLASH_AGENT_JAR;
listener.getLogger().println(Messages.SSHLauncher_StartingSFTPClient(getTimestamp()));
SFTPClient sftpClient = null;
... | [
"private",
"void",
"copyAgentJar",
"(",
"TaskListener",
"listener",
",",
"String",
"workingDirectory",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"String",
"fileName",
"=",
"workingDirectory",
"+",
"SLASH_AGENT_JAR",
";",
"listener",
".",
"getLogg... | Method copies the agent jar to the remote system.
@param listener The listener.
@param workingDirectory The directory into which the agent jar will be copied.
@throws IOException If something goes wrong. | [
"Method",
"copies",
"the",
"agent",
"jar",
"to",
"the",
"remote",
"system",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L639-L710 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.getMd5Hash | static String getMd5Hash(byte[] bytes) throws NoSuchAlgorithmException {
String hash;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes);
byte[] digest = md.digest();
char[] hexCode = "0123456789ABCDEF".toCharArray();
... | java | static String getMd5Hash(byte[] bytes) throws NoSuchAlgorithmException {
String hash;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(bytes);
byte[] digest = md.digest();
char[] hexCode = "0123456789ABCDEF".toCharArray();
... | [
"static",
"String",
"getMd5Hash",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"String",
"hash",
";",
"try",
"{",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"md",
".",
"update... | Method reads a byte array and returns an upper case md5 hash for it.
@param bytes
@return
@throws NoSuchAlgorithmException | [
"Method",
"reads",
"a",
"byte",
"array",
"and",
"returns",
"an",
"upper",
"case",
"md5",
"hash",
"for",
"it",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L719-L739 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.readInputStreamIntoByteArrayAndClose | static byte[] readInputStreamIntoByteArrayAndClose(InputStream inputStream) throws IOException {
byte[] bytes = null;
try{
bytes = ByteStreams.toByteArray(inputStream);
}catch(IOException e){
throw e;
} finally {
IOUtils.closeQuietly(inputStream);
... | java | static byte[] readInputStreamIntoByteArrayAndClose(InputStream inputStream) throws IOException {
byte[] bytes = null;
try{
bytes = ByteStreams.toByteArray(inputStream);
}catch(IOException e){
throw e;
} finally {
IOUtils.closeQuietly(inputStream);
... | [
"static",
"byte",
"[",
"]",
"readInputStreamIntoByteArrayAndClose",
"(",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"null",
";",
"try",
"{",
"bytes",
"=",
"ByteStreams",
".",
"toByteArray",
"(",
"inputStream"... | Method reads an input stream into a byte array and closes the input stream when finished.
Added for reading the remoting jar and generating a hash value for it.
@param inputStream
@return
@throws IOException | [
"Method",
"reads",
"an",
"input",
"stream",
"into",
"a",
"byte",
"array",
"and",
"closes",
"the",
"input",
"stream",
"when",
"finished",
".",
"Added",
"for",
"reading",
"the",
"remoting",
"jar",
"and",
"generating",
"a",
"hash",
"value",
"for",
"it",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L749-L764 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.copySlaveJarUsingSCP | private void copySlaveJarUsingSCP(TaskListener listener, String workingDirectory) throws IOException, InterruptedException {
SCPClient scp = new SCPClient(connection);
try {
// check if the working directory exists
if (connection.exec("test -d " + workingDirectory ,listener.getLo... | java | private void copySlaveJarUsingSCP(TaskListener listener, String workingDirectory) throws IOException, InterruptedException {
SCPClient scp = new SCPClient(connection);
try {
// check if the working directory exists
if (connection.exec("test -d " + workingDirectory ,listener.getLo... | [
"private",
"void",
"copySlaveJarUsingSCP",
"(",
"TaskListener",
"listener",
",",
"String",
"workingDirectory",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"SCPClient",
"scp",
"=",
"new",
"SCPClient",
"(",
"connection",
")",
";",
"try",
"{",
"//... | Method copies the agent jar to the remote system using scp.
@param listener The listener.
@param workingDirectory The directory into which the agent jar will be copied.
@throws IOException If something goes wrong.
@throws InterruptedException If something goes wrong. | [
"Method",
"copies",
"the",
"agent",
"jar",
"to",
"the",
"remote",
"system",
"using",
"scp",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L775-L797 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.reportTransportLoss | private boolean reportTransportLoss(Connection c, TaskListener listener) {
Throwable cause = c.getReasonClosedCause();
if (cause != null) {
cause.printStackTrace(listener.error("Socket connection to SSH server was lost"));
}
return cause != null;
} | java | private boolean reportTransportLoss(Connection c, TaskListener listener) {
Throwable cause = c.getReasonClosedCause();
if (cause != null) {
cause.printStackTrace(listener.error("Socket connection to SSH server was lost"));
}
return cause != null;
} | [
"private",
"boolean",
"reportTransportLoss",
"(",
"Connection",
"c",
",",
"TaskListener",
"listener",
")",
"{",
"Throwable",
"cause",
"=",
"c",
".",
"getReasonClosedCause",
"(",
")",
";",
"if",
"(",
"cause",
"!=",
"null",
")",
"{",
"cause",
".",
"printStackT... | If the SSH connection as a whole is lost, report that information. | [
"If",
"the",
"SSH",
"connection",
"as",
"a",
"whole",
"is",
"lost",
"report",
"that",
"information",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L1014-L1021 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | SSHLauncher.getSessionOutcomeMessage | private String getSessionOutcomeMessage(Session session, boolean isConnectionLost) throws InterruptedException {
session.waitForCondition(ChannelCondition.EXIT_STATUS | ChannelCondition.EXIT_SIGNAL, 3000);
Integer exitCode = session.getExitStatus();
if (exitCode != null)
return "Sla... | java | private String getSessionOutcomeMessage(Session session, boolean isConnectionLost) throws InterruptedException {
session.waitForCondition(ChannelCondition.EXIT_STATUS | ChannelCondition.EXIT_SIGNAL, 3000);
Integer exitCode = session.getExitStatus();
if (exitCode != null)
return "Sla... | [
"private",
"String",
"getSessionOutcomeMessage",
"(",
"Session",
"session",
",",
"boolean",
"isConnectionLost",
")",
"throws",
"InterruptedException",
"{",
"session",
".",
"waitForCondition",
"(",
"ChannelCondition",
".",
"EXIT_STATUS",
"|",
"ChannelCondition",
".",
"EX... | Find the exit code or exit status, which are differentiated in SSH protocol. | [
"Find",
"the",
"exit",
"code",
"or",
"exit",
"status",
"which",
"are",
"differentiated",
"in",
"SSH",
"protocol",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java#L1026-L1041 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/verifiers/TrileadVersionSupportManager.java | TrileadVersionSupportManager.getTrileadSupport | static TrileadVersionSupport getTrileadSupport() {
try {
if (isAfterTrilead8()) {
return createVersion9Instance();
}
} catch (Exception | LinkageError e) {
LOGGER.log(Level.WARNING, "Could not create Trilead support class. Using legacy Trilead features... | java | static TrileadVersionSupport getTrileadSupport() {
try {
if (isAfterTrilead8()) {
return createVersion9Instance();
}
} catch (Exception | LinkageError e) {
LOGGER.log(Level.WARNING, "Could not create Trilead support class. Using legacy Trilead features... | [
"static",
"TrileadVersionSupport",
"getTrileadSupport",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"isAfterTrilead8",
"(",
")",
")",
"{",
"return",
"createVersion9Instance",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"|",
"LinkageError",
"e",
")",
"{",
... | Craetes an instance of TrileadVersionSupport that can provide functionality relevant to the version of Trilead
available in the current executing instance of Jenkins.
@return an instance of TrileadVersionSupport that provides functionality relevant for the version of Trilead
currently on the classpath | [
"Craetes",
"an",
"instance",
"of",
"TrileadVersionSupport",
"that",
"can",
"provide",
"functionality",
"relevant",
"to",
"the",
"version",
"of",
"Trilead",
"available",
"in",
"the",
"current",
"executing",
"instance",
"of",
"Jenkins",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/verifiers/TrileadVersionSupportManager.java#L29-L39 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java | JavaVersionChecker.resolveJava | protected String resolveJava() throws InterruptedException, IOException {
for (JavaProvider provider : JavaProvider.all()) {
for (String javaCommand : provider.getJavas(computer, listener, connection)) {
LOGGER.fine("Trying Java at " + javaCommand);
try {
... | java | protected String resolveJava() throws InterruptedException, IOException {
for (JavaProvider provider : JavaProvider.all()) {
for (String javaCommand : provider.getJavas(computer, listener, connection)) {
LOGGER.fine("Trying Java at " + javaCommand);
try {
... | [
"protected",
"String",
"resolveJava",
"(",
")",
"throws",
"InterruptedException",
",",
"IOException",
"{",
"for",
"(",
"JavaProvider",
"provider",
":",
"JavaProvider",
".",
"all",
"(",
")",
")",
"{",
"for",
"(",
"String",
"javaCommand",
":",
"provider",
".",
... | return javaPath if specified in the configuration.
Finds local Java. | [
"return",
"javaPath",
"if",
"specified",
"in",
"the",
"configuration",
".",
"Finds",
"local",
"Java",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L70-L83 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/verifiers/HostKeyHelper.java | HostKeyHelper.getHostKey | public HostKey getHostKey(Computer host) throws IOException {
HostKey key = cache.get(host);
if (null == key) {
File hostKeyFile = getSshHostKeyFile(host.getNode());
if (hostKeyFile.exists()) {
XmlFile xmlHostKeyFile = new XmlFile(hostKeyFile);
key... | java | public HostKey getHostKey(Computer host) throws IOException {
HostKey key = cache.get(host);
if (null == key) {
File hostKeyFile = getSshHostKeyFile(host.getNode());
if (hostKeyFile.exists()) {
XmlFile xmlHostKeyFile = new XmlFile(hostKeyFile);
key... | [
"public",
"HostKey",
"getHostKey",
"(",
"Computer",
"host",
")",
"throws",
"IOException",
"{",
"HostKey",
"key",
"=",
"cache",
".",
"get",
"(",
"host",
")",
";",
"if",
"(",
"null",
"==",
"key",
")",
"{",
"File",
"hostKeyFile",
"=",
"getSshHostKeyFile",
"... | Retrieve the currently trusted host key for the requested computer, or null if
no key is currently trusted.
@param host the Computer to retrieve the key for.
@return the currently trusted key for the requested host, or null if no key is trusted.
@throws IOException if the host key can not be read from storage | [
"Retrieve",
"the",
"currently",
"trusted",
"host",
"key",
"for",
"the",
"requested",
"computer",
"or",
"null",
"if",
"no",
"key",
"is",
"currently",
"trusted",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/verifiers/HostKeyHelper.java#L66-L79 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/verifiers/HostKeyHelper.java | HostKeyHelper.saveHostKey | public void saveHostKey(Computer host, HostKey hostKey) throws IOException {
XmlFile xmlHostKeyFile = new XmlFile(getSshHostKeyFile(host.getNode()));
xmlHostKeyFile.write(hostKey);
cache.put(host, hostKey);
} | java | public void saveHostKey(Computer host, HostKey hostKey) throws IOException {
XmlFile xmlHostKeyFile = new XmlFile(getSshHostKeyFile(host.getNode()));
xmlHostKeyFile.write(hostKey);
cache.put(host, hostKey);
} | [
"public",
"void",
"saveHostKey",
"(",
"Computer",
"host",
",",
"HostKey",
"hostKey",
")",
"throws",
"IOException",
"{",
"XmlFile",
"xmlHostKeyFile",
"=",
"new",
"XmlFile",
"(",
"getSshHostKeyFile",
"(",
"host",
".",
"getNode",
"(",
")",
")",
")",
";",
"xmlHo... | Persists an SSH key to disk for the requested host. This effectively marks
the requested key as trusted for all future connections to the host, until
any future save attempt replaces this key.
@param host the host the key is being saved for
@param hostKey the key to be saved as the trusted key for this host
@throws IOE... | [
"Persists",
"an",
"SSH",
"key",
"to",
"disk",
"for",
"the",
"requested",
"host",
".",
"This",
"effectively",
"marks",
"the",
"requested",
"key",
"as",
"trusted",
"for",
"all",
"future",
"connections",
"to",
"the",
"host",
"until",
"any",
"future",
"save",
... | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/verifiers/HostKeyHelper.java#L90-L94 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/com/trilead/ssh2/jenkins/SFTPClient.java | SFTPClient.mkdirs | public void mkdirs(String path, int posixPermission) throws IOException {
SFTPv3FileAttributes atts = _stat(path);
if (atts!=null && atts.isDirectory())
return;
int idx = path.lastIndexOf('/');
if (idx>0)
mkdirs(path.substring(0,idx), posixPermission);
t... | java | public void mkdirs(String path, int posixPermission) throws IOException {
SFTPv3FileAttributes atts = _stat(path);
if (atts!=null && atts.isDirectory())
return;
int idx = path.lastIndexOf('/');
if (idx>0)
mkdirs(path.substring(0,idx), posixPermission);
t... | [
"public",
"void",
"mkdirs",
"(",
"String",
"path",
",",
"int",
"posixPermission",
")",
"throws",
"IOException",
"{",
"SFTPv3FileAttributes",
"atts",
"=",
"_stat",
"(",
"path",
")",
";",
"if",
"(",
"atts",
"!=",
"null",
"&&",
"atts",
".",
"isDirectory",
"("... | Makes sure that the directory exists, by creating it if necessary.
@param path directory path.
@param posixPermission POSIX permissions.
@throws IOException if it is not possible to access to the directory. | [
"Makes",
"sure",
"that",
"the",
"directory",
"exists",
"by",
"creating",
"it",
"if",
"necessary",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/com/trilead/ssh2/jenkins/SFTPClient.java#L80-L94 | train |
jenkinsci/ssh-slaves-plugin | src/main/java/com/trilead/ssh2/jenkins/SFTPClient.java | SFTPClient.chmod | public void chmod(String path, int permissions) throws IOException {
SFTPv3FileAttributes atts = new SFTPv3FileAttributes();
atts.permissions = permissions;
setstat(path, atts);
} | java | public void chmod(String path, int permissions) throws IOException {
SFTPv3FileAttributes atts = new SFTPv3FileAttributes();
atts.permissions = permissions;
setstat(path, atts);
} | [
"public",
"void",
"chmod",
"(",
"String",
"path",
",",
"int",
"permissions",
")",
"throws",
"IOException",
"{",
"SFTPv3FileAttributes",
"atts",
"=",
"new",
"SFTPv3FileAttributes",
"(",
")",
";",
"atts",
".",
"permissions",
"=",
"permissions",
";",
"setstat",
"... | Change file or directory permissions.
@param path file or directory path.
@param permissions POSIX permissions.
@throws IOException in case of error. | [
"Change",
"file",
"or",
"directory",
"permissions",
"."
] | 95f528730fc1e01b25983459927b7516ead3ee00 | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/com/trilead/ssh2/jenkins/SFTPClient.java#L124-L128 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.