code
stringlengths 73
34.1k
| label
stringclasses 1
value |
---|---|
public static protocolhttp_stats get(nitro_service service, options option) throws Exception{
protocolhttp_stats obj = new protocolhttp_stats();
protocolhttp_stats[] response = (protocolhttp_stats[])obj.stat_resources(service,option);
return response[0];
} | java |
public static base_response add(nitro_service client, dnsnameserver resource) throws Exception {
dnsnameserver addresource = new dnsnameserver();
addresource.ip = resource.ip;
addresource.dnsvservername = resource.dnsvservername;
addresource.local = resource.local;
addresource.state = resource.state;
addresource.type = resource.type;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, dnsnameserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsnameserver addresources[] = new dnsnameserver[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnsnameserver();
addresources[i].ip = resources[i].ip;
addresources[i].dnsvservername = resources[i].dnsvservername;
addresources[i].local = resources[i].local;
addresources[i].state = resources[i].state;
addresources[i].type = resources[i].type;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response delete(nitro_service client, String ip) throws Exception {
dnsnameserver deleteresource = new dnsnameserver();
deleteresource.ip = ip;
return deleteresource.delete_resource(client);
} | java |
public static base_response delete(nitro_service client, dnsnameserver resource) throws Exception {
dnsnameserver deleteresource = new dnsnameserver();
deleteresource.ip = resource.ip;
deleteresource.dnsvservername = resource.dnsvservername;
return deleteresource.delete_resource(client);
} | java |
public static base_responses delete(nitro_service client, String ip[]) throws Exception {
base_responses result = null;
if (ip != null && ip.length > 0) {
dnsnameserver deleteresources[] = new dnsnameserver[ip.length];
for (int i=0;i<ip.length;i++){
deleteresources[i] = new dnsnameserver();
deleteresources[i].ip = ip[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static base_responses delete(nitro_service client, dnsnameserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsnameserver deleteresources[] = new dnsnameserver[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new dnsnameserver();
deleteresources[i].ip = resources[i].ip;
deleteresources[i].dnsvservername = resources[i].dnsvservername;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static base_response enable(nitro_service client, String ip) throws Exception {
dnsnameserver enableresource = new dnsnameserver();
enableresource.ip = ip;
return enableresource.perform_operation(client,"enable");
} | java |
public static base_response enable(nitro_service client, dnsnameserver resource) throws Exception {
dnsnameserver enableresource = new dnsnameserver();
enableresource.ip = resource.ip;
enableresource.dnsvservername = resource.dnsvservername;
return enableresource.perform_operation(client,"enable");
} | java |
public static base_responses enable(nitro_service client, String ip[]) throws Exception {
base_responses result = null;
if (ip != null && ip.length > 0) {
dnsnameserver enableresources[] = new dnsnameserver[ip.length];
for (int i=0;i<ip.length;i++){
enableresources[i] = new dnsnameserver();
enableresources[i].ip = ip[i];
}
result = perform_operation_bulk_request(client, enableresources,"enable");
}
return result;
} | java |
public static base_responses enable(nitro_service client, dnsnameserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsnameserver enableresources[] = new dnsnameserver[resources.length];
for (int i=0;i<resources.length;i++){
enableresources[i] = new dnsnameserver();
enableresources[i].ip = resources[i].ip;
enableresources[i].dnsvservername = resources[i].dnsvservername;
}
result = perform_operation_bulk_request(client, enableresources,"enable");
}
return result;
} | java |
public static base_response disable(nitro_service client, String ip) throws Exception {
dnsnameserver disableresource = new dnsnameserver();
disableresource.ip = ip;
return disableresource.perform_operation(client,"disable");
} | java |
public static base_response disable(nitro_service client, dnsnameserver resource) throws Exception {
dnsnameserver disableresource = new dnsnameserver();
disableresource.ip = resource.ip;
disableresource.dnsvservername = resource.dnsvservername;
return disableresource.perform_operation(client,"disable");
} | java |
public static base_responses disable(nitro_service client, String ip[]) throws Exception {
base_responses result = null;
if (ip != null && ip.length > 0) {
dnsnameserver disableresources[] = new dnsnameserver[ip.length];
for (int i=0;i<ip.length;i++){
disableresources[i] = new dnsnameserver();
disableresources[i].ip = ip[i];
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} | java |
public static base_responses disable(nitro_service client, dnsnameserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsnameserver disableresources[] = new dnsnameserver[resources.length];
for (int i=0;i<resources.length;i++){
disableresources[i] = new dnsnameserver();
disableresources[i].ip = resources[i].ip;
disableresources[i].dnsvservername = resources[i].dnsvservername;
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} | java |
public static dnsnameserver[] get(nitro_service service) throws Exception{
dnsnameserver obj = new dnsnameserver();
dnsnameserver[] response = (dnsnameserver[])obj.get_resources(service);
return response;
} | java |
public static authenticationnegotiatepolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{
authenticationnegotiatepolicy_authenticationvserver_binding obj = new authenticationnegotiatepolicy_authenticationvserver_binding();
obj.set_name(name);
authenticationnegotiatepolicy_authenticationvserver_binding response[] = (authenticationnegotiatepolicy_authenticationvserver_binding[]) obj.get_resources(service);
return response;
} | java |
public static transformpolicylabel_policybinding_binding[] get(nitro_service service, String labelname) throws Exception{
transformpolicylabel_policybinding_binding obj = new transformpolicylabel_policybinding_binding();
obj.set_labelname(labelname);
transformpolicylabel_policybinding_binding response[] = (transformpolicylabel_policybinding_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response update(nitro_service client, policyhttpcallout resource) throws Exception {
policyhttpcallout updateresource = new policyhttpcallout();
updateresource.name = resource.name;
updateresource.ipaddress = resource.ipaddress;
updateresource.port = resource.port;
updateresource.vserver = resource.vserver;
updateresource.returntype = resource.returntype;
updateresource.httpmethod = resource.httpmethod;
updateresource.hostexpr = resource.hostexpr;
updateresource.urlstemexpr = resource.urlstemexpr;
updateresource.headers = resource.headers;
updateresource.parameters = resource.parameters;
updateresource.bodyexpr = resource.bodyexpr;
updateresource.fullreqexpr = resource.fullreqexpr;
updateresource.scheme = resource.scheme;
updateresource.resultexpr = resource.resultexpr;
updateresource.cacheforsecs = resource.cacheforsecs;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, policyhttpcallout resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
policyhttpcallout updateresources[] = new policyhttpcallout[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new policyhttpcallout();
updateresources[i].name = resources[i].name;
updateresources[i].ipaddress = resources[i].ipaddress;
updateresources[i].port = resources[i].port;
updateresources[i].vserver = resources[i].vserver;
updateresources[i].returntype = resources[i].returntype;
updateresources[i].httpmethod = resources[i].httpmethod;
updateresources[i].hostexpr = resources[i].hostexpr;
updateresources[i].urlstemexpr = resources[i].urlstemexpr;
updateresources[i].headers = resources[i].headers;
updateresources[i].parameters = resources[i].parameters;
updateresources[i].bodyexpr = resources[i].bodyexpr;
updateresources[i].fullreqexpr = resources[i].fullreqexpr;
updateresources[i].scheme = resources[i].scheme;
updateresources[i].resultexpr = resources[i].resultexpr;
updateresources[i].cacheforsecs = resources[i].cacheforsecs;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static policyhttpcallout[] get(nitro_service service) throws Exception{
policyhttpcallout obj = new policyhttpcallout();
policyhttpcallout[] response = (policyhttpcallout[])obj.get_resources(service);
return response;
} | java |
public static policyhttpcallout get(nitro_service service, String name) throws Exception{
policyhttpcallout obj = new policyhttpcallout();
obj.set_name(name);
policyhttpcallout response = (policyhttpcallout) obj.get_resource(service);
return response;
} | java |
@Override
public void loadPath(File path, FileFilter filt) {
if(path.exists()) {
filePaths.add(path);
fileFilters.add(filt);
} else {
System.err.printf("%s: File/path %s does not exist. Skipping.\n" , this.getClass().getName(), path.getPath());
}
} | java |
public static dnsview_gslbservice_binding[] get(nitro_service service, String viewname) throws Exception{
dnsview_gslbservice_binding obj = new dnsview_gslbservice_binding();
obj.set_viewname(viewname);
dnsview_gslbservice_binding response[] = (dnsview_gslbservice_binding[]) obj.get_resources(service);
return response;
} | java |
public static long count(nitro_service service, String viewname) throws Exception{
dnsview_gslbservice_binding obj = new dnsview_gslbservice_binding();
obj.set_viewname(viewname);
options option = new options();
option.set_count(true);
dnsview_gslbservice_binding response[] = (dnsview_gslbservice_binding[]) obj.get_resources(service,option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java |
public static <X> IteratorFromReaderFactory<X> getFactory(Function<String,X> op) {
return new LineIteratorFactory<X>(op);
} | java |
public static base_response add(nitro_service client, vpnclientlessaccessprofile resource) throws Exception {
vpnclientlessaccessprofile addresource = new vpnclientlessaccessprofile();
addresource.profilename = resource.profilename;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, vpnclientlessaccessprofile resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnclientlessaccessprofile addresources[] = new vpnclientlessaccessprofile[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new vpnclientlessaccessprofile();
addresources[i].profilename = resources[i].profilename;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response delete(nitro_service client, String profilename) throws Exception {
vpnclientlessaccessprofile deleteresource = new vpnclientlessaccessprofile();
deleteresource.profilename = profilename;
return deleteresource.delete_resource(client);
} | java |
public static base_responses delete(nitro_service client, String profilename[]) throws Exception {
base_responses result = null;
if (profilename != null && profilename.length > 0) {
vpnclientlessaccessprofile deleteresources[] = new vpnclientlessaccessprofile[profilename.length];
for (int i=0;i<profilename.length;i++){
deleteresources[i] = new vpnclientlessaccessprofile();
deleteresources[i].profilename = profilename[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static base_response update(nitro_service client, vpnclientlessaccessprofile resource) throws Exception {
vpnclientlessaccessprofile updateresource = new vpnclientlessaccessprofile();
updateresource.profilename = resource.profilename;
updateresource.urlrewritepolicylabel = resource.urlrewritepolicylabel;
updateresource.javascriptrewritepolicylabel = resource.javascriptrewritepolicylabel;
updateresource.reqhdrrewritepolicylabel = resource.reqhdrrewritepolicylabel;
updateresource.reshdrrewritepolicylabel = resource.reshdrrewritepolicylabel;
updateresource.regexforfindingurlinjavascript = resource.regexforfindingurlinjavascript;
updateresource.regexforfindingurlincss = resource.regexforfindingurlincss;
updateresource.regexforfindingurlinxcomponent = resource.regexforfindingurlinxcomponent;
updateresource.regexforfindingurlinxml = resource.regexforfindingurlinxml;
updateresource.regexforfindingcustomurls = resource.regexforfindingcustomurls;
updateresource.clientconsumedcookies = resource.clientconsumedcookies;
updateresource.requirepersistentcookie = resource.requirepersistentcookie;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, vpnclientlessaccessprofile resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnclientlessaccessprofile updateresources[] = new vpnclientlessaccessprofile[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new vpnclientlessaccessprofile();
updateresources[i].profilename = resources[i].profilename;
updateresources[i].urlrewritepolicylabel = resources[i].urlrewritepolicylabel;
updateresources[i].javascriptrewritepolicylabel = resources[i].javascriptrewritepolicylabel;
updateresources[i].reqhdrrewritepolicylabel = resources[i].reqhdrrewritepolicylabel;
updateresources[i].reshdrrewritepolicylabel = resources[i].reshdrrewritepolicylabel;
updateresources[i].regexforfindingurlinjavascript = resources[i].regexforfindingurlinjavascript;
updateresources[i].regexforfindingurlincss = resources[i].regexforfindingurlincss;
updateresources[i].regexforfindingurlinxcomponent = resources[i].regexforfindingurlinxcomponent;
updateresources[i].regexforfindingurlinxml = resources[i].regexforfindingurlinxml;
updateresources[i].regexforfindingcustomurls = resources[i].regexforfindingcustomurls;
updateresources[i].clientconsumedcookies = resources[i].clientconsumedcookies;
updateresources[i].requirepersistentcookie = resources[i].requirepersistentcookie;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static base_response unset(nitro_service client, vpnclientlessaccessprofile resource, String[] args) throws Exception{
vpnclientlessaccessprofile unsetresource = new vpnclientlessaccessprofile();
unsetresource.profilename = resource.profilename;
return unsetresource.unset_resource(client,args);
} | java |
public static base_responses unset(nitro_service client, vpnclientlessaccessprofile resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnclientlessaccessprofile unsetresources[] = new vpnclientlessaccessprofile[resources.length];
for (int i=0;i<resources.length;i++){
unsetresources[i] = new vpnclientlessaccessprofile();
unsetresources[i].profilename = resources[i].profilename;
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java |
public static vpnclientlessaccessprofile[] get(nitro_service service) throws Exception{
vpnclientlessaccessprofile obj = new vpnclientlessaccessprofile();
vpnclientlessaccessprofile[] response = (vpnclientlessaccessprofile[])obj.get_resources(service);
return response;
} | java |
public static vpnclientlessaccessprofile get(nitro_service service, String profilename) throws Exception{
vpnclientlessaccessprofile obj = new vpnclientlessaccessprofile();
obj.set_profilename(profilename);
vpnclientlessaccessprofile response = (vpnclientlessaccessprofile) obj.get_resource(service);
return response;
} | java |
public static vpnclientlessaccessprofile[] get(nitro_service service, String profilename[]) throws Exception{
if (profilename !=null && profilename.length>0) {
vpnclientlessaccessprofile response[] = new vpnclientlessaccessprofile[profilename.length];
vpnclientlessaccessprofile obj[] = new vpnclientlessaccessprofile[profilename.length];
for (int i=0;i<profilename.length;i++) {
obj[i] = new vpnclientlessaccessprofile();
obj[i].set_profilename(profilename[i]);
response[i] = (vpnclientlessaccessprofile) obj[i].get_resource(service);
}
return response;
}
return null;
} | java |
public static vpnclientlessaccessprofile[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
vpnclientlessaccessprofile obj = new vpnclientlessaccessprofile();
options option = new options();
option.set_filter(filter);
vpnclientlessaccessprofile[] response = (vpnclientlessaccessprofile[]) obj.getfiltered(service, option);
return response;
} | java |
public Set<String> getFullKeyList() throws IOException {
if (dataCollector.getCollectorType()
.equals(DataCollector.COLLECTOR_TYPE_LIST)) {
return dataCollector.getKeyList();
} else {
throw new IOException(
"only allowed for " + DataCollector.COLLECTOR_TYPE_LIST);
}
} | java |
public double conditionalLogProbGivenPrevious(int[] given, int of) {
if (given.length != windowSize - 1) {
throw new IllegalArgumentException("conditionalLogProbGivenPrevious requires given one less than clique size (" +
windowSize + ") but was " + Arrays.toString(given));
}
// Note: other similar methods could be optimized like this one, but this is the one the CRF uses....
/*
int startIndex = indicesFront(given);
int numCellsToSum = SloppyMath.intPow(numClasses, windowSize - given.length);
double z = ArrayMath.logSum(table, startIndex, startIndex + numCellsToSum);
int i = indexOf(given, of);
System.err.printf("startIndex is %d, numCellsToSum is %d, i is %d (of is %d)%n", startIndex, numCellsToSum, i, of);
*/
int startIndex = indicesFront(given);
double z = ArrayMath.logSum(table, startIndex, startIndex + numClasses);
int i = startIndex + of;
// System.err.printf("startIndex is %d, numCellsToSum is %d, i is %d (of is %d)%n", startIndex, numClasses, i, of);
return table[i] - z;
} | java |
public double[] conditionalLogProbsGivenPrevious(int[] given) {
if (given.length != windowSize - 1) {
throw new IllegalArgumentException("conditionalLogProbsGivenPrevious requires given one less than clique size (" +
windowSize + ") but was " + Arrays.toString(given));
}
double[] result = new double[numClasses];
for (int i = 0; i < numClasses; i++) {
int index = indexOf(given, i);
result[i] = table[index];
}
ArrayMath.logNormalize(result);
return result;
} | java |
public double conditionalLogProbGivenFirst(int given, int[] of) {
if (of.length != windowSize - 1) {
throw new IllegalArgumentException("conditionalLogProbGivenFirst requires of one less than clique size (" +
windowSize + ") but was " + Arrays.toString(of));
}
// compute P(given, of)
int[] labels = new int[windowSize];
labels[0] = given;
System.arraycopy(of, 0, labels, 1, windowSize - 1);
// double probAll = logProb(labels);
double probAll = unnormalizedLogProb(labels);
// compute P(given)
// double probGiven = logProbFront(given);
double probGiven = unnormalizedLogProbFront(given);
// compute P(given, of) / P(given)
return probAll - probGiven;
} | java |
public double unnormalizedConditionalLogProbGivenFirst(int given, int[] of) {
if (of.length != windowSize - 1) {
throw new IllegalArgumentException("unnormalizedConditionalLogProbGivenFirst requires of one less than clique size (" +
windowSize + ") but was " + Arrays.toString(of));
}
// compute P(given, of)
int[] labels = new int[windowSize];
labels[0] = given;
System.arraycopy(of, 0, labels, 1, windowSize - 1);
// double probAll = logProb(labels);
double probAll = unnormalizedLogProb(labels);
// compute P(given)
// double probGiven = logProbFront(given);
// double probGiven = unnormalizedLogProbFront(given);
// compute P(given, of) / P(given)
// return probAll - probGiven;
return probAll;
} | java |
protected String get_object_type()
{
String name = this.getClass().getName();
int index = name.lastIndexOf(".");
if(index > 0)
name = name.substring(index+1);
index = name.lastIndexOf("_stats");
if (index > 0) {
name = name.substring(0, index);
}
return name;
} | java |
protected String unset_string(nitro_service service, String id, options option, String args[]) throws Exception
{
Boolean warning = service.get_warning();
String result = service.get_payload_formatter().unset_string(this, id, option, args, warning);
return result;
} | java |
private base_resource post_requestEx(nitro_service service, options option) throws Exception
{
String sessionid = service.get_sessionid();
String request = resource_to_string(service, sessionid, option);
return post_dataEx(service, request);
} | java |
protected base_response add_resource(nitro_service service,options option) throws Exception
{
if (!service.isLogin() && !this.get_object_type().equals("login"))
service.login();
String sessionid = service.get_sessionid();
String request = resource_to_string(service, sessionid, option);
return post_data(service,request);
} | java |
protected base_response update_resource(nitro_service service,options option) throws Exception
{
if (!service.isLogin() && !this.get_object_type().equals("login"))
service.login();
String sessionid = service.get_sessionid();
String request = resource_to_string(service, sessionid, option);
return put_data(service,request);
} | java |
protected base_response delete_resource(nitro_service service) throws Exception
{
base_response response;
if (!service.isLogin())
service.login();
String str = nitro_util.object_to_string_withoutquotes(this);
response = delete_request(service, str);
return response;
} | java |
protected base_resource[] getfiltered(nitro_service service,options option) throws Exception
{
if (!service.isLogin())
service.login();
base_resource[] response = get_request(service, option);
return response;
} | java |
protected base_resource get_resource(nitro_service service,options option) throws Exception
{
if (!service.isLogin())
service.login();
base_resource[] response = get_request(service, option);
if (response != null) {
return response[0];
}
return null;
} | java |
protected base_resource[] stat_resources(nitro_service service,options option) throws Exception
{
if (!service.isLogin())
service.login();
base_resource[] response = stat_request(service, option);
return response;
} | java |
protected base_resource stat_resource(nitro_service service,options option) throws Exception
{
if (!service.isLogin())
service.login();
base_resource[] response = stat_request(service, option);
if (response != null && response.length > 0)
{
return response[0];
}
return null;
} | java |
public base_resource perform_operationEx(nitro_service service, String action) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
options option = new options();
option.set_action(action);
base_resource response = post_requestEx(service, option);
return response;
} | java |
protected base_response rename_resource(nitro_service service, String newname) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
options option = new options();
option.set_action("rename");
this.set_newname(newname);
base_response response = post_request(service, option);
return response;
} | java |
protected static base_responses update_bulk_request(nitro_service service,base_resource resources[]) throws Exception
{
if (!service.isLogin())
service.login();
String id = service.get_sessionid();
Boolean warning = service.get_warning();
String onerror = service.get_onerror();
String request = service.get_payload_formatter().resource_to_string(resources, id, null, warning, onerror);
base_responses result = put_bulk_data(service, request);
return result;
} | java |
protected static base_responses delete_bulk_request(nitro_service service,base_resource resources[]) throws Exception
{
if (!service.isLogin())
service.login();
options option = new options();
option.set_action("rm");
String type = resources[0].get_object_type();
if (type.indexOf("_binding") > 0)
{
option.set_action("unbind");
}
String id = service.get_sessionid();
String onerror = service.get_onerror();
Boolean warning = service.get_warning();
String request = service.get_payload_formatter().resource_to_string(resources, id, option,warning, onerror);
base_responses result = post_bulk_data(service,request);
return result;
} | java |
private static String _put(nitro_service service, String request) throws Exception {
HttpURLConnection httpURLConnection;
StringBuilder responseStr = new StringBuilder();
try
{
String urlstr;
String ipaddress = service.get_ipaddress();
String version = service.get_version();
String protocol = service.get_protocol();
urlstr = protocol+"://" + ipaddress + "/nitro/" + version + "/config/";
URL url = new URL(urlstr);
httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("PUT");
if (httpURLConnection instanceof HttpsURLConnection)
{
if (service.get_certvalidation()) {
SocketFactory sslSocketFactory = SSLSocketFactory.getDefault();
HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection;
secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory);
if (!service.get_hostnameverification()) {
/*
* override defualt hostNameverifier's verify method
* with EmptyHostnameVerifier's verify method to ignore hostname verification check.
*/
secured.setHostnameVerifier(new EmptyHostnameVerifier());
}
} else {
SSLContext sslContext = SSLContext.getInstance("SSL");
//we are using an empty trust manager, because NetScaler currently presents
//a test certificate not issued by any signing authority, so we need to bypass
//the credentials check
sslContext.init(null, new TrustManager[]{new EmptyTrustManager()}, null);
SocketFactory sslSocketFactory = sslContext.getSocketFactory();
HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection;
secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory);
if (!service.get_hostnameverification()) {
/*
* overriding defualt hostNameverifier's verify method
* with EmptyHostnameVerifier's verify method to bypass hostname check.
*/
secured.setHostnameVerifier(new EmptyHostnameVerifier());
}
}
}
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setUseCaches(false);
httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpURLConnection.setDoOutput(true);
OutputStreamWriter ouput = new OutputStreamWriter(httpURLConnection.getOutputStream());
ouput.write(request);
ouput.flush();
ouput.close();
InputStream input;
try {
input = httpURLConnection.getInputStream();
}
catch (Exception e) {
input = httpURLConnection.getErrorStream();
}
String contentEncoding = httpURLConnection.getContentEncoding();
// get correct input stream for compressed data:
if (contentEncoding != null)
{
if(contentEncoding.equalsIgnoreCase("gzip"))
input = new GZIPInputStream(input); //reads 2 bytes to determine GZIP stream!
else if(contentEncoding.equalsIgnoreCase("deflate"))
input = new InflaterInputStream(input);
}
int numOfTotalBytesRead;
byte [] buffer = new byte[1024];
while ((numOfTotalBytesRead = input.read(buffer, 0, buffer.length)) != -1)
{
responseStr.append(new String(buffer, 0, numOfTotalBytesRead));
}
httpURLConnection.disconnect();
input.close();
}
catch (MalformedURLException mue)
{
throw mue;
}
catch (IOException ioe)
{
throw ioe;
}
catch(Exception e)
{
throw e;
}
return responseStr.toString();
} | java |
public static nsevents[] get(nitro_service service, options option) throws Exception{
nsevents obj = new nsevents();
nsevents[] response = (nsevents[])obj.get_resources(service,option);
return response;
} | java |
public static nsevents[] get(nitro_service service, nsevents_args args) throws Exception{
nsevents obj = new nsevents();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
nsevents[] response = (nsevents[])obj.get_resources(service, option);
return response;
} | java |
public static sslpolicy_sslservice_binding[] get(nitro_service service, String name) throws Exception{
sslpolicy_sslservice_binding obj = new sslpolicy_sslservice_binding();
obj.set_name(name);
sslpolicy_sslservice_binding response[] = (sslpolicy_sslservice_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, lbroute6 resource) throws Exception {
lbroute6 addresource = new lbroute6();
addresource.network = resource.network;
addresource.gatewayname = resource.gatewayname;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, lbroute6 resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
lbroute6 addresources[] = new lbroute6[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new lbroute6();
addresources[i].network = resources[i].network;
addresources[i].gatewayname = resources[i].gatewayname;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static lbroute6[] get(nitro_service service) throws Exception{
lbroute6 obj = new lbroute6();
lbroute6[] response = (lbroute6[])obj.get_resources(service);
return response;
} | java |
public static lbroute6 get(nitro_service service, String network) throws Exception{
lbroute6 obj = new lbroute6();
obj.set_network(network);
lbroute6 response = (lbroute6) obj.get_resource(service);
return response;
} | java |
public static lbroute6[] get(nitro_service service, String network[]) throws Exception{
if (network !=null && network.length>0) {
lbroute6 response[] = new lbroute6[network.length];
lbroute6 obj[] = new lbroute6[network.length];
for (int i=0;i<network.length;i++) {
obj[i] = new lbroute6();
obj[i].set_network(network[i]);
response[i] = (lbroute6) obj[i].get_resource(service);
}
return response;
}
return null;
} | java |
public static base_response update(nitro_service client, l2param resource) throws Exception {
l2param updateresource = new l2param();
updateresource.mbfpeermacupdate = resource.mbfpeermacupdate;
updateresource.maxbridgecollision = resource.maxbridgecollision;
updateresource.bdggrpproxyarp = resource.bdggrpproxyarp;
updateresource.bdgsetting = resource.bdgsetting;
updateresource.garponvridintf = resource.garponvridintf;
updateresource.macmodefwdmypkt = resource.macmodefwdmypkt;
updateresource.usemymac = resource.usemymac;
updateresource.proxyarp = resource.proxyarp;
updateresource.garpreply = resource.garpreply;
updateresource.mbfinstlearning = resource.mbfinstlearning;
updateresource.rstintfonhafo = resource.rstintfonhafo;
updateresource.skipproxyingbsdtraffic = resource.skipproxyingbsdtraffic;
updateresource.returntoethernetsender = resource.returntoethernetsender;
return updateresource.update_resource(client);
} | java |
public static base_response unset(nitro_service client, l2param resource, String[] args) throws Exception{
l2param unsetresource = new l2param();
return unsetresource.unset_resource(client,args);
} | java |
public static l2param get(nitro_service service) throws Exception{
l2param obj = new l2param();
l2param[] response = (l2param[])obj.get_resources(service);
return response[0];
} | java |
public <E> ClassFactory<E> createFactory(String... classes) {
try {
return new ClassFactory<E>(classname, classes);
} catch (ClassCreationException e){
throw e;
} catch (Exception e) {
throw new ClassCreationException(e);
}
} | java |
public <E> ClassFactory<E> createFactory(Object... objects) {
try {
return new ClassFactory<E>(classname, objects);
} catch (ClassCreationException e){
throw e;
} catch (Exception e) {
throw new ClassCreationException(e);
}
} | java |
private static Class <?> type2class(Type type){
if(type instanceof Class <?>){
return (Class <?>) type; //base case
}else if(type instanceof ParameterizedType){
return type2class( ((ParameterizedType) type).getRawType() );
}else if(type instanceof TypeVariable<?>){
return type2class( ((TypeVariable<?>) type).getBounds()[0] );
}else if(type instanceof WildcardType){
return type2class( ((WildcardType) type).getUpperBounds()[0] );
}else{
throw new IllegalArgumentException("Cannot convert type to class: " + type);
}
} | java |
private static final String[] decodeArray(String encoded){
char[] chars = encoded.trim().toCharArray();
//--Parse the String
//(state)
char quoteCloseChar = (char) 0;
List<StringBuilder> terms = new LinkedList<StringBuilder>();
StringBuilder current = new StringBuilder();
//(start/stop overhead)
int start = 0; int end = chars.length;
if(chars[0] == '('){ start += 1; end -= 1; if(chars[end] != ')') throw new IllegalArgumentException("Unclosed paren in encoded array: " + encoded); }
if(chars[0] == '['){ start += 1; end -= 1; if(chars[end] != ']') throw new IllegalArgumentException("Unclosed bracket in encoded array: " + encoded); }
//(finite state automata)
for(int i=start; i<end; i++){
if(chars[i] == '\\'){
//(case: escaped character)
if(i == chars.length - 1) throw new IllegalArgumentException("Last character of encoded pair is escape character: " + encoded);
current.append(chars[i+1]);
i += 1;
} else if(quoteCloseChar != 0){
//(case: in quotes)
if(chars[i] == quoteCloseChar){
quoteCloseChar = (char) 0;
}else{
current.append(chars[i]);
}
}else{
//(case: normal)
if(chars[i] == '"'){ quoteCloseChar = '"';
} else if(chars[i] == '\''){ quoteCloseChar = '\'';
} else if(chars[i] == ','){
//break
terms.add(current);
current = new StringBuilder();
}else{
current.append(chars[i]);
}
}
}
//--Return
if(current.length() > 0) terms.add(current);
String[] rtn = new String[terms.size()];
int i=0;
for(StringBuilder b : terms){
rtn[i] = b.toString().trim();
i += 1;
}
return rtn;
} | java |
public static linkset_binding get(nitro_service service, String id) throws Exception{
linkset_binding obj = new linkset_binding();
obj.set_id(id);
linkset_binding response = (linkset_binding) obj.get_resource(service);
return response;
} | java |
public static base_response enable(nitro_service client, sslfipssimtarget resource) throws Exception {
sslfipssimtarget enableresource = new sslfipssimtarget();
enableresource.keyvector = resource.keyvector;
enableresource.sourcesecret = resource.sourcesecret;
return enableresource.perform_operation(client,"enable");
} | java |
public static base_response init(nitro_service client, sslfipssimtarget resource) throws Exception {
sslfipssimtarget initresource = new sslfipssimtarget();
initresource.certfile = resource.certfile;
initresource.keyvector = resource.keyvector;
initresource.targetsecret = resource.targetsecret;
return initresource.perform_operation(client,"init");
} | java |
public static rewritepolicy_stats[] get(nitro_service service, options option) throws Exception{
rewritepolicy_stats obj = new rewritepolicy_stats();
rewritepolicy_stats[] response = (rewritepolicy_stats[])obj.stat_resources(service,option);
return response;
} | java |
public static rewritepolicy_stats get(nitro_service service, String name) throws Exception{
rewritepolicy_stats obj = new rewritepolicy_stats();
obj.set_name(name);
rewritepolicy_stats response = (rewritepolicy_stats) obj.stat_resource(service);
return response;
} | java |
public static rewritepolicylabel_binding get(nitro_service service, String labelname) throws Exception{
rewritepolicylabel_binding obj = new rewritepolicylabel_binding();
obj.set_labelname(labelname);
rewritepolicylabel_binding response = (rewritepolicylabel_binding) obj.get_resource(service);
return response;
} | java |
public static tmsessionpolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{
tmsessionpolicy_authenticationvserver_binding obj = new tmsessionpolicy_authenticationvserver_binding();
obj.set_name(name);
tmsessionpolicy_authenticationvserver_binding response[] = (tmsessionpolicy_authenticationvserver_binding[]) obj.get_resources(service);
return response;
} | java |
public static authenticationvserver_authenticationsamlpolicy_binding[] get(nitro_service service, String name) throws Exception{
authenticationvserver_authenticationsamlpolicy_binding obj = new authenticationvserver_authenticationsamlpolicy_binding();
obj.set_name(name);
authenticationvserver_authenticationsamlpolicy_binding response[] = (authenticationvserver_authenticationsamlpolicy_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, hanode resource) throws Exception {
hanode addresource = new hanode();
addresource.id = resource.id;
addresource.ipaddress = resource.ipaddress;
addresource.inc = resource.inc;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, hanode resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
hanode addresources[] = new hanode[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new hanode();
addresources[i].id = resources[i].id;
addresources[i].ipaddress = resources[i].ipaddress;
addresources[i].inc = resources[i].inc;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response update(nitro_service client, hanode resource) throws Exception {
hanode updateresource = new hanode();
updateresource.id = resource.id;
updateresource.hastatus = resource.hastatus;
updateresource.hasync = resource.hasync;
updateresource.haprop = resource.haprop;
updateresource.hellointerval = resource.hellointerval;
updateresource.deadinterval = resource.deadinterval;
updateresource.failsafe = resource.failsafe;
updateresource.maxflips = resource.maxflips;
updateresource.maxfliptime = resource.maxfliptime;
updateresource.syncvlan = resource.syncvlan;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, hanode resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
hanode updateresources[] = new hanode[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new hanode();
updateresources[i].id = resources[i].id;
updateresources[i].hastatus = resources[i].hastatus;
updateresources[i].hasync = resources[i].hasync;
updateresources[i].haprop = resources[i].haprop;
updateresources[i].hellointerval = resources[i].hellointerval;
updateresources[i].deadinterval = resources[i].deadinterval;
updateresources[i].failsafe = resources[i].failsafe;
updateresources[i].maxflips = resources[i].maxflips;
updateresources[i].maxfliptime = resources[i].maxfliptime;
updateresources[i].syncvlan = resources[i].syncvlan;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static base_responses unset(nitro_service client, hanode resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
hanode unsetresources[] = new hanode[resources.length];
for (int i=0;i<resources.length;i++){
unsetresources[i] = new hanode();
unsetresources[i].id = resources[i].id;
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java |
public static hanode[] get(nitro_service service) throws Exception{
hanode obj = new hanode();
hanode[] response = (hanode[])obj.get_resources(service);
return response;
} | java |
public static hanode get(nitro_service service, Long id) throws Exception{
hanode obj = new hanode();
obj.set_id(id);
hanode response = (hanode) obj.get_resource(service);
return response;
} | java |
public static hanode[] get(nitro_service service, Long id[]) throws Exception{
if (id !=null && id.length>0) {
hanode response[] = new hanode[id.length];
hanode obj[] = new hanode[id.length];
for (int i=0;i<id.length;i++) {
obj[i] = new hanode();
obj[i].set_id(id[i]);
response[i] = (hanode) obj[i].get_resource(service);
}
return response;
}
return null;
} | java |
public static base_response update(nitro_service client, aaaradiusparams resource) throws Exception {
aaaradiusparams updateresource = new aaaradiusparams();
updateresource.serverip = resource.serverip;
updateresource.serverport = resource.serverport;
updateresource.authtimeout = resource.authtimeout;
updateresource.radkey = resource.radkey;
updateresource.radnasip = resource.radnasip;
updateresource.radnasid = resource.radnasid;
updateresource.radvendorid = resource.radvendorid;
updateresource.radattributetype = resource.radattributetype;
updateresource.radgroupsprefix = resource.radgroupsprefix;
updateresource.radgroupseparator = resource.radgroupseparator;
updateresource.passencoding = resource.passencoding;
updateresource.ipvendorid = resource.ipvendorid;
updateresource.ipattributetype = resource.ipattributetype;
updateresource.accounting = resource.accounting;
updateresource.pwdvendorid = resource.pwdvendorid;
updateresource.pwdattributetype = resource.pwdattributetype;
updateresource.defaultauthenticationgroup = resource.defaultauthenticationgroup;
updateresource.callingstationid = resource.callingstationid;
return updateresource.update_resource(client);
} | java |
public static base_response unset(nitro_service client, aaaradiusparams resource, String[] args) throws Exception{
aaaradiusparams unsetresource = new aaaradiusparams();
return unsetresource.unset_resource(client,args);
} | java |
public static aaaradiusparams get(nitro_service service) throws Exception{
aaaradiusparams obj = new aaaradiusparams();
aaaradiusparams[] response = (aaaradiusparams[])obj.get_resources(service);
return response[0];
} | java |
public static base_response flush(nitro_service client, nssurgeq resource) throws Exception {
nssurgeq flushresource = new nssurgeq();
flushresource.name = resource.name;
flushresource.servername = resource.servername;
flushresource.port = resource.port;
return flushresource.perform_operation(client,"flush");
} | java |
public static MtasTokenString getToken(IndexInput inObject, IndexInput inTerm,
Long ref) throws IOException {
MtasTokenString token = null;
try {
inObject.seek(ref);
token = new MtasTokenString(null, "");
token.setId(inObject.readVInt());
token.setTokenRef(ref);
int objectFlags = inObject.readVInt();
int[] positions = null;
if ((objectFlags & MTAS_OBJECT_HAS_PARENT) == MTAS_OBJECT_HAS_PARENT) {
int parentId = inObject.readVInt();
token.setParentId(parentId);
}
if ((objectFlags
& MTAS_OBJECT_HAS_POSITION_RANGE) == MTAS_OBJECT_HAS_POSITION_RANGE) {
int positionStart = inObject.readVInt();
int positionEnd = positionStart + inObject.readVInt();
token.addPositionRange(positionStart, positionEnd);
} else if ((objectFlags
& MTAS_OBJECT_HAS_POSITION_SET) == MTAS_OBJECT_HAS_POSITION_SET) {
int size = inObject.readVInt();
int tmpPrevious = 0;
positions = new int[size];
for (int t = 0; t < size; t++) {
int position = tmpPrevious + inObject.readVInt();
tmpPrevious = position;
positions[t] = position;
}
token.addPositions(positions);
} else {
int position = inObject.readVInt();
token.addPosition(position);
}
if ((objectFlags & MTAS_OBJECT_HAS_OFFSET) == MTAS_OBJECT_HAS_OFFSET) {
int offsetStart = inObject.readVInt();
int offsetEnd = offsetStart + inObject.readVInt();
token.setOffset(offsetStart, offsetEnd);
}
if ((objectFlags
& MTAS_OBJECT_HAS_REALOFFSET) == MTAS_OBJECT_HAS_REALOFFSET) {
int realOffsetStart = inObject.readVInt();
int realOffsetEnd = realOffsetStart + inObject.readVInt();
token.setRealOffset(realOffsetStart, realOffsetEnd);
}
if ((objectFlags & MTAS_OBJECT_HAS_PAYLOAD) == MTAS_OBJECT_HAS_PAYLOAD) {
int length = inObject.readVInt();
byte[] mtasPayload = new byte[length];
inObject.readBytes(mtasPayload, 0, length);
token.setPayload(new BytesRef(mtasPayload));
}
Long termRef = inObject.readVLong();
inTerm.seek(termRef);
token.setTermRef(termRef);
token.setValue(inTerm.readString());
} catch (Exception e) {
throw new IOException(e);
}
return token;
} | java |
public static String getTerm(IndexInput inTerm, Long ref) throws IOException {
try {
inTerm.seek(ref);
return inTerm.readString();
} catch (Exception e) {
throw new IOException(e);
}
} | java |
public void colorChannel(String channel, Color color){
if(this.channelColors == null){
this.channelColors = new HashMap<String,Color>();
}
this.channelColors.put(channel.toLowerCase(),color);
} | java |
public void styleChannel(String channel, Style style){
if(this.channelStyles == null){
this.channelStyles = new HashMap<String,Style>();
}
this.channelStyles.put(channel.toLowerCase(),style);
} | java |
protected StringBuilder style(StringBuilder b, String line, Color color, Style style){
if(color != Color.NONE || style != Style.NONE){
b.append(color.ansiCode);
b.append(style.ansiCode);
b.append(line);
b.append("\033[0m");
} else {
b.append(line);
}
return b;
} | java |
public static protocoltcp_stats get(nitro_service service) throws Exception{
protocoltcp_stats obj = new protocoltcp_stats();
protocoltcp_stats[] response = (protocoltcp_stats[])obj.stat_resources(service);
return response[0];
} | java |
public static responderpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{
responderpolicy_lbvserver_binding obj = new responderpolicy_lbvserver_binding();
obj.set_name(name);
responderpolicy_lbvserver_binding response[] = (responderpolicy_lbvserver_binding[]) obj.get_resources(service);
return response;
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.