From d4eab9f86e9feaa20374662deace6e094494fa43 Mon Sep 17 00:00:00 2001 From: harshanl Date: Mon, 12 Oct 2015 19:48:35 +0530 Subject: [PATCH] Code refactored. --- .../mgt/core/permission/mgt/PermissionUtils.java | 10 +++++----- .../dynamic/client/web/DynamicClientUtil.java | 2 +- .../impl/DynamicClientRegistrationImpl.java | 13 ++++++------- .../DynamicClientRegistrationServiceComponent.java | 1 - 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/permission/mgt/PermissionUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/permission/mgt/PermissionUtils.java index d81d7a157c..3ed44c63b1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/permission/mgt/PermissionUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/permission/mgt/PermissionUtils.java @@ -39,8 +39,8 @@ import java.util.StringTokenizer; */ public class PermissionUtils { - public static String ADMIN_PERMISSION_REGISTRY_PATH = "/permission/admin"; - public static String PERMISSION_PROPERTY_NAME = "name"; + public static final String ADMIN_PERMISSION_REGISTRY_PATH = "/permission/admin"; + public static final String PERMISSION_PROPERTY_NAME = "name"; public static Registry getGovernanceRegistry() throws PermissionManagementException { try { @@ -78,11 +78,11 @@ public class PermissionUtils { try { StringTokenizer tokenizer = new StringTokenizer(permission.getPath(), "/"); String lastToken = "", currentToken, tempPath; - while(tokenizer.hasMoreTokens()){ + while(tokenizer.hasMoreTokens()) { currentToken = tokenizer.nextToken(); tempPath = lastToken + "/" + currentToken; - if(!checkResourceExists(tempPath)){ - createRegistryCollection(tempPath, currentToken.substring(0)); + if(!checkResourceExists(tempPath)) { + createRegistryCollection(tempPath, currentToken); } lastToken = tempPath; } diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java index 21f2aec018..5025a796bf 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/src/main/java/org/wso2/carbon/dynamic/client/web/DynamicClientUtil.java @@ -22,7 +22,7 @@ import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; /** - * Created by harshan on 9/8/15. + * Holds the utility methods used by Dynamic-Client web bundle. */ public class DynamicClientUtil { diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java index 3c2c49f002..fcd1c7c133 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/impl/DynamicClientRegistrationImpl.java @@ -38,7 +38,6 @@ import org.wso2.carbon.identity.sso.saml.admin.SAMLSSOConfigAdmin; import org.wso2.carbon.identity.sso.saml.dto.SAMLSSOServiceProviderDTO; import org.wso2.carbon.registry.core.Registry; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; - import java.util.Arrays; /** @@ -95,16 +94,16 @@ public class DynamicClientRegistrationImpl implements DynamicClientRegistrationS if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS)) { oAuthApplicationInfo .addParameter(ApplicationConstants.ClientMetadata.OAUTH_REDIRECT_URIS, - jsonObject - .get(ApplicationConstants.ClientMetadata. - OAUTH_REDIRECT_URIS)); + jsonObject + .get(ApplicationConstants.ClientMetadata. + OAUTH_REDIRECT_URIS)); } if (jsonObject.has(ApplicationConstants.ClientMetadata.OAUTH_CLIENT_GRANT)) { oAuthApplicationInfo.addParameter(ApplicationConstants.ClientMetadata. - OAUTH_CLIENT_GRANT, jsonObject - .get(ApplicationConstants.ClientMetadata. - OAUTH_CLIENT_GRANT)); + OAUTH_CLIENT_GRANT, jsonObject + .get(ApplicationConstants.ClientMetadata. + OAUTH_CLIENT_GRANT)); } } catch (JSONException e) { throw new DynamicClientRegistrationException( diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationServiceComponent.java b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationServiceComponent.java index d01b7fa524..68d7ef02a0 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationServiceComponent.java +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/src/main/java/org/wso2/carbon/dynamic/client/registration/internal/DynamicClientRegistrationServiceComponent.java @@ -24,7 +24,6 @@ import org.osgi.service.component.ComponentContext; import org.wso2.carbon.dynamic.client.registration.DynamicClientRegistrationService; import org.wso2.carbon.dynamic.client.registration.impl.DynamicClientRegistrationImpl; import org.wso2.carbon.identity.application.mgt.ApplicationManagementService; -import org.wso2.carbon.identity.core.util.IdentityCoreInitializedEvent; /** * @scr.component name="org.wso2.carbon.dynamic.client.registration" immediate="true"