org.wso2.carbon.base.api.ServerConfigurationService Java Examples
The following examples show how to use
org.wso2.carbon.base.api.ServerConfigurationService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserStoreConfigComponent.java From carbon-identity with Apache License 2.0 | 5 votes |
protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Set the ServerConfiguration Service"); } UserStoreConfigComponent.serverConfigurationService = serverConfigurationService; }
Example #2
Source File: CarbonUIUtil.java From attic-stratos with Apache License 2.0 | 5 votes |
/** * Get a ServerConfiguration Property * * @param propertyName Name of the property * @return the property */ public static String getServerConfigurationProperty(String propertyName) { try { ServerConfigurationService serverConfig = CarbonUIServiceComponent.getServerConfiguration(); return serverConfig.getFirstProperty(propertyName); } catch (Exception e) { String msg = "ServerConfiguration Service not available"; log.error(msg, e); } return null; }
Example #3
Source File: CarbonUIServiceComponent.java From attic-stratos with Apache License 2.0 | 5 votes |
/** * This method checks whether the management console is configured to run on the local transport. * Check the ServerURL property in the carbon.xml. * Set a system property if and only if the system is running on local transport. * * @param serverConfiguration Service configuration. * @return boolean; true if running on local transport */ private boolean checkForLocalTransportMode(ServerConfigurationService serverConfiguration) { String serverURL = serverConfiguration.getFirstProperty(CarbonConstants.SERVER_URL); if(serverURL != null && (serverURL.startsWith("local") || serverURL.startsWith("Local") || serverURL.startsWith("LOCAL"))) { System.setProperty(CarbonConstants.LOCAL_TRANSPORT_MODE_ENABLED, "true"); return true; } return false; }
Example #4
Source File: CarbonUIServiceComponent.java From attic-stratos with Apache License 2.0 | 5 votes |
public static ServerConfigurationService getServerConfiguration() { if (serverConfiguration == null) { String msg = "Before activating Carbon UI bundle, an instance of " + "ServerConfiguration Service should be in existence"; log.error(msg); throw new RuntimeException(msg); } return serverConfiguration; }
Example #5
Source File: StatisticsServiceComponent.java From carbon-commons with Apache License 2.0 | 5 votes |
@Reference( name = "server.configuration", service = org.wso2.carbon.base.api.ServerConfigurationService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetServerConfiguration") protected void setServerConfiguration(ServerConfigurationService serverConfiguration) { this.serverConfig = serverConfiguration; }
Example #6
Source File: APIHandlerServiceComponent.java From carbon-apimgt with Apache License 2.0 | 5 votes |
/** * This method will be called when {@link ServerConfigurationService} instance is being removed from OSGI * environment. * * @param serverConfigurationService Instance of {@link ServerConfigurationService} */ protected void unsetServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Server configuration service is unbound from the API handlers"); } ServiceReferenceHolder.getInstance().setServerConfigurationService(null); }
Example #7
Source File: APIHandlerServiceComponent.java From carbon-apimgt with Apache License 2.0 | 5 votes |
/** * This method will be called when {@link ServerConfigurationService} instance is available in OSGI environment. * * @param serverConfigurationService Instance of {@link ServerConfigurationService} */ @Reference( name = "server.configuration.service", service = org.wso2.carbon.base.api.ServerConfigurationService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetServerConfigurationService") protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Server configuration service is bound to the API handlers"); } ServiceReferenceHolder.getInstance().setServerConfigurationService(serverConfigurationService); }
Example #8
Source File: MigrationServiceComponent.java From product-ei with Apache License 2.0 | 5 votes |
/** * Method to unset server configuration service. * * @param serverConfigurationService ServerConfigurationService. */ protected void unsetServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Unsetting ServerConfigurationService from WSO2 EI Config component"); } MigrationServiceDataHolder.setServerConfigurationService(null); }
Example #9
Source File: MigrationServiceComponent.java From product-ei with Apache License 2.0 | 5 votes |
/** * Method to set server configuration service. * * @param serverConfigurationService ServerConfigurationService. */ protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Setting ServerConfigurationService to WSO2 EI Config component"); } MigrationServiceDataHolder.setServerConfigurationService(serverConfigurationService); }
Example #10
Source File: UserStoreUtil.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * Util function to encrypt given plain text using given cipher * * @param plainTextBytes target plain text to encrypt using the cipher * @return Cipher text * @throws BadPaddingException * @throws IllegalBlockSizeException * @throws IOException */ public static byte[] encrypt(byte[] plainTextBytes) throws CryptoException { boolean isInternalKeyStoreEncryptionEnabled = false; boolean isSymmetricKeyEncryptionEnabled = false; ServerConfigurationService config = UserStoreConfigComponent.getServerConfigurationService(); if (config != null) { String encryptionKeyStore = config.getFirstProperty(UserStoreConfigurationConstants.ENCRYPTION_KEYSTORE); if (INTERNAL_KEYSTORE.equalsIgnoreCase(encryptionKeyStore)) { isInternalKeyStoreEncryptionEnabled = true; } String cryptoProvider = config.getFirstProperty(UserStoreConfigurationConstants.CRYPTO_PROVIDER); if (UserStoreConfigurationConstants.SYMMETRIC_KEY_CRYPTO_PROVIDER.equalsIgnoreCase(cryptoProvider)) { isSymmetricKeyEncryptionEnabled = true; } } if (isInternalKeyStoreEncryptionEnabled && isSymmetricKeyEncryptionEnabled) { throw new CryptoException(String.format("Userstore encryption can not be supported due to " + "conflicting configurations: '%s' and '%s'. When using internal keystore, assymetric crypto " + "provider should be used.", UserStoreConfigurationConstants.INTERNAL_KEYSTORE, UserStoreConfigurationConstants.SYMMETRIC_KEY_CRYPTO_PROVIDER)); } else if (isInternalKeyStoreEncryptionEnabled || isSymmetricKeyEncryptionEnabled) { return CryptoUtil.getDefaultCryptoUtil().encrypt(plainTextBytes); } else { return encryptWithPrimaryKeyStore(plainTextBytes); } }
Example #11
Source File: IdentityCoreServiceComponent.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
@Reference( name = "server.configuration.service", service = ServerConfigurationService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetServerConfigurationService" ) protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Set the ServerConfiguration Service"); } IdentityCoreServiceComponent.serverConfigurationService = serverConfigurationService; }
Example #12
Source File: UserStoreConfigComponent.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
@Reference( name = "server.configuration.service", service = ServerConfigurationService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetServerConfigurationService" ) protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Setting the serverConfigurationService"); } UserStoreConfigComponent.serverConfigurationService = serverConfigurationService; }
Example #13
Source File: SecondaryUserStoreConfigurator.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * Encrypt a given text. * * @param plainText Cipher text to be encrypted * @return Returns the encrypted text * @throws IdentityUserStoreMgtException Encryption failed */ public String encryptPlainText(String plainText) throws IdentityUserStoreMgtException { boolean isInternalKeyStoreEncryptionEnabled = false; boolean isSymmetricKeyEncryptionEnabled = false; ServerConfigurationService config = UserStoreConfigComponent.getServerConfigurationService(); if (config != null) { String encryptionKeyStore = config.getFirstProperty(ENCRYPTION_KEYSTORE); if (INTERNAL_KEYSTORE.equalsIgnoreCase(encryptionKeyStore)) { isInternalKeyStoreEncryptionEnabled = true; } String cryptoProvider = config.getFirstProperty(CRYPTO_PROVIDER); if (SYMMETRIC_KEY_CRYPTO_PROVIDER.equalsIgnoreCase(cryptoProvider)) { isSymmetricKeyEncryptionEnabled = true; } } if (isInternalKeyStoreEncryptionEnabled && isSymmetricKeyEncryptionEnabled) { throw new IdentityUserStoreMgtException(String.format("Userstore encryption can not be supported due to " + "conflicting configurations: '%s' and '%s'. When using internal keystore, assymetric crypto " + "provider should be used.", INTERNAL_KEYSTORE, SYMMETRIC_KEY_CRYPTO_PROVIDER)); } else if (isInternalKeyStoreEncryptionEnabled || isSymmetricKeyEncryptionEnabled) { try { return CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode(plainText.getBytes()); } catch (CryptoException e) { String errorMessage = "Error while encrypting the plain text using internal keystore."; throw new IdentityUserStoreMgtException(errorMessage, e); } } else { return encryptWithPrimaryKeyStore(config, plainText); } }
Example #14
Source File: UserStoreConfigComponent.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
@Reference( name = "server.configuration.service", service = ServerConfigurationService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetServerConfigurationService" ) protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Set the ServerConfiguration Service"); } UserStoreConfigComponent.serverConfigurationService = serverConfigurationService; }
Example #15
Source File: WorkflowImplServiceDataHolder.java From carbon-identity with Apache License 2.0 | 4 votes |
public ServerConfigurationService getServerConfigurationService() { return serverConfigurationService; }
Example #16
Source File: CarbonUIUtil.java From attic-stratos with Apache License 2.0 | 4 votes |
public static String getServerURL(ServerConfigurationService serverConfig) { ConfigurationContext serverCfgCtx = CarbonUIServiceComponent.getConfigurationContextService().getServerConfigContext(); return CarbonUtils.getServerURL(serverConfig, serverCfgCtx); }
Example #17
Source File: CarbonUIUtil.java From attic-stratos with Apache License 2.0 | 4 votes |
public static String getIndexPageURL(ServerConfigurationService serverConfig) { return serverConfig.getFirstProperty(CarbonConstants.INDEX_PAGE_URL); }
Example #18
Source File: IdentityCoreServiceComponent.java From carbon-identity-framework with Apache License 2.0 | 4 votes |
protected void unsetServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Unset the ServerConfiguration Service"); } IdentityCoreServiceComponent.serverConfigurationService = null; }
Example #19
Source File: CarbonUIServiceComponent.java From attic-stratos with Apache License 2.0 | 4 votes |
protected void unsetServerConfigurationService(ServerConfigurationService serverConfiguration) { CarbonUIServiceComponent.serverConfiguration = null; }
Example #20
Source File: CarbonUIServiceComponent.java From attic-stratos with Apache License 2.0 | 4 votes |
protected void setServerConfigurationService(ServerConfigurationService serverConfiguration) { CarbonUIServiceComponent.serverConfiguration = serverConfiguration; }
Example #21
Source File: UserStoreConfigComponent.java From carbon-identity-framework with Apache License 2.0 | 4 votes |
public static ServerConfigurationService getServerConfigurationService() { return UserStoreConfigComponent.serverConfigurationService; }
Example #22
Source File: UserStoreConfigComponent.java From carbon-identity-framework with Apache License 2.0 | 4 votes |
protected void unsetServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Unset the ServerConfiguration Service"); } UserStoreConfigComponent.serverConfigurationService = null; }
Example #23
Source File: WorkflowImplServiceDataHolder.java From carbon-identity with Apache License 2.0 | 4 votes |
public void setServerConfigurationService( ServerConfigurationService serverConfigurationService) { this.serverConfigurationService = serverConfigurationService; }
Example #24
Source File: UserStoreConfigComponent.java From carbon-identity-framework with Apache License 2.0 | 4 votes |
protected void unsetServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Unsetting the ServerConfigurationService"); } UserStoreConfigComponent.serverConfigurationService = null; }
Example #25
Source File: UserStoreConfigComponent.java From carbon-identity with Apache License 2.0 | 4 votes |
protected void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { if (log.isDebugEnabled()) { log.debug("Setting the serverConfigurationService"); } UserStoreConfigComponent.serverConfigurationService = serverConfigurationService; }
Example #26
Source File: UserStoreConfigComponent.java From carbon-identity-framework with Apache License 2.0 | 4 votes |
public static ServerConfigurationService getServerConfigurationService() { return UserStoreConfigComponent.serverConfigurationService; }
Example #27
Source File: OAuthUIServiceComponentHolder.java From carbon-identity with Apache License 2.0 | 4 votes |
public ServerConfigurationService getServerConfigurationService() { return serverConfigurationService; }
Example #28
Source File: OAuthUIServiceComponentHolder.java From carbon-identity with Apache License 2.0 | 4 votes |
public void setServerConfigurationService(ServerConfigurationService serverConfigurationService) { this.serverConfigurationService = serverConfigurationService; }
Example #29
Source File: OAuthUIServiceComponent.java From carbon-identity with Apache License 2.0 | 4 votes |
protected void setServerConfigurationService(ServerConfigurationService serverConfigService) { OAuthUIServiceComponentHolder.getInstance().setServerConfigurationService(serverConfigService); log.debug("ServerConfigurationService instance was set."); }
Example #30
Source File: OAuthUIServiceComponent.java From carbon-identity with Apache License 2.0 | 4 votes |
protected void unsetServerConfigurationService(ServerConfigurationService serverConfigService) { OAuthUIServiceComponentHolder.getInstance().setServerConfigurationService(null); log.debug("ServerConfigurationService instance was unset."); }