You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2013/07/08 09:39:01 UTC

[2/2] git commit: adding refactored keystore-mgt module

adding refactored keystore-mgt module


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/dac65a59
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/dac65a59
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/dac65a59

Branch: refs/heads/master
Commit: dac65a596af628c2c2d4b86ffc50e1c62acb4934
Parents: 9d00e6a
Author: Isuru <is...@wso2.com>
Authored: Mon Jul 8 13:08:38 2013 +0530
Committer: Isuru <is...@wso2.com>
Committed: Mon Jul 8 13:08:38 2013 +0530

----------------------------------------------------------------------
 components/pom.xml                              |   1 +
 .../org.wso2.carbon.keystore.mgt/2.1.0/pom.xml  | 117 ----------
 .../carbon/keystore/mgt/KeyStoreGenerator.java  | 229 -------------------
 .../keystore/mgt/KeyStoreMgtException.java      |  39 ----
 .../keystore/mgt/KeystoreTenantMgtListener.java |  79 -------
 .../internal/KeyStoreMgtServiceComponent.java   |  87 -------
 .../keystore/mgt/util/RealmServiceHolder.java   |  33 ---
 .../mgt/util/RegistryServiceHolder.java         |  33 ---
 8 files changed, 1 insertion(+), 617 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dac65a59/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index a4fea2d..e5ee9a3 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -68,6 +68,7 @@
 		<!-- COMMON -->
 		<module>org.apache.stratos.common/2.1.2</module>
 		<module>org.apache.stratos.tenant.dispatcher/2.1.0</module>
+		<module>org.apache.stratos.keystore.mgt/2.1.0</module>
 	    </modules>
 	    
 	    <build>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dac65a59/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/pom.xml b/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/pom.xml
deleted file mode 100644
index 9e855ce..0000000
--- a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/pom.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-# Copyright (c) 2008, 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.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <parent>
-        <groupId>org.wso2.carbon</groupId>
-        <artifactId>stratos-components</artifactId>
-        <version>2.1.0</version>
-<relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.wso2.carbon.keystore.mgt</artifactId>
-    <packaging>bundle</packaging>
-    <name>WSO2 Stratos - Keystore Generation and Management</name>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Name>${project.artifactId}</Bundle-Name>
-                        <Private-Package>
-                            org.wso2.carbon.keystore.mgt.internal                            
-                        </Private-Package>
-                        <Export-Package>
-                            !org.wso2.carbon.keystore.mgt.internal,
-                            org.wso2.carbon.keystore.mgt.*,
-                        </Export-Package>
-                        <Import-Package>
-                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
-                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
-                            org.wso2.carbon.security.*,
-                            org.apache.lucene.*,
-                            *;resolution:=optional
-                        </Import-Package>
-                        <Embed-Dependency>
-                            bcprov-jdk15|naming-factory|naming-resources|commons-collections;scope=compile|runtime;inline=false
-                        </Embed-Dependency>
-                        <DynamicImport-Package>*</DynamicImport-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-
-        </plugins>
-    </build>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-	<dependency>
-            <groupId>commons-codec.wso2</groupId>
-            <artifactId>commons-codec</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.equinox</groupId>
-            <artifactId>javax.servlet</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.axis2.wso2</groupId>
-            <artifactId>axis2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ws.commons.axiom.wso2</groupId>
-            <artifactId>axiom</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.stratos.common</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>bouncycastle</groupId>
-            <artifactId>bcprov-jdk15</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.security.mgt</artifactId>
-        </dependency>
-    </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dac65a59/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeyStoreGenerator.java
----------------------------------------------------------------------
diff --git a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeyStoreGenerator.java b/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeyStoreGenerator.java
deleted file mode 100644
index 9dc4a92..0000000
--- a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeyStoreGenerator.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
-*  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.
-*  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.keystore.mgt;
-
-import org.apache.axiom.om.util.UUIDGenerator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.bouncycastle.jce.X509Principal;
-import org.bouncycastle.jce.X509V3CertificateGenerator;
-import org.wso2.carbon.core.RegistryResources;
-import org.wso2.carbon.core.util.CryptoUtil;
-import org.wso2.carbon.keystore.mgt.util.RealmServiceHolder;
-import org.wso2.carbon.keystore.mgt.util.RegistryServiceHolder;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.wso2.carbon.security.SecurityConstants;
-import org.wso2.carbon.security.keystore.KeyStoreAdmin;
-import org.wso2.carbon.user.core.service.RealmService;
-
-import java.io.ByteArrayOutputStream;
-import java.math.BigInteger;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.SecureRandom;
-import java.security.cert.X509Certificate;
-import java.util.Date;
-
-/**
- * This class is used to generate a key store for a tenant and store it in the governance registry.
- */
-public class KeyStoreGenerator {
-
-    private static Log log = LogFactory.getLog(KeyStoreGenerator.class);
-    private UserRegistry govRegistry;
-    private int tenantId;
-    private String tenantDomain;
-    private String password;
-
-
-    public KeyStoreGenerator(int  tenantId) throws KeyStoreMgtException {
-        try {
-            this.tenantId = tenantId;
-            this.tenantDomain = getTenantDomainName();
-            this.govRegistry = RegistryServiceHolder.getRegistryService().
-                    getGovernanceSystemRegistry(tenantId);
-            if(govRegistry == null){
-                log.error("Governance registry instance is null");
-                throw new KeyStoreMgtException("Governance registry instance is null");
-            }
-        } catch (RegistryException e) {
-            String errorMsg = "Error while obtaining the governance registry for tenant : " +
-                      tenantId;
-            log.error(errorMsg, e);
-            throw new KeyStoreMgtException(errorMsg, e);
-        }
-    }
-
-
-    /**
-     * This method first generates the keystore, then persist it in the gov.registry of that tenant
-     *
-     * @throws KeyStoreMgtException Error when generating or storing the keystore
-     */
-    public void generateKeyStore() throws KeyStoreMgtException {
-        try {
-            password = generatePassword();
-            KeyStore keyStore = KeyStore.getInstance("JKS");
-            keyStore.load(null, password.toCharArray());
-            X509Certificate pubCert = generateKeyPair(keyStore);
-            persistKeyStore(keyStore, pubCert);
-        } catch (Exception e) {
-            String msg = "Error while instantiating a keystore";
-            log.error(msg, e);
-            throw new KeyStoreMgtException(msg, e);
-        }
-    }
-
-    /**
-     * This method generates the keypair and stores it in the keystore
-     *
-     * @param keyStore A keystore instance
-     * @return Generated public key for the tenant
-     * @throws KeyStoreMgtException Error when generating key pair
-     */
-    private X509Certificate generateKeyPair(KeyStore keyStore) throws KeyStoreMgtException {
-        try {
-            CryptoUtil.getDefaultCryptoUtil();
-            //generate key pair
-            KeyPairGenerator keyPairGenerator = null;
-            keyPairGenerator = KeyPairGenerator.getInstance("RSA");
-            keyPairGenerator.initialize(1024);
-            KeyPair keyPair = keyPairGenerator.generateKeyPair();
-
-            // Common Name and alias for the generated certificate
-            String commonName = "CN=" + tenantDomain + ", OU=None, O=None L=None, C=None";
-
-            //generate certificates
-            X509V3CertificateGenerator v3CertGen = new X509V3CertificateGenerator();
-            v3CertGen.setSerialNumber(BigInteger.valueOf(new SecureRandom().nextInt()));
-            v3CertGen.setIssuerDN(new X509Principal(commonName));
-            v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30));
-            v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 365 * 10)));
-            v3CertGen.setSubjectDN(new X509Principal(commonName));
-            v3CertGen.setPublicKey(keyPair.getPublic());
-            v3CertGen.setSignatureAlgorithm("MD5WithRSAEncryption");
-            X509Certificate PKCertificate = v3CertGen.generateX509Certificate(keyPair.getPrivate());
-
-            //add private key to KS
-            keyStore.setKeyEntry(tenantDomain, keyPair.getPrivate(), password.toCharArray(),
-                                 new java.security.cert.Certificate[]{PKCertificate});
-            return PKCertificate;
-        } catch (Exception ex) {
-            String msg = "Error while generating the certificate for tenant :" +
-                         tenantDomain + ".";
-            log.error(msg, ex);
-            throw new KeyStoreMgtException(msg, ex);
-        }
-
-    }
-
-    /**
-     * Persist the keystore in the gov.registry
-     *
-     * @param keyStore created Keystore of the tenant
-     * @param PKCertificate pub. key of the tenant
-     * @throws KeyStoreMgtException Exception when storing the keystore in the registry
-     */
-    private void persistKeyStore(KeyStore keyStore, X509Certificate PKCertificate)
-            throws KeyStoreMgtException {
-        try {
-            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-            keyStore.store(outputStream, password.toCharArray());
-            outputStream.flush();
-            outputStream.close();
-
-            String keyStoreName = generateKSNameFromDomainName();
-            // Use the keystore using the keystore admin
-            KeyStoreAdmin keystoreAdmin = new KeyStoreAdmin(tenantId, govRegistry);
-            keystoreAdmin.addKeyStore(outputStream.toByteArray(), keyStoreName,
-                                      password, " ", "JKS", password);
-            
-            //Create the pub. key resource
-            Resource pubKeyResource = govRegistry.newResource();
-            pubKeyResource.setContent(PKCertificate.getEncoded());
-            pubKeyResource.addProperty(SecurityConstants.PROP_TENANT_PUB_KEY_FILE_NAME_APPENDER,
-                                       generatePubKeyFileNameAppender());
-
-            govRegistry.put(RegistryResources.SecurityManagement.TENANT_PUBKEY_RESOURCE, pubKeyResource);
-
-            //associate the public key with the keystore
-            govRegistry.addAssociation(RegistryResources.SecurityManagement.KEY_STORES + "/" + keyStoreName,
-                                       RegistryResources.SecurityManagement.TENANT_PUBKEY_RESOURCE,
-                                       SecurityConstants.ASSOCIATION_TENANT_KS_PUB_KEY);
-
-        } catch (RegistryException e) {
-            String msg = "Error when writing the keystore/pub.cert to registry";
-            log.error(msg, e);
-            throw new KeyStoreMgtException(msg, e);
-        }
-        catch (Exception e) {
-            String msg = "Error when processing keystore/pub. cert to be stored in registry";
-            log.error(msg, e);
-            throw new KeyStoreMgtException(msg, e);
-        }
-    }
-
-    /**
-     * This method is used to generate a random password for the generated keystore
-     *
-     * @return generated password
-     */
-    private String generatePassword() {
-        SecureRandom random = new SecureRandom();
-        String randString = new BigInteger(130, random).toString(12);
-        return randString.substring(randString.length() - 10, randString.length());
-    }
-
-    /**
-     * This method is used to generate a file name appender for the pub. cert, e.g.
-     * example-com-343743.cert
-     * @return generated string to be used as a file name appender
-     */
-    private String generatePubKeyFileNameAppender(){
-        String uuid = UUIDGenerator.getUUID();
-        return uuid.substring(uuid.length() - 6, uuid.length()-1);
-    }
-
-    /**
-     * This method generates the key store file name from the Domain Name
-     * @return
-     */
-    private String generateKSNameFromDomainName(){
-        String ksName = tenantDomain.trim().replace(".", "-");
-        return (ksName + ".jks" );
-    }
-
-    private String getTenantDomainName() throws KeyStoreMgtException {
-        RealmService realmService = RealmServiceHolder.getRealmService();
-        if (realmService == null) {
-            String msg = "Error in getting the domain name, realm service is null.";
-            log.error(msg);
-            throw new KeyStoreMgtException(msg);
-        }
-        try {
-            return realmService.getTenantManager().getDomain(tenantId);
-        } catch (org.wso2.carbon.user.api.UserStoreException e) {
-            String msg = "Error in getting the domain name for the tenant id: " + tenantId;
-            log.error(msg, e);
-            throw new KeyStoreMgtException(msg, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dac65a59/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeyStoreMgtException.java
----------------------------------------------------------------------
diff --git a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeyStoreMgtException.java b/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeyStoreMgtException.java
deleted file mode 100644
index 040fb1f..0000000
--- a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeyStoreMgtException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-*  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.
-*  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.keystore.mgt;
-
-/**
- * This class is used to wrap the exceptions thrown from stratos keystore mgt component.
- */
-public class KeyStoreMgtException extends Exception {
-    public KeyStoreMgtException() {
-    }
-
-    public KeyStoreMgtException(String message) {
-        super(message);
-    }
-
-    public KeyStoreMgtException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public KeyStoreMgtException(Throwable cause) {
-        super(cause);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dac65a59/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeystoreTenantMgtListener.java
----------------------------------------------------------------------
diff --git a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeystoreTenantMgtListener.java b/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeystoreTenantMgtListener.java
deleted file mode 100644
index 6262806..0000000
--- a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/KeystoreTenantMgtListener.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-*  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.
-*  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.keystore.mgt;
-
-import org.wso2.carbon.stratos.common.beans.TenantInfoBean;
-import org.wso2.carbon.stratos.common.exception.StratosException;
-import org.wso2.carbon.stratos.common.listeners.TenantMgtListener;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This class is used to listen to the tenant creation events and fire the keystore creation event
- */
-public class KeystoreTenantMgtListener implements TenantMgtListener {
-
-    private static Log log = LogFactory.getLog(KeystoreTenantMgtListener.class);
-    private static final int EXEC_ORDER = 20;
-
-    /**
-     * Generate the keystore when a new tenant is registered.
-     * @param tenantInfo Information about the newly created tenant
-     */
-    public void onTenantCreate(TenantInfoBean tenantInfo) throws StratosException {
-        try {
-            KeyStoreGenerator ksGenerator = new KeyStoreGenerator(tenantInfo.getTenantId());
-            ksGenerator.generateKeyStore();
-        } catch (KeyStoreMgtException e) {
-            String message = "Error when generating the keystore";
-            log.error(message, e);
-            throw new StratosException(message, e);
-        }
-    }
-
-    public void onTenantUpdate(TenantInfoBean tenantInfo) throws StratosException {
-        // It is not required to implement this method for keystore mgt. 
-    }
-
-    public void onTenantRename(int tenantId, String oldDomainName,
-                             String newDomainName) throws StratosException {
-        // It is not required to implement this method for keystore mgt.
-    }
-
-    public int getListenerOrder() {
-        return EXEC_ORDER;
-    }
-
-    public void onTenantInitialActivation(int tenantId) throws StratosException {
-        // It is not required to implement this method for keystore mgt. 
-    }
-
-    public void onTenantActivation(int tenantId) throws StratosException {
-        // It is not required to implement this method for keystore mgt. 
-    }
-
-    public void onTenantDeactivation(int tenantId) throws StratosException {
-        // It is not required to implement this method for keystore mgt. 
-    }
-
-    public void onSubscriptionPlanChange(int tenentId, String oldPlan, 
-                                         String newPlan) throws StratosException {
-        // It is not required to implement this method for keystore mgt. 
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dac65a59/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/internal/KeyStoreMgtServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/internal/KeyStoreMgtServiceComponent.java b/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/internal/KeyStoreMgtServiceComponent.java
deleted file mode 100644
index 9b094a8..0000000
--- a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/internal/KeyStoreMgtServiceComponent.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-*  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.
-*  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.keystore.mgt.internal;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.keystore.mgt.KeystoreTenantMgtListener;
-import org.wso2.carbon.keystore.mgt.util.RealmServiceHolder;
-import org.wso2.carbon.keystore.mgt.util.RegistryServiceHolder;
-
-/**
- * @scr.component name="org.wso2.carbon.keystore.mgt"
- * immediate="true"
- * @scr.reference name="registry.service"
- * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="1..1"
- * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService"
- * @scr.reference name="user.realmservice.default" interface="org.wso2.carbon.user.core.service.RealmService"
- * cardinality="1..1" policy="dynamic" bind="setRealmService"
- * unbind="unsetRealmService"
- */
-public class KeyStoreMgtServiceComponent {
-
-    private static Log log = LogFactory.getLog(KeyStoreMgtServiceComponent.class);
-
-
-    protected void activate(ComponentContext ctxt){
-        KeystoreTenantMgtListener keystoreTenantMgtListener = new KeystoreTenantMgtListener();
-        ctxt.getBundleContext().registerService(
-                org.wso2.carbon.stratos.common.listeners.TenantMgtListener.class.getName(),
-                keystoreTenantMgtListener, null);
-        if (log.isDebugEnabled()) {
-            log.debug("*************Stratos Keystore mgt component is activated.**************");
-        }
-    }
-
-    protected void deactivate(ComponentContext ctxt) {
-        if(log.isDebugEnabled()){
-            log.debug("************Stratos keystore mgt component is decativated.*************");
-        }
-    }
-
-    protected void setRegistryService(RegistryService registryService){
-        RegistryServiceHolder.setRegistryService(registryService);
-        if (log.isDebugEnabled()) {
-            log.debug("Registry Service is set for KeyStoreMgtServiceComponent.");
-        }
-    }
-
-    protected void unsetRegistryService(RegistryService registryService){
-        RegistryServiceHolder.setRegistryService(null);
-        if(log.isDebugEnabled()){
-            log.debug("Registry Service is unset for KeyStoreMgtServiceComponent.");
-        }
-    }
-
-    protected void setRealmService(RealmService realmService){
-        RealmServiceHolder.setRealmService(realmService);
-        if (log.isDebugEnabled()) {
-            log.debug("Realm Service is set for KeyStoreMgtServiceComponent.");
-        }
-    }
-
-    protected void unsetRealmService(RealmService realmService){
-        RealmServiceHolder.setRealmService(null);
-        if(log.isDebugEnabled()){
-            log.debug("Realm Service is unset for KeyStoreMgtServiceComponent.");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dac65a59/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/util/RealmServiceHolder.java
----------------------------------------------------------------------
diff --git a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/util/RealmServiceHolder.java b/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/util/RealmServiceHolder.java
deleted file mode 100644
index 719036a..0000000
--- a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/util/RealmServiceHolder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-*  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.
-*  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.keystore.mgt.util;
-
-import org.wso2.carbon.user.core.service.RealmService;
-
-public class RealmServiceHolder {
-
-    private static RealmService realmServiceService;
-
-    public static RealmService getRealmService() {
-        return realmServiceService;
-    }
-
-    public static void setRealmService(RealmService realmService) {
-        RealmServiceHolder.realmServiceService = realmService;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/dac65a59/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/util/RegistryServiceHolder.java
----------------------------------------------------------------------
diff --git a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/util/RegistryServiceHolder.java b/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/util/RegistryServiceHolder.java
deleted file mode 100644
index ec00c2a..0000000
--- a/components/stratos/org.wso2.carbon.keystore.mgt/2.1.0/src/main/java/org/wso2/carbon/keystore/mgt/util/RegistryServiceHolder.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-*  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.
-*  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.keystore.mgt.util;
-
-import org.wso2.carbon.registry.core.service.RegistryService;
-
-public class RegistryServiceHolder {
-
-    private static RegistryService registryService;
-
-    public static RegistryService getRegistryService() {
-        return registryService;
-    }
-
-    public static void setRegistryService(RegistryService registryService) {
-        RegistryServiceHolder.registryService = registryService;
-    }
-}