diff --git a/.gitignore b/.gitignore
index 32858aa..01252e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,9 @@
*.class
+*.iml
+*.ipr
+*.iws
+.idea
+.DS_Store
# Mobile Tools for Java (J2ME)
.mtj.tmp/
@@ -10,3 +15,5 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
+
+target/
\ No newline at end of file
diff --git a/components/org.wso2.carbon.identity.common/pom.xml b/components/org.wso2.carbon.identity.common/pom.xml
index f7c7881..25721a2 100644
--- a/components/org.wso2.carbon.identity.common/pom.xml
+++ b/components/org.wso2.carbon.identity.common/pom.xml
@@ -1,20 +1,18 @@
@@ -28,7 +26,7 @@
4.0.0
org.wso2.carbon.identity.commons
- jar
+ bundle
WSO2 Carbon - Identity Common
This is a Carbon bundle that represents the Identity Common module.
@@ -93,4 +91,16 @@
+
+ org.wso2.carbon.identity.common.internal
+
+ !org.wso2.carbon.identity.common.internal,
+ org.wso2.carbon.identity.common.*; version="${identity.base.package.export.version}"
+
+
+ org.slf4j.*; version="${slf4j.package.import.version}",
+
+ *
+
+
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/Constants.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/Constants.java
index 1c1b918..06d4860 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/Constants.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/Constants.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2007 WSO2, Inc. (http://wso2.com)
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +16,16 @@
package org.wso2.carbon.identity.common.base;
+/**
+ * Identity common constants.
+ */
public class Constants {
- private Constants() {
- }
-
public static final String CLOCK_SKEW_DEFAULT = "300";
public static final String IP_UNKNOWN = "unknown";
public static final String WSO2CARBON_CLAIM_DIALECT = "http://wso2.org/claims";
- public final static String CLAIM_TENANT_DOMAIN = "http://wso2.org/claims/tenant";
- public final static String SELF_SIGNUP_ROLE = "selfsignup";
+ public static final String CLAIM_TENANT_DOMAIN = "http://wso2.org/claims/tenant";
+ public static final String SELF_SIGNUP_ROLE = "selfsignup";
public static final String CASE_INSENSITIVE_USERNAME = "CaseInsensitiveUsername";
public static final int HTTPS_PORT_DEFAULT = 443;
public static final String IDENTITY_CONFIG = "identity.xml";
@@ -40,50 +40,81 @@ private Constants() {
public static final String RANDOM_PHRASE_PREFIX = "random-password-generated!@#$%^&*(0)+_";
public static final String HMAC_SHA1 = "HmacSHA1";
public static final String NULL = "null";
+ // HTTP headers which may contain IP address of the client in the order of priority
+ public static final String[] HEADERS_WITH_IP = {
+ "X-Forwarded-For",
+ "Proxy-Client-IP",
+ "WL-Proxy-Client-IP",
+ "HTTP_X_FORWARDED_FOR",
+ "HTTP_X_FORWARDED",
+ "HTTP_X_CLUSTER_CLIENT_IP",
+ "HTTP_CLIENT_IP",
+ "HTTP_FORWARDED_FOR",
+ "HTTP_FORWARDED",
+ "HTTP_VIA",
+ "REMOTE_ADDR"
+ };
+
+ private Constants() {
+ }
+ /**
+ * Server configuration.
+ */
public static class ServerConfig {
- // Interceptor Config attributes
+ // Server Synchronization Tolerance Config
+ public static final String CLOCK_SKEW = "ClockSkew";
+ public static final String PROXY_CONTEXT_PATH = "ProxyContextPath";
+ public static final String WEB_CONTEXT_ROOT = "WebContextRoot";
+
+ /**
+ * Interceptor Config attributes
+ */
public static class Interceptor {
- public final static String ROOT = "Interceptors";
- public final static String INTERCEPTOR = "Interceptor";
- public final static String TYPE = "type";
- public final static String NAME = "name";
- public final static String ORDER = "order";
- public final static String ENABLE = "enable";
- public final static String PROPERTY = "Property";
- public final static String PROPERTY_NAME = "name";
+ public static final String ROOT = "Interceptors";
+ public static final String INTERCEPTOR = "Interceptor";
+ public static final String TYPE = "type";
+ public static final String NAME = "name";
+ public static final String ORDER = "order";
+ public static final String ENABLE = "enable";
+ public static final String PROPERTY = "Property";
+ public static final String PROPERTY_NAME = "name";
}
- // Cache Config attributes
+ /**
+ * Cache Config attributes
+ */
public static class Cache {
- public final static String ROOT = "CacheConfig";
- public final static String MANAGER = "CacheManager";
- public final static String MANAGER_NAME = "name";
- public final static String CACHE = "Cache";
- public final static String NAME = "name";
- public final static String ENABLE = "enable";
- public final static String TIMEOUT = "timeout";
- public final static String CAPACITY = "capacity";
+ public static final String ROOT = "CacheConfig";
+ public static final String MANAGER = "CacheManager";
+ public static final String MANAGER_NAME = "name";
+ public static final String CACHE = "Cache";
+ public static final String NAME = "name";
+ public static final String ENABLE = "enable";
+ public static final String TIMEOUT = "timeout";
+ public static final String CAPACITY = "capacity";
}
- // Cookie Config attributes
+ /**
+ * Cookie Config attributes
+ */
public static class Cookie {
- public final static String ROOT = "Cookies";
- public final static String COOKIE = "Cookie";
- public final static String NAME = "name";
- public final static String DOMAIN = "domain";
- public final static String COMMENT = "comment";
- public final static String VERSION = "version";
- public final static String PATH = "path";
- public final static String MAX_AGE = "maxAge";
- public final static String SECURE = "secure";
- public final static String HTTP_ONLY = "httpOnly";
+ public static final String ROOT = "Cookies";
+ public static final String COOKIE = "Cookie";
+ public static final String NAME = "name";
+ public static final String DOMAIN = "domain";
+ public static final String COMMENT = "comment";
+ public static final String VERSION = "version";
+ public static final String PATH = "path";
+ public static final String MAX_AGE = "maxAge";
+ public static final String SECURE = "secure";
+ public static final String HTTP_ONLY = "httpOnly";
}
- // Server Synchronization Tolerance Config
- public static final String CLOCK_SKEW = "ClockSkew";
-
+ /**
+ * Carbon place holders
+ */
public static class CarbonPlaceholders {
public static final String CARBON_HOST = "${carbon.host}";
@@ -99,6 +130,9 @@ public static class CarbonPlaceholders {
public static final String CARBON_PORT_HTTPS_PROPERTY = "mgt.transport.https.port";
}
+ /**
+ * Config elements.
+ */
public static class ConfigElements {
public static final String PROPERTIES = "Properties";
@@ -114,29 +148,16 @@ private ConfigElements() {
}
- public static final String PROXY_CONTEXT_PATH = "ProxyContextPath";
- public static final String WEB_CONTEXT_ROOT = "WebContextRoot";
-
}
- // HTTP headers which may contain IP address of the client in the order of priority
- public static final String[] HEADERS_WITH_IP = {
- "X-Forwarded-For",
- "Proxy-Client-IP",
- "WL-Proxy-Client-IP",
- "HTTP_X_FORWARDED_FOR",
- "HTTP_X_FORWARDED",
- "HTTP_X_CLUSTER_CLIENT_IP",
- "HTTP_CLIENT_IP",
- "HTTP_FORWARDED_FOR",
- "HTTP_FORWARDED",
- "HTTP_VIA",
- "REMOTE_ADDR"
- };
-
-
+ /**
+ * XML
+ */
public static class XML {
+ /**
+ * Signature algorithms.
+ */
public static class SignatureAlgorithm {
public static final String DSA_SHA1 = "DSA with SHA1";
public static final String ECDSA_SHA1 = "ECDSA with SHA1";
@@ -151,6 +172,9 @@ public static class SignatureAlgorithm {
public static final String RSA_SHA512 = "RSA with SHA512";
}
+ /**
+ * Signature algorithm URIs.
+ */
public static class SignatureAlgorithmURI {
public static final String DSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
public static final String ECDSA_SHA1 = "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1";
@@ -165,6 +189,9 @@ public static class SignatureAlgorithmURI {
public static final String RSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
}
+ /**
+ * Digest algorithm.
+ */
public static class DigestAlgorithm {
public static final String MD5 = "MD5";
public static final String RIPEMD160 = "RIPEMD160";
@@ -174,6 +201,9 @@ public static class DigestAlgorithm {
public static final String SHA512 = "SHA512";
}
+ /**
+ * Digest algorithm URIs.
+ */
public static class DigestAlgorithmURI {
public static final String MD5 = "http://www.w3.org/2001/04/xmldsig-more#md5";
public static final String RIPEMD160 = "http://www.w3.org/2001/04/xmlenc#ripemd160";
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/AbstractCacheEntryListener.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/AbstractCacheEntryListener.java
index 4061b30..6e7a3f6 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/AbstractCacheEntryListener.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/AbstractCacheEntryListener.java
@@ -1,30 +1,33 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.cache;
import org.apache.commons.lang3.StringUtils;
-import org.wso2.carbon.identity.common.util.IdentityUtils;
import org.wso2.carbon.identity.common.internal.handler.HandlerConfig;
import org.wso2.carbon.identity.common.internal.handler.HandlerConfigKey;
+import org.wso2.carbon.identity.common.util.IdentityUtils;
import javax.cache.event.CacheEntryListener;
+/**
+ * Abstract Cache Entry Listener.
+ * @param
+ * @param
+ */
public abstract class AbstractCacheEntryListener implements CacheEntryListener {
/**
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/BaseCache.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/BaseCache.java
index 6d5d0e5..2bea66e 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/BaseCache.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/BaseCache.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.cache;
@@ -21,24 +19,27 @@
//import org.wso2.carbon.caching.impl.CacheImpl;
//import org.wso2.carbon.caching.impl.CachingConstants;
-import org.wso2.carbon.identity.common.util.IdentityUtils;
import org.wso2.carbon.identity.common.internal.cache.CacheConfig;
import org.wso2.carbon.identity.common.internal.cache.CacheConfigKey;
+import org.wso2.carbon.identity.common.util.IdentityUtils;
-import javax.cache.Cache;
-//import javax.cache.CacheBuilder;
-//import javax.cache.CacheConfiguration;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import javax.cache.Cache;
+
+//import javax.cache.CacheBuilder;
+//import javax.cache.CacheConfiguration;
/**
* A base class for all cache implementations in Identity Application Management modules.
+ * @param
+ * @param
*/
public class BaseCache {
private static final String CACHE_MANAGER_NAME = "IdentityApplicationManagementCacheManager";
-// private CacheBuilder cacheBuilder;
+ // private CacheBuilder cacheBuilder;
private String cacheName;
private List cacheListeners = new ArrayList();
@@ -123,7 +124,7 @@ public V get(K key) {
return null;
}
- if(key == null) {
+ if (key == null) {
return null;
}
@@ -164,12 +165,13 @@ public void clear() {
}
}
- public void addListener(AbstractCacheEntryListener listener){
+ public void addListener(AbstractCacheEntryListener listener) {
cacheListeners.add(listener);
}
public boolean isEnabled() {
- CacheConfig cacheConfig = IdentityUtils.getInstance().getCacheConfig().get(new CacheConfigKey(CACHE_MANAGER_NAME, cacheName));
+ CacheConfig cacheConfig = IdentityUtils.getInstance().getCacheConfig().get(new CacheConfigKey
+ (CACHE_MANAGER_NAME, cacheName));
if (cacheConfig != null) {
return cacheConfig.isEnabled();
}
@@ -177,7 +179,8 @@ public boolean isEnabled() {
}
public int getCacheTimeout() {
- CacheConfig cacheConfig = IdentityUtils.getInstance().getCacheConfig().get(new CacheConfigKey(CACHE_MANAGER_NAME, cacheName));
+ CacheConfig cacheConfig = IdentityUtils.getInstance().getCacheConfig().get(new CacheConfigKey
+ (CACHE_MANAGER_NAME, cacheName));
if (cacheConfig != null && cacheConfig.getTimeout() > 0) {
return cacheConfig.getTimeout();
}
@@ -185,7 +188,8 @@ public int getCacheTimeout() {
}
public int getCapacity() {
- CacheConfig cacheConfig = IdentityUtils.getInstance().getCacheConfig().get(new CacheConfigKey(CACHE_MANAGER_NAME, cacheName));
+ CacheConfig cacheConfig = IdentityUtils.getInstance().getCacheConfig().get(new CacheConfigKey
+ (CACHE_MANAGER_NAME, cacheName));
if (cacheConfig != null && cacheConfig.getCapacity() > 0) {
return cacheConfig.getCapacity();
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/CacheEntry.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/CacheEntry.java
index d0d6a4e..715a011 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/CacheEntry.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/CacheEntry.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.cache;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/CacheKey.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/CacheKey.java
index 1ab217e..36de0ed 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/CacheKey.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/cache/CacheKey.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.cache;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/exception/IdentityException.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/exception/IdentityException.java
index 310f228..1553a4a 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/exception/IdentityException.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/exception/IdentityException.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.exception;
@@ -34,10 +32,81 @@ public class IdentityException extends Exception {
protected List errorInfoList = new ArrayList();
+ protected IdentityException(String errorDescription) {
+ super(errorDescription);
+ }
+
+ protected IdentityException(String errorDescription, Throwable cause) {
+ super(errorDescription, cause);
+ }
+
+ // This method may be used for easily migrating existing usages of IdentityException creation.
+ // However once we migrate all the usages of IdentityException to create using error(ErrorInfo) we can remove this
+ @Deprecated
+ public static IdentityException error(String errorDescription) {
+ IdentityException identityException = new IdentityException(errorDescription);
+ ErrorInfo.ErrorInfoBuilder errorInfoBuilder = new ErrorInfo.ErrorInfoBuilder(errorDescription);
+ identityException.addErrorInfo(errorInfoBuilder.build());
+ return identityException;
+ }
+
+ // This method may be used for easily migrating existing usages of IdentityException creation.
+ // However once we migrate all the usages of IdentityException to create using error(ErrorInfo) we can remove this
+ @Deprecated
+ public static IdentityException error(String errorDescription, Throwable cause) {
+ IdentityException identityException = new IdentityException(errorDescription, cause);
+ ErrorInfo.ErrorInfoBuilder errorInfoBuilder = new ErrorInfo.ErrorInfoBuilder(errorDescription);
+ errorInfoBuilder.cause(cause);
+ identityException.addErrorInfo(errorInfoBuilder.build());
+ return identityException;
+ }
+
+ public static IdentityException error(ErrorInfo errorInfo) {
+ if (errorInfo == null || StringUtils.isBlank(errorInfo.errorDescription)) {
+ throw new IllegalArgumentException("ErrorInfo object is null or Error Description is blank");
+ }
+ IdentityException identityException = null;
+ if (errorInfo.getCause() != null) {
+ identityException = new IdentityException(errorInfo.getErrorDescription(), errorInfo.getCause());
+ } else {
+ identityException = new IdentityException(errorInfo.getErrorDescription());
+ }
+ identityException.addErrorInfo(errorInfo);
+ return identityException;
+ }
+
+ public void addErrorInfo(ErrorInfo errorInfo) {
+ if (errorInfo == null || StringUtils.isBlank(errorInfo.errorDescription)) {
+ throw new IllegalArgumentException("ErrorInfo object is null or Error Description is blank");
+ }
+ this.errorInfoList.add(errorInfo);
+ }
+
+ public List getErrorInfoList() {
+ return errorInfoList;
+ }
+
+ public String getCode() {
+
+ StringBuilder builder = new StringBuilder();
+ for (int i = this.errorInfoList.size() - 1; i >= 0; i--) {
+ ErrorInfo info = this.errorInfoList.get(i);
+ builder.append('[');
+ builder.append(info.contextId);
+ builder.append(':');
+ builder.append(info.errorCode);
+ builder.append(']');
+ }
+ return builder.toString();
+ }
+
+ /**
+ * Error Info
+ */
public static class ErrorInfo {
private String contextId = null;
- private String errorCode = null;
+ private String errorCode = null;
private String errorDescription = null;
private String userErrorDescription = null;
private Throwable cause = null;
@@ -75,7 +144,7 @@ public Throwable getCause() {
return cause;
}
- public Map getParameters() {
+ public Map getParameters() {
return this.parameters;
}
@@ -83,10 +152,13 @@ public Object getParameter(String key) {
return this.parameters.get(key);
}
+ /**
+ * Error Info Builder
+ */
public static class ErrorInfoBuilder {
private String contextId = null;
- private String errorCode = null;
+ private String errorCode = null;
private String errorDescription = null;
private String userErrorDescription = null;
private Throwable cause = null;
@@ -116,7 +188,7 @@ public ErrorInfoBuilder cause(Throwable cause) {
return this;
}
- public ErrorInfoBuilder parameters(Map parameters) {
+ public ErrorInfoBuilder parameters(Map parameters) {
// if(MapUtils.isNotEmpty(parameters)) {
// this.parameters = parameters;
// }
@@ -124,83 +196,15 @@ public ErrorInfoBuilder parameters(Map parameters) {
}
public ErrorInfoBuilder parameter(String key, Object value) {
- if(key != null){
+ if (key != null) {
this.parameters.put(key, value);
}
return this;
}
- public ErrorInfo build(){
+ public ErrorInfo build() {
return new ErrorInfo(this);
}
}
}
-
- protected IdentityException(String errorDescription) {
- super(errorDescription);
- }
-
- protected IdentityException(String errorDescription, Throwable cause) {
- super(errorDescription, cause);
- }
-
- // This method may be used for easily migrating existing usages of IdentityException creation.
- // However once we migrate all the usages of IdentityException to create using error(ErrorInfo) we can remove this
- @Deprecated
- public static IdentityException error(String errorDescription) {
- IdentityException identityException = new IdentityException(errorDescription);
- ErrorInfo.ErrorInfoBuilder errorInfoBuilder = new ErrorInfo.ErrorInfoBuilder(errorDescription);
- identityException.addErrorInfo(errorInfoBuilder.build());
- return identityException;
- }
-
- // This method may be used for easily migrating existing usages of IdentityException creation.
- // However once we migrate all the usages of IdentityException to create using error(ErrorInfo) we can remove this
- @Deprecated
- public static IdentityException error(String errorDescription, Throwable cause) {
- IdentityException identityException = new IdentityException(errorDescription, cause);
- ErrorInfo.ErrorInfoBuilder errorInfoBuilder = new ErrorInfo.ErrorInfoBuilder(errorDescription);
- errorInfoBuilder.cause(cause);
- identityException.addErrorInfo(errorInfoBuilder.build());
- return identityException;
- }
-
- public static IdentityException error(ErrorInfo errorInfo) {
- if(errorInfo == null || StringUtils.isBlank(errorInfo.errorDescription)){
- throw new IllegalArgumentException("ErrorInfo object is null or Error Description is blank");
- }
- IdentityException identityException = null;
- if(errorInfo.getCause() != null) {
- identityException = new IdentityException(errorInfo.getErrorDescription(), errorInfo.getCause());
- } else {
- identityException = new IdentityException(errorInfo.getErrorDescription());
- }
- identityException.addErrorInfo(errorInfo);
- return identityException;
- }
-
- public void addErrorInfo(ErrorInfo errorInfo) {
- if(errorInfo == null || StringUtils.isBlank(errorInfo.errorDescription)){
- throw new IllegalArgumentException("ErrorInfo object is null or Error Description is blank");
- }
- this.errorInfoList.add(errorInfo);
- }
-
- public List getErrorInfoList() {
- return errorInfoList;
- }
-
- public String getCode() {
-
- StringBuilder builder = new StringBuilder();
- for(int i = this.errorInfoList.size() - 1; i >= 0; i--) {
- ErrorInfo info = this.errorInfoList.get(i);
- builder.append('[');
- builder.append(info.contextId);
- builder.append(':');
- builder.append(info.errorCode);
- builder.append(']');
- }
- return builder.toString();
- }
-}
\ No newline at end of file
+}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/exception/IdentityRuntimeException.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/exception/IdentityRuntimeException.java
index 8367bed..7e26d9c 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/exception/IdentityRuntimeException.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/exception/IdentityRuntimeException.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.exception;
@@ -34,108 +32,6 @@ public class IdentityRuntimeException extends RuntimeException {
private List errorInfoList = new ArrayList();
- public static class ErrorInfo {
-
- private String contextId = null;
- private String errorCode = null;
- private String errorDescription = null;
- private String userErrorDescription = null;
- private Throwable cause = null;
- private Map parameters = new HashMap<>();
-
- private ErrorInfo(ErrorInfoBuilder builder) {
-
- this.contextId = builder.contextId;
- this.errorCode = builder.errorCode;
- this.userErrorDescription = builder.userErrorDescription;
- this.errorDescription = builder.errorDescription;
-// if(MapUtils.isNotEmpty(builder.parameters)){
-// this.parameters = builder.parameters;
-// }
- this.cause = builder.cause;
- }
-
- public String getContextId() {
- return contextId;
- }
-
- public String getErrorCode() {
- return errorCode;
- }
-
- public String getErrorDescription() {
- return errorDescription;
- }
-
- public String getUserErrorDescription() {
- return userErrorDescription;
- }
-
- public Throwable getCause() {
- return cause;
- }
-
- public Map getParameters() {
- return this.parameters;
- }
-
- public Object getParameter(String key) {
- return this.parameters.get(key);
- }
-
- public static class ErrorInfoBuilder {
-
- private String contextId = null;
- private String errorCode = null;
- private String errorDescription = null;
- private String userErrorDescription = null;
- private Throwable cause = null;
- private Map parameters = new HashMap<>();
-
- public ErrorInfoBuilder(String errorDescription) {
- this.errorDescription = errorDescription;
- }
-
- public ErrorInfoBuilder contextId(String contextId) {
- this.contextId = contextId;
- return this;
- }
-
- public ErrorInfoBuilder errorCode(String errorCode) {
- this.errorCode = errorCode;
- return this;
- }
-
- public ErrorInfoBuilder userErrorDescription(String userErrorDescription) {
- this.userErrorDescription = userErrorDescription;
- return this;
- }
-
- public ErrorInfoBuilder cause(Throwable cause) {
- this.cause = cause;
- return this;
- }
-
- public ErrorInfoBuilder parameters(Map parameters) {
-// if(MapUtils.isNotEmpty(parameters)) {
-// this.parameters = parameters;
-// }
- return this;
- }
-
- public ErrorInfoBuilder parameter(String key, Object value) {
- if(key != null){
- this.parameters.put(key, value);
- }
- return this;
- }
-
- public ErrorInfo build(){
- return new ErrorInfo(this);
- }
- }
- }
-
protected IdentityRuntimeException(String errorDescription) {
super(errorDescription);
}
@@ -145,7 +41,8 @@ protected IdentityRuntimeException(String errorDescription, Throwable cause) {
}
// This method may be used for easily migrating existing usages of IdentityRuntimeException creation.
- // However once we migrate all the usages of IdentityRuntimeException to create using error(ErrorInfo) we can remove this
+ // However once we migrate all the usages of IdentityRuntimeException to create using error(ErrorInfo) we can
+ // remove this
@Deprecated
public static IdentityRuntimeException error(String errorDescription) {
IdentityRuntimeException identityRuntimeException = new IdentityRuntimeException(errorDescription);
@@ -155,7 +52,8 @@ public static IdentityRuntimeException error(String errorDescription) {
}
// This method may be used for easily migrating existing usages of IdentityRuntimeException creation.
- // However once we migrate all the usages of IdentityRuntimeException to create using error(ErrorInfo) we can remove this
+ // However once we migrate all the usages of IdentityRuntimeException to create using error(ErrorInfo) we can
+ // remove this
@Deprecated
public static IdentityRuntimeException error(String errorDescription, Throwable cause) {
IdentityRuntimeException identityRuntimeException = new IdentityRuntimeException(errorDescription, cause);
@@ -166,13 +64,13 @@ public static IdentityRuntimeException error(String errorDescription, Throwable
}
public static IdentityRuntimeException error(ErrorInfo errorInfo) {
- if(errorInfo == null || StringUtils.isBlank(errorInfo.errorDescription)){
+ if (errorInfo == null || StringUtils.isBlank(errorInfo.errorDescription)) {
throw new IllegalArgumentException("ErrorInfo object is null or Error Description is blank");
}
IdentityRuntimeException identityRuntimeException = null;
- if(errorInfo.getCause() != null) {
+ if (errorInfo.getCause() != null) {
identityRuntimeException = new IdentityRuntimeException(errorInfo.getErrorDescription(),
- errorInfo.getCause());
+ errorInfo.getCause());
} else {
identityRuntimeException = new IdentityRuntimeException(errorInfo.getErrorDescription());
}
@@ -181,7 +79,7 @@ public static IdentityRuntimeException error(ErrorInfo errorInfo) {
}
public void addErrorInfo(ErrorInfo errorInfo) {
- if(errorInfo == null || StringUtils.isBlank(errorInfo.errorDescription)){
+ if (errorInfo == null || StringUtils.isBlank(errorInfo.errorDescription)) {
throw new IllegalArgumentException("ErrorInfo object is null or Error Description is blank");
}
this.errorInfoList.add(errorInfo);
@@ -194,7 +92,7 @@ public List getErrorInfoList() {
public String getCode() {
StringBuilder builder = new StringBuilder();
- for(int i = this.errorInfoList.size() - 1; i >= 0; i--) {
+ for (int i = this.errorInfoList.size() - 1; i >= 0; i--) {
ErrorInfo info = this.errorInfoList.get(i);
builder.append('[');
builder.append(info.contextId);
@@ -212,7 +110,7 @@ public String toString() {
builder.append('\n');
//append additional context information.
- for(int i = this.errorInfoList.size() - 1; i >= 0; i--) {
+ for (int i = this.errorInfoList.size() - 1; i >= 0; i--) {
ErrorInfo info = this.errorInfoList.get(i);
builder.append('[');
builder.append(info.contextId);
@@ -220,17 +118,17 @@ public String toString() {
builder.append(info.errorCode);
builder.append(']');
builder.append(info.errorDescription);
- if(i > 0) {
+ if (i > 0) {
builder.append('\n');
}
}
//append root causes and text from this exception first.
- if(getMessage() != null) {
+ if (getMessage() != null) {
builder.append('\n');
- if(getCause() == null) {
+ if (getCause() == null) {
builder.append(getMessage());
- } else if(!getMessage().equals(getCause().toString())) {
+ } else if (!getMessage().equals(getCause().toString())) {
builder.append(getMessage());
}
}
@@ -239,11 +137,119 @@ public String toString() {
}
private void appendException(StringBuilder builder, Throwable throwable) {
- if(throwable == null) {
+ if (throwable == null) {
return;
}
appendException(builder, throwable.getCause());
builder.append(throwable.toString());
builder.append('\n');
}
+
+ /**
+ * Error Info
+ */
+ public static class ErrorInfo {
+
+ private String contextId = null;
+ private String errorCode = null;
+ private String errorDescription = null;
+ private String userErrorDescription = null;
+ private Throwable cause = null;
+ private Map parameters = new HashMap<>();
+
+ private ErrorInfo(ErrorInfoBuilder builder) {
+
+ this.contextId = builder.contextId;
+ this.errorCode = builder.errorCode;
+ this.userErrorDescription = builder.userErrorDescription;
+ this.errorDescription = builder.errorDescription;
+// if(MapUtils.isNotEmpty(builder.parameters)){
+// this.parameters = builder.parameters;
+// }
+ this.cause = builder.cause;
+ }
+
+ public String getContextId() {
+ return contextId;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public String getErrorDescription() {
+ return errorDescription;
+ }
+
+ public String getUserErrorDescription() {
+ return userErrorDescription;
+ }
+
+ public Throwable getCause() {
+ return cause;
+ }
+
+ public Map getParameters() {
+ return this.parameters;
+ }
+
+ public Object getParameter(String key) {
+ return this.parameters.get(key);
+ }
+
+ /**
+ * Error Info Builder
+ */
+ public static class ErrorInfoBuilder {
+
+ private String contextId = null;
+ private String errorCode = null;
+ private String errorDescription = null;
+ private String userErrorDescription = null;
+ private Throwable cause = null;
+ private Map parameters = new HashMap<>();
+
+ public ErrorInfoBuilder(String errorDescription) {
+ this.errorDescription = errorDescription;
+ }
+
+ public ErrorInfoBuilder contextId(String contextId) {
+ this.contextId = contextId;
+ return this;
+ }
+
+ public ErrorInfoBuilder errorCode(String errorCode) {
+ this.errorCode = errorCode;
+ return this;
+ }
+
+ public ErrorInfoBuilder userErrorDescription(String userErrorDescription) {
+ this.userErrorDescription = userErrorDescription;
+ return this;
+ }
+
+ public ErrorInfoBuilder cause(Throwable cause) {
+ this.cause = cause;
+ return this;
+ }
+
+ public ErrorInfoBuilder parameters(Map parameters) {
+// if(MapUtils.isNotEmpty(parameters)) {
+// this.parameters = parameters;
+// }
+ return this;
+ }
+
+ public ErrorInfoBuilder parameter(String key, Object value) {
+ if (key != null) {
+ this.parameters.put(key, value);
+ }
+ return this;
+ }
+
+ public ErrorInfo build() {
+ return new ErrorInfo(this);
+ }
+ }
+ }
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/AbstractHandler.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/AbstractHandler.java
index 42651d8..2e30af0 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/AbstractHandler.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/AbstractHandler.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
@@ -21,13 +19,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.common.base.Constants;
-import org.wso2.carbon.identity.common.util.IdentityUtils;
import org.wso2.carbon.identity.common.internal.handler.HandlerConfig;
import org.wso2.carbon.identity.common.internal.handler.HandlerConfigKey;
+import org.wso2.carbon.identity.common.util.IdentityUtils;
import java.util.Map;
import java.util.Properties;
+/**
+ * Abstract handler.
+ */
public abstract class AbstractHandler implements Handler {
private static Logger logger = LoggerFactory.getLogger(AbstractHandler.class);
@@ -48,11 +49,11 @@ public void init(InitConfig initConfig) {
return;
}
- if(identityEventListenerConfig.getProperties() != null) {
- for(Map.Entry property:identityEventListenerConfig.getProperties().entrySet()) {
- String key = (String)property.getKey();
- String value = (String)property.getValue();
- if(!properties.containsKey(key)) {
+ if (identityEventListenerConfig.getProperties() != null) {
+ for (Map.Entry property : identityEventListenerConfig.getProperties().entrySet()) {
+ String key = (String) property.getKey();
+ String value = (String) property.getValue();
+ if (!properties.containsKey(key)) {
properties.setProperty(key, value);
} else {
logger.warn("Property key " + key + " already exists. Cannot add property!!");
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/AbstractMessageHandler.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/AbstractMessageHandler.java
index a2dd77d..37d0f0c 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/AbstractMessageHandler.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/AbstractMessageHandler.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
@@ -22,13 +20,16 @@
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.common.base.Constants;
import org.wso2.carbon.identity.common.base.message.MessageContext;
-import org.wso2.carbon.identity.common.util.IdentityUtils;
import org.wso2.carbon.identity.common.internal.handler.HandlerConfig;
import org.wso2.carbon.identity.common.internal.handler.HandlerConfigKey;
+import org.wso2.carbon.identity.common.util.IdentityUtils;
import java.util.Map;
import java.util.Properties;
+/**
+ * Abstract message handler.
+ */
public abstract class AbstractMessageHandler implements MessageHandler {
private static Logger logger = LoggerFactory.getLogger(AbstractMessageHandler.class);
@@ -48,11 +49,11 @@ public void init(InitConfig initConfig) {
return;
}
- if(identityEventListenerConfig.getProperties() != null) {
- for(Map.Entry property:identityEventListenerConfig.getProperties().entrySet()) {
- String key = (String)property.getKey();
- String value = (String)property.getValue();
- if(!properties.containsKey(key)) {
+ if (identityEventListenerConfig.getProperties() != null) {
+ for (Map.Entry property : identityEventListenerConfig.getProperties().entrySet()) {
+ String key = (String) property.getKey();
+ String value = (String) property.getValue();
+ if (!properties.containsKey(key)) {
properties.setProperty(key, value);
} else {
logger.warn("Property key " + key + " already exists. Cannot add property!!");
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtHandlerReturnStatus.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtHandlerReturnStatus.java
index 85345f0..d064c3b 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtHandlerReturnStatus.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtHandlerReturnStatus.java
@@ -1,24 +1,22 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
-/*
+/**
* Return value from extension handlers. Used to control the invocation of handler chain.
*/
public enum ExtHandlerReturnStatus {
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtensionHandler.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtensionHandler.java
index 3527858..a2067c7 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtensionHandler.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtensionHandler.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtensionMessageHandler.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtensionMessageHandler.java
index 4bdb63c..b8131cc 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtensionMessageHandler.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/ExtensionMessageHandler.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/Handler.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/Handler.java
index 975cdbb..60a4d9a 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/Handler.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/Handler.java
@@ -1,28 +1,28 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
+/**
+ * Handler interface.
+ */
public interface Handler {
/**
* Initializes the handler
- *
*/
public void init(InitConfig initConfig);
@@ -36,7 +36,6 @@ public interface Handler {
/**
* Tells if the handler is enabled or not. Based on the result {@Code canHandle()} and {@code handle()} may be
* called.
- *
*/
public boolean isEnabled();
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/HandlerComparator.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/HandlerComparator.java
index e36695a..e010fe6 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/HandlerComparator.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/HandlerComparator.java
@@ -1,31 +1,29 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
import java.util.Comparator;
-/*
+/**
* Comparator for sorting handler collection
*/
public class HandlerComparator implements Comparator {
- public HandlerComparator(){
+ public HandlerComparator() {
}
@Override
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/HandlerManager.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/HandlerManager.java
index 607658c..f6db6e9 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/HandlerManager.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/HandlerManager.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
@@ -36,15 +34,15 @@ public class HandlerManager {
private static Logger logger = LoggerFactory.getLogger(AbstractMessageHandler.class);
private static HandlerManager handlerManager = new HandlerManager();
- private HandlerManager(){
+ private HandlerManager() {
}
- public static HandlerManager getInstance(){
- if(logger.isDebugEnabled()){
+ public static HandlerManager getInstance() {
+ if (logger.isDebugEnabled()) {
logger.debug("Created singleton instance for " + HandlerManager.class.getName());
}
- return HandlerManager.handlerManager ;
+ return HandlerManager.handlerManager;
}
/**
@@ -56,11 +54,11 @@ public static HandlerManager getInstance(){
*/
public T getFirstPriorityHandler(List identityHandlers,
boolean isEnableHandlersOnly) {
- if(logger.isDebugEnabled()){
+ if (logger.isDebugEnabled()) {
logger.debug("Get first priority handler for the given handler list.");
}
- if(identityHandlers == null || identityHandlers.isEmpty()){
- return null ;
+ if (identityHandlers == null || identityHandlers.isEmpty()) {
+ return null;
}
T identityHandler = null;
@@ -77,9 +75,9 @@ public T getFirstPriorityHandler(List identityHandlers,
break;
}
}
- if(logger.isDebugEnabled()){
+ if (logger.isDebugEnabled()) {
logger.debug("Get first priority handler : " + identityHandler.getName() + "(" +
- identityHandler.getClass().getName() + ")");
+ identityHandler.getClass().getName() + ")");
}
return identityHandler;
}
@@ -93,11 +91,11 @@ public T getFirstPriorityHandler(List identityHandlers,
*/
public List sortHandlers(List identityHandlers,
boolean isEnableHandlersOnly) {
- if(logger.isDebugEnabled()){
+ if (logger.isDebugEnabled()) {
logger.debug("Sort the handler list.");
}
- if(identityHandlers == null || identityHandlers.isEmpty()){
- return new ArrayList() ;
+ if (identityHandlers == null || identityHandlers.isEmpty()) {
+ return new ArrayList();
}
List identityHandlersList = identityHandlers;
sort(identityHandlersList, new HandlerComparator());
@@ -121,12 +119,12 @@ public List sortHandlers(List identityHandlers,
* @return IdentityMessageHandler
*/
public T1
- getFirstPriorityHandler(List identityMessageHandlers, boolean isEnableHandlersOnly, T2 messageContext) {
- if(logger.isDebugEnabled()){
+ getFirstPriorityHandler(List identityMessageHandlers, boolean isEnableHandlersOnly, T2 messageContext) {
+ if (logger.isDebugEnabled()) {
logger.debug("Get first priority handler for the given handler list and the context");
}
- if(identityMessageHandlers == null || identityMessageHandlers.isEmpty()){
- return null ;
+ if (identityMessageHandlers == null || identityMessageHandlers.isEmpty()) {
+ return null;
}
T1 identityMessageHandler = null;
@@ -147,9 +145,9 @@ public List sortHandlers(List identityHandlers,
}
}
}
- if(logger.isDebugEnabled()){
+ if (logger.isDebugEnabled()) {
logger.debug("Get first priority handler : " + identityMessageHandler.getName() + "(" +
- identityMessageHandler.getClass().getName() + ")");
+ identityMessageHandler.getClass().getName() + ")");
}
return identityMessageHandler;
}
@@ -164,13 +162,13 @@ public List sortHandlers(List identityHandlers,
* @return List
*/
public List sortHandlers
- (List identityMessageHandlers, boolean isEnableHandlersOnly, T2 messageContext) {
+ (List identityMessageHandlers, boolean isEnableHandlersOnly, T2 messageContext) {
- if(logger.isDebugEnabled()){
+ if (logger.isDebugEnabled()) {
logger.debug("Sort the handler list with the context.");
}
- if(identityMessageHandlers == null || identityMessageHandlers.isEmpty()){
- return new ArrayList() ;
+ if (identityMessageHandlers == null || identityMessageHandlers.isEmpty()) {
+ return new ArrayList();
}
List identityMessageHandlerList = identityMessageHandlers;
sort(identityMessageHandlerList, new MessageHandlerComparator(messageContext));
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/InitConfig.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/InitConfig.java
index 92c09e4..763922f 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/InitConfig.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/InitConfig.java
@@ -1,22 +1,23 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
+/**
+ * Init config.
+ */
public class InitConfig {
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/MessageHandler.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/MessageHandler.java
index 6022010..a959357 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/MessageHandler.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/MessageHandler.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
@@ -27,7 +25,6 @@ public interface MessageHandler {
/**
* Initializes the handler
- *
*/
public void init(InitConfig initConfig);
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/MessageHandlerComparator.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/MessageHandlerComparator.java
index a14fe05..88e67db 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/MessageHandlerComparator.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/MessageHandlerComparator.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
@@ -22,18 +20,18 @@
import java.util.Comparator;
-/*
+/**
* Comparator for sorting message handler collection
*/
public class MessageHandlerComparator implements Comparator {
private MessageContext messageContext = null;
- public MessageHandlerComparator(MessageContext messageContext){
+ public MessageHandlerComparator(MessageContext messageContext) {
this.messageContext = messageContext;
}
- public MessageHandlerComparator(){
+ public MessageHandlerComparator() {
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/PostProcessHandler.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/PostProcessHandler.java
index 1a19bba..50c4895 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/PostProcessHandler.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/PostProcessHandler.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/PreProcessHandler.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/PreProcessHandler.java
index f64d63c..0df220f 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/PreProcessHandler.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/handler/PreProcessHandler.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.handler;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/message/MessageContext.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/message/MessageContext.java
index 4b4e25f..a404ff1 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/message/MessageContext.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/base/message/MessageContext.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.base.message;
@@ -24,11 +22,16 @@
import java.util.HashMap;
import java.util.Map;
-public abstract class MessageContext {
+/**
+ * Message context.
+ * @param
+ * @param
+ */
+public abstract class MessageContext {
- protected Map parameters = new HashMap();
+ protected Map parameters = new HashMap();
- public MessageContext(Map parameters){
+ public MessageContext(Map parameters) {
// if(parameters != null || MapUtils.isNotEmpty(parameters)) {
// this.parameters = parameters;
// }
@@ -37,28 +40,29 @@ public MessageContext(Map parameters){
public MessageContext() {
}
- public void addParameter(T1 key, T2 value){
- if(this.parameters.containsKey(key)) {
+ public void addParameter(T1 key, T2 value) {
+ if (this.parameters.containsKey(key)) {
throw IdentityRuntimeException.error("Parameters map trying to override existing key " +
- key);
+ key);
}
parameters.put(key, value);
}
- public void addParameters(Map parameters){
- for (Map.Entry parameter : parameters.entrySet()) {
- if(this.parameters.containsKey(parameter.getKey())) {
- throw IdentityRuntimeException.error("Parameters map trying to override existing key " + parameter.getKey());
+ public void addParameters(Map parameters) {
+ for (Map.Entry parameter : parameters.entrySet()) {
+ if (this.parameters.containsKey(parameter.getKey())) {
+ throw IdentityRuntimeException.error("Parameters map trying to override existing key " + parameter
+ .getKey());
}
parameters.put(parameter.getKey(), parameter.getValue());
}
}
- public Map getParameters(){
+ public Map getParameters() {
return Collections.unmodifiableMap(parameters);
}
- public T2 getParameter(T1 key){
+ public T2 getParameter(T1 key) {
return parameters.get(key);
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityCommonDataHolder.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityCommonDataHolder.java
index a38b013..c6cbf83 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityCommonDataHolder.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityCommonDataHolder.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal;
@@ -22,21 +20,23 @@
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.common.internal.cache.CacheConfig;
import org.wso2.carbon.identity.common.internal.cache.CacheConfigKey;
-import org.wso2.carbon.identity.common.internal.handler.HandlerConfig;
-import org.wso2.carbon.identity.common.internal.handler.HandlerConfigKey;
import org.wso2.carbon.identity.common.internal.config.ConfigParser;
import org.wso2.carbon.identity.common.internal.cookie.CookieConfig;
import org.wso2.carbon.identity.common.internal.cookie.CookieConfigKey;
+import org.wso2.carbon.identity.common.internal.handler.HandlerConfig;
+import org.wso2.carbon.identity.common.internal.handler.HandlerConfigKey;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.ExecutorService;
+/**
+ * Identity Common Data Holder
+ */
public class IdentityCommonDataHolder {
private static Logger logger = LoggerFactory.getLogger(ConfigParser.class);
- private static IdentityCommonDataHolder instance;
+ private static IdentityCommonDataHolder instance = new IdentityCommonDataHolder();
private Map handlerConfig = new HashMap();
private Map cacheConfig = new HashMap();
private Map cookieConfig = new HashMap();
@@ -46,38 +46,31 @@ private IdentityCommonDataHolder() {
}
public static IdentityCommonDataHolder getInstance() {
- if(instance == null) {
- synchronized (IdentityCommonDataHolder.class) {
- if (instance == null) {
- instance = new IdentityCommonDataHolder();
- }
- }
- }
return instance;
}
- public void setHandlerConfig(Map handlerConfig) {
- this.handlerConfig = handlerConfig;
- }
-
- public void setCacheConfig(Map cacheConfig) {
- this.cacheConfig = cacheConfig;
- }
-
- public void setCookieConfig(Map cookieConfig) {
- this.cookieConfig = cookieConfig;
- }
-
public Map getHandlerConfig() {
return handlerConfig;
}
+ public void setHandlerConfig(Map handlerConfig) {
+ this.handlerConfig = handlerConfig;
+ }
+
public Map getCacheConfig() {
return cacheConfig;
}
+ public void setCacheConfig(Map cacheConfig) {
+ this.cacheConfig = cacheConfig;
+ }
+
public Map getCookieConfig() {
return cookieConfig;
}
+ public void setCookieConfig(Map cookieConfig) {
+ this.cookieConfig = cookieConfig;
+ }
+
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityCommonServiceComponent.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityCommonServiceComponent.java
index f5a8fa6..0f5dab5 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityCommonServiceComponent.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityCommonServiceComponent.java
@@ -1,66 +1,52 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.common.util.IdentityUtilService;
-//import org.osgi.framework.BundleContext;
-//import org.osgi.framework.ServiceRegistration;
-//import org.osgi.service.component.ComponentContext;
-//import org.osgi.service.component.annotations.*;
-import java.util.Map;
/**
* Identity provider service component
*/
-/**
- * @scr.component name="identity.event.service"
- * immediate="true"
- * @scr.reference name="event.handler"
- * interface="org.wso2.carbon.identity.event.handler.AbstractEventHandler"
- * cardinality="0..n" policy="dynamic"
- * bind="registerEventHandler" unbind="unRegisterEventHandler"
- */
-//@Component(
-// name = "identity.util.dscomponent",
-// immediate = true)
+
+@Component(
+ name = "identity.util.dscomponent",
+ immediate = true)
public class IdentityCommonServiceComponent {
private static Logger logger = LoggerFactory.getLogger(IdentityCommonServiceComponent.class);
private ServiceRegistration serviceRegistration = null;
- protected void activate(ComponentContext componentContext, BundleContext bundleContext, Map properties) {
+ @Activate
+ protected void activate(ComponentContext componentContext) {
try {
-
// preload configurations
org.wso2.carbon.identity.common.internal.config.ConfigParser.getInstance();
- serviceRegistration = bundleContext.registerService(IdentityUtilService.class.getName(),
- new IdentityUtilServiceImpl(),
- null);
+ serviceRegistration = componentContext.getBundleContext().registerService(IdentityUtilService.class
+ .getName(), new IdentityUtilServiceImpl(), null);
} catch (Throwable e) {
logger.error("Error while initiating IdentityMgtService.", e);
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityUtilServiceImpl.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityUtilServiceImpl.java
index 11ca12f..b5ba65c 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityUtilServiceImpl.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/IdentityUtilServiceImpl.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal;
@@ -21,17 +19,20 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.common.base.exception.IdentityException;
+import org.wso2.carbon.identity.common.util.IdentityUtilService;
+import org.wso2.carbon.identity.common.util.IdentityUtils;
import org.wso2.carbon.identity.common.util.jdbc.JDBCUtils;
+import org.wso2.carbon.identity.common.util.keystore.KeyStoreUtils;
+import org.wso2.carbon.identity.common.util.log.LogUtils;
import org.wso2.carbon.identity.common.util.passwordsafe.PasswordSafeUtils;
import org.wso2.carbon.identity.common.util.stream.StreamUtils;
-import org.wso2.carbon.identity.common.util.keystore.KeyStoreUtils;
import org.wso2.carbon.identity.common.util.url.URLUtils;
import org.wso2.carbon.identity.common.util.validation.ValidationUtils;
import org.wso2.carbon.identity.common.util.xml.XMLUtils;
-import org.wso2.carbon.identity.common.util.log.LogUtils;
-import org.wso2.carbon.identity.common.util.IdentityUtilService;
-import org.wso2.carbon.identity.common.util.IdentityUtils;
+/**
+ * Identity Util Service Implementation.
+ */
public class IdentityUtilServiceImpl implements IdentityUtilService {
private static final Logger logger = LoggerFactory.getLogger(IdentityUtilServiceImpl.class);
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cache/CacheConfig.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cache/CacheConfig.java
index 887a0c5..44bf983 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cache/CacheConfig.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cache/CacheConfig.java
@@ -1,22 +1,23 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.cache;
+/**
+ * Cache Configuration.
+ */
public class CacheConfig {
private CacheConfigKey cacheConfigKey;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cache/CacheConfigKey.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cache/CacheConfigKey.java
index 9be6f68..d57cef9 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cache/CacheConfigKey.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cache/CacheConfigKey.java
@@ -1,22 +1,23 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.cache;
+/**
+ * Cache configuration key.
+ */
public class CacheConfigKey {
private String cacheManagerName;
@@ -29,12 +30,18 @@ public CacheConfigKey(String cacheManagerName, String cacheName) {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
CacheConfigKey that = (CacheConfigKey) o;
- if (!cacheManagerName.equals(that.cacheManagerName)) return false;
+ if (!cacheManagerName.equals(that.cacheManagerName)) {
+ return false;
+ }
return cacheName.equals(that.cacheName);
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/config/ConfigParser.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/config/ConfigParser.java
index efddac7..dc0b5bc 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/config/ConfigParser.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/config/ConfigParser.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.config;
@@ -25,6 +23,9 @@
import java.util.Properties;
+/**
+ * Configuration key.
+ */
public class ConfigParser {
private static Logger logger = LoggerFactory.getLogger(ConfigParser.class);
@@ -91,7 +92,7 @@ private void buildCacheConfig() {
IdentityCommonDataHolder.getInstance().setCacheConfig(null);
}
- private void buildCookieConfig() {
+ private void buildCookieConfig() {
IdentityCommonDataHolder.getInstance().setCookieConfig(null);
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieBuilder.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieBuilder.java
index f66e33f..ffcb04b 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieBuilder.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieBuilder.java
@@ -1,25 +1,24 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.cookie;
-//import javax.servlet.http.Cookie;
-
+/**
+ * Cookie builder.
+ */
public class CookieBuilder {
private String name;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieConfig.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieConfig.java
index 86e7d9a..a7a9de8 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieConfig.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieConfig.java
@@ -1,23 +1,24 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.cookie;
+/**
+ * Cookie configuration
+ */
public class CookieConfig {
private String name;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieConfigKey.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieConfigKey.java
index 5e10695..3997559 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieConfigKey.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/cookie/CookieConfigKey.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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
+ * 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,
@@ -15,6 +15,9 @@
*/
package org.wso2.carbon.identity.common.internal.cookie;
+/**
+ * Cookie configuration key.
+ */
public class CookieConfigKey {
private String name;
@@ -38,12 +41,18 @@ public void setType(String type) {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
CookieConfigKey that = (CookieConfigKey) o;
- if (!domain.equals(that.domain)) return false;
+ if (!domain.equals(that.domain)) {
+ return false;
+ }
return name.equals(that.name);
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/handler/HandlerConfig.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/handler/HandlerConfig.java
index 1313ee4..55a4df1 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/handler/HandlerConfig.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/handler/HandlerConfig.java
@@ -1,25 +1,26 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.handler;
import java.util.Properties;
+/**
+ * Handler Configuration.
+ */
public class HandlerConfig {
private int order;
@@ -32,7 +33,7 @@ public HandlerConfig(String enable, int order, HandlerConfigKey
this.order = order;
this.enable = enable;
this.handlerConfigKey = handlerConfigKey;
- if(properties != null && !properties.isEmpty()) {
+ if (properties != null && !properties.isEmpty()) {
this.properties = properties;
}
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/handler/HandlerConfigKey.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/handler/HandlerConfigKey.java
index 34d0e62..8251dff 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/handler/HandlerConfigKey.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/handler/HandlerConfigKey.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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
+ * 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,
@@ -15,6 +15,9 @@
*/
package org.wso2.carbon.identity.common.internal.handler;
+/**
+ * Handler Config Key.
+ */
public class HandlerConfigKey {
private String type;
@@ -38,12 +41,18 @@ public void setType(String type) {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
HandlerConfigKey that = (HandlerConfigKey) o;
- if (!type.equals(that.type)) return false;
+ if (!type.equals(that.type)) {
+ return false;
+ }
return name.equals(that.name);
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafe.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafe.java
index 85ff588..bd8fef8 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafe.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafe.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.passwordsafe;
@@ -21,24 +19,20 @@
import org.wso2.carbon.identity.common.base.cache.BaseCache;
+/**
+ * Password safe cache.
+ */
public class PasswordSafe extends BaseCache {
private static final String PASSWORD_SAFE_NAME = "PasswordSafe";
- private static volatile PasswordSafe instance;
+ private static volatile PasswordSafe instance = new PasswordSafe();
private PasswordSafe() {
super(PASSWORD_SAFE_NAME);
}
public static PasswordSafe getInstance() {
- if (instance == null) {
- synchronized (PasswordSafe.class) {
- if (instance == null) {
- instance = new PasswordSafe();
- }
- }
- }
return instance;
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafeEntry.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafeEntry.java
index 12eb60a..6c93b3c 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafeEntry.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafeEntry.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.passwordsafe;
@@ -21,6 +19,9 @@
import org.wso2.carbon.identity.common.base.cache.CacheEntry;
import org.wso2.carbon.identity.common.util.passwordsafe.SafePasswordContainer;
+/**
+ * Password safe cache entry.
+ */
public class PasswordSafeEntry extends CacheEntry {
private SafePasswordContainer safePasswordContainer = null;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafeKey.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafeKey.java
index 03aca0a..832dbba 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafeKey.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/passwordsafe/PasswordSafeKey.java
@@ -1,30 +1,31 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.passwordsafe;
import org.wso2.carbon.identity.common.base.cache.CacheKey;
+/**
+ * Password safe cache key.
+ */
public class PasswordSafeKey extends CacheKey {
private String uniqueID = null;
- public PasswordSafeKey(String uniqueID){
+ public PasswordSafeKey(String uniqueID) {
this.uniqueID = uniqueID;
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/validation/ValidationConfig.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/validation/ValidationConfig.java
index e1bea41..94d2574 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/validation/ValidationConfig.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/internal/validation/ValidationConfig.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.internal.validation;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/IdentityUtilService.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/IdentityUtilService.java
index f059a6f..27654c7 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/IdentityUtilService.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/IdentityUtilService.java
@@ -1,25 +1,22 @@
/*
- * Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util;
import org.wso2.carbon.identity.common.base.exception.IdentityException;
-import org.wso2.carbon.identity.common.util.IdentityUtils;
import org.wso2.carbon.identity.common.util.jdbc.JDBCUtils;
import org.wso2.carbon.identity.common.util.keystore.KeyStoreUtils;
import org.wso2.carbon.identity.common.util.log.LogUtils;
@@ -29,6 +26,9 @@
import org.wso2.carbon.identity.common.util.validation.ValidationUtils;
import org.wso2.carbon.identity.common.util.xml.XMLUtils;
+/**
+ * Identity util service.
+ */
public interface IdentityUtilService {
JDBCUtils getJDBCUtils() throws IdentityException;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/IdentityUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/IdentityUtils.java
index be277c1..47871a9 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/IdentityUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/IdentityUtils.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * 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.
+ *
+ * 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 org.wso2.carbon.identity.common.util;
@@ -22,16 +20,14 @@
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.common.base.exception.IdentityRuntimeException;
import org.wso2.carbon.identity.common.internal.IdentityCommonDataHolder;
-import org.wso2.carbon.identity.common.internal.config.ConfigParser;
import org.wso2.carbon.identity.common.internal.cache.CacheConfig;
import org.wso2.carbon.identity.common.internal.cache.CacheConfigKey;
+import org.wso2.carbon.identity.common.internal.config.ConfigParser;
import org.wso2.carbon.identity.common.internal.cookie.CookieConfig;
import org.wso2.carbon.identity.common.internal.cookie.CookieConfigKey;
import org.wso2.carbon.identity.common.internal.handler.HandlerConfig;
import org.wso2.carbon.identity.common.internal.handler.HandlerConfigKey;
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.InvalidKeyException;
@@ -41,29 +37,32 @@
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+/**
+ * Identity utils.
+ */
public class IdentityUtils {
- private static Logger logger = LoggerFactory.getLogger(IdentityUtils.class);
-
- private static volatile IdentityUtils instance = null;
-
- public static final ThreadLocal> threadLocals = new ThreadLocal> () {
+ public static final ThreadLocal> MAP_THREAD_LOCAL = new ThreadLocal>() {
@Override
protected Map initialValue() {
return new HashMap();
}
};
+ private static Logger logger = LoggerFactory.getLogger(IdentityUtils.class);
+ private static volatile IdentityUtils instance = null;
private IdentityUtils() {
ConfigParser.getInstance();
}
public static IdentityUtils getInstance() {
- if(instance == null) {
+ if (instance == null) {
synchronized (IdentityUtils.class) {
- if(instance == null) {
+ if (instance == null) {
instance = new IdentityUtils();
}
}
@@ -71,18 +70,6 @@ public static IdentityUtils getInstance() {
return instance;
}
- public Map getHandlerConfig() {
- return IdentityCommonDataHolder.getInstance().getHandlerConfig();
- }
-
- public Map getCacheConfig() {
- return IdentityCommonDataHolder.getInstance().getCacheConfig();
- }
-
- public Map getCookieConfig() {
- return IdentityCommonDataHolder.getInstance().getCookieConfig();
- }
-
public static String generateHmacSHA1(String secretKey, String baseString) throws SignatureException {
// try {
// SecretKeySpec key = new SecretKeySpec(secretKey.getBytes(), Constants.HMAC_SHA1);
@@ -124,7 +111,6 @@ public static String generateUUID() throws Exception {
/**
* Generates a random number using two UUIDs and HMAC-SHA1
- *
*/
public static String generateRandomNumber() throws IdentityRuntimeException {
try {
@@ -138,7 +124,7 @@ public static String generateRandomNumber() throws IdentityRuntimeException {
String random = null;
// random = new String(Base64.getEncoder().encode(rawHmac));
return random;
- } catch (NoSuchAlgorithmException|InvalidKeyException e) {
+ } catch (NoSuchAlgorithmException | InvalidKeyException e) {
throw IdentityRuntimeException.error("Error occurred while generating random number.", e);
}
}
@@ -167,8 +153,6 @@ public static String getServicePath() {
return null;
}
-
-
/**
* Get the server synchronization tolerance value in seconds
*
@@ -179,8 +163,6 @@ public static int getClockSkewInSeconds() {
return 0;
}
-
-
/**
* Validates an URI.
*
@@ -249,6 +231,18 @@ public static String getTenantDomain(int tenantId) throws IdentityRuntimeExcepti
return null;
}
+ public Map getHandlerConfig() {
+ return IdentityCommonDataHolder.getInstance().getHandlerConfig();
+ }
+
+ public Map getCacheConfig() {
+ return IdentityCommonDataHolder.getInstance().getCacheConfig();
+ }
+
+ public Map getCookieConfig() {
+ return IdentityCommonDataHolder.getInstance().getCookieConfig();
+ }
+
// User store case sensitivity check method must come from RealmService
// Session cleanup period, session cleanup timeout, operation cleanup period and operation cleanup timeout must
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/jdbc/JDBCUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/jdbc/JDBCUtils.java
index 4563450..7faf50c 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/jdbc/JDBCUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/jdbc/JDBCUtils.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.jdbc;
@@ -34,22 +32,16 @@ public class JDBCUtils {
private static final Logger logger = LoggerFactory.getLogger(JDBCUtils.class);
- private static volatile JDBCUtils instance = null;
+ private static volatile JDBCUtils instance = new JDBCUtils();
private JDBCUtils() {
}
public static JDBCUtils getInstance() {
- if(instance == null) {
- synchronized (JDBCUtils.class) {
- if(instance == null) {
- instance = new JDBCUtils();
- }
- }
- }
return instance;
}
+
/**
* Get a database connection instance from the Identity Persistence Manager
*
@@ -72,7 +64,8 @@ public static void closeConnection(Connection dbConnection) {
try {
dbConnection.close();
} catch (SQLException e) {
- logger.error("Database error. Could not close statement. Continuing with others. - " + e.getMessage(), e);
+ logger.error("Database error. Could not close statement. Continuing with others. - " + e.getMessage()
+ , e);
}
}
}
@@ -93,7 +86,8 @@ public static void closeStatement(PreparedStatement preparedStatement) {
try {
preparedStatement.close();
} catch (SQLException e) {
- logger.error("Database error. Could not close statement. Continuing with others. - " + e.getMessage(), e);
+ logger.error("Database error. Could not close statement. Continuing with others. - " + e.getMessage()
+ , e);
}
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/keystore/KeyStoreUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/keystore/KeyStoreUtils.java
index 3e9ab82..83f1f09 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/keystore/KeyStoreUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/keystore/KeyStoreUtils.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.keystore;
@@ -31,6 +29,9 @@
import java.security.cert.X509Certificate;
import java.util.Base64;
+/**
+ * Keystore utils.
+ */
public class KeyStoreUtils {
private static final Logger logger = LoggerFactory.getLogger(KeyStoreUtils.class);
@@ -42,9 +43,9 @@ private KeyStoreUtils() {
}
public static KeyStoreUtils getInstance() {
- if(instance == null) {
+ if (instance == null) {
synchronized (KeyStoreUtils.class) {
- if(instance == null) {
+ if (instance == null) {
instance = new KeyStoreUtils();
}
}
@@ -138,7 +139,7 @@ public static String hexify(byte bytes[]) {
if (bytes != null) {
char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c',
- 'd', 'e', 'f'};
+ 'd', 'e', 'f'};
StringBuilder buf = new StringBuilder(bytes.length * 2);
for (int i = 0; i < bytes.length; ++i) {
buf.append(hexDigits[(bytes[i] & 0xf0) >> 4]);
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/log/LogUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/log/LogUtils.java
index bd0ebe0..0111606 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/log/LogUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/log/LogUtils.java
@@ -1,19 +1,17 @@
/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * 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
*
- * 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.
+ * 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 org.wso2.carbon.identity.common.util.log;
@@ -34,11 +32,10 @@
*/
public class LogUtils {
+ private static final Object lock = new Object();
private static LogUtils logUtils;
private static Map logTokenMap = new HashMap();
private static String filePath;
- private static final Object lock = new Object();
-
private static Logger logger = LoggerFactory.getLogger(LogUtils.class);
private LogUtils() {
@@ -53,6 +50,7 @@ private LogUtils() {
/**
* Instantiate a new instance and get it or get the available instance.
+ *
* @return IdentityLogTokenParser
*/
public static LogUtils getInstance() {
@@ -69,6 +67,7 @@ public static LogUtils getInstance() {
/**
* Check whether the given token value is appropriate to log.
+ *
* @param tokenName Name of the token.
* @return True if token is appropriate to log.
*/
@@ -76,19 +75,11 @@ public static boolean isTokenLoggable(String tokenName) {
return false;
}
- /**
- * Get the properties as a map.
- * @return Map{String String}
- */
- Map getLogTokenMap() {
- return logTokenMap;
- }
-
private static void buildConfiguration() {
if (filePath == null) {
filePath = IdentityUtils.getIdentityConfigDirPath() + File.separator +
- LogTokens.FILE_NAME;
+ LogTokens.FILE_NAME;
}
FileInputStream fileInput = null;
@@ -115,6 +106,18 @@ private static void buildConfiguration() {
}
}
+ /**
+ * Get the properties as a map.
+ *
+ * @return Map{String String}
+ */
+ Map getLogTokenMap() {
+ return logTokenMap;
+ }
+
+ /**
+ * Log tokens.
+ */
public static class LogTokens {
public static final String FILE_NAME = "identity_log_tokens.properties";
@@ -128,4 +131,4 @@ public static class LogTokens {
public static final String SAML_ASSERTION = "SAML_Assertion";
public static final String SAML_REQUEST = "SAML_Request";
}
-}
\ No newline at end of file
+}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/PasswordSafeUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/PasswordSafeUtils.java
index 944b7e1..1b7be29 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/PasswordSafeUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/PasswordSafeUtils.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.passwordsafe;
@@ -30,15 +28,15 @@ public class PasswordSafeUtils {
private static volatile PasswordSafeUtils passwordSafeUtils = null;
- private PasswordSafeUtils(){
+ private PasswordSafeUtils() {
}
- public static PasswordSafeUtils getInstance(){
+ public static PasswordSafeUtils getInstance() {
- if(passwordSafeUtils == null){
- synchronized (SafePassword.class){
- if(passwordSafeUtils == null){
+ if (passwordSafeUtils == null) {
+ synchronized (SafePassword.class) {
+ if (passwordSafeUtils == null) {
passwordSafeUtils = new PasswordSafeUtils();
}
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/SafePassword.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/SafePassword.java
index b4ef41b..56e90aa 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/SafePassword.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/SafePassword.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.passwordsafe;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/SafePasswordContainer.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/SafePasswordContainer.java
index 337bf9f..773a4d9 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/SafePasswordContainer.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/passwordsafe/SafePasswordContainer.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.passwordsafe;
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/stream/StreamUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/stream/StreamUtils.java
index 31d603f..7f4dc53 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/stream/StreamUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/stream/StreamUtils.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.stream;
@@ -27,19 +25,22 @@
import java.io.OutputStream;
import java.io.Reader;
+/**
+ * Stream utils.
+ */
public class StreamUtils {
private static final Logger logger = LoggerFactory.getLogger(StreamUtils.class);
- private static volatile StreamUtils instance = null;
+ private static volatile StreamUtils instance = new StreamUtils();
private StreamUtils() {
}
public static StreamUtils getInstance() {
- if(instance == null) {
+ if (instance == null) {
synchronized (StreamUtils.class) {
- if(instance == null) {
+ if (instance == null) {
instance = new StreamUtils();
}
}
@@ -47,7 +48,7 @@ public static StreamUtils getInstance() {
return instance;
}
- public static void closeAllStreams(InputStream input, OutputStream output){
+ public static void closeAllStreams(InputStream input, OutputStream output) {
closeInputStream(input);
closeOutputStream(output);
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/url/URLUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/url/URLUtils.java
index 29be7ff..12ab2fd 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/url/URLUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/url/URLUtils.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.url;
@@ -28,6 +26,9 @@
import java.nio.charset.StandardCharsets;
import java.util.Map;
+/**
+ * Url utils.
+ */
public class URLUtils {
private static final Logger logger = LoggerFactory.getLogger(URLUtils.class);
@@ -39,9 +40,9 @@ private URLUtils() {
}
public static URLUtils getInstance() {
- if(instance == null) {
+ if (instance == null) {
synchronized (URLUtils.class) {
- if(instance == null) {
+ if (instance == null) {
instance = new URLUtils();
}
}
@@ -59,6 +60,7 @@ public static String getServerURL(String endpoint, boolean addProxyContextPath,
/**
* Replace the placeholders with the related values in the URL.
+ *
* @param urlWithPlaceholders URL with the placeholders.
* @return URL filled with the placeholder values.
*/
@@ -71,6 +73,7 @@ public static String fillURLPlaceholders(String urlWithPlaceholders) {
/**
* Get the host name of the server.
+ *
* @return Hostname
*/
public static String getHostName() {
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/validation/ValidationUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/validation/ValidationUtils.java
index 72df42a..3cfc0c3 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/validation/ValidationUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/validation/ValidationUtils.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you 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
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.validation;
@@ -26,7 +24,6 @@
import org.wso2.carbon.identity.common.base.exception.IdentityException;
import org.wso2.carbon.identity.common.internal.config.ConfigParser;
import org.wso2.carbon.identity.common.internal.validation.ValidationConfig;
-import org.wso2.carbon.identity.common.util.IdentityUtils;
import java.util.HashMap;
import java.util.Map;
@@ -38,6 +35,14 @@
*/
public class ValidationUtils {
+ public static final String DEFAULT_FILE_NAME_REGEX = "^(?!(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\\.[^.]*)?$)" +
+ "[^<>:\"/\\\\|?*\\x00-\\x1F]*[^<>:\"/\\\\|?*\\x00-\\x1F\\ .]$";
+ public static final ThreadLocal> MAP_THREAD_LOCAL = new ThreadLocal>() {
+ @Override
+ protected Map initialValue() {
+ return new HashMap();
+ }
+ };
private static final ValidationConfig validatorConfig = new ValidationConfig();
private static final String msgSection1 = "The provided input ";
private static final String msgSection2 = "does not match any of the white list patterns [ %s ]";
@@ -45,29 +50,23 @@ public class ValidationUtils {
"contains illegal characters matching one of the black list patterns [ %s ]";
private static final String msgSection4 = " or ";
private static final String PATTERN_NOT_REGISTERED = "No regex pattern registered for the provided key : %s";
- public static final String DEFAULT_FILE_NAME_REGEX = "^(?!(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\\.[^.]*)?$)" +
- "[^<>:\"/\\\\|?*\\x00-\\x1F]*[^<>:\"/\\\\|?*\\x00-\\x1F\\ .]$";
-
private static Logger logger = LoggerFactory.getLogger(ValidationUtils.class);
-
private static volatile ValidationUtils instance = null;
- public static final ThreadLocal> threadLocals = new ThreadLocal> () {
-
- @Override
- protected Map initialValue() {
- return new HashMap();
+ static {
+ for (ValidatorPattern pattern : ValidatorPattern.values()) {
+ validatorConfig.addPattern(pattern.name(), pattern.getRegex());
}
- };
+ }
private ValidationUtils() {
ConfigParser.getInstance();
}
public static ValidationUtils getInstance() {
- if(instance == null) {
+ if (instance == null) {
synchronized (ValidationUtils.class) {
- if(instance == null) {
+ if (instance == null) {
instance = new ValidationUtils();
}
}
@@ -75,43 +74,6 @@ public static ValidationUtils getInstance() {
return instance;
}
- /**
- * Defines a predefined set of pattern list
- */
- public static enum ValidatorPattern {
- DIGITS_ONLY("^[0-9]+$"),
- ALPHABETIC_ONLY("^[a-zA-Z]+$"),
- ALPHANUMERICS_ONLY("^[a-zA-Z0-9]+$"),
- URL("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),
- EMAIL("^\\s*?(.+)@(.+?)\\s*$"),
- WHITESPACE_EXISTS(".*\\s+.*"),
- URI_RESERVED_EXISTS(".*[:/\\?#\\[\\]@!\\$&'\\(\\)\\*\\+,;=]+.*"),
- URI_UNSAFE_EXISTS(".*[<>%\\{\\}\\|\\^~\\[\\]`]+.*"),
- HTML_META_EXISTS(".*[&<>\"'/]+.*"),
- XML_META_EXISTS(".*[&<>\"']+.*"),
- REGEX_META_EXISTS(".*[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)\\[\\{]+.*"),
- HTTP_URL("^(http:)([^/?#])?(:)?(([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),
- HTTPS_URL("^(https:)([^/?#])?(:)?(([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),
- FTP_URL("^(ftp:)([^/?#])?(:)?(([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),
- REGISTRY_INVALID_CHARS_EXISTS("[~!@#;%^*()+={}|<>\\\\\"'/,]+");
-
- private String regex;
-
- ValidatorPattern(String regex) {
- this.regex = regex;
- }
-
- public String getRegex() {
- return regex;
- }
- }
-
- static {
- for (ValidatorPattern pattern : ValidatorPattern.values()) {
- validatorConfig.addPattern(pattern.name(), pattern.getRegex());
- }
- }
-
/**
* Validates the provided input against the given white list patterns
*
@@ -324,16 +286,47 @@ public static boolean isBlank(String input) {
}
}
- public static boolean isValidFileName(String fileName){
+ public static boolean isValidFileName(String fileName) {
String fileNameRegEx = null; // read filename regex from identity.yaml
- if(isBlank(fileNameRegEx)){
+ if (isBlank(fileNameRegEx)) {
fileNameRegEx = DEFAULT_FILE_NAME_REGEX;
}
Pattern pattern = Pattern.compile(fileNameRegEx, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE |
- Pattern.COMMENTS);
+ Pattern.COMMENTS);
Matcher matcher = pattern.matcher(fileName);
return matcher.matches();
}
+
+ /**
+ * Defines a predefined set of pattern list
+ */
+ public static enum ValidatorPattern {
+ DIGITS_ONLY("^[0-9]+$"),
+ ALPHABETIC_ONLY("^[a-zA-Z]+$"),
+ ALPHANUMERICS_ONLY("^[a-zA-Z0-9]+$"),
+ URL("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),
+ EMAIL("^\\s*?(.+)@(.+?)\\s*$"),
+ WHITESPACE_EXISTS(".*\\s+.*"),
+ URI_RESERVED_EXISTS(".*[:/\\?#\\[\\]@!\\$&'\\(\\)\\*\\+,;=]+.*"),
+ URI_UNSAFE_EXISTS(".*[<>%\\{\\}\\|\\^~\\[\\]`]+.*"),
+ HTML_META_EXISTS(".*[&<>\"'/]+.*"),
+ XML_META_EXISTS(".*[&<>\"']+.*"),
+ REGEX_META_EXISTS(".*[\\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)\\[\\{]+.*"),
+ HTTP_URL("^(http:)([^/?#])?(:)?(([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),
+ HTTPS_URL("^(https:)([^/?#])?(:)?(([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),
+ FTP_URL("^(ftp:)([^/?#])?(:)?(([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),
+ REGISTRY_INVALID_CHARS_EXISTS("[~!@#;%^*()+={}|<>\\\\\"'/,]+");
+
+ private String regex;
+
+ ValidatorPattern(String regex) {
+ this.regex = regex;
+ }
+
+ public String getRegex() {
+ return regex;
+ }
+ }
}
diff --git a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/xml/XMLUtils.java b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/xml/XMLUtils.java
index 91564c3..8c9a6e3 100644
--- a/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/xml/XMLUtils.java
+++ b/components/org.wso2.carbon.identity.common/src/main/java/org/wso2/carbon/identity/common/util/xml/XMLUtils.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.common.util.xml;
@@ -27,33 +25,29 @@
import org.wso2.carbon.identity.common.base.exception.IdentityException;
import org.xml.sax.SAXException;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-
+/**
+ * XML Utils.
+ */
public class XMLUtils {
private static final Logger logger = LoggerFactory.getLogger(XMLUtils.class);
- private static volatile XMLUtils instance = null;
private static final int ENTITY_EXPANSION_LIMIT = 0;
+ private static volatile XMLUtils instance = new XMLUtils();
private XMLUtils() {
}
public static XMLUtils getInstance() {
- if(instance == null) {
- synchronized (XMLUtils.class) {
- if(instance == null) {
- instance = new XMLUtils();
- }
- }
- }
+
return instance;
}
@@ -62,10 +56,11 @@ public static Element getDocumentElement(String xmlString) throws IdentityExcept
try {
DocumentBuilderFactory documentBuilderFactory = getSecuredDocumentBuilderFactory();
DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
- Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes(StandardCharsets.UTF_8)));
+ Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes(StandardCharsets
+ .UTF_8)));
Element element = document.getDocumentElement();
return element;
- } catch (ParserConfigurationException|SAXException|IOException e) {
+ } catch (ParserConfigurationException | SAXException | IOException e) {
String message = "Error in constructing element from the encoded XML string.";
throw IdentityException.error(message, e);
}
@@ -90,9 +85,9 @@ public static DocumentBuilderFactory getSecuredDocumentBuilderFactory() {
} catch (ParserConfigurationException e) {
logger.error("Failed to load XML Processor Feature " + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE + " or" +
- " " +
- Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE + " or " + Constants.LOAD_EXTERNAL_DTD_FEATURE +
- " or secure-processing." );
+ " " +
+ Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE + " or " + Constants.LOAD_EXTERNAL_DTD_FEATURE +
+ " or secure-processing.");
}
SecurityManager securityManager = new SecurityManager();
diff --git a/components/org.wso2.carbon.identity.event/pom.xml b/components/org.wso2.carbon.identity.event/pom.xml
index b88a62d..87175e9 100644
--- a/components/org.wso2.carbon.identity.event/pom.xml
+++ b/components/org.wso2.carbon.identity.event/pom.xml
@@ -1,20 +1,18 @@
@@ -28,7 +26,7 @@
4.0.0
org.wso2.carbon.identity.event
- jar
+ bundle
WSO2 Carbon - Identity Event
This is a Carbon bundle that represents the Identity Event module.
@@ -97,4 +95,16 @@
+
+ org.wso2.carbon.identity.event.internal
+
+ !org.wso2.carbon.identity.event.internal,
+ org.wso2.carbon.identity.event.*; version="${identity.base.package.export.version}"
+
+
+ org.slf4j.*; version="${slf4j.package.import.version}",
+
+ *
+
+
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/AbstractEventHandler.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/AbstractEventHandler.java
index 28630a2..f0f3da0 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/AbstractEventHandler.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/AbstractEventHandler.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event;
@@ -34,13 +32,12 @@
public abstract class AbstractEventHandler extends AbstractMessageHandler {
- protected ModuleConfig moduleConfig;
-
private static final Logger logger = LoggerFactory.getLogger(AbstractEventHandler.class);
+ protected ModuleConfig moduleConfig;
public boolean canHandle(MessageContext messageContext) throws IdentityRuntimeException {
- Event event = ((EventMessageContext)messageContext).getEvent();
+ Event event = ((EventMessageContext) messageContext).getEvent();
String eventName = event.getEventName();
String moduleName = this.getName();
ConfigParser notificationMgtConfigBuilder = null;
@@ -76,7 +73,7 @@ public boolean isAssociationAsync(String eventName) throws EventException {
}
if (Boolean.parseBoolean(sub.getSubscriptionProperties().getProperty(this
.getName() + ".subscription." + eventName + "" +
- ".operationAsync"))) {
+ ".operationAsync"))) {
return true;
} else {
return false;
@@ -89,7 +86,7 @@ public boolean isAssociationAsync(String eventName) throws EventException {
@Override
public void init(InitConfig configuration) throws IdentityRuntimeException {
- this.moduleConfig = (ModuleConfig)configuration;
+ this.moduleConfig = (ModuleConfig) configuration;
}
}
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventException.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventException.java
index aa2b924..d3084f5 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventException.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventException.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event;
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventMessageContext.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventMessageContext.java
index b754d72..52c12bb 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventMessageContext.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventMessageContext.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * 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 org.wso2.carbon.identity.event;
import org.wso2.carbon.identity.common.base.message.MessageContext;
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventService.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventService.java
index be29b24..fcb90bc 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventService.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/EventService.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event;
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/ConfigParser.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/ConfigParser.java
index aed3860..d80c847 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/ConfigParser.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/ConfigParser.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.internal;
@@ -47,6 +45,7 @@
public class ConfigParser {
private static final Logger logger = LoggerFactory.getLogger(ConfigParser.class);
+ private static ConfigParser notificationMgtConfigBuilder;
/**
* All properties configured in msg-mgt.properties file
*/
@@ -60,8 +59,6 @@ public class ConfigParser {
*/
private String threadPoolSize;
- private static ConfigParser notificationMgtConfigBuilder;
-
/**
* Load properties file and set Module properties
*
@@ -75,7 +72,7 @@ private ConfigParser() throws EventException {
build();
}
- public static ConfigParser getInstance () throws EventException {
+ public static ConfigParser getInstance() throws EventException {
if (notificationMgtConfigBuilder == null) {
return new ConfigParser();
}
@@ -167,7 +164,7 @@ private ModuleConfig buildModuleConfigurations(String moduleName) {
private List buildSubscriptionList(String moduleName, Properties moduleProperties) {
// Get subscribed events
Properties subscriptions = EventUtils.getSubProperties(moduleName + "." +
- "subscription", moduleProperties);
+ "subscription", moduleProperties);
List subscriptionList = new ArrayList();
Enumeration propertyNames = subscriptions.propertyNames();
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/Constants.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/Constants.java
index b73de26..c962038 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/Constants.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/Constants.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.internal;
@@ -23,73 +21,72 @@
*/
public class Constants {
- private Constants(){}
+ private Constants() {
+ }
public class PropertyConfig {
- private PropertyConfig(){}
-
public static final String CONFIG_FILE_NAME = "identity-event.properties";
public static final String ACCOUNT_LOCK_ENABLE = "Account.Lock.Enable";
public static final String AUTH_POLICY_ENABLE = "Authentication.Policy.Enable";
public static final String AUTH_POLICY_ACCOUNT_EXIST = "Authentication.Policy.Check.Account.Exist";
public static final String AUTH_POLICY_ACCOUNT_LOCKING_FAIL_ATTEMPTS = "Authentication.Policy.Account.Lock.On" +
- ".Failure.Max.Attempts";
+ ".Failure.Max.Attempts";
public static final String PASSWORD_POLICY_EXTENSIONS = "Password.policy.extensions";
public static final String EXTENSION_USER_DATA_STORE = "Identity.Mgt.User.Data.Store";
public static final String EXTENSION_USER_RECOVERY_DATA_STORE = "Identity.Mgt.User.Recovery.Data.Store";
public static final String NOTIFICATION_LINK_EXPIRE_TIME = "Notification.Expire.Time";
public static final String ALREADY_WRITTEN_PROPERTY_KEY = "AlreadyWritten";
public static final String ALREADY_WRITTEN_PROPERTY_VALUE = "true";
+ private PropertyConfig() {
+ }
}
public class Event {
- private Event(){}
-
public static final String PRE_AUTHENTICATION = "PRE_AUTHENTICATION";
public static final String POST_AUTHENTICATION = "POST_AUTHENTICATION";
public static final String PRE_SET_USER_CLAIMS = "PRE_SET_USER_CLAIMS";
public static final String POST_SET_USER_CLAIMS = "POST_SET_USER_CLAIMS";
- public static final String PRE_ADD_USER= "PRE_ADD_USER";
- public static final String POST_ADD_USER= "POST_ADD_USER";
- public static final String PRE_UPDATE_CREDENTIAL= "PRE_UPDATE_CREDENTIAL";
- public static final String POST_UPDATE_CREDENTIAL= "POST_UPDATE_CREDENTIAL";
- public static final String PRE_UPDATE_CREDENTIAL_BY_ADMIN= "PRE_UPDATE_CREDENTIAL_BY_ADMIN";
- public static final String POST_UPDATE_CREDENTIAL_BY_ADMIN= "POST_UPDATE_CREDENTIAL_BY_ADMIN";
- public static final String PRE_DELETE_USER= "PRE_DELETE_USER";
- public static final String POST_DELETE_USER= "POST_DELETE_USER";
- public static final String PRE_SET_USER_CLAIM= "PRE_SET_USER_CLAIM";
- public static final String PRE_GET_USER_CLAIM= "PRE_GET_USER_CLAIM";
- public static final String PRE_GET_USER_CLAIMS= "PRE_GET_USER_CLAIMS";
- public static final String POST_GET_USER_CLAIMS= "POST_GET_USER_CLAIMS";
- public static final String POST_GET_USER_CLAIM= "POST_GET_USER_CLAIM";
- public static final String POST_SET_USER_CLAIM= "POST_SET_USER_CLAIM";
- public static final String PRE_DELETE_USER_CLAIMS= "PRE_DELETE_USER_CLAIMS";
- public static final String POST_DELETE_USER_CLAIMS= "POST_DELETE_USER_CLAIMS";
- public static final String PRE_DELETE_USER_CLAIM= "PRE_DELETE_USER_CLAIM";
- public static final String POST_DELETE_USER_CLAIM= "POST_DELETE_USER_CLAIM";
- public static final String PRE_ADD_ROLE= "PRE_ADD_ROLE";
- public static final String POST_ADD_ROLE= "POST_ADD_ROLE";
- public static final String PRE_DELETE_ROLE= "PRE_DELETE_ROLE";
- public static final String POST_DELETE_ROLE= "POST_DELETE_ROLE";
- public static final String PRE_UPDATE_ROLE= "PRE_UPDATE_ROLE";
- public static final String POST_UPDATE_ROLE= "POST_UPDATE_ROLE";
- public static final String PRE_UPDATE_USER_LIST_OF_ROLE= "PRE_UPDATE_USER_LIST_OF_ROLE";
- public static final String POST_UPDATE_USER_LIST_OF_ROLE= "POST_UPDATE_USER_LIST_OF_ROLE";
- public static final String PRE_UPDATE_ROLE_LIST_OF_USER= "PRE_UPDATE_ROLE_LIST_OF_USER";
- public static final String POST_UPDATE_ROLE_LIST_OF_USER= "POST_UPDATE_ROLE_LIST_OF_USER";
- public static final String UPDATE_GOVERNANCE_CONFIGURATION= "UPDATE_GOVERNANCE_CONFIGURATION";
-
+ public static final String PRE_ADD_USER = "PRE_ADD_USER";
+ public static final String POST_ADD_USER = "POST_ADD_USER";
+ public static final String PRE_UPDATE_CREDENTIAL = "PRE_UPDATE_CREDENTIAL";
+ public static final String POST_UPDATE_CREDENTIAL = "POST_UPDATE_CREDENTIAL";
+ public static final String PRE_UPDATE_CREDENTIAL_BY_ADMIN = "PRE_UPDATE_CREDENTIAL_BY_ADMIN";
+ public static final String POST_UPDATE_CREDENTIAL_BY_ADMIN = "POST_UPDATE_CREDENTIAL_BY_ADMIN";
+ public static final String PRE_DELETE_USER = "PRE_DELETE_USER";
+ public static final String POST_DELETE_USER = "POST_DELETE_USER";
+ public static final String PRE_SET_USER_CLAIM = "PRE_SET_USER_CLAIM";
+ public static final String PRE_GET_USER_CLAIM = "PRE_GET_USER_CLAIM";
+ public static final String PRE_GET_USER_CLAIMS = "PRE_GET_USER_CLAIMS";
+ public static final String POST_GET_USER_CLAIMS = "POST_GET_USER_CLAIMS";
+ public static final String POST_GET_USER_CLAIM = "POST_GET_USER_CLAIM";
+ public static final String POST_SET_USER_CLAIM = "POST_SET_USER_CLAIM";
+ public static final String PRE_DELETE_USER_CLAIMS = "PRE_DELETE_USER_CLAIMS";
+ public static final String POST_DELETE_USER_CLAIMS = "POST_DELETE_USER_CLAIMS";
+ public static final String PRE_DELETE_USER_CLAIM = "PRE_DELETE_USER_CLAIM";
+ public static final String POST_DELETE_USER_CLAIM = "POST_DELETE_USER_CLAIM";
+ public static final String PRE_ADD_ROLE = "PRE_ADD_ROLE";
+ public static final String POST_ADD_ROLE = "POST_ADD_ROLE";
+ public static final String PRE_DELETE_ROLE = "PRE_DELETE_ROLE";
+ public static final String POST_DELETE_ROLE = "POST_DELETE_ROLE";
+ public static final String PRE_UPDATE_ROLE = "PRE_UPDATE_ROLE";
+ public static final String POST_UPDATE_ROLE = "POST_UPDATE_ROLE";
+ public static final String PRE_UPDATE_USER_LIST_OF_ROLE = "PRE_UPDATE_USER_LIST_OF_ROLE";
+ public static final String POST_UPDATE_USER_LIST_OF_ROLE = "POST_UPDATE_USER_LIST_OF_ROLE";
+ public static final String PRE_UPDATE_ROLE_LIST_OF_USER = "PRE_UPDATE_ROLE_LIST_OF_USER";
+ public static final String POST_UPDATE_ROLE_LIST_OF_USER = "POST_UPDATE_ROLE_LIST_OF_USER";
+ public static final String UPDATE_GOVERNANCE_CONFIGURATION = "UPDATE_GOVERNANCE_CONFIGURATION";
public static final String TRIGGER_NOTIFICATION = "TRIGGER_NOTIFICATION";
+ private Event() {
+ }
+
}
public class EventProperty {
- private EventProperty(){}
-
public static final String MODULE = "module";
public static final String USER_NAME = "user-name";
public static final String ROLE_NAME = "role-name";
@@ -116,29 +113,30 @@ private EventProperty(){}
public static final String DELETED_ROLES = "DELETED_ROLES";
public static final String NEW_ROLES = "NEW_ROLES";
public static final String PROFILE_NAME = "PROFILE_NAME";
-
+ private EventProperty() {
+ }
}
public class ErrorMessage {
- private ErrorMessage(){}
-
public static final String FAILURE = "Failure";
public static final String FAILED_AUTHENTICATION = "Authentication Failed.";
public static final String FAILED_ENCRYPTION = "Encryption Failed";
+ private ErrorMessage() {
+ }
}
public class Claim {
- private Claim(){}
-
public static final String FAIL_LOGIN_ATTEMPTS = "http://wso2.org/claims/identity/failedLoginAttempts";
public static final String UNLOCKING_TIME = "http://wso2.org/claims/identity/unlockTime";
public static final String ACCOUNT_LOCK = "http://wso2.org/claims/identity/accountLocked";
+ private Claim() {
+ }
}
}
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventDataHolder.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventDataHolder.java
index 175d02b..a1c443b 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventDataHolder.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventDataHolder.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.internal;
@@ -27,18 +25,16 @@
public class EventDataHolder {
private static Logger logger = LoggerFactory.getLogger(EventDataHolder.class);
-
+ private static EventDataHolder instance;
private EventService eventService;
private ExecutorService threadPool;
- private static EventDataHolder instance;
-
private EventDataHolder() {
}
public static EventDataHolder getInstance() {
- if(instance == null) {
+ if (instance == null) {
synchronized (EventDataHolder.class) {
if (instance == null) {
instance = new EventDataHolder();
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventDistributionTask.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventDistributionTask.java
index dde2a0d..a1fe6d2 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventDistributionTask.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventDistributionTask.java
@@ -1,26 +1,23 @@
/*
- * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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.
+ * 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 org.wso2.carbon.identity.event.internal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.wso2.carbon.identity.common.internal.IdentityCommonDataHolder;
import org.wso2.carbon.identity.event.AbstractEventHandler;
import org.wso2.carbon.identity.event.EventException;
import org.wso2.carbon.identity.event.EventMessageContext;
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventServiceComponent.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventServiceComponent.java
index c7779dc..7855d83 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventServiceComponent.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventServiceComponent.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.internal;
@@ -35,22 +33,20 @@
public class EventServiceComponent {
- private static Logger logger = LoggerFactory.getLogger(EventServiceComponent.class);
-
- private ServiceRegistration serviceRegistration = null;
-
// list of all registered event handlers
public static List eventHandlerList = new ArrayList();
+ private static Logger logger = LoggerFactory.getLogger(EventServiceComponent.class);
+ private ServiceRegistration serviceRegistration = null;
protected void activate(ComponentContext componentContext, BundleContext bundleContext, Map properties) {
try {
serviceRegistration = bundleContext.registerService(EventService.class.getName(),
- new EventServiceImpl(
- eventHandlerList, Integer.parseInt
- (ConfigParser.getInstance().getThreadPoolSize())),
- null);
+ new EventServiceImpl(
+ eventHandlerList, Integer.parseInt
+ (ConfigParser.getInstance().getThreadPoolSize())),
+ null);
} catch (Throwable e) {
logger.error("Error while initiating IdentityMgtService.", e);
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventServiceImpl.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventServiceImpl.java
index 2edd25a..a38dc74 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventServiceImpl.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventServiceImpl.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.internal;
@@ -40,6 +38,7 @@ public EventServiceImpl(List handlerList, int threadPoolSi
}
new Thread(eventDistributionTask).start();
}
+
@Override
public void handleEvent(Event event) throws EventException {
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventUtils.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventUtils.java
index 6de4d9a..26f0c51 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventUtils.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/internal/EventUtils.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.internal;
@@ -50,7 +48,7 @@ public static Properties getPropertiesWithPrefix(String prefix, Properties prope
if (StringUtils.isEmpty(prefix) || properties == null) {
throw new IllegalArgumentException("Prefix and properties should not be null to extract properties with " +
- "certain prefix");
+ "certain prefix");
}
Properties subProperties = new Properties();
@@ -101,7 +99,7 @@ public static Properties buildSingleWordKeyProperties(String prefix, Properties
// Stop proceeding if required arguments are not present
if (StringUtils.isEmpty(prefix) || propertiesWithFullKeys == null) {
throw new IllegalArgumentException("Prefix and properties should not be null to get properties with " +
- "single word keys.");
+ "single word keys.");
}
propertiesWithFullKeys = EventUtils.getPropertiesWithPrefix(prefix, propertiesWithFullKeys);
@@ -144,19 +142,19 @@ public static String replacePlaceHolders(String content, String replaceRegexStar
replaceRegexEndsWith);
logger.debug("Replacing place holders of String " + content);
}
- // For each property check whether there is a place holder and replace the place
- // holders exist.
- for (String key : properties.stringPropertyNames()) {
- if (logger.isDebugEnabled()) {
- logger.debug("Replacing place holder with property key :" + key + " from value :" + properties
- .getProperty(key));
- }
- content = content.replaceAll(replaceRegexStartsWith + key + replaceRegexEndsWith,
- properties.getProperty(key));
- }
+ // For each property check whether there is a place holder and replace the place
+ // holders exist.
+ for (String key : properties.stringPropertyNames()) {
if (logger.isDebugEnabled()) {
- logger.debug("Place holders replaced String " + content);
+ logger.debug("Replacing place holder with property key :" + key + " from value :" + properties
+ .getProperty(key));
}
+ content = content.replaceAll(replaceRegexStartsWith + key + replaceRegexEndsWith,
+ properties.getProperty(key));
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("Place holders replaced String " + content);
+ }
return content;
}
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/Event.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/Event.java
index e016277..400e2e1 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/Event.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/Event.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.model;
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/ModuleConfig.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/ModuleConfig.java
index 7e3a60d..faf3e6a 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/ModuleConfig.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/ModuleConfig.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.model;
diff --git a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/Subscription.java b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/Subscription.java
index d027647..b8a37c4 100644
--- a/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/Subscription.java
+++ b/components/org.wso2.carbon.identity.event/src/main/java/org/wso2/carbon/identity/event/model/Subscription.java
@@ -1,19 +1,17 @@
/*
- * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.event.model;
diff --git a/components/org.wso2.carbon.identity.keystore/pom.xml b/components/org.wso2.carbon.identity.keystore/pom.xml
index 96129e8..b601576 100644
--- a/components/org.wso2.carbon.identity.keystore/pom.xml
+++ b/components/org.wso2.carbon.identity.keystore/pom.xml
@@ -1,20 +1,18 @@
@@ -28,7 +26,7 @@
4.0.0
org.wso2.carbon.identity.keystore
- jar
+ bundle
WSO2 Carbon - Identity KeyStore
This is a Carbon bundle that represents the Identity KeyStore module.
@@ -85,4 +83,16 @@
+
+ org.wso2.carbon.identity.keystore.internal
+
+ !org.wso2.carbon.identity.keystore.internal,
+ org.wso2.carbon.identity.keystore.*; version="${identity.base.package.export.version}"
+
+
+ org.slf4j.*; version="${slf4j.package.import.version}",
+
+ *
+
+
diff --git a/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/KeyStoreException.java b/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/KeyStoreException.java
index c7520b9..3eb5763 100644
--- a/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/KeyStoreException.java
+++ b/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/KeyStoreException.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.keystore;
diff --git a/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/KeyStoreService.java b/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/KeyStoreService.java
index e9ea939..b706782 100644
--- a/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/KeyStoreService.java
+++ b/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/KeyStoreService.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.keystore;
@@ -39,7 +37,8 @@ public interface KeyStoreService {
void addCertEntry(String keyStoreName, String alias, Certificate certificate) throws KeyStoreException;
- void addKeyEntry(String keyStoreName, String alias, Key key, char[] password, Certificate[] chain) throws KeyStoreException;
+ void addKeyEntry(String keyStoreName, String alias, Key key, char[] password, Certificate[] chain) throws
+ KeyStoreException;
void deleteEntry(String keyStoreName, String alias) throws KeyStoreException;
diff --git a/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/internal/KeyStoreServiceImpl.java b/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/internal/KeyStoreServiceImpl.java
index 5141ac2..88c88ff 100644
--- a/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/internal/KeyStoreServiceImpl.java
+++ b/components/org.wso2.carbon.identity.keystore/src/main/java/org/wso2/carbon/identity/keystore/internal/KeyStoreServiceImpl.java
@@ -1,19 +1,17 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
- * WSO2 Inc. licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License.
+ * 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
+ * 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.
+ * 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 org.wso2.carbon.identity.keystore.internal;
diff --git a/pom.xml b/pom.xml
index 3f052ca..b89ad29 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
~ 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
+ ~ 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,
@@ -19,7 +19,7 @@
org.wso2
wso2
- 1
+ 5
4.0.0