id int32 0 165k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
142,500 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.updateVNFD | @Help(
help =
"Update the VirtualNetworkFunctionDescriptor dependency of a NetworkServiceDescriptor with specific id"
)
public VNFDependency updateVNFD(
final String idNSD, final String idVnfDep, final VNFDependency vnfDependency)
throws SDKException {
String url = idNSD + "/vnfdependencies" + "/" + idVnfDep;
return (VNFDependency) requestPut(url, vnfDependency);
} | java | @Help(
help =
"Update the VirtualNetworkFunctionDescriptor dependency of a NetworkServiceDescriptor with specific id"
)
public VNFDependency updateVNFD(
final String idNSD, final String idVnfDep, final VNFDependency vnfDependency)
throws SDKException {
String url = idNSD + "/vnfdependencies" + "/" + idVnfDep;
return (VNFDependency) requestPut(url, vnfDependency);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Update the VirtualNetworkFunctionDescriptor dependency of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"VNFDependency",
"updateVNFD",
"(",
"final",
"String",
"idNSD",
",",
"final",
"String",
"idVnfDep",
",",
"final",
"VNFDependency",
"vnfDependency",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNSD",
"+",
"\"/vnfdependencies\"",
"+",
"\"/\"",
"+",
"idVnfDep",
";",
"return",
"(",
"VNFDependency",
")",
"requestPut",
"(",
"url",
",",
"vnfDependency",
")",
";",
"}"
] | Update a specific VNFDependency which is contained in a particular NetworkServiceDescriptor.
@param idNSD the ID of the NetworkServiceDescriptor containing the VNFDependency
@param idVnfDep the ID of the VNFDependency which shall be updated
@param vnfDependency the updated version of the VNFDependency
@return the updated VNFDependency
@throws SDKException if the request fails | [
"Update",
"a",
"specific",
"VNFDependency",
"which",
"is",
"contained",
"in",
"a",
"particular",
"NetworkServiceDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L280-L289 |
142,501 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.getPhysicalNetworkFunctionDescriptors | @Help(
help =
"Get all the PhysicalNetworkFunctionDescriptors of a NetworkServiceDescriptor with specific id"
)
public List<PhysicalNetworkFunctionDescriptor> getPhysicalNetworkFunctionDescriptors(
final String idNSD) throws SDKException {
String url = idNSD + "/pnfdescriptors";
return Arrays.asList(
(PhysicalNetworkFunctionDescriptor[])
requestGetAll(url, PhysicalNetworkFunctionDescriptor.class));
} | java | @Help(
help =
"Get all the PhysicalNetworkFunctionDescriptors of a NetworkServiceDescriptor with specific id"
)
public List<PhysicalNetworkFunctionDescriptor> getPhysicalNetworkFunctionDescriptors(
final String idNSD) throws SDKException {
String url = idNSD + "/pnfdescriptors";
return Arrays.asList(
(PhysicalNetworkFunctionDescriptor[])
requestGetAll(url, PhysicalNetworkFunctionDescriptor.class));
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Get all the PhysicalNetworkFunctionDescriptors of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"List",
"<",
"PhysicalNetworkFunctionDescriptor",
">",
"getPhysicalNetworkFunctionDescriptors",
"(",
"final",
"String",
"idNSD",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNSD",
"+",
"\"/pnfdescriptors\"",
";",
"return",
"Arrays",
".",
"asList",
"(",
"(",
"PhysicalNetworkFunctionDescriptor",
"[",
"]",
")",
"requestGetAll",
"(",
"url",
",",
"PhysicalNetworkFunctionDescriptor",
".",
"class",
")",
")",
";",
"}"
] | Returns the List of PhysicalNetworkFunctionDescriptors that are contained in a specific
NetworkServiceDescriptor.
@param idNSD the ID of the NetworkServiceDescriptor
@return the List of PhysicalNetworkFunctionDescriptors
@throws SDKException if the request fails | [
"Returns",
"the",
"List",
"of",
"PhysicalNetworkFunctionDescriptors",
"that",
"are",
"contained",
"in",
"a",
"specific",
"NetworkServiceDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L299-L309 |
142,502 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.getPhysicalNetworkFunctionDescriptor | @Help(
help =
"Get the PhysicalNetworkFunctionDescriptor with specific id of a NetworkServiceDescriptor with specific id"
)
public PhysicalNetworkFunctionDescriptor getPhysicalNetworkFunctionDescriptor(
final String idNsd, final String idPnf) throws SDKException {
String url = idNsd + "/pnfdescriptors" + "/" + idPnf;
return (PhysicalNetworkFunctionDescriptor)
requestGetWithStatusAccepted(url, PhysicalNetworkFunctionDescriptor.class);
} | java | @Help(
help =
"Get the PhysicalNetworkFunctionDescriptor with specific id of a NetworkServiceDescriptor with specific id"
)
public PhysicalNetworkFunctionDescriptor getPhysicalNetworkFunctionDescriptor(
final String idNsd, final String idPnf) throws SDKException {
String url = idNsd + "/pnfdescriptors" + "/" + idPnf;
return (PhysicalNetworkFunctionDescriptor)
requestGetWithStatusAccepted(url, PhysicalNetworkFunctionDescriptor.class);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Get the PhysicalNetworkFunctionDescriptor with specific id of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"PhysicalNetworkFunctionDescriptor",
"getPhysicalNetworkFunctionDescriptor",
"(",
"final",
"String",
"idNsd",
",",
"final",
"String",
"idPnf",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsd",
"+",
"\"/pnfdescriptors\"",
"+",
"\"/\"",
"+",
"idPnf",
";",
"return",
"(",
"PhysicalNetworkFunctionDescriptor",
")",
"requestGetWithStatusAccepted",
"(",
"url",
",",
"PhysicalNetworkFunctionDescriptor",
".",
"class",
")",
";",
"}"
] | Returns a specific PhysicalNetworkFunctionDescriptor that is contained in a particular
NetworkServiceDescriptor.
@param idNsd the NetworkServiceDescriptr's ID
@param idPnf the PhysicalNetworkFunctionDescriptor's ID
@return the PhysicalNetworkFunctionDescriptor
@throws SDKException if the request fails | [
"Returns",
"a",
"specific",
"PhysicalNetworkFunctionDescriptor",
"that",
"is",
"contained",
"in",
"a",
"particular",
"NetworkServiceDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L320-L329 |
142,503 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.deletePhysicalNetworkFunctionDescriptor | @Help(
help =
"Delete the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id"
)
public void deletePhysicalNetworkFunctionDescriptor(final String idNsd, final String idPnf)
throws SDKException {
String url = idNsd + "/pnfdescriptors" + "/" + idPnf;
requestDelete(url);
} | java | @Help(
help =
"Delete the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id"
)
public void deletePhysicalNetworkFunctionDescriptor(final String idNsd, final String idPnf)
throws SDKException {
String url = idNsd + "/pnfdescriptors" + "/" + idPnf;
requestDelete(url);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Delete the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"void",
"deletePhysicalNetworkFunctionDescriptor",
"(",
"final",
"String",
"idNsd",
",",
"final",
"String",
"idPnf",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsd",
"+",
"\"/pnfdescriptors\"",
"+",
"\"/\"",
"+",
"idPnf",
";",
"requestDelete",
"(",
"url",
")",
";",
"}"
] | Delete a specific PhysicalNetworkFunctionDescriptor which is contained in a particular
NetworkServiceDescriptor.
@param idNsd the NetworkServiceDescriptor's ID
@param idPnf :the PhysicalNetworkFunctionDescriptor's ID
@throws SDKException if the request fails | [
"Delete",
"a",
"specific",
"PhysicalNetworkFunctionDescriptor",
"which",
"is",
"contained",
"in",
"a",
"particular",
"NetworkServiceDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L339-L347 |
142,504 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.createPhysicalNetworkFunctionDescriptor | @Help(
help =
"Create the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id"
)
public PhysicalNetworkFunctionDescriptor createPhysicalNetworkFunctionDescriptor(
final String idNsd, final PhysicalNetworkFunctionDescriptor physicalNetworkFunctionDescriptor)
throws SDKException {
String url = idNsd + "/pnfdescriptors";
return (PhysicalNetworkFunctionDescriptor) requestPost(url, physicalNetworkFunctionDescriptor);
} | java | @Help(
help =
"Create the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id"
)
public PhysicalNetworkFunctionDescriptor createPhysicalNetworkFunctionDescriptor(
final String idNsd, final PhysicalNetworkFunctionDescriptor physicalNetworkFunctionDescriptor)
throws SDKException {
String url = idNsd + "/pnfdescriptors";
return (PhysicalNetworkFunctionDescriptor) requestPost(url, physicalNetworkFunctionDescriptor);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Create the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"PhysicalNetworkFunctionDescriptor",
"createPhysicalNetworkFunctionDescriptor",
"(",
"final",
"String",
"idNsd",
",",
"final",
"PhysicalNetworkFunctionDescriptor",
"physicalNetworkFunctionDescriptor",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsd",
"+",
"\"/pnfdescriptors\"",
";",
"return",
"(",
"PhysicalNetworkFunctionDescriptor",
")",
"requestPost",
"(",
"url",
",",
"physicalNetworkFunctionDescriptor",
")",
";",
"}"
] | Create a new PhysicalNetworkFunctionDescriptor in a NetworkServiceDescriptor
@param idNsd the NetworkServiceDescriptor's ID
@param physicalNetworkFunctionDescriptor the new PhysicalNetworkFunctionDescriptor
@return the created PhysicalNetworkFunctionDescriptor
@throws SDKException if the request fails | [
"Create",
"a",
"new",
"PhysicalNetworkFunctionDescriptor",
"in",
"a",
"NetworkServiceDescriptor"
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L357-L366 |
142,505 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.updatePNFD | @Help(
help =
"Update the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id"
)
public PhysicalNetworkFunctionDescriptor updatePNFD(
final String idNsd,
final String idPnf,
final PhysicalNetworkFunctionDescriptor physicalNetworkFunctionDescriptor)
throws SDKException {
String url = idNsd + "/pnfdescriptors" + "/" + idPnf;
return (PhysicalNetworkFunctionDescriptor) requestPut(url, physicalNetworkFunctionDescriptor);
} | java | @Help(
help =
"Update the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id"
)
public PhysicalNetworkFunctionDescriptor updatePNFD(
final String idNsd,
final String idPnf,
final PhysicalNetworkFunctionDescriptor physicalNetworkFunctionDescriptor)
throws SDKException {
String url = idNsd + "/pnfdescriptors" + "/" + idPnf;
return (PhysicalNetworkFunctionDescriptor) requestPut(url, physicalNetworkFunctionDescriptor);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Update the PhysicalNetworkFunctionDescriptor of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"PhysicalNetworkFunctionDescriptor",
"updatePNFD",
"(",
"final",
"String",
"idNsd",
",",
"final",
"String",
"idPnf",
",",
"final",
"PhysicalNetworkFunctionDescriptor",
"physicalNetworkFunctionDescriptor",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsd",
"+",
"\"/pnfdescriptors\"",
"+",
"\"/\"",
"+",
"idPnf",
";",
"return",
"(",
"PhysicalNetworkFunctionDescriptor",
")",
"requestPut",
"(",
"url",
",",
"physicalNetworkFunctionDescriptor",
")",
";",
"}"
] | Update a PhysicalNetworkFunctionDescriptor.
@param idNsd the NetworkFunctionDescriptor's ID
@param idPnf the PhysicalNetworkFunctionDescriptor's ID
@param physicalNetworkFunctionDescriptor the updated version of the
PhysicalNetworkFunctionDescriptor
@return the updated PhysicalNetworkFunctionDescriptor
@throws SDKException if the request fails | [
"Update",
"a",
"PhysicalNetworkFunctionDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L378-L389 |
142,506 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.getSecurities | @Help(help = "Get all the Security of a NetworkServiceDescriptor with specific id")
public Security getSecurities(final String idNsd) throws SDKException {
String url = idNsd + "/security";
return ((Security) requestGet(url, Security.class));
} | java | @Help(help = "Get all the Security of a NetworkServiceDescriptor with specific id")
public Security getSecurities(final String idNsd) throws SDKException {
String url = idNsd + "/security";
return ((Security) requestGet(url, Security.class));
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Get all the Security of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"Security",
"getSecurities",
"(",
"final",
"String",
"idNsd",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsd",
"+",
"\"/security\"",
";",
"return",
"(",
"(",
"Security",
")",
"requestGet",
"(",
"url",
",",
"Security",
".",
"class",
")",
")",
";",
"}"
] | Returns a List of all Security objects that are contained in a specific
NetworkServiceDescriptor.
@param idNsd the ID of the NetworkServiceDescriptor
@return the List of Security objects
@throws SDKException if the request fails | [
"Returns",
"a",
"List",
"of",
"all",
"Security",
"objects",
"that",
"are",
"contained",
"in",
"a",
"specific",
"NetworkServiceDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L399-L403 |
142,507 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.deleteSecurity | @Help(help = "Delete the Security of a NetworkServiceDescriptor with specific id")
public void deleteSecurity(final String idNsd, final String idSecurity) throws SDKException {
String url = idNsd + "/security" + "/" + idSecurity;
requestDelete(url);
} | java | @Help(help = "Delete the Security of a NetworkServiceDescriptor with specific id")
public void deleteSecurity(final String idNsd, final String idSecurity) throws SDKException {
String url = idNsd + "/security" + "/" + idSecurity;
requestDelete(url);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Delete the Security of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"void",
"deleteSecurity",
"(",
"final",
"String",
"idNsd",
",",
"final",
"String",
"idSecurity",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsd",
"+",
"\"/security\"",
"+",
"\"/\"",
"+",
"idSecurity",
";",
"requestDelete",
"(",
"url",
")",
";",
"}"
] | Delete a Security object.
@param idNsd the NetworkServiceDescriptor's ID
@param idSecurity the Security object's ID
@throws SDKException if the request fails | [
"Delete",
"a",
"Security",
"object",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L412-L416 |
142,508 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.createSecurity | @Help(help = "Create the Security of a NetworkServiceDescriptor with specific id")
public Security createSecurity(final String idNSD, final Security security) throws SDKException {
String url = idNSD + "/security" + "/";
return (Security) requestPost(url, security);
} | java | @Help(help = "Create the Security of a NetworkServiceDescriptor with specific id")
public Security createSecurity(final String idNSD, final Security security) throws SDKException {
String url = idNSD + "/security" + "/";
return (Security) requestPost(url, security);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Create the Security of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"Security",
"createSecurity",
"(",
"final",
"String",
"idNSD",
",",
"final",
"Security",
"security",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNSD",
"+",
"\"/security\"",
"+",
"\"/\"",
";",
"return",
"(",
"Security",
")",
"requestPost",
"(",
"url",
",",
"security",
")",
";",
"}"
] | Add a new Security object to a NetworkServiceDescriptor.
@param idNSD the ID of the NetworkServiceDescriptor
@param security the Security object to add
@return the new Security object
@throws SDKException if the request fails | [
"Add",
"a",
"new",
"Security",
"object",
"to",
"a",
"NetworkServiceDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L426-L430 |
142,509 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.updateSecurity | @Help(help = "Update the Security of a NetworkServiceDescriptor with specific id")
public Security updateSecurity(
final String idNSD, final String idSecurity, final Security updatedSecurity)
throws SDKException {
String url = idNSD + "/security" + "/" + idSecurity;
return (Security) requestPut(url, updatedSecurity);
} | java | @Help(help = "Update the Security of a NetworkServiceDescriptor with specific id")
public Security updateSecurity(
final String idNSD, final String idSecurity, final Security updatedSecurity)
throws SDKException {
String url = idNSD + "/security" + "/" + idSecurity;
return (Security) requestPut(url, updatedSecurity);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Update the Security of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"Security",
"updateSecurity",
"(",
"final",
"String",
"idNSD",
",",
"final",
"String",
"idSecurity",
",",
"final",
"Security",
"updatedSecurity",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNSD",
"+",
"\"/security\"",
"+",
"\"/\"",
"+",
"idSecurity",
";",
"return",
"(",
"Security",
")",
"requestPut",
"(",
"url",
",",
"updatedSecurity",
")",
";",
"}"
] | Update a Security object of a specific NetworkServiceDescriptor.
@param idNSD the id of the NetworkServiceDescriptor
@param idSecurity the ID of the Security object which shall be updated
@param updatedSecurity the updated version of the Security object
@return the updated Security object
@throws SDKException if the request fails | [
"Update",
"a",
"Security",
"object",
"of",
"a",
"specific",
"NetworkServiceDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L441-L447 |
142,510 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BodyParserSAX.java | BodyParserSAX.getSAXParser | private static SAXParser getSAXParser() {
SoftReference<SAXParser> ref = PARSER.get();
SAXParser result = ref.get();
if (result == null) {
Exception thrown;
try {
result = SAX_FACTORY.newSAXParser();
ref = new SoftReference<SAXParser>(result);
PARSER.set(ref);
return result;
} catch (ParserConfigurationException ex) {
thrown = ex;
} catch (SAXException ex) {
thrown = ex;
}
throw(new IllegalStateException(
"Could not create SAX parser", thrown));
} else {
result.reset();
return result;
}
} | java | private static SAXParser getSAXParser() {
SoftReference<SAXParser> ref = PARSER.get();
SAXParser result = ref.get();
if (result == null) {
Exception thrown;
try {
result = SAX_FACTORY.newSAXParser();
ref = new SoftReference<SAXParser>(result);
PARSER.set(ref);
return result;
} catch (ParserConfigurationException ex) {
thrown = ex;
} catch (SAXException ex) {
thrown = ex;
}
throw(new IllegalStateException(
"Could not create SAX parser", thrown));
} else {
result.reset();
return result;
}
} | [
"private",
"static",
"SAXParser",
"getSAXParser",
"(",
")",
"{",
"SoftReference",
"<",
"SAXParser",
">",
"ref",
"=",
"PARSER",
".",
"get",
"(",
")",
";",
"SAXParser",
"result",
"=",
"ref",
".",
"get",
"(",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"Exception",
"thrown",
";",
"try",
"{",
"result",
"=",
"SAX_FACTORY",
".",
"newSAXParser",
"(",
")",
";",
"ref",
"=",
"new",
"SoftReference",
"<",
"SAXParser",
">",
"(",
"result",
")",
";",
"PARSER",
".",
"set",
"(",
"ref",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"ParserConfigurationException",
"ex",
")",
"{",
"thrown",
"=",
"ex",
";",
"}",
"catch",
"(",
"SAXException",
"ex",
")",
"{",
"thrown",
"=",
"ex",
";",
"}",
"throw",
"(",
"new",
"IllegalStateException",
"(",
"\"Could not create SAX parser\"",
",",
"thrown",
")",
")",
";",
"}",
"else",
"{",
"result",
".",
"reset",
"(",
")",
";",
"return",
"result",
";",
"}",
"}"
] | Gets a SAXParser for use in parsing incoming messages.
@return parser instance | [
"Gets",
"a",
"SAXParser",
"for",
"use",
"in",
"parsing",
"incoming",
"messages",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BodyParserSAX.java#L183-L204 |
142,511 | Jasig/resource-server | resource-server-utils/src/main/java/org/jasig/resourceserver/utils/aggr/ResourcesElementsProviderImpl.java | ResourcesElementsProviderImpl.resolveResourceContextPath | protected String resolveResourceContextPath(HttpServletRequest request, String resource) {
final String resourceContextPath = this.getResourceServerContextPath();
this.logger.debug("Attempting to locate resource serving webapp with context path: {}", resourceContextPath);
//Try to resolve the
final ServletContext resourceContext = this.servletContext.getContext(resourceContextPath);
if (resourceContext == null || !resourceContextPath.equals(resourceContext.getContextPath())) {
this.logger.warn("Could not find resource serving webapp under context path {} ensure the resource server is deployed and cross context dispatching is enable for this web application", resourceContextPath);
return request.getContextPath();
}
this.logger.debug("Found resource serving webapp at: {}", resourceContextPath);
URL url = null;
try {
url = resourceContext.getResource(resource);
}
catch (MalformedURLException e) {
//Ignore
}
if (url == null) {
this.logger.debug("Resource serving webapp {} doesn't contain resource {} Falling back to the local resource.", resourceContextPath, resource);
return request.getContextPath();
}
this.logger.debug("Resource serving webapp {} contains resource {} Using resource server.", resourceContextPath, resource);
return resourceContextPath;
} | java | protected String resolveResourceContextPath(HttpServletRequest request, String resource) {
final String resourceContextPath = this.getResourceServerContextPath();
this.logger.debug("Attempting to locate resource serving webapp with context path: {}", resourceContextPath);
//Try to resolve the
final ServletContext resourceContext = this.servletContext.getContext(resourceContextPath);
if (resourceContext == null || !resourceContextPath.equals(resourceContext.getContextPath())) {
this.logger.warn("Could not find resource serving webapp under context path {} ensure the resource server is deployed and cross context dispatching is enable for this web application", resourceContextPath);
return request.getContextPath();
}
this.logger.debug("Found resource serving webapp at: {}", resourceContextPath);
URL url = null;
try {
url = resourceContext.getResource(resource);
}
catch (MalformedURLException e) {
//Ignore
}
if (url == null) {
this.logger.debug("Resource serving webapp {} doesn't contain resource {} Falling back to the local resource.", resourceContextPath, resource);
return request.getContextPath();
}
this.logger.debug("Resource serving webapp {} contains resource {} Using resource server.", resourceContextPath, resource);
return resourceContextPath;
} | [
"protected",
"String",
"resolveResourceContextPath",
"(",
"HttpServletRequest",
"request",
",",
"String",
"resource",
")",
"{",
"final",
"String",
"resourceContextPath",
"=",
"this",
".",
"getResourceServerContextPath",
"(",
")",
";",
"this",
".",
"logger",
".",
"debug",
"(",
"\"Attempting to locate resource serving webapp with context path: {}\"",
",",
"resourceContextPath",
")",
";",
"//Try to resolve the ",
"final",
"ServletContext",
"resourceContext",
"=",
"this",
".",
"servletContext",
".",
"getContext",
"(",
"resourceContextPath",
")",
";",
"if",
"(",
"resourceContext",
"==",
"null",
"||",
"!",
"resourceContextPath",
".",
"equals",
"(",
"resourceContext",
".",
"getContextPath",
"(",
")",
")",
")",
"{",
"this",
".",
"logger",
".",
"warn",
"(",
"\"Could not find resource serving webapp under context path {} ensure the resource server is deployed and cross context dispatching is enable for this web application\"",
",",
"resourceContextPath",
")",
";",
"return",
"request",
".",
"getContextPath",
"(",
")",
";",
"}",
"this",
".",
"logger",
".",
"debug",
"(",
"\"Found resource serving webapp at: {}\"",
",",
"resourceContextPath",
")",
";",
"URL",
"url",
"=",
"null",
";",
"try",
"{",
"url",
"=",
"resourceContext",
".",
"getResource",
"(",
"resource",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"//Ignore",
"}",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"this",
".",
"logger",
".",
"debug",
"(",
"\"Resource serving webapp {} doesn't contain resource {} Falling back to the local resource.\"",
",",
"resourceContextPath",
",",
"resource",
")",
";",
"return",
"request",
".",
"getContextPath",
"(",
")",
";",
"}",
"this",
".",
"logger",
".",
"debug",
"(",
"\"Resource serving webapp {} contains resource {} Using resource server.\"",
",",
"resourceContextPath",
",",
"resource",
")",
";",
"return",
"resourceContextPath",
";",
"}"
] | If the resource serving servlet context is available and the resource
is available in the context, create a URL to the resource in that context.
If not, create a local URL for the requested resource. | [
"If",
"the",
"resource",
"serving",
"servlet",
"context",
"is",
"available",
"and",
"the",
"resource",
"is",
"available",
"in",
"the",
"context",
"create",
"a",
"URL",
"to",
"the",
"resource",
"in",
"that",
"context",
".",
"If",
"not",
"create",
"a",
"local",
"URL",
"for",
"the",
"requested",
"resource",
"."
] | 13375f716777ec3c99ae9917f672881d4aa32df3 | https://github.com/Jasig/resource-server/blob/13375f716777ec3c99ae9917f672881d4aa32df3/resource-server-utils/src/main/java/org/jasig/resourceserver/utils/aggr/ResourcesElementsProviderImpl.java#L383-L412 |
142,512 | Jasig/resource-server | resource-server-utils/src/main/java/org/jasig/resourceserver/utils/aggr/ResourcesElementsProviderImpl.java | ResourcesElementsProviderImpl.getResourceServerContextPath | protected String getResourceServerContextPath() {
final String resourceContextPath = this.servletContext.getInitParameter(RESOURCE_CONTEXT_INIT_PARAM);
if (resourceContextPath == null) {
// if no resource context path was defined in the web.xml, use the
// default
return DEFAULT_RESOURCE_CONTEXT;
}
if (!resourceContextPath.startsWith("/")) {
// ensure that our context starts with a slash
return "/".concat(resourceContextPath);
}
return resourceContextPath;
} | java | protected String getResourceServerContextPath() {
final String resourceContextPath = this.servletContext.getInitParameter(RESOURCE_CONTEXT_INIT_PARAM);
if (resourceContextPath == null) {
// if no resource context path was defined in the web.xml, use the
// default
return DEFAULT_RESOURCE_CONTEXT;
}
if (!resourceContextPath.startsWith("/")) {
// ensure that our context starts with a slash
return "/".concat(resourceContextPath);
}
return resourceContextPath;
} | [
"protected",
"String",
"getResourceServerContextPath",
"(",
")",
"{",
"final",
"String",
"resourceContextPath",
"=",
"this",
".",
"servletContext",
".",
"getInitParameter",
"(",
"RESOURCE_CONTEXT_INIT_PARAM",
")",
";",
"if",
"(",
"resourceContextPath",
"==",
"null",
")",
"{",
"// if no resource context path was defined in the web.xml, use the",
"// default",
"return",
"DEFAULT_RESOURCE_CONTEXT",
";",
"}",
"if",
"(",
"!",
"resourceContextPath",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"// ensure that our context starts with a slash",
"return",
"\"/\"",
".",
"concat",
"(",
"resourceContextPath",
")",
";",
"}",
"return",
"resourceContextPath",
";",
"}"
] | Determine the context name of the resource serving webapp | [
"Determine",
"the",
"context",
"name",
"of",
"the",
"resource",
"serving",
"webapp"
] | 13375f716777ec3c99ae9917f672881d4aa32df3 | https://github.com/Jasig/resource-server/blob/13375f716777ec3c99ae9917f672881d4aa32df3/resource-server-utils/src/main/java/org/jasig/resourceserver/utils/aggr/ResourcesElementsProviderImpl.java#L417-L431 |
142,513 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/TerminalBindingCondition.java | TerminalBindingCondition.create | private static TerminalBindingCondition create(
final String condition,
final String message) {
return createWithCode(condition, message, null);
} | java | private static TerminalBindingCondition create(
final String condition,
final String message) {
return createWithCode(condition, message, null);
} | [
"private",
"static",
"TerminalBindingCondition",
"create",
"(",
"final",
"String",
"condition",
",",
"final",
"String",
"message",
")",
"{",
"return",
"createWithCode",
"(",
"condition",
",",
"message",
",",
"null",
")",
";",
"}"
] | Helper method to call the helper method to add entries. | [
"Helper",
"method",
"to",
"call",
"the",
"helper",
"method",
"to",
"add",
"entries",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/TerminalBindingCondition.java#L128-L132 |
142,514 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/TerminalBindingCondition.java | TerminalBindingCondition.createWithCode | private static TerminalBindingCondition createWithCode(
final String condition,
final String message,
final Integer code) {
if (condition == null) {
throw(new IllegalArgumentException(
"condition may not be null"));
}
if (message == null) {
throw(new IllegalArgumentException(
"message may not be null"));
}
if (COND_TO_INSTANCE.get(condition) != null) {
throw(new IllegalStateException(
"Multiple definitions of condition: " + condition));
}
TerminalBindingCondition result =
new TerminalBindingCondition(condition, message);
COND_TO_INSTANCE.put(condition, result);
if (code != null) {
if (CODE_TO_INSTANCE.get(code) != null) {
throw(new IllegalStateException(
"Multiple definitions of code: " + code));
}
CODE_TO_INSTANCE.put(code, result);
}
return result;
} | java | private static TerminalBindingCondition createWithCode(
final String condition,
final String message,
final Integer code) {
if (condition == null) {
throw(new IllegalArgumentException(
"condition may not be null"));
}
if (message == null) {
throw(new IllegalArgumentException(
"message may not be null"));
}
if (COND_TO_INSTANCE.get(condition) != null) {
throw(new IllegalStateException(
"Multiple definitions of condition: " + condition));
}
TerminalBindingCondition result =
new TerminalBindingCondition(condition, message);
COND_TO_INSTANCE.put(condition, result);
if (code != null) {
if (CODE_TO_INSTANCE.get(code) != null) {
throw(new IllegalStateException(
"Multiple definitions of code: " + code));
}
CODE_TO_INSTANCE.put(code, result);
}
return result;
} | [
"private",
"static",
"TerminalBindingCondition",
"createWithCode",
"(",
"final",
"String",
"condition",
",",
"final",
"String",
"message",
",",
"final",
"Integer",
"code",
")",
"{",
"if",
"(",
"condition",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"\"condition may not be null\"",
")",
")",
";",
"}",
"if",
"(",
"message",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"\"message may not be null\"",
")",
")",
";",
"}",
"if",
"(",
"COND_TO_INSTANCE",
".",
"get",
"(",
"condition",
")",
"!=",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalStateException",
"(",
"\"Multiple definitions of condition: \"",
"+",
"condition",
")",
")",
";",
"}",
"TerminalBindingCondition",
"result",
"=",
"new",
"TerminalBindingCondition",
"(",
"condition",
",",
"message",
")",
";",
"COND_TO_INSTANCE",
".",
"put",
"(",
"condition",
",",
"result",
")",
";",
"if",
"(",
"code",
"!=",
"null",
")",
"{",
"if",
"(",
"CODE_TO_INSTANCE",
".",
"get",
"(",
"code",
")",
"!=",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalStateException",
"(",
"\"Multiple definitions of code: \"",
"+",
"code",
")",
")",
";",
"}",
"CODE_TO_INSTANCE",
".",
"put",
"(",
"code",
",",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Helper method to add entries. | [
"Helper",
"method",
"to",
"add",
"entries",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/TerminalBindingCondition.java#L137-L164 |
142,515 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/ServiceAgent.java | ServiceAgent.create | @Help(help = "Creates a new service")
public String create(String serviceName, List<String> roles) throws SDKException {
HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("name", serviceName);
requestBody.put("roles", roles);
return new String(
(byte[])
requestPost(
"create",
requestBody,
MediaType.APPLICATION_OCTET_STREAM_VALUE,
MediaType.APPLICATION_JSON_VALUE));
} | java | @Help(help = "Creates a new service")
public String create(String serviceName, List<String> roles) throws SDKException {
HashMap<String, Object> requestBody = new HashMap<>();
requestBody.put("name", serviceName);
requestBody.put("roles", roles);
return new String(
(byte[])
requestPost(
"create",
requestBody,
MediaType.APPLICATION_OCTET_STREAM_VALUE,
MediaType.APPLICATION_JSON_VALUE));
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Creates a new service\"",
")",
"public",
"String",
"create",
"(",
"String",
"serviceName",
",",
"List",
"<",
"String",
">",
"roles",
")",
"throws",
"SDKException",
"{",
"HashMap",
"<",
"String",
",",
"Object",
">",
"requestBody",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"requestBody",
".",
"put",
"(",
"\"name\"",
",",
"serviceName",
")",
";",
"requestBody",
".",
"put",
"(",
"\"roles\"",
",",
"roles",
")",
";",
"return",
"new",
"String",
"(",
"(",
"byte",
"[",
"]",
")",
"requestPost",
"(",
"\"create\"",
",",
"requestBody",
",",
"MediaType",
".",
"APPLICATION_OCTET_STREAM_VALUE",
",",
"MediaType",
".",
"APPLICATION_JSON_VALUE",
")",
")",
";",
"}"
] | Creates a new service.
@param serviceName Name of the service to create
@param roles projects to access
@throws SDKException if the request fails
@return key for the service to authenticate | [
"Creates",
"a",
"new",
"service",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/ServiceAgent.java#L102-L115 |
142,516 | librato/librato-java | src/main/java/com/librato/metrics/client/Versions.java | Versions.getVersion | public static String getVersion(String path, Class<?> klass) {
try {
final InputStream in = klass.getClassLoader().getResourceAsStream(path);
if (in != null) {
try {
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
while (line != null) {
if (line.startsWith("version")) {
return line.split("=")[1];
}
line = reader.readLine();
}
} finally {
in.close();
}
}
} catch (IOException e) {
LOG.error("Could not read package version using path " + path + ":", e);
}
return "unknown";
} | java | public static String getVersion(String path, Class<?> klass) {
try {
final InputStream in = klass.getClassLoader().getResourceAsStream(path);
if (in != null) {
try {
final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
while (line != null) {
if (line.startsWith("version")) {
return line.split("=")[1];
}
line = reader.readLine();
}
} finally {
in.close();
}
}
} catch (IOException e) {
LOG.error("Could not read package version using path " + path + ":", e);
}
return "unknown";
} | [
"public",
"static",
"String",
"getVersion",
"(",
"String",
"path",
",",
"Class",
"<",
"?",
">",
"klass",
")",
"{",
"try",
"{",
"final",
"InputStream",
"in",
"=",
"klass",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"path",
")",
";",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"try",
"{",
"final",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"in",
")",
")",
";",
"String",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"while",
"(",
"line",
"!=",
"null",
")",
"{",
"if",
"(",
"line",
".",
"startsWith",
"(",
"\"version\"",
")",
")",
"{",
"return",
"line",
".",
"split",
"(",
"\"=\"",
")",
"[",
"1",
"]",
";",
"}",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not read package version using path \"",
"+",
"path",
"+",
"\":\"",
",",
"e",
")",
";",
"}",
"return",
"\"unknown\"",
";",
"}"
] | Attempts to get a version property from a specified resource
@param path the path of the properties file resource
@param klass the Class whose classloader will be used to load the resource
@return the found version, "unknown" if it could not be found / determined | [
"Attempts",
"to",
"get",
"a",
"version",
"property",
"from",
"a",
"specified",
"resource"
] | bff7e776d4af5e978181db47f65e171ab67c1c77 | https://github.com/librato/librato-java/blob/bff7e776d4af5e978181db47f65e171ab67c1c77/src/main/java/com/librato/metrics/client/Versions.java#L29-L50 |
142,517 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BodyQName.java | BodyQName.create | public static BodyQName create(
final String uri,
final String local) {
return createWithPrefix(uri, local, null);
} | java | public static BodyQName create(
final String uri,
final String local) {
return createWithPrefix(uri, local, null);
} | [
"public",
"static",
"BodyQName",
"create",
"(",
"final",
"String",
"uri",
",",
"final",
"String",
"local",
")",
"{",
"return",
"createWithPrefix",
"(",
"uri",
",",
"local",
",",
"null",
")",
";",
"}"
] | Creates a new qualified name using a namespace URI and local name.
@param uri namespace URI
@param local local name
@return BodyQName instance | [
"Creates",
"a",
"new",
"qualified",
"name",
"using",
"a",
"namespace",
"URI",
"and",
"local",
"name",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BodyQName.java#L59-L63 |
142,518 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BodyQName.java | BodyQName.createWithPrefix | public static BodyQName createWithPrefix(
final String uri,
final String local,
final String prefix) {
if (uri == null || uri.length() == 0) {
throw(new IllegalArgumentException(
"URI is required and may not be null/empty"));
}
if (local == null || local.length() == 0) {
throw(new IllegalArgumentException(
"Local arg is required and may not be null/empty"));
}
if (prefix == null || prefix.length() == 0) {
return new BodyQName(new QName(uri, local));
} else {
return new BodyQName(new QName(uri, local, prefix));
}
} | java | public static BodyQName createWithPrefix(
final String uri,
final String local,
final String prefix) {
if (uri == null || uri.length() == 0) {
throw(new IllegalArgumentException(
"URI is required and may not be null/empty"));
}
if (local == null || local.length() == 0) {
throw(new IllegalArgumentException(
"Local arg is required and may not be null/empty"));
}
if (prefix == null || prefix.length() == 0) {
return new BodyQName(new QName(uri, local));
} else {
return new BodyQName(new QName(uri, local, prefix));
}
} | [
"public",
"static",
"BodyQName",
"createWithPrefix",
"(",
"final",
"String",
"uri",
",",
"final",
"String",
"local",
",",
"final",
"String",
"prefix",
")",
"{",
"if",
"(",
"uri",
"==",
"null",
"||",
"uri",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"\"URI is required and may not be null/empty\"",
")",
")",
";",
"}",
"if",
"(",
"local",
"==",
"null",
"||",
"local",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"\"Local arg is required and may not be null/empty\"",
")",
")",
";",
"}",
"if",
"(",
"prefix",
"==",
"null",
"||",
"prefix",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"new",
"BodyQName",
"(",
"new",
"QName",
"(",
"uri",
",",
"local",
")",
")",
";",
"}",
"else",
"{",
"return",
"new",
"BodyQName",
"(",
"new",
"QName",
"(",
"uri",
",",
"local",
",",
"prefix",
")",
")",
";",
"}",
"}"
] | Creates a new qualified name using a namespace URI and local name
along with an optional prefix.
@param uri namespace URI
@param local local name
@param prefix optional prefix or @{code null} for no prefix
@return BodyQName instance | [
"Creates",
"a",
"new",
"qualified",
"name",
"using",
"a",
"namespace",
"URI",
"and",
"local",
"name",
"along",
"with",
"an",
"optional",
"prefix",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BodyQName.java#L74-L91 |
142,519 | openbaton/openbaton-client | cli/src/main/java/org/openbaton/cli/util/Utils.java | Utils.methodsAreEqual | public static boolean methodsAreEqual(Method m1, Method m2) {
if (!m1.getName().equals(m2.getName())) return false;
if (!m1.getReturnType().equals(m2.getReturnType())) return false;
if (!Objects.deepEquals(m1.getParameterTypes(), m2.getParameterTypes())) return false;
return true;
} | java | public static boolean methodsAreEqual(Method m1, Method m2) {
if (!m1.getName().equals(m2.getName())) return false;
if (!m1.getReturnType().equals(m2.getReturnType())) return false;
if (!Objects.deepEquals(m1.getParameterTypes(), m2.getParameterTypes())) return false;
return true;
} | [
"public",
"static",
"boolean",
"methodsAreEqual",
"(",
"Method",
"m1",
",",
"Method",
"m2",
")",
"{",
"if",
"(",
"!",
"m1",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"m2",
".",
"getName",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"m1",
".",
"getReturnType",
"(",
")",
".",
"equals",
"(",
"m2",
".",
"getReturnType",
"(",
")",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"Objects",
".",
"deepEquals",
"(",
"m1",
".",
"getParameterTypes",
"(",
")",
",",
"m2",
".",
"getParameterTypes",
"(",
")",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}"
] | Returns true if the two passed methods are equal. Methods are in this case regarded as equal if
they take the same parameter types, return the same return type and share the same name.
@param m1 message one
@param m2 message two
@return true if method m1 and method m2 are considered equal for our case | [
"Returns",
"true",
"if",
"the",
"two",
"passed",
"methods",
"are",
"equal",
".",
"Methods",
"are",
"in",
"this",
"case",
"regarded",
"as",
"equal",
"if",
"they",
"take",
"the",
"same",
"parameter",
"types",
"return",
"the",
"same",
"return",
"type",
"and",
"share",
"the",
"same",
"name",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/cli/src/main/java/org/openbaton/cli/util/Utils.java#L34-L39 |
142,520 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/AbstractRestAgent.java | AbstractRestAgent.create | @Help(help = "Create the object of type {#}")
public T create(final T object) throws SDKException {
return (T) requestPost(object);
} | java | @Help(help = "Create the object of type {#}")
public T create(final T object) throws SDKException {
return (T) requestPost(object);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Create the object of type {#}\"",
")",
"public",
"T",
"create",
"(",
"final",
"T",
"object",
")",
"throws",
"SDKException",
"{",
"return",
"(",
"T",
")",
"requestPost",
"(",
"object",
")",
";",
"}"
] | Sends a request for creating an instance of type T to the NFVO API.
@param object the object that is sent in the create request
@return the created object
@throws SDKException if the request fails | [
"Sends",
"a",
"request",
"for",
"creating",
"an",
"instance",
"of",
"type",
"T",
"to",
"the",
"NFVO",
"API",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/AbstractRestAgent.java#L104-L107 |
142,521 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/AbstractRestAgent.java | AbstractRestAgent.findAll | @Help(help = "Find all the objects of type {#}")
public List<T> findAll() throws SDKException {
return Arrays.asList((T[]) requestGet(null, clazz));
} | java | @Help(help = "Find all the objects of type {#}")
public List<T> findAll() throws SDKException {
return Arrays.asList((T[]) requestGet(null, clazz));
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Find all the objects of type {#}\"",
")",
"public",
"List",
"<",
"T",
">",
"findAll",
"(",
")",
"throws",
"SDKException",
"{",
"return",
"Arrays",
".",
"asList",
"(",
"(",
"T",
"[",
"]",
")",
"requestGet",
"(",
"null",
",",
"clazz",
")",
")",
";",
"}"
] | Sends a request for finding all instances of type T to the NFVO API.
@return the list of found objects
@throws SDKException if the request fails | [
"Sends",
"a",
"request",
"for",
"finding",
"all",
"instances",
"of",
"type",
"T",
"to",
"the",
"NFVO",
"API",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/AbstractRestAgent.java#L126-L129 |
142,522 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/AbstractRestAgent.java | AbstractRestAgent.findById | @Help(help = "Find the object of type {#} through the id")
public T findById(final String id) throws SDKException {
return (T) requestGet(id, clazz);
} | java | @Help(help = "Find the object of type {#} through the id")
public T findById(final String id) throws SDKException {
return (T) requestGet(id, clazz);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Find the object of type {#} through the id\"",
")",
"public",
"T",
"findById",
"(",
"final",
"String",
"id",
")",
"throws",
"SDKException",
"{",
"return",
"(",
"T",
")",
"requestGet",
"(",
"id",
",",
"clazz",
")",
";",
"}"
] | Sends a request to the NFVO API for finding an instance of type T specified by it's ID.
@param id the ID of the object that shall be retrieved
@return the found object
@throws SDKException if the request fails | [
"Sends",
"a",
"request",
"to",
"the",
"NFVO",
"API",
"for",
"finding",
"an",
"instance",
"of",
"type",
"T",
"specified",
"by",
"it",
"s",
"ID",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/AbstractRestAgent.java#L138-L141 |
142,523 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/AbstractRestAgent.java | AbstractRestAgent.update | @Help(help = "Update the object of type {#} passing the new object and the id of the old object")
public T update(final T object, final String id) throws SDKException {
return (T) requestPut(id, object);
} | java | @Help(help = "Update the object of type {#} passing the new object and the id of the old object")
public T update(final T object, final String id) throws SDKException {
return (T) requestPut(id, object);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Update the object of type {#} passing the new object and the id of the old object\"",
")",
"public",
"T",
"update",
"(",
"final",
"T",
"object",
",",
"final",
"String",
"id",
")",
"throws",
"SDKException",
"{",
"return",
"(",
"T",
")",
"requestPut",
"(",
"id",
",",
"object",
")",
";",
"}"
] | Sends a request to the NFVO API for updating an instance of type T specified by its ID.
@param object the new object that is sent in the update request
@param id the ID of the object to update
@return the updated object
@throws SDKException if the request fails | [
"Sends",
"a",
"request",
"to",
"the",
"NFVO",
"API",
"for",
"updating",
"an",
"instance",
"of",
"type",
"T",
"specified",
"by",
"its",
"ID",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/AbstractRestAgent.java#L151-L154 |
142,524 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java | RestRequest.requestPost | public String requestPost(final String id) throws SDKException {
CloseableHttpResponse response = null;
HttpPost httpPost = null;
checkToken();
try {
log.debug("pathUrl: " + pathUrl);
log.debug("id: " + pathUrl + "/" + id);
// call the api here
log.debug("Executing post on: " + this.pathUrl + "/" + id);
httpPost = new HttpPost(this.pathUrl + "/" + id);
preparePostHeader(httpPost, "application/json", "application/json");
response = httpClient.execute(httpPost);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_CREATED);
// return the response of the request
String result = "";
if (response.getEntity() != null) {
result = EntityUtils.toString(response.getEntity());
}
closeResponseObject(response);
log.trace("received: " + result);
httpPost.releaseConnection();
return result;
} catch (IOException e) {
// catch request exceptions here
log.error(e.getMessage(), e);
if (httpPost != null) {
httpPost.releaseConnection();
}
throw new SDKException(
"Could not http-post or open the object properly",
e.getStackTrace(),
"Could not http-post or open the object properly because: " + e.getMessage());
} catch (SDKException e) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
token = null;
if (httpPost != null) {
httpPost.releaseConnection();
}
return requestPost(id);
} else {
if (httpPost != null) {
httpPost.releaseConnection();
}
try {
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
EntityUtils.toString(response.getEntity()));
} catch (IOException e1) {
e1.printStackTrace();
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
"could not provide reason because: " + e.getMessage());
}
}
}
} | java | public String requestPost(final String id) throws SDKException {
CloseableHttpResponse response = null;
HttpPost httpPost = null;
checkToken();
try {
log.debug("pathUrl: " + pathUrl);
log.debug("id: " + pathUrl + "/" + id);
// call the api here
log.debug("Executing post on: " + this.pathUrl + "/" + id);
httpPost = new HttpPost(this.pathUrl + "/" + id);
preparePostHeader(httpPost, "application/json", "application/json");
response = httpClient.execute(httpPost);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_CREATED);
// return the response of the request
String result = "";
if (response.getEntity() != null) {
result = EntityUtils.toString(response.getEntity());
}
closeResponseObject(response);
log.trace("received: " + result);
httpPost.releaseConnection();
return result;
} catch (IOException e) {
// catch request exceptions here
log.error(e.getMessage(), e);
if (httpPost != null) {
httpPost.releaseConnection();
}
throw new SDKException(
"Could not http-post or open the object properly",
e.getStackTrace(),
"Could not http-post or open the object properly because: " + e.getMessage());
} catch (SDKException e) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
token = null;
if (httpPost != null) {
httpPost.releaseConnection();
}
return requestPost(id);
} else {
if (httpPost != null) {
httpPost.releaseConnection();
}
try {
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
EntityUtils.toString(response.getEntity()));
} catch (IOException e1) {
e1.printStackTrace();
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
"could not provide reason because: " + e.getMessage());
}
}
}
} | [
"public",
"String",
"requestPost",
"(",
"final",
"String",
"id",
")",
"throws",
"SDKException",
"{",
"CloseableHttpResponse",
"response",
"=",
"null",
";",
"HttpPost",
"httpPost",
"=",
"null",
";",
"checkToken",
"(",
")",
";",
"try",
"{",
"log",
".",
"debug",
"(",
"\"pathUrl: \"",
"+",
"pathUrl",
")",
";",
"log",
".",
"debug",
"(",
"\"id: \"",
"+",
"pathUrl",
"+",
"\"/\"",
"+",
"id",
")",
";",
"// call the api here",
"log",
".",
"debug",
"(",
"\"Executing post on: \"",
"+",
"this",
".",
"pathUrl",
"+",
"\"/\"",
"+",
"id",
")",
";",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"this",
".",
"pathUrl",
"+",
"\"/\"",
"+",
"id",
")",
";",
"preparePostHeader",
"(",
"httpPost",
",",
"\"application/json\"",
",",
"\"application/json\"",
")",
";",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"httpPost",
")",
";",
"// check response status",
"RestUtils",
".",
"checkStatus",
"(",
"response",
",",
"HttpURLConnection",
".",
"HTTP_CREATED",
")",
";",
"// return the response of the request",
"String",
"result",
"=",
"\"\"",
";",
"if",
"(",
"response",
".",
"getEntity",
"(",
")",
"!=",
"null",
")",
"{",
"result",
"=",
"EntityUtils",
".",
"toString",
"(",
"response",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"closeResponseObject",
"(",
"response",
")",
";",
"log",
".",
"trace",
"(",
"\"received: \"",
"+",
"result",
")",
";",
"httpPost",
".",
"releaseConnection",
"(",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// catch request exceptions here",
"log",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"if",
"(",
"httpPost",
"!=",
"null",
")",
"{",
"httpPost",
".",
"releaseConnection",
"(",
")",
";",
"}",
"throw",
"new",
"SDKException",
"(",
"\"Could not http-post or open the object properly\"",
",",
"e",
".",
"getStackTrace",
"(",
")",
",",
"\"Could not http-post or open the object properly because: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"SDKException",
"e",
")",
"{",
"if",
"(",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"==",
"HttpStatus",
".",
"SC_UNAUTHORIZED",
")",
"{",
"token",
"=",
"null",
";",
"if",
"(",
"httpPost",
"!=",
"null",
")",
"{",
"httpPost",
".",
"releaseConnection",
"(",
")",
";",
"}",
"return",
"requestPost",
"(",
"id",
")",
";",
"}",
"else",
"{",
"if",
"(",
"httpPost",
"!=",
"null",
")",
"{",
"httpPost",
".",
"releaseConnection",
"(",
")",
";",
"}",
"try",
"{",
"throw",
"new",
"SDKException",
"(",
"\"Status is \"",
"+",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
",",
"new",
"StackTraceElement",
"[",
"0",
"]",
",",
"EntityUtils",
".",
"toString",
"(",
"response",
".",
"getEntity",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e1",
")",
"{",
"e1",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"SDKException",
"(",
"\"Status is \"",
"+",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
",",
"new",
"StackTraceElement",
"[",
"0",
"]",
",",
"\"could not provide reason because: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Does the POST Request
@param id specifies the entity on which to perform the post request
@return a String containing the response content
@throws SDKException if the request fails | [
"Does",
"the",
"POST",
"Request"
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L218-L281 |
142,525 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java | RestRequest.preparePostHeader | private void preparePostHeader(HttpPost httpPost, String acceptMimeType, String contentMimeType) {
if (acceptMimeType != null && !acceptMimeType.equals("")) {
httpPost.setHeader(new BasicHeader("accept", acceptMimeType));
}
if (contentMimeType != null && !contentMimeType.equals("")) {
httpPost.setHeader(new BasicHeader("Content-Type", contentMimeType));
}
httpPost.setHeader(new BasicHeader("project-id", projectId));
if (token != null && bearerToken != null) {
httpPost.setHeader(new BasicHeader("authorization", bearerToken.replaceAll("\"", "")));
}
} | java | private void preparePostHeader(HttpPost httpPost, String acceptMimeType, String contentMimeType) {
if (acceptMimeType != null && !acceptMimeType.equals("")) {
httpPost.setHeader(new BasicHeader("accept", acceptMimeType));
}
if (contentMimeType != null && !contentMimeType.equals("")) {
httpPost.setHeader(new BasicHeader("Content-Type", contentMimeType));
}
httpPost.setHeader(new BasicHeader("project-id", projectId));
if (token != null && bearerToken != null) {
httpPost.setHeader(new BasicHeader("authorization", bearerToken.replaceAll("\"", "")));
}
} | [
"private",
"void",
"preparePostHeader",
"(",
"HttpPost",
"httpPost",
",",
"String",
"acceptMimeType",
",",
"String",
"contentMimeType",
")",
"{",
"if",
"(",
"acceptMimeType",
"!=",
"null",
"&&",
"!",
"acceptMimeType",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"httpPost",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"accept\"",
",",
"acceptMimeType",
")",
")",
";",
"}",
"if",
"(",
"contentMimeType",
"!=",
"null",
"&&",
"!",
"contentMimeType",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"httpPost",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"Content-Type\"",
",",
"contentMimeType",
")",
")",
";",
"}",
"httpPost",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"project-id\"",
",",
"projectId",
")",
")",
";",
"if",
"(",
"token",
"!=",
"null",
"&&",
"bearerToken",
"!=",
"null",
")",
"{",
"httpPost",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"authorization\"",
",",
"bearerToken",
".",
"replaceAll",
"(",
"\"\\\"\"",
",",
"\"\"",
")",
")",
")",
";",
"}",
"}"
] | Add accept, content-type, projectId and token headers to an HttpPost object.
@param httpPost
@param acceptMimeType
@param contentMimeType | [
"Add",
"accept",
"content",
"-",
"type",
"projectId",
"and",
"token",
"headers",
"to",
"an",
"HttpPost",
"object",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L364-L375 |
142,526 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java | RestRequest.requestPostPackage | public VNFPackage requestPostPackage(final File f) throws SDKException {
CloseableHttpResponse response = null;
HttpPost httpPost = null;
checkToken();
try {
log.debug("Executing post on " + pathUrl);
httpPost = new HttpPost(this.pathUrl);
preparePostHeader(httpPost, "application/json", null);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
multipartEntityBuilder.addBinaryBody("file", f);
httpPost.setEntity(multipartEntityBuilder.build());
response = httpClient.execute(httpPost);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_OK);
// return the response of the request
String result = "";
if (response.getEntity() != null) {
try {
result = EntityUtils.toString(response.getEntity());
} catch (IOException e) {
e.printStackTrace();
}
}
int statusCode = response.getStatusLine().getStatusCode();
closeResponseObject(response);
httpPost.releaseConnection();
if (statusCode != HttpURLConnection.HTTP_NO_CONTENT) {
JsonParser jsonParser = new JsonParser();
JsonElement jsonElement = jsonParser.parse(result);
result = mapper.toJson(jsonElement);
log.debug("Uploaded the VNFPackage");
log.trace("received: " + result);
log.trace("Casting it into: " + VNFPackage.class);
return mapper.fromJson(result, VNFPackage.class);
}
return null;
} catch (IOException e) {
httpPost.releaseConnection();
throw new SDKException(
"Could not create VNFPackage from file " + f.getName(),
e.getStackTrace(),
e.getMessage());
} catch (SDKException e) {
if (response != null
&& response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
token = null;
if (httpPost != null) {
httpPost.releaseConnection();
}
closeResponseObject(response);
return requestPostPackage(f);
} else {
if (httpPost != null) {
httpPost.releaseConnection();
}
try {
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
EntityUtils.toString(response.getEntity()));
} catch (IOException e1) {
e1.printStackTrace();
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
"could not provide reason because: " + e.getMessage());
}
}
}
} | java | public VNFPackage requestPostPackage(final File f) throws SDKException {
CloseableHttpResponse response = null;
HttpPost httpPost = null;
checkToken();
try {
log.debug("Executing post on " + pathUrl);
httpPost = new HttpPost(this.pathUrl);
preparePostHeader(httpPost, "application/json", null);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
multipartEntityBuilder.addBinaryBody("file", f);
httpPost.setEntity(multipartEntityBuilder.build());
response = httpClient.execute(httpPost);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_OK);
// return the response of the request
String result = "";
if (response.getEntity() != null) {
try {
result = EntityUtils.toString(response.getEntity());
} catch (IOException e) {
e.printStackTrace();
}
}
int statusCode = response.getStatusLine().getStatusCode();
closeResponseObject(response);
httpPost.releaseConnection();
if (statusCode != HttpURLConnection.HTTP_NO_CONTENT) {
JsonParser jsonParser = new JsonParser();
JsonElement jsonElement = jsonParser.parse(result);
result = mapper.toJson(jsonElement);
log.debug("Uploaded the VNFPackage");
log.trace("received: " + result);
log.trace("Casting it into: " + VNFPackage.class);
return mapper.fromJson(result, VNFPackage.class);
}
return null;
} catch (IOException e) {
httpPost.releaseConnection();
throw new SDKException(
"Could not create VNFPackage from file " + f.getName(),
e.getStackTrace(),
e.getMessage());
} catch (SDKException e) {
if (response != null
&& response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
token = null;
if (httpPost != null) {
httpPost.releaseConnection();
}
closeResponseObject(response);
return requestPostPackage(f);
} else {
if (httpPost != null) {
httpPost.releaseConnection();
}
try {
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
EntityUtils.toString(response.getEntity()));
} catch (IOException e1) {
e1.printStackTrace();
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
"could not provide reason because: " + e.getMessage());
}
}
}
} | [
"public",
"VNFPackage",
"requestPostPackage",
"(",
"final",
"File",
"f",
")",
"throws",
"SDKException",
"{",
"CloseableHttpResponse",
"response",
"=",
"null",
";",
"HttpPost",
"httpPost",
"=",
"null",
";",
"checkToken",
"(",
")",
";",
"try",
"{",
"log",
".",
"debug",
"(",
"\"Executing post on \"",
"+",
"pathUrl",
")",
";",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"this",
".",
"pathUrl",
")",
";",
"preparePostHeader",
"(",
"httpPost",
",",
"\"application/json\"",
",",
"null",
")",
";",
"MultipartEntityBuilder",
"multipartEntityBuilder",
"=",
"MultipartEntityBuilder",
".",
"create",
"(",
")",
";",
"multipartEntityBuilder",
".",
"addBinaryBody",
"(",
"\"file\"",
",",
"f",
")",
";",
"httpPost",
".",
"setEntity",
"(",
"multipartEntityBuilder",
".",
"build",
"(",
")",
")",
";",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"httpPost",
")",
";",
"// check response status",
"RestUtils",
".",
"checkStatus",
"(",
"response",
",",
"HttpURLConnection",
".",
"HTTP_OK",
")",
";",
"// return the response of the request",
"String",
"result",
"=",
"\"\"",
";",
"if",
"(",
"response",
".",
"getEntity",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"result",
"=",
"EntityUtils",
".",
"toString",
"(",
"response",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"int",
"statusCode",
"=",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"closeResponseObject",
"(",
"response",
")",
";",
"httpPost",
".",
"releaseConnection",
"(",
")",
";",
"if",
"(",
"statusCode",
"!=",
"HttpURLConnection",
".",
"HTTP_NO_CONTENT",
")",
"{",
"JsonParser",
"jsonParser",
"=",
"new",
"JsonParser",
"(",
")",
";",
"JsonElement",
"jsonElement",
"=",
"jsonParser",
".",
"parse",
"(",
"result",
")",
";",
"result",
"=",
"mapper",
".",
"toJson",
"(",
"jsonElement",
")",
";",
"log",
".",
"debug",
"(",
"\"Uploaded the VNFPackage\"",
")",
";",
"log",
".",
"trace",
"(",
"\"received: \"",
"+",
"result",
")",
";",
"log",
".",
"trace",
"(",
"\"Casting it into: \"",
"+",
"VNFPackage",
".",
"class",
")",
";",
"return",
"mapper",
".",
"fromJson",
"(",
"result",
",",
"VNFPackage",
".",
"class",
")",
";",
"}",
"return",
"null",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"httpPost",
".",
"releaseConnection",
"(",
")",
";",
"throw",
"new",
"SDKException",
"(",
"\"Could not create VNFPackage from file \"",
"+",
"f",
".",
"getName",
"(",
")",
",",
"e",
".",
"getStackTrace",
"(",
")",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"SDKException",
"e",
")",
"{",
"if",
"(",
"response",
"!=",
"null",
"&&",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"==",
"HttpStatus",
".",
"SC_UNAUTHORIZED",
")",
"{",
"token",
"=",
"null",
";",
"if",
"(",
"httpPost",
"!=",
"null",
")",
"{",
"httpPost",
".",
"releaseConnection",
"(",
")",
";",
"}",
"closeResponseObject",
"(",
"response",
")",
";",
"return",
"requestPostPackage",
"(",
"f",
")",
";",
"}",
"else",
"{",
"if",
"(",
"httpPost",
"!=",
"null",
")",
"{",
"httpPost",
".",
"releaseConnection",
"(",
")",
";",
"}",
"try",
"{",
"throw",
"new",
"SDKException",
"(",
"\"Status is \"",
"+",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
",",
"new",
"StackTraceElement",
"[",
"0",
"]",
",",
"EntityUtils",
".",
"toString",
"(",
"response",
".",
"getEntity",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e1",
")",
"{",
"e1",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"SDKException",
"(",
"\"Status is \"",
"+",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
",",
"new",
"StackTraceElement",
"[",
"0",
"]",
",",
"\"could not provide reason because: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Used to upload tar files to the NFVO for creating VNFPackages.
@param f the tar file containing the VNFPackage
@return the created VNFPackage object
@throws SDKException if the request fails | [
"Used",
"to",
"upload",
"tar",
"files",
"to",
"the",
"NFVO",
"for",
"creating",
"VNFPackages",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L552-L628 |
142,527 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java | RestRequest.requestDelete | public void requestDelete(final String id) throws SDKException {
CloseableHttpResponse response = null;
HttpDelete httpDelete = null;
checkToken();
try {
log.debug("pathUrl: " + pathUrl);
log.debug("id: " + pathUrl + "/" + id);
// call the api here
log.info("Executing delete on: " + this.pathUrl + "/" + id);
httpDelete = new HttpDelete(this.pathUrl + "/" + id);
httpDelete.setHeader(new BasicHeader("project-id", projectId));
if (token != null) {
httpDelete.setHeader(new BasicHeader("authorization", bearerToken.replaceAll("\"", "")));
}
response = httpClient.execute(httpDelete);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_NO_CONTENT);
httpDelete.releaseConnection();
// return the response of the request
} catch (IOException e) {
// catch request exceptions here
log.error(e.getMessage(), e);
if (httpDelete != null) {
httpDelete.releaseConnection();
}
throw new SDKException("Could not http-delete", e.getStackTrace(), e.getMessage());
} catch (SDKException e) {
if (response != null
&& (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED)) {
token = null;
if (httpDelete != null) {
httpDelete.releaseConnection();
}
requestDelete(id);
return;
}
throw new SDKException(
"Could not http-delete or the api response was wrong", e.getStackTrace(), e.getMessage());
} finally {
if (httpDelete != null) {
httpDelete.releaseConnection();
}
}
} | java | public void requestDelete(final String id) throws SDKException {
CloseableHttpResponse response = null;
HttpDelete httpDelete = null;
checkToken();
try {
log.debug("pathUrl: " + pathUrl);
log.debug("id: " + pathUrl + "/" + id);
// call the api here
log.info("Executing delete on: " + this.pathUrl + "/" + id);
httpDelete = new HttpDelete(this.pathUrl + "/" + id);
httpDelete.setHeader(new BasicHeader("project-id", projectId));
if (token != null) {
httpDelete.setHeader(new BasicHeader("authorization", bearerToken.replaceAll("\"", "")));
}
response = httpClient.execute(httpDelete);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_NO_CONTENT);
httpDelete.releaseConnection();
// return the response of the request
} catch (IOException e) {
// catch request exceptions here
log.error(e.getMessage(), e);
if (httpDelete != null) {
httpDelete.releaseConnection();
}
throw new SDKException("Could not http-delete", e.getStackTrace(), e.getMessage());
} catch (SDKException e) {
if (response != null
&& (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED)) {
token = null;
if (httpDelete != null) {
httpDelete.releaseConnection();
}
requestDelete(id);
return;
}
throw new SDKException(
"Could not http-delete or the api response was wrong", e.getStackTrace(), e.getMessage());
} finally {
if (httpDelete != null) {
httpDelete.releaseConnection();
}
}
} | [
"public",
"void",
"requestDelete",
"(",
"final",
"String",
"id",
")",
"throws",
"SDKException",
"{",
"CloseableHttpResponse",
"response",
"=",
"null",
";",
"HttpDelete",
"httpDelete",
"=",
"null",
";",
"checkToken",
"(",
")",
";",
"try",
"{",
"log",
".",
"debug",
"(",
"\"pathUrl: \"",
"+",
"pathUrl",
")",
";",
"log",
".",
"debug",
"(",
"\"id: \"",
"+",
"pathUrl",
"+",
"\"/\"",
"+",
"id",
")",
";",
"// call the api here",
"log",
".",
"info",
"(",
"\"Executing delete on: \"",
"+",
"this",
".",
"pathUrl",
"+",
"\"/\"",
"+",
"id",
")",
";",
"httpDelete",
"=",
"new",
"HttpDelete",
"(",
"this",
".",
"pathUrl",
"+",
"\"/\"",
"+",
"id",
")",
";",
"httpDelete",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"project-id\"",
",",
"projectId",
")",
")",
";",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"httpDelete",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"authorization\"",
",",
"bearerToken",
".",
"replaceAll",
"(",
"\"\\\"\"",
",",
"\"\"",
")",
")",
")",
";",
"}",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"httpDelete",
")",
";",
"// check response status",
"RestUtils",
".",
"checkStatus",
"(",
"response",
",",
"HttpURLConnection",
".",
"HTTP_NO_CONTENT",
")",
";",
"httpDelete",
".",
"releaseConnection",
"(",
")",
";",
"// return the response of the request",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// catch request exceptions here",
"log",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"if",
"(",
"httpDelete",
"!=",
"null",
")",
"{",
"httpDelete",
".",
"releaseConnection",
"(",
")",
";",
"}",
"throw",
"new",
"SDKException",
"(",
"\"Could not http-delete\"",
",",
"e",
".",
"getStackTrace",
"(",
")",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"SDKException",
"e",
")",
"{",
"if",
"(",
"response",
"!=",
"null",
"&&",
"(",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"==",
"HttpStatus",
".",
"SC_UNAUTHORIZED",
")",
")",
"{",
"token",
"=",
"null",
";",
"if",
"(",
"httpDelete",
"!=",
"null",
")",
"{",
"httpDelete",
".",
"releaseConnection",
"(",
")",
";",
"}",
"requestDelete",
"(",
"id",
")",
";",
"return",
";",
"}",
"throw",
"new",
"SDKException",
"(",
"\"Could not http-delete or the api response was wrong\"",
",",
"e",
".",
"getStackTrace",
"(",
")",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"httpDelete",
"!=",
"null",
")",
"{",
"httpDelete",
".",
"releaseConnection",
"(",
")",
";",
"}",
"}",
"}"
] | Executes a http delete with to a given id
@param id the id path used for the api request
@throws SDKException if the request fails | [
"Executes",
"a",
"http",
"delete",
"with",
"to",
"a",
"given",
"id"
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L657-L705 |
142,528 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java | RestRequest.requestGet | public Object requestGet(final String id, Class type) throws SDKException {
String url = this.pathUrl;
if (id != null) {
url += "/" + id;
return requestGetWithStatus(url, null, type);
} else {
return requestGetAll(url, type, null);
}
} | java | public Object requestGet(final String id, Class type) throws SDKException {
String url = this.pathUrl;
if (id != null) {
url += "/" + id;
return requestGetWithStatus(url, null, type);
} else {
return requestGetAll(url, type, null);
}
} | [
"public",
"Object",
"requestGet",
"(",
"final",
"String",
"id",
",",
"Class",
"type",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"this",
".",
"pathUrl",
";",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"url",
"+=",
"\"/\"",
"+",
"id",
";",
"return",
"requestGetWithStatus",
"(",
"url",
",",
"null",
",",
"type",
")",
";",
"}",
"else",
"{",
"return",
"requestGetAll",
"(",
"url",
",",
"type",
",",
"null",
")",
";",
"}",
"}"
] | Executes a http get with to a given id
@param id the id path used for the api request
@param type the class of the requested entity
@return a string containing he response content
@throws SDKException if the request fails | [
"Executes",
"a",
"http",
"get",
"with",
"to",
"a",
"given",
"id"
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L715-L723 |
142,529 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java | RestRequest.requestPut | public Serializable requestPut(final String id, final Serializable object) throws SDKException {
CloseableHttpResponse response = null;
HttpPut httpPut = null;
checkToken();
try {
log.trace("Object is: " + object);
String fileJSONNode = mapper.toJson(object);
// call the api here
log.debug("Executing put on: " + this.pathUrl + "/" + id);
httpPut = new HttpPut(this.pathUrl + "/" + id);
httpPut.setHeader(new BasicHeader("accept", "application/json"));
httpPut.setHeader(new BasicHeader("Content-Type", "application/json"));
httpPut.setHeader(new BasicHeader("project-id", projectId));
if (token != null) {
httpPut.setHeader(new BasicHeader("authorization", bearerToken.replaceAll("\"", "")));
}
httpPut.setEntity(new StringEntity(fileJSONNode));
response = httpClient.execute(httpPut);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_ACCEPTED);
// return the response of the request
String result = "";
if (response.getEntity() != null) {
result = EntityUtils.toString(response.getEntity());
}
if (response.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_NO_CONTENT) {
closeResponseObject(response);
httpPut.releaseConnection();
JsonParser jsonParser = new JsonParser();
JsonElement jsonElement = jsonParser.parse(result);
result = mapper.toJson(jsonElement);
log.trace("received: " + result);
log.trace("Casting it into: " + object.getClass());
return mapper.fromJson(result, object.getClass());
}
closeResponseObject(response);
httpPut.releaseConnection();
return null;
} catch (IOException e) {
// catch request exceptions here
log.error(e.getMessage(), e);
if (httpPut != null) {
httpPut.releaseConnection();
}
throw new SDKException(
"PUT request failed. Either the request failed or the provided object is incorrect",
e.getStackTrace(),
e.getMessage());
} catch (SDKException e) {
if (response != null
&& response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
token = null;
if (httpPut != null) {
httpPut.releaseConnection();
}
return requestPut(id, object);
} else {
if (httpPut != null) {
httpPut.releaseConnection();
}
throw new SDKException("PUT request failed", e.getStackTrace(), e.getMessage());
}
} finally {
if (httpPut != null) {
httpPut.releaseConnection();
}
}
} | java | public Serializable requestPut(final String id, final Serializable object) throws SDKException {
CloseableHttpResponse response = null;
HttpPut httpPut = null;
checkToken();
try {
log.trace("Object is: " + object);
String fileJSONNode = mapper.toJson(object);
// call the api here
log.debug("Executing put on: " + this.pathUrl + "/" + id);
httpPut = new HttpPut(this.pathUrl + "/" + id);
httpPut.setHeader(new BasicHeader("accept", "application/json"));
httpPut.setHeader(new BasicHeader("Content-Type", "application/json"));
httpPut.setHeader(new BasicHeader("project-id", projectId));
if (token != null) {
httpPut.setHeader(new BasicHeader("authorization", bearerToken.replaceAll("\"", "")));
}
httpPut.setEntity(new StringEntity(fileJSONNode));
response = httpClient.execute(httpPut);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_ACCEPTED);
// return the response of the request
String result = "";
if (response.getEntity() != null) {
result = EntityUtils.toString(response.getEntity());
}
if (response.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_NO_CONTENT) {
closeResponseObject(response);
httpPut.releaseConnection();
JsonParser jsonParser = new JsonParser();
JsonElement jsonElement = jsonParser.parse(result);
result = mapper.toJson(jsonElement);
log.trace("received: " + result);
log.trace("Casting it into: " + object.getClass());
return mapper.fromJson(result, object.getClass());
}
closeResponseObject(response);
httpPut.releaseConnection();
return null;
} catch (IOException e) {
// catch request exceptions here
log.error(e.getMessage(), e);
if (httpPut != null) {
httpPut.releaseConnection();
}
throw new SDKException(
"PUT request failed. Either the request failed or the provided object is incorrect",
e.getStackTrace(),
e.getMessage());
} catch (SDKException e) {
if (response != null
&& response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
token = null;
if (httpPut != null) {
httpPut.releaseConnection();
}
return requestPut(id, object);
} else {
if (httpPut != null) {
httpPut.releaseConnection();
}
throw new SDKException("PUT request failed", e.getStackTrace(), e.getMessage());
}
} finally {
if (httpPut != null) {
httpPut.releaseConnection();
}
}
} | [
"public",
"Serializable",
"requestPut",
"(",
"final",
"String",
"id",
",",
"final",
"Serializable",
"object",
")",
"throws",
"SDKException",
"{",
"CloseableHttpResponse",
"response",
"=",
"null",
";",
"HttpPut",
"httpPut",
"=",
"null",
";",
"checkToken",
"(",
")",
";",
"try",
"{",
"log",
".",
"trace",
"(",
"\"Object is: \"",
"+",
"object",
")",
";",
"String",
"fileJSONNode",
"=",
"mapper",
".",
"toJson",
"(",
"object",
")",
";",
"// call the api here",
"log",
".",
"debug",
"(",
"\"Executing put on: \"",
"+",
"this",
".",
"pathUrl",
"+",
"\"/\"",
"+",
"id",
")",
";",
"httpPut",
"=",
"new",
"HttpPut",
"(",
"this",
".",
"pathUrl",
"+",
"\"/\"",
"+",
"id",
")",
";",
"httpPut",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"accept\"",
",",
"\"application/json\"",
")",
")",
";",
"httpPut",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"Content-Type\"",
",",
"\"application/json\"",
")",
")",
";",
"httpPut",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"project-id\"",
",",
"projectId",
")",
")",
";",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"httpPut",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"\"authorization\"",
",",
"bearerToken",
".",
"replaceAll",
"(",
"\"\\\"\"",
",",
"\"\"",
")",
")",
")",
";",
"}",
"httpPut",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"fileJSONNode",
")",
")",
";",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"httpPut",
")",
";",
"// check response status",
"RestUtils",
".",
"checkStatus",
"(",
"response",
",",
"HttpURLConnection",
".",
"HTTP_ACCEPTED",
")",
";",
"// return the response of the request",
"String",
"result",
"=",
"\"\"",
";",
"if",
"(",
"response",
".",
"getEntity",
"(",
")",
"!=",
"null",
")",
"{",
"result",
"=",
"EntityUtils",
".",
"toString",
"(",
"response",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"if",
"(",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"!=",
"HttpURLConnection",
".",
"HTTP_NO_CONTENT",
")",
"{",
"closeResponseObject",
"(",
"response",
")",
";",
"httpPut",
".",
"releaseConnection",
"(",
")",
";",
"JsonParser",
"jsonParser",
"=",
"new",
"JsonParser",
"(",
")",
";",
"JsonElement",
"jsonElement",
"=",
"jsonParser",
".",
"parse",
"(",
"result",
")",
";",
"result",
"=",
"mapper",
".",
"toJson",
"(",
"jsonElement",
")",
";",
"log",
".",
"trace",
"(",
"\"received: \"",
"+",
"result",
")",
";",
"log",
".",
"trace",
"(",
"\"Casting it into: \"",
"+",
"object",
".",
"getClass",
"(",
")",
")",
";",
"return",
"mapper",
".",
"fromJson",
"(",
"result",
",",
"object",
".",
"getClass",
"(",
")",
")",
";",
"}",
"closeResponseObject",
"(",
"response",
")",
";",
"httpPut",
".",
"releaseConnection",
"(",
")",
";",
"return",
"null",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// catch request exceptions here",
"log",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"if",
"(",
"httpPut",
"!=",
"null",
")",
"{",
"httpPut",
".",
"releaseConnection",
"(",
")",
";",
"}",
"throw",
"new",
"SDKException",
"(",
"\"PUT request failed. Either the request failed or the provided object is incorrect\"",
",",
"e",
".",
"getStackTrace",
"(",
")",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"SDKException",
"e",
")",
"{",
"if",
"(",
"response",
"!=",
"null",
"&&",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"==",
"HttpStatus",
".",
"SC_UNAUTHORIZED",
")",
"{",
"token",
"=",
"null",
";",
"if",
"(",
"httpPut",
"!=",
"null",
")",
"{",
"httpPut",
".",
"releaseConnection",
"(",
")",
";",
"}",
"return",
"requestPut",
"(",
"id",
",",
"object",
")",
";",
"}",
"else",
"{",
"if",
"(",
"httpPut",
"!=",
"null",
")",
"{",
"httpPut",
".",
"releaseConnection",
"(",
")",
";",
"}",
"throw",
"new",
"SDKException",
"(",
"\"PUT request failed\"",
",",
"e",
".",
"getStackTrace",
"(",
")",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"httpPut",
"!=",
"null",
")",
"{",
"httpPut",
".",
"releaseConnection",
"(",
")",
";",
"}",
"}",
"}"
] | Executes a http put with to a given id, while serializing the object content as json and
returning the response
@param id the id path used for the api request
@param object the object content to be serialized as json
@return a string containing the response content
@throws SDKException if the request fails | [
"Executes",
"a",
"http",
"put",
"with",
"to",
"a",
"given",
"id",
"while",
"serializing",
"the",
"object",
"content",
"as",
"json",
"and",
"returning",
"the",
"response"
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L900-L973 |
142,530 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClientConnEvent.java | BOSHClientConnEvent.createConnectionClosedOnErrorEvent | static BOSHClientConnEvent createConnectionClosedOnErrorEvent(
final BOSHClient source,
final List<ComposableBody> outstanding,
final Throwable cause) {
return new BOSHClientConnEvent(source, false, outstanding, cause);
} | java | static BOSHClientConnEvent createConnectionClosedOnErrorEvent(
final BOSHClient source,
final List<ComposableBody> outstanding,
final Throwable cause) {
return new BOSHClientConnEvent(source, false, outstanding, cause);
} | [
"static",
"BOSHClientConnEvent",
"createConnectionClosedOnErrorEvent",
"(",
"final",
"BOSHClient",
"source",
",",
"final",
"List",
"<",
"ComposableBody",
">",
"outstanding",
",",
"final",
"Throwable",
"cause",
")",
"{",
"return",
"new",
"BOSHClientConnEvent",
"(",
"source",
",",
"false",
",",
"outstanding",
",",
"cause",
")",
";",
"}"
] | Creates a connection closed on error event. This represents
an unexpected termination of the client session.
@param source client which has been disconnected
@param outstanding list of requests which may not have been received
by the remote connection manager
@param cause cause of termination
@return event instance | [
"Creates",
"a",
"connection",
"closed",
"on",
"error",
"event",
".",
"This",
"represents",
"an",
"unexpected",
"termination",
"of",
"the",
"client",
"session",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClientConnEvent.java#L127-L132 |
142,531 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/AttrCharsets.java | AttrCharsets.isAccepted | boolean isAccepted(final String name) {
for (String str : charsets) {
if (str.equalsIgnoreCase(name)) {
return true;
}
}
return false;
} | java | boolean isAccepted(final String name) {
for (String str : charsets) {
if (str.equalsIgnoreCase(name)) {
return true;
}
}
return false;
} | [
"boolean",
"isAccepted",
"(",
"final",
"String",
"name",
")",
"{",
"for",
"(",
"String",
"str",
":",
"charsets",
")",
"{",
"if",
"(",
"str",
".",
"equalsIgnoreCase",
"(",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Determines whether or not the specified charset is supported.
@param name encoding name
@result {@code true} if the encoding is accepted, {@code false}
otherwise | [
"Determines",
"whether",
"or",
"not",
"the",
"specified",
"charset",
"is",
"supported",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/AttrCharsets.java#L62-L69 |
142,532 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BodyParserXmlPull.java | BodyParserXmlPull.getXmlPullParser | private static XmlPullParser getXmlPullParser() {
SoftReference<XmlPullParser> ref = XPP_PARSER.get();
XmlPullParser result = ref.get();
if (result == null) {
Exception thrown;
try {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(false);
result = factory.newPullParser();
ref = new SoftReference<XmlPullParser>(result);
XPP_PARSER.set(ref);
return result;
} catch (Exception ex) {
thrown = ex;
}
throw(new IllegalStateException(
"Could not create XmlPull parser", thrown));
} else {
return result;
}
} | java | private static XmlPullParser getXmlPullParser() {
SoftReference<XmlPullParser> ref = XPP_PARSER.get();
XmlPullParser result = ref.get();
if (result == null) {
Exception thrown;
try {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(false);
result = factory.newPullParser();
ref = new SoftReference<XmlPullParser>(result);
XPP_PARSER.set(ref);
return result;
} catch (Exception ex) {
thrown = ex;
}
throw(new IllegalStateException(
"Could not create XmlPull parser", thrown));
} else {
return result;
}
} | [
"private",
"static",
"XmlPullParser",
"getXmlPullParser",
"(",
")",
"{",
"SoftReference",
"<",
"XmlPullParser",
">",
"ref",
"=",
"XPP_PARSER",
".",
"get",
"(",
")",
";",
"XmlPullParser",
"result",
"=",
"ref",
".",
"get",
"(",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"Exception",
"thrown",
";",
"try",
"{",
"XmlPullParserFactory",
"factory",
"=",
"XmlPullParserFactory",
".",
"newInstance",
"(",
")",
";",
"factory",
".",
"setNamespaceAware",
"(",
"true",
")",
";",
"factory",
".",
"setValidating",
"(",
"false",
")",
";",
"result",
"=",
"factory",
".",
"newPullParser",
"(",
")",
";",
"ref",
"=",
"new",
"SoftReference",
"<",
"XmlPullParser",
">",
"(",
"result",
")",
";",
"XPP_PARSER",
".",
"set",
"(",
"ref",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"thrown",
"=",
"ex",
";",
"}",
"throw",
"(",
"new",
"IllegalStateException",
"(",
"\"Could not create XmlPull parser\"",
",",
"thrown",
")",
")",
";",
"}",
"else",
"{",
"return",
"result",
";",
"}",
"}"
] | Gets a XmlPullParser for use in parsing incoming messages.
@return parser instance | [
"Gets",
"a",
"XmlPullParser",
"for",
"use",
"in",
"parsing",
"incoming",
"messages",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BodyParserXmlPull.java#L143-L164 |
142,533 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/StaticBody.java | StaticBody.fromStream | public static StaticBody fromStream(
final InputStream inStream)
throws BOSHException {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
try {
byte[] buffer = new byte[BUFFER_SIZE];
int read;
do {
read = inStream.read(buffer);
if (read > 0) {
byteOut.write(buffer, 0, read);
}
} while (read >= 0);
} catch (IOException iox) {
throw(new BOSHException(
"Could not read body data", iox));
}
return fromString(byteOut.toString());
} | java | public static StaticBody fromStream(
final InputStream inStream)
throws BOSHException {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
try {
byte[] buffer = new byte[BUFFER_SIZE];
int read;
do {
read = inStream.read(buffer);
if (read > 0) {
byteOut.write(buffer, 0, read);
}
} while (read >= 0);
} catch (IOException iox) {
throw(new BOSHException(
"Could not read body data", iox));
}
return fromString(byteOut.toString());
} | [
"public",
"static",
"StaticBody",
"fromStream",
"(",
"final",
"InputStream",
"inStream",
")",
"throws",
"BOSHException",
"{",
"ByteArrayOutputStream",
"byteOut",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
";",
"int",
"read",
";",
"do",
"{",
"read",
"=",
"inStream",
".",
"read",
"(",
"buffer",
")",
";",
"if",
"(",
"read",
">",
"0",
")",
"{",
"byteOut",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"read",
")",
";",
"}",
"}",
"while",
"(",
"read",
">=",
"0",
")",
";",
"}",
"catch",
"(",
"IOException",
"iox",
")",
"{",
"throw",
"(",
"new",
"BOSHException",
"(",
"\"Could not read body data\"",
",",
"iox",
")",
")",
";",
"}",
"return",
"fromString",
"(",
"byteOut",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Creates an instance which is initialized by reading a body
message from the provided stream.
@param inStream stream to read message XML from
@return body instance
@throws BOSHException on parse error | [
"Creates",
"an",
"instance",
"which",
"is",
"initialized",
"by",
"reading",
"a",
"body",
"message",
"from",
"the",
"provided",
"stream",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/StaticBody.java#L83-L101 |
142,534 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/StaticBody.java | StaticBody.fromString | public static StaticBody fromString(
final String rawXML)
throws BOSHException {
BodyParserResults results = PARSER.parse(rawXML);
return new StaticBody(results.getAttributes(), rawXML);
} | java | public static StaticBody fromString(
final String rawXML)
throws BOSHException {
BodyParserResults results = PARSER.parse(rawXML);
return new StaticBody(results.getAttributes(), rawXML);
} | [
"public",
"static",
"StaticBody",
"fromString",
"(",
"final",
"String",
"rawXML",
")",
"throws",
"BOSHException",
"{",
"BodyParserResults",
"results",
"=",
"PARSER",
".",
"parse",
"(",
"rawXML",
")",
";",
"return",
"new",
"StaticBody",
"(",
"results",
".",
"getAttributes",
"(",
")",
",",
"rawXML",
")",
";",
"}"
] | Creates an instance which is initialized by reading a body
message from the provided raw XML string.
@param rawXML raw message XML in string form
@return body instance
@throws BOSHException on parse error | [
"Creates",
"an",
"instance",
"which",
"is",
"initialized",
"by",
"reading",
"a",
"body",
"message",
"from",
"the",
"provided",
"raw",
"XML",
"string",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/StaticBody.java#L111-L116 |
142,535 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/VNFPackageAgent.java | VNFPackageAgent.create | @Help(help = "Create a VNFPackage by uploading a tar file")
public VNFPackage create(String filePath) throws SDKException {
log.debug("Start uploading a VNFPackage using the tar at path " + filePath);
File f = new File(filePath);
if (f == null || !f.exists()) {
log.error("No package: " + f.getName() + " found!");
throw new SDKException(
"No package: " + f.getName() + " found!",
new StackTraceElement[0],
"File " + filePath + " not existing");
}
return requestPostPackage(f);
} | java | @Help(help = "Create a VNFPackage by uploading a tar file")
public VNFPackage create(String filePath) throws SDKException {
log.debug("Start uploading a VNFPackage using the tar at path " + filePath);
File f = new File(filePath);
if (f == null || !f.exists()) {
log.error("No package: " + f.getName() + " found!");
throw new SDKException(
"No package: " + f.getName() + " found!",
new StackTraceElement[0],
"File " + filePath + " not existing");
}
return requestPostPackage(f);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Create a VNFPackage by uploading a tar file\"",
")",
"public",
"VNFPackage",
"create",
"(",
"String",
"filePath",
")",
"throws",
"SDKException",
"{",
"log",
".",
"debug",
"(",
"\"Start uploading a VNFPackage using the tar at path \"",
"+",
"filePath",
")",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"filePath",
")",
";",
"if",
"(",
"f",
"==",
"null",
"||",
"!",
"f",
".",
"exists",
"(",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"No package: \"",
"+",
"f",
".",
"getName",
"(",
")",
"+",
"\" found!\"",
")",
";",
"throw",
"new",
"SDKException",
"(",
"\"No package: \"",
"+",
"f",
".",
"getName",
"(",
")",
"+",
"\" found!\"",
",",
"new",
"StackTraceElement",
"[",
"0",
"]",
",",
"\"File \"",
"+",
"filePath",
"+",
"\" not existing\"",
")",
";",
"}",
"return",
"requestPostPackage",
"(",
"f",
")",
";",
"}"
] | Uploads a VNFPackage to the NFVO.
@param filePath the path to the tar file representing the VNFPackage
@return the uploaded VNFPackage
@throws SDKException if the request fails | [
"Uploads",
"a",
"VNFPackage",
"to",
"the",
"NFVO",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/VNFPackageAgent.java#L107-L119 |
142,536 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/UserAgent.java | UserAgent.findByName | @Help(help = "Find a User by his name")
public User findByName(String name) throws SDKException {
return (User) requestGet(name, User.class);
} | java | @Help(help = "Find a User by his name")
public User findByName(String name) throws SDKException {
return (User) requestGet(name, User.class);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Find a User by his name\"",
")",
"public",
"User",
"findByName",
"(",
"String",
"name",
")",
"throws",
"SDKException",
"{",
"return",
"(",
"User",
")",
"requestGet",
"(",
"name",
",",
"User",
".",
"class",
")",
";",
"}"
] | Returns a User specified by his username.
@param name the username
@return the User
@throws SDKException if the request fails | [
"Returns",
"a",
"User",
"specified",
"by",
"his",
"username",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/UserAgent.java#L93-L96 |
142,537 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/UserAgent.java | UserAgent.changePassword | @Help(help = "Change a user's password")
public void changePassword(String oldPassword, String newPassword) throws SDKException {
HashMap<String, String> requestBody = new HashMap<>();
requestBody.put("old_pwd", oldPassword);
requestBody.put("new_pwd", newPassword);
requestPut("changepwd", requestBody);
} | java | @Help(help = "Change a user's password")
public void changePassword(String oldPassword, String newPassword) throws SDKException {
HashMap<String, String> requestBody = new HashMap<>();
requestBody.put("old_pwd", oldPassword);
requestBody.put("new_pwd", newPassword);
requestPut("changepwd", requestBody);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Change a user's password\"",
")",
"public",
"void",
"changePassword",
"(",
"String",
"oldPassword",
",",
"String",
"newPassword",
")",
"throws",
"SDKException",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"requestBody",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"requestBody",
".",
"put",
"(",
"\"old_pwd\"",
",",
"oldPassword",
")",
";",
"requestBody",
".",
"put",
"(",
"\"new_pwd\"",
",",
"newPassword",
")",
";",
"requestPut",
"(",
"\"changepwd\"",
",",
"requestBody",
")",
";",
"}"
] | Changes a User's password.
@param oldPassword the User's old password
@param newPassword the User's new password
@throws SDKException if the request fails | [
"Changes",
"a",
"User",
"s",
"password",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/UserAgent.java#L105-L112 |
142,538 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/KeyAgent.java | KeyAgent.generateKey | @Help(help = "Generate a new Key in the NFVO")
public String generateKey(String name) throws SDKException {
return (String) requestPost("generate", name);
} | java | @Help(help = "Generate a new Key in the NFVO")
public String generateKey(String name) throws SDKException {
return (String) requestPost("generate", name);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Generate a new Key in the NFVO\"",
")",
"public",
"String",
"generateKey",
"(",
"String",
"name",
")",
"throws",
"SDKException",
"{",
"return",
"(",
"String",
")",
"requestPost",
"(",
"\"generate\"",
",",
"name",
")",
";",
"}"
] | Generate a new Key in the NFVO.
@param name the name of the new Key
@return the private Key
@throws SDKException if the request fails | [
"Generate",
"a",
"new",
"Key",
"in",
"the",
"NFVO",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/KeyAgent.java#L92-L95 |
142,539 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/KeyAgent.java | KeyAgent.importKey | @Help(help = "Import a Key into the NFVO by providing name and public key")
public Key importKey(String name, String publicKey) throws SDKException {
Key key = new Key();
key.setName(name);
key.setPublicKey(publicKey);
return (Key) requestPost(key);
} | java | @Help(help = "Import a Key into the NFVO by providing name and public key")
public Key importKey(String name, String publicKey) throws SDKException {
Key key = new Key();
key.setName(name);
key.setPublicKey(publicKey);
return (Key) requestPost(key);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Import a Key into the NFVO by providing name and public key\"",
")",
"public",
"Key",
"importKey",
"(",
"String",
"name",
",",
"String",
"publicKey",
")",
"throws",
"SDKException",
"{",
"Key",
"key",
"=",
"new",
"Key",
"(",
")",
";",
"key",
".",
"setName",
"(",
"name",
")",
";",
"key",
".",
"setPublicKey",
"(",
"publicKey",
")",
";",
"return",
"(",
"Key",
")",
"requestPost",
"(",
"key",
")",
";",
"}"
] | Import a Key into the NFVO by providing name and public key.
@param name the name of the Key
@param publicKey the public Key
@return the imported Key
@throws SDKException if the request fails | [
"Import",
"a",
"Key",
"into",
"the",
"NFVO",
"by",
"providing",
"name",
"and",
"public",
"key",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/KeyAgent.java#L105-L111 |
142,540 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/ComposableBody.java | ComposableBody.computeXML | private String computeXML() {
BodyQName bodyName = getBodyQName();
StringBuilder builder = new StringBuilder();
builder.append("<");
builder.append(bodyName.getLocalPart());
for (Map.Entry<BodyQName, String> entry : attrs.entrySet()) {
builder.append(" ");
BodyQName name = entry.getKey();
String prefix = name.getPrefix();
if (prefix != null && prefix.length() > 0) {
builder.append(prefix);
builder.append(":");
}
builder.append(name.getLocalPart());
builder.append("='");
builder.append(escape(entry.getValue()));
builder.append("'");
}
builder.append(" ");
builder.append(XMLConstants.XMLNS_ATTRIBUTE);
builder.append("='");
builder.append(bodyName.getNamespaceURI());
builder.append("'>");
if (payload != null) {
builder.append(payload);
}
builder.append("</body>");
return builder.toString();
} | java | private String computeXML() {
BodyQName bodyName = getBodyQName();
StringBuilder builder = new StringBuilder();
builder.append("<");
builder.append(bodyName.getLocalPart());
for (Map.Entry<BodyQName, String> entry : attrs.entrySet()) {
builder.append(" ");
BodyQName name = entry.getKey();
String prefix = name.getPrefix();
if (prefix != null && prefix.length() > 0) {
builder.append(prefix);
builder.append(":");
}
builder.append(name.getLocalPart());
builder.append("='");
builder.append(escape(entry.getValue()));
builder.append("'");
}
builder.append(" ");
builder.append(XMLConstants.XMLNS_ATTRIBUTE);
builder.append("='");
builder.append(bodyName.getNamespaceURI());
builder.append("'>");
if (payload != null) {
builder.append(payload);
}
builder.append("</body>");
return builder.toString();
} | [
"private",
"String",
"computeXML",
"(",
")",
"{",
"BodyQName",
"bodyName",
"=",
"getBodyQName",
"(",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"<\"",
")",
";",
"builder",
".",
"append",
"(",
"bodyName",
".",
"getLocalPart",
"(",
")",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"BodyQName",
",",
"String",
">",
"entry",
":",
"attrs",
".",
"entrySet",
"(",
")",
")",
"{",
"builder",
".",
"append",
"(",
"\" \"",
")",
";",
"BodyQName",
"name",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"prefix",
"=",
"name",
".",
"getPrefix",
"(",
")",
";",
"if",
"(",
"prefix",
"!=",
"null",
"&&",
"prefix",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"prefix",
")",
";",
"builder",
".",
"append",
"(",
"\":\"",
")",
";",
"}",
"builder",
".",
"append",
"(",
"name",
".",
"getLocalPart",
"(",
")",
")",
";",
"builder",
".",
"append",
"(",
"\"='\"",
")",
";",
"builder",
".",
"append",
"(",
"escape",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
")",
";",
"builder",
".",
"append",
"(",
"\"'\"",
")",
";",
"}",
"builder",
".",
"append",
"(",
"\" \"",
")",
";",
"builder",
".",
"append",
"(",
"XMLConstants",
".",
"XMLNS_ATTRIBUTE",
")",
";",
"builder",
".",
"append",
"(",
"\"='\"",
")",
";",
"builder",
".",
"append",
"(",
"bodyName",
".",
"getNamespaceURI",
"(",
")",
")",
";",
"builder",
".",
"append",
"(",
"\"'>\"",
")",
";",
"if",
"(",
"payload",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"payload",
")",
";",
"}",
"builder",
".",
"append",
"(",
"\"</body>\"",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] | Generate a String representation of the message body.
@return XML string representation of the body | [
"Generate",
"a",
"String",
"representation",
"of",
"the",
"message",
"body",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/ComposableBody.java#L321-L349 |
142,541 | Jasig/resource-server | resource-server-core/src/main/java/org/jasig/resource/aggr/ResourcesAggregatorImpl.java | ResourcesAggregatorImpl.findFile | protected File findFile(final List<File> sourceDirectories, String resourceFileName) throws IOException {
for (final File sourceDirectory : sourceDirectories) {
final File resourceFile = new File(sourceDirectory, resourceFileName);
if (resourceFile.exists()) {
return resourceFile;
}
}
throw new IOException("Failed to find resource " + resourceFileName + " in any of the source directories: " + sourceDirectories);
} | java | protected File findFile(final List<File> sourceDirectories, String resourceFileName) throws IOException {
for (final File sourceDirectory : sourceDirectories) {
final File resourceFile = new File(sourceDirectory, resourceFileName);
if (resourceFile.exists()) {
return resourceFile;
}
}
throw new IOException("Failed to find resource " + resourceFileName + " in any of the source directories: " + sourceDirectories);
} | [
"protected",
"File",
"findFile",
"(",
"final",
"List",
"<",
"File",
">",
"sourceDirectories",
",",
"String",
"resourceFileName",
")",
"throws",
"IOException",
"{",
"for",
"(",
"final",
"File",
"sourceDirectory",
":",
"sourceDirectories",
")",
"{",
"final",
"File",
"resourceFile",
"=",
"new",
"File",
"(",
"sourceDirectory",
",",
"resourceFileName",
")",
";",
"if",
"(",
"resourceFile",
".",
"exists",
"(",
")",
")",
"{",
"return",
"resourceFile",
";",
"}",
"}",
"throw",
"new",
"IOException",
"(",
"\"Failed to find resource \"",
"+",
"resourceFileName",
"+",
"\" in any of the source directories: \"",
"+",
"sourceDirectories",
")",
";",
"}"
] | Find the File for the resource file in the various source directories.
@param sourceDirectories List of directories to scan
@param resourceFileName File name of resource file
@return The resolved File
@throws IOException If the File cannot be found | [
"Find",
"the",
"File",
"for",
"the",
"resource",
"file",
"in",
"the",
"various",
"source",
"directories",
"."
] | 13375f716777ec3c99ae9917f672881d4aa32df3 | https://github.com/Jasig/resource-server/blob/13375f716777ec3c99ae9917f672881d4aa32df3/resource-server-core/src/main/java/org/jasig/resource/aggr/ResourcesAggregatorImpl.java#L313-L322 |
142,542 | Jasig/resource-server | resource-server-core/src/main/java/org/jasig/resource/aggr/ResourcesAggregatorImpl.java | ResourcesAggregatorImpl.logAggregation | protected void logAggregation(final Deque<? extends BasicInclude> elements, final String fileName) {
if (this.logger.isDebugEnabled()) {
final StringBuilder msg = new StringBuilder("Aggregated ")
.append(fileName)
.append(" from ")
.append(generatePathList(elements));
this.logger.debug(msg);
}
} | java | protected void logAggregation(final Deque<? extends BasicInclude> elements, final String fileName) {
if (this.logger.isDebugEnabled()) {
final StringBuilder msg = new StringBuilder("Aggregated ")
.append(fileName)
.append(" from ")
.append(generatePathList(elements));
this.logger.debug(msg);
}
} | [
"protected",
"void",
"logAggregation",
"(",
"final",
"Deque",
"<",
"?",
"extends",
"BasicInclude",
">",
"elements",
",",
"final",
"String",
"fileName",
")",
"{",
"if",
"(",
"this",
".",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"final",
"StringBuilder",
"msg",
"=",
"new",
"StringBuilder",
"(",
"\"Aggregated \"",
")",
".",
"append",
"(",
"fileName",
")",
".",
"append",
"(",
"\" from \"",
")",
".",
"append",
"(",
"generatePathList",
"(",
"elements",
")",
")",
";",
"this",
".",
"logger",
".",
"debug",
"(",
"msg",
")",
";",
"}",
"}"
] | Log the result of an aggregation | [
"Log",
"the",
"result",
"of",
"an",
"aggregation"
] | 13375f716777ec3c99ae9917f672881d4aa32df3 | https://github.com/Jasig/resource-server/blob/13375f716777ec3c99ae9917f672881d4aa32df3/resource-server-core/src/main/java/org/jasig/resource/aggr/ResourcesAggregatorImpl.java#L429-L438 |
142,543 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/ApacheHTTPResponse.java | ApacheHTTPResponse.getBody | public AbstractBody getBody() throws InterruptedException, BOSHException {
if (toThrow != null) {
throw(toThrow);
}
lock.lock();
try {
if (!sent) {
awaitResponse();
}
} finally {
lock.unlock();
}
return body;
} | java | public AbstractBody getBody() throws InterruptedException, BOSHException {
if (toThrow != null) {
throw(toThrow);
}
lock.lock();
try {
if (!sent) {
awaitResponse();
}
} finally {
lock.unlock();
}
return body;
} | [
"public",
"AbstractBody",
"getBody",
"(",
")",
"throws",
"InterruptedException",
",",
"BOSHException",
"{",
"if",
"(",
"toThrow",
"!=",
"null",
")",
"{",
"throw",
"(",
"toThrow",
")",
";",
"}",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"sent",
")",
"{",
"awaitResponse",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"return",
"body",
";",
"}"
] | Wait for and then return the response body.
@return body of the response
@throws InterruptedException if interrupted while awaiting the response
@throws BOSHException on communication failure | [
"Wait",
"for",
"and",
"then",
"return",
"the",
"response",
"body",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/ApacheHTTPResponse.java#L185-L198 |
142,544 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/ApacheHTTPResponse.java | ApacheHTTPResponse.getHTTPStatus | public int getHTTPStatus() throws InterruptedException, BOSHException {
if (toThrow != null) {
throw(toThrow);
}
lock.lock();
try {
if (!sent) {
awaitResponse();
}
} finally {
lock.unlock();
}
return statusCode;
} | java | public int getHTTPStatus() throws InterruptedException, BOSHException {
if (toThrow != null) {
throw(toThrow);
}
lock.lock();
try {
if (!sent) {
awaitResponse();
}
} finally {
lock.unlock();
}
return statusCode;
} | [
"public",
"int",
"getHTTPStatus",
"(",
")",
"throws",
"InterruptedException",
",",
"BOSHException",
"{",
"if",
"(",
"toThrow",
"!=",
"null",
")",
"{",
"throw",
"(",
"toThrow",
")",
";",
"}",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"sent",
")",
"{",
"awaitResponse",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"return",
"statusCode",
";",
"}"
] | Wait for and then return the response HTTP status code.
@return HTTP status code of the response
@throws InterruptedException if interrupted while awaiting the response
@throws BOSHException on communication failure | [
"Wait",
"for",
"and",
"then",
"return",
"the",
"response",
"HTTP",
"status",
"code",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/ApacheHTTPResponse.java#L207-L220 |
142,545 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/ApacheHTTPResponse.java | ApacheHTTPResponse.awaitResponse | private synchronized void awaitResponse() throws BOSHException {
HttpEntity entity = null;
try {
HttpResponse httpResp = client.execute(post, context);
entity = httpResp.getEntity();
byte[] data = EntityUtils.toByteArray(entity);
String encoding = entity.getContentEncoding() != null ?
entity.getContentEncoding().getValue() :
null;
if (ZLIBCodec.getID().equalsIgnoreCase(encoding)) {
data = ZLIBCodec.decode(data);
} else if (GZIPCodec.getID().equalsIgnoreCase(encoding)) {
data = GZIPCodec.decode(data);
}
body = StaticBody.fromString(new String(data, CHARSET));
statusCode = httpResp.getStatusLine().getStatusCode();
sent = true;
} catch (IOException iox) {
abort();
toThrow = new BOSHException("Could not obtain response", iox);
throw(toThrow);
} catch (RuntimeException ex) {
abort();
throw(ex);
}
} | java | private synchronized void awaitResponse() throws BOSHException {
HttpEntity entity = null;
try {
HttpResponse httpResp = client.execute(post, context);
entity = httpResp.getEntity();
byte[] data = EntityUtils.toByteArray(entity);
String encoding = entity.getContentEncoding() != null ?
entity.getContentEncoding().getValue() :
null;
if (ZLIBCodec.getID().equalsIgnoreCase(encoding)) {
data = ZLIBCodec.decode(data);
} else if (GZIPCodec.getID().equalsIgnoreCase(encoding)) {
data = GZIPCodec.decode(data);
}
body = StaticBody.fromString(new String(data, CHARSET));
statusCode = httpResp.getStatusLine().getStatusCode();
sent = true;
} catch (IOException iox) {
abort();
toThrow = new BOSHException("Could not obtain response", iox);
throw(toThrow);
} catch (RuntimeException ex) {
abort();
throw(ex);
}
} | [
"private",
"synchronized",
"void",
"awaitResponse",
"(",
")",
"throws",
"BOSHException",
"{",
"HttpEntity",
"entity",
"=",
"null",
";",
"try",
"{",
"HttpResponse",
"httpResp",
"=",
"client",
".",
"execute",
"(",
"post",
",",
"context",
")",
";",
"entity",
"=",
"httpResp",
".",
"getEntity",
"(",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"EntityUtils",
".",
"toByteArray",
"(",
"entity",
")",
";",
"String",
"encoding",
"=",
"entity",
".",
"getContentEncoding",
"(",
")",
"!=",
"null",
"?",
"entity",
".",
"getContentEncoding",
"(",
")",
".",
"getValue",
"(",
")",
":",
"null",
";",
"if",
"(",
"ZLIBCodec",
".",
"getID",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"encoding",
")",
")",
"{",
"data",
"=",
"ZLIBCodec",
".",
"decode",
"(",
"data",
")",
";",
"}",
"else",
"if",
"(",
"GZIPCodec",
".",
"getID",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"encoding",
")",
")",
"{",
"data",
"=",
"GZIPCodec",
".",
"decode",
"(",
"data",
")",
";",
"}",
"body",
"=",
"StaticBody",
".",
"fromString",
"(",
"new",
"String",
"(",
"data",
",",
"CHARSET",
")",
")",
";",
"statusCode",
"=",
"httpResp",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"sent",
"=",
"true",
";",
"}",
"catch",
"(",
"IOException",
"iox",
")",
"{",
"abort",
"(",
")",
";",
"toThrow",
"=",
"new",
"BOSHException",
"(",
"\"Could not obtain response\"",
",",
"iox",
")",
";",
"throw",
"(",
"toThrow",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"ex",
")",
"{",
"abort",
"(",
")",
";",
"throw",
"(",
"ex",
")",
";",
"}",
"}"
] | Await the response, storing the result in the instance variables of
this class when they arrive.
@throws InterruptedException if interrupted while awaiting the response
@throws BOSHException on communication failure | [
"Await",
"the",
"response",
"storing",
"the",
"result",
"in",
"the",
"instance",
"variables",
"of",
"this",
"class",
"when",
"they",
"arrive",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/ApacheHTTPResponse.java#L232-L257 |
142,546 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.addBOSHClientConnListener | public void addBOSHClientConnListener(
final BOSHClientConnListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
connListeners.add(listener);
} | java | public void addBOSHClientConnListener(
final BOSHClientConnListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
connListeners.add(listener);
} | [
"public",
"void",
"addBOSHClientConnListener",
"(",
"final",
"BOSHClientConnListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"NULL_LISTENER",
")",
")",
";",
"}",
"connListeners",
".",
"add",
"(",
"listener",
")",
";",
"}"
] | Adds a connection listener to the session.
@param listener connection listener to add, if not already added | [
"Adds",
"a",
"connection",
"listener",
"to",
"the",
"session",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L382-L388 |
142,547 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.removeBOSHClientConnListener | public void removeBOSHClientConnListener(
final BOSHClientConnListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
connListeners.remove(listener);
} | java | public void removeBOSHClientConnListener(
final BOSHClientConnListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
connListeners.remove(listener);
} | [
"public",
"void",
"removeBOSHClientConnListener",
"(",
"final",
"BOSHClientConnListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"NULL_LISTENER",
")",
")",
";",
"}",
"connListeners",
".",
"remove",
"(",
"listener",
")",
";",
"}"
] | Removes a connection listener from the session.
@param listener connection listener to remove, if previously added | [
"Removes",
"a",
"connection",
"listener",
"from",
"the",
"session",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L395-L401 |
142,548 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.addBOSHClientRequestListener | public void addBOSHClientRequestListener(
final BOSHClientRequestListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
requestListeners.add(listener);
} | java | public void addBOSHClientRequestListener(
final BOSHClientRequestListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
requestListeners.add(listener);
} | [
"public",
"void",
"addBOSHClientRequestListener",
"(",
"final",
"BOSHClientRequestListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"NULL_LISTENER",
")",
")",
";",
"}",
"requestListeners",
".",
"add",
"(",
"listener",
")",
";",
"}"
] | Adds a request message listener to the session.
@param listener request listener to add, if not already added | [
"Adds",
"a",
"request",
"message",
"listener",
"to",
"the",
"session",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L408-L414 |
142,549 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.removeBOSHClientRequestListener | public void removeBOSHClientRequestListener(
final BOSHClientRequestListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
requestListeners.remove(listener);
} | java | public void removeBOSHClientRequestListener(
final BOSHClientRequestListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
requestListeners.remove(listener);
} | [
"public",
"void",
"removeBOSHClientRequestListener",
"(",
"final",
"BOSHClientRequestListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"NULL_LISTENER",
")",
")",
";",
"}",
"requestListeners",
".",
"remove",
"(",
"listener",
")",
";",
"}"
] | Removes a request message listener from the session, if previously
added.
@param listener instance to remove | [
"Removes",
"a",
"request",
"message",
"listener",
"from",
"the",
"session",
"if",
"previously",
"added",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L422-L428 |
142,550 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.addBOSHClientResponseListener | public void addBOSHClientResponseListener(
final BOSHClientResponseListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
responseListeners.add(listener);
} | java | public void addBOSHClientResponseListener(
final BOSHClientResponseListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
responseListeners.add(listener);
} | [
"public",
"void",
"addBOSHClientResponseListener",
"(",
"final",
"BOSHClientResponseListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"NULL_LISTENER",
")",
")",
";",
"}",
"responseListeners",
".",
"add",
"(",
"listener",
")",
";",
"}"
] | Adds a response message listener to the session.
@param listener response listener to add, if not already added | [
"Adds",
"a",
"response",
"message",
"listener",
"to",
"the",
"session",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L435-L441 |
142,551 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.removeBOSHClientResponseListener | public void removeBOSHClientResponseListener(
final BOSHClientResponseListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
responseListeners.remove(listener);
} | java | public void removeBOSHClientResponseListener(
final BOSHClientResponseListener listener) {
if (listener == null) {
throw(new IllegalArgumentException(NULL_LISTENER));
}
responseListeners.remove(listener);
} | [
"public",
"void",
"removeBOSHClientResponseListener",
"(",
"final",
"BOSHClientResponseListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"NULL_LISTENER",
")",
")",
";",
"}",
"responseListeners",
".",
"remove",
"(",
"listener",
")",
";",
"}"
] | Removes a response message listener from the session, if previously
added.
@param listener instance to remove | [
"Removes",
"a",
"response",
"message",
"listener",
"from",
"the",
"session",
"if",
"previously",
"added",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L449-L455 |
142,552 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.disconnect | public void disconnect(final ComposableBody msg) throws BOSHException {
if (msg == null) {
throw(new IllegalArgumentException(
"Message body may not be null"));
}
Builder builder = msg.rebuild();
builder.setAttribute(Attributes.TYPE, TERMINATE);
send(builder.build());
} | java | public void disconnect(final ComposableBody msg) throws BOSHException {
if (msg == null) {
throw(new IllegalArgumentException(
"Message body may not be null"));
}
Builder builder = msg.rebuild();
builder.setAttribute(Attributes.TYPE, TERMINATE);
send(builder.build());
} | [
"public",
"void",
"disconnect",
"(",
"final",
"ComposableBody",
"msg",
")",
"throws",
"BOSHException",
"{",
"if",
"(",
"msg",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"\"Message body may not be null\"",
")",
")",
";",
"}",
"Builder",
"builder",
"=",
"msg",
".",
"rebuild",
"(",
")",
";",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"TYPE",
",",
"TERMINATE",
")",
";",
"send",
"(",
"builder",
".",
"build",
"(",
")",
")",
";",
"}"
] | End the BOSH session by disconnecting from the remote BOSH connection
manager, sending the provided content in the final connection
termination message.
@param msg final message to send
@throws BOSHException when termination message cannot be sent | [
"End",
"the",
"BOSH",
"session",
"by",
"disconnecting",
"from",
"the",
"remote",
"BOSH",
"connection",
"manager",
"sending",
"the",
"provided",
"content",
"in",
"the",
"final",
"connection",
"termination",
"message",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L578-L587 |
142,553 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.drain | void drain() {
lock.lock();
try {
LOG.finest("Waiting while draining...");
while (isWorking()
&& (emptyRequestFuture == null
|| emptyRequestFuture.isDone())) {
try {
drained.await();
} catch (InterruptedException intx) {
LOG.log(Level.FINEST, INTERRUPTED, intx);
}
}
LOG.finest("Drained");
} finally {
lock.unlock();
}
} | java | void drain() {
lock.lock();
try {
LOG.finest("Waiting while draining...");
while (isWorking()
&& (emptyRequestFuture == null
|| emptyRequestFuture.isDone())) {
try {
drained.await();
} catch (InterruptedException intx) {
LOG.log(Level.FINEST, INTERRUPTED, intx);
}
}
LOG.finest("Drained");
} finally {
lock.unlock();
}
} | [
"void",
"drain",
"(",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"LOG",
".",
"finest",
"(",
"\"Waiting while draining...\"",
")",
";",
"while",
"(",
"isWorking",
"(",
")",
"&&",
"(",
"emptyRequestFuture",
"==",
"null",
"||",
"emptyRequestFuture",
".",
"isDone",
"(",
")",
")",
")",
"{",
"try",
"{",
"drained",
".",
"await",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"intx",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"INTERRUPTED",
",",
"intx",
")",
";",
"}",
"}",
"LOG",
".",
"finest",
"(",
"\"Drained\"",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Wait until no more messages are waiting to be processed. | [
"Wait",
"until",
"no",
"more",
"messages",
"are",
"waiting",
"to",
"be",
"processed",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L620-L637 |
142,554 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.init | private void init() {
assertUnlocked();
lock.lock();
try {
httpSender.init(cfg);
LOG.info(
"Starting with "
+ DEFAULT_REQ_PROC_COUNT + " request processors");
procThreads = new RequestProcessor[DEFAULT_REQ_PROC_COUNT];
for (int i = 0; i < procThreads.length; i++) {
procThreads[i] = new RequestProcessor(i);
procThreads[i].start();
}
} finally {
lock.unlock();
}
} | java | private void init() {
assertUnlocked();
lock.lock();
try {
httpSender.init(cfg);
LOG.info(
"Starting with "
+ DEFAULT_REQ_PROC_COUNT + " request processors");
procThreads = new RequestProcessor[DEFAULT_REQ_PROC_COUNT];
for (int i = 0; i < procThreads.length; i++) {
procThreads[i] = new RequestProcessor(i);
procThreads[i].start();
}
} finally {
lock.unlock();
}
} | [
"private",
"void",
"init",
"(",
")",
"{",
"assertUnlocked",
"(",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"httpSender",
".",
"init",
"(",
"cfg",
")",
";",
"LOG",
".",
"info",
"(",
"\"Starting with \"",
"+",
"DEFAULT_REQ_PROC_COUNT",
"+",
"\" request processors\"",
")",
";",
"procThreads",
"=",
"new",
"RequestProcessor",
"[",
"DEFAULT_REQ_PROC_COUNT",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"procThreads",
".",
"length",
";",
"i",
"++",
")",
"{",
"procThreads",
"[",
"i",
"]",
"=",
"new",
"RequestProcessor",
"(",
"i",
")",
";",
"procThreads",
"[",
"i",
"]",
".",
"start",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Initialize the session. This initializes the underlying HTTP
transport implementation and starts the receive thread. | [
"Initialize",
"the",
"session",
".",
"This",
"initializes",
"the",
"underlying",
"HTTP",
"transport",
"implementation",
"and",
"starts",
"the",
"receive",
"thread",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L656-L677 |
142,555 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.dispose | private void dispose(final Throwable cause) {
assertUnlocked();
lock.lock();
try {
if (procThreads == null) {
// Already disposed
return;
}
for (RequestProcessor processor : procThreads) {
processor.dispose();
}
procThreads = null;
} finally {
lock.unlock();
}
if (cause == null) {
fireConnectionClosed();
} else {
fireConnectionClosedOnError(cause);
}
lock.lock();
try {
clearEmptyRequest();
exchanges = null;
cmParams = null;
pendingResponseAcks = null;
pendingRequestAcks = null;
notEmpty.signalAll();
notFull.signalAll();
drained.signalAll();
} finally {
lock.unlock();
}
httpSender.destroy();
schedExec.shutdownNow();
} | java | private void dispose(final Throwable cause) {
assertUnlocked();
lock.lock();
try {
if (procThreads == null) {
// Already disposed
return;
}
for (RequestProcessor processor : procThreads) {
processor.dispose();
}
procThreads = null;
} finally {
lock.unlock();
}
if (cause == null) {
fireConnectionClosed();
} else {
fireConnectionClosedOnError(cause);
}
lock.lock();
try {
clearEmptyRequest();
exchanges = null;
cmParams = null;
pendingResponseAcks = null;
pendingRequestAcks = null;
notEmpty.signalAll();
notFull.signalAll();
drained.signalAll();
} finally {
lock.unlock();
}
httpSender.destroy();
schedExec.shutdownNow();
} | [
"private",
"void",
"dispose",
"(",
"final",
"Throwable",
"cause",
")",
"{",
"assertUnlocked",
"(",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"procThreads",
"==",
"null",
")",
"{",
"// Already disposed",
"return",
";",
"}",
"for",
"(",
"RequestProcessor",
"processor",
":",
"procThreads",
")",
"{",
"processor",
".",
"dispose",
"(",
")",
";",
"}",
"procThreads",
"=",
"null",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"if",
"(",
"cause",
"==",
"null",
")",
"{",
"fireConnectionClosed",
"(",
")",
";",
"}",
"else",
"{",
"fireConnectionClosedOnError",
"(",
"cause",
")",
";",
"}",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"clearEmptyRequest",
"(",
")",
";",
"exchanges",
"=",
"null",
";",
"cmParams",
"=",
"null",
";",
"pendingResponseAcks",
"=",
"null",
";",
"pendingRequestAcks",
"=",
"null",
";",
"notEmpty",
".",
"signalAll",
"(",
")",
";",
"notFull",
".",
"signalAll",
"(",
")",
";",
"drained",
".",
"signalAll",
"(",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"httpSender",
".",
"destroy",
"(",
")",
";",
"schedExec",
".",
"shutdownNow",
"(",
")",
";",
"}"
] | Destroy this session.
@param cause the reason for the session termination, or {@code null}
for normal termination | [
"Destroy",
"this",
"session",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L685-L724 |
142,556 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.getTerminalBindingCondition | private TerminalBindingCondition getTerminalBindingCondition(
final int respCode,
final AbstractBody respBody) {
assertLocked();
if (isTermination(respBody)) {
String str = respBody.getAttribute(Attributes.CONDITION);
return TerminalBindingCondition.forString(str);
}
// Check for deprecated HTTP Error Conditions
if (cmParams != null && cmParams.getVersion() == null) {
return TerminalBindingCondition.forHTTPResponseCode(respCode);
}
return null;
} | java | private TerminalBindingCondition getTerminalBindingCondition(
final int respCode,
final AbstractBody respBody) {
assertLocked();
if (isTermination(respBody)) {
String str = respBody.getAttribute(Attributes.CONDITION);
return TerminalBindingCondition.forString(str);
}
// Check for deprecated HTTP Error Conditions
if (cmParams != null && cmParams.getVersion() == null) {
return TerminalBindingCondition.forHTTPResponseCode(respCode);
}
return null;
} | [
"private",
"TerminalBindingCondition",
"getTerminalBindingCondition",
"(",
"final",
"int",
"respCode",
",",
"final",
"AbstractBody",
"respBody",
")",
"{",
"assertLocked",
"(",
")",
";",
"if",
"(",
"isTermination",
"(",
"respBody",
")",
")",
"{",
"String",
"str",
"=",
"respBody",
".",
"getAttribute",
"(",
"Attributes",
".",
"CONDITION",
")",
";",
"return",
"TerminalBindingCondition",
".",
"forString",
"(",
"str",
")",
";",
"}",
"// Check for deprecated HTTP Error Conditions",
"if",
"(",
"cmParams",
"!=",
"null",
"&&",
"cmParams",
".",
"getVersion",
"(",
")",
"==",
"null",
")",
"{",
"return",
"TerminalBindingCondition",
".",
"forHTTPResponseCode",
"(",
"respCode",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Evaluates the HTTP response code and response message and returns the
terminal binding condition that it describes, if any.
@param respCode HTTP response code
@param respBody response body
@return terminal binding condition, or {@code null} if not a terminal
binding condition message | [
"Evaluates",
"the",
"HTTP",
"response",
"code",
"and",
"response",
"message",
"and",
"returns",
"the",
"terminal",
"binding",
"condition",
"that",
"it",
"describes",
"if",
"any",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L759-L773 |
142,557 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.isImmediatelySendable | private boolean isImmediatelySendable(final AbstractBody msg) {
assertLocked();
if (cmParams == null) {
// block if we're waiting for a response to our first request
return exchanges.isEmpty();
}
AttrRequests requests = cmParams.getRequests();
if (requests == null) {
return true;
}
int maxRequests = requests.intValue();
if (exchanges.size() < maxRequests) {
return true;
}
if (exchanges.size() == maxRequests
&& (isTermination(msg) || isPause(msg))) {
// One additional terminate or pause message is allowed
return true;
}
return false;
} | java | private boolean isImmediatelySendable(final AbstractBody msg) {
assertLocked();
if (cmParams == null) {
// block if we're waiting for a response to our first request
return exchanges.isEmpty();
}
AttrRequests requests = cmParams.getRequests();
if (requests == null) {
return true;
}
int maxRequests = requests.intValue();
if (exchanges.size() < maxRequests) {
return true;
}
if (exchanges.size() == maxRequests
&& (isTermination(msg) || isPause(msg))) {
// One additional terminate or pause message is allowed
return true;
}
return false;
} | [
"private",
"boolean",
"isImmediatelySendable",
"(",
"final",
"AbstractBody",
"msg",
")",
"{",
"assertLocked",
"(",
")",
";",
"if",
"(",
"cmParams",
"==",
"null",
")",
"{",
"// block if we're waiting for a response to our first request",
"return",
"exchanges",
".",
"isEmpty",
"(",
")",
";",
"}",
"AttrRequests",
"requests",
"=",
"cmParams",
".",
"getRequests",
"(",
")",
";",
"if",
"(",
"requests",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"int",
"maxRequests",
"=",
"requests",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"exchanges",
".",
"size",
"(",
")",
"<",
"maxRequests",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"exchanges",
".",
"size",
"(",
")",
"==",
"maxRequests",
"&&",
"(",
"isTermination",
"(",
"msg",
")",
"||",
"isPause",
"(",
"msg",
")",
")",
")",
"{",
"// One additional terminate or pause message is allowed",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Determines if the message specified is immediately sendable or if it
needs to block until the session state changes.
@param msg message to evaluate
@return {@code true} if the message can be immediately sent,
{@code false} otherwise | [
"Determines",
"if",
"the",
"message",
"specified",
"is",
"immediately",
"sendable",
"or",
"if",
"it",
"needs",
"to",
"block",
"until",
"the",
"session",
"state",
"changes",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L783-L805 |
142,558 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.blockUntilSendable | private void blockUntilSendable(final AbstractBody msg) {
assertLocked();
while (isWorking() && !isImmediatelySendable(msg)) {
try {
notFull.await();
} catch (InterruptedException intx) {
LOG.log(Level.FINEST, INTERRUPTED, intx);
}
}
} | java | private void blockUntilSendable(final AbstractBody msg) {
assertLocked();
while (isWorking() && !isImmediatelySendable(msg)) {
try {
notFull.await();
} catch (InterruptedException intx) {
LOG.log(Level.FINEST, INTERRUPTED, intx);
}
}
} | [
"private",
"void",
"blockUntilSendable",
"(",
"final",
"AbstractBody",
"msg",
")",
"{",
"assertLocked",
"(",
")",
";",
"while",
"(",
"isWorking",
"(",
")",
"&&",
"!",
"isImmediatelySendable",
"(",
"msg",
")",
")",
"{",
"try",
"{",
"notFull",
".",
"await",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"intx",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"INTERRUPTED",
",",
"intx",
")",
";",
"}",
"}",
"}"
] | Blocks until either the message provided becomes immediately
sendable or until the session is terminated.
@param msg message to evaluate | [
"Blocks",
"until",
"either",
"the",
"message",
"provided",
"becomes",
"immediately",
"sendable",
"or",
"until",
"the",
"session",
"is",
"terminated",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L824-L834 |
142,559 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.applySessionCreationRequest | private ComposableBody applySessionCreationRequest(
final long rid, final ComposableBody orig) throws BOSHException {
assertLocked();
Builder builder = orig.rebuild();
builder.setAttribute(Attributes.TO, cfg.getTo());
builder.setAttribute(Attributes.XML_LANG, cfg.getLang());
builder.setAttribute(Attributes.VER,
AttrVersion.getSupportedVersion().toString());
// NOTE: when WAIT is set to 60, HOLD is set to 1 and the CM replies
// with REQ = 1 then the connection can end up stuck up to 60 seconds
// if empty request is sent and there is no incoming traffic during that
// time.
builder.setAttribute(Attributes.WAIT, "60");
builder.setAttribute(Attributes.HOLD, "1");
builder.setAttribute(Attributes.RID, Long.toString(rid));
applyRoute(builder);
applyFrom(builder);
// NOTE: Using only one thread and waiting for the acknowledgment slows
// the connection down because it postpones sending every packet until
// previous ack is received.
if (cfg.isAckEnabled() ) {
builder.setAttribute(Attributes.ACK, "1");
}
// Make sure the following are NOT present (i.e., during retries)
builder.setAttribute(Attributes.SID, null);
return builder.build();
} | java | private ComposableBody applySessionCreationRequest(
final long rid, final ComposableBody orig) throws BOSHException {
assertLocked();
Builder builder = orig.rebuild();
builder.setAttribute(Attributes.TO, cfg.getTo());
builder.setAttribute(Attributes.XML_LANG, cfg.getLang());
builder.setAttribute(Attributes.VER,
AttrVersion.getSupportedVersion().toString());
// NOTE: when WAIT is set to 60, HOLD is set to 1 and the CM replies
// with REQ = 1 then the connection can end up stuck up to 60 seconds
// if empty request is sent and there is no incoming traffic during that
// time.
builder.setAttribute(Attributes.WAIT, "60");
builder.setAttribute(Attributes.HOLD, "1");
builder.setAttribute(Attributes.RID, Long.toString(rid));
applyRoute(builder);
applyFrom(builder);
// NOTE: Using only one thread and waiting for the acknowledgment slows
// the connection down because it postpones sending every packet until
// previous ack is received.
if (cfg.isAckEnabled() ) {
builder.setAttribute(Attributes.ACK, "1");
}
// Make sure the following are NOT present (i.e., during retries)
builder.setAttribute(Attributes.SID, null);
return builder.build();
} | [
"private",
"ComposableBody",
"applySessionCreationRequest",
"(",
"final",
"long",
"rid",
",",
"final",
"ComposableBody",
"orig",
")",
"throws",
"BOSHException",
"{",
"assertLocked",
"(",
")",
";",
"Builder",
"builder",
"=",
"orig",
".",
"rebuild",
"(",
")",
";",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"TO",
",",
"cfg",
".",
"getTo",
"(",
")",
")",
";",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"XML_LANG",
",",
"cfg",
".",
"getLang",
"(",
")",
")",
";",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"VER",
",",
"AttrVersion",
".",
"getSupportedVersion",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"// NOTE: when WAIT is set to 60, HOLD is set to 1 and the CM replies",
"// with REQ = 1 then the connection can end up stuck up to 60 seconds",
"// if empty request is sent and there is no incoming traffic during that",
"// time.",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"WAIT",
",",
"\"60\"",
")",
";",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"HOLD",
",",
"\"1\"",
")",
";",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"RID",
",",
"Long",
".",
"toString",
"(",
"rid",
")",
")",
";",
"applyRoute",
"(",
"builder",
")",
";",
"applyFrom",
"(",
"builder",
")",
";",
"// NOTE: Using only one thread and waiting for the acknowledgment slows",
"// the connection down because it postpones sending every packet until",
"// previous ack is received.",
"if",
"(",
"cfg",
".",
"isAckEnabled",
"(",
")",
")",
"{",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"ACK",
",",
"\"1\"",
")",
";",
"}",
"// Make sure the following are NOT present (i.e., during retries)",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"SID",
",",
"null",
")",
";",
"return",
"builder",
".",
"build",
"(",
")",
";",
"}"
] | Modifies the specified body message such that it becomes a new
BOSH session creation request.
@param rid request ID to use
@param orig original body to modify
@return modified message which acts as a session creation request | [
"Modifies",
"the",
"specified",
"body",
"message",
"such",
"that",
"it",
"becomes",
"a",
"new",
"BOSH",
"session",
"creation",
"request",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L844-L872 |
142,560 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.applyRoute | private void applyRoute(final Builder builder) {
assertLocked();
String route = cfg.getRoute();
if (route != null) {
builder.setAttribute(Attributes.ROUTE, route);
}
} | java | private void applyRoute(final Builder builder) {
assertLocked();
String route = cfg.getRoute();
if (route != null) {
builder.setAttribute(Attributes.ROUTE, route);
}
} | [
"private",
"void",
"applyRoute",
"(",
"final",
"Builder",
"builder",
")",
"{",
"assertLocked",
"(",
")",
";",
"String",
"route",
"=",
"cfg",
".",
"getRoute",
"(",
")",
";",
"if",
"(",
"route",
"!=",
"null",
")",
"{",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"ROUTE",
",",
"route",
")",
";",
"}",
"}"
] | Applies routing information to the request message who's builder has
been provided.
@param builder builder instance to add routing information to | [
"Applies",
"routing",
"information",
"to",
"the",
"request",
"message",
"who",
"s",
"builder",
"has",
"been",
"provided",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L880-L887 |
142,561 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.applyFrom | private void applyFrom(final Builder builder) {
assertLocked();
String from = cfg.getFrom();
if (from != null) {
builder.setAttribute(Attributes.FROM, from);
}
} | java | private void applyFrom(final Builder builder) {
assertLocked();
String from = cfg.getFrom();
if (from != null) {
builder.setAttribute(Attributes.FROM, from);
}
} | [
"private",
"void",
"applyFrom",
"(",
"final",
"Builder",
"builder",
")",
"{",
"assertLocked",
"(",
")",
";",
"String",
"from",
"=",
"cfg",
".",
"getFrom",
"(",
")",
";",
"if",
"(",
"from",
"!=",
"null",
")",
"{",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"FROM",
",",
"from",
")",
";",
"}",
"}"
] | Applies the local station ID information to the request message who's
builder has been provided.
@param builder builder instance to add station ID information to | [
"Applies",
"the",
"local",
"station",
"ID",
"information",
"to",
"the",
"request",
"message",
"who",
"s",
"builder",
"has",
"been",
"provided",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L895-L902 |
142,562 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.applySessionData | private ComposableBody applySessionData(
final long rid,
final ComposableBody orig) throws BOSHException {
assertLocked();
Builder builder = orig.rebuild();
builder.setAttribute(Attributes.SID,
cmParams.getSessionID().toString());
builder.setAttribute(Attributes.RID, Long.toString(rid));
if(cfg.isAckEnabled()) {
applyResponseAcknowledgement(builder, rid);
}
return builder.build();
} | java | private ComposableBody applySessionData(
final long rid,
final ComposableBody orig) throws BOSHException {
assertLocked();
Builder builder = orig.rebuild();
builder.setAttribute(Attributes.SID,
cmParams.getSessionID().toString());
builder.setAttribute(Attributes.RID, Long.toString(rid));
if(cfg.isAckEnabled()) {
applyResponseAcknowledgement(builder, rid);
}
return builder.build();
} | [
"private",
"ComposableBody",
"applySessionData",
"(",
"final",
"long",
"rid",
",",
"final",
"ComposableBody",
"orig",
")",
"throws",
"BOSHException",
"{",
"assertLocked",
"(",
")",
";",
"Builder",
"builder",
"=",
"orig",
".",
"rebuild",
"(",
")",
";",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"SID",
",",
"cmParams",
".",
"getSessionID",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"RID",
",",
"Long",
".",
"toString",
"(",
"rid",
")",
")",
";",
"if",
"(",
"cfg",
".",
"isAckEnabled",
"(",
")",
")",
"{",
"applyResponseAcknowledgement",
"(",
"builder",
",",
"rid",
")",
";",
"}",
"return",
"builder",
".",
"build",
"(",
")",
";",
"}"
] | Applies existing session data to the outbound request, returning the
modified request.
This method assumes the lock is currently held.
@param rid request ID to use
@param orig original/raw request
@return modified request with session information applied | [
"Applies",
"existing",
"session",
"data",
"to",
"the",
"outbound",
"request",
"returning",
"the",
"modified",
"request",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L914-L928 |
142,563 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.applyResponseAcknowledgement | private void applyResponseAcknowledgement(
final Builder builder,
final long rid) {
assertLocked();
if (responseAck.equals(Long.valueOf(-1L))) {
// We have not received any responses yet
return;
}
Long prevRID = Long.valueOf(rid - 1L);
if (responseAck.equals(prevRID)) {
// Implicit ack
return;
}
builder.setAttribute(Attributes.ACK, responseAck.toString());
} | java | private void applyResponseAcknowledgement(
final Builder builder,
final long rid) {
assertLocked();
if (responseAck.equals(Long.valueOf(-1L))) {
// We have not received any responses yet
return;
}
Long prevRID = Long.valueOf(rid - 1L);
if (responseAck.equals(prevRID)) {
// Implicit ack
return;
}
builder.setAttribute(Attributes.ACK, responseAck.toString());
} | [
"private",
"void",
"applyResponseAcknowledgement",
"(",
"final",
"Builder",
"builder",
",",
"final",
"long",
"rid",
")",
"{",
"assertLocked",
"(",
")",
";",
"if",
"(",
"responseAck",
".",
"equals",
"(",
"Long",
".",
"valueOf",
"(",
"-",
"1L",
")",
")",
")",
"{",
"// We have not received any responses yet",
"return",
";",
"}",
"Long",
"prevRID",
"=",
"Long",
".",
"valueOf",
"(",
"rid",
"-",
"1L",
")",
";",
"if",
"(",
"responseAck",
".",
"equals",
"(",
"prevRID",
")",
")",
"{",
"// Implicit ack",
"return",
";",
"}",
"builder",
".",
"setAttribute",
"(",
"Attributes",
".",
"ACK",
",",
"responseAck",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Sets the 'ack' attribute of the request to the value of the highest
'rid' of a request for which it has already received a response in the
case where it has also received all responses associated with lower
'rid' values. The only exception is that, after its session creation
request, the client SHOULD NOT include an 'ack' attribute in any request
if it has received responses to all its previous requests.
@param builder message builder
@param rid current request RID | [
"Sets",
"the",
"ack",
"attribute",
"of",
"the",
"request",
"to",
"the",
"value",
"of",
"the",
"highest",
"rid",
"of",
"a",
"request",
"for",
"which",
"it",
"has",
"already",
"received",
"a",
"response",
"in",
"the",
"case",
"where",
"it",
"has",
"also",
"received",
"all",
"responses",
"associated",
"with",
"lower",
"rid",
"values",
".",
"The",
"only",
"exception",
"is",
"that",
"after",
"its",
"session",
"creation",
"request",
"the",
"client",
"SHOULD",
"NOT",
"include",
"an",
"ack",
"attribute",
"in",
"any",
"request",
"if",
"it",
"has",
"received",
"responses",
"to",
"all",
"its",
"previous",
"requests",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L941-L958 |
142,564 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.processMessages | private void processMessages(int idx) {
LOG.finest("Processing thread " + idx + " starting...");
try {
HTTPExchange exch;
do {
exch = nextExchange(idx);
if (exch == null) {
break;
}
// Test hook to manipulate what the client sees:
ExchangeInterceptor interceptor = exchInterceptor.get();
if (interceptor != null) {
HTTPExchange newExch = interceptor.interceptExchange(exch);
if (newExch == null) {
LOG.log(Level.FINE, "Discarding exchange on request "
+ "of test hook: RID="
+ exch.getRequest().getAttribute(
Attributes.RID));
lock.lock();
try {
exchanges.remove(exch);
} finally {
lock.unlock();
}
continue;
}
exch = newExch;
}
processExchange(idx, exch);
} while (true);
} finally {
LOG.log(Level.FINEST, "Processing thread exiting: " + idx);
}
} | java | private void processMessages(int idx) {
LOG.finest("Processing thread " + idx + " starting...");
try {
HTTPExchange exch;
do {
exch = nextExchange(idx);
if (exch == null) {
break;
}
// Test hook to manipulate what the client sees:
ExchangeInterceptor interceptor = exchInterceptor.get();
if (interceptor != null) {
HTTPExchange newExch = interceptor.interceptExchange(exch);
if (newExch == null) {
LOG.log(Level.FINE, "Discarding exchange on request "
+ "of test hook: RID="
+ exch.getRequest().getAttribute(
Attributes.RID));
lock.lock();
try {
exchanges.remove(exch);
} finally {
lock.unlock();
}
continue;
}
exch = newExch;
}
processExchange(idx, exch);
} while (true);
} finally {
LOG.log(Level.FINEST, "Processing thread exiting: " + idx);
}
} | [
"private",
"void",
"processMessages",
"(",
"int",
"idx",
")",
"{",
"LOG",
".",
"finest",
"(",
"\"Processing thread \"",
"+",
"idx",
"+",
"\" starting...\"",
")",
";",
"try",
"{",
"HTTPExchange",
"exch",
";",
"do",
"{",
"exch",
"=",
"nextExchange",
"(",
"idx",
")",
";",
"if",
"(",
"exch",
"==",
"null",
")",
"{",
"break",
";",
"}",
"// Test hook to manipulate what the client sees:",
"ExchangeInterceptor",
"interceptor",
"=",
"exchInterceptor",
".",
"get",
"(",
")",
";",
"if",
"(",
"interceptor",
"!=",
"null",
")",
"{",
"HTTPExchange",
"newExch",
"=",
"interceptor",
".",
"interceptExchange",
"(",
"exch",
")",
";",
"if",
"(",
"newExch",
"==",
"null",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Discarding exchange on request \"",
"+",
"\"of test hook: RID=\"",
"+",
"exch",
".",
"getRequest",
"(",
")",
".",
"getAttribute",
"(",
"Attributes",
".",
"RID",
")",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"exchanges",
".",
"remove",
"(",
"exch",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"continue",
";",
"}",
"exch",
"=",
"newExch",
";",
"}",
"processExchange",
"(",
"idx",
",",
"exch",
")",
";",
"}",
"while",
"(",
"true",
")",
";",
"}",
"finally",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Processing thread exiting: \"",
"+",
"idx",
")",
";",
"}",
"}"
] | While we are "connected", process received responses.
This method is run in the processing thread.
@param idx the {@link #procThreads} index of the "RequestProcessor"
for which this method is executed. | [
"While",
"we",
"are",
"connected",
"process",
"received",
"responses",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L968-L1004 |
142,565 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.nextExchange | private HTTPExchange nextExchange(int idx) {
assertUnlocked();
final Thread thread = Thread.currentThread();
HTTPExchange exch = null;
lock.lock();
try {
do {
if (procThreads == null
|| !thread.equals(procThreads[idx].procThread)) {
break;
}
exch = claimExchange(idx);
if (exch == null) {
try {
notEmpty.await();
} catch (InterruptedException intx) {
LOG.log(Level.FINEST, INTERRUPTED, intx);
}
}
} while (exch == null);
} finally {
lock.unlock();
}
return exch;
} | java | private HTTPExchange nextExchange(int idx) {
assertUnlocked();
final Thread thread = Thread.currentThread();
HTTPExchange exch = null;
lock.lock();
try {
do {
if (procThreads == null
|| !thread.equals(procThreads[idx].procThread)) {
break;
}
exch = claimExchange(idx);
if (exch == null) {
try {
notEmpty.await();
} catch (InterruptedException intx) {
LOG.log(Level.FINEST, INTERRUPTED, intx);
}
}
} while (exch == null);
} finally {
lock.unlock();
}
return exch;
} | [
"private",
"HTTPExchange",
"nextExchange",
"(",
"int",
"idx",
")",
"{",
"assertUnlocked",
"(",
")",
";",
"final",
"Thread",
"thread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"HTTPExchange",
"exch",
"=",
"null",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"do",
"{",
"if",
"(",
"procThreads",
"==",
"null",
"||",
"!",
"thread",
".",
"equals",
"(",
"procThreads",
"[",
"idx",
"]",
".",
"procThread",
")",
")",
"{",
"break",
";",
"}",
"exch",
"=",
"claimExchange",
"(",
"idx",
")",
";",
"if",
"(",
"exch",
"==",
"null",
")",
"{",
"try",
"{",
"notEmpty",
".",
"await",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"intx",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"INTERRUPTED",
",",
"intx",
")",
";",
"}",
"}",
"}",
"while",
"(",
"exch",
"==",
"null",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"return",
"exch",
";",
"}"
] | Get the next message exchange to process, blocking until one becomes
available if nothing is already waiting for processing.
@param idx the {@link #procThreads} index of the "RequestProcessor"
for which this method is executed.
@return next available exchange to process, or {@code null} if no
exchanges are immediately available | [
"Get",
"the",
"next",
"message",
"exchange",
"to",
"process",
"blocking",
"until",
"one",
"becomes",
"available",
"if",
"nothing",
"is",
"already",
"waiting",
"for",
"processing",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1016-L1041 |
142,566 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.claimExchange | private HTTPExchange claimExchange(int idx) {
assertLocked();
HTTPExchange exch = null;
// Claim the exchange
for (HTTPExchange toClaim : exchanges) {
if (findProcessorForExchange(toClaim) == null) {
exch = toClaim;
break;
}
}
if (exch != null) {
procThreads[idx].procExchange = exch;
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest(
"Thread " + idx + " claimed: "
+ exch.getRequest().getAttribute(Attributes.RID));
}
} else {
if (LOG.isLoggable(Level.FINEST))
LOG.finest("Thread " + idx + " will wait for new request...");
}
return exch;
} | java | private HTTPExchange claimExchange(int idx) {
assertLocked();
HTTPExchange exch = null;
// Claim the exchange
for (HTTPExchange toClaim : exchanges) {
if (findProcessorForExchange(toClaim) == null) {
exch = toClaim;
break;
}
}
if (exch != null) {
procThreads[idx].procExchange = exch;
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest(
"Thread " + idx + " claimed: "
+ exch.getRequest().getAttribute(Attributes.RID));
}
} else {
if (LOG.isLoggable(Level.FINEST))
LOG.finest("Thread " + idx + " will wait for new request...");
}
return exch;
} | [
"private",
"HTTPExchange",
"claimExchange",
"(",
"int",
"idx",
")",
"{",
"assertLocked",
"(",
")",
";",
"HTTPExchange",
"exch",
"=",
"null",
";",
"// Claim the exchange",
"for",
"(",
"HTTPExchange",
"toClaim",
":",
"exchanges",
")",
"{",
"if",
"(",
"findProcessorForExchange",
"(",
"toClaim",
")",
"==",
"null",
")",
"{",
"exch",
"=",
"toClaim",
";",
"break",
";",
"}",
"}",
"if",
"(",
"exch",
"!=",
"null",
")",
"{",
"procThreads",
"[",
"idx",
"]",
".",
"procExchange",
"=",
"exch",
";",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"LOG",
".",
"finest",
"(",
"\"Thread \"",
"+",
"idx",
"+",
"\" claimed: \"",
"+",
"exch",
".",
"getRequest",
"(",
")",
".",
"getAttribute",
"(",
"Attributes",
".",
"RID",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"LOG",
".",
"finest",
"(",
"\"Thread \"",
"+",
"idx",
"+",
"\" will wait for new request...\"",
")",
";",
"}",
"return",
"exch",
";",
"}"
] | Finds and claims the exchange that has not been taken by other request
processor.
@param idx the {@link #procThreads} index of the "RequestProcessor"
for which this method is executed.
@return <tt>HTTPExchange</tt> claimed for
the <tt>{@link RequestProcessor}</tt> or <tt>null</tt> if there are no
unclaimed exchanges available at this time. | [
"Finds",
"and",
"claims",
"the",
"exchange",
"that",
"has",
"not",
"been",
"taken",
"by",
"other",
"request",
"processor",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1054-L1080 |
142,567 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.adjustRequestProcessorsPool | private void adjustRequestProcessorsPool()
{
assertLocked();
AttrRequests attrRequests = cmParams.getRequests();
int requests
= attrRequests != null
? attrRequests.intValue() : 2;
// NOTE In polling mode with default WAIT=60 connection
// will be unresponsive
if (requests <= 1 && "1".equals(String.valueOf(cmParams.getHold()))) {
LOG.warning(
"CM supports only 1 requests at a time and there is"
+ " a risk of connection being stuck up to "
+ cmParams.getWait() + "seconds");
}
// Expand request processors pool
if (requests > procThreads.length) {
RequestProcessor[] oldProcessors = procThreads;
procThreads = new RequestProcessor[requests];
System.arraycopy(
oldProcessors, 0, procThreads, 0, oldProcessors.length);
for (int i = oldProcessors.length; i < requests; i++) {
procThreads[i] = new RequestProcessor(i);
procThreads[i].start();
}
}
} | java | private void adjustRequestProcessorsPool()
{
assertLocked();
AttrRequests attrRequests = cmParams.getRequests();
int requests
= attrRequests != null
? attrRequests.intValue() : 2;
// NOTE In polling mode with default WAIT=60 connection
// will be unresponsive
if (requests <= 1 && "1".equals(String.valueOf(cmParams.getHold()))) {
LOG.warning(
"CM supports only 1 requests at a time and there is"
+ " a risk of connection being stuck up to "
+ cmParams.getWait() + "seconds");
}
// Expand request processors pool
if (requests > procThreads.length) {
RequestProcessor[] oldProcessors = procThreads;
procThreads = new RequestProcessor[requests];
System.arraycopy(
oldProcessors, 0, procThreads, 0, oldProcessors.length);
for (int i = oldProcessors.length; i < requests; i++) {
procThreads[i] = new RequestProcessor(i);
procThreads[i].start();
}
}
} | [
"private",
"void",
"adjustRequestProcessorsPool",
"(",
")",
"{",
"assertLocked",
"(",
")",
";",
"AttrRequests",
"attrRequests",
"=",
"cmParams",
".",
"getRequests",
"(",
")",
";",
"int",
"requests",
"=",
"attrRequests",
"!=",
"null",
"?",
"attrRequests",
".",
"intValue",
"(",
")",
":",
"2",
";",
"// NOTE In polling mode with default WAIT=60 connection",
"// will be unresponsive",
"if",
"(",
"requests",
"<=",
"1",
"&&",
"\"1\"",
".",
"equals",
"(",
"String",
".",
"valueOf",
"(",
"cmParams",
".",
"getHold",
"(",
")",
")",
")",
")",
"{",
"LOG",
".",
"warning",
"(",
"\"CM supports only 1 requests at a time and there is\"",
"+",
"\" a risk of connection being stuck up to \"",
"+",
"cmParams",
".",
"getWait",
"(",
")",
"+",
"\"seconds\"",
")",
";",
"}",
"// Expand request processors pool",
"if",
"(",
"requests",
">",
"procThreads",
".",
"length",
")",
"{",
"RequestProcessor",
"[",
"]",
"oldProcessors",
"=",
"procThreads",
";",
"procThreads",
"=",
"new",
"RequestProcessor",
"[",
"requests",
"]",
";",
"System",
".",
"arraycopy",
"(",
"oldProcessors",
",",
"0",
",",
"procThreads",
",",
"0",
",",
"oldProcessors",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"oldProcessors",
".",
"length",
";",
"i",
"<",
"requests",
";",
"i",
"++",
")",
"{",
"procThreads",
"[",
"i",
"]",
"=",
"new",
"RequestProcessor",
"(",
"i",
")",
";",
"procThreads",
"[",
"i",
"]",
".",
"start",
"(",
")",
";",
"}",
"}",
"}"
] | Checks the value of REQ attribute received from the CM and adjusts
the size of the request processors pool. | [
"Checks",
"the",
"value",
"of",
"REQ",
"attribute",
"received",
"from",
"the",
"CM",
"and",
"adjusts",
"the",
"size",
"of",
"the",
"request",
"processors",
"pool",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1236-L1269 |
142,568 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.scheduleEmptyRequest | private void scheduleEmptyRequest(long delay) {
assertLocked();
if (delay < 0L) {
throw(new IllegalArgumentException(
"Empty request delay must be >= 0 (was: " + delay + ")"));
}
clearEmptyRequest();
if (!isWorking()) {
return;
}
// Schedule the transmission
if (LOG.isLoggable(Level.FINER)) {
LOG.finer("Scheduling empty request in " + delay + "ms");
}
try {
emptyRequestFuture = schedExec.schedule(emptyRequestRunnable,
delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException rex) {
LOG.log(Level.FINEST, "Could not schedule empty request", rex);
}
drained.signalAll();
} | java | private void scheduleEmptyRequest(long delay) {
assertLocked();
if (delay < 0L) {
throw(new IllegalArgumentException(
"Empty request delay must be >= 0 (was: " + delay + ")"));
}
clearEmptyRequest();
if (!isWorking()) {
return;
}
// Schedule the transmission
if (LOG.isLoggable(Level.FINER)) {
LOG.finer("Scheduling empty request in " + delay + "ms");
}
try {
emptyRequestFuture = schedExec.schedule(emptyRequestRunnable,
delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException rex) {
LOG.log(Level.FINEST, "Could not schedule empty request", rex);
}
drained.signalAll();
} | [
"private",
"void",
"scheduleEmptyRequest",
"(",
"long",
"delay",
")",
"{",
"assertLocked",
"(",
")",
";",
"if",
"(",
"delay",
"<",
"0L",
")",
"{",
"throw",
"(",
"new",
"IllegalArgumentException",
"(",
"\"Empty request delay must be >= 0 (was: \"",
"+",
"delay",
"+",
"\")\"",
")",
")",
";",
"}",
"clearEmptyRequest",
"(",
")",
";",
"if",
"(",
"!",
"isWorking",
"(",
")",
")",
"{",
"return",
";",
"}",
"// Schedule the transmission",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
")",
"{",
"LOG",
".",
"finer",
"(",
"\"Scheduling empty request in \"",
"+",
"delay",
"+",
"\"ms\"",
")",
";",
"}",
"try",
"{",
"emptyRequestFuture",
"=",
"schedExec",
".",
"schedule",
"(",
"emptyRequestRunnable",
",",
"delay",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}",
"catch",
"(",
"RejectedExecutionException",
"rex",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Could not schedule empty request\"",
",",
"rex",
")",
";",
"}",
"drained",
".",
"signalAll",
"(",
")",
";",
"}"
] | Schedule an empty request to be sent if no other requests are
sent in a reasonable amount of time. | [
"Schedule",
"an",
"empty",
"request",
"to",
"be",
"sent",
"if",
"no",
"other",
"requests",
"are",
"sent",
"in",
"a",
"reasonable",
"amount",
"of",
"time",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1310-L1333 |
142,569 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.sendEmptyRequest | private void sendEmptyRequest() {
assertUnlocked();
// Send an empty request
LOG.finest("Sending empty request");
try {
send(ComposableBody.builder().build());
} catch (BOSHException boshx) {
dispose(boshx);
}
} | java | private void sendEmptyRequest() {
assertUnlocked();
// Send an empty request
LOG.finest("Sending empty request");
try {
send(ComposableBody.builder().build());
} catch (BOSHException boshx) {
dispose(boshx);
}
} | [
"private",
"void",
"sendEmptyRequest",
"(",
")",
"{",
"assertUnlocked",
"(",
")",
";",
"// Send an empty request",
"LOG",
".",
"finest",
"(",
"\"Sending empty request\"",
")",
";",
"try",
"{",
"send",
"(",
"ComposableBody",
".",
"builder",
"(",
")",
".",
"build",
"(",
")",
")",
";",
"}",
"catch",
"(",
"BOSHException",
"boshx",
")",
"{",
"dispose",
"(",
"boshx",
")",
";",
"}",
"}"
] | Sends an empty request to maintain session requirements. If a request
is sent within a reasonable time window, the empty request transmission
will be cancelled. | [
"Sends",
"an",
"empty",
"request",
"to",
"maintain",
"session",
"requirements",
".",
"If",
"a",
"request",
"is",
"sent",
"within",
"a",
"reasonable",
"time",
"window",
"the",
"empty",
"request",
"transmission",
"will",
"be",
"cancelled",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1340-L1349 |
142,570 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.processPauseRequest | private long processPauseRequest(
final AbstractBody req) {
assertLocked();
if (cmParams != null && cmParams.getMaxPause() != null) {
try {
AttrPause pause = AttrPause.createFromString(
req.getAttribute(Attributes.PAUSE));
if (pause != null) {
long delay = pause.getInMilliseconds() - PAUSE_MARGIN;
if (delay < 0) {
delay = EMPTY_REQUEST_DELAY;
}
return delay;
}
} catch (BOSHException boshx) {
LOG.log(Level.FINEST, "Could not extract", boshx);
}
}
return getDefaultEmptyRequestDelay();
} | java | private long processPauseRequest(
final AbstractBody req) {
assertLocked();
if (cmParams != null && cmParams.getMaxPause() != null) {
try {
AttrPause pause = AttrPause.createFromString(
req.getAttribute(Attributes.PAUSE));
if (pause != null) {
long delay = pause.getInMilliseconds() - PAUSE_MARGIN;
if (delay < 0) {
delay = EMPTY_REQUEST_DELAY;
}
return delay;
}
} catch (BOSHException boshx) {
LOG.log(Level.FINEST, "Could not extract", boshx);
}
}
return getDefaultEmptyRequestDelay();
} | [
"private",
"long",
"processPauseRequest",
"(",
"final",
"AbstractBody",
"req",
")",
"{",
"assertLocked",
"(",
")",
";",
"if",
"(",
"cmParams",
"!=",
"null",
"&&",
"cmParams",
".",
"getMaxPause",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"AttrPause",
"pause",
"=",
"AttrPause",
".",
"createFromString",
"(",
"req",
".",
"getAttribute",
"(",
"Attributes",
".",
"PAUSE",
")",
")",
";",
"if",
"(",
"pause",
"!=",
"null",
")",
"{",
"long",
"delay",
"=",
"pause",
".",
"getInMilliseconds",
"(",
")",
"-",
"PAUSE_MARGIN",
";",
"if",
"(",
"delay",
"<",
"0",
")",
"{",
"delay",
"=",
"EMPTY_REQUEST_DELAY",
";",
"}",
"return",
"delay",
";",
"}",
"}",
"catch",
"(",
"BOSHException",
"boshx",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Could not extract\"",
",",
"boshx",
")",
";",
"}",
"}",
"return",
"getDefaultEmptyRequestDelay",
"(",
")",
";",
"}"
] | Process the request to determine if the empty request delay
can be determined by looking to see if the request is a pause
request. If it can, the request's delay is returned, otherwise
the default delay is returned.
@return delay in milliseconds that should elapse prior to an
empty message being sent | [
"Process",
"the",
"request",
"to",
"determine",
"if",
"the",
"empty",
"request",
"delay",
"can",
"be",
"determined",
"by",
"looking",
"to",
"see",
"if",
"the",
"request",
"is",
"a",
"pause",
"request",
".",
"If",
"it",
"can",
"the",
"request",
"s",
"delay",
"is",
"returned",
"otherwise",
"the",
"default",
"delay",
"is",
"returned",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1418-L1439 |
142,571 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.processRequestAcknowledgements | private void processRequestAcknowledgements(
final AbstractBody req, final AbstractBody resp) {
assertLocked();
if (!cmParams.isAckingRequests()) {
return;
}
// If a report or time attribute is set, we aren't acking anything
if (resp.getAttribute(Attributes.REPORT) != null) {
return;
}
// Figure out what the highest acked RID is
String acked = resp.getAttribute(Attributes.ACK);
Long ackUpTo;
if (acked == null) {
// Implicit ack of all prior requests up until RID
ackUpTo = Long.parseLong(req.getAttribute(Attributes.RID));
} else {
ackUpTo = Long.parseLong(acked);
}
// Remove the acked requests from the list
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Removing pending acks up to: " + ackUpTo);
}
Iterator<ComposableBody> iter = pendingRequestAcks.iterator();
while (iter.hasNext()) {
AbstractBody pending = iter.next();
Long pendingRID = Long.parseLong(
pending.getAttribute(Attributes.RID));
if (pendingRID.compareTo(ackUpTo) <= 0) {
iter.remove();
}
}
} | java | private void processRequestAcknowledgements(
final AbstractBody req, final AbstractBody resp) {
assertLocked();
if (!cmParams.isAckingRequests()) {
return;
}
// If a report or time attribute is set, we aren't acking anything
if (resp.getAttribute(Attributes.REPORT) != null) {
return;
}
// Figure out what the highest acked RID is
String acked = resp.getAttribute(Attributes.ACK);
Long ackUpTo;
if (acked == null) {
// Implicit ack of all prior requests up until RID
ackUpTo = Long.parseLong(req.getAttribute(Attributes.RID));
} else {
ackUpTo = Long.parseLong(acked);
}
// Remove the acked requests from the list
if (LOG.isLoggable(Level.FINEST)) {
LOG.finest("Removing pending acks up to: " + ackUpTo);
}
Iterator<ComposableBody> iter = pendingRequestAcks.iterator();
while (iter.hasNext()) {
AbstractBody pending = iter.next();
Long pendingRID = Long.parseLong(
pending.getAttribute(Attributes.RID));
if (pendingRID.compareTo(ackUpTo) <= 0) {
iter.remove();
}
}
} | [
"private",
"void",
"processRequestAcknowledgements",
"(",
"final",
"AbstractBody",
"req",
",",
"final",
"AbstractBody",
"resp",
")",
"{",
"assertLocked",
"(",
")",
";",
"if",
"(",
"!",
"cmParams",
".",
"isAckingRequests",
"(",
")",
")",
"{",
"return",
";",
"}",
"// If a report or time attribute is set, we aren't acking anything",
"if",
"(",
"resp",
".",
"getAttribute",
"(",
"Attributes",
".",
"REPORT",
")",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"// Figure out what the highest acked RID is",
"String",
"acked",
"=",
"resp",
".",
"getAttribute",
"(",
"Attributes",
".",
"ACK",
")",
";",
"Long",
"ackUpTo",
";",
"if",
"(",
"acked",
"==",
"null",
")",
"{",
"// Implicit ack of all prior requests up until RID",
"ackUpTo",
"=",
"Long",
".",
"parseLong",
"(",
"req",
".",
"getAttribute",
"(",
"Attributes",
".",
"RID",
")",
")",
";",
"}",
"else",
"{",
"ackUpTo",
"=",
"Long",
".",
"parseLong",
"(",
"acked",
")",
";",
"}",
"// Remove the acked requests from the list",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"LOG",
".",
"finest",
"(",
"\"Removing pending acks up to: \"",
"+",
"ackUpTo",
")",
";",
"}",
"Iterator",
"<",
"ComposableBody",
">",
"iter",
"=",
"pendingRequestAcks",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"AbstractBody",
"pending",
"=",
"iter",
".",
"next",
"(",
")",
";",
"Long",
"pendingRID",
"=",
"Long",
".",
"parseLong",
"(",
"pending",
".",
"getAttribute",
"(",
"Attributes",
".",
"RID",
")",
")",
";",
"if",
"(",
"pendingRID",
".",
"compareTo",
"(",
"ackUpTo",
")",
"<=",
"0",
")",
"{",
"iter",
".",
"remove",
"(",
")",
";",
"}",
"}",
"}"
] | Check the response for request acknowledgements and take appropriate
action.
This method assumes the lock is currently held.
@param req request
@param resp response | [
"Check",
"the",
"response",
"for",
"request",
"acknowledgements",
"and",
"take",
"appropriate",
"action",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1450-L1486 |
142,572 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.processResponseAcknowledgementData | private void processResponseAcknowledgementData(
final AbstractBody req) {
assertLocked();
Long rid = Long.parseLong(req.getAttribute(Attributes.RID));
if (responseAck.equals(Long.valueOf(-1L))) {
// This is the first request
responseAck = rid;
} else {
pendingResponseAcks.add(rid);
// Remove up until the first missing response (or end of queue)
Long whileVal = Long.valueOf(responseAck.longValue() + 1);
while (!pendingResponseAcks.isEmpty()
&& whileVal.equals(pendingResponseAcks.first())) {
responseAck = whileVal;
pendingResponseAcks.remove(whileVal);
whileVal = Long.valueOf(whileVal.longValue() + 1);
}
}
} | java | private void processResponseAcknowledgementData(
final AbstractBody req) {
assertLocked();
Long rid = Long.parseLong(req.getAttribute(Attributes.RID));
if (responseAck.equals(Long.valueOf(-1L))) {
// This is the first request
responseAck = rid;
} else {
pendingResponseAcks.add(rid);
// Remove up until the first missing response (or end of queue)
Long whileVal = Long.valueOf(responseAck.longValue() + 1);
while (!pendingResponseAcks.isEmpty()
&& whileVal.equals(pendingResponseAcks.first())) {
responseAck = whileVal;
pendingResponseAcks.remove(whileVal);
whileVal = Long.valueOf(whileVal.longValue() + 1);
}
}
} | [
"private",
"void",
"processResponseAcknowledgementData",
"(",
"final",
"AbstractBody",
"req",
")",
"{",
"assertLocked",
"(",
")",
";",
"Long",
"rid",
"=",
"Long",
".",
"parseLong",
"(",
"req",
".",
"getAttribute",
"(",
"Attributes",
".",
"RID",
")",
")",
";",
"if",
"(",
"responseAck",
".",
"equals",
"(",
"Long",
".",
"valueOf",
"(",
"-",
"1L",
")",
")",
")",
"{",
"// This is the first request",
"responseAck",
"=",
"rid",
";",
"}",
"else",
"{",
"pendingResponseAcks",
".",
"add",
"(",
"rid",
")",
";",
"// Remove up until the first missing response (or end of queue)",
"Long",
"whileVal",
"=",
"Long",
".",
"valueOf",
"(",
"responseAck",
".",
"longValue",
"(",
")",
"+",
"1",
")",
";",
"while",
"(",
"!",
"pendingResponseAcks",
".",
"isEmpty",
"(",
")",
"&&",
"whileVal",
".",
"equals",
"(",
"pendingResponseAcks",
".",
"first",
"(",
")",
")",
")",
"{",
"responseAck",
"=",
"whileVal",
";",
"pendingResponseAcks",
".",
"remove",
"(",
"whileVal",
")",
";",
"whileVal",
"=",
"Long",
".",
"valueOf",
"(",
"whileVal",
".",
"longValue",
"(",
")",
"+",
"1",
")",
";",
"}",
"}",
"}"
] | Process the response in order to update the response acknowlegement
data.
This method assumes the lock is currently held.
@param req request | [
"Process",
"the",
"response",
"in",
"order",
"to",
"update",
"the",
"response",
"acknowlegement",
"data",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1496-L1515 |
142,573 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.processResponseAcknowledgementReport | private HTTPExchange processResponseAcknowledgementReport(
final AbstractBody resp)
throws BOSHException {
assertLocked();
String reportStr = resp.getAttribute(Attributes.REPORT);
if (reportStr == null) {
// No report on this message
return null;
}
Long report = Long.parseLong(reportStr);
Long time = Long.parseLong(resp.getAttribute(Attributes.TIME));
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Received report of missing request (RID="
+ report + ", time=" + time + "ms)");
}
// Find the missing request
Iterator<ComposableBody> iter = pendingRequestAcks.iterator();
AbstractBody req = null;
while (iter.hasNext() && req == null) {
AbstractBody pending = iter.next();
Long pendingRID = Long.parseLong(
pending.getAttribute(Attributes.RID));
if (report.equals(pendingRID)) {
req = pending;
}
}
if (req == null) {
throw(new BOSHException("Report of missing message with RID '"
+ reportStr
+ "' but local copy of that request was not found"));
}
// Resend the missing request
HTTPExchange exch = new HTTPExchange(req);
exchanges.add(exch);
notEmpty.signal();
return exch;
} | java | private HTTPExchange processResponseAcknowledgementReport(
final AbstractBody resp)
throws BOSHException {
assertLocked();
String reportStr = resp.getAttribute(Attributes.REPORT);
if (reportStr == null) {
// No report on this message
return null;
}
Long report = Long.parseLong(reportStr);
Long time = Long.parseLong(resp.getAttribute(Attributes.TIME));
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Received report of missing request (RID="
+ report + ", time=" + time + "ms)");
}
// Find the missing request
Iterator<ComposableBody> iter = pendingRequestAcks.iterator();
AbstractBody req = null;
while (iter.hasNext() && req == null) {
AbstractBody pending = iter.next();
Long pendingRID = Long.parseLong(
pending.getAttribute(Attributes.RID));
if (report.equals(pendingRID)) {
req = pending;
}
}
if (req == null) {
throw(new BOSHException("Report of missing message with RID '"
+ reportStr
+ "' but local copy of that request was not found"));
}
// Resend the missing request
HTTPExchange exch = new HTTPExchange(req);
exchanges.add(exch);
notEmpty.signal();
return exch;
} | [
"private",
"HTTPExchange",
"processResponseAcknowledgementReport",
"(",
"final",
"AbstractBody",
"resp",
")",
"throws",
"BOSHException",
"{",
"assertLocked",
"(",
")",
";",
"String",
"reportStr",
"=",
"resp",
".",
"getAttribute",
"(",
"Attributes",
".",
"REPORT",
")",
";",
"if",
"(",
"reportStr",
"==",
"null",
")",
"{",
"// No report on this message",
"return",
"null",
";",
"}",
"Long",
"report",
"=",
"Long",
".",
"parseLong",
"(",
"reportStr",
")",
";",
"Long",
"time",
"=",
"Long",
".",
"parseLong",
"(",
"resp",
".",
"getAttribute",
"(",
"Attributes",
".",
"TIME",
")",
")",
";",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LOG",
".",
"fine",
"(",
"\"Received report of missing request (RID=\"",
"+",
"report",
"+",
"\", time=\"",
"+",
"time",
"+",
"\"ms)\"",
")",
";",
"}",
"// Find the missing request",
"Iterator",
"<",
"ComposableBody",
">",
"iter",
"=",
"pendingRequestAcks",
".",
"iterator",
"(",
")",
";",
"AbstractBody",
"req",
"=",
"null",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
"&&",
"req",
"==",
"null",
")",
"{",
"AbstractBody",
"pending",
"=",
"iter",
".",
"next",
"(",
")",
";",
"Long",
"pendingRID",
"=",
"Long",
".",
"parseLong",
"(",
"pending",
".",
"getAttribute",
"(",
"Attributes",
".",
"RID",
")",
")",
";",
"if",
"(",
"report",
".",
"equals",
"(",
"pendingRID",
")",
")",
"{",
"req",
"=",
"pending",
";",
"}",
"}",
"if",
"(",
"req",
"==",
"null",
")",
"{",
"throw",
"(",
"new",
"BOSHException",
"(",
"\"Report of missing message with RID '\"",
"+",
"reportStr",
"+",
"\"' but local copy of that request was not found\"",
")",
")",
";",
"}",
"// Resend the missing request",
"HTTPExchange",
"exch",
"=",
"new",
"HTTPExchange",
"(",
"req",
")",
";",
"exchanges",
".",
"add",
"(",
"exch",
")",
";",
"notEmpty",
".",
"signal",
"(",
")",
";",
"return",
"exch",
";",
"}"
] | Process the response in order to check for and respond to any potential
ack reports.
This method assumes the lock is currently held.
@param resp response
@return exchange to transmit if a resend is to be performed, or
{@code null} if no resend is necessary
@throws BOSHException when a a retry is needed but cannot be performed | [
"Process",
"the",
"response",
"in",
"order",
"to",
"check",
"for",
"and",
"respond",
"to",
"any",
"potential",
"ack",
"reports",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1528-L1569 |
142,574 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.fireRequestSent | private void fireRequestSent(final AbstractBody request) {
assertUnlocked();
BOSHMessageEvent event = null;
for (BOSHClientRequestListener listener : requestListeners) {
if (event == null) {
event = BOSHMessageEvent.createRequestSentEvent(this, request);
}
try {
listener.requestSent(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} | java | private void fireRequestSent(final AbstractBody request) {
assertUnlocked();
BOSHMessageEvent event = null;
for (BOSHClientRequestListener listener : requestListeners) {
if (event == null) {
event = BOSHMessageEvent.createRequestSentEvent(this, request);
}
try {
listener.requestSent(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} | [
"private",
"void",
"fireRequestSent",
"(",
"final",
"AbstractBody",
"request",
")",
"{",
"assertUnlocked",
"(",
")",
";",
"BOSHMessageEvent",
"event",
"=",
"null",
";",
"for",
"(",
"BOSHClientRequestListener",
"listener",
":",
"requestListeners",
")",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"event",
"=",
"BOSHMessageEvent",
".",
"createRequestSentEvent",
"(",
"this",
",",
"request",
")",
";",
"}",
"try",
"{",
"listener",
".",
"requestSent",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"UNHANDLED",
",",
"ex",
")",
";",
"}",
"}",
"}"
] | Notifies all request listeners that the specified request is being
sent.
@param request request being sent | [
"Notifies",
"all",
"request",
"listeners",
"that",
"the",
"specified",
"request",
"is",
"being",
"sent",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1577-L1591 |
142,575 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.fireResponseReceived | private void fireResponseReceived(final AbstractBody response) {
assertUnlocked();
BOSHMessageEvent event = null;
for (BOSHClientResponseListener listener : responseListeners) {
if (event == null) {
event = BOSHMessageEvent.createResponseReceivedEvent(
this, response);
}
try {
listener.responseReceived(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} | java | private void fireResponseReceived(final AbstractBody response) {
assertUnlocked();
BOSHMessageEvent event = null;
for (BOSHClientResponseListener listener : responseListeners) {
if (event == null) {
event = BOSHMessageEvent.createResponseReceivedEvent(
this, response);
}
try {
listener.responseReceived(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} | [
"private",
"void",
"fireResponseReceived",
"(",
"final",
"AbstractBody",
"response",
")",
"{",
"assertUnlocked",
"(",
")",
";",
"BOSHMessageEvent",
"event",
"=",
"null",
";",
"for",
"(",
"BOSHClientResponseListener",
"listener",
":",
"responseListeners",
")",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"event",
"=",
"BOSHMessageEvent",
".",
"createResponseReceivedEvent",
"(",
"this",
",",
"response",
")",
";",
"}",
"try",
"{",
"listener",
".",
"responseReceived",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"UNHANDLED",
",",
"ex",
")",
";",
"}",
"}",
"}"
] | Notifies all response listeners that the specified response has been
received.
@param response response received | [
"Notifies",
"all",
"response",
"listeners",
"that",
"the",
"specified",
"response",
"has",
"been",
"received",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1599-L1614 |
142,576 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.fireConnectionEstablished | private void fireConnectionEstablished() {
final boolean hadLock = lock.isHeldByCurrentThread();
if (hadLock) {
lock.unlock();
}
try {
BOSHClientConnEvent event = null;
for (BOSHClientConnListener listener : connListeners) {
if (event == null) {
event = BOSHClientConnEvent
.createConnectionEstablishedEvent(this);
}
try {
listener.connectionEvent(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} finally {
if (hadLock) {
lock.lock();
}
}
} | java | private void fireConnectionEstablished() {
final boolean hadLock = lock.isHeldByCurrentThread();
if (hadLock) {
lock.unlock();
}
try {
BOSHClientConnEvent event = null;
for (BOSHClientConnListener listener : connListeners) {
if (event == null) {
event = BOSHClientConnEvent
.createConnectionEstablishedEvent(this);
}
try {
listener.connectionEvent(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} finally {
if (hadLock) {
lock.lock();
}
}
} | [
"private",
"void",
"fireConnectionEstablished",
"(",
")",
"{",
"final",
"boolean",
"hadLock",
"=",
"lock",
".",
"isHeldByCurrentThread",
"(",
")",
";",
"if",
"(",
"hadLock",
")",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"try",
"{",
"BOSHClientConnEvent",
"event",
"=",
"null",
";",
"for",
"(",
"BOSHClientConnListener",
"listener",
":",
"connListeners",
")",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"event",
"=",
"BOSHClientConnEvent",
".",
"createConnectionEstablishedEvent",
"(",
"this",
")",
";",
"}",
"try",
"{",
"listener",
".",
"connectionEvent",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"UNHANDLED",
",",
"ex",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"hadLock",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"}",
"}",
"}"
] | Notifies all connection listeners that the session has been successfully
established. | [
"Notifies",
"all",
"connection",
"listeners",
"that",
"the",
"session",
"has",
"been",
"successfully",
"established",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1620-L1643 |
142,577 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.fireConnectionClosed | private void fireConnectionClosed() {
assertUnlocked();
BOSHClientConnEvent event = null;
for (BOSHClientConnListener listener : connListeners) {
if (event == null) {
event = BOSHClientConnEvent.createConnectionClosedEvent(this);
}
try {
listener.connectionEvent(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} | java | private void fireConnectionClosed() {
assertUnlocked();
BOSHClientConnEvent event = null;
for (BOSHClientConnListener listener : connListeners) {
if (event == null) {
event = BOSHClientConnEvent.createConnectionClosedEvent(this);
}
try {
listener.connectionEvent(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} | [
"private",
"void",
"fireConnectionClosed",
"(",
")",
"{",
"assertUnlocked",
"(",
")",
";",
"BOSHClientConnEvent",
"event",
"=",
"null",
";",
"for",
"(",
"BOSHClientConnListener",
"listener",
":",
"connListeners",
")",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"event",
"=",
"BOSHClientConnEvent",
".",
"createConnectionClosedEvent",
"(",
"this",
")",
";",
"}",
"try",
"{",
"listener",
".",
"connectionEvent",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"UNHANDLED",
",",
"ex",
")",
";",
"}",
"}",
"}"
] | Notifies all connection listeners that the session has been
terminated normally. | [
"Notifies",
"all",
"connection",
"listeners",
"that",
"the",
"session",
"has",
"been",
"terminated",
"normally",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1649-L1663 |
142,578 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/BOSHClient.java | BOSHClient.fireConnectionClosedOnError | private void fireConnectionClosedOnError(
final Throwable cause) {
assertUnlocked();
BOSHClientConnEvent event = null;
for (BOSHClientConnListener listener : connListeners) {
if (event == null) {
event = BOSHClientConnEvent
.createConnectionClosedOnErrorEvent(
this, pendingRequestAcks, cause);
}
try {
listener.connectionEvent(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} | java | private void fireConnectionClosedOnError(
final Throwable cause) {
assertUnlocked();
BOSHClientConnEvent event = null;
for (BOSHClientConnListener listener : connListeners) {
if (event == null) {
event = BOSHClientConnEvent
.createConnectionClosedOnErrorEvent(
this, pendingRequestAcks, cause);
}
try {
listener.connectionEvent(event);
} catch (Exception ex) {
LOG.log(Level.WARNING, UNHANDLED, ex);
}
}
} | [
"private",
"void",
"fireConnectionClosedOnError",
"(",
"final",
"Throwable",
"cause",
")",
"{",
"assertUnlocked",
"(",
")",
";",
"BOSHClientConnEvent",
"event",
"=",
"null",
";",
"for",
"(",
"BOSHClientConnListener",
"listener",
":",
"connListeners",
")",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"event",
"=",
"BOSHClientConnEvent",
".",
"createConnectionClosedOnErrorEvent",
"(",
"this",
",",
"pendingRequestAcks",
",",
"cause",
")",
";",
"}",
"try",
"{",
"listener",
".",
"connectionEvent",
"(",
"event",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"UNHANDLED",
",",
"ex",
")",
";",
"}",
"}",
"}"
] | Notifies all connection listeners that the session has been
terminated due to the exceptional condition provided.
@param cause cause of the termination | [
"Notifies",
"all",
"connection",
"listeners",
"that",
"the",
"session",
"has",
"been",
"terminated",
"due",
"to",
"the",
"exceptional",
"condition",
"provided",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/BOSHClient.java#L1671-L1688 |
142,579 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestUtils.java | RestUtils.checkStatus | public static void checkStatus(CloseableHttpResponse httpResponse, final int httpStatus)
throws SDKException {
if (httpResponse.getStatusLine().getStatusCode() != httpStatus) {
log.error(
"Status expected: "
+ httpStatus
+ " obtained: "
+ httpResponse.getStatusLine().getStatusCode());
log.error("httpresponse: " + httpResponse.toString());
String body;
try {
body = EntityUtils.toString(httpResponse.getEntity());
} catch (IOException e) {
e.printStackTrace();
throw new SDKException(
"Status is " + httpResponse.getStatusLine().getStatusCode(),
new StackTraceElement[0],
"could not provide reason because: " + e.getMessage());
}
log.error("Body: " + body);
throw new SDKException(
"Status is " + httpResponse.getStatusLine().getStatusCode(),
new StackTraceElement[0],
body);
}
} | java | public static void checkStatus(CloseableHttpResponse httpResponse, final int httpStatus)
throws SDKException {
if (httpResponse.getStatusLine().getStatusCode() != httpStatus) {
log.error(
"Status expected: "
+ httpStatus
+ " obtained: "
+ httpResponse.getStatusLine().getStatusCode());
log.error("httpresponse: " + httpResponse.toString());
String body;
try {
body = EntityUtils.toString(httpResponse.getEntity());
} catch (IOException e) {
e.printStackTrace();
throw new SDKException(
"Status is " + httpResponse.getStatusLine().getStatusCode(),
new StackTraceElement[0],
"could not provide reason because: " + e.getMessage());
}
log.error("Body: " + body);
throw new SDKException(
"Status is " + httpResponse.getStatusLine().getStatusCode(),
new StackTraceElement[0],
body);
}
} | [
"public",
"static",
"void",
"checkStatus",
"(",
"CloseableHttpResponse",
"httpResponse",
",",
"final",
"int",
"httpStatus",
")",
"throws",
"SDKException",
"{",
"if",
"(",
"httpResponse",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
"!=",
"httpStatus",
")",
"{",
"log",
".",
"error",
"(",
"\"Status expected: \"",
"+",
"httpStatus",
"+",
"\" obtained: \"",
"+",
"httpResponse",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
")",
";",
"log",
".",
"error",
"(",
"\"httpresponse: \"",
"+",
"httpResponse",
".",
"toString",
"(",
")",
")",
";",
"String",
"body",
";",
"try",
"{",
"body",
"=",
"EntityUtils",
".",
"toString",
"(",
"httpResponse",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"SDKException",
"(",
"\"Status is \"",
"+",
"httpResponse",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
",",
"new",
"StackTraceElement",
"[",
"0",
"]",
",",
"\"could not provide reason because: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"log",
".",
"error",
"(",
"\"Body: \"",
"+",
"body",
")",
";",
"throw",
"new",
"SDKException",
"(",
"\"Status is \"",
"+",
"httpResponse",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
",",
"new",
"StackTraceElement",
"[",
"0",
"]",
",",
"body",
")",
";",
"}",
"}"
] | Check whether a json repsonse has the right http status. If not, an SDKException is thrown.
@param httpResponse the http response
@param httpStatus the (desired) http status of the repsonse
@throws SDKException if the request fails | [
"Check",
"whether",
"a",
"json",
"repsonse",
"has",
"the",
"right",
"http",
"status",
".",
"If",
"not",
"an",
"SDKException",
"is",
"thrown",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestUtils.java#L20-L46 |
142,580 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/AbstractBody.java | AbstractBody.getAttributeNames | public final Set<BodyQName> getAttributeNames() {
Map<BodyQName, String> attrs = getAttributes();
return Collections.unmodifiableSet(attrs.keySet());
} | java | public final Set<BodyQName> getAttributeNames() {
Map<BodyQName, String> attrs = getAttributes();
return Collections.unmodifiableSet(attrs.keySet());
} | [
"public",
"final",
"Set",
"<",
"BodyQName",
">",
"getAttributeNames",
"(",
")",
"{",
"Map",
"<",
"BodyQName",
",",
"String",
">",
"attrs",
"=",
"getAttributes",
"(",
")",
";",
"return",
"Collections",
".",
"unmodifiableSet",
"(",
"attrs",
".",
"keySet",
"(",
")",
")",
";",
"}"
] | Get a set of all defined attribute names.
@return set of qualified attribute names | [
"Get",
"a",
"set",
"of",
"all",
"defined",
"attribute",
"names",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/AbstractBody.java#L59-L62 |
142,581 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/AbstractBody.java | AbstractBody.getAttribute | public final String getAttribute(final BodyQName attr) {
Map<BodyQName, String> attrs = getAttributes();
return attrs.get(attr);
} | java | public final String getAttribute(final BodyQName attr) {
Map<BodyQName, String> attrs = getAttributes();
return attrs.get(attr);
} | [
"public",
"final",
"String",
"getAttribute",
"(",
"final",
"BodyQName",
"attr",
")",
"{",
"Map",
"<",
"BodyQName",
",",
"String",
">",
"attrs",
"=",
"getAttributes",
"(",
")",
";",
"return",
"attrs",
".",
"get",
"(",
"attr",
")",
";",
"}"
] | Get the value of the specified attribute.
@param attr name of the attribute to retriece
@return attribute value, or {@code null} if not defined | [
"Get",
"the",
"value",
"of",
"the",
"specified",
"attribute",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/AbstractBody.java#L70-L73 |
142,582 | igniterealtime/jbosh | src/main/java/org/igniterealtime/jbosh/AttrAccept.java | AttrAccept.isAccepted | boolean isAccepted(final String name) {
for (String str : encodings) {
if (str.equalsIgnoreCase(name)) {
return true;
}
}
return false;
} | java | boolean isAccepted(final String name) {
for (String str : encodings) {
if (str.equalsIgnoreCase(name)) {
return true;
}
}
return false;
} | [
"boolean",
"isAccepted",
"(",
"final",
"String",
"name",
")",
"{",
"for",
"(",
"String",
"str",
":",
"encodings",
")",
"{",
"if",
"(",
"str",
".",
"equalsIgnoreCase",
"(",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Determines whether or not the specified encoding is supported.
@param name encoding name
@result {@code true} if the encoding is accepted, {@code false}
otherwise | [
"Determines",
"whether",
"or",
"not",
"the",
"specified",
"encoding",
"is",
"supported",
"."
] | b43378f27e19b753b552b1e9666abc0476cdceff | https://github.com/igniterealtime/jbosh/blob/b43378f27e19b753b552b1e9666abc0476cdceff/src/main/java/org/igniterealtime/jbosh/AttrAccept.java#L65-L72 |
142,583 | librato/librato-java | src/main/java/com/librato/metrics/client/Authorization.java | Authorization.buildAuthHeader | public static String buildAuthHeader(String username, String token) {
if (username == null || "".equals(username)) {
throw new IllegalArgumentException("Username must be specified");
}
if (token == null || "".equals(token)) {
throw new IllegalArgumentException("Token must be specified");
}
return String.format("Basic %s", base64Encode((username + ":" + token).getBytes(Charset.forName("UTF-8"))));
} | java | public static String buildAuthHeader(String username, String token) {
if (username == null || "".equals(username)) {
throw new IllegalArgumentException("Username must be specified");
}
if (token == null || "".equals(token)) {
throw new IllegalArgumentException("Token must be specified");
}
return String.format("Basic %s", base64Encode((username + ":" + token).getBytes(Charset.forName("UTF-8"))));
} | [
"public",
"static",
"String",
"buildAuthHeader",
"(",
"String",
"username",
",",
"String",
"token",
")",
"{",
"if",
"(",
"username",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"username",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Username must be specified\"",
")",
";",
"}",
"if",
"(",
"token",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"token",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Token must be specified\"",
")",
";",
"}",
"return",
"String",
".",
"format",
"(",
"\"Basic %s\"",
",",
"base64Encode",
"(",
"(",
"username",
"+",
"\":\"",
"+",
"token",
")",
".",
"getBytes",
"(",
"Charset",
".",
"forName",
"(",
"\"UTF-8\"",
")",
")",
")",
")",
";",
"}"
] | Builds a new HTTP Authorization header for Librato API requests
@param username the Librato username
@param token the Librato token
@return the Authorization header value | [
"Builds",
"a",
"new",
"HTTP",
"Authorization",
"header",
"for",
"Librato",
"API",
"requests"
] | bff7e776d4af5e978181db47f65e171ab67c1c77 | https://github.com/librato/librato-java/blob/bff7e776d4af5e978181db47f65e171ab67c1c77/src/main/java/com/librato/metrics/client/Authorization.java#L18-L26 |
142,584 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.create | @Help(help = "Create NetworkServiceRecord from NetworkServiceDescriptor id")
public NetworkServiceRecord create(
final String id,
HashMap<String, ArrayList<String>> vduVimInstances,
ArrayList<String> keys,
HashMap<String, Configuration> configurations,
String monitoringIp)
throws SDKException {
HashMap<String, Serializable> jsonBody = new HashMap<>();
jsonBody.put("keys", keys);
jsonBody.put("vduVimInstances", vduVimInstances);
jsonBody.put("configurations", configurations);
jsonBody.put("monitoringIp", monitoringIp);
return (NetworkServiceRecord) this.requestPost(id, jsonBody, NetworkServiceRecord.class);
} | java | @Help(help = "Create NetworkServiceRecord from NetworkServiceDescriptor id")
public NetworkServiceRecord create(
final String id,
HashMap<String, ArrayList<String>> vduVimInstances,
ArrayList<String> keys,
HashMap<String, Configuration> configurations,
String monitoringIp)
throws SDKException {
HashMap<String, Serializable> jsonBody = new HashMap<>();
jsonBody.put("keys", keys);
jsonBody.put("vduVimInstances", vduVimInstances);
jsonBody.put("configurations", configurations);
jsonBody.put("monitoringIp", monitoringIp);
return (NetworkServiceRecord) this.requestPost(id, jsonBody, NetworkServiceRecord.class);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Create NetworkServiceRecord from NetworkServiceDescriptor id\"",
")",
"public",
"NetworkServiceRecord",
"create",
"(",
"final",
"String",
"id",
",",
"HashMap",
"<",
"String",
",",
"ArrayList",
"<",
"String",
">",
">",
"vduVimInstances",
",",
"ArrayList",
"<",
"String",
">",
"keys",
",",
"HashMap",
"<",
"String",
",",
"Configuration",
">",
"configurations",
",",
"String",
"monitoringIp",
")",
"throws",
"SDKException",
"{",
"HashMap",
"<",
"String",
",",
"Serializable",
">",
"jsonBody",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"jsonBody",
".",
"put",
"(",
"\"keys\"",
",",
"keys",
")",
";",
"jsonBody",
".",
"put",
"(",
"\"vduVimInstances\"",
",",
"vduVimInstances",
")",
";",
"jsonBody",
".",
"put",
"(",
"\"configurations\"",
",",
"configurations",
")",
";",
"jsonBody",
".",
"put",
"(",
"\"monitoringIp\"",
",",
"monitoringIp",
")",
";",
"return",
"(",
"NetworkServiceRecord",
")",
"this",
".",
"requestPost",
"(",
"id",
",",
"jsonBody",
",",
"NetworkServiceRecord",
".",
"class",
")",
";",
"}"
] | Create a new NetworkServiceRecord from a NetworkServiceDescriptor.
@param id ID of the NetworkServiceDescriptor
@param vduVimInstances a HashMap assigning VimInstance names to VirtualDeploymentUnits
@param keys an ArrayList of Key names that shall be passed to the NetworkServiceRecord
@param configurations a HashMap assigning Configuration objects to VirtualNetworkServiceRecord
@param monitoringIp the IP of the monitoring system
@return the created NetworkServiceRecord
@throws SDKException if the request fails | [
"Create",
"a",
"new",
"NetworkServiceRecord",
"from",
"a",
"NetworkServiceDescriptor",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L112-L126 |
142,585 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.getVirtualNetworkFunctionRecords | @Help(help = "Get all the VirtualNetworkFunctionRecords of NetworkServiceRecord with specific id")
public List<VirtualNetworkFunctionRecord> getVirtualNetworkFunctionRecords(final String id)
throws SDKException {
String url = id + "/vnfrecords";
return Arrays.asList(
(VirtualNetworkFunctionRecord[]) requestGetAll(url, VirtualNetworkFunctionRecord.class));
} | java | @Help(help = "Get all the VirtualNetworkFunctionRecords of NetworkServiceRecord with specific id")
public List<VirtualNetworkFunctionRecord> getVirtualNetworkFunctionRecords(final String id)
throws SDKException {
String url = id + "/vnfrecords";
return Arrays.asList(
(VirtualNetworkFunctionRecord[]) requestGetAll(url, VirtualNetworkFunctionRecord.class));
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Get all the VirtualNetworkFunctionRecords of NetworkServiceRecord with specific id\"",
")",
"public",
"List",
"<",
"VirtualNetworkFunctionRecord",
">",
"getVirtualNetworkFunctionRecords",
"(",
"final",
"String",
"id",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"id",
"+",
"\"/vnfrecords\"",
";",
"return",
"Arrays",
".",
"asList",
"(",
"(",
"VirtualNetworkFunctionRecord",
"[",
"]",
")",
"requestGetAll",
"(",
"url",
",",
"VirtualNetworkFunctionRecord",
".",
"class",
")",
")",
";",
"}"
] | Returns a List of all the VirtualNetworkFunctionRecords that are contained in a
NetworkServiceRecord.
@param id ID of the NetworkServiceRecord
@return the List of VirtualNetworkFunctionRecords
@throws SDKException if the request fails | [
"Returns",
"a",
"List",
"of",
"all",
"the",
"VirtualNetworkFunctionRecords",
"that",
"are",
"contained",
"in",
"a",
"NetworkServiceRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L136-L142 |
142,586 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.getVirtualNetworkFunctionRecord | @Help(help = "Get the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id")
public VirtualNetworkFunctionRecord getVirtualNetworkFunctionRecord(
final String id, final String idVnfr) throws SDKException {
String url = id + "/vnfrecords" + "/" + idVnfr;
return (VirtualNetworkFunctionRecord) requestGet(url, VirtualNetworkFunctionRecord.class);
} | java | @Help(help = "Get the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id")
public VirtualNetworkFunctionRecord getVirtualNetworkFunctionRecord(
final String id, final String idVnfr) throws SDKException {
String url = id + "/vnfrecords" + "/" + idVnfr;
return (VirtualNetworkFunctionRecord) requestGet(url, VirtualNetworkFunctionRecord.class);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Get the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id\"",
")",
"public",
"VirtualNetworkFunctionRecord",
"getVirtualNetworkFunctionRecord",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"idVnfr",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"id",
"+",
"\"/vnfrecords\"",
"+",
"\"/\"",
"+",
"idVnfr",
";",
"return",
"(",
"VirtualNetworkFunctionRecord",
")",
"requestGet",
"(",
"url",
",",
"VirtualNetworkFunctionRecord",
".",
"class",
")",
";",
"}"
] | Returns a specific VirtualNetworkFunctionRecord which is contained in a NetworkServiceRecord.
@param id the ID of the NetworkServiceRecord
@param idVnfr the ID of the VirtualNetworkFunctionRecord
@return the VirtualNetworkFunctionRecord
@throws SDKException if the request fails | [
"Returns",
"a",
"specific",
"VirtualNetworkFunctionRecord",
"which",
"is",
"contained",
"in",
"a",
"NetworkServiceRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L152-L157 |
142,587 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.deleteVirtualNetworkFunctionRecord | @Help(help = "Delete the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id")
public void deleteVirtualNetworkFunctionRecord(final String id, final String idVnfr)
throws SDKException {
String url = id + "/vnfrecords" + "/" + idVnfr;
requestDelete(url);
} | java | @Help(help = "Delete the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id")
public void deleteVirtualNetworkFunctionRecord(final String id, final String idVnfr)
throws SDKException {
String url = id + "/vnfrecords" + "/" + idVnfr;
requestDelete(url);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Delete the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id\"",
")",
"public",
"void",
"deleteVirtualNetworkFunctionRecord",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"idVnfr",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"id",
"+",
"\"/vnfrecords\"",
"+",
"\"/\"",
"+",
"idVnfr",
";",
"requestDelete",
"(",
"url",
")",
";",
"}"
] | Deletes a specific VirtualNetworkFunctionRecord.
@param id the ID of the NetworkServiceRecord containing the VirtualNetworkFunctionRecord
@param idVnfr the ID of the VirtualNetworkFunctionRecord to delete
@throws SDKException if the request fails | [
"Deletes",
"a",
"specific",
"VirtualNetworkFunctionRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L166-L171 |
142,588 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.switchToStandby | @Help(help = "Switch to standby")
public void switchToStandby(
final String idNsr,
final String idVnfr,
final String idVdu,
final String idVnfc,
final VNFCInstance failedVnfcInstance)
throws SDKException {
String url =
idNsr
+ "/vnfrecords/"
+ idVnfr
+ "/vdunits/"
+ idVdu
+ "/vnfcinstances/"
+ idVnfc
+ "/switchtostandby";
requestPost(url, failedVnfcInstance);
} | java | @Help(help = "Switch to standby")
public void switchToStandby(
final String idNsr,
final String idVnfr,
final String idVdu,
final String idVnfc,
final VNFCInstance failedVnfcInstance)
throws SDKException {
String url =
idNsr
+ "/vnfrecords/"
+ idVnfr
+ "/vdunits/"
+ idVdu
+ "/vnfcinstances/"
+ idVnfc
+ "/switchtostandby";
requestPost(url, failedVnfcInstance);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Switch to standby\"",
")",
"public",
"void",
"switchToStandby",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
",",
"final",
"String",
"idVdu",
",",
"final",
"String",
"idVnfc",
",",
"final",
"VNFCInstance",
"failedVnfcInstance",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfrecords/\"",
"+",
"idVnfr",
"+",
"\"/vdunits/\"",
"+",
"idVdu",
"+",
"\"/vnfcinstances/\"",
"+",
"idVnfc",
"+",
"\"/switchtostandby\"",
";",
"requestPost",
"(",
"url",
",",
"failedVnfcInstance",
")",
";",
"}"
] | Make a VNFCInstance switch into standby mode.
@param idNsr the ID of the NetworkServiceRecord containing the VNFCInstance
@param idVnfr the ID of the VirtualNetworkFunctionRecord containing the VNFCInstance
@param idVdu the ID of the VirtualDeploymentUnit containing the VNFCInstance
@param idVnfc the ID on the VNFCInstance that shall switch into standby mode
@param failedVnfcInstance the failed VNFCInstance
@throws SDKException if the request fails | [
"Make",
"a",
"VNFCInstance",
"switch",
"into",
"standby",
"mode",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L210-L228 |
142,589 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.postAction | @Help(help = "Execute a specific action specified in the nfvMessage")
public void postAction(
final String idNsr,
final String idVnfr,
final String idVdu,
final String idVnfc,
final NFVMessage nfvMessage)
throws SDKException {
String url =
idNsr
+ "/vnfrecords/"
+ idVnfr
+ "/vdunits/"
+ idVdu
+ "/vnfcinstances/"
+ idVnfc
+ "/actions";
requestPost(url, nfvMessage);
} | java | @Help(help = "Execute a specific action specified in the nfvMessage")
public void postAction(
final String idNsr,
final String idVnfr,
final String idVdu,
final String idVnfc,
final NFVMessage nfvMessage)
throws SDKException {
String url =
idNsr
+ "/vnfrecords/"
+ idVnfr
+ "/vdunits/"
+ idVdu
+ "/vnfcinstances/"
+ idVnfc
+ "/actions";
requestPost(url, nfvMessage);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Execute a specific action specified in the nfvMessage\"",
")",
"public",
"void",
"postAction",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
",",
"final",
"String",
"idVdu",
",",
"final",
"String",
"idVnfc",
",",
"final",
"NFVMessage",
"nfvMessage",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfrecords/\"",
"+",
"idVnfr",
"+",
"\"/vdunits/\"",
"+",
"idVdu",
"+",
"\"/vnfcinstances/\"",
"+",
"idVnfc",
"+",
"\"/actions\"",
";",
"requestPost",
"(",
"url",
",",
"nfvMessage",
")",
";",
"}"
] | Trigger the execution of a specific LifecycleEvent on a VNFCInstance. Currently only the HEAL
LifecycleEvent is supported.
@param idNsr the ID of the NetworkServiceRecord containing the VNFCInstance
@param idVnfr the ID of the VirtualNetworkFunctionRecord containing the VNFCInstance
@param idVdu the ID of the VirtualDeploymentUnit containing the VNFCInstance
@param idVnfc the ID on the VNFCInstance on which a LifecycleEvent shall be executed
@param nfvMessage the NFVMessage describing the LifecyceEvent to execute
@throws SDKException if the request fails | [
"Trigger",
"the",
"execution",
"of",
"a",
"specific",
"LifecycleEvent",
"on",
"a",
"VNFCInstance",
".",
"Currently",
"only",
"the",
"HEAL",
"LifecycleEvent",
"is",
"supported",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L241-L259 |
142,590 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.createVNFR | @Help(help = "create VirtualNetworkFunctionRecord")
public VirtualNetworkFunctionRecord createVNFR(
final String idNsr, final VirtualNetworkFunctionRecord virtualNetworkFunctionRecord)
throws SDKException {
String url = idNsr + "/vnfrecords";
return (VirtualNetworkFunctionRecord) requestPost(url, virtualNetworkFunctionRecord);
} | java | @Help(help = "create VirtualNetworkFunctionRecord")
public VirtualNetworkFunctionRecord createVNFR(
final String idNsr, final VirtualNetworkFunctionRecord virtualNetworkFunctionRecord)
throws SDKException {
String url = idNsr + "/vnfrecords";
return (VirtualNetworkFunctionRecord) requestPost(url, virtualNetworkFunctionRecord);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"create VirtualNetworkFunctionRecord\"",
")",
"public",
"VirtualNetworkFunctionRecord",
"createVNFR",
"(",
"final",
"String",
"idNsr",
",",
"final",
"VirtualNetworkFunctionRecord",
"virtualNetworkFunctionRecord",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfrecords\"",
";",
"return",
"(",
"VirtualNetworkFunctionRecord",
")",
"requestPost",
"(",
"url",
",",
"virtualNetworkFunctionRecord",
")",
";",
"}"
] | Create a new VirtualNetworkFunctionRecord and add it to a NetworkServiceRecord.
@param idNsr the ID of the NetworkServiceRecord to which the VirtualNetworkFunctionRecord shall
be added
@param virtualNetworkFunctionRecord the new VirtualNetworkFunctionRecord
@return the VirtualNetworkFunctionRecord
@throws SDKException if the request fails | [
"Create",
"a",
"new",
"VirtualNetworkFunctionRecord",
"and",
"add",
"it",
"to",
"a",
"NetworkServiceRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L271-L277 |
142,591 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.createVNFCInstance | @Help(help = "create VNFCInstance. Aka SCALE OUT")
public void createVNFCInstance(
final String idNsr,
final String idVnfr,
final VNFComponent vnfComponent,
ArrayList<String> vimInstanceNames)
throws SDKException {
String url = idNsr + "/vnfrecords/" + idVnfr + "/vdunits/vnfcinstances";
HashMap<String, Serializable> body = new HashMap<>();
body.put("vnfComponent", vnfComponent);
body.put("vimInstanceNames", vimInstanceNames);
requestPost(url, body);
} | java | @Help(help = "create VNFCInstance. Aka SCALE OUT")
public void createVNFCInstance(
final String idNsr,
final String idVnfr,
final VNFComponent vnfComponent,
ArrayList<String> vimInstanceNames)
throws SDKException {
String url = idNsr + "/vnfrecords/" + idVnfr + "/vdunits/vnfcinstances";
HashMap<String, Serializable> body = new HashMap<>();
body.put("vnfComponent", vnfComponent);
body.put("vimInstanceNames", vimInstanceNames);
requestPost(url, body);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"create VNFCInstance. Aka SCALE OUT\"",
")",
"public",
"void",
"createVNFCInstance",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
",",
"final",
"VNFComponent",
"vnfComponent",
",",
"ArrayList",
"<",
"String",
">",
"vimInstanceNames",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfrecords/\"",
"+",
"idVnfr",
"+",
"\"/vdunits/vnfcinstances\"",
";",
"HashMap",
"<",
"String",
",",
"Serializable",
">",
"body",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"body",
".",
"put",
"(",
"\"vnfComponent\"",
",",
"vnfComponent",
")",
";",
"body",
".",
"put",
"(",
"\"vimInstanceNames\"",
",",
"vimInstanceNames",
")",
";",
"requestPost",
"(",
"url",
",",
"body",
")",
";",
"}"
] | Create a new VNFCInstance from a VNFComponent without specifying the VirtualDeploymentUnit to
which the VNFCInstance shall be added. This is also called a scale out operation.
@param idNsr the ID of the NetworkServiceRecord to which the new VNFCInstance shall be added
@param idVnfr the ID of the VirtualNetworkFunctionRecord to which the new VNFCInstance shall be
added
@param vnfComponent the VNFComponent from which the new VNFCInstance shall be created
@param vimInstanceNames the list of vimInstanceNames where you want to deploy the new vnf
component
@throws SDKException if the request fails | [
"Create",
"a",
"new",
"VNFCInstance",
"from",
"a",
"VNFComponent",
"without",
"specifying",
"the",
"VirtualDeploymentUnit",
"to",
"which",
"the",
"VNFCInstance",
"shall",
"be",
"added",
".",
"This",
"is",
"also",
"called",
"a",
"scale",
"out",
"operation",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L291-L303 |
142,592 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.deleteVNFCInstance | @Help(help = "remove VNFCInstance. Aka SCALE IN")
public void deleteVNFCInstance(final String idNsr, final String idVnfr) throws SDKException {
String url = idNsr + "/vnfrecords/" + idVnfr + "/vdunits/vnfcinstances";
requestDelete(url);
} | java | @Help(help = "remove VNFCInstance. Aka SCALE IN")
public void deleteVNFCInstance(final String idNsr, final String idVnfr) throws SDKException {
String url = idNsr + "/vnfrecords/" + idVnfr + "/vdunits/vnfcinstances";
requestDelete(url);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"remove VNFCInstance. Aka SCALE IN\"",
")",
"public",
"void",
"deleteVNFCInstance",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfrecords/\"",
"+",
"idVnfr",
"+",
"\"/vdunits/vnfcinstances\"",
";",
"requestDelete",
"(",
"url",
")",
";",
"}"
] | Delete a VNFCInstance from a VirtualNetworkFunctionRecord. This operation is also called
scaling in. This method does not require you to specify the VirtualDeploymentUnit from which a
VNFCInstance shall be deleted.
@param idNsr the ID of the NetworkServiceRecord from which a VNFCInstance shall be deleted
@param idVnfr the ID of the VirtualNetworkFunctionRecord from which a VNFCInstance shall be
deleted
@throws SDKException if the request fails | [
"Delete",
"a",
"VNFCInstance",
"from",
"a",
"VirtualNetworkFunctionRecord",
".",
"This",
"operation",
"is",
"also",
"called",
"scaling",
"in",
".",
"This",
"method",
"does",
"not",
"require",
"you",
"to",
"specify",
"the",
"VirtualDeploymentUnit",
"from",
"which",
"a",
"VNFCInstance",
"shall",
"be",
"deleted",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L343-L347 |
142,593 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.updateVNFR | @Help(help = "update VirtualNetworkFunctionRecord")
public String updateVNFR(
final String idNsr,
final String idVnfr,
final VirtualNetworkFunctionRecord virtualNetworkFunctionRecord)
throws SDKException {
String url = idNsr + "/vnfrecords" + "/" + idVnfr;
return requestPut(url, virtualNetworkFunctionRecord).toString();
} | java | @Help(help = "update VirtualNetworkFunctionRecord")
public String updateVNFR(
final String idNsr,
final String idVnfr,
final VirtualNetworkFunctionRecord virtualNetworkFunctionRecord)
throws SDKException {
String url = idNsr + "/vnfrecords" + "/" + idVnfr;
return requestPut(url, virtualNetworkFunctionRecord).toString();
} | [
"@",
"Help",
"(",
"help",
"=",
"\"update VirtualNetworkFunctionRecord\"",
")",
"public",
"String",
"updateVNFR",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
",",
"final",
"VirtualNetworkFunctionRecord",
"virtualNetworkFunctionRecord",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfrecords\"",
"+",
"\"/\"",
"+",
"idVnfr",
";",
"return",
"requestPut",
"(",
"url",
",",
"virtualNetworkFunctionRecord",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Updates a VirtualNetworkFunctionRecord.
@param idNsr the ID of the NetworkServiceRecord containing the VirtualNetworkFunctionRecord
@param idVnfr the ID of the VirtualNetworkFunctionRecord to update
@param virtualNetworkFunctionRecord the updated version of the VirtualNetworkFunctionRecord
@return the updated VirtualNetworkFunctionRecord
@throws SDKException if the request fails | [
"Updates",
"a",
"VirtualNetworkFunctionRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L398-L406 |
142,594 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.getVNFDependencies | @Help(
help =
"Get all the VirtualNetworkFunctionRecord dependencies of NetworkServiceRecord with specific id"
)
public List<VNFRecordDependency> getVNFDependencies(final String idNsr) throws SDKException {
String url = idNsr + "/vnfdependencies";
return Arrays.asList((VNFRecordDependency[]) requestGetAll(url, VNFRecordDependency.class));
} | java | @Help(
help =
"Get all the VirtualNetworkFunctionRecord dependencies of NetworkServiceRecord with specific id"
)
public List<VNFRecordDependency> getVNFDependencies(final String idNsr) throws SDKException {
String url = idNsr + "/vnfdependencies";
return Arrays.asList((VNFRecordDependency[]) requestGetAll(url, VNFRecordDependency.class));
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Get all the VirtualNetworkFunctionRecord dependencies of NetworkServiceRecord with specific id\"",
")",
"public",
"List",
"<",
"VNFRecordDependency",
">",
"getVNFDependencies",
"(",
"final",
"String",
"idNsr",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfdependencies\"",
";",
"return",
"Arrays",
".",
"asList",
"(",
"(",
"VNFRecordDependency",
"[",
"]",
")",
"requestGetAll",
"(",
"url",
",",
"VNFRecordDependency",
".",
"class",
")",
")",
";",
"}"
] | Returns a List of all the VNFRecordDependencies contained in a particular NetworkServiceRecord.
@param idNsr the ID of the NetworkServiceRecord
@return a List of VNFRecordDependencies
@throws SDKException if the request fails | [
"Returns",
"a",
"List",
"of",
"all",
"the",
"VNFRecordDependencies",
"contained",
"in",
"a",
"particular",
"NetworkServiceRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L415-L422 |
142,595 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.getVNFDependency | @Help(
help =
"Get the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id"
)
public VNFRecordDependency getVNFDependency(final String idNsr, final String idVnfrDep)
throws SDKException {
String url = idNsr + "/vnfdependencies" + "/" + idVnfrDep;
return (VNFRecordDependency) requestGet(url, VNFRecordDependency.class);
} | java | @Help(
help =
"Get the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id"
)
public VNFRecordDependency getVNFDependency(final String idNsr, final String idVnfrDep)
throws SDKException {
String url = idNsr + "/vnfdependencies" + "/" + idVnfrDep;
return (VNFRecordDependency) requestGet(url, VNFRecordDependency.class);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Get the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id\"",
")",
"public",
"VNFRecordDependency",
"getVNFDependency",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfrDep",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfdependencies\"",
"+",
"\"/\"",
"+",
"idVnfrDep",
";",
"return",
"(",
"VNFRecordDependency",
")",
"requestGet",
"(",
"url",
",",
"VNFRecordDependency",
".",
"class",
")",
";",
"}"
] | Returns a specific VNFRecordDependency from a particular NetworkServiceRecord.
@param idNsr the ID of the NetworkServiceRecord
@param idVnfrDep the ID of the requested VNFRecordDependency
@return the VNFRecordDependency
@throws SDKException if the request fails | [
"Returns",
"a",
"specific",
"VNFRecordDependency",
"from",
"a",
"particular",
"NetworkServiceRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L432-L440 |
142,596 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.deleteVNFDependency | @Help(
help =
"Delete the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id"
)
public void deleteVNFDependency(final String idNsr, final String idVnfrDep) throws SDKException {
String url = idNsr + "/vnfdependencies" + "/" + idVnfrDep;
requestDelete(url);
} | java | @Help(
help =
"Delete the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id"
)
public void deleteVNFDependency(final String idNsr, final String idVnfrDep) throws SDKException {
String url = idNsr + "/vnfdependencies" + "/" + idVnfrDep;
requestDelete(url);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Delete the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id\"",
")",
"public",
"void",
"deleteVNFDependency",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfrDep",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfdependencies\"",
"+",
"\"/\"",
"+",
"idVnfrDep",
";",
"requestDelete",
"(",
"url",
")",
";",
"}"
] | Deletes a specific VNFRecordDependency from a NetworkServiceRecord.
@param idNsr the ID of the NetworkServiceRecord
@param idVnfrDep the ID of the VNFRecordDependency to delete
@throws SDKException if the request fails | [
"Deletes",
"a",
"specific",
"VNFRecordDependency",
"from",
"a",
"NetworkServiceRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L449-L456 |
142,597 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.postVNFDependency | @Help(
help =
"Create the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id"
)
public VNFRecordDependency postVNFDependency(
final String idNsr, final VNFRecordDependency vnfRecordDependency) throws SDKException {
String url = idNsr + "/vnfdependencies" + "/";
return (VNFRecordDependency) requestPost(url, vnfRecordDependency);
} | java | @Help(
help =
"Create the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id"
)
public VNFRecordDependency postVNFDependency(
final String idNsr, final VNFRecordDependency vnfRecordDependency) throws SDKException {
String url = idNsr + "/vnfdependencies" + "/";
return (VNFRecordDependency) requestPost(url, vnfRecordDependency);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Create the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id\"",
")",
"public",
"VNFRecordDependency",
"postVNFDependency",
"(",
"final",
"String",
"idNsr",
",",
"final",
"VNFRecordDependency",
"vnfRecordDependency",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfdependencies\"",
"+",
"\"/\"",
";",
"return",
"(",
"VNFRecordDependency",
")",
"requestPost",
"(",
"url",
",",
"vnfRecordDependency",
")",
";",
"}"
] | Add a new VNFRecordDependency to a NetworkServiceRecord.
@param idNsr the ID of the NetworkServiceRecord
@param vnfRecordDependency the new VNFRecordDependency
@return the created VNFRecordDependency
@throws SDKException if the request fails | [
"Add",
"a",
"new",
"VNFRecordDependency",
"to",
"a",
"NetworkServiceRecord",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L467-L475 |
142,598 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.updateVNFDependency | @Help(
help =
"Update the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id"
)
public VNFRecordDependency updateVNFDependency(
final String idNsr, final String idVnfrDep, final VNFRecordDependency vnfRecordDependency)
throws SDKException {
String url = idNsr + "/vnfdependencies" + "/" + idVnfrDep;
return (VNFRecordDependency) requestPut(url, vnfRecordDependency);
} | java | @Help(
help =
"Update the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id"
)
public VNFRecordDependency updateVNFDependency(
final String idNsr, final String idVnfrDep, final VNFRecordDependency vnfRecordDependency)
throws SDKException {
String url = idNsr + "/vnfdependencies" + "/" + idVnfrDep;
return (VNFRecordDependency) requestPut(url, vnfRecordDependency);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Update the VirtualNetworkFunctionRecord Dependency of a NetworkServiceRecord with specific id\"",
")",
"public",
"VNFRecordDependency",
"updateVNFDependency",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfrDep",
",",
"final",
"VNFRecordDependency",
"vnfRecordDependency",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vnfdependencies\"",
"+",
"\"/\"",
"+",
"idVnfrDep",
";",
"return",
"(",
"VNFRecordDependency",
")",
"requestPut",
"(",
"url",
",",
"vnfRecordDependency",
")",
";",
"}"
] | Update a VNFRecordDependency.
@param idNsr the ID of the NetworkServiceRecord containing the VNFRecordDependency
@param idVnfrDep the ID of the VNFRecordDependency to update
@param vnfRecordDependency the updated version of the VNFRecordDependency
@return the updated VNFRecordDependency
@throws SDKException if the request fails | [
"Update",
"a",
"VNFRecordDependency",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L486-L495 |
142,599 | openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.startVNFCInstance | @Help(help = "Start the specified VNFC Instance")
public void startVNFCInstance(
final String nsrId, final String vnfrId, final String vduId, final String vnfcInstanceId)
throws SDKException {
String url =
nsrId
+ "/vnfrecords/"
+ vnfrId
+ "/vdunits/"
+ vduId
+ "/vnfcinstances/"
+ vnfcInstanceId
+ "/start";
requestPost(url);
} | java | @Help(help = "Start the specified VNFC Instance")
public void startVNFCInstance(
final String nsrId, final String vnfrId, final String vduId, final String vnfcInstanceId)
throws SDKException {
String url =
nsrId
+ "/vnfrecords/"
+ vnfrId
+ "/vdunits/"
+ vduId
+ "/vnfcinstances/"
+ vnfcInstanceId
+ "/start";
requestPost(url);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Start the specified VNFC Instance\"",
")",
"public",
"void",
"startVNFCInstance",
"(",
"final",
"String",
"nsrId",
",",
"final",
"String",
"vnfrId",
",",
"final",
"String",
"vduId",
",",
"final",
"String",
"vnfcInstanceId",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"nsrId",
"+",
"\"/vnfrecords/\"",
"+",
"vnfrId",
"+",
"\"/vdunits/\"",
"+",
"vduId",
"+",
"\"/vnfcinstances/\"",
"+",
"vnfcInstanceId",
"+",
"\"/start\"",
";",
"requestPost",
"(",
"url",
")",
";",
"}"
] | Start a specific VNFCInstance.
@param nsrId the ID of the NetworkServiceRecord containing the VNFCInstance
@param vnfrId the ID of the VirtualNetworkFunctionRecord containing the VNFCInstance
@param vduId the ID of the VirtualDeploymentUnit containing the VNFCInstance
@param vnfcInstanceId the ID on the VNFCInstance that shall be started
@throws SDKException if the request fails | [
"Start",
"a",
"specific",
"VNFCInstance",
"."
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L506-L520 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.