Package com.axway.apim.adapter
Class APIManagerAdapter
- java.lang.Object
-
- com.axway.apim.adapter.APIManagerAdapter
-
public class APIManagerAdapter extends Object
The APIContract reflects the actual existing API in the API-Manager.- Author:
- cwiechmann@axway.com
-
-
Field Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclearCache(String cacheName)static voiddeleteInstance()static StringgetApiManagerName()StringgetApiManagerVersion()ClientApplicationgetAppIdForCredential(String credential, String type)The actual App-ID based on the AppName.static <K,V>
org.ehcache.Cache<K,V>getCache(CacheType cacheType, Class<K> key, Class<V> value)static StringgetCertInfo(InputStream certificate, String password, CaCert cert)static UsergetCurrentUser()static com.fasterxml.jackson.databind.JsonNodegetFileData(byte[] fileFontent, String filename, org.apache.http.entity.ContentType contentType)Helper method to translate a Base64 encoded format as it's needed by the API-Manager.StringgetHigherRole(User user)static ImagegetImageFromAPIM(URI uri, String baseFilename)static APIManagerAdaptergetInstance()static booleanhasAdminAccount()static booleanhasAPIManagerVersion(String version)Checks if the API-Manager has at least given version.voidloginToAPIManager()voidlogoutFromAPIManager()voidsetApiManagerVersion(String apiManagerVersion)
-
-
-
Field Detail
-
ADMIN
public static final String ADMIN
- See Also:
- Constant Field Values
-
OADMIN
public static final String OADMIN
- See Also:
- Constant Field Values
-
USER
public static final String USER
- See Also:
- Constant Field Values
-
apiManagerName
public static String apiManagerName
-
initialized
public static boolean initialized
-
mapper
public static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
CREDENTIAL_TYPE_API_KEY
public static final String CREDENTIAL_TYPE_API_KEY
- See Also:
- Constant Field Values
-
CREDENTIAL_TYPE_EXT_CLIENTID
public static final String CREDENTIAL_TYPE_EXT_CLIENTID
- See Also:
- Constant Field Values
-
CREDENTIAL_TYPE_OAUTH
public static final String CREDENTIAL_TYPE_OAUTH
- See Also:
- Constant Field Values
-
SYSTEM_API_QUOTA
public static final String SYSTEM_API_QUOTA
- See Also:
- Constant Field Values
-
APPLICATION_DEFAULT_QUOTA
public static final String APPLICATION_DEFAULT_QUOTA
- See Also:
- Constant Field Values
-
TYPE_FRONT_END
public static final String TYPE_FRONT_END
- See Also:
- Constant Field Values
-
TYPE_BACK_END
public static final String TYPE_BACK_END
- See Also:
- Constant Field Values
-
cacheManager
public static APIMCLICacheManager cacheManager
-
configAdapter
public APIManagerConfigAdapter configAdapter
-
customPropertiesAdapter
public APIManagerCustomPropertiesAdapter customPropertiesAdapter
-
alertsAdapter
public APIManagerAlertsAdapter alertsAdapter
-
remoteHostsAdapter
public APIManagerRemoteHostsAdapter remoteHostsAdapter
-
apiAdapter
public APIManagerAPIAdapter apiAdapter
-
methodAdapter
public APIManagerAPIMethodAdapter methodAdapter
-
policiesAdapter
public APIManagerPoliciesAdapter policiesAdapter
-
quotaAdapter
public APIManagerQuotaAdapter quotaAdapter
-
orgAdapter
public APIManagerOrganizationAdapter orgAdapter
-
accessAdapter
public APIManagerAPIAccessAdapter accessAdapter
-
oauthClientAdapter
public APIManagerOAuthClientProfilesAdapter oauthClientAdapter
-
appAdapter
public APIMgrAppsAdapter appAdapter
-
userAdapter
public APIManagerUserAdapter userAdapter
-
-
Method Detail
-
getInstance
public static APIManagerAdapter getInstance() throws AppException
- Throws:
AppException
-
deleteInstance
public static void deleteInstance() throws AppException- Throws:
AppException
-
setApiManagerVersion
public void setApiManagerVersion(String apiManagerVersion)
-
loginToAPIManager
public void loginToAPIManager() throws AppException- Throws:
AppException
-
logoutFromAPIManager
public void logoutFromAPIManager() throws AppException- Throws:
AppException
-
getCurrentUser
public static User getCurrentUser() throws AppException
- Throws:
AppException
-
getCache
public static <K,V> org.ehcache.Cache<K,V> getCache(CacheType cacheType, Class<K> key, Class<V> value)
-
clearCache
public static void clearCache(String cacheName)
-
hasAPIManagerVersion
public static boolean hasAPIManagerVersion(String version)
Checks if the API-Manager has at least given version. If the given requested version is the same or lower than the actual API-Manager version, true is returned otherwise false. This helps to use features, that are introduced with a certain version or even service-pack.- Parameters:
version- has the API-Manager this version of higher?- Returns:
- false if API-Manager doesn't have this version otherwise true
-
getAppIdForCredential
public ClientApplication getAppIdForCredential(String credential, String type) throws AppException
The actual App-ID based on the AppName. Lazy implementation.- Parameters:
credential- The credentials (API-Key, Client-ID) which is registered for an applicationtype- of the credential. See APIManagerAdapter for potential credential types- Returns:
- the id of the organization
- Throws:
AppException- if JSON response from API-Manager can't be parsed
-
getImageFromAPIM
public static Image getImageFromAPIM(URI uri, String baseFilename) throws AppException
- Throws:
AppException
-
getApiManagerVersion
public String getApiManagerVersion() throws AppException
- Throws:
AppException
-
getApiManagerName
public static String getApiManagerName() throws AppException
- Throws:
AppException
-
getCertInfo
public static String getCertInfo(InputStream certificate, String password, CaCert cert) throws AppException
- Throws:
AppException
-
getFileData
public static com.fasterxml.jackson.databind.JsonNode getFileData(byte[] fileFontent, String filename, org.apache.http.entity.ContentType contentType) throws AppExceptionHelper method to translate a Base64 encoded format as it's needed by the API-Manager.- Parameters:
fileFontent- the certificate contentfilename- the name of the certificate file used as a reference in the generated Json objectcontentType- the content type- Returns:
- a Json-Object structure as needed by the API-Manager
- Throws:
AppException- when the certificate information can't be created
-
hasAdminAccount
public static boolean hasAdminAccount() throws AppException- Returns:
- true, when admin credentials are provided
- Throws:
AppException- when the API-Manager instance is not initialized
-
-