repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/MultiTenantExternalUserCreateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the MultiTenantUserCreateRequest NeXpose API request for user's that are authenticated by an external resource. * The request leaves out the password field since this causes a server side failure. * * @author Leonardo Varela */ public class MultiTenantExternalUserCreateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new MultiTenantUserCreateRequest NeXpose API Request. Sets the first API supported version to 1.2 and * the last supported version to 1.2. * * NOTE: All parameters are strings or generators, since we want to be able to test edge cases and simulate incorrect * usage of the tool for robustness * * @param sessionId the session to be used if different from the currently acquired one. This is a String of 40 * characters. * @param syncId The String that uniquely identifies the response associated with the request sent. This field is * optional. * @param fullName The full name of the Multi Tenant User. * @param authsrcid The authentication source used by the Multi Tenant User. * @param email The email of the Multi Tenant User. * @param enabled whether the Multi Tenant User is enabled or not. * @param userName the user name or diplay name of the Multi Tenant User. * @param superuser the flag that tells whether a Multi Tenant User is a super user or not. * @param siloAccessGenerator the generator of the silos accesses. */ public MultiTenantExternalUserCreateRequest( String sessionId, String syncId, String fullName, String authsrcid, String email, String enabled, String userName, String superuser, IContentGenerator siloAccessGenerator) { super(sessionId, syncId); set("authSrcId", authsrcid); set("email", email); set("enabled", enabled); set("full-name", fullName); set("user-name", userName); set("superuser", superuser); set("siloAccessGenerator", siloAccessGenerator);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/MultiTenantExternalUserCreateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the MultiTenantUserCreateRequest NeXpose API request for user's that are authenticated by an external resource. * The request leaves out the password field since this causes a server side failure. * * @author Leonardo Varela */ public class MultiTenantExternalUserCreateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new MultiTenantUserCreateRequest NeXpose API Request. Sets the first API supported version to 1.2 and * the last supported version to 1.2. * * NOTE: All parameters are strings or generators, since we want to be able to test edge cases and simulate incorrect * usage of the tool for robustness * * @param sessionId the session to be used if different from the currently acquired one. This is a String of 40 * characters. * @param syncId The String that uniquely identifies the response associated with the request sent. This field is * optional. * @param fullName The full name of the Multi Tenant User. * @param authsrcid The authentication source used by the Multi Tenant User. * @param email The email of the Multi Tenant User. * @param enabled whether the Multi Tenant User is enabled or not. * @param userName the user name or diplay name of the Multi Tenant User. * @param superuser the flag that tells whether a Multi Tenant User is a super user or not. * @param siloAccessGenerator the generator of the silos accesses. */ public MultiTenantExternalUserCreateRequest( String sessionId, String syncId, String fullName, String authsrcid, String email, String enabled, String userName, String superuser, IContentGenerator siloAccessGenerator) { super(sessionId, syncId); set("authSrcId", authsrcid); set("email", email); set("enabled", enabled); set("full-name", fullName); set("user-name", userName); set("superuser", superuser); set("siloAccessGenerator", siloAccessGenerator);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/MultiTenantUserDeleteRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The multi-tenant user deletes request. * * @author Christopher Lee. */ public class MultiTenantUserDeleteRequest extends TemplateAPIRequest { /** * Constructs the profile config request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param userID The multi-user tenant ID. */ public MultiTenantUserDeleteRequest(String sessionID, String syncID, String userID) { super(sessionID, syncID); set("user-id", userID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/MultiTenantUserDeleteRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The multi-tenant user deletes request. * * @author Christopher Lee. */ public class MultiTenantUserDeleteRequest extends TemplateAPIRequest { /** * Constructs the profile config request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param userID The multi-user tenant ID. */ public MultiTenantUserDeleteRequest(String sessionID, String syncID, String userID) { super(sessionID, syncID); set("user-id", userID);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/UserAuthenticatorListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the UserAuthenticatorListingRequest NeXpose API request. * * @author Murali Rongali */ public class UserAuthenticatorListingRequest extends TemplateAPIRequest { /** * Creates a new UserAuthenticatorListingRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public UserAuthenticatorListingRequest(String sessionID, String syncID) { super(sessionID, syncID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/UserAuthenticatorListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the UserAuthenticatorListingRequest NeXpose API request. * * @author Murali Rongali */ public class UserAuthenticatorListingRequest extends TemplateAPIRequest { /** * Creates a new UserAuthenticatorListingRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public UserAuthenticatorListingRequest(String sessionID, String syncID) { super(sessionID, syncID);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiteScanRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the SiteScanRequest NeXpose API request. * * @author Leonardo Varela */ public class SiteScanRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new SiteScanRequest NeXpose API Request. Sets the first API * supported version to 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param siteId the positive integer that represents the site id of the * site to be scanned. */ public SiteScanRequest(String sessionId, String syncId, String siteId) { super(sessionId, syncId); set("siteId", siteId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/SiteScanRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the SiteScanRequest NeXpose API request. * * @author Leonardo Varela */ public class SiteScanRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new SiteScanRequest NeXpose API Request. Sets the first API * supported version to 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param siteId the positive integer that represents the site id of the * site to be scanned. */ public SiteScanRequest(String sessionId, String syncId, String siteId) { super(sessionId, syncId); set("siteId", siteId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/VulnerabilityExceptionDeleteRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link VulnerabilityExceptionDeleteRequest} Nexpose API request. * * @author Murali Rongali */ public class VulnerabilityExceptionDeleteRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link VulnerabilityExceptionDeleteRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param exceptionId the id of the Vulnerability exception. */ public VulnerabilityExceptionDeleteRequest(String sessionId, String syncId, String exceptionId) { super(sessionId, syncId); set("exceptionId", exceptionId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/VulnerabilityExceptionDeleteRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link VulnerabilityExceptionDeleteRequest} Nexpose API request. * * @author Murali Rongali */ public class VulnerabilityExceptionDeleteRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link VulnerabilityExceptionDeleteRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param exceptionId the id of the Vulnerability exception. */ public VulnerabilityExceptionDeleteRequest(String sessionId, String syncId, String exceptionId) { super(sessionId, syncId); set("exceptionId", exceptionId);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/RawXMLAPIRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates any request that come in an String. This class is used for both: * extreme cases testing, and unimplemented(in the api-client library) * API requests. * * @author Leonardo Varela */ public class RawXMLAPIRequest extends TemplateAPIRequest implements APIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new RawXMLAPIRequest NeXpose API Request. * * @param rawXML The XML string to be sent to the NeXpose Console * @param version the version of the API to use for this RawXML request. */
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/RawXMLAPIRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates any request that come in an String. This class is used for both: * extreme cases testing, and unimplemented(in the api-client library) * API requests. * * @author Leonardo Varela */ public class RawXMLAPIRequest extends TemplateAPIRequest implements APIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new RawXMLAPIRequest NeXpose API Request. * * @param rawXML The XML string to be sent to the NeXpose Console * @param version the version of the API to use for this RawXML request. */
public RawXMLAPIRequest(String rawXML, APISupportedVersion version)
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ReportTemplateListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportTemplateListingRequest NeXpose API request. * * @author Murali Rongali */ public class ReportTemplateListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new ReportTemplateListingRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public ReportTemplateListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/ReportTemplateListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportTemplateListingRequest NeXpose API request. * * @author Murali Rongali */ public class ReportTemplateListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new ReportTemplateListingRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public ReportTemplateListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/DiscoveryConnectionConnectRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link DiscoveryConnectionConnectRequest} Nexpose API request. * * @author Murali Rongali */ public class DiscoveryConnectionConnectRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link DiscoveryConnectionConnectRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param connectionID the id of the DiscoveryConnection. */ public DiscoveryConnectionConnectRequest(String sessionId, String syncId, String connectionID) { super(sessionId, syncId); set("connectionID", connectionID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/DiscoveryConnectionConnectRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link DiscoveryConnectionConnectRequest} Nexpose API request. * * @author Murali Rongali */ public class DiscoveryConnectionConnectRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link DiscoveryConnectionConnectRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param connectionID the id of the DiscoveryConnection. */ public DiscoveryConnectionConnectRequest(String sessionId, String syncId, String connectionID) { super(sessionId, syncId); set("connectionID", connectionID);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ScanPauseRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the ScanPauseRequest NeXpose API request. * * @author Leonardo Varela */ public class ScanPauseRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a ScanPauseRequest NeXpose API Request. Sets the first API * supported version to 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param scanId the positive integer that represents the scan id of the * scan to be stopped. */ public ScanPauseRequest(String sessionId, String syncId, String scanId) { super(sessionId, syncId); set("scanId", scanId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/ScanPauseRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the ScanPauseRequest NeXpose API request. * * @author Leonardo Varela */ public class ScanPauseRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a ScanPauseRequest NeXpose API Request. Sets the first API * supported version to 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param scanId the positive integer that represents the scan id of the * scan to be stopped. */ public ScanPauseRequest(String sessionId, String syncId, String scanId) { super(sessionId, syncId); set("scanId", scanId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ReportListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportListingRequest NeXpose API request. * * @author Murali Rongali */ public class ReportListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new ReportListingRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public ReportListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/ReportListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportListingRequest NeXpose API request. * * @author Murali Rongali */ public class ReportListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new ReportListingRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public ReportListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/MultiTenantUserConfigRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The multi-tenant user config request. * * @author Christopher Lee. */ public class MultiTenantUserConfigRequest extends TemplateAPIRequest { /** * Constructs the profile config request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param userID The multi-user tenant ID. */ public MultiTenantUserConfigRequest(String sessionID, String syncID, String userID) { super(sessionID, syncID); set("user-id", userID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/MultiTenantUserConfigRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The multi-tenant user config request. * * @author Christopher Lee. */ public class MultiTenantUserConfigRequest extends TemplateAPIRequest { /** * Constructs the profile config request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param userID The multi-user tenant ID. */ public MultiTenantUserConfigRequest(String sessionID, String syncID, String userID) { super(sessionID, syncID); set("user-id", userID);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/EngineDeleteRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EngineDeleteRequest NeXpose API request. * * @author Leonardo Varela */ public class EngineDeleteRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new Engine deletion Request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param engineId the engine id to to be deleted */ public EngineDeleteRequest(String sessionId, String syncId, String engineId, String scope) { super(sessionId, syncId); set("engineId", engineId); set("scope", scope);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/EngineDeleteRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EngineDeleteRequest NeXpose API request. * * @author Leonardo Varela */ public class EngineDeleteRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new Engine deletion Request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param engineId the engine id to to be deleted */ public EngineDeleteRequest(String sessionId, String syncId, String engineId, String scope) { super(sessionId, syncId); set("engineId", engineId); set("scope", scope);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/DeviceDeleteRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the DeviceDeleteRequest NeXpose API request. * * @author Murali Rongali */ public class DeviceDeleteRequest extends TemplateAPIRequest { /** * Creates a new DeviceDeleteRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param deviceId the id of the device. */ public DeviceDeleteRequest(String sessionID, String syncID, String deviceId) { super(sessionID, syncID); set("deviceId", deviceId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/DeviceDeleteRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the DeviceDeleteRequest NeXpose API request. * * @author Murali Rongali */ public class DeviceDeleteRequest extends TemplateAPIRequest { /** * Creates a new DeviceDeleteRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param deviceId the id of the device. */ public DeviceDeleteRequest(String sessionID, String syncID, String deviceId) { super(sessionID, syncID); set("deviceId", deviceId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ReportAdhocGenerateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportAdhocGenerateRequest NeXpose API request. * * @author Murali Rongali */ public class ReportAdhocGenerateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ReportAdhocGenerateRequest with its associated API version * information. * * @param sessionId The session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId The sync id to identify the response. May be {@code null}. * @param reportFormat The format of the Adhoc report. * @param reportTemplateId The id of the report template. * @param compareTo The date to use as the baseline scan in ISO 8601 format, like YYYYMMDDTHHMMSSss. * @param filtersGenerator a Generator that knows how to output filter section of * filter sections that are to be associated with the Adhoc report generate. e.g. * &lt;Filter id="1" type="site"/&gt;. Please see * {@link ReportFiltersContentGenerator} for a reference * implementation. For QA testing you should construct your own * {@link IContentGenerator} to generate all the edge test cases you * can think of. */ public ReportAdhocGenerateRequest( String sessionId, String syncId, String reportFormat, String reportTemplateId, String compareTo,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/ReportAdhocGenerateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportAdhocGenerateRequest NeXpose API request. * * @author Murali Rongali */ public class ReportAdhocGenerateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ReportAdhocGenerateRequest with its associated API version * information. * * @param sessionId The session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId The sync id to identify the response. May be {@code null}. * @param reportFormat The format of the Adhoc report. * @param reportTemplateId The id of the report template. * @param compareTo The date to use as the baseline scan in ISO 8601 format, like YYYYMMDDTHHMMSSss. * @param filtersGenerator a Generator that knows how to output filter section of * filter sections that are to be associated with the Adhoc report generate. e.g. * &lt;Filter id="1" type="site"/&gt;. Please see * {@link ReportFiltersContentGenerator} for a reference * implementation. For QA testing you should construct your own * {@link IContentGenerator} to generate all the edge test cases you * can think of. */ public ReportAdhocGenerateRequest( String sessionId, String syncId, String reportFormat, String reportTemplateId, String compareTo,
IContentGenerator filtersGenerator)
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ReportAdhocGenerateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportAdhocGenerateRequest NeXpose API request. * * @author Murali Rongali */ public class ReportAdhocGenerateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ReportAdhocGenerateRequest with its associated API version * information. * * @param sessionId The session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId The sync id to identify the response. May be {@code null}. * @param reportFormat The format of the Adhoc report. * @param reportTemplateId The id of the report template. * @param compareTo The date to use as the baseline scan in ISO 8601 format, like YYYYMMDDTHHMMSSss. * @param filtersGenerator a Generator that knows how to output filter section of * filter sections that are to be associated with the Adhoc report generate. e.g. * &lt;Filter id="1" type="site"/&gt;. Please see * {@link ReportFiltersContentGenerator} for a reference * implementation. For QA testing you should construct your own * {@link IContentGenerator} to generate all the edge test cases you * can think of. */ public ReportAdhocGenerateRequest( String sessionId, String syncId, String reportFormat, String reportTemplateId, String compareTo, IContentGenerator filtersGenerator) { super(sessionId, syncId); set("reportFormat", reportFormat); set("reportTemplateId", reportTemplateId); set("compareTo", compareTo); set("filtersGenerator", filtersGenerator);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/ReportAdhocGenerateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportAdhocGenerateRequest NeXpose API request. * * @author Murali Rongali */ public class ReportAdhocGenerateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ReportAdhocGenerateRequest with its associated API version * information. * * @param sessionId The session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId The sync id to identify the response. May be {@code null}. * @param reportFormat The format of the Adhoc report. * @param reportTemplateId The id of the report template. * @param compareTo The date to use as the baseline scan in ISO 8601 format, like YYYYMMDDTHHMMSSss. * @param filtersGenerator a Generator that knows how to output filter section of * filter sections that are to be associated with the Adhoc report generate. e.g. * &lt;Filter id="1" type="site"/&gt;. Please see * {@link ReportFiltersContentGenerator} for a reference * implementation. For QA testing you should construct your own * {@link IContentGenerator} to generate all the edge test cases you * can think of. */ public ReportAdhocGenerateRequest( String sessionId, String syncId, String reportFormat, String reportTemplateId, String compareTo, IContentGenerator filtersGenerator) { super(sessionId, syncId); set("reportFormat", reportFormat); set("reportTemplateId", reportTemplateId); set("compareTo", compareTo); set("filtersGenerator", filtersGenerator);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/VulnerabilityExceptionRecallRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link VulnerabilityExceptionRecallRequest} Nexpose API request. * * @author Murali Rongali */ public class VulnerabilityExceptionRecallRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link VulnerabilityExceptionRecallRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param exceptionId the id of the Vulnerability exception. */ public VulnerabilityExceptionRecallRequest(String sessionId, String syncId, String exceptionId) { super(sessionId, syncId); set("exceptionId", exceptionId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/VulnerabilityExceptionRecallRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link VulnerabilityExceptionRecallRequest} Nexpose API request. * * @author Murali Rongali */ public class VulnerabilityExceptionRecallRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link VulnerabilityExceptionRecallRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param exceptionId the id of the Vulnerability exception. */ public VulnerabilityExceptionRecallRequest(String sessionId, String syncId, String exceptionId) { super(sessionId, syncId); set("exceptionId", exceptionId);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiteListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the SiteListingRequest NeXpose API request. * * @author Leonardo Varela */ public class SiteListingRequest extends TemplateAPIRequest { /** * Creates a new SiteListingRequest NeXpose API Request. Sets the first API * supported version to 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. */ public SiteListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/SiteListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the SiteListingRequest NeXpose API request. * * @author Leonardo Varela */ public class SiteListingRequest extends TemplateAPIRequest { /** * Creates a new SiteListingRequest NeXpose API Request. Sets the first API * supported version to 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. */ public SiteListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/EngineListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EngineListingRequest NeXpose API request. * * @author Leonardo Varela */ public class EngineListingRequest extends TemplateAPIRequest { /** * Constructs an Engine Listing request with its associated API versioning * information. * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public EngineListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/EngineListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EngineListingRequest NeXpose API request. * * @author Leonardo Varela */ public class EngineListingRequest extends TemplateAPIRequest { /** * Constructs an Engine Listing request with its associated API versioning * information. * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public EngineListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
m_firstSupportedVersion = APISupportedVersion.V1_1;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/domain/EngineSummary.java
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // }
import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api.domain; /** * Represents an Engine retrieved by the engine listing API request. * * @author Leonardo Varela */ public class EngineSummary extends BaseElement { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Retrieves the id of the Engine * @return the m_id attribute which represents the id of the engine. */ public int getId() { return m_id; } /** * Retrieves the name of the Engine * @return the m_name attribute which represents the name of the engine. */ public String getName() { return m_name; } /** * Retrieves the address of the engine * @return the m_address attribute which represents the address of the engine. */ public String getAddress() { return m_address; } /** * Retrieves the port of the engine * @return the m_port attribute which represents the port associated with the * engine. */ public int getPort() { return m_port; } /** * Retrieves the status of the engine * @return the m_status attribute which represents the status associated with * the engine. */ public String getStatus() { return m_status; } /** * Creates a summary out of an element SiteSummary * * @throws APIException When there is a problem parsing the element's * attributes. */
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // } // Path: src/main/java/org/rapid7/nexpose/api/domain/EngineSummary.java import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api.domain; /** * Represents an Engine retrieved by the engine listing API request. * * @author Leonardo Varela */ public class EngineSummary extends BaseElement { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Retrieves the id of the Engine * @return the m_id attribute which represents the id of the engine. */ public int getId() { return m_id; } /** * Retrieves the name of the Engine * @return the m_name attribute which represents the name of the engine. */ public String getName() { return m_name; } /** * Retrieves the address of the engine * @return the m_address attribute which represents the address of the engine. */ public String getAddress() { return m_address; } /** * Retrieves the port of the engine * @return the m_port attribute which represents the port associated with the * engine. */ public int getPort() { return m_port; } /** * Retrieves the status of the engine * @return the m_status attribute which represents the status associated with * the engine. */ public String getStatus() { return m_status; } /** * Creates a summary out of an element SiteSummary * * @throws APIException When there is a problem parsing the element's * attributes. */
public EngineSummary(Element siteSummaryElement) throws APIException
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/UserDeleteRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2010, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the UserDeleteRequest NeXpose API request. * * @author Leonardo Varela */ public class UserDeleteRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new UserDeleteRequest NeXpose API Request. Sets the first API * supported version to 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param userId the non negative integer that represents the user id of the * user to be deleted. */ public UserDeleteRequest(String sessionId, String syncId, String userId) { super(sessionId, syncId); set("userId", userId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/UserDeleteRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2010, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the UserDeleteRequest NeXpose API request. * * @author Leonardo Varela */ public class UserDeleteRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new UserDeleteRequest NeXpose API Request. Sets the first API * supported version to 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param userId the non negative integer that represents the user id of the * user to be deleted. */ public UserDeleteRequest(String sessionId, String syncId, String userId) { super(sessionId, syncId); set("userId", userId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloProfileUpdateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Silo profile update request template. * * @author Christopher Lee. * */ public class SiloProfileUpdateRequest extends TemplateAPIRequest { /** * Constructs the silo profile update request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param hasGlobalReportTemplates "true" iff the silo should have global report templates. * @param hasGlobalEngines "true" iff the silo has access to global scan engines. * @param hasGlobalScanTemplates "true" iff the silo has access to global scan templates. * @param hasLicensedModules "true" iff the silo has licensed modules. * @param description The silo description. The description for the silo being defined. * @param id The silo id. * @param name The silo name. * @param globalReportTemplates The global report template * @param globalScanEngines The global scan engine. * @param globalScanTemplates The global scan template. * @param licensedModules The license module. */ public SiloProfileUpdateRequest( String sessionID, String syncID, String hasGlobalReportTemplates, String hasGlobalEngines, String hasGlobalScanTemplates, String hasLicensedModules, String description, String id, String name,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/SiloProfileUpdateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Silo profile update request template. * * @author Christopher Lee. * */ public class SiloProfileUpdateRequest extends TemplateAPIRequest { /** * Constructs the silo profile update request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param hasGlobalReportTemplates "true" iff the silo should have global report templates. * @param hasGlobalEngines "true" iff the silo has access to global scan engines. * @param hasGlobalScanTemplates "true" iff the silo has access to global scan templates. * @param hasLicensedModules "true" iff the silo has licensed modules. * @param description The silo description. The description for the silo being defined. * @param id The silo id. * @param name The silo name. * @param globalReportTemplates The global report template * @param globalScanEngines The global scan engine. * @param globalScanTemplates The global scan template. * @param licensedModules The license module. */ public SiloProfileUpdateRequest( String sessionID, String syncID, String hasGlobalReportTemplates, String hasGlobalEngines, String hasGlobalScanTemplates, String hasLicensedModules, String description, String id, String name,
IContentGenerator globalReportTemplates,
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloProfileUpdateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Silo profile update request template. * * @author Christopher Lee. * */ public class SiloProfileUpdateRequest extends TemplateAPIRequest { /** * Constructs the silo profile update request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param hasGlobalReportTemplates "true" iff the silo should have global report templates. * @param hasGlobalEngines "true" iff the silo has access to global scan engines. * @param hasGlobalScanTemplates "true" iff the silo has access to global scan templates. * @param hasLicensedModules "true" iff the silo has licensed modules. * @param description The silo description. The description for the silo being defined. * @param id The silo id. * @param name The silo name. * @param globalReportTemplates The global report template * @param globalScanEngines The global scan engine. * @param globalScanTemplates The global scan template. * @param licensedModules The license module. */ public SiloProfileUpdateRequest( String sessionID, String syncID, String hasGlobalReportTemplates, String hasGlobalEngines, String hasGlobalScanTemplates, String hasLicensedModules, String description, String id, String name, IContentGenerator globalReportTemplates, IContentGenerator globalScanEngines, IContentGenerator globalScanTemplates, IContentGenerator licensedModules) { super(sessionID, syncID); set("hasGlobalReportTemplates", hasGlobalReportTemplates); set("hasGlobalEngines", hasGlobalEngines); set("hasGlobalScanTemplates", hasGlobalScanTemplates); set("hasLicensedModules", hasLicensedModules); set("description", description); set("id", id); set("name", name); set("globalReportTemplate", globalReportTemplates); set("globalScanEngine", globalScanEngines); set("globalScanTemplate", globalScanTemplates); set("licensedModule", licensedModules);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/SiloProfileUpdateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Silo profile update request template. * * @author Christopher Lee. * */ public class SiloProfileUpdateRequest extends TemplateAPIRequest { /** * Constructs the silo profile update request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param hasGlobalReportTemplates "true" iff the silo should have global report templates. * @param hasGlobalEngines "true" iff the silo has access to global scan engines. * @param hasGlobalScanTemplates "true" iff the silo has access to global scan templates. * @param hasLicensedModules "true" iff the silo has licensed modules. * @param description The silo description. The description for the silo being defined. * @param id The silo id. * @param name The silo name. * @param globalReportTemplates The global report template * @param globalScanEngines The global scan engine. * @param globalScanTemplates The global scan template. * @param licensedModules The license module. */ public SiloProfileUpdateRequest( String sessionID, String syncID, String hasGlobalReportTemplates, String hasGlobalEngines, String hasGlobalScanTemplates, String hasLicensedModules, String description, String id, String name, IContentGenerator globalReportTemplates, IContentGenerator globalScanEngines, IContentGenerator globalScanTemplates, IContentGenerator licensedModules) { super(sessionID, syncID); set("hasGlobalReportTemplates", hasGlobalReportTemplates); set("hasGlobalEngines", hasGlobalEngines); set("hasGlobalScanTemplates", hasGlobalScanTemplates); set("hasLicensedModules", hasLicensedModules); set("description", description); set("id", id); set("name", name); set("globalReportTemplate", globalReportTemplates); set("globalScanEngine", globalScanEngines); set("globalScanTemplate", globalScanTemplates); set("licensedModule", licensedModules);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/LoginRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the LoginRequest NeXpose API request. * * @author Leonardo Varela */ public class LoginRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new LoginRequest NeXpose API request. * * @param syncId the syncId to identify the request/response pair. * @param username the username to log in with. * @param password the password to log in with. * @param siloId the id of the silo. */ public LoginRequest(String syncId, String username, String password, String siloId) { super(null, syncId); set("username", username); set("password", password); set("siloId", siloId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/LoginRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the LoginRequest NeXpose API request. * * @author Leonardo Varela */ public class LoginRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new LoginRequest NeXpose API request. * * @param syncId the syncId to identify the request/response pair. * @param username the username to log in with. * @param password the password to log in with. * @param siloId the id of the silo. */ public LoginRequest(String syncId, String username, String password, String siloId) { super(null, syncId); set("username", username); set("password", password); set("siloId", siloId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ConsoleCommandRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ConsoleCommandRequest NeXpose API request. * * @author Murali Rongali */ public class ConsoleCommandRequest extends TemplateAPIRequest { /** * Creates a new ConsoleCommandRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param command the Nexpose console command. */ public ConsoleCommandRequest(String sessionID, String syncID, String command) { super(sessionID, syncID); set("command", command);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/ConsoleCommandRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ConsoleCommandRequest NeXpose API request. * * @author Murali Rongali */ public class ConsoleCommandRequest extends TemplateAPIRequest { /** * Creates a new ConsoleCommandRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param command the Nexpose console command. */ public ConsoleCommandRequest(String sessionID, String syncID, String command) { super(sessionID, syncID); set("command", command);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ReportSaveRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; import org.rapid7.nexpose.api.generators.ReportTemplateIDGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The report save request template. * * @author Allen Jensen. */ public class ReportSaveRequest extends TemplateAPIRequest { /** * Constructs the report delete request. * * @param reportID The report ID. * @param sessionID The session ID. * @param syncID The sync ID. */ public ReportSaveRequest(String sessionID, String syncID, String generateNow, String reportID, String name, String templateID, String format, String owner, String timezone, String description,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/ReportSaveRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; import org.rapid7.nexpose.api.generators.ReportTemplateIDGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The report save request template. * * @author Allen Jensen. */ public class ReportSaveRequest extends TemplateAPIRequest { /** * Constructs the report delete request. * * @param reportID The report ID. * @param sessionID The session ID. * @param syncID The sync ID. */ public ReportSaveRequest(String sessionID, String syncID, String generateNow, String reportID, String name, String templateID, String format, String owner, String timezone, String description,
IContentGenerator filtersGenerator,
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ReportSaveRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; import org.rapid7.nexpose.api.generators.ReportTemplateIDGenerator;
String format, String owner, String timezone, String description, IContentGenerator filtersGenerator, IContentGenerator baselineGenerator, IContentGenerator generateGenerator, IContentGenerator deliveryGenerator, IContentGenerator dbExportGenerator) { super(sessionID, syncID); ReportTemplateIDGenerator templateIDGenerator = new ReportTemplateIDGenerator(templateID); set("generate-now",generateNow); set("id", reportID); set("name", name); // Special case - must not be empty string, so have to use a generator. set("templateIDGenerator", templateIDGenerator); set("format", format); set("owner", owner); set("timezone", timezone); set("description", description); set("filtersGenerator", filtersGenerator); set("baselineGenerator", baselineGenerator); // Not currently implemented set("generateGenerator", generateGenerator); // Not currently implemented set("deliveryGenerator", deliveryGenerator); // Partial implementation - only supports store on server in DB set("dbExportGenerator", dbExportGenerator);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/ReportSaveRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; import org.rapid7.nexpose.api.generators.ReportTemplateIDGenerator; String format, String owner, String timezone, String description, IContentGenerator filtersGenerator, IContentGenerator baselineGenerator, IContentGenerator generateGenerator, IContentGenerator deliveryGenerator, IContentGenerator dbExportGenerator) { super(sessionID, syncID); ReportTemplateIDGenerator templateIDGenerator = new ReportTemplateIDGenerator(templateID); set("generate-now",generateNow); set("id", reportID); set("name", name); // Special case - must not be empty string, so have to use a generator. set("templateIDGenerator", templateIDGenerator); set("format", format); set("owner", owner); set("timezone", timezone); set("description", description); set("filtersGenerator", filtersGenerator); set("baselineGenerator", baselineGenerator); // Not currently implemented set("generateGenerator", generateGenerator); // Not currently implemented set("deliveryGenerator", deliveryGenerator); // Partial implementation - only supports store on server in DB set("dbExportGenerator", dbExportGenerator);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/AssetGroupDeleteRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the AssetGroupDeleteRequest NeXpose API request. * * @author Leonardo Varela */ public class AssetGroupDeleteRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new AssetGroupDeleteRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param assetGroupId the id of the asset group to delete. */ public AssetGroupDeleteRequest(String sessionId, String syncId, String assetGroupId) { super(sessionId, syncId); set("assetGroupId", assetGroupId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/AssetGroupDeleteRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the AssetGroupDeleteRequest NeXpose API request. * * @author Leonardo Varela */ public class AssetGroupDeleteRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new AssetGroupDeleteRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param assetGroupId the id of the asset group to delete. */ public AssetGroupDeleteRequest(String sessionId, String syncId, String assetGroupId) { super(sessionId, syncId); set("assetGroupId", assetGroupId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/TicketListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketListingRequest NeXpose API request. * * @author Murali Rongali */ public class TicketListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket listing request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param filtersGenerator the content generator instance. May be {@code null}. */
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/TicketListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketListingRequest NeXpose API request. * * @author Murali Rongali */ public class TicketListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket listing request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param filtersGenerator the content generator instance. May be {@code null}. */
public TicketListingRequest(String sessionId, String syncId, IContentGenerator filtersGenerator)
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/TicketListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketListingRequest NeXpose API request. * * @author Murali Rongali */ public class TicketListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket listing request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param filtersGenerator the content generator instance. May be {@code null}. */ public TicketListingRequest(String sessionId, String syncId, IContentGenerator filtersGenerator) { super(sessionId, syncId); set("filtersGenerator", filtersGenerator);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/TicketListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketListingRequest NeXpose API request. * * @author Murali Rongali */ public class TicketListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket listing request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param filtersGenerator the content generator instance. May be {@code null}. */ public TicketListingRequest(String sessionId, String syncId, IContentGenerator filtersGenerator) { super(sessionId, syncId); set("filtersGenerator", filtersGenerator);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ExternalUserSaveRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2010, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the UserSaveRequest NeXpose API request for user's that are authenticated by an external resource. * The request leaves out the password field since this causes a server side failure. * * @author Leonardo Varela */ public class ExternalUserSaveRequest extends TemplateAPIRequest { /** * Creates a new User Save Request with any given sites content generator and * any given group content generator. Sets the first API supported version to * 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link org.rapid7.nexpose.api.APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param allGroups true if the user has access to all groups, false * otherwise (specified when creating/saving a config and Group * elements are not specified) * @param allSites true if the user has access to all sites, false otherwise * (specified when creating/saving a config and Site elements are not * specified) * @param authSrcId the positive integer that identifies the authentication * source to be used to authenticate the user. Should be one of the * existing authentication for correctness. * @param email the email of the user, should have the right email format. * This field is optional. * @param enabled true (or 1) if the user is enabled, false (or 0) otherwise. * This field is optional. * @param fullname a String that represents the full name of the user. * @param id the non negative integer that identifies the user, -1 to create * a new user. * @param name the String that represents the name of the user. This field * may not be updated, so only used for new users. You can still * specify it and NeXpose will throw an Exception. * @param roleName the role name of the user, should be one of * global-admin for Global Administrator. * security-manager for Security Manager. * site-admin for Site Administrator. * system-admin for System Administrator. * user for User. * custom for Custom. NOTE: Be aware that there is not role management * enabled to date (1/6/2010) * @param sitesGenerator a Generator that knows how to output user sites with * IDs associated to it e.g. &lt;Site id="X"/&gt; where X is a non * negative Integer. Please see {@link org.rapid7.nexpose.api.generators.UserSaveRequestSitesGenerator} * for a reference implementation. For QA testing you should construct * your own {@link org.rapid7.nexpose.api.IContentGenerator} to generate all the edge test * cases you can think of. * @param groupsGenerator a Generator that knows how to output user groups * with IDs associated to it e.g. &lt;Group id="X"/&gt; where X is a * non negative Integer. Please see * {@link org.rapid7.nexpose.api.generators.UserSaveRequestGroupsGenerator} for a reference * implementation. For QA testing you should construct your own * {@link org.rapid7.nexpose.api.IContentGenerator} to generate all the edge test cases you * can think of. */ public ExternalUserSaveRequest( String sessionId, String syncId, String allGroups, String allSites, String authSrcId, String email, String enabled, String fullname, String id, String name, String roleName,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/ExternalUserSaveRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2010, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the UserSaveRequest NeXpose API request for user's that are authenticated by an external resource. * The request leaves out the password field since this causes a server side failure. * * @author Leonardo Varela */ public class ExternalUserSaveRequest extends TemplateAPIRequest { /** * Creates a new User Save Request with any given sites content generator and * any given group content generator. Sets the first API supported version to * 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link org.rapid7.nexpose.api.APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param allGroups true if the user has access to all groups, false * otherwise (specified when creating/saving a config and Group * elements are not specified) * @param allSites true if the user has access to all sites, false otherwise * (specified when creating/saving a config and Site elements are not * specified) * @param authSrcId the positive integer that identifies the authentication * source to be used to authenticate the user. Should be one of the * existing authentication for correctness. * @param email the email of the user, should have the right email format. * This field is optional. * @param enabled true (or 1) if the user is enabled, false (or 0) otherwise. * This field is optional. * @param fullname a String that represents the full name of the user. * @param id the non negative integer that identifies the user, -1 to create * a new user. * @param name the String that represents the name of the user. This field * may not be updated, so only used for new users. You can still * specify it and NeXpose will throw an Exception. * @param roleName the role name of the user, should be one of * global-admin for Global Administrator. * security-manager for Security Manager. * site-admin for Site Administrator. * system-admin for System Administrator. * user for User. * custom for Custom. NOTE: Be aware that there is not role management * enabled to date (1/6/2010) * @param sitesGenerator a Generator that knows how to output user sites with * IDs associated to it e.g. &lt;Site id="X"/&gt; where X is a non * negative Integer. Please see {@link org.rapid7.nexpose.api.generators.UserSaveRequestSitesGenerator} * for a reference implementation. For QA testing you should construct * your own {@link org.rapid7.nexpose.api.IContentGenerator} to generate all the edge test * cases you can think of. * @param groupsGenerator a Generator that knows how to output user groups * with IDs associated to it e.g. &lt;Group id="X"/&gt; where X is a * non negative Integer. Please see * {@link org.rapid7.nexpose.api.generators.UserSaveRequestGroupsGenerator} for a reference * implementation. For QA testing you should construct your own * {@link org.rapid7.nexpose.api.IContentGenerator} to generate all the edge test cases you * can think of. */ public ExternalUserSaveRequest( String sessionId, String syncId, String allGroups, String allSites, String authSrcId, String email, String enabled, String fullname, String id, String name, String roleName,
IContentGenerator sitesGenerator,
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/EnginePoolUpdateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EnginePoolUpdateRequest NeXpose API request. * * @author Meera Muthuswami */ public class EnginePoolUpdateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a engine pool update request with its associated API version * information. * * @param sessionId The session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId The sync id to identify the response. May be {@code null}. * @param enginePoolId The id of the engine pool. May not be {@code null} nor empty and must be a positive number. * @param enginePoolName The name of the engine pool. May not be {@code null} nor empty and must be less than 255 character. * @param enginePoolScope The scope of the engine pool. May not be {@code null} nor empty and must be less than 255 character. * @param enginesGenerator The content generator instance. May not be {@code null} nor empty. */ public EnginePoolUpdateRequest(String sessionId, String syncId, String enginePoolId, String enginePoolName, String enginePoolScope,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/EnginePoolUpdateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EnginePoolUpdateRequest NeXpose API request. * * @author Meera Muthuswami */ public class EnginePoolUpdateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a engine pool update request with its associated API version * information. * * @param sessionId The session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId The sync id to identify the response. May be {@code null}. * @param enginePoolId The id of the engine pool. May not be {@code null} nor empty and must be a positive number. * @param enginePoolName The name of the engine pool. May not be {@code null} nor empty and must be less than 255 character. * @param enginePoolScope The scope of the engine pool. May not be {@code null} nor empty and must be less than 255 character. * @param enginesGenerator The content generator instance. May not be {@code null} nor empty. */ public EnginePoolUpdateRequest(String sessionId, String syncId, String enginePoolId, String enginePoolName, String enginePoolScope,
IContentGenerator enginesGenerator)
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/EnginePoolUpdateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EnginePoolUpdateRequest NeXpose API request. * * @author Meera Muthuswami */ public class EnginePoolUpdateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a engine pool update request with its associated API version * information. * * @param sessionId The session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId The sync id to identify the response. May be {@code null}. * @param enginePoolId The id of the engine pool. May not be {@code null} nor empty and must be a positive number. * @param enginePoolName The name of the engine pool. May not be {@code null} nor empty and must be less than 255 character. * @param enginePoolScope The scope of the engine pool. May not be {@code null} nor empty and must be less than 255 character. * @param enginesGenerator The content generator instance. May not be {@code null} nor empty. */ public EnginePoolUpdateRequest(String sessionId, String syncId, String enginePoolId, String enginePoolName, String enginePoolScope, IContentGenerator enginesGenerator) { super(sessionId, syncId); set("enginePoolID", enginePoolId); set("enginePoolName", enginePoolName); set("enginePoolScope", enginePoolScope); set("enginesGenerator", enginesGenerator);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/EnginePoolUpdateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EnginePoolUpdateRequest NeXpose API request. * * @author Meera Muthuswami */ public class EnginePoolUpdateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a engine pool update request with its associated API version * information. * * @param sessionId The session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId The sync id to identify the response. May be {@code null}. * @param enginePoolId The id of the engine pool. May not be {@code null} nor empty and must be a positive number. * @param enginePoolName The name of the engine pool. May not be {@code null} nor empty and must be less than 255 character. * @param enginePoolScope The scope of the engine pool. May not be {@code null} nor empty and must be less than 255 character. * @param enginesGenerator The content generator instance. May not be {@code null} nor empty. */ public EnginePoolUpdateRequest(String sessionId, String syncId, String enginePoolId, String enginePoolName, String enginePoolScope, IContentGenerator enginesGenerator) { super(sessionId, syncId); set("enginePoolID", enginePoolId); set("enginePoolName", enginePoolName); set("enginePoolScope", enginePoolScope); set("enginesGenerator", enginesGenerator);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/domain/DiscoveryConfig.java
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // }
import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element;
/*************************************************************************** * COPYRIGHT (C) 2015, Rapid7 LLC, Boston, MA, USA. * All rights reserved. This material contains unpublished, copyrighted * work including confidential and proprietary information of Rapid7. **************************************************************************/ package org.rapid7.nexpose.api.domain; /** * Holds a discovery configuration */ public class DiscoveryConfig extends BaseElement { public DiscoveryConfig(Element element)
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // } // Path: src/main/java/org/rapid7/nexpose/api/domain/DiscoveryConfig.java import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element; /*************************************************************************** * COPYRIGHT (C) 2015, Rapid7 LLC, Boston, MA, USA. * All rights reserved. This material contains unpublished, copyrighted * work including confidential and proprietary information of Rapid7. **************************************************************************/ package org.rapid7.nexpose.api.domain; /** * Holds a discovery configuration */ public class DiscoveryConfig extends BaseElement { public DiscoveryConfig(Element element)
throws APIException
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/VulnerabilityExceptionListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link VulnerabilityExceptionListingRequest} Nexpose API request. * * @author Murali Rongali */ public class VulnerabilityExceptionListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link VulnerabilityExceptionListingRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param status the status of the Vulnerability exception(Must be "Under Review" | "Approved" | "Rejected"). * @param timeDuration the valid interval in the following format: PnYnMnDTnHnMnS. */ public VulnerabilityExceptionListingRequest(String sessionId, String syncId, String status, String timeDuration) { super(sessionId, syncId); set("status", status); set("timeDuration", timeDuration);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/VulnerabilityExceptionListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link VulnerabilityExceptionListingRequest} Nexpose API request. * * @author Murali Rongali */ public class VulnerabilityExceptionListingRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link VulnerabilityExceptionListingRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param status the status of the Vulnerability exception(Must be "Under Review" | "Approved" | "Rejected"). * @param timeDuration the valid interval in the following format: PnYnMnDTnHnMnS. */ public VulnerabilityExceptionListingRequest(String sessionId, String syncId, String status, String timeDuration) { super(sessionId, syncId); set("status", status); set("timeDuration", timeDuration);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/TicketCreateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketCreateRequest NeXpose API request. * * @author Murali Rongali */ public class TicketCreateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket create request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param ticketName the name of the ticket. May not be {@code null} nor empty and must be less than 255 character. * @param ticketPriority the priority of the ticket. May not be {@code null} nor empty and * expected values are low, moderate, normal, high, critical. * @param ticketDeviceId the device id of the ticket. May not be {@code null} nor empty. * @param ticketAssignedTo the name of the person to whom the ticket is assigned. May not be {@code null} nor empty. * @param ticketVulnerabilities the content generator for the ticket vulnerabilities. May not be {@code null} nor empty. * @param ticketComments the content generator for the ticket comments. May be {@code null}. */ public TicketCreateRequest( String sessionId, String syncId, String ticketName, String ticketPriority, String ticketDeviceId, String ticketAssignedTo,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/TicketCreateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketCreateRequest NeXpose API request. * * @author Murali Rongali */ public class TicketCreateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket create request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param ticketName the name of the ticket. May not be {@code null} nor empty and must be less than 255 character. * @param ticketPriority the priority of the ticket. May not be {@code null} nor empty and * expected values are low, moderate, normal, high, critical. * @param ticketDeviceId the device id of the ticket. May not be {@code null} nor empty. * @param ticketAssignedTo the name of the person to whom the ticket is assigned. May not be {@code null} nor empty. * @param ticketVulnerabilities the content generator for the ticket vulnerabilities. May not be {@code null} nor empty. * @param ticketComments the content generator for the ticket comments. May be {@code null}. */ public TicketCreateRequest( String sessionId, String syncId, String ticketName, String ticketPriority, String ticketDeviceId, String ticketAssignedTo,
IContentGenerator ticketVulnerabilities,
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/TicketCreateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketCreateRequest NeXpose API request. * * @author Murali Rongali */ public class TicketCreateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket create request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param ticketName the name of the ticket. May not be {@code null} nor empty and must be less than 255 character. * @param ticketPriority the priority of the ticket. May not be {@code null} nor empty and * expected values are low, moderate, normal, high, critical. * @param ticketDeviceId the device id of the ticket. May not be {@code null} nor empty. * @param ticketAssignedTo the name of the person to whom the ticket is assigned. May not be {@code null} nor empty. * @param ticketVulnerabilities the content generator for the ticket vulnerabilities. May not be {@code null} nor empty. * @param ticketComments the content generator for the ticket comments. May be {@code null}. */ public TicketCreateRequest( String sessionId, String syncId, String ticketName, String ticketPriority, String ticketDeviceId, String ticketAssignedTo, IContentGenerator ticketVulnerabilities, IContentGenerator ticketComments) { super(sessionId, syncId); set("ticketName", ticketName); set("ticketPriority", ticketPriority); set("ticketDeviceId", ticketDeviceId); set("tikcetAssignedTo", ticketAssignedTo); set("vulnerabilitiesGenerator", ticketVulnerabilities); set("commentsGenerator", ticketComments);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/TicketCreateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketCreateRequest NeXpose API request. * * @author Murali Rongali */ public class TicketCreateRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket create request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param ticketName the name of the ticket. May not be {@code null} nor empty and must be less than 255 character. * @param ticketPriority the priority of the ticket. May not be {@code null} nor empty and * expected values are low, moderate, normal, high, critical. * @param ticketDeviceId the device id of the ticket. May not be {@code null} nor empty. * @param ticketAssignedTo the name of the person to whom the ticket is assigned. May not be {@code null} nor empty. * @param ticketVulnerabilities the content generator for the ticket vulnerabilities. May not be {@code null} nor empty. * @param ticketComments the content generator for the ticket comments. May be {@code null}. */ public TicketCreateRequest( String sessionId, String syncId, String ticketName, String ticketPriority, String ticketDeviceId, String ticketAssignedTo, IContentGenerator ticketVulnerabilities, IContentGenerator ticketComments) { super(sessionId, syncId); set("ticketName", ticketName); set("ticketPriority", ticketPriority); set("ticketDeviceId", ticketDeviceId); set("tikcetAssignedTo", ticketAssignedTo); set("vulnerabilitiesGenerator", ticketVulnerabilities); set("commentsGenerator", ticketComments);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ReportDeleteRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The report delete request template. * * @author Allen Jensen. * */ public class ReportDeleteRequest extends TemplateAPIRequest { /** * Constructs the report delete request. * * @param reportID The report ID. * @param reportCfgID The report Configuration ID. * @param sessionID The session ID. * @param syncID The sync ID. */ public ReportDeleteRequest(String sessionID, String syncID, String reportID, String reportCfgID) { super(sessionID, syncID); set("report-id", reportID); set("reportcfg-id", reportCfgID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/ReportDeleteRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The report delete request template. * * @author Allen Jensen. * */ public class ReportDeleteRequest extends TemplateAPIRequest { /** * Constructs the report delete request. * * @param reportID The report ID. * @param reportCfgID The report Configuration ID. * @param sessionID The session ID. * @param syncID The sync ID. */ public ReportDeleteRequest(String sessionID, String syncID, String reportID, String reportCfgID) { super(sessionID, syncID); set("report-id", reportID); set("reportcfg-id", reportCfgID);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/domain/SiloConfigPCIMerchant.java
// Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.generators.IContentGenerator;
public void setAcquirerRelationship(String relationship) { m_acquirerRelationship = relationship; } /** * Retrieves the PCI Merchants's agent relationship. * * @return The PCI Merchants's agen relationship. */ public String getAgentRelationship() { return m_agentRelationship; } /** * Sets the PCI Merchants's agent relationship. * * @param relationship The new value of PCI Merchants's agent relationship. */ public void setAgentRelationship(String relationship) { m_agentRelationship = relationship; } /** * Retrieves the content generator for the DBAs associated with the PCI Merchants. * * @return The content generator of the PCI Merchants's DBAs. */
// Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/domain/SiloConfigPCIMerchant.java import org.rapid7.nexpose.api.generators.IContentGenerator; public void setAcquirerRelationship(String relationship) { m_acquirerRelationship = relationship; } /** * Retrieves the PCI Merchants's agent relationship. * * @return The PCI Merchants's agen relationship. */ public String getAgentRelationship() { return m_agentRelationship; } /** * Sets the PCI Merchants's agent relationship. * * @param relationship The new value of PCI Merchants's agent relationship. */ public void setAgentRelationship(String relationship) { m_agentRelationship = relationship; } /** * Retrieves the content generator for the DBAs associated with the PCI Merchants. * * @return The content generator of the PCI Merchants's DBAs. */
public IContentGenerator getDBAGenerator()
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloProfileDeleteRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The silo profile delete request template. * * @author Christopher Lee. * */ public class SiloProfileDeleteRequest extends TemplateAPIRequest { /** * Constructs the silo profile delete request. * * @param siloProfileID The silo profile ID. * @param sessionID The session ID. * @param syncID The sync ID. */ public SiloProfileDeleteRequest(String sessionID, String syncID, String siloProfileID) { super(sessionID, syncID); set("silo-profile-id", siloProfileID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/SiloProfileDeleteRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The silo profile delete request template. * * @author Christopher Lee. * */ public class SiloProfileDeleteRequest extends TemplateAPIRequest { /** * Constructs the silo profile delete request. * * @param siloProfileID The silo profile ID. * @param sessionID The session ID. * @param syncID The sync ID. */ public SiloProfileDeleteRequest(String sessionID, String syncID, String siloProfileID) { super(sessionID, syncID); set("silo-profile-id", siloProfileID);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/PendingVulnExceptionsCountRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link PendingVulnExceptionsCountRequest} Nexpose API request. * * @author Murali Rongali */ public class PendingVulnExceptionsCountRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link PendingVulnExceptionsCountRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. */ public PendingVulnExceptionsCountRequest(String sessionId, String syncId) { super(sessionId, syncId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/PendingVulnExceptionsCountRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link PendingVulnExceptionsCountRequest} Nexpose API request. * * @author Murali Rongali */ public class PendingVulnExceptionsCountRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link PendingVulnExceptionsCountRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. */ public PendingVulnExceptionsCountRequest(String sessionId, String syncId) { super(sessionId, syncId);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/TicketDetailsRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketDetailsRequest NeXpose API request. * * @author Murali Rongali */ public class TicketDetailsRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket detail request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param ticketsGenerator the content generator instance. */
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/TicketDetailsRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketDetailsRequest NeXpose API request. * * @author Murali Rongali */ public class TicketDetailsRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket detail request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param ticketsGenerator the content generator instance. */
public TicketDetailsRequest(String sessionId, String syncId, IContentGenerator ticketsGenerator)
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/TicketDetailsRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketDetailsRequest NeXpose API request. * * @author Murali Rongali */ public class TicketDetailsRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket detail request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param ticketsGenerator the content generator instance. */ public TicketDetailsRequest(String sessionId, String syncId, IContentGenerator ticketsGenerator) { super(sessionId, syncId); set("ticketsGenerator", ticketsGenerator);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/TicketDetailsRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the TicketDetailsRequest NeXpose API request. * * @author Murali Rongali */ public class TicketDetailsRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a ticket detail request with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param ticketsGenerator the content generator instance. */ public TicketDetailsRequest(String sessionId, String syncId, IContentGenerator ticketsGenerator) { super(sessionId, syncId); set("ticketsGenerator", ticketsGenerator);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloListingRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the SiloListingRequest NeXpose API request. * * @author Leonardo Varela */ public class SiloListingRequest extends TemplateAPIRequest { /** * Constructs a Silo Listing request with its associated API versioning * information. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public SiloListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/SiloListingRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the SiloListingRequest NeXpose API request. * * @author Leonardo Varela */ public class SiloListingRequest extends TemplateAPIRequest { /** * Constructs a Silo Listing request with its associated API versioning * information. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public SiloListingRequest(String sessionId, String syncId) { super(sessionId, syncId);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/ReportHistoryRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportHistoryRequest NeXpose API request. * * @author Murali Rongali */ public class ReportHistoryRequest extends TemplateAPIRequest { /** * Creates a new ReportHistoryRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param reportCfgID the id of the report config. */ public ReportHistoryRequest(String sessionID, String syncID, String reportCfgID) { super(sessionID, syncID); set("reportcfgId", reportCfgID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/ReportHistoryRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the ReportHistoryRequest NeXpose API request. * * @author Murali Rongali */ public class ReportHistoryRequest extends TemplateAPIRequest { /** * Creates a new ReportHistoryRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param reportCfgID the id of the report config. */ public ReportHistoryRequest(String sessionID, String syncID, String reportCfgID) { super(sessionID, syncID); set("reportcfgId", reportCfgID);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/domain/RoleSummary.java
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // }
import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api.domain; /** * Represents a Role retrieved by the role listing API request. * * @author Meera Muthuswami */ public class RoleSummary extends BaseElement { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Retrieves the id of the role. * * @return The id attribute of the role. */ public long getId() { return m_id; } /** * Retrieves the name of the role. * * @return The name of the role. */ public String getName() { return m_name; } /** * Retrieves the full name of the role. * * @return The full name of the role. */ public String getFullName() { return m_fullname; } /** * Retrieves the description of the role. * * @return The description of the role. */ public String getDescription() { return m_description; } /** * Retrieves the state of the role. * * @return The state of the role. */ public String getEnabled() { return m_enabled; } /** * Creates an element containing a role summary. * * @throws APIException When there is a problem parsing the element's * attributes. */
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // } // Path: src/main/java/org/rapid7/nexpose/api/domain/RoleSummary.java import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api.domain; /** * Represents a Role retrieved by the role listing API request. * * @author Meera Muthuswami */ public class RoleSummary extends BaseElement { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Retrieves the id of the role. * * @return The id attribute of the role. */ public long getId() { return m_id; } /** * Retrieves the name of the role. * * @return The name of the role. */ public String getName() { return m_name; } /** * Retrieves the full name of the role. * * @return The full name of the role. */ public String getFullName() { return m_fullname; } /** * Retrieves the description of the role. * * @return The description of the role. */ public String getDescription() { return m_description; } /** * Retrieves the state of the role. * * @return The state of the role. */ public String getEnabled() { return m_enabled; } /** * Creates an element containing a role summary. * * @throws APIException When there is a problem parsing the element's * attributes. */
public RoleSummary(Element roleSummaryElement) throws APIException
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/AssetGroupSaveRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2010, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the AssetGroupSaveRequest NeXpose API request. * * @author Leonardo Varela */ public class AssetGroupSaveRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new AssetGroupSaveRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param groupId the id of the group to save (-1) if you want to create a * new one. * @param groupName the name of the group to save. * @param groupDescription the description of the group to save. * @param groupRiskScore the risk score associated with the group to save. * @param devicesGenerator the {@link IContentGenerator} that knows how to * include devices inside of the AssetGroupSaveRequest. */ public AssetGroupSaveRequest( String sessionId, String syncId, String groupId, String groupName, String groupDescription, String groupRiskScore,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/AssetGroupSaveRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2010, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the AssetGroupSaveRequest NeXpose API request. * * @author Leonardo Varela */ public class AssetGroupSaveRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new AssetGroupSaveRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param groupId the id of the group to save (-1) if you want to create a * new one. * @param groupName the name of the group to save. * @param groupDescription the description of the group to save. * @param groupRiskScore the risk score associated with the group to save. * @param devicesGenerator the {@link IContentGenerator} that knows how to * include devices inside of the AssetGroupSaveRequest. */ public AssetGroupSaveRequest( String sessionId, String syncId, String groupId, String groupName, String groupDescription, String groupRiskScore,
IContentGenerator devicesGenerator)
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/AssetGroupSaveRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2010, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the AssetGroupSaveRequest NeXpose API request. * * @author Leonardo Varela */ public class AssetGroupSaveRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new AssetGroupSaveRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param groupId the id of the group to save (-1) if you want to create a * new one. * @param groupName the name of the group to save. * @param groupDescription the description of the group to save. * @param groupRiskScore the risk score associated with the group to save. * @param devicesGenerator the {@link IContentGenerator} that knows how to * include devices inside of the AssetGroupSaveRequest. */ public AssetGroupSaveRequest( String sessionId, String syncId, String groupId, String groupName, String groupDescription, String groupRiskScore, IContentGenerator devicesGenerator) { super(sessionId, syncId); set("assetGroupId", groupId); set("assetGroupName", groupName); set("assetGroupDescription", groupDescription); set("assetGroupRiskScore", groupRiskScore); set("devicesGenerator", devicesGenerator);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/AssetGroupSaveRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2010, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the AssetGroupSaveRequest NeXpose API request. * * @author Leonardo Varela */ public class AssetGroupSaveRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new AssetGroupSaveRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param groupId the id of the group to save (-1) if you want to create a * new one. * @param groupName the name of the group to save. * @param groupDescription the description of the group to save. * @param groupRiskScore the risk score associated with the group to save. * @param devicesGenerator the {@link IContentGenerator} that knows how to * include devices inside of the AssetGroupSaveRequest. */ public AssetGroupSaveRequest( String sessionId, String syncId, String groupId, String groupName, String groupDescription, String groupRiskScore, IContentGenerator devicesGenerator) { super(sessionId, syncId); set("assetGroupId", groupId); set("assetGroupName", groupName); set("assetGroupDescription", groupDescription); set("assetGroupRiskScore", groupRiskScore); set("devicesGenerator", devicesGenerator);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/domain/ScanSummary.java
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // }
import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.ArrayList; import java.util.List;
/*************************************************************************** * COPYRIGHT (C) 2015, Rapid7 LLC, Boston, MA, USA. * All rights reserved. This material contains unpublished, copyrighted * work including confidential and proprietary information of Rapid7. **************************************************************************/ package org.rapid7.nexpose.api.domain; /** * Scan summary object */ public class ScanSummary extends BaseElement {
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // } // Path: src/main/java/org/rapid7/nexpose/api/domain/ScanSummary.java import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.ArrayList; import java.util.List; /*************************************************************************** * COPYRIGHT (C) 2015, Rapid7 LLC, Boston, MA, USA. * All rights reserved. This material contains unpublished, copyrighted * work including confidential and proprietary information of Rapid7. **************************************************************************/ package org.rapid7.nexpose.api.domain; /** * Scan summary object */ public class ScanSummary extends BaseElement {
public ScanSummary(Element element) throws APIException
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloUpdateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/domain/SiloConfigStorage.java // public class SiloConfigStorage // { // // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Retrieves the storage's user id. // * // * @return The the storage's host value. // */ // public String getUserID() // { // return m_userID; // } // // /** // * Sets the storage's user id. // * // * @param userID The new value of the storage's user id to set. // */ // public void setUserID(String userID) // { // m_userID = userID; // } // // /** // * Retrieves the storage's DBMS value. // * // * @return The value of the storage's DBMS. // */ // public String getDBMS() // { // return m_DBMS; // } // // /** // * Sets the storage's DBMS value. // * // * @param dbms The value of the storage's DBMS to set. // */ // public void setDBMS(String dbms) // { // m_DBMS = dbms; // } // // /** // * Retrieves the storage's realm. // * // * @return The value of the storage's realm. // */ // public String getUserRealm() // { // return m_userRealm; // } // // /** // * Sets the storage's realm. // * // * @param username The value of the storage's realm to set // */ // public void setUserRealm(String realm) // { // m_userRealm = realm; // } // // /** // * Retrieves the storage's password. // * // * @return The value of the storage's passsword. // */ // public String getPassword() // { // return m_password; // } // // /** // * Sets the storage's password. // * // * @param port The value of the storage's password to set. // */ // public void setPassword(String password) // { // m_password = password; // } // // /** // * Retrieves the storage's URL. // * // * @return The value of the storage's URL. // */ // public String getURL() // { // return m_url; // } // // /** // * Sets the storage's URL. // * // * @param url The value of the storage's URL to set. // */ // public void setURL(String url) // { // m_url = url; // } // // /** // * Retrieves the storage's properties generator. // * // * @return The storage's properties Generator. // */ // public IContentGenerator getPropertiesGenerator() // { // return m_propertiesGenerator; // } // // /** // * Sets the storage's properties content generator. // * // * @param generator The storage's properties content generator to set. // */ // public void setPropertiesGenerator(IContentGenerator generator) // { // m_propertiesGenerator = generator; // } // // /** // * Tells whether all the attributes are null or not. // */ // public boolean areAllNull() // { // return (m_userID== null && // m_DBMS== null && // m_password == null && // m_url == null && // m_userRealm== null && // m_propertiesGenerator == null); // } // ///////////////////////////////////////////////////////////////////////// // // non-Public fields // ///////////////////////////////////////////////////////////////////////// // // /** Represents the host of the storage. */ // private String m_userID; // /** Represents the dbms of the storage. */ // private String m_DBMS; // /** Represents the name of the storage. */ // private String m_userRealm; // /** Represents the port of the storage. */ // private String m_password; // /**Represents the url of the storage. */ // private String m_url; // /** Represents the content generator for the properties of the storage. */ // private IContentGenerator m_propertiesGenerator; // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.domain.SiloConfigStorage; import org.rapid7.nexpose.api.generators.IContentGenerator;
public SiloUpdateRequest( String sessionId, String syncId, String id, String name, String description, String siloProfileId, String maxAssets, String maxUsers, String dbID, IContentGenerator merchantGenerator, IContentGenerator organizationURLGenerator, SiloConfigStorage storage) { super(sessionId, syncId); set("maxAssets", maxAssets); set("maxUsers", maxUsers); set("description", description); set("name", name); set("id", id); set("silo-profile-id", siloProfileId); set("db-id", dbID); set("merchantGenerator", merchantGenerator); set("organizationGenerator", organizationURLGenerator); set("storageUserID", storage != null? storage.getUserID() : null); set("storageDBMS", storage != null? storage.getDBMS() : null); set("storageRealm", storage != null? storage.getUserRealm() : null); set("storagePassword", storage != null? storage.getPassword() : null); set("storageURL", storage != null? storage.getURL() : null); set("storagePropertiesGenerator", storage != null? storage.getPropertiesGenerator() : null);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/domain/SiloConfigStorage.java // public class SiloConfigStorage // { // // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Retrieves the storage's user id. // * // * @return The the storage's host value. // */ // public String getUserID() // { // return m_userID; // } // // /** // * Sets the storage's user id. // * // * @param userID The new value of the storage's user id to set. // */ // public void setUserID(String userID) // { // m_userID = userID; // } // // /** // * Retrieves the storage's DBMS value. // * // * @return The value of the storage's DBMS. // */ // public String getDBMS() // { // return m_DBMS; // } // // /** // * Sets the storage's DBMS value. // * // * @param dbms The value of the storage's DBMS to set. // */ // public void setDBMS(String dbms) // { // m_DBMS = dbms; // } // // /** // * Retrieves the storage's realm. // * // * @return The value of the storage's realm. // */ // public String getUserRealm() // { // return m_userRealm; // } // // /** // * Sets the storage's realm. // * // * @param username The value of the storage's realm to set // */ // public void setUserRealm(String realm) // { // m_userRealm = realm; // } // // /** // * Retrieves the storage's password. // * // * @return The value of the storage's passsword. // */ // public String getPassword() // { // return m_password; // } // // /** // * Sets the storage's password. // * // * @param port The value of the storage's password to set. // */ // public void setPassword(String password) // { // m_password = password; // } // // /** // * Retrieves the storage's URL. // * // * @return The value of the storage's URL. // */ // public String getURL() // { // return m_url; // } // // /** // * Sets the storage's URL. // * // * @param url The value of the storage's URL to set. // */ // public void setURL(String url) // { // m_url = url; // } // // /** // * Retrieves the storage's properties generator. // * // * @return The storage's properties Generator. // */ // public IContentGenerator getPropertiesGenerator() // { // return m_propertiesGenerator; // } // // /** // * Sets the storage's properties content generator. // * // * @param generator The storage's properties content generator to set. // */ // public void setPropertiesGenerator(IContentGenerator generator) // { // m_propertiesGenerator = generator; // } // // /** // * Tells whether all the attributes are null or not. // */ // public boolean areAllNull() // { // return (m_userID== null && // m_DBMS== null && // m_password == null && // m_url == null && // m_userRealm== null && // m_propertiesGenerator == null); // } // ///////////////////////////////////////////////////////////////////////// // // non-Public fields // ///////////////////////////////////////////////////////////////////////// // // /** Represents the host of the storage. */ // private String m_userID; // /** Represents the dbms of the storage. */ // private String m_DBMS; // /** Represents the name of the storage. */ // private String m_userRealm; // /** Represents the port of the storage. */ // private String m_password; // /**Represents the url of the storage. */ // private String m_url; // /** Represents the content generator for the properties of the storage. */ // private IContentGenerator m_propertiesGenerator; // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/SiloUpdateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.domain.SiloConfigStorage; import org.rapid7.nexpose.api.generators.IContentGenerator; public SiloUpdateRequest( String sessionId, String syncId, String id, String name, String description, String siloProfileId, String maxAssets, String maxUsers, String dbID, IContentGenerator merchantGenerator, IContentGenerator organizationURLGenerator, SiloConfigStorage storage) { super(sessionId, syncId); set("maxAssets", maxAssets); set("maxUsers", maxUsers); set("description", description); set("name", name); set("id", id); set("silo-profile-id", siloProfileId); set("db-id", dbID); set("merchantGenerator", merchantGenerator); set("organizationGenerator", organizationURLGenerator); set("storageUserID", storage != null? storage.getUserID() : null); set("storageDBMS", storage != null? storage.getDBMS() : null); set("storageRealm", storage != null? storage.getUserRealm() : null); set("storagePassword", storage != null? storage.getPassword() : null); set("storageURL", storage != null? storage.getURL() : null); set("storagePropertiesGenerator", storage != null? storage.getPropertiesGenerator() : null);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/domain/MultiTenantUserSummary.java
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // }
import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element;
return m_superuser; } /** * Retrieves the full name of the multiTenant user. * * @return The full name of the multiTenant user. */ public String getFullname() { return m_fullname; } /** * Retrieves the enabled of the multiTenant user. * * @return whether enabled or not. */ public boolean isEnabled() { return m_enabled; } /** * Creates a summary out of an element MultiTenantUser Summary * * @throws APIException When there is a problem parsing the element's * attributes. */
// Path: src/main/java/org/rapid7/nexpose/api/APIException.java // @SuppressWarnings("serial") // public class APIException extends Exception // { // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Constructs a new {@link APIException} with the given error message. // * // * @param msg the message to create the {@link Exception} with. // */ // public APIException(String msg) // { // super(msg); // } // // /** // * Constructs a new {@link APIException} with the given error message and root // * cause. // * // * @param msg the message to create the exception with. // * @param cause the cause of the {@link Exception} // */ // public APIException(String msg, Throwable cause) // { // super(msg, cause); // } // } // Path: src/main/java/org/rapid7/nexpose/api/domain/MultiTenantUserSummary.java import org.rapid7.nexpose.api.APIException; import org.rapid7.nexpose.api.BaseElement; import org.w3c.dom.Element; return m_superuser; } /** * Retrieves the full name of the multiTenant user. * * @return The full name of the multiTenant user. */ public String getFullname() { return m_fullname; } /** * Retrieves the enabled of the multiTenant user. * * @return whether enabled or not. */ public boolean isEnabled() { return m_enabled; } /** * Creates a summary out of an element MultiTenantUser Summary * * @throws APIException When there is a problem parsing the element's * attributes. */
public MultiTenantUserSummary(Element multiTenantUserElement) throws APIException
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloConfigRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the SiloConfigRequest NeXpose API request. * * @author Leonardo Varela */ public class SiloConfigRequest extends TemplateAPIRequest { /** * Creates a new SiloConfigRequest NeXpose API Request. Sets the first API supported version to 1.2 and the last * supported version to 1.2. * * NOTE: All parameters are strings or generators, since we want to be able to test edge cases and simulate incorrect * usage of the tool for robustness * * @param sessionId the session to be used if different from the currently acquired one. This is a String of 40 * characters. * @param syncId The String that uniquely identifies the response associated with the request sent. This field is * optional. * @param siloId a string that represents the id of the silo to delete. */ public SiloConfigRequest(String sessionId, String syncId, String siloId) { super(sessionId, syncId); set("siloId", siloId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/SiloConfigRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the SiloConfigRequest NeXpose API request. * * @author Leonardo Varela */ public class SiloConfigRequest extends TemplateAPIRequest { /** * Creates a new SiloConfigRequest NeXpose API Request. Sets the first API supported version to 1.2 and the last * supported version to 1.2. * * NOTE: All parameters are strings or generators, since we want to be able to test edge cases and simulate incorrect * usage of the tool for robustness * * @param sessionId the session to be used if different from the currently acquired one. This is a String of 40 * characters. * @param syncId The String that uniquely identifies the response associated with the request sent. This field is * optional. * @param siloId a string that represents the id of the silo to delete. */ public SiloConfigRequest(String sessionId, String syncId, String siloId) { super(sessionId, syncId); set("siloId", siloId);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloProfileCreateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Silo profile create request template. * * @author Christopher Lee. * */ public class SiloProfileCreateRequest extends TemplateAPIRequest { /** * Constructs the silo profile create request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param hasGlobalReportTemplates "true" iff the silo should have global report templates. * @param hasGlobalEngines "true" iff the silo has access to global scan engines. * @param hasGlobalScanTemplates "true" iff the silo has access to global scan templates. * @param hasLicensedModules "true" iff the silo has licensed modules. * @param description The silo description. The description for the silo being defined. * @param id The silo id. * @param name The sild name. * @param globalReportTemplates The global report template * @param globalScanEngines The global scan engine. * @param globalScanTemplates The global scan template. * @param licensedModules The license module. */ public SiloProfileCreateRequest( String sessionID, String syncID, String hasGlobalReportTemplates, String hasGlobalEngines, String hasGlobalScanTemplates, String hasLicensedModules, String description, String id, String name,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/SiloProfileCreateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Silo profile create request template. * * @author Christopher Lee. * */ public class SiloProfileCreateRequest extends TemplateAPIRequest { /** * Constructs the silo profile create request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param hasGlobalReportTemplates "true" iff the silo should have global report templates. * @param hasGlobalEngines "true" iff the silo has access to global scan engines. * @param hasGlobalScanTemplates "true" iff the silo has access to global scan templates. * @param hasLicensedModules "true" iff the silo has licensed modules. * @param description The silo description. The description for the silo being defined. * @param id The silo id. * @param name The sild name. * @param globalReportTemplates The global report template * @param globalScanEngines The global scan engine. * @param globalScanTemplates The global scan template. * @param licensedModules The license module. */ public SiloProfileCreateRequest( String sessionID, String syncID, String hasGlobalReportTemplates, String hasGlobalEngines, String hasGlobalScanTemplates, String hasLicensedModules, String description, String id, String name,
IContentGenerator globalReportTemplates,
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloProfileCreateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Silo profile create request template. * * @author Christopher Lee. * */ public class SiloProfileCreateRequest extends TemplateAPIRequest { /** * Constructs the silo profile create request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param hasGlobalReportTemplates "true" iff the silo should have global report templates. * @param hasGlobalEngines "true" iff the silo has access to global scan engines. * @param hasGlobalScanTemplates "true" iff the silo has access to global scan templates. * @param hasLicensedModules "true" iff the silo has licensed modules. * @param description The silo description. The description for the silo being defined. * @param id The silo id. * @param name The sild name. * @param globalReportTemplates The global report template * @param globalScanEngines The global scan engine. * @param globalScanTemplates The global scan template. * @param licensedModules The license module. */ public SiloProfileCreateRequest( String sessionID, String syncID, String hasGlobalReportTemplates, String hasGlobalEngines, String hasGlobalScanTemplates, String hasLicensedModules, String description, String id, String name, IContentGenerator globalReportTemplates, IContentGenerator globalScanEngines, IContentGenerator globalScanTemplates, IContentGenerator licensedModules) { super(sessionID, syncID); set("hasGlobalReportTemplates", hasGlobalReportTemplates); set("hasGlobalEngines", hasGlobalEngines); set("hasGlobalScanTemplates", hasGlobalScanTemplates); set("hasLicensedModules", hasLicensedModules); set("description", description); set("id", id); set("name", name); set("globalReportTemplate", globalReportTemplates); set("globalScanEngine", globalScanEngines); set("globalScanTemplate", globalScanTemplates); set("licensedModule", licensedModules);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/SiloProfileCreateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Silo profile create request template. * * @author Christopher Lee. * */ public class SiloProfileCreateRequest extends TemplateAPIRequest { /** * Constructs the silo profile create request. * * @param sessionID The session ID. * @param syncID The sync ID. * @param hasGlobalReportTemplates "true" iff the silo should have global report templates. * @param hasGlobalEngines "true" iff the silo has access to global scan engines. * @param hasGlobalScanTemplates "true" iff the silo has access to global scan templates. * @param hasLicensedModules "true" iff the silo has licensed modules. * @param description The silo description. The description for the silo being defined. * @param id The silo id. * @param name The sild name. * @param globalReportTemplates The global report template * @param globalScanEngines The global scan engine. * @param globalScanTemplates The global scan template. * @param licensedModules The license module. */ public SiloProfileCreateRequest( String sessionID, String syncID, String hasGlobalReportTemplates, String hasGlobalEngines, String hasGlobalScanTemplates, String hasLicensedModules, String description, String id, String name, IContentGenerator globalReportTemplates, IContentGenerator globalScanEngines, IContentGenerator globalScanTemplates, IContentGenerator licensedModules) { super(sessionID, syncID); set("hasGlobalReportTemplates", hasGlobalReportTemplates); set("hasGlobalEngines", hasGlobalEngines); set("hasGlobalScanTemplates", hasGlobalScanTemplates); set("hasLicensedModules", hasLicensedModules); set("description", description); set("id", id); set("name", name); set("globalReportTemplate", globalReportTemplates); set("globalScanEngine", globalScanEngines); set("globalScanTemplate", globalScanTemplates); set("licensedModule", licensedModules);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/EngineActivityRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EngineActivityRequest NeXpose API request. * * @author Leonardo Varela */ public class EngineActivityRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new Engine activity Request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param engineId the engine id to request the activity from. */ public EngineActivityRequest(String sessionId, String syncId, String engineId) { super(sessionId,syncId); set("engineId", engineId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/EngineActivityRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the EngineActivityRequest NeXpose API request. * * @author Leonardo Varela */ public class EngineActivityRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Creates a new Engine activity Request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param engineId the engine id to request the activity from. */ public EngineActivityRequest(String sessionId, String syncId, String engineId) { super(sessionId,syncId); set("engineId", engineId);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/UserConfigRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the UserConfigRequest NeXpose API request. * * @author Murali Rongali */ public class UserConfigRequest extends TemplateAPIRequest { /** * Creates a new UserConfigRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param userId the id of the user. */ public UserConfigRequest(String sessionID, String syncID, String userId) { super(sessionID, syncID); set("userId", userId);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/UserConfigRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the UserConfigRequest NeXpose API request. * * @author Murali Rongali */ public class UserConfigRequest extends TemplateAPIRequest { /** * Creates a new UserConfigRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. * @param userId the id of the user. */ public UserConfigRequest(String sessionID, String syncID, String userId) { super(sessionID, syncID); set("userId", userId);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/StartUpdateRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the StartUpdateRequest NeXpose API request. * * @author Murali Rongali */ public class StartUpdateRequest extends TemplateAPIRequest { /** * Creates a new StartUpdateRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public StartUpdateRequest(String sessionID, String syncID) { super(sessionID, syncID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/StartUpdateRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the StartUpdateRequest NeXpose API request. * * @author Murali Rongali */ public class StartUpdateRequest extends TemplateAPIRequest { /** * Creates a new StartUpdateRequest NeXpose API request. * * @param sessionId the session to be used if different from the one on the * current APISession. useful when testing edge cases and testing in * general. * @param syncId the syncId to identify the request/response pair. */ public StartUpdateRequest(String sessionID, String syncID) { super(sessionID, syncID);
m_firstSupportedVersion = APISupportedVersion.V1_0;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/VulnerabilityExceptionResubmitRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link VulnerabilityExceptionResubmitRequest} Nexpose API request. * * @author Murali Rongali */ public class VulnerabilityExceptionResubmitRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link VulnerabilityExceptionResubmitRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param exceptionId the id of the Vulnerability exception. * @param comment the comment for the vulnerabilty exception. */ public VulnerabilityExceptionResubmitRequest(String sessionId, String syncId, String exceptionId, String reason, String comment) { super(sessionId, syncId); set("exceptionId", exceptionId); set("reason", reason); set("comment", comment);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/VulnerabilityExceptionResubmitRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Encapsulates the {@link VulnerabilityExceptionResubmitRequest} Nexpose API request. * * @author Murali Rongali */ public class VulnerabilityExceptionResubmitRequest extends TemplateAPIRequest { ///////////////////////////////////////////////////////////////////////// // Public methods ///////////////////////////////////////////////////////////////////////// /** * Constructs a {@link VulnerabilityExceptionResubmitRequest} with its associated API version * information. * * @param sessionId the session to submit the request with. May not be {@code null} nor empty and must * be a 40 character hex {@link String}. * @param syncId the sync id to identify the response. May be {@code null}. * @param exceptionId the id of the Vulnerability exception. * @param comment the comment for the vulnerabilty exception. */ public VulnerabilityExceptionResubmitRequest(String sessionId, String syncId, String exceptionId, String reason, String comment) { super(sessionId, syncId); set("exceptionId", exceptionId); set("reason", reason); set("comment", comment);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/domain/ReportDBExport.java
// Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/ReportDBExportParamsGenerator.java // public class ReportDBExportParamsGenerator implements IContentGenerator // { // // /** // * Represents a DBProperty associated with the storage configuration of a Silo Config. // * // * @author Leonardo Varela // */ // public static class DBParam // { // /** // * Retrieves the name of the property. // * // * @return the name of the property. // */ // public String getName() // { // return m_name; // } // // /** // * Sets the name of the property. // * // * @param name The name of the property. // */ // public void setName(String name) // { // m_name = name; // } // // /** // * Retrieves the value of the property // * // * @return The value of the property. // */ // public String getValue() // { // return m_value; // } // // /** // * Sets the value of the property // * // * @param value The value to set. // */ // public void setValue(String value) // { // m_value = value; // } // /** // * Creates a new Property. // * // * @param name The name of the property // * @param value The value of the property. // */ // public DBParam(String name, String value) // { // m_name = name; // m_value = value; // } // /**The name of the property. */ // private String m_name; // /**The value of the property. */ // private String m_value; // } // // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Creates a new Storage Properties generator for the silo config. // */ // public ReportDBExportParamsGenerator() // { // m_param = new ArrayList<DBParam>(); // } // // /** // * Knows how to print the xml output for properties elements inside of a <SiloConfig> element on the silo Config. // * // * @see java.lang.Object#toString() // */ // @Override // public String toString() // { // StringBuilder sb = new StringBuilder(); // Iterator<DBParam> itProperties = m_param.iterator(); // while(itProperties.hasNext()) // { // DBParam property = itProperties.next(); // sb.append("<param name=\""); // sb.append(StringUtils.xmlEscape(property.getName())); // sb.append("\">"); // sb.append(StringUtils.xmlEscape(property.getValue())); // sb.append("</param>"); // } // return sb.toString(); // } // // /* (non-Javadoc) // * @see org.rapid7.nexpose.api.IContentGenerator#setContents(org.w3c.dom.Element) // */ // @Override // public void setContents(Element contents) // { // try // { // final NodeList properties = (NodeList) XPathFactory.newInstance().newXPath().evaluate("DBExport", contents, XPathConstants.NODESET); // for (int i = 0; i < properties.getLength(); i++) // { // Element elementProperty = (Element) properties.item(i); // String name = elementProperty.getAttribute("name"); // String value = elementProperty.getNodeValue(); // DBParam param = new DBParam(name, value); // m_param.add(param); // } // } // catch (XPathExpressionException e) // { // System.out.println("Could not parse the generator for SiloConfigStoragePropertiesGenerator: " + e.toString()); // throw new RuntimeException("The DBPRoperty could not be generated: " + e.toString()); // } // } // // /** // * Retrieves the list of DBProperty elements associated with the Silo Config. // * // * @return the list of DBProperty properties associated with the Silo Config. // */ // public List<DBParam> getParams() // { // return m_param; // } // // /** // * Sets the list of other-type associated with the Silo Config. // * // * @param properties The other-types to be set. // */ // public void setParams(List<DBParam> param) // { // m_param = param; // } // // ///////////////////////////////////////////////////////////////////////// // // non-Public fields // ///////////////////////////////////////////////////////////////////////// // // /**The Properties associated with the Silo Config*/ // private List<DBParam> m_param; // }
import org.rapid7.nexpose.api.generators.IContentGenerator; import org.rapid7.nexpose.api.generators.ReportDBExportParamsGenerator;
public String getUserID() { return m_userid; } public void setUserID(String userid) { m_userid = userid; } public String getPassword() { return m_password; } public void setPassword(String password) { m_password = password; } public String getRealm() { return m_realm; } public void setRealm(String realm) { m_realm = realm; }
// Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/ReportDBExportParamsGenerator.java // public class ReportDBExportParamsGenerator implements IContentGenerator // { // // /** // * Represents a DBProperty associated with the storage configuration of a Silo Config. // * // * @author Leonardo Varela // */ // public static class DBParam // { // /** // * Retrieves the name of the property. // * // * @return the name of the property. // */ // public String getName() // { // return m_name; // } // // /** // * Sets the name of the property. // * // * @param name The name of the property. // */ // public void setName(String name) // { // m_name = name; // } // // /** // * Retrieves the value of the property // * // * @return The value of the property. // */ // public String getValue() // { // return m_value; // } // // /** // * Sets the value of the property // * // * @param value The value to set. // */ // public void setValue(String value) // { // m_value = value; // } // /** // * Creates a new Property. // * // * @param name The name of the property // * @param value The value of the property. // */ // public DBParam(String name, String value) // { // m_name = name; // m_value = value; // } // /**The name of the property. */ // private String m_name; // /**The value of the property. */ // private String m_value; // } // // ///////////////////////////////////////////////////////////////////////// // // Public methods // ///////////////////////////////////////////////////////////////////////// // // /** // * Creates a new Storage Properties generator for the silo config. // */ // public ReportDBExportParamsGenerator() // { // m_param = new ArrayList<DBParam>(); // } // // /** // * Knows how to print the xml output for properties elements inside of a <SiloConfig> element on the silo Config. // * // * @see java.lang.Object#toString() // */ // @Override // public String toString() // { // StringBuilder sb = new StringBuilder(); // Iterator<DBParam> itProperties = m_param.iterator(); // while(itProperties.hasNext()) // { // DBParam property = itProperties.next(); // sb.append("<param name=\""); // sb.append(StringUtils.xmlEscape(property.getName())); // sb.append("\">"); // sb.append(StringUtils.xmlEscape(property.getValue())); // sb.append("</param>"); // } // return sb.toString(); // } // // /* (non-Javadoc) // * @see org.rapid7.nexpose.api.IContentGenerator#setContents(org.w3c.dom.Element) // */ // @Override // public void setContents(Element contents) // { // try // { // final NodeList properties = (NodeList) XPathFactory.newInstance().newXPath().evaluate("DBExport", contents, XPathConstants.NODESET); // for (int i = 0; i < properties.getLength(); i++) // { // Element elementProperty = (Element) properties.item(i); // String name = elementProperty.getAttribute("name"); // String value = elementProperty.getNodeValue(); // DBParam param = new DBParam(name, value); // m_param.add(param); // } // } // catch (XPathExpressionException e) // { // System.out.println("Could not parse the generator for SiloConfigStoragePropertiesGenerator: " + e.toString()); // throw new RuntimeException("The DBPRoperty could not be generated: " + e.toString()); // } // } // // /** // * Retrieves the list of DBProperty elements associated with the Silo Config. // * // * @return the list of DBProperty properties associated with the Silo Config. // */ // public List<DBParam> getParams() // { // return m_param; // } // // /** // * Sets the list of other-type associated with the Silo Config. // * // * @param properties The other-types to be set. // */ // public void setParams(List<DBParam> param) // { // m_param = param; // } // // ///////////////////////////////////////////////////////////////////////// // // non-Public fields // ///////////////////////////////////////////////////////////////////////// // // /**The Properties associated with the Silo Config*/ // private List<DBParam> m_param; // } // Path: src/main/java/org/rapid7/nexpose/api/domain/ReportDBExport.java import org.rapid7.nexpose.api.generators.IContentGenerator; import org.rapid7.nexpose.api.generators.ReportDBExportParamsGenerator; public String getUserID() { return m_userid; } public void setUserID(String userid) { m_userid = userid; } public String getPassword() { return m_password; } public void setPassword(String password) { m_password = password; } public String getRealm() { return m_realm; } public void setRealm(String realm) { m_realm = realm; }
public IContentGenerator getParamGenerator()
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/SiloProfileConfigRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The Silo profile configuration request template. * * @author Christopher Lee. * */ public class SiloProfileConfigRequest extends TemplateAPIRequest { /** * Constructs the profile config request. * * @param siloID The silo profile ID. * @param sessionID The session ID. * @param syncID The sync ID. */ public SiloProfileConfigRequest(String sessionID, String syncID, String siloProfileID) { super(sessionID, syncID); set("silo-profile-id", siloProfileID);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // Path: src/main/java/org/rapid7/nexpose/api/SiloProfileConfigRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * The Silo profile configuration request template. * * @author Christopher Lee. * */ public class SiloProfileConfigRequest extends TemplateAPIRequest { /** * Constructs the profile config request. * * @param siloID The silo profile ID. * @param sessionID The session ID. * @param syncID The sync ID. */ public SiloProfileConfigRequest(String sessionID, String syncID, String siloProfileID) { super(sessionID, syncID); set("silo-profile-id", siloProfileID);
m_firstSupportedVersion = APISupportedVersion.V1_2;
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/UserSaveRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
/** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the UserSaveRequest NeXpose API request. * * @author Leonardo Varela */ public class UserSaveRequest extends TemplateAPIRequest { /** * Creates a new User Save Request with any given sites content generator and * any given group content generator. Sets the first API supported version to * 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param allGroups true if the user has access to all groups, false * otherwise (specified when creating/saving a config and Group * elements are not specified) * @param allSites true if the user has access to all sites, false otherwise * (specified when creating/saving a config and Site elements are not * specified) * @param authSrcId the positive integer that identifies the authentication * source to be used to authenticate the user. Should be one of the * existing authentication for correctness. * @param email the email of the user, should have the right email format. * This field is optional. * @param enabled true (or 1) if the user is enabled, false (or 0) otherwise. * This field is optional. * @param fullname a String that represents the full name of the user. * @param id the non negative integer that identifies the user, -1 to create * a new user. * @param name the String that represents the name of the user. This field * may not be updated, so only used for new users. You can still * specify it and NeXpose will throw an Exception. * @param password the String that represents the password of the user.\ * This field is optional, if present, the user's new password. * @param roleName the role name of the user, should be one of * global-admin for Global Administrator. * security-manager for Security Manager. * site-admin for Site Administrator. * system-admin for System Administrator. * user for User. * custom for Custom. NOTE: Be aware that there is not role management * enabled to date (1/6/2010) * @param sitesGenerator a Generator that knows how to output user sites with * IDs associated to it e.g. &lt;Site id="X"/&gt; where X is a non * negative Integer. Please see {@link UserSaveRequestSitesGenerator} * for a reference implementation. For QA testing you should construct * your own {@link IContentGenerator} to generate all the edge test * cases you can think of. * @param groupsGenerator a Generator that knows how to output user groups * with IDs associated to it e.g. &lt;Group id="X"/&gt; where X is a * non negative Integer. Please see * {@link UserSaveRequestGroupsGenerator} for a reference * implementation. For QA testing you should construct your own * {@link IContentGenerator} to generate all the edge test cases you * can think of. */ public UserSaveRequest( String sessionId, String syncId, String allGroups, String allSites, String authSrcId, String email, String enabled, String fullname, String id, String name, String password, String roleName,
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/UserSaveRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; /** * Copyright (C) 2012, Rapid7 LLC, Boston, MA, USA. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.rapid7.nexpose.api; /** * Represents the UserSaveRequest NeXpose API request. * * @author Leonardo Varela */ public class UserSaveRequest extends TemplateAPIRequest { /** * Creates a new User Save Request with any given sites content generator and * any given group content generator. Sets the first API supported version to * 1.0 and the last supported version to 1.1. * * NOTE: All parameters are strings or generators, since we want to be able * to test edge cases and simulate incorrect usage of the tool for robustness * * @param sessionId the session to be used if different from the current * acquired one (You acquire one when you authenticate correctly with * the login method in the {@link APISession} class). This is a * String of 40 characters. * @param syncId the synchronization id to identify the response associated * with the response in asynchronous environments. It can be any * string. This field is optional. * @param allGroups true if the user has access to all groups, false * otherwise (specified when creating/saving a config and Group * elements are not specified) * @param allSites true if the user has access to all sites, false otherwise * (specified when creating/saving a config and Site elements are not * specified) * @param authSrcId the positive integer that identifies the authentication * source to be used to authenticate the user. Should be one of the * existing authentication for correctness. * @param email the email of the user, should have the right email format. * This field is optional. * @param enabled true (or 1) if the user is enabled, false (or 0) otherwise. * This field is optional. * @param fullname a String that represents the full name of the user. * @param id the non negative integer that identifies the user, -1 to create * a new user. * @param name the String that represents the name of the user. This field * may not be updated, so only used for new users. You can still * specify it and NeXpose will throw an Exception. * @param password the String that represents the password of the user.\ * This field is optional, if present, the user's new password. * @param roleName the role name of the user, should be one of * global-admin for Global Administrator. * security-manager for Security Manager. * site-admin for Site Administrator. * system-admin for System Administrator. * user for User. * custom for Custom. NOTE: Be aware that there is not role management * enabled to date (1/6/2010) * @param sitesGenerator a Generator that knows how to output user sites with * IDs associated to it e.g. &lt;Site id="X"/&gt; where X is a non * negative Integer. Please see {@link UserSaveRequestSitesGenerator} * for a reference implementation. For QA testing you should construct * your own {@link IContentGenerator} to generate all the edge test * cases you can think of. * @param groupsGenerator a Generator that knows how to output user groups * with IDs associated to it e.g. &lt;Group id="X"/&gt; where X is a * non negative Integer. Please see * {@link UserSaveRequestGroupsGenerator} for a reference * implementation. For QA testing you should construct your own * {@link IContentGenerator} to generate all the edge test cases you * can think of. */ public UserSaveRequest( String sessionId, String syncId, String allGroups, String allSites, String authSrcId, String email, String enabled, String fullname, String id, String name, String password, String roleName,
IContentGenerator sitesGenerator,
rapid7/nexpose_java_api
src/main/java/org/rapid7/nexpose/api/UserSaveRequest.java
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // }
import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator;
*/ public UserSaveRequest( String sessionId, String syncId, String allGroups, String allSites, String authSrcId, String email, String enabled, String fullname, String id, String name, String password, String roleName, IContentGenerator sitesGenerator, IContentGenerator groupsGenerator) { super(sessionId, syncId); set("allGroups", allGroups); set("allSites", allSites); set("authSrcId", authSrcId); set("email", email); set("enabled", enabled); set("fullname", fullname); set("id", id); set("name", name); set("password", password); set("roleName", roleName); set("sitesGenerator", sitesGenerator); set("groupsGenerator", groupsGenerator);
// Path: src/main/java/org/rapid7/nexpose/api/APISession.java // public enum APISupportedVersion // { // V1_0("1.0"), V1_1("1.1"), V1_2("1.2"); // private String m_version; // // APISupportedVersion(String value) // { // m_version = value; // } // String getVersion() // { // return m_version; // } // } // // Path: src/main/java/org/rapid7/nexpose/api/generators/IContentGenerator.java // public interface IContentGenerator // { // /** // * Knows how to generate content for a request. // * @return the generated content // */ // String toString(); // /** // * Sets the contents of the generator that come as a parameter // */ // void setContents(Element contents); // } // Path: src/main/java/org/rapid7/nexpose/api/UserSaveRequest.java import org.rapid7.nexpose.api.APISession.APISupportedVersion; import org.rapid7.nexpose.api.generators.IContentGenerator; */ public UserSaveRequest( String sessionId, String syncId, String allGroups, String allSites, String authSrcId, String email, String enabled, String fullname, String id, String name, String password, String roleName, IContentGenerator sitesGenerator, IContentGenerator groupsGenerator) { super(sessionId, syncId); set("allGroups", allGroups); set("allSites", allSites); set("authSrcId", authSrcId); set("email", email); set("enabled", enabled); set("fullname", fullname); set("id", id); set("name", name); set("password", password); set("roleName", roleName); set("sitesGenerator", sitesGenerator); set("groupsGenerator", groupsGenerator);
m_firstSupportedVersion = APISupportedVersion.V1_0;
idega/is.idega.idegaweb.egov.cases.focal
src/java/is/idega/idegaweb/egov/cases/focal/business/ExportCasesManagementBean.java
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/CaseArg.java // public class CaseArg { // // private GeneralCase gcase; // private Status status; // // public GeneralCase getGcase() { // return gcase; // } // public void setGcase(GeneralCase gcase) { // this.gcase = gcase; // } // public Status getStatus() { // return status; // } // public void setStatus(Status status) { // this.status = status; // } // } // // Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/Status.java // public class Status { // // public static final int success = 0; // public static final int unknown_fail = 1; // public static final int no_customer = 2; // public static final int no_projects = 3; // public static final int failed_to_save = 6; // // /* // * "1" = Error with getting a support document. A more detailed error message comes within "errorText" // "2" = errorText = "Error: User does not have access to use this webservice" // "3" = errorText = "Error: Database was not found on "| + strServer + | " - " | + strPath +|"| // "6" = errorText = " Error: The saving of a document in the document system was not successful" + Cstr(Err) + " - " + Error (A more detailed explanation comes why saving was not successful) // "0" = OK, no errorText sent with // "100" = errorText = "Error " + Cstr(Err) + " - " + Error (These are errors that I can not forsee, and therefore here come direct error messages from Notes in errorText) // */ // // private int status = -1; // // public Status(int status) { // // if(status < 0 || (status > 3 && status != 6)) // throw new RuntimeException("Value not supported: "+status); // // this.status = status; // } // // public Integer getStatus() { // // return new Integer(status); // } // }
import is.idega.idegaweb.egov.cases.data.GeneralCase; import is.idega.idegaweb.egov.cases.focal.business.beans.CaseArg; import is.idega.idegaweb.egov.cases.focal.business.beans.Status; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.transaction.SystemException; import javax.transaction.TransactionManager; import com.idega.business.IBOServiceBean; import com.idega.data.IDOStoreException; import com.idega.transaction.IdegaTransactionManager;
package is.idega.idegaweb.egov.cases.focal.business; /** * * Last modified: $Date: 2007/05/05 19:00:06 $ by $Author: civilis $ * * @author <a href="civilis@idega.com">Vytautas Čivilis</a> * @version $Revision: 1.2 $ */ public class ExportCasesManagementBean extends IBOServiceBean implements ExportCasesManagement { private static final long serialVersionUID = -4409596745472629280L; private Logger logger = Logger.getLogger(ExportCasesManagementBean.class.getName()); /** * @see ExportCasesManagement method description * */ public void updateCasesExternalId(String project_id, List cases) { TransactionManager tm = IdegaTransactionManager.getInstance(GeneralCase.class); boolean transaction_started = false; try { tm.begin(); transaction_started = true; } catch (Exception e) { logger.log(Level.SEVERE, "Transaction failed to begin, storing immediately", e); } for (Iterator iter = cases.iterator(); iter.hasNext();) {
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/CaseArg.java // public class CaseArg { // // private GeneralCase gcase; // private Status status; // // public GeneralCase getGcase() { // return gcase; // } // public void setGcase(GeneralCase gcase) { // this.gcase = gcase; // } // public Status getStatus() { // return status; // } // public void setStatus(Status status) { // this.status = status; // } // } // // Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/Status.java // public class Status { // // public static final int success = 0; // public static final int unknown_fail = 1; // public static final int no_customer = 2; // public static final int no_projects = 3; // public static final int failed_to_save = 6; // // /* // * "1" = Error with getting a support document. A more detailed error message comes within "errorText" // "2" = errorText = "Error: User does not have access to use this webservice" // "3" = errorText = "Error: Database was not found on "| + strServer + | " - " | + strPath +|"| // "6" = errorText = " Error: The saving of a document in the document system was not successful" + Cstr(Err) + " - " + Error (A more detailed explanation comes why saving was not successful) // "0" = OK, no errorText sent with // "100" = errorText = "Error " + Cstr(Err) + " - " + Error (These are errors that I can not forsee, and therefore here come direct error messages from Notes in errorText) // */ // // private int status = -1; // // public Status(int status) { // // if(status < 0 || (status > 3 && status != 6)) // throw new RuntimeException("Value not supported: "+status); // // this.status = status; // } // // public Integer getStatus() { // // return new Integer(status); // } // } // Path: src/java/is/idega/idegaweb/egov/cases/focal/business/ExportCasesManagementBean.java import is.idega.idegaweb.egov.cases.data.GeneralCase; import is.idega.idegaweb.egov.cases.focal.business.beans.CaseArg; import is.idega.idegaweb.egov.cases.focal.business.beans.Status; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.transaction.SystemException; import javax.transaction.TransactionManager; import com.idega.business.IBOServiceBean; import com.idega.data.IDOStoreException; import com.idega.transaction.IdegaTransactionManager; package is.idega.idegaweb.egov.cases.focal.business; /** * * Last modified: $Date: 2007/05/05 19:00:06 $ by $Author: civilis $ * * @author <a href="civilis@idega.com">Vytautas Čivilis</a> * @version $Revision: 1.2 $ */ public class ExportCasesManagementBean extends IBOServiceBean implements ExportCasesManagement { private static final long serialVersionUID = -4409596745472629280L; private Logger logger = Logger.getLogger(ExportCasesManagementBean.class.getName()); /** * @see ExportCasesManagement method description * */ public void updateCasesExternalId(String project_id, List cases) { TransactionManager tm = IdegaTransactionManager.getInstance(GeneralCase.class); boolean transaction_started = false; try { tm.begin(); transaction_started = true; } catch (Exception e) { logger.log(Level.SEVERE, "Transaction failed to begin, storing immediately", e); } for (Iterator iter = cases.iterator(); iter.hasNext();) {
CaseArg case_arg = (CaseArg) iter.next();
idega/is.idega.idegaweb.egov.cases.focal
src/java/is/idega/idegaweb/egov/cases/focal/business/ExportCasesManagementBean.java
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/CaseArg.java // public class CaseArg { // // private GeneralCase gcase; // private Status status; // // public GeneralCase getGcase() { // return gcase; // } // public void setGcase(GeneralCase gcase) { // this.gcase = gcase; // } // public Status getStatus() { // return status; // } // public void setStatus(Status status) { // this.status = status; // } // } // // Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/Status.java // public class Status { // // public static final int success = 0; // public static final int unknown_fail = 1; // public static final int no_customer = 2; // public static final int no_projects = 3; // public static final int failed_to_save = 6; // // /* // * "1" = Error with getting a support document. A more detailed error message comes within "errorText" // "2" = errorText = "Error: User does not have access to use this webservice" // "3" = errorText = "Error: Database was not found on "| + strServer + | " - " | + strPath +|"| // "6" = errorText = " Error: The saving of a document in the document system was not successful" + Cstr(Err) + " - " + Error (A more detailed explanation comes why saving was not successful) // "0" = OK, no errorText sent with // "100" = errorText = "Error " + Cstr(Err) + " - " + Error (These are errors that I can not forsee, and therefore here come direct error messages from Notes in errorText) // */ // // private int status = -1; // // public Status(int status) { // // if(status < 0 || (status > 3 && status != 6)) // throw new RuntimeException("Value not supported: "+status); // // this.status = status; // } // // public Integer getStatus() { // // return new Integer(status); // } // }
import is.idega.idegaweb.egov.cases.data.GeneralCase; import is.idega.idegaweb.egov.cases.focal.business.beans.CaseArg; import is.idega.idegaweb.egov.cases.focal.business.beans.Status; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.transaction.SystemException; import javax.transaction.TransactionManager; import com.idega.business.IBOServiceBean; import com.idega.data.IDOStoreException; import com.idega.transaction.IdegaTransactionManager;
package is.idega.idegaweb.egov.cases.focal.business; /** * * Last modified: $Date: 2007/05/05 19:00:06 $ by $Author: civilis $ * * @author <a href="civilis@idega.com">Vytautas Čivilis</a> * @version $Revision: 1.2 $ */ public class ExportCasesManagementBean extends IBOServiceBean implements ExportCasesManagement { private static final long serialVersionUID = -4409596745472629280L; private Logger logger = Logger.getLogger(ExportCasesManagementBean.class.getName()); /** * @see ExportCasesManagement method description * */ public void updateCasesExternalId(String project_id, List cases) { TransactionManager tm = IdegaTransactionManager.getInstance(GeneralCase.class); boolean transaction_started = false; try { tm.begin(); transaction_started = true; } catch (Exception e) { logger.log(Level.SEVERE, "Transaction failed to begin, storing immediately", e); } for (Iterator iter = cases.iterator(); iter.hasNext();) { CaseArg case_arg = (CaseArg) iter.next();
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/CaseArg.java // public class CaseArg { // // private GeneralCase gcase; // private Status status; // // public GeneralCase getGcase() { // return gcase; // } // public void setGcase(GeneralCase gcase) { // this.gcase = gcase; // } // public Status getStatus() { // return status; // } // public void setStatus(Status status) { // this.status = status; // } // } // // Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/Status.java // public class Status { // // public static final int success = 0; // public static final int unknown_fail = 1; // public static final int no_customer = 2; // public static final int no_projects = 3; // public static final int failed_to_save = 6; // // /* // * "1" = Error with getting a support document. A more detailed error message comes within "errorText" // "2" = errorText = "Error: User does not have access to use this webservice" // "3" = errorText = "Error: Database was not found on "| + strServer + | " - " | + strPath +|"| // "6" = errorText = " Error: The saving of a document in the document system was not successful" + Cstr(Err) + " - " + Error (A more detailed explanation comes why saving was not successful) // "0" = OK, no errorText sent with // "100" = errorText = "Error " + Cstr(Err) + " - " + Error (These are errors that I can not forsee, and therefore here come direct error messages from Notes in errorText) // */ // // private int status = -1; // // public Status(int status) { // // if(status < 0 || (status > 3 && status != 6)) // throw new RuntimeException("Value not supported: "+status); // // this.status = status; // } // // public Integer getStatus() { // // return new Integer(status); // } // } // Path: src/java/is/idega/idegaweb/egov/cases/focal/business/ExportCasesManagementBean.java import is.idega.idegaweb.egov.cases.data.GeneralCase; import is.idega.idegaweb.egov.cases.focal.business.beans.CaseArg; import is.idega.idegaweb.egov.cases.focal.business.beans.Status; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.transaction.SystemException; import javax.transaction.TransactionManager; import com.idega.business.IBOServiceBean; import com.idega.data.IDOStoreException; import com.idega.transaction.IdegaTransactionManager; package is.idega.idegaweb.egov.cases.focal.business; /** * * Last modified: $Date: 2007/05/05 19:00:06 $ by $Author: civilis $ * * @author <a href="civilis@idega.com">Vytautas Čivilis</a> * @version $Revision: 1.2 $ */ public class ExportCasesManagementBean extends IBOServiceBean implements ExportCasesManagement { private static final long serialVersionUID = -4409596745472629280L; private Logger logger = Logger.getLogger(ExportCasesManagementBean.class.getName()); /** * @see ExportCasesManagement method description * */ public void updateCasesExternalId(String project_id, List cases) { TransactionManager tm = IdegaTransactionManager.getInstance(GeneralCase.class); boolean transaction_started = false; try { tm.begin(); transaction_started = true; } catch (Exception e) { logger.log(Level.SEVERE, "Transaction failed to begin, storing immediately", e); } for (Iterator iter = cases.iterator(); iter.hasNext();) { CaseArg case_arg = (CaseArg) iter.next();
Status status = case_arg.getStatus();
idega/is.idega.idegaweb.egov.cases.focal
src/java/is/idega/idegaweb/egov/cases/focal/business/UnsuccessfulStatusException.java
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/Status.java // public class Status { // // public static final int success = 0; // public static final int unknown_fail = 1; // public static final int no_customer = 2; // public static final int no_projects = 3; // public static final int failed_to_save = 6; // // /* // * "1" = Error with getting a support document. A more detailed error message comes within "errorText" // "2" = errorText = "Error: User does not have access to use this webservice" // "3" = errorText = "Error: Database was not found on "| + strServer + | " - " | + strPath +|"| // "6" = errorText = " Error: The saving of a document in the document system was not successful" + Cstr(Err) + " - " + Error (A more detailed explanation comes why saving was not successful) // "0" = OK, no errorText sent with // "100" = errorText = "Error " + Cstr(Err) + " - " + Error (These are errors that I can not forsee, and therefore here come direct error messages from Notes in errorText) // */ // // private int status = -1; // // public Status(int status) { // // if(status < 0 || (status > 3 && status != 6)) // throw new RuntimeException("Value not supported: "+status); // // this.status = status; // } // // public Integer getStatus() { // // return new Integer(status); // } // }
import is.idega.idegaweb.egov.cases.focal.business.beans.Status;
package is.idega.idegaweb.egov.cases.focal.business; /** * * Last modified: $Date: 2007/05/04 12:04:16 $ by $Author: civilis $ * * @author <a href="civilis@idega.com">Vytautas Čivilis</a> * @version $Revision: 1.2 $ */ public class UnsuccessfulStatusException extends Exception { private static final long serialVersionUID = 8020380823364682303L; public UnsuccessfulStatusException() { } public UnsuccessfulStatusException(String s) { super(s); } public UnsuccessfulStatusException(String s, Throwable throwable) { super(s, throwable); } public UnsuccessfulStatusException(Throwable throwable) { super(throwable); }
// Path: src/java/is/idega/idegaweb/egov/cases/focal/business/beans/Status.java // public class Status { // // public static final int success = 0; // public static final int unknown_fail = 1; // public static final int no_customer = 2; // public static final int no_projects = 3; // public static final int failed_to_save = 6; // // /* // * "1" = Error with getting a support document. A more detailed error message comes within "errorText" // "2" = errorText = "Error: User does not have access to use this webservice" // "3" = errorText = "Error: Database was not found on "| + strServer + | " - " | + strPath +|"| // "6" = errorText = " Error: The saving of a document in the document system was not successful" + Cstr(Err) + " - " + Error (A more detailed explanation comes why saving was not successful) // "0" = OK, no errorText sent with // "100" = errorText = "Error " + Cstr(Err) + " - " + Error (These are errors that I can not forsee, and therefore here come direct error messages from Notes in errorText) // */ // // private int status = -1; // // public Status(int status) { // // if(status < 0 || (status > 3 && status != 6)) // throw new RuntimeException("Value not supported: "+status); // // this.status = status; // } // // public Integer getStatus() { // // return new Integer(status); // } // } // Path: src/java/is/idega/idegaweb/egov/cases/focal/business/UnsuccessfulStatusException.java import is.idega.idegaweb.egov.cases.focal.business.beans.Status; package is.idega.idegaweb.egov.cases.focal.business; /** * * Last modified: $Date: 2007/05/04 12:04:16 $ by $Author: civilis $ * * @author <a href="civilis@idega.com">Vytautas Čivilis</a> * @version $Revision: 1.2 $ */ public class UnsuccessfulStatusException extends Exception { private static final long serialVersionUID = 8020380823364682303L; public UnsuccessfulStatusException() { } public UnsuccessfulStatusException(String s) { super(s); } public UnsuccessfulStatusException(String s, Throwable throwable) { super(s, throwable); } public UnsuccessfulStatusException(Throwable throwable) { super(throwable); }
private Status status;
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/data/Flow.java
// Path: app/src/main/java/io/rapidpro/surveyor/utils/JsonUtils.java // public class JsonUtils { // private static Gson s_gson = new GsonBuilder() // //.setPrettyPrinting() // .registerTypeAdapter(RawJson.class, new RawJson.Adapter()) // .create(); // // public static Gson getGson() { // return s_gson; // } // // public static String marshal(Object src) { // return s_gson.toJson(src); // } // // public static <T> T unmarshal(String json, Class<T> clazz) { // return s_gson.fromJson(json, clazz); // } // // public static <T> T unmarshal(String json, TypeToken type) { // return s_gson.fromJson(json, type.getType()); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/utils/RawJson.java // public class RawJson { // private String data; // // public RawJson(String data) { // this.data = data; // } // // @Override // public String toString() { // return this.data; // } // // /** // * Type adapter to tell Gson how to use fields of this type // */ // public static class Adapter extends TypeAdapter<RawJson> { // @Override // public void write(JsonWriter out, RawJson value) throws IOException { // out.jsonValue(value.toString()); // } // // @Override // public RawJson read(JsonReader in) throws IOException { // // TODO ideally this wouldn't parse the entire tree into memory // // see https://github.com/google/gson/issues/1368 // JsonElement parsed = new JsonParser().parse(in); // // return new RawJson(parsed.toString()); // } // } // }
import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.annotations.SerializedName; import com.nyaruka.goflow.mobile.FlowReference; import io.rapidpro.surveyor.utils.JsonUtils; import io.rapidpro.surveyor.utils.RawJson;
package io.rapidpro.surveyor.data; public class Flow { private String uuid; private String name; @SerializedName("spec_version") private String specVersion; private int revision; @SerializedName("question_count") private int questionCount; /** * Creates a new flow * * @param uuid the flow UUID * @param name the flow name * @param specVersion the flow spec version number * @param revision the flow revision number * @param questionCount the number of questions */ public Flow(String uuid, String name, String specVersion, int revision, int questionCount) { this.uuid = uuid; this.name = name; this.specVersion = specVersion; this.revision = revision; this.questionCount = questionCount; } /** * Extracts a flow summary from the given flow definition * * @param flow the flow definition * @return the flow summary */
// Path: app/src/main/java/io/rapidpro/surveyor/utils/JsonUtils.java // public class JsonUtils { // private static Gson s_gson = new GsonBuilder() // //.setPrettyPrinting() // .registerTypeAdapter(RawJson.class, new RawJson.Adapter()) // .create(); // // public static Gson getGson() { // return s_gson; // } // // public static String marshal(Object src) { // return s_gson.toJson(src); // } // // public static <T> T unmarshal(String json, Class<T> clazz) { // return s_gson.fromJson(json, clazz); // } // // public static <T> T unmarshal(String json, TypeToken type) { // return s_gson.fromJson(json, type.getType()); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/utils/RawJson.java // public class RawJson { // private String data; // // public RawJson(String data) { // this.data = data; // } // // @Override // public String toString() { // return this.data; // } // // /** // * Type adapter to tell Gson how to use fields of this type // */ // public static class Adapter extends TypeAdapter<RawJson> { // @Override // public void write(JsonWriter out, RawJson value) throws IOException { // out.jsonValue(value.toString()); // } // // @Override // public RawJson read(JsonReader in) throws IOException { // // TODO ideally this wouldn't parse the entire tree into memory // // see https://github.com/google/gson/issues/1368 // JsonElement parsed = new JsonParser().parse(in); // // return new RawJson(parsed.toString()); // } // } // } // Path: app/src/main/java/io/rapidpro/surveyor/data/Flow.java import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.annotations.SerializedName; import com.nyaruka.goflow.mobile.FlowReference; import io.rapidpro.surveyor.utils.JsonUtils; import io.rapidpro.surveyor.utils.RawJson; package io.rapidpro.surveyor.data; public class Flow { private String uuid; private String name; @SerializedName("spec_version") private String specVersion; private int revision; @SerializedName("question_count") private int questionCount; /** * Creates a new flow * * @param uuid the flow UUID * @param name the flow name * @param specVersion the flow spec version number * @param revision the flow revision number * @param questionCount the number of questions */ public Flow(String uuid, String name, String specVersion, int revision, int questionCount) { this.uuid = uuid; this.name = name; this.specVersion = specVersion; this.revision = revision; this.questionCount = questionCount; } /** * Extracts a flow summary from the given flow definition * * @param flow the flow definition * @return the flow summary */
public static Flow extract(RawJson flow) {
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/data/Flow.java
// Path: app/src/main/java/io/rapidpro/surveyor/utils/JsonUtils.java // public class JsonUtils { // private static Gson s_gson = new GsonBuilder() // //.setPrettyPrinting() // .registerTypeAdapter(RawJson.class, new RawJson.Adapter()) // .create(); // // public static Gson getGson() { // return s_gson; // } // // public static String marshal(Object src) { // return s_gson.toJson(src); // } // // public static <T> T unmarshal(String json, Class<T> clazz) { // return s_gson.fromJson(json, clazz); // } // // public static <T> T unmarshal(String json, TypeToken type) { // return s_gson.fromJson(json, type.getType()); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/utils/RawJson.java // public class RawJson { // private String data; // // public RawJson(String data) { // this.data = data; // } // // @Override // public String toString() { // return this.data; // } // // /** // * Type adapter to tell Gson how to use fields of this type // */ // public static class Adapter extends TypeAdapter<RawJson> { // @Override // public void write(JsonWriter out, RawJson value) throws IOException { // out.jsonValue(value.toString()); // } // // @Override // public RawJson read(JsonReader in) throws IOException { // // TODO ideally this wouldn't parse the entire tree into memory // // see https://github.com/google/gson/issues/1368 // JsonElement parsed = new JsonParser().parse(in); // // return new RawJson(parsed.toString()); // } // } // }
import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.annotations.SerializedName; import com.nyaruka.goflow.mobile.FlowReference; import io.rapidpro.surveyor.utils.JsonUtils; import io.rapidpro.surveyor.utils.RawJson;
package io.rapidpro.surveyor.data; public class Flow { private String uuid; private String name; @SerializedName("spec_version") private String specVersion; private int revision; @SerializedName("question_count") private int questionCount; /** * Creates a new flow * * @param uuid the flow UUID * @param name the flow name * @param specVersion the flow spec version number * @param revision the flow revision number * @param questionCount the number of questions */ public Flow(String uuid, String name, String specVersion, int revision, int questionCount) { this.uuid = uuid; this.name = name; this.specVersion = specVersion; this.revision = revision; this.questionCount = questionCount; } /** * Extracts a flow summary from the given flow definition * * @param flow the flow definition * @return the flow summary */ public static Flow extract(RawJson flow) {
// Path: app/src/main/java/io/rapidpro/surveyor/utils/JsonUtils.java // public class JsonUtils { // private static Gson s_gson = new GsonBuilder() // //.setPrettyPrinting() // .registerTypeAdapter(RawJson.class, new RawJson.Adapter()) // .create(); // // public static Gson getGson() { // return s_gson; // } // // public static String marshal(Object src) { // return s_gson.toJson(src); // } // // public static <T> T unmarshal(String json, Class<T> clazz) { // return s_gson.fromJson(json, clazz); // } // // public static <T> T unmarshal(String json, TypeToken type) { // return s_gson.fromJson(json, type.getType()); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/utils/RawJson.java // public class RawJson { // private String data; // // public RawJson(String data) { // this.data = data; // } // // @Override // public String toString() { // return this.data; // } // // /** // * Type adapter to tell Gson how to use fields of this type // */ // public static class Adapter extends TypeAdapter<RawJson> { // @Override // public void write(JsonWriter out, RawJson value) throws IOException { // out.jsonValue(value.toString()); // } // // @Override // public RawJson read(JsonReader in) throws IOException { // // TODO ideally this wouldn't parse the entire tree into memory // // see https://github.com/google/gson/issues/1368 // JsonElement parsed = new JsonParser().parse(in); // // return new RawJson(parsed.toString()); // } // } // } // Path: app/src/main/java/io/rapidpro/surveyor/data/Flow.java import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.annotations.SerializedName; import com.nyaruka.goflow.mobile.FlowReference; import io.rapidpro.surveyor.utils.JsonUtils; import io.rapidpro.surveyor.utils.RawJson; package io.rapidpro.surveyor.data; public class Flow { private String uuid; private String name; @SerializedName("spec_version") private String specVersion; private int revision; @SerializedName("question_count") private int questionCount; /** * Creates a new flow * * @param uuid the flow UUID * @param name the flow name * @param specVersion the flow spec version number * @param revision the flow revision number * @param questionCount the number of questions */ public Flow(String uuid, String name, String specVersion, int revision, int questionCount) { this.uuid = uuid; this.name = name; this.specVersion = specVersion; this.revision = revision; this.questionCount = questionCount; } /** * Extracts a flow summary from the given flow definition * * @param flow the flow definition * @return the flow summary */ public static Flow extract(RawJson flow) {
JsonObject definition = JsonUtils.unmarshal(flow.toString(), JsonObject.class);
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/widget/IconLinkView.java
// Path: app/src/main/java/io/rapidpro/surveyor/ui/CachedLinearLayout.java // public class CachedLinearLayout extends LinearLayout { // // private ViewCache m_cache; // // public CachedLinearLayout(Context context) { // super(context); // init(); // } // // public CachedLinearLayout(Context context, AttributeSet attrs) { // super(context, attrs); // init(); // } // // public CachedLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // init(); // } // // protected void init() { // m_cache = new ViewCache(getContext(), this); // } // // public TextView getTextView(int id) { // return m_cache.getTextView(id); // } // // public ImageView getImageView(int id) { // return m_cache.getImageView(id); // } // // public View getView(int id) { // return m_cache.getView(id); // } // // public void hide(int id) { // m_cache.hide(id); // } // // public void show(int id) { // m_cache.show(id); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // }
import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.TextView; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.ui.CachedLinearLayout; import io.rapidpro.surveyor.ui.IconTextView;
package io.rapidpro.surveyor.widget; public class IconLinkView extends CachedLinearLayout { public IconLinkView(Context context) { super(context); init(); } public IconLinkView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public IconLinkView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } protected void init() { super.init(); } public void initialize(String message, int type, String url) { View bubble = getView(R.id.chat_bubble); bubble.setTag(R.string.tag_url, url); bubble.setTag(R.string.tag_media_type, type); TextView tv = getTextView(R.id.text_message); tv.setText(message);
// Path: app/src/main/java/io/rapidpro/surveyor/ui/CachedLinearLayout.java // public class CachedLinearLayout extends LinearLayout { // // private ViewCache m_cache; // // public CachedLinearLayout(Context context) { // super(context); // init(); // } // // public CachedLinearLayout(Context context, AttributeSet attrs) { // super(context, attrs); // init(); // } // // public CachedLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // init(); // } // // protected void init() { // m_cache = new ViewCache(getContext(), this); // } // // public TextView getTextView(int id) { // return m_cache.getTextView(id); // } // // public ImageView getImageView(int id) { // return m_cache.getImageView(id); // } // // public View getView(int id) { // return m_cache.getView(id); // } // // public void hide(int id) { // m_cache.hide(id); // } // // public void show(int id) { // m_cache.show(id); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/widget/IconLinkView.java import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.TextView; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.ui.CachedLinearLayout; import io.rapidpro.surveyor.ui.IconTextView; package io.rapidpro.surveyor.widget; public class IconLinkView extends CachedLinearLayout { public IconLinkView(Context context) { super(context); init(); } public IconLinkView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public IconLinkView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } protected void init() { super.init(); } public void initialize(String message, int type, String url) { View bubble = getView(R.id.chat_bubble); bubble.setTag(R.string.tag_url, url); bubble.setTag(R.string.tag_media_type, type); TextView tv = getTextView(R.id.text_message); tv.setText(message);
IconTextView iconView = (IconTextView) getTextView(R.id.media_icon);
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/net/responses/Definitions.java
// Path: app/src/main/java/io/rapidpro/surveyor/utils/RawJson.java // public class RawJson { // private String data; // // public RawJson(String data) { // this.data = data; // } // // @Override // public String toString() { // return this.data; // } // // /** // * Type adapter to tell Gson how to use fields of this type // */ // public static class Adapter extends TypeAdapter<RawJson> { // @Override // public void write(JsonWriter out, RawJson value) throws IOException { // out.jsonValue(value.toString()); // } // // @Override // public RawJson read(JsonReader in) throws IOException { // // TODO ideally this wouldn't parse the entire tree into memory // // see https://github.com/google/gson/issues/1368 // JsonElement parsed = new JsonParser().parse(in); // // return new RawJson(parsed.toString()); // } // } // }
import java.util.List; import io.rapidpro.surveyor.utils.RawJson;
package io.rapidpro.surveyor.net.responses; public class Definitions { private String version; private String site;
// Path: app/src/main/java/io/rapidpro/surveyor/utils/RawJson.java // public class RawJson { // private String data; // // public RawJson(String data) { // this.data = data; // } // // @Override // public String toString() { // return this.data; // } // // /** // * Type adapter to tell Gson how to use fields of this type // */ // public static class Adapter extends TypeAdapter<RawJson> { // @Override // public void write(JsonWriter out, RawJson value) throws IOException { // out.jsonValue(value.toString()); // } // // @Override // public RawJson read(JsonReader in) throws IOException { // // TODO ideally this wouldn't parse the entire tree into memory // // see https://github.com/google/gson/issues/1368 // JsonElement parsed = new JsonParser().parse(in); // // return new RawJson(parsed.toString()); // } // } // } // Path: app/src/main/java/io/rapidpro/surveyor/net/responses/Definitions.java import java.util.List; import io.rapidpro.surveyor.utils.RawJson; package io.rapidpro.surveyor.net.responses; public class Definitions { private String version; private String site;
private List<RawJson> flows;
rapidpro/surveyor
app/src/test/java/io/rapidpro/surveyor/data/FlowTest.java
// Path: app/src/main/java/io/rapidpro/surveyor/utils/RawJson.java // public class RawJson { // private String data; // // public RawJson(String data) { // this.data = data; // } // // @Override // public String toString() { // return this.data; // } // // /** // * Type adapter to tell Gson how to use fields of this type // */ // public static class Adapter extends TypeAdapter<RawJson> { // @Override // public void write(JsonWriter out, RawJson value) throws IOException { // out.jsonValue(value.toString()); // } // // @Override // public RawJson read(JsonReader in) throws IOException { // // TODO ideally this wouldn't parse the entire tree into memory // // see https://github.com/google/gson/issues/1368 // JsonElement parsed = new JsonParser().parse(in); // // return new RawJson(parsed.toString()); // } // } // }
import org.apache.commons.io.FileUtils; import org.junit.Test; import java.io.File; import java.io.IOException; import io.rapidpro.surveyor.utils.RawJson; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat;
package io.rapidpro.surveyor.data; public class FlowTest { @Test public void extractV13() throws IOException { File flow = new File(FlowTest.class.getClassLoader().getResource("flows/two_questions_v13.json").getPath()); String definition = FileUtils.readFileToString(flow);
// Path: app/src/main/java/io/rapidpro/surveyor/utils/RawJson.java // public class RawJson { // private String data; // // public RawJson(String data) { // this.data = data; // } // // @Override // public String toString() { // return this.data; // } // // /** // * Type adapter to tell Gson how to use fields of this type // */ // public static class Adapter extends TypeAdapter<RawJson> { // @Override // public void write(JsonWriter out, RawJson value) throws IOException { // out.jsonValue(value.toString()); // } // // @Override // public RawJson read(JsonReader in) throws IOException { // // TODO ideally this wouldn't parse the entire tree into memory // // see https://github.com/google/gson/issues/1368 // JsonElement parsed = new JsonParser().parse(in); // // return new RawJson(parsed.toString()); // } // } // } // Path: app/src/test/java/io/rapidpro/surveyor/data/FlowTest.java import org.apache.commons.io.FileUtils; import org.junit.Test; import java.io.File; import java.io.IOException; import io.rapidpro.surveyor.utils.RawJson; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; package io.rapidpro.surveyor.data; public class FlowTest { @Test public void extractV13() throws IOException { File flow = new File(FlowTest.class.getClassLoader().getResource("flows/two_questions_v13.json").getPath()); String definition = FileUtils.readFileToString(flow);
Flow summary = Flow.extract(new RawJson(definition));
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/ui/CameraPreview.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // }
import android.app.Activity; import android.content.Context; import android.hardware.Camera; import android.hardware.SensorManager; import android.util.Log; import android.view.Display; import android.view.OrientationEventListener; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.WindowManager; import java.io.IOException; import io.rapidpro.surveyor.Logger;
m_camera.setDisplayOrientation(CameraUtil.getRotationDegrees(m_activity, m_cameraId, true)); } /** * Refresh the camera according to it's properties. Use for toggling between * front and rear cameras */ public void refreshCamera(Camera camera, int cameraId) { if (m_surfaceHolder.getSurface() == null) { return; } if (m_camera != null) { try { m_camera.stopPreview(); } catch (Exception e) { // we may already be released } } m_camera = camera; m_cameraId = cameraId; m_camera.setDisplayOrientation(CameraUtil.getRotationDegrees(m_activity, m_cameraId, true)); try { m_camera.setPreviewDisplay(m_surfaceHolder); m_camera.startPreview(); } catch (Exception e) {
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/ui/CameraPreview.java import android.app.Activity; import android.content.Context; import android.hardware.Camera; import android.hardware.SensorManager; import android.util.Log; import android.view.Display; import android.view.OrientationEventListener; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.WindowManager; import java.io.IOException; import io.rapidpro.surveyor.Logger; m_camera.setDisplayOrientation(CameraUtil.getRotationDegrees(m_activity, m_cameraId, true)); } /** * Refresh the camera according to it's properties. Use for toggling between * front and rear cameras */ public void refreshCamera(Camera camera, int cameraId) { if (m_surfaceHolder.getSurface() == null) { return; } if (m_camera != null) { try { m_camera.stopPreview(); } catch (Exception e) { // we may already be released } } m_camera = camera; m_cameraId = cameraId; m_camera.setDisplayOrientation(CameraUtil.getRotationDegrees(m_activity, m_cameraId, true)); try { m_camera.setPreviewDisplay(m_surfaceHolder); m_camera.startPreview(); } catch (Exception e) {
Logger.e("Error starting camera preview", e);
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/utils/ImageUtils.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // }
import android.graphics.Bitmap; import android.graphics.Matrix; import androidx.exifinterface.media.ExifInterface; import io.rapidpro.surveyor.Logger; import android.media.ThumbnailUtils; import android.provider.MediaStore; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException;
} } /** * Rotates a bitmap by the given number of degrees */ public static Bitmap rotateImage(Bitmap img, int degrees) { Matrix matrix = new Matrix(); matrix.postRotate(degrees); Bitmap rotatedImg = Bitmap.createBitmap(img, 0, 0, img.getWidth(), img.getHeight(), matrix, true); img.recycle(); return rotatedImg; } /** * Gets the EXIF orientation (if set) in degrees */ public static int getExifRotation(String path) { try { ExifInterface exif = new ExifInterface(path); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: return 90; case ExifInterface.ORIENTATION_ROTATE_180: return 180; case ExifInterface.ORIENTATION_ROTATE_270: return 270; } } catch (IOException e) {
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/utils/ImageUtils.java import android.graphics.Bitmap; import android.graphics.Matrix; import androidx.exifinterface.media.ExifInterface; import io.rapidpro.surveyor.Logger; import android.media.ThumbnailUtils; import android.provider.MediaStore; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; } } /** * Rotates a bitmap by the given number of degrees */ public static Bitmap rotateImage(Bitmap img, int degrees) { Matrix matrix = new Matrix(); matrix.postRotate(degrees); Bitmap rotatedImg = Bitmap.createBitmap(img, 0, 0, img.getWidth(), img.getHeight(), matrix, true); img.recycle(); return rotatedImg; } /** * Gets the EXIF orientation (if set) in degrees */ public static int getExifRotation(String path) { try { ExifInterface exif = new ExifInterface(path); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: return 90; case ExifInterface.ORIENTATION_ROTATE_180: return 180; case ExifInterface.ORIENTATION_ROTATE_270: return 270; } } catch (IOException e) {
Logger.d("Unable to read EXIF data from " + path);
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/activity/SettingsActivity.java
// Path: app/src/main/java/io/rapidpro/surveyor/fragment/SettingsFragment.java // public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { // // public SettingsFragment() { // // Required empty public constructor // } // // @Override // public void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // // make sure we're editing the correct preferences // getPreferenceManager().setSharedPreferencesName(getSurveyor().getPreferencesName()); // // // load the preference screen from an XML resource // addPreferencesFromResource(R.xml.preferences); // // Preference pref = findPreference(SurveyorPreferences.HOST); // pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { // @Override // public boolean onPreferenceChange(Preference preference, Object newValue) { // if (!Patterns.WEB_URL.matcher((String) newValue).matches()) { // Toast.makeText(getActivity(), getString(R.string.error_invalid_host), Toast.LENGTH_SHORT).show(); // return false; // } // return true; // } // }); // } // // @Override // public void onResume() { // super.onResume(); // // getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); // } // // @Override // public void onPause() { // getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); // // super.onPause(); // } // // @Override // public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { // if (key.equals(SurveyorPreferences.HOST)) { // getSurveyor().onTembaHostChanged(); // } // } // // private SurveyorApplication getSurveyor() { // return ((BaseActivity) getActivity()).getSurveyor(); // } // }
import android.app.FragmentTransaction; import android.os.Bundle; import io.rapidpro.surveyor.fragment.SettingsFragment;
package io.rapidpro.surveyor.activity; /** * Activity for modifying app settings */ public class SettingsActivity extends BaseActivity { public boolean requireLogin() { return false; } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FragmentTransaction ft = getFragmentManager().beginTransaction();
// Path: app/src/main/java/io/rapidpro/surveyor/fragment/SettingsFragment.java // public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { // // public SettingsFragment() { // // Required empty public constructor // } // // @Override // public void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // // // make sure we're editing the correct preferences // getPreferenceManager().setSharedPreferencesName(getSurveyor().getPreferencesName()); // // // load the preference screen from an XML resource // addPreferencesFromResource(R.xml.preferences); // // Preference pref = findPreference(SurveyorPreferences.HOST); // pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { // @Override // public boolean onPreferenceChange(Preference preference, Object newValue) { // if (!Patterns.WEB_URL.matcher((String) newValue).matches()) { // Toast.makeText(getActivity(), getString(R.string.error_invalid_host), Toast.LENGTH_SHORT).show(); // return false; // } // return true; // } // }); // } // // @Override // public void onResume() { // super.onResume(); // // getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); // } // // @Override // public void onPause() { // getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); // // super.onPause(); // } // // @Override // public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { // if (key.equals(SurveyorPreferences.HOST)) { // getSurveyor().onTembaHostChanged(); // } // } // // private SurveyorApplication getSurveyor() { // return ((BaseActivity) getActivity()).getSurveyor(); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/activity/SettingsActivity.java import android.app.FragmentTransaction; import android.os.Bundle; import io.rapidpro.surveyor.fragment.SettingsFragment; package io.rapidpro.surveyor.activity; /** * Activity for modifying app settings */ public class SettingsActivity extends BaseActivity { public boolean requireLogin() { return false; } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(android.R.id.content, new SettingsFragment()).commit();
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/ui/Typefaces.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // }
import io.rapidpro.surveyor.Logger; import android.content.Context; import android.graphics.Typeface; import java.util.Hashtable;
/* * RapidPro Android Channel - Relay SMS messages where MNO connections aren't practical. * Copyright (C) 2014 Nyaruka, UNICEF * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package io.rapidpro.surveyor.ui; public class Typefaces { private static final Hashtable<String, Typeface> s_fontCache = new Hashtable<String, Typeface>(); public static Typeface get(Context c, String assetPath) { synchronized (s_fontCache) { if (!s_fontCache.containsKey(assetPath)) { try { Typeface t = Typeface.createFromAsset(c.getAssets(), assetPath); s_fontCache.put(assetPath, t); } catch (Exception e) {
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/ui/Typefaces.java import io.rapidpro.surveyor.Logger; import android.content.Context; import android.graphics.Typeface; import java.util.Hashtable; /* * RapidPro Android Channel - Relay SMS messages where MNO connections aren't practical. * Copyright (C) 2014 Nyaruka, UNICEF * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package io.rapidpro.surveyor.ui; public class Typefaces { private static final Hashtable<String, Typeface> s_fontCache = new Hashtable<String, Typeface>(); public static Typeface get(Context c, String assetPath) { synchronized (s_fontCache) { if (!s_fontCache.containsKey(assetPath)) { try { Typeface t = Typeface.createFromAsset(c.getAssets(), assetPath); s_fontCache.put(assetPath, t); } catch (Exception e) {
Logger.e("Could not get typeface '" + assetPath + "' because " + e.getMessage(), e);
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/activity/CaptureLocationActivity.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // }
import android.Manifest; import android.content.Intent; import android.location.Location; import android.os.Bundle; import android.view.View; import android.widget.TextView; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationCallback; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationResult; import com.google.android.gms.location.LocationServices; import com.greysonparrelli.permiso.Permiso; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.ui.IconTextView;
}; } @Override public boolean requireLogin() { return false; } @Override public void onPause() { super.onPause(); stopLocationUpdates(); } protected void connectGoogleApi() { googleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); googleApiClient.connect(); } /** * Start receiving location updates */ @SuppressWarnings("ResourceType") private void startLocationUpdates() {
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/activity/CaptureLocationActivity.java import android.Manifest; import android.content.Intent; import android.location.Location; import android.os.Bundle; import android.view.View; import android.widget.TextView; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationCallback; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationResult; import com.google.android.gms.location.LocationServices; import com.greysonparrelli.permiso.Permiso; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.ui.IconTextView; }; } @Override public boolean requireLogin() { return false; } @Override public void onPause() { super.onPause(); stopLocationUpdates(); } protected void connectGoogleApi() { googleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); googleApiClient.connect(); } /** * Start receiving location updates */ @SuppressWarnings("ResourceType") private void startLocationUpdates() {
Logger.d("Starting location updates...");
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/activity/CaptureLocationActivity.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // }
import android.Manifest; import android.content.Intent; import android.location.Location; import android.os.Bundle; import android.view.View; import android.widget.TextView; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationCallback; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationResult; import com.google.android.gms.location.LocationServices; import com.greysonparrelli.permiso.Permiso; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.ui.IconTextView;
@Override public boolean requireLogin() { return false; } @Override public void onPause() { super.onPause(); stopLocationUpdates(); } protected void connectGoogleApi() { googleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); googleApiClient.connect(); } /** * Start receiving location updates */ @SuppressWarnings("ResourceType") private void startLocationUpdates() { Logger.d("Starting location updates...");
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/activity/CaptureLocationActivity.java import android.Manifest; import android.content.Intent; import android.location.Location; import android.os.Bundle; import android.view.View; import android.widget.TextView; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.FusedLocationProviderClient; import com.google.android.gms.location.LocationCallback; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationResult; import com.google.android.gms.location.LocationServices; import com.greysonparrelli.permiso.Permiso; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.ui.IconTextView; @Override public boolean requireLogin() { return false; } @Override public void onPause() { super.onPause(); stopLocationUpdates(); } protected void connectGoogleApi() { googleApiClient = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); googleApiClient.connect(); } /** * Start receiving location updates */ @SuppressWarnings("ResourceType") private void startLocationUpdates() { Logger.d("Starting location updates...");
IconTextView button = (IconTextView) getViewCache().getView(R.id.button_capture);
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/data/OrgService.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/net/TembaException.java // public class TembaException extends SurveyorException { // public TembaException(String message) { // super(message); // } // // public TembaException(String message, Exception e) { // super(message, e); // } // }
import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.net.TembaException;
package io.rapidpro.surveyor.data; /** * Directory based service for org configurations */ public class OrgService { private File rootDir; private Map<String, Org> cache = new HashMap<>(); public OrgService(File rootDir) { this.rootDir = rootDir;
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/net/TembaException.java // public class TembaException extends SurveyorException { // public TembaException(String message) { // super(message); // } // // public TembaException(String message, Exception e) { // super(message, e); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/data/OrgService.java import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.net.TembaException; package io.rapidpro.surveyor.data; /** * Directory based service for org configurations */ public class OrgService { private File rootDir; private Map<String, Org> cache = new HashMap<>(); public OrgService(File rootDir) { this.rootDir = rootDir;
Logger.d("OrgService created for directory " + this.rootDir.getAbsolutePath());
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/data/OrgService.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/net/TembaException.java // public class TembaException extends SurveyorException { // public TembaException(String message) { // super(message); // } // // public TembaException(String message, Exception e) { // super(message, e); // } // }
import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.net.TembaException;
package io.rapidpro.surveyor.data; /** * Directory based service for org configurations */ public class OrgService { private File rootDir; private Map<String, Org> cache = new HashMap<>(); public OrgService(File rootDir) { this.rootDir = rootDir; Logger.d("OrgService created for directory " + this.rootDir.getAbsolutePath()); } public Org get(String uuid) throws IOException { if (cache.containsKey(uuid)) { Logger.d("Returning cached org " + uuid); return cache.get(uuid); } File directory = new File(rootDir, uuid); Org org = Org.load(directory); Logger.d("Loaded org " + uuid); cache.put(uuid, org); return org; } /** * Fetches an org using the given API token and saves it to the org storage * * @param uuid the UUID of the org * @param name the name of the org * @param token the API token */
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/net/TembaException.java // public class TembaException extends SurveyorException { // public TembaException(String message) { // super(message); // } // // public TembaException(String message, Exception e) { // super(message, e); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/data/OrgService.java import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.net.TembaException; package io.rapidpro.surveyor.data; /** * Directory based service for org configurations */ public class OrgService { private File rootDir; private Map<String, Org> cache = new HashMap<>(); public OrgService(File rootDir) { this.rootDir = rootDir; Logger.d("OrgService created for directory " + this.rootDir.getAbsolutePath()); } public Org get(String uuid) throws IOException { if (cache.containsKey(uuid)) { Logger.d("Returning cached org " + uuid); return cache.get(uuid); } File directory = new File(rootDir, uuid); Org org = Org.load(directory); Logger.d("Loaded org " + uuid); cache.put(uuid, org); return org; } /** * Fetches an org using the given API token and saves it to the org storage * * @param uuid the UUID of the org * @param name the name of the org * @param token the API token */
public Org getOrFetch(String uuid, String name, String token) throws TembaException, IOException {
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/engine/FieldAsset.java
// Path: app/src/main/java/io/rapidpro/surveyor/net/responses/Field.java // public class Field { // private String key; // private String label; // // @SerializedName("value_type") // private String valueType; // // public String getKey() { // return key; // } // // public String getLabel() { // return label; // } // // public String getValueType() { // return valueType; // } // }
import io.rapidpro.surveyor.net.responses.Field;
package io.rapidpro.surveyor.engine; public class FieldAsset { private String key; private String name; private String type; public FieldAsset(String key, String name, String type) { this.key = key; this.name = name; this.type = type; }
// Path: app/src/main/java/io/rapidpro/surveyor/net/responses/Field.java // public class Field { // private String key; // private String label; // // @SerializedName("value_type") // private String valueType; // // public String getKey() { // return key; // } // // public String getLabel() { // return label; // } // // public String getValueType() { // return valueType; // } // } // Path: app/src/main/java/io/rapidpro/surveyor/engine/FieldAsset.java import io.rapidpro.surveyor.net.responses.Field; package io.rapidpro.surveyor.engine; public class FieldAsset { private String key; private String name; private String type; public FieldAsset(String key, String name, String type) { this.key = key; this.name = name; this.type = type; }
public static FieldAsset fromTemba(Field field) {
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/engine/LocationAsset.java
// Path: app/src/main/java/io/rapidpro/surveyor/net/responses/Boundary.java // public class Boundary { // @SerializedName("osm_id") // private String osmID; // // private String name; // private Reference parent; // private int level; // private String[] aliases; // // public String getOsmID() { // return osmID; // } // // public String getName() { // return name; // } // // public Reference getParent() { // return parent; // } // // public int getLevel() { // return level; // } // // public String[] getAliases() { // return aliases; // } // // public static class Reference { // @SerializedName("osm_id") // private String osmID; // // private String name; // // public String getOsmID() { // return osmID; // } // // public String getName() { // return name; // } // } // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import io.rapidpro.surveyor.net.responses.Boundary;
package io.rapidpro.surveyor.engine; public class LocationAsset { private String name; private String[] aliases; private List<LocationAsset> children; public LocationAsset(String name, String[] aliases) { this.name = name; this.aliases = aliases; this.children = new ArrayList<>(); } public String getName() { return name; } public String[] getAliases() { return aliases; } public List<LocationAsset> getChildren() { return children; }
// Path: app/src/main/java/io/rapidpro/surveyor/net/responses/Boundary.java // public class Boundary { // @SerializedName("osm_id") // private String osmID; // // private String name; // private Reference parent; // private int level; // private String[] aliases; // // public String getOsmID() { // return osmID; // } // // public String getName() { // return name; // } // // public Reference getParent() { // return parent; // } // // public int getLevel() { // return level; // } // // public String[] getAliases() { // return aliases; // } // // public static class Reference { // @SerializedName("osm_id") // private String osmID; // // private String name; // // public String getOsmID() { // return osmID; // } // // public String getName() { // return name; // } // } // } // Path: app/src/main/java/io/rapidpro/surveyor/engine/LocationAsset.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import io.rapidpro.surveyor.net.responses.Boundary; package io.rapidpro.surveyor.engine; public class LocationAsset { private String name; private String[] aliases; private List<LocationAsset> children; public LocationAsset(String name, String[] aliases) { this.name = name; this.aliases = aliases; this.children = new ArrayList<>(); } public String getName() { return name; } public String[] getAliases() { return aliases; } public List<LocationAsset> getChildren() { return children; }
public static LocationAsset fromTemba(List<Boundary> boundaries) {
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/data/SubmissionService.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/utils/SurveyUtils.java // public class SurveyUtils { // /** // * Creates a nested directory // * // * @param root the root directory // * @param folders the nested directory names // * @return the directory // * @throws IOException if any directory couldn't be created // */ // public static File mkdir(File root, String... folders) throws IOException { // File current = root; // for (String folder : folders) { // current = new File(current, folder); // // if (!current.exists() && !current.mkdirs()) { // throw new IOException("Unable to create directory: " + current.getAbsolutePath()); // } // } // return current; // } // }
import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.DirectoryFileFilter; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.UUID; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.utils.SurveyUtils;
package io.rapidpro.surveyor.data; /** * Directory based service for flow session submissions */ public class SubmissionService { private File rootDir; private static FileFilter DIR_FILTER = DirectoryFileFilter.INSTANCE; /** * Creates a new submission service * * @param rootDir the root directory */ public SubmissionService(File rootDir) { this.rootDir = rootDir;
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/utils/SurveyUtils.java // public class SurveyUtils { // /** // * Creates a nested directory // * // * @param root the root directory // * @param folders the nested directory names // * @return the directory // * @throws IOException if any directory couldn't be created // */ // public static File mkdir(File root, String... folders) throws IOException { // File current = root; // for (String folder : folders) { // current = new File(current, folder); // // if (!current.exists() && !current.mkdirs()) { // throw new IOException("Unable to create directory: " + current.getAbsolutePath()); // } // } // return current; // } // } // Path: app/src/main/java/io/rapidpro/surveyor/data/SubmissionService.java import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.DirectoryFileFilter; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.UUID; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.utils.SurveyUtils; package io.rapidpro.surveyor.data; /** * Directory based service for flow session submissions */ public class SubmissionService { private File rootDir; private static FileFilter DIR_FILTER = DirectoryFileFilter.INSTANCE; /** * Creates a new submission service * * @param rootDir the root directory */ public SubmissionService(File rootDir) { this.rootDir = rootDir;
Logger.d("SubmissionService created for directory " + this.rootDir.getAbsolutePath());
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/data/SubmissionService.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/utils/SurveyUtils.java // public class SurveyUtils { // /** // * Creates a nested directory // * // * @param root the root directory // * @param folders the nested directory names // * @return the directory // * @throws IOException if any directory couldn't be created // */ // public static File mkdir(File root, String... folders) throws IOException { // File current = root; // for (String folder : folders) { // current = new File(current, folder); // // if (!current.exists() && !current.mkdirs()) { // throw new IOException("Unable to create directory: " + current.getAbsolutePath()); // } // } // return current; // } // }
import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.DirectoryFileFilter; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.UUID; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.utils.SurveyUtils;
package io.rapidpro.surveyor.data; /** * Directory based service for flow session submissions */ public class SubmissionService { private File rootDir; private static FileFilter DIR_FILTER = DirectoryFileFilter.INSTANCE; /** * Creates a new submission service * * @param rootDir the root directory */ public SubmissionService(File rootDir) { this.rootDir = rootDir; Logger.d("SubmissionService created for directory " + this.rootDir.getAbsolutePath()); } /** * Creates a new submission for the given flow in the given org * * @param org the org * @param flow the flow * @return the new submission */ public Submission newSubmission(Org org, Flow flow) throws IOException {
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/utils/SurveyUtils.java // public class SurveyUtils { // /** // * Creates a nested directory // * // * @param root the root directory // * @param folders the nested directory names // * @return the directory // * @throws IOException if any directory couldn't be created // */ // public static File mkdir(File root, String... folders) throws IOException { // File current = root; // for (String folder : folders) { // current = new File(current, folder); // // if (!current.exists() && !current.mkdirs()) { // throw new IOException("Unable to create directory: " + current.getAbsolutePath()); // } // } // return current; // } // } // Path: app/src/main/java/io/rapidpro/surveyor/data/SubmissionService.java import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.DirectoryFileFilter; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.UUID; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.utils.SurveyUtils; package io.rapidpro.surveyor.data; /** * Directory based service for flow session submissions */ public class SubmissionService { private File rootDir; private static FileFilter DIR_FILTER = DirectoryFileFilter.INSTANCE; /** * Creates a new submission service * * @param rootDir the root directory */ public SubmissionService(File rootDir) { this.rootDir = rootDir; Logger.d("SubmissionService created for directory " + this.rootDir.getAbsolutePath()); } /** * Creates a new submission for the given flow in the given org * * @param org the org * @param flow the flow * @return the new submission */ public Submission newSubmission(Org org, Flow flow) throws IOException {
File flowDir = SurveyUtils.mkdir(rootDir, org.getUuid(), flow.getUuid());
rapidpro/surveyor
app/src/androidTest/java/io/rapidpro/surveyor/test/TestRunner.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // }
import android.app.Application; import android.content.Context; import android.os.Bundle; import androidx.test.runner.AndroidJUnitRunner; import io.rapidpro.surveyor.Logger;
package io.rapidpro.surveyor.test; /** * Custom test runner class which will use a subclass of the regular Surveyor application */ public class TestRunner extends AndroidJUnitRunner { public static int PAUSE_MILLIS = 1000; public void onCreate(Bundle arguments) {
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // Path: app/src/androidTest/java/io/rapidpro/surveyor/test/TestRunner.java import android.app.Application; import android.content.Context; import android.os.Bundle; import androidx.test.runner.AndroidJUnitRunner; import io.rapidpro.surveyor.Logger; package io.rapidpro.surveyor.test; /** * Custom test runner class which will use a subclass of the regular Surveyor application */ public class TestRunner extends AndroidJUnitRunner { public static int PAUSE_MILLIS = 1000; public void onCreate(Bundle arguments) {
Logger.d("Creating test runner with arguments: ");
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/widget/ChatBubbleView.java
// Path: app/src/main/java/io/rapidpro/surveyor/ui/CachedLinearLayout.java // public class CachedLinearLayout extends LinearLayout { // // private ViewCache m_cache; // // public CachedLinearLayout(Context context) { // super(context); // init(); // } // // public CachedLinearLayout(Context context, AttributeSet attrs) { // super(context, attrs); // init(); // } // // public CachedLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // init(); // } // // protected void init() { // m_cache = new ViewCache(getContext(), this); // } // // public TextView getTextView(int id) { // return m_cache.getTextView(id); // } // // public ImageView getImageView(int id) { // return m_cache.getImageView(id); // } // // public View getView(int id) { // return m_cache.getView(id); // } // // public void hide(int id) { // m_cache.hide(id); // } // // public void show(int id) { // m_cache.show(id); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // }
import android.content.Context; import android.graphics.Bitmap; import android.text.method.LinkMovementMethod; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.ui.CachedLinearLayout; import io.rapidpro.surveyor.ui.IconTextView;
tv.setText(text); tv.setMovementMethod(LinkMovementMethod.getInstance()); if (!inbound) { tv.setBackground(getResources().getDrawable(R.drawable.chat_bubble_out)); } addView(getSpacer(), inbound ? 1 : 0); } public void setThumbnail(Bitmap image, String url, int type) { ImageView imageView = getImageView(R.id.thumbnail); if (image != null) { imageView.setImageBitmap(image); } else { } View mediaView = getView(R.id.media_view); mediaView.setVisibility(VISIBLE); mediaView.setTag(R.string.tag_url, url); mediaView.setTag(R.string.tag_media_type, type); if (type == R.string.media_image) { getTextView(R.id.media_icon).setText(R.string.icon_photo); } else if (type == R.string.media_video) { getTextView(R.id.media_icon).setText(R.string.icon_play_arrow); } else if (type == R.string.media_audio || type == R.string.media_location) {
// Path: app/src/main/java/io/rapidpro/surveyor/ui/CachedLinearLayout.java // public class CachedLinearLayout extends LinearLayout { // // private ViewCache m_cache; // // public CachedLinearLayout(Context context) { // super(context); // init(); // } // // public CachedLinearLayout(Context context, AttributeSet attrs) { // super(context, attrs); // init(); // } // // public CachedLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { // super(context, attrs, defStyleAttr); // init(); // } // // protected void init() { // m_cache = new ViewCache(getContext(), this); // } // // public TextView getTextView(int id) { // return m_cache.getTextView(id); // } // // public ImageView getImageView(int id) { // return m_cache.getImageView(id); // } // // public View getView(int id) { // return m_cache.getView(id); // } // // public void hide(int id) { // m_cache.hide(id); // } // // public void show(int id) { // m_cache.show(id); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/widget/ChatBubbleView.java import android.content.Context; import android.graphics.Bitmap; import android.text.method.LinkMovementMethod; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.ui.CachedLinearLayout; import io.rapidpro.surveyor.ui.IconTextView; tv.setText(text); tv.setMovementMethod(LinkMovementMethod.getInstance()); if (!inbound) { tv.setBackground(getResources().getDrawable(R.drawable.chat_bubble_out)); } addView(getSpacer(), inbound ? 1 : 0); } public void setThumbnail(Bitmap image, String url, int type) { ImageView imageView = getImageView(R.id.thumbnail); if (image != null) { imageView.setImageBitmap(image); } else { } View mediaView = getView(R.id.media_view); mediaView.setVisibility(VISIBLE); mediaView.setTag(R.string.tag_url, url); mediaView.setTag(R.string.tag_media_type, type); if (type == R.string.media_image) { getTextView(R.id.media_icon).setText(R.string.icon_photo); } else if (type == R.string.media_video) { getTextView(R.id.media_icon).setText(R.string.icon_play_arrow); } else if (type == R.string.media_audio || type == R.string.media_location) {
IconTextView iconView = (IconTextView) getTextView(R.id.media_icon);
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/engine/GroupAsset.java
// Path: app/src/main/java/io/rapidpro/surveyor/net/responses/Group.java // public class Group { // private String uuid; // private String name; // private String query; // // public String getUuid() { // return uuid; // } // // public String getName() { // return name; // } // // public String getQuery() { // return query; // } // }
import io.rapidpro.surveyor.net.responses.Group;
package io.rapidpro.surveyor.engine; public class GroupAsset { private String uuid; private String name; private String query; public GroupAsset(String uuid, String name, String query) { this.uuid = uuid; this.name = name; this.query = query; }
// Path: app/src/main/java/io/rapidpro/surveyor/net/responses/Group.java // public class Group { // private String uuid; // private String name; // private String query; // // public String getUuid() { // return uuid; // } // // public String getName() { // return name; // } // // public String getQuery() { // return query; // } // } // Path: app/src/main/java/io/rapidpro/surveyor/engine/GroupAsset.java import io.rapidpro.surveyor.net.responses.Group; package io.rapidpro.surveyor.engine; public class GroupAsset { private String uuid; private String name; private String query; public GroupAsset(String uuid, String name, String query) { this.uuid = uuid; this.name = name; this.query = query; }
public static GroupAsset fromTemba(Group group) {
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/activity/CaptureAudioActivity.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/SurveyorIntent.java // public interface SurveyorIntent { // String EXTRA_ORG_UUID = "surveyor.extra.org_uuid"; // String EXTRA_FLOW_UUID = "surveyor.extra.flow_uuid"; // // String EXTRA_SUBMISSION_FILE = "surveyor.extra.submission_file"; // // // where media files are to be stored // String EXTRA_MEDIA_FILE = "surveyor.extra.media_file"; // // String EXTRA_ERROR = "surveyor.extra.error"; // String EXTRA_CAMERA_DIRECTION = "surveyor.extra.camera_direction"; // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // }
import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.media.MediaRecorder; import android.os.Bundle; import android.view.View; import android.widget.TextView; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.SurveyorIntent; import io.rapidpro.surveyor.ui.IconTextView;
package io.rapidpro.surveyor.activity; /** * Activity for capturing an audio recording */ public class CaptureAudioActivity extends BaseActivity { private boolean isRecording = false; private MediaRecorder mediaRecorder; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_capture_audio); } @Override public boolean requireLogin() { return false; } public void recordAudio() { isRecording = true;
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/SurveyorIntent.java // public interface SurveyorIntent { // String EXTRA_ORG_UUID = "surveyor.extra.org_uuid"; // String EXTRA_FLOW_UUID = "surveyor.extra.flow_uuid"; // // String EXTRA_SUBMISSION_FILE = "surveyor.extra.submission_file"; // // // where media files are to be stored // String EXTRA_MEDIA_FILE = "surveyor.extra.media_file"; // // String EXTRA_ERROR = "surveyor.extra.error"; // String EXTRA_CAMERA_DIRECTION = "surveyor.extra.camera_direction"; // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/activity/CaptureAudioActivity.java import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.media.MediaRecorder; import android.os.Bundle; import android.view.View; import android.widget.TextView; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.SurveyorIntent; import io.rapidpro.surveyor.ui.IconTextView; package io.rapidpro.surveyor.activity; /** * Activity for capturing an audio recording */ public class CaptureAudioActivity extends BaseActivity { private boolean isRecording = false; private MediaRecorder mediaRecorder; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_capture_audio); } @Override public boolean requireLogin() { return false; } public void recordAudio() { isRecording = true;
String output = getIntent().getStringExtra(SurveyorIntent.EXTRA_MEDIA_FILE);
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/activity/CaptureAudioActivity.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/SurveyorIntent.java // public interface SurveyorIntent { // String EXTRA_ORG_UUID = "surveyor.extra.org_uuid"; // String EXTRA_FLOW_UUID = "surveyor.extra.flow_uuid"; // // String EXTRA_SUBMISSION_FILE = "surveyor.extra.submission_file"; // // // where media files are to be stored // String EXTRA_MEDIA_FILE = "surveyor.extra.media_file"; // // String EXTRA_ERROR = "surveyor.extra.error"; // String EXTRA_CAMERA_DIRECTION = "surveyor.extra.camera_direction"; // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // }
import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.media.MediaRecorder; import android.os.Bundle; import android.view.View; import android.widget.TextView; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.SurveyorIntent; import io.rapidpro.surveyor.ui.IconTextView;
package io.rapidpro.surveyor.activity; /** * Activity for capturing an audio recording */ public class CaptureAudioActivity extends BaseActivity { private boolean isRecording = false; private MediaRecorder mediaRecorder; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_capture_audio); } @Override public boolean requireLogin() { return false; } public void recordAudio() { isRecording = true; String output = getIntent().getStringExtra(SurveyorIntent.EXTRA_MEDIA_FILE);
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/SurveyorIntent.java // public interface SurveyorIntent { // String EXTRA_ORG_UUID = "surveyor.extra.org_uuid"; // String EXTRA_FLOW_UUID = "surveyor.extra.flow_uuid"; // // String EXTRA_SUBMISSION_FILE = "surveyor.extra.submission_file"; // // // where media files are to be stored // String EXTRA_MEDIA_FILE = "surveyor.extra.media_file"; // // String EXTRA_ERROR = "surveyor.extra.error"; // String EXTRA_CAMERA_DIRECTION = "surveyor.extra.camera_direction"; // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/activity/CaptureAudioActivity.java import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.media.MediaRecorder; import android.os.Bundle; import android.view.View; import android.widget.TextView; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.SurveyorIntent; import io.rapidpro.surveyor.ui.IconTextView; package io.rapidpro.surveyor.activity; /** * Activity for capturing an audio recording */ public class CaptureAudioActivity extends BaseActivity { private boolean isRecording = false; private MediaRecorder mediaRecorder; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_capture_audio); } @Override public boolean requireLogin() { return false; } public void recordAudio() { isRecording = true; String output = getIntent().getStringExtra(SurveyorIntent.EXTRA_MEDIA_FILE);
Logger.d("Recording audio to " + output + "...");
rapidpro/surveyor
app/src/main/java/io/rapidpro/surveyor/activity/CaptureAudioActivity.java
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/SurveyorIntent.java // public interface SurveyorIntent { // String EXTRA_ORG_UUID = "surveyor.extra.org_uuid"; // String EXTRA_FLOW_UUID = "surveyor.extra.flow_uuid"; // // String EXTRA_SUBMISSION_FILE = "surveyor.extra.submission_file"; // // // where media files are to be stored // String EXTRA_MEDIA_FILE = "surveyor.extra.media_file"; // // String EXTRA_ERROR = "surveyor.extra.error"; // String EXTRA_CAMERA_DIRECTION = "surveyor.extra.camera_direction"; // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // }
import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.media.MediaRecorder; import android.os.Bundle; import android.view.View; import android.widget.TextView; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.SurveyorIntent; import io.rapidpro.surveyor.ui.IconTextView;
} mediaRecorder.start(); } private void releaseMediaRecorder() { if (mediaRecorder != null) { mediaRecorder.reset(); mediaRecorder.release(); mediaRecorder = null; } } private void stopRecording() { if (mediaRecorder != null) { mediaRecorder.stop(); } releaseMediaRecorder(); isRecording = false; Intent returnIntent = new Intent(); returnIntent.putExtra(SurveyorIntent.EXTRA_MEDIA_FILE, getIntent().getStringExtra(SurveyorIntent.EXTRA_MEDIA_FILE)); setResult(Activity.RESULT_OK, returnIntent); finish(); } public void toggleRecording(View view) { if (!isRecording) { Resources res = getResources();
// Path: app/src/main/java/io/rapidpro/surveyor/Logger.java // public class Logger { // // private static final String TAG = "Surveyor"; // // public static void e(String message, Throwable t) { // Log.e(TAG, message, t); // } // // public static void w(String message) { // Log.w(TAG, message); // } // // public static void d(String message) { // Log.d(TAG, message); // } // } // // Path: app/src/main/java/io/rapidpro/surveyor/SurveyorIntent.java // public interface SurveyorIntent { // String EXTRA_ORG_UUID = "surveyor.extra.org_uuid"; // String EXTRA_FLOW_UUID = "surveyor.extra.flow_uuid"; // // String EXTRA_SUBMISSION_FILE = "surveyor.extra.submission_file"; // // // where media files are to be stored // String EXTRA_MEDIA_FILE = "surveyor.extra.media_file"; // // String EXTRA_ERROR = "surveyor.extra.error"; // String EXTRA_CAMERA_DIRECTION = "surveyor.extra.camera_direction"; // } // // Path: app/src/main/java/io/rapidpro/surveyor/ui/IconTextView.java // public class IconTextView extends TextView { // public IconTextView(Context context, AttributeSet attrs) { // super(context, attrs); // setTypeface(Typefaces.get(getContext(), "material.ttf")); // } // // public void setIconColor(int color) { // setTextColor(getResources().getColor(color)); // } // } // Path: app/src/main/java/io/rapidpro/surveyor/activity/CaptureAudioActivity.java import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.media.MediaRecorder; import android.os.Bundle; import android.view.View; import android.widget.TextView; import io.rapidpro.surveyor.Logger; import io.rapidpro.surveyor.R; import io.rapidpro.surveyor.SurveyorIntent; import io.rapidpro.surveyor.ui.IconTextView; } mediaRecorder.start(); } private void releaseMediaRecorder() { if (mediaRecorder != null) { mediaRecorder.reset(); mediaRecorder.release(); mediaRecorder = null; } } private void stopRecording() { if (mediaRecorder != null) { mediaRecorder.stop(); } releaseMediaRecorder(); isRecording = false; Intent returnIntent = new Intent(); returnIntent.putExtra(SurveyorIntent.EXTRA_MEDIA_FILE, getIntent().getStringExtra(SurveyorIntent.EXTRA_MEDIA_FILE)); setResult(Activity.RESULT_OK, returnIntent); finish(); } public void toggleRecording(View view) { if (!isRecording) { Resources res = getResources();
IconTextView button = (IconTextView) getViewCache().getView(R.id.button_capture);
x-falcon/Virtual-Hosts
app/src/main/java/com/github/xfalcon/vhosts/NetworkReceiver.java
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // }
import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import com.github.xfalcon.vhosts.util.LogUtils; import java.net.Inet4Address; import java.net.InetAddress;
/* **Copyright (C) 2017 xfalcon ** **This program is free software: you can redistribute it and/or modify **it under the terms of the GNU General Public License as published by **the Free Software Foundation, either version 3 of the License, or **(at your option) any later version. ** **This program is distributed in the hope that it will be useful, **but WITHOUT ANY WARRANTY; without even the implied warranty of **MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **GNU General Public License for more details. ** **You should have received a copy of the GNU General Public License **along with this program. If not, see <http://www.gnu.org/licenses/>. ** */ package com.github.xfalcon.vhosts; public class NetworkReceiver extends BroadcastReceiver { private static final String TAG = NetworkReceiver.class.getSimpleName(); public static String ipAddress = null; @Override public void onReceive(Context context, Intent intent) { if(!ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())){ return; } ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (networkInfo == null) return; if (networkInfo.isAvailable()& networkInfo.isConnected()) { if (networkInfo.getType()==ConnectivityManager.TYPE_WIFI) { ipAddress = getWifiIpAddress(context);
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // } // Path: app/src/main/java/com/github/xfalcon/vhosts/NetworkReceiver.java import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import com.github.xfalcon.vhosts.util.LogUtils; import java.net.Inet4Address; import java.net.InetAddress; /* **Copyright (C) 2017 xfalcon ** **This program is free software: you can redistribute it and/or modify **it under the terms of the GNU General Public License as published by **the Free Software Foundation, either version 3 of the License, or **(at your option) any later version. ** **This program is distributed in the hope that it will be useful, **but WITHOUT ANY WARRANTY; without even the implied warranty of **MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **GNU General Public License for more details. ** **You should have received a copy of the GNU General Public License **along with this program. If not, see <http://www.gnu.org/licenses/>. ** */ package com.github.xfalcon.vhosts; public class NetworkReceiver extends BroadcastReceiver { private static final String TAG = NetworkReceiver.class.getSimpleName(); public static String ipAddress = null; @Override public void onReceive(Context context, Intent intent) { if(!ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())){ return; } ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (networkInfo == null) return; if (networkInfo.isAvailable()& networkInfo.isConnected()) { if (networkInfo.getType()==ConnectivityManager.TYPE_WIFI) { ipAddress = getWifiIpAddress(context);
LogUtils.d(TAG, "WIFI "+ipAddress);
x-falcon/Virtual-Hosts
app/src/main/java/com/github/xfalcon/vhosts/vservice/TCPInput.java
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // }
import com.github.xfalcon.vhosts.util.LogUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.util.Iterator; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock;
/* ** Copyright 2015, Mohamed Naufal ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package com.github.xfalcon.vhosts.vservice; public class TCPInput implements Runnable { private static final String TAG = TCPInput.class.getSimpleName(); private ConcurrentLinkedQueue<ByteBuffer> outputQueue; private Selector selector; private ReentrantLock tcpSelectorLock; public TCPInput(ConcurrentLinkedQueue<ByteBuffer> outputQueue, Selector selector,ReentrantLock tcpSelectorLock) { this.outputQueue = outputQueue; this.selector = selector; this.tcpSelectorLock=tcpSelectorLock; } @Override public void run() { try {
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // } // Path: app/src/main/java/com/github/xfalcon/vhosts/vservice/TCPInput.java import com.github.xfalcon.vhosts.util.LogUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.util.Iterator; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; /* ** Copyright 2015, Mohamed Naufal ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package com.github.xfalcon.vhosts.vservice; public class TCPInput implements Runnable { private static final String TAG = TCPInput.class.getSimpleName(); private ConcurrentLinkedQueue<ByteBuffer> outputQueue; private Selector selector; private ReentrantLock tcpSelectorLock; public TCPInput(ConcurrentLinkedQueue<ByteBuffer> outputQueue, Selector selector,ReentrantLock tcpSelectorLock) { this.outputQueue = outputQueue; this.selector = selector; this.tcpSelectorLock=tcpSelectorLock; } @Override public void run() { try {
LogUtils.i(TAG, "Started");
x-falcon/Virtual-Hosts
app/src/main/java/com/github/xfalcon/vhosts/vservice/DnsChange.java
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // }
import com.github.xfalcon.vhosts.util.LogUtils; import org.xbill.DNS.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.InetAddress; import java.nio.ByteBuffer; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Matcher; import java.util.regex.Pattern;
/* **Copyright (C) 2017 xfalcon ** **This program is free software: you can redistribute it and/or modify **it under the terms of the GNU General Public License as published by **the Free Software Foundation, either version 3 of the License, or **(at your option) any later version. ** **This program is distributed in the hope that it will be useful, **but WITHOUT ANY WARRANTY; without even the implied warranty of **MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **GNU General Public License for more details. ** **You should have received a copy of the GNU General Public License **along with this program. If not, see <http://www.gnu.org/licenses/>. ** */ package com.github.xfalcon.vhosts.vservice; public class DnsChange { static String TAG = DnsChange.class.getSimpleName(); static ConcurrentHashMap<String, String> DOMAINS_IP_MAPS4 = null; static ConcurrentHashMap<String, String> DOMAINS_IP_MAPS6 = null; public static ByteBuffer handle_dns_packet(Packet packet) { if (DOMAINS_IP_MAPS4 == null) {
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // } // Path: app/src/main/java/com/github/xfalcon/vhosts/vservice/DnsChange.java import com.github.xfalcon.vhosts.util.LogUtils; import org.xbill.DNS.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.InetAddress; import java.nio.ByteBuffer; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Matcher; import java.util.regex.Pattern; /* **Copyright (C) 2017 xfalcon ** **This program is free software: you can redistribute it and/or modify **it under the terms of the GNU General Public License as published by **the Free Software Foundation, either version 3 of the License, or **(at your option) any later version. ** **This program is distributed in the hope that it will be useful, **but WITHOUT ANY WARRANTY; without even the implied warranty of **MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **GNU General Public License for more details. ** **You should have received a copy of the GNU General Public License **along with this program. If not, see <http://www.gnu.org/licenses/>. ** */ package com.github.xfalcon.vhosts.vservice; public class DnsChange { static String TAG = DnsChange.class.getSimpleName(); static ConcurrentHashMap<String, String> DOMAINS_IP_MAPS4 = null; static ConcurrentHashMap<String, String> DOMAINS_IP_MAPS6 = null; public static ByteBuffer handle_dns_packet(Packet packet) { if (DOMAINS_IP_MAPS4 == null) {
LogUtils.d(TAG, "DOMAINS_IP_MAPS IS NULL HOST FILE ERROR");
x-falcon/Virtual-Hosts
app/src/main/java/com/github/xfalcon/vhosts/vservice/UDPOutput.java
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // }
import com.github.xfalcon.vhosts.util.LogUtils; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock;
private ConcurrentLinkedQueue<Packet> inputQueue; private ConcurrentLinkedQueue<ByteBuffer> outputQueue; private Selector selector; private ReentrantLock udpSelectorLock; private StringBuilder stringBuild; private static final int MAX_CACHE_SIZE = 50; private LRUCache<String, DatagramChannel> channelCache = new LRUCache<>(MAX_CACHE_SIZE, new LRUCache.CleanupCallback<String, DatagramChannel>() { @Override public void cleanup(Map.Entry<String, DatagramChannel> eldest) { closeChannel(eldest.getValue()); } }); public UDPOutput(ConcurrentLinkedQueue<Packet> inputQueue,ConcurrentLinkedQueue<ByteBuffer> outputQueue, Selector selector,ReentrantLock udpSelectorLock, VhostsService vpnService) { this.inputQueue = inputQueue; this.selector = selector; this.vpnService = vpnService; this.outputQueue=outputQueue; this.udpSelectorLock=udpSelectorLock; this.stringBuild=new StringBuilder(32); } @Override public void run() {
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // } // Path: app/src/main/java/com/github/xfalcon/vhosts/vservice/UDPOutput.java import com.github.xfalcon.vhosts.util.LogUtils; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; private ConcurrentLinkedQueue<Packet> inputQueue; private ConcurrentLinkedQueue<ByteBuffer> outputQueue; private Selector selector; private ReentrantLock udpSelectorLock; private StringBuilder stringBuild; private static final int MAX_CACHE_SIZE = 50; private LRUCache<String, DatagramChannel> channelCache = new LRUCache<>(MAX_CACHE_SIZE, new LRUCache.CleanupCallback<String, DatagramChannel>() { @Override public void cleanup(Map.Entry<String, DatagramChannel> eldest) { closeChannel(eldest.getValue()); } }); public UDPOutput(ConcurrentLinkedQueue<Packet> inputQueue,ConcurrentLinkedQueue<ByteBuffer> outputQueue, Selector selector,ReentrantLock udpSelectorLock, VhostsService vpnService) { this.inputQueue = inputQueue; this.selector = selector; this.vpnService = vpnService; this.outputQueue=outputQueue; this.udpSelectorLock=udpSelectorLock; this.stringBuild=new StringBuilder(32); } @Override public void run() {
LogUtils.i(TAG, "Started");
x-falcon/Virtual-Hosts
app/src/main/java/com/github/xfalcon/vhosts/vservice/Packet.java
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // }
import com.github.xfalcon.vhosts.util.LogUtils; import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.ByteBuffer;
/* ** Copyright 2015, Mohamed Naufal ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package com.github.xfalcon.vhosts.vservice; /** * Representation of an IP Packet */ // TODO: Reduce public mutability public class Packet { private static final int IP4_HEADER_SIZE = 20; private static final int IP6_HEADER_SIZE = 40; private static final int TCP_HEADER_SIZE = 20; private static final int UDP_HEADER_SIZE = 8; private static final int TCP = 6; private static final int UDP = 17; private int IP_HEADER_SIZE; public int IP_TRAN_SIZE; public IPHeader ipHeader; public TCPHeader tcpHeader; public UDPHeader udpHeader; public ByteBuffer backingBuffer; private boolean isTCP; private boolean isUDP; public Packet(ByteBuffer buffer) throws UnknownHostException { byte versionAndIHL = buffer.get(); byte version = (byte) (versionAndIHL >> 4); if (version == 4) { IP_HEADER_SIZE = IP4_HEADER_SIZE; byte IHL = (byte) (versionAndIHL & 0x0F); int headerLength = IHL << 2; this.ipHeader = new IP4Header(buffer, version, IHL, headerLength); } else if (version == 6) { IP_HEADER_SIZE = IP6_HEADER_SIZE; this.ipHeader = new IP6Header(buffer, version); } else {
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // } // Path: app/src/main/java/com/github/xfalcon/vhosts/vservice/Packet.java import com.github.xfalcon.vhosts.util.LogUtils; import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.ByteBuffer; /* ** Copyright 2015, Mohamed Naufal ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package com.github.xfalcon.vhosts.vservice; /** * Representation of an IP Packet */ // TODO: Reduce public mutability public class Packet { private static final int IP4_HEADER_SIZE = 20; private static final int IP6_HEADER_SIZE = 40; private static final int TCP_HEADER_SIZE = 20; private static final int UDP_HEADER_SIZE = 8; private static final int TCP = 6; private static final int UDP = 17; private int IP_HEADER_SIZE; public int IP_TRAN_SIZE; public IPHeader ipHeader; public TCPHeader tcpHeader; public UDPHeader udpHeader; public ByteBuffer backingBuffer; private boolean isTCP; private boolean isUDP; public Packet(ByteBuffer buffer) throws UnknownHostException { byte versionAndIHL = buffer.get(); byte version = (byte) (versionAndIHL >> 4); if (version == 4) { IP_HEADER_SIZE = IP4_HEADER_SIZE; byte IHL = (byte) (versionAndIHL & 0x0F); int headerLength = IHL << 2; this.ipHeader = new IP4Header(buffer, version, IHL, headerLength); } else if (version == 6) { IP_HEADER_SIZE = IP6_HEADER_SIZE; this.ipHeader = new IP6Header(buffer, version); } else {
LogUtils.d("Un Know Packet", version + "");
x-falcon/Virtual-Hosts
app/src/main/java/com/github/xfalcon/vhosts/vservice/UDPInput.java
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // }
import com.github.xfalcon.vhosts.util.LogUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.util.Iterator; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock;
/* ** Copyright 2015, Mohamed Naufal ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package com.github.xfalcon.vhosts.vservice; public class UDPInput implements Runnable { private static final String TAG = UDPInput.class.getSimpleName(); private Selector selector; private ReentrantLock udpSelectorLock; private ConcurrentLinkedQueue<ByteBuffer> outputQueue; public UDPInput(ConcurrentLinkedQueue<ByteBuffer> outputQueue, Selector selector, ReentrantLock udpSelectorLock) { this.outputQueue = outputQueue; this.selector = selector; this.udpSelectorLock=udpSelectorLock; } @Override public void run() { try {
// Path: app/src/main/java/com/github/xfalcon/vhosts/util/LogUtils.java // public class LogUtils { // // // public static Context context; // // private static void sendLogData(String tag,String msg){ // // } // // public static void v(String tag, String msg) { // sendLogData(tag,msg); // Log.v(tag,msg); // } // // public static void v(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.v(tag,msg,tr); // } // // public static void d(String tag, String msg) { // sendLogData(tag,msg); // Log.d(tag,msg); // } // // public static void d(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.d(tag,msg,tr); // } // // public static void i(String tag, String msg) { // sendLogData(tag,msg); // Log.i(tag,msg); // } // // public static void i(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.i(tag,msg,tr); // } // // public static void w(String tag, String msg) { // sendLogData(tag,msg); // Log.w(tag,msg); // } // // public static void w(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.w(tag,msg,tr); // } // // public static void e(String tag, String msg) { // sendLogData(tag,msg); // Log.e(tag,msg); // } // // public static void e(String tag, String msg, Throwable tr) { // sendLogData(tag,msg+" ;"+tr.getMessage()); // Log.e(tag,msg,tr); // } // // } // Path: app/src/main/java/com/github/xfalcon/vhosts/vservice/UDPInput.java import com.github.xfalcon.vhosts.util.LogUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.DatagramChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.util.Iterator; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; /* ** Copyright 2015, Mohamed Naufal ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package com.github.xfalcon.vhosts.vservice; public class UDPInput implements Runnable { private static final String TAG = UDPInput.class.getSimpleName(); private Selector selector; private ReentrantLock udpSelectorLock; private ConcurrentLinkedQueue<ByteBuffer> outputQueue; public UDPInput(ConcurrentLinkedQueue<ByteBuffer> outputQueue, Selector selector, ReentrantLock udpSelectorLock) { this.outputQueue = outputQueue; this.selector = selector; this.udpSelectorLock=udpSelectorLock; } @Override public void run() { try {
LogUtils.i(TAG, "Started");
kawasima/moshas
moshas/src/test/java/net/unit8/moshas/LoopTemplateTest.java
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java // public class Context extends AbstractContext { // // public Context() { // super(); // } // // public Context(Map<String, Object> variables) { // super(); // for (Map.Entry<String, Object> entry : variables.entrySet()) { // setVariable(entry.getKey(), entry.getValue()); // } // } // } // // Path: moshas/src/main/java/net/unit8/moshas/loader/ResourceTemplateLoader.java // public class ResourceTemplateLoader extends TemplateLoader { // private String prefix; // private String suffix; // // @Override // public InputStream getTemplateStream(String templateSource) throws TemplateNotFoundException { // ClassLoader cl = Thread.currentThread().getContextClassLoader(); // if (cl == null) { // cl = getClass().getClassLoader(); // } // // if (prefix != null) { // templateSource = prefix + templateSource; // } // if (suffix != null) { // templateSource = templateSource + suffix; // } // // if (templateSource.startsWith("/")) { // templateSource = templateSource.replaceAll("^/(.*)", "$1"); // } // InputStream is = cl.getResourceAsStream(templateSource); // if (is == null) { // throw new TemplateNotFoundException("Can't find template " + templateSource); // } // // return is; // } // // public void setPrefix(String prefix) { // this.prefix = prefix; // } // // public void setSuffix(String suffix) { // this.suffix = suffix; // } // }
import net.unit8.moshas.context.Context; import net.unit8.moshas.loader.ResourceTemplateLoader; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger;
package net.unit8.moshas; /** * * @author kawasima */ public class LoopTemplateTest { private Template template; @Before public void setup() throws IOException { MoshasEngine engine = new MoshasEngine();
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java // public class Context extends AbstractContext { // // public Context() { // super(); // } // // public Context(Map<String, Object> variables) { // super(); // for (Map.Entry<String, Object> entry : variables.entrySet()) { // setVariable(entry.getKey(), entry.getValue()); // } // } // } // // Path: moshas/src/main/java/net/unit8/moshas/loader/ResourceTemplateLoader.java // public class ResourceTemplateLoader extends TemplateLoader { // private String prefix; // private String suffix; // // @Override // public InputStream getTemplateStream(String templateSource) throws TemplateNotFoundException { // ClassLoader cl = Thread.currentThread().getContextClassLoader(); // if (cl == null) { // cl = getClass().getClassLoader(); // } // // if (prefix != null) { // templateSource = prefix + templateSource; // } // if (suffix != null) { // templateSource = templateSource + suffix; // } // // if (templateSource.startsWith("/")) { // templateSource = templateSource.replaceAll("^/(.*)", "$1"); // } // InputStream is = cl.getResourceAsStream(templateSource); // if (is == null) { // throw new TemplateNotFoundException("Can't find template " + templateSource); // } // // return is; // } // // public void setPrefix(String prefix) { // this.prefix = prefix; // } // // public void setSuffix(String suffix) { // this.suffix = suffix; // } // } // Path: moshas/src/test/java/net/unit8/moshas/LoopTemplateTest.java import net.unit8.moshas.context.Context; import net.unit8.moshas.loader.ResourceTemplateLoader; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; package net.unit8.moshas; /** * * @author kawasima */ public class LoopTemplateTest { private Template template; @Before public void setup() throws IOException { MoshasEngine engine = new MoshasEngine();
ResourceTemplateLoader resourceTemplateLoader = new ResourceTemplateLoader();
kawasima/moshas
moshas/src/test/java/net/unit8/moshas/LoopTemplateTest.java
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java // public class Context extends AbstractContext { // // public Context() { // super(); // } // // public Context(Map<String, Object> variables) { // super(); // for (Map.Entry<String, Object> entry : variables.entrySet()) { // setVariable(entry.getKey(), entry.getValue()); // } // } // } // // Path: moshas/src/main/java/net/unit8/moshas/loader/ResourceTemplateLoader.java // public class ResourceTemplateLoader extends TemplateLoader { // private String prefix; // private String suffix; // // @Override // public InputStream getTemplateStream(String templateSource) throws TemplateNotFoundException { // ClassLoader cl = Thread.currentThread().getContextClassLoader(); // if (cl == null) { // cl = getClass().getClassLoader(); // } // // if (prefix != null) { // templateSource = prefix + templateSource; // } // if (suffix != null) { // templateSource = templateSource + suffix; // } // // if (templateSource.startsWith("/")) { // templateSource = templateSource.replaceAll("^/(.*)", "$1"); // } // InputStream is = cl.getResourceAsStream(templateSource); // if (is == null) { // throw new TemplateNotFoundException("Can't find template " + templateSource); // } // // return is; // } // // public void setPrefix(String prefix) { // this.prefix = prefix; // } // // public void setSuffix(String suffix) { // this.suffix = suffix; // } // }
import net.unit8.moshas.context.Context; import net.unit8.moshas.loader.ResourceTemplateLoader; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger;
el.attr("class", "minus"); } el.text(ctx.getString("stock", "ratio")); }); }); t.select("tbody", (el, ctx) -> { el.empty(); AtomicInteger counter = new AtomicInteger(0); ctx.getCollection("items").forEach(item -> ctx.localScope("stock", item, "itemIndex", counter.incrementAndGet(), () -> { el.appendChild(stockSnippet.render(ctx)); })); }); }); } protected Map<String, Object> getContext() { Map<String, Object> ctx = new HashMap<>(); ctx.put("items", Stock.dummyItems()); return ctx; } @Test public void benchmark() throws IOException, InterruptedException { ExecutorService service = Executors.newFixedThreadPool(100); for (int i=0; i<100; i++) { service.execute(() -> {
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java // public class Context extends AbstractContext { // // public Context() { // super(); // } // // public Context(Map<String, Object> variables) { // super(); // for (Map.Entry<String, Object> entry : variables.entrySet()) { // setVariable(entry.getKey(), entry.getValue()); // } // } // } // // Path: moshas/src/main/java/net/unit8/moshas/loader/ResourceTemplateLoader.java // public class ResourceTemplateLoader extends TemplateLoader { // private String prefix; // private String suffix; // // @Override // public InputStream getTemplateStream(String templateSource) throws TemplateNotFoundException { // ClassLoader cl = Thread.currentThread().getContextClassLoader(); // if (cl == null) { // cl = getClass().getClassLoader(); // } // // if (prefix != null) { // templateSource = prefix + templateSource; // } // if (suffix != null) { // templateSource = templateSource + suffix; // } // // if (templateSource.startsWith("/")) { // templateSource = templateSource.replaceAll("^/(.*)", "$1"); // } // InputStream is = cl.getResourceAsStream(templateSource); // if (is == null) { // throw new TemplateNotFoundException("Can't find template " + templateSource); // } // // return is; // } // // public void setPrefix(String prefix) { // this.prefix = prefix; // } // // public void setSuffix(String suffix) { // this.suffix = suffix; // } // } // Path: moshas/src/test/java/net/unit8/moshas/LoopTemplateTest.java import net.unit8.moshas.context.Context; import net.unit8.moshas.loader.ResourceTemplateLoader; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; el.attr("class", "minus"); } el.text(ctx.getString("stock", "ratio")); }); }); t.select("tbody", (el, ctx) -> { el.empty(); AtomicInteger counter = new AtomicInteger(0); ctx.getCollection("items").forEach(item -> ctx.localScope("stock", item, "itemIndex", counter.incrementAndGet(), () -> { el.appendChild(stockSnippet.render(ctx)); })); }); }); } protected Map<String, Object> getContext() { Map<String, Object> ctx = new HashMap<>(); ctx.put("items", Stock.dummyItems()); return ctx; } @Test public void benchmark() throws IOException, InterruptedException { ExecutorService service = Executors.newFixedThreadPool(100); for (int i=0; i<100; i++) { service.execute(() -> {
Context context = new Context(getContext());
kawasima/moshas
moshas/src/main/java/net/unit8/moshas/parser/CharacterReader.java
// Path: moshas/src/main/java/net/unit8/moshas/helper/Validate.java // public class Validate { // // private Validate() {} // // /** // * Validates that the object is not null // * @param obj object to test // */ // public static void notNull(Object obj) { // if (obj == null) // throw new IllegalArgumentException("Object must not be null"); // } // // /** // * Validates that the object is not null // * @param obj object to test // * @param msg message to output if validation fails // */ // public static void notNull(Object obj, String msg) { // if (obj == null) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the value is true // * @param val object to test // */ // public static void isTrue(boolean val) { // if (!val) // throw new IllegalArgumentException("Must be true"); // } // // /** // * Validates that the value is true // * @param val object to test // * @param msg message to output if validation fails // */ // public static void isTrue(boolean val, String msg) { // if (!val) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the value is false // * @param val object to test // */ // public static void isFalse(boolean val) { // if (val) // throw new IllegalArgumentException("Must be false"); // } // // /** // * Validates that the value is false // * @param val object to test // * @param msg message to output if validation fails // */ // public static void isFalse(boolean val, String msg) { // if (val) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the array contains no null elements // * @param objects the array to test // */ // public static void noNullElements(Object[] objects) { // noNullElements(objects, "Array must not contain any null objects"); // } // // /** // * Validates that the array contains no null elements // * @param objects the array to test // * @param msg message to output if validation fails // */ // public static void noNullElements(Object[] objects, String msg) { // for (Object obj : objects) // if (obj == null) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the string is not empty // * @param string the string to test // */ // public static void notEmpty(String string) { // if (string == null || string.length() == 0) // throw new IllegalArgumentException("String must not be empty"); // } // // /** // * Validates that the string is not empty // * @param string the string to test // * @param msg message to output if validation fails // */ // public static void notEmpty(String string, String msg) { // if (string == null || string.length() == 0) // throw new IllegalArgumentException(msg); // } // // /** // Cause a failure. // @param msg message to output. // */ // public static void fail(String msg) { // throw new IllegalArgumentException(msg); // } // }
import net.unit8.moshas.helper.Validate; import java.util.Arrays; import java.util.Locale;
package net.unit8.moshas.parser; /** * * @author kawasima */ class CharacterReader { static final char EOF = (char) -1; private static final int maxCacheLen = 12; private final char[] input; private final int length; private int pos = 0; private int mark = 0; private final String[] stringCache = new String[512]; // holds reused strings in this doc, to lessen garbage CharacterReader(String input) {
// Path: moshas/src/main/java/net/unit8/moshas/helper/Validate.java // public class Validate { // // private Validate() {} // // /** // * Validates that the object is not null // * @param obj object to test // */ // public static void notNull(Object obj) { // if (obj == null) // throw new IllegalArgumentException("Object must not be null"); // } // // /** // * Validates that the object is not null // * @param obj object to test // * @param msg message to output if validation fails // */ // public static void notNull(Object obj, String msg) { // if (obj == null) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the value is true // * @param val object to test // */ // public static void isTrue(boolean val) { // if (!val) // throw new IllegalArgumentException("Must be true"); // } // // /** // * Validates that the value is true // * @param val object to test // * @param msg message to output if validation fails // */ // public static void isTrue(boolean val, String msg) { // if (!val) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the value is false // * @param val object to test // */ // public static void isFalse(boolean val) { // if (val) // throw new IllegalArgumentException("Must be false"); // } // // /** // * Validates that the value is false // * @param val object to test // * @param msg message to output if validation fails // */ // public static void isFalse(boolean val, String msg) { // if (val) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the array contains no null elements // * @param objects the array to test // */ // public static void noNullElements(Object[] objects) { // noNullElements(objects, "Array must not contain any null objects"); // } // // /** // * Validates that the array contains no null elements // * @param objects the array to test // * @param msg message to output if validation fails // */ // public static void noNullElements(Object[] objects, String msg) { // for (Object obj : objects) // if (obj == null) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the string is not empty // * @param string the string to test // */ // public static void notEmpty(String string) { // if (string == null || string.length() == 0) // throw new IllegalArgumentException("String must not be empty"); // } // // /** // * Validates that the string is not empty // * @param string the string to test // * @param msg message to output if validation fails // */ // public static void notEmpty(String string, String msg) { // if (string == null || string.length() == 0) // throw new IllegalArgumentException(msg); // } // // /** // Cause a failure. // @param msg message to output. // */ // public static void fail(String msg) { // throw new IllegalArgumentException(msg); // } // } // Path: moshas/src/main/java/net/unit8/moshas/parser/CharacterReader.java import net.unit8.moshas.helper.Validate; import java.util.Arrays; import java.util.Locale; package net.unit8.moshas.parser; /** * * @author kawasima */ class CharacterReader { static final char EOF = (char) -1; private static final int maxCacheLen = 12; private final char[] input; private final int length; private int pos = 0; private int mark = 0; private final String[] stringCache = new String[512]; // holds reused strings in this doc, to lessen garbage CharacterReader(String input) {
Validate.notNull(input);
kawasima/moshas
moshas/src/main/java/net/unit8/moshas/parser/Tag.java
// Path: moshas/src/main/java/net/unit8/moshas/helper/Validate.java // public class Validate { // // private Validate() {} // // /** // * Validates that the object is not null // * @param obj object to test // */ // public static void notNull(Object obj) { // if (obj == null) // throw new IllegalArgumentException("Object must not be null"); // } // // /** // * Validates that the object is not null // * @param obj object to test // * @param msg message to output if validation fails // */ // public static void notNull(Object obj, String msg) { // if (obj == null) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the value is true // * @param val object to test // */ // public static void isTrue(boolean val) { // if (!val) // throw new IllegalArgumentException("Must be true"); // } // // /** // * Validates that the value is true // * @param val object to test // * @param msg message to output if validation fails // */ // public static void isTrue(boolean val, String msg) { // if (!val) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the value is false // * @param val object to test // */ // public static void isFalse(boolean val) { // if (val) // throw new IllegalArgumentException("Must be false"); // } // // /** // * Validates that the value is false // * @param val object to test // * @param msg message to output if validation fails // */ // public static void isFalse(boolean val, String msg) { // if (val) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the array contains no null elements // * @param objects the array to test // */ // public static void noNullElements(Object[] objects) { // noNullElements(objects, "Array must not contain any null objects"); // } // // /** // * Validates that the array contains no null elements // * @param objects the array to test // * @param msg message to output if validation fails // */ // public static void noNullElements(Object[] objects, String msg) { // for (Object obj : objects) // if (obj == null) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the string is not empty // * @param string the string to test // */ // public static void notEmpty(String string) { // if (string == null || string.length() == 0) // throw new IllegalArgumentException("String must not be empty"); // } // // /** // * Validates that the string is not empty // * @param string the string to test // * @param msg message to output if validation fails // */ // public static void notEmpty(String string, String msg) { // if (string == null || string.length() == 0) // throw new IllegalArgumentException(msg); // } // // /** // Cause a failure. // @param msg message to output. // */ // public static void fail(String msg) { // throw new IllegalArgumentException(msg); // } // }
import net.unit8.moshas.helper.Validate; import java.io.Serializable; import java.util.HashMap; import java.util.Map;
package net.unit8.moshas.parser; /** * * @author kawasima */ public class Tag implements Serializable { private static final Map<String, Tag> tags = new HashMap<>(); // map of known tags private String tagName; private boolean isBlock = true; // block or inline private boolean formatAsBlock = true; // should be formatted as a block private boolean canContainBlock = true; // Can this tag hold block level tags? private boolean canContainInline = true; // only pcdata if not private boolean empty = false; // can hold nothing; e.g. img private boolean selfClosing = false; // can self close (<foo />). used for unknown tags that self close, without forcing them as empty. private boolean preserveWhitespace = false; // for pre, textarea, script etc private boolean formList = false; // a control that appears in forms: input, textarea, output etc private boolean formSubmit = false; // a control that can be submitted in a form: input etc private Tag(String tagName) { this.tagName = tagName.toLowerCase(); } /** * Get this tag's name. * * @return the tag's name */ public String getName() { return tagName; } /** * Get a Tag by name. If not previously defined (unknown), returns a new generic tag, that can do anything. * <p> * Pre-defined tags (P, DIV etc) will be ==, but unknown tags are not registered and will only .equals(). * </p> * * @param tagName Name of tag, e.g. "p". Case insensitive. * @return The tag, either defined or new generic. */ public static Tag valueOf(String tagName) {
// Path: moshas/src/main/java/net/unit8/moshas/helper/Validate.java // public class Validate { // // private Validate() {} // // /** // * Validates that the object is not null // * @param obj object to test // */ // public static void notNull(Object obj) { // if (obj == null) // throw new IllegalArgumentException("Object must not be null"); // } // // /** // * Validates that the object is not null // * @param obj object to test // * @param msg message to output if validation fails // */ // public static void notNull(Object obj, String msg) { // if (obj == null) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the value is true // * @param val object to test // */ // public static void isTrue(boolean val) { // if (!val) // throw new IllegalArgumentException("Must be true"); // } // // /** // * Validates that the value is true // * @param val object to test // * @param msg message to output if validation fails // */ // public static void isTrue(boolean val, String msg) { // if (!val) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the value is false // * @param val object to test // */ // public static void isFalse(boolean val) { // if (val) // throw new IllegalArgumentException("Must be false"); // } // // /** // * Validates that the value is false // * @param val object to test // * @param msg message to output if validation fails // */ // public static void isFalse(boolean val, String msg) { // if (val) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the array contains no null elements // * @param objects the array to test // */ // public static void noNullElements(Object[] objects) { // noNullElements(objects, "Array must not contain any null objects"); // } // // /** // * Validates that the array contains no null elements // * @param objects the array to test // * @param msg message to output if validation fails // */ // public static void noNullElements(Object[] objects, String msg) { // for (Object obj : objects) // if (obj == null) // throw new IllegalArgumentException(msg); // } // // /** // * Validates that the string is not empty // * @param string the string to test // */ // public static void notEmpty(String string) { // if (string == null || string.length() == 0) // throw new IllegalArgumentException("String must not be empty"); // } // // /** // * Validates that the string is not empty // * @param string the string to test // * @param msg message to output if validation fails // */ // public static void notEmpty(String string, String msg) { // if (string == null || string.length() == 0) // throw new IllegalArgumentException(msg); // } // // /** // Cause a failure. // @param msg message to output. // */ // public static void fail(String msg) { // throw new IllegalArgumentException(msg); // } // } // Path: moshas/src/main/java/net/unit8/moshas/parser/Tag.java import net.unit8.moshas.helper.Validate; import java.io.Serializable; import java.util.HashMap; import java.util.Map; package net.unit8.moshas.parser; /** * * @author kawasima */ public class Tag implements Serializable { private static final Map<String, Tag> tags = new HashMap<>(); // map of known tags private String tagName; private boolean isBlock = true; // block or inline private boolean formatAsBlock = true; // should be formatted as a block private boolean canContainBlock = true; // Can this tag hold block level tags? private boolean canContainInline = true; // only pcdata if not private boolean empty = false; // can hold nothing; e.g. img private boolean selfClosing = false; // can self close (<foo />). used for unknown tags that self close, without forcing them as empty. private boolean preserveWhitespace = false; // for pre, textarea, script etc private boolean formList = false; // a control that appears in forms: input, textarea, output etc private boolean formSubmit = false; // a control that can be submitted in a form: input etc private Tag(String tagName) { this.tagName = tagName.toLowerCase(); } /** * Get this tag's name. * * @return the tag's name */ public String getName() { return tagName; } /** * Get a Tag by name. If not previously defined (unknown), returns a new generic tag, that can do anything. * <p> * Pre-defined tags (P, DIV etc) will be ==, but unknown tags are not registered and will only .equals(). * </p> * * @param tagName Name of tag, e.g. "p". Case insensitive. * @return The tag, either defined or new generic. */ public static Tag valueOf(String tagName) {
Validate.notNull(tagName);
kawasima/moshas
moshas/src/main/java/net/unit8/moshas/TemplateManager.java
// Path: moshas/src/main/java/net/unit8/moshas/loader/TemplateLoader.java // public abstract class TemplateLoader { // public abstract InputStream getTemplateStream(String templateSource) throws TemplateNotFoundException; // }
import net.unit8.moshas.loader.TemplateLoader;
package net.unit8.moshas; /** * * @author kawasima */ public interface TemplateManager { Template loadTemplate(String templateName); Template getTemplate(String source);
// Path: moshas/src/main/java/net/unit8/moshas/loader/TemplateLoader.java // public abstract class TemplateLoader { // public abstract InputStream getTemplateStream(String templateSource) throws TemplateNotFoundException; // } // Path: moshas/src/main/java/net/unit8/moshas/TemplateManager.java import net.unit8.moshas.loader.TemplateLoader; package net.unit8.moshas; /** * * @author kawasima */ public interface TemplateManager { Template loadTemplate(String templateName); Template getTemplate(String source);
void setTemplateLoaders(TemplateLoader... loaders);
kawasima/moshas
moshas/src/test/java/net/unit8/moshas/MoshasEngineTest.java
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java // public class Context extends AbstractContext { // // public Context() { // super(); // } // // public Context(Map<String, Object> variables) { // super(); // for (Map.Entry<String, Object> entry : variables.entrySet()) { // setVariable(entry.getKey(), entry.getValue()); // } // } // } // // Path: moshas/src/main/java/net/unit8/moshas/loader/TemplateNotFoundException.java // public class TemplateNotFoundException extends RuntimeException { // public TemplateNotFoundException(String msg) { // super(msg); // } // // public TemplateNotFoundException(String msg, Exception cause) { // super(msg, cause); // } // } // // Path: moshas/src/main/java/net/unit8/moshas/RenderUtils.java // public static RenderFunction text(String... keys) { // return (el, ctx) -> el.text(ctx.getString(keys)); // }
import net.unit8.moshas.context.Context; import net.unit8.moshas.loader.TemplateNotFoundException; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.io.StringWriter; import java.util.Locale; import static net.unit8.moshas.RenderUtils.text;
package net.unit8.moshas; /** * @author kawasima */ @RunWith(Parameterized.class) public class MoshasEngineTest { @Parameterized.Parameter(0) public MoshasEngine engine; @Parameterized.Parameters(name = "engine [{0}]") public static Object[][] arguments() { return new Object[][]{ {new MoshasEngine()}, {new MoshasEngine(new StandardTemplateManager(new ConcurrentHashMapTemplateCache()))} }; }
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java // public class Context extends AbstractContext { // // public Context() { // super(); // } // // public Context(Map<String, Object> variables) { // super(); // for (Map.Entry<String, Object> entry : variables.entrySet()) { // setVariable(entry.getKey(), entry.getValue()); // } // } // } // // Path: moshas/src/main/java/net/unit8/moshas/loader/TemplateNotFoundException.java // public class TemplateNotFoundException extends RuntimeException { // public TemplateNotFoundException(String msg) { // super(msg); // } // // public TemplateNotFoundException(String msg, Exception cause) { // super(msg, cause); // } // } // // Path: moshas/src/main/java/net/unit8/moshas/RenderUtils.java // public static RenderFunction text(String... keys) { // return (el, ctx) -> el.text(ctx.getString(keys)); // } // Path: moshas/src/test/java/net/unit8/moshas/MoshasEngineTest.java import net.unit8.moshas.context.Context; import net.unit8.moshas.loader.TemplateNotFoundException; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.io.StringWriter; import java.util.Locale; import static net.unit8.moshas.RenderUtils.text; package net.unit8.moshas; /** * @author kawasima */ @RunWith(Parameterized.class) public class MoshasEngineTest { @Parameterized.Parameter(0) public MoshasEngine engine; @Parameterized.Parameters(name = "engine [{0}]") public static Object[][] arguments() { return new Object[][]{ {new MoshasEngine()}, {new MoshasEngine(new StandardTemplateManager(new ConcurrentHashMapTemplateCache()))} }; }
@Test(expected = TemplateNotFoundException.class)
kawasima/moshas
moshas/src/test/java/net/unit8/moshas/MoshasEngineTest.java
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java // public class Context extends AbstractContext { // // public Context() { // super(); // } // // public Context(Map<String, Object> variables) { // super(); // for (Map.Entry<String, Object> entry : variables.entrySet()) { // setVariable(entry.getKey(), entry.getValue()); // } // } // } // // Path: moshas/src/main/java/net/unit8/moshas/loader/TemplateNotFoundException.java // public class TemplateNotFoundException extends RuntimeException { // public TemplateNotFoundException(String msg) { // super(msg); // } // // public TemplateNotFoundException(String msg, Exception cause) { // super(msg, cause); // } // } // // Path: moshas/src/main/java/net/unit8/moshas/RenderUtils.java // public static RenderFunction text(String... keys) { // return (el, ctx) -> el.text(ctx.getString(keys)); // }
import net.unit8.moshas.context.Context; import net.unit8.moshas.loader.TemplateNotFoundException; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.io.StringWriter; import java.util.Locale; import static net.unit8.moshas.RenderUtils.text;
package net.unit8.moshas; /** * @author kawasima */ @RunWith(Parameterized.class) public class MoshasEngineTest { @Parameterized.Parameter(0) public MoshasEngine engine; @Parameterized.Parameters(name = "engine [{0}]") public static Object[][] arguments() { return new Object[][]{ {new MoshasEngine()}, {new MoshasEngine(new StandardTemplateManager(new ConcurrentHashMapTemplateCache()))} }; } @Test(expected = TemplateNotFoundException.class) public void test() { engine.describe("notfound", t -> {}); } @Test public void test1() { Template template = engine.describe("META-INF/templates/index.html", t -> {});
// Path: moshas/src/main/java/net/unit8/moshas/context/Context.java // public class Context extends AbstractContext { // // public Context() { // super(); // } // // public Context(Map<String, Object> variables) { // super(); // for (Map.Entry<String, Object> entry : variables.entrySet()) { // setVariable(entry.getKey(), entry.getValue()); // } // } // } // // Path: moshas/src/main/java/net/unit8/moshas/loader/TemplateNotFoundException.java // public class TemplateNotFoundException extends RuntimeException { // public TemplateNotFoundException(String msg) { // super(msg); // } // // public TemplateNotFoundException(String msg, Exception cause) { // super(msg, cause); // } // } // // Path: moshas/src/main/java/net/unit8/moshas/RenderUtils.java // public static RenderFunction text(String... keys) { // return (el, ctx) -> el.text(ctx.getString(keys)); // } // Path: moshas/src/test/java/net/unit8/moshas/MoshasEngineTest.java import net.unit8.moshas.context.Context; import net.unit8.moshas.loader.TemplateNotFoundException; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.io.StringWriter; import java.util.Locale; import static net.unit8.moshas.RenderUtils.text; package net.unit8.moshas; /** * @author kawasima */ @RunWith(Parameterized.class) public class MoshasEngineTest { @Parameterized.Parameter(0) public MoshasEngine engine; @Parameterized.Parameters(name = "engine [{0}]") public static Object[][] arguments() { return new Object[][]{ {new MoshasEngine()}, {new MoshasEngine(new StandardTemplateManager(new ConcurrentHashMapTemplateCache()))} }; } @Test(expected = TemplateNotFoundException.class) public void test() { engine.describe("notfound", t -> {}); } @Test public void test1() { Template template = engine.describe("META-INF/templates/index.html", t -> {});
Context context = new Context();