text:
package org.wso2.appcloud.core;

import com.nimbusds.jose.util.JSONObjectUtils;
import net.minidev.json.JSONObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.appcloud.common.AppCloudException;
import org.wso2.appcloud.core.dao.ApplicationDAO;
import org.wso2.appcloud.core.dto.Application;
import org.wso2.appcloud.core.dto.ApplicationRuntime;
import org.wso2.appcloud.core.dto.ApplicationType;
import org.wso2.appcloud.core.dto.ContainerServiceProxy;
import org.wso2.appcloud.core.dto.Deployment;
import org.wso2.appcloud.core.dto.RuntimeProperty;
import org.wso2.appcloud.core.dto.Tag;
import org.wso2.appcloud.core.dto.Transport;
import org.wso2.appcloud.core.dto.Version;
import org.wso2.appcloud.core.dto.*;
import org.wso2.carbon.context.CarbonContext;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * This class provide the interface for accessing the dao layer.
 */
public class ApplicationManager {

    private static Log log = LogFactory.getLog(ApplicationManager.class);

    /**
     * Method for adding application.
     *
     * @param application application object
     * @throws AppCloudException
     */
    public static void addApplication(Application application) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().addApplication(dbConnection, application, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while adding application with name : " + application.getApplicationName() +
                    " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for adding application with name : " +
                    application.getApplicationName() + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for adding application version.
     *
     * @param version version object
     * @throws AppCloudException
     */
    public static void addApplicationVersion(Version version, String applicationHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            int applicationId = ApplicationDAO.getInstance().
                    getApplicationId(dbConnection, applicationHashId, tenantId);
            ApplicationDAO.getInstance().addVersion(dbConnection, version, applicationId, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while adding application version for application hash id : " + applicationHashId +
                    "and version :" + version.getVersionName() + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for adding application version, for application id : " +
                    applicationHashId + " and version : " + version.getVersionName() + " for tenant id : "
                    + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for adding runtime properties for a specific version.
     *
     * @param runtimeProperties list of runtime properties
     * @param versionHashId     version hash id
     * @throws AppCloudException
     */
    public static void addRuntimeProperties(List<RuntimeProperty> runtimeProperties, String versionHashId)
            throws AppCloudException {
        if (runtimeProperties == null || runtimeProperties.isEmpty()) {
            return;
        }
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().addRunTimeProperties(dbConnection, runtimeProperties, versionHashId, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while adding runtime properties for version with version id : " + versionHashId +
                    " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for adding runtime properties for version with " +
                    "version id : " + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for adding tags for a specific version.
     *
     * @param tags          list of tags
     * @param versionHashId version hash id
     * @throws AppCloudException
     */
    public static void addTags(List<Tag> tags, String versionHashId)
            throws AppCloudException {
        if (tags == null || tags.isEmpty()) {
            return;
        }
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().addTags(dbConnection, tags, versionHashId, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while adding tags for version with hash id : " + versionHashId + " for tenant id : " +
                    tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for adding tags for version with hash id : "
                    + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting the list of application of a tenant per cloud
     * @param cloudType cloud type
     * @return array of application objects
     * @throws AppCloudException
     */
    public static Application[] getApplicationList(String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            List<Application> applications = ApplicationDAO.getInstance().
                    getAllApplicationsList(dbConnection, tenantId, cloudType);
            return applications.toArray(new Application[applications.size()]);
        } catch (AppCloudException e) {
            String msg = "Error while getting application list for tenant id : " + tenantId + " and cloud : " + cloudType ;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting version list of application.
     *
     * @param applicationHashId hash id of application object
     * @return list of versions
     * @throws AppCloudException
     */
    public static List<String> getVersionListOfApplication(String applicationHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().
                    getAllVersionListOfApplication(dbConnection, applicationHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting version list for application with hash id : " + applicationHashId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting version hash ids of application.
     *
     * @param applicationHashId hash id of application object
     * @return list of version hash ids
     * @throws AppCloudException
     */
    public static List<String> getVersionHashIdsOfApplication(String applicationHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().
                    getAllVersionHashIdsOfApplication(dbConnection, applicationHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting version hash ids for application with hash id : " + applicationHashId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for checking if the given version is the only version.
     *
     * @param versionHashId version id of application version
     * @return is only version or not
     * @throws AppCloudException
     */
    public static boolean isSingleVersion(String versionHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().isSingleVersion(dbConnection, versionHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting if version is a single version for version with hash id : "
                    + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting application hash id by version hash id.
     *
     * @param versionHashId version id of application version
     * @return application hash id
     * @throws AppCloudException
     */
    public static String getApplicationHashIdByVersionHashId(String versionHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().
                    getApplicationHashIdByVersionHashId(dbConnection, versionHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting application hash id by version hash id for version with hash id : " +
                    versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting application name by hash id.
     *
     * @param applicationHashId hash id of application object
     * @return application name
     * @throws AppCloudException
     */
    public static String getApplicationNameByHashId(String applicationHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {

            return ApplicationDAO.getInstance().getApplicationNameByHashId(dbConnection, applicationHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting application name by hash id for application with hash id : " +
                    applicationHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting application hash id of matching application name.
     *
     * @param applicationName name of application object
     * @return application hash id
     * @throws AppCloudException
     */
    public static String getApplicationHashIdOfMatchingAppName(String applicationName) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getApplicationHashIdOfMatchingAppName(dbConnection, applicationName, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting application hash id of matching app name : "
                    + applicationName + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting application by hash id.
     *
     * @param applicationHashId application hash id
     * @return application object
     * @throws AppCloudException
     */
    public static Application getApplicationByHashId(String applicationHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getApplicationByHashId(dbConnection, applicationHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting application by hash id for hash id : " + applicationHashId +
                    " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting all runtime properties of version.
     *
     * @param versionHashId hash id of version
     * @return list of runtime properties
     * @throws AppCloudException
     */
    public static List<RuntimeProperty> getAllRuntimePropertiesOfVersion(String versionHashId)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getAllRuntimePropertiesOfVersion(dbConnection, versionHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting all runtime properties of version for version hash id : " + versionHashId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting all tags of version.
     *
     * @param versionHashId hash id of version
     * @return list of tags
     * @throws AppCloudException
     */
    public static List<Tag> getAllTagsOfVersion(String versionHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getAllTagsOfVersion(dbConnection, versionHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting all tags of version for version with hash id : " + versionHashId +
                    " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for updating runtime property.
     *
     * @param versionHashId hash id of version
     * @param oldKey        old key of runtime property
     * @param newKey        new key of runtime property
     * @param newValue      new value of runtime property
     * @throws AppCloudException
     */
    public static void updateRuntimeProperty(String versionHashId, String oldKey, String newKey,
                                             String newValue) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().
                    updateRuntimeProperty(dbConnection, versionHashId, oldKey, newKey, newValue, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while adding runtime property with key : " + oldKey + " for version with hash id : " +
                    versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for adding runtime property with key : " + oldKey +
                    " for version with hash id : " + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for updating tag.
     *
     * @param versionHashId hash id of version
     * @param oldKey        old key of tag
     * @param newKey        new key of tag
     * @param newValue      new value of tag
     * @throws AppCloudException
     */
    public static void updateTag(String versionHashId, String oldKey, String newKey, String newValue)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().updateTag(dbConnection, versionHashId, oldKey, newKey, newValue, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while updating tag with the key : " + oldKey + " for version with hash id : " +
                    versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for updating tag with the key : " + oldKey +
                    " for version with hash id : " + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for deleting runtime property.
     *
     * @param versionHashId hash id of version
     * @param key           key of runtime property
     * @throws AppCloudException
     */
    public static void deleteRuntimeProperty(String versionHashId, String key)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().deleteRuntimeProperty(dbConnection, versionHashId, key, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while deleting runtime property with key : " + key + " for version with hash id : " +
                    versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for deleting runtime property with key : " + key +
                    " for version with hash id : " + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for deleting tag.
     *
     * @param versionHashId hash id of version
     * @param key           key of tag
     * @throws AppCloudException
     */
    public static void deleteTag(String versionHashId, String key)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().deleteTag(dbConnection, versionHashId, key, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while deleting tag with key : " + key + " for version with hash id : " + versionHashId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for deleting tag with key : " + key +
                    " for version with hash id : " + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for updating application icon.
     *
     * @param applicationHashId hash id of version
     * @param iconStream        icon stream object
     * @throws AppCloudException
     */
    public static void updateApplicationIcon(String applicationHashId, Object iconStream)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        if (iconStream instanceof InputStream) {
            InputStream iconInputStream = (InputStream) iconStream;
            try {
                int applicationId = ApplicationDAO.getInstance().
                        getApplicationId(dbConnection, applicationHashId, tenantId);
                ApplicationDAO.getInstance().
                        updateApplicationIcon(dbConnection, iconInputStream, applicationId, tenantId);
                dbConnection.commit();
            } catch (AppCloudException e) {
                String msg = "Error while updating the application icon for application with hash id : "
                        + applicationHashId + " for tenant id : " + tenantId;
                log.error(msg, e);
                throw new AppCloudException(msg, e);
            } catch (SQLException e) {
                String msg = "Error while committing transaction for updating the application icon for " +
                        "application with hash id : " + applicationHashId + " for tenant id : " + tenantId;
                log.error(msg, e);
                throw new AppCloudException(msg, e);
            } finally {
                try {
                    iconInputStream.close();
                } catch (IOException e) {
                    log.error("Error occurred while closing input stream for application with hash id : " +
                            applicationHashId + " for tenant id : " + tenantId);
                } finally {
                    DBUtil.closeConnection(dbConnection);
                }
            }
        } else {
            String msg = "Cannot read the provided icon stream for application with hash id : " + applicationHashId
                    + " for tenant id : " + tenantId;
            log.error(msg);
            throw new AppCloudException(msg);
        }
    }

    /**
     * Method for getting all apptypes for a given cloud type.
     *
     * @param cloudType cloud type
     * @return list of app types
     * @throws AppCloudException
     */
    public static ApplicationType[] getAllAppTypesForCloud(String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            List<ApplicationType> applicationTypeList = ApplicationDAO.getInstance().
                    getAllApplicationTypesForCloud(dbConnection, tenantId, cloudType);
            return applicationTypeList.toArray(new ApplicationType[applicationTypeList.size()]);
        } catch (AppCloudException e) {
            String msg = "Error while getting all application types for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting all runtimes for a given application type.
     *
     * @param appType application type
     * @return list of application runtimes
     * @throws AppCloudException
     */
    public static ApplicationRuntime[] getAllRuntimesForAppType(String appType)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            List<ApplicationRuntime> runtimes = ApplicationDAO.getInstance().
                    getRuntimesForAppType(dbConnection, appType, tenantId);
            return runtimes.toArray(new ApplicationRuntime[runtimes.size()]);
        } catch (AppCloudException e) {
            String msg = "Error while getting all runtimes for application type for type : " + appType +
                    " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for updating application status.
     *
     * @param versionHashId hash id of version
     * @param status        status of application
     * @throws AppCloudException
     */
    public static void updateVersionStatus(String versionHashId, String status) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().updateVersionStatus(dbConnection, status, versionHashId, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while updating version status with status : " + status + " for version with hash id : "
                    + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for updating version status with status : " + status +
                    " for version with hash id : " + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for delete an application completely.
     *
     * @param applicationHashId application hash id
     * @throws AppCloudException
     */
    public static void deleteApplication(String applicationHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().deleteAllDeploymentOfApplication(dbConnection, applicationHashId, tenantId);
            ApplicationDAO.getInstance().deleteApplication(dbConnection, applicationHashId, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while deleting application with hash id : " + applicationHashId + " for tenant id : "
                    + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while commiting transaction for deleting application with hash id : " +
                    applicationHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for deleting version of application.
     *
     * @param versionHashId hash id of version
     * @throws AppCloudException
     */
    public static void deleteVersion(String versionHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().deleteDeployment(dbConnection, versionHashId, tenantId);
            ApplicationDAO.getInstance().deleteVersion(dbConnection, versionHashId, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while deleting the version with hash id : " + versionHashId + " for tenant id : " +
                    tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for deleting the version with hash id : "
                    + versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for adding deployment.
     *
     * @param versionHashId hash id of version
     * @param deployment    deployment object
     * @throws AppCloudException
     */
    public static void addDeployment(String versionHashId, Deployment deployment) throws AppCloudException {
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        Connection dbcConnection = DBUtil.getDBConnection();
        try {
            ApplicationDAO.getInstance().addDeploymentForVersion(dbcConnection, versionHashId, deployment, tenantId);
            dbcConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while adding deployment for version with hash id : " + versionHashId +
                    " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for adding deployment for version with hash id : " +
                    versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbcConnection);
        }

    }

    /**
     * Method for getting deployments.
     *
     * @param versionHashId hash id of version
     * @return deployment object
     * @throws AppCloudException
     */
    public static Deployment getDeployment(String versionHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getDeployment(dbConnection, versionHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting deployment for version with hash id : " + versionHashId +
                    " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for deleting deployment.
     *
     * @param versionHashId hash id of version
     * @throws AppCloudException
     */
    public static void deleteDeployment(String versionHashId) throws AppCloudException {
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            ApplicationDAO.getInstance().deleteDeployment(dbConnection, versionHashId, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while deleting deployment for version with hash id : " + versionHashId +
                    " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for deleting deployment for version with hash id : " +
                    versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting transports for runtime.
     *
     * @param runtimeId id of runtime
     * @return transports array
     * @throws AppCloudException
     */
    public static Transport[] getTransportsForRuntime(int runtimeId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            List<Transport> transports = ApplicationDAO.getInstance().
                    getTransportsForRuntime(dbConnection, runtimeId, tenantId);
            return transports.toArray(new Transport[transports.size()]);
        } catch (AppCloudException e) {
            String msg = "Error while getting transports for runtime with id : " + runtimeId + " for tenant id : "
                    + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting runtime by id.
     *
     * @param runtimeId id of runtime
     * @return application runtime
     * @throws AppCloudException
     */
    public static ApplicationRuntime getRuntimeById(int runtimeId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getRuntimeById(dbConnection, runtimeId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting runtime by id for id : " + runtimeId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

     /**
     * Method for getting existing applications count per cloud
     *
     * @param cloudType cloud type
     * @return application count
     * @throws AppCloudException
     */
    public static int getRunningApplicationVersionCount(String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getRunningApplicationVersionCount(dbConnection, tenantId, cloudType);
        } catch (AppCloudException e) {
            String msg =
                    "Error while getting application count for tenant id : " + tenantId + " and cloud : " + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get custom domain by application hash id.
     *
     * @param applicationId hash id of application
     * @return custom domain
     * @throws AppCloudException
     */
    public static String getCustomDomain(String applicationId) throws AppCloudException {
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getCustomDomain(dbConnection, applicationId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting custom domain with application hash id : " + applicationId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get default version by application hash id.
     *
     * @param applicationId hash id of application
     * @return default version
     * @throws AppCloudException
     */
    public static String getDefaultVersion(String applicationId) throws AppCloudException {
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getDefaultVersion(dbConnection, applicationId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting default version with application hash id : " + applicationId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get container service proxy by version hash id.
     *
     * @param versionHashId hash id of version
     * @return list of container service proxies
     * @throws AppCloudException
     */
    public static List<ContainerServiceProxy> getContainerServiceProxyByVersion(String versionHashId)
            throws AppCloudException {
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().
                    getContainerServiceProxyByVersion(dbConnection, versionHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting container service proxy with version hash id : " + versionHashId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Update custom domain for particular application.
     *
     * @param applicationHashId hash id of application
     * @param customDomain      custom domain
     * @return is container service proxy service update successful or not
     * @throws AppCloudException
     */
    public static boolean updateCustomDomain(String applicationHashId, String customDomain) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();

        try {
            boolean isUpdateSuccess = ApplicationDAO.getInstance().
                    updateCustomDomain(dbConnection, applicationHashId, customDomain, tenantId);
            dbConnection.commit();
            return isUpdateSuccess;
        } catch (AppCloudException e) {
            String msg = "Error while updating the custom domain with application hash id : " + applicationHashId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for update custom domain with application hash id : "
                    + applicationHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Update default version field with mapped version for custom url.
     *
     * @param applicationHashId  hash id of application object
     * @param defaultVersionName name of default version
     * @return is default version update successful or not
     * @throws AppCloudException
     */
    public static boolean updateDefaultVersion(String applicationHashId, String defaultVersionName)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            boolean isUpdatedSuccess = ApplicationDAO.getInstance().
                    updateDefaultVersion(dbConnection, applicationHashId, defaultVersionName, tenantId);
            dbConnection.commit();
            return isUpdatedSuccess;
        } catch (AppCloudException e) {
            String msg = "Error while updating default version with application hash id : " + applicationHashId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String message = "Error while committing transaction for updating default version with application hash " +
                    "id : " + applicationHashId + " for tenant id : " + tenantId;
            throw new AppCloudException(message, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting application version by running time period.
     *
     * @param numberOfHours number of hours the version has been running
     * @return array of version objects
     * @throws AppCloudException
     */
    public static Version[] getApplicationVersionsByRunningTimePeriod(int numberOfHours) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().
                    getApplicationVersionsByRunningTimePeriod(dbConnection, numberOfHours, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting application version by running time period for " + numberOfHours +
                    " numberOfHours for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting tool apps version by running time period.
     *
     * @param numberOfHours number of hours the version has been running
     * @param toolName      name of the tool
     * @return array of version objects
     * @throws AppCloudException
     */
    public static Version[] getRunningToolAppsByRunningTimePeriod(int numberOfHours, String toolName)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().
                    getRunningToolAppsByRunningTimePeriod(dbConnection, numberOfHours, tenantId, toolName);
        } catch (AppCloudException e) {
            String msg = "Error while getting application version by running time period for " + numberOfHours +
                    " numberOfHours for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get running applications of all tenants
     *
     * @return map of running applications
     * @throws AppCloudException
     */
    public static Map<Integer, List<Application>> getRunningApplicationsOfAllTenants() throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getRunningApplicationsOfAllTenants(dbConnection);
        } catch (AppCloudException e) {
            String msg = "Error while getting running applications of all tenants.";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get all application with running state.
     * @param tenantId
     * @return
     * @throws AppCloudException
     */
    public static Map<Integer, List<Application>> getRunningApplicationsOfTenant(int tenantId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getRunningApplicationsOfTenant(dbConnection, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting running applications of a tenant.";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting maximum application count for whitelisted tenant per cloud
     * @param tenantId id of tenant
     * @param cloudType cloud type
     * @return maximum application count
     * @throws AppCloudException
     */
    public static int getMaxAppCountForWhiteListedTenants(int tenantId, String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getWhiteListedTenantMaxAppCount(dbConnection, tenantId, cloudType);
        } catch (AppCloudException e) {
            String msg = "Error while getting maximum application count for whitelisted tenant for tenant id : " +
                    tenantId + " and cloud : " + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting maximum replication count for whitelisted tenant per cloud
     *
     * @param tenantId id of tenant
     * @param cloudType cloud type
     * @return maximum replication count
     * @throws AppCloudException
     */
    public static int getMaxReplicaCountForWhiteListedTenants(int tenantId, String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getWhiteListedTenantMaxReplicaCount(dbConnection, tenantId, cloudType);
        } catch (AppCloudException e) {
            String msg = "Error while getting maximum replication count for whitelisted tenant for tenant id : " +
                    tenantId + " and cloud : " + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting all versions of application object.
     *
     * @param applicationHashId hash id of application object
     * @return list of version objects
     * @throws AppCloudException
     */
    public static List<Version> getAllVersionsOfApplication(String applicationHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getAllVersionsOfApplication(dbConnection, applicationHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while getting versions list for application with hash id : " + applicationHashId
                    + " for tenant id : " + tenantId;
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for whitelisting application version.
     *
     * @param versionHashId hash id of version
     * @throws AppCloudException
     */
    public static void whiteListApplicationVersion(String versionHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().whiteListApplicationVersion(dbConnection, versionHashId, tenantId);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error whitelisting application version hash id : " + versionHashId + " for tenant id : "
                    + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for whitelisting application version hash id : " +
                    versionHashId + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for whitelisting tenant per cloud
     *
     * @param tenantId         id of tenant
     * @param maxAppCount      maximum application count
     * @param maxDatabaseCount maximum database count
     * @param cloudType        cloud type
     * @param replicaCount        replication count
     * @throws AppCloudException
     */
    public static void whiteListTenant(int tenantId, int maxAppCount, int maxDatabaseCount, String cloudType, int replicaCount) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            ApplicationDAO.getInstance().whiteListTenant(dbConnection, tenantId, maxAppCount, maxDatabaseCount, cloudType, replicaCount);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error whitelisting tenant for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for whitelisting tenant for tenant id : " + tenantId +
                    " and cloud : " + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for updating container specification.
     *
     * @param versionHashId hash id of version
     * @param memory        memory specification
     * @param cpu           cpu specification
     * @return is container specification update successful or not
     * @throws AppCloudException
     */
    public static boolean updateContainerSpecification(String versionHashId, int memory, int cpu)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            boolean isUpdatedSuccess = ApplicationDAO.getInstance().
                    updateContainerSpecification(dbConnection, versionHashId, memory, cpu, tenantId);
            dbConnection.commit();
            return isUpdatedSuccess;
        } catch (AppCloudException e) {
            String msg = "Error while updating container specification with application hash id : " + versionHashId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String message = "Error while committing transaction for updating container specification with " +
                    "application hash id : " + versionHashId + " for tenant id : " + tenantId;
            throw new AppCloudException(message, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for getting maximum database count for white listed tenant per cloud
     * @param tenantId id of tenant
     * @param cloudType cloud type
     * @return maximum database count
     * @throws AppCloudException
     */
    public static int getMaxDatabaseCountForWhiteListedTenants(int tenantId, String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getWhiteListedTenantMaxDatabaseCount(dbConnection, tenantId, cloudType);
        } catch (AppCloudException e) {
            String msg = "Error while getting maximum database count for whitelisted tenant for tenant id : " +
                    tenantId + " and cloud : " + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for whitelisting maximum database count for tenant per cloud
     *
     * @param tenantId         id of tenant
     * @param maxDatabaseCount maximum database count
     * @param cloudType        cloud type
     * @throws AppCloudException
     */
    public static void whiteListMaxDatabaseCount(int tenantId, int maxDatabaseCount, String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            ApplicationDAO.getInstance().whiteListMaxDatabaseCount(dbConnection, tenantId, maxDatabaseCount, cloudType);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error whitelisting maximum database count for tenant id : " + tenantId + " and cloud : " + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for whitelisting maximum database count for tenant id : "
                    + tenantId + " and cloud : " + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for whitelisting maximum application count for tenant per cloud
     *
     * @param tenantId    id of tenant
     * @param maxAppCount maximum application count
     * @param cloudType   cloud type
     * @throws AppCloudException
     */
    public static void whiteListMaxAppCount(int tenantId, int maxAppCount, String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            ApplicationDAO.getInstance().whiteListMaxAppCount(dbConnection, tenantId, maxAppCount, cloudType);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error whitelisting maximum application count for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for whitelisting maximum application count for " +
                    "tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for whitelist and increase replica count for a given tenant
     *
     * @param tenantId tenant id
     * @param cloudType cloud type
     * @param replicaCount new replication count
     * @throws AppCloudException
     */
    public static void whiteListMaxReplicaCount(int tenantId, String cloudType, int replicaCount) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            ApplicationDAO.getInstance().whiteListMaxReplicaCount(dbConnection, tenantId, cloudType, replicaCount);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error whitelisting maximum replication count for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for whitelisting maximum replication count for " +
                    "tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get the list of tagged applications per cloud
     *
     * @param cloudType cloud type
     * @return List of all the tagged applications per cloud
     * @throws AppCloudException
     */
    public static Application[] getTaggedApplicationsList(String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            List<Application> applications = ApplicationDAO.getInstance().
                    getTaggedApplicationsList(dbConnection, tenantId, cloudType);
            return applications.toArray(new Application[applications.size()]);
        } catch (AppCloudException e) {
            String msg = "Error while retrieving tagged applications for tenant id : " + tenantId + " and cloud : " + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get version id.
     *
     * @param versionHashId hash id of version
     * @return version Id
     * @throws AppCloudException
     */
    public static int getVersionId(String versionHashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getVersionId(dbConnection, versionHashId, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error occured while getting version id for version hash id : " + versionHashId
                         + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get list of application contexts.
     *
     * @param versionId version id
     * @return List of application contexts
     * @throws AppCloudException
     */
    public static List<String> getApplicationContexts(int versionId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getApplicationContexts(dbConnection, tenantId, versionId);
        } catch (AppCloudException e) {
            String msg = "Error occured while getting application context for version id : " + versionId
                    + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Add application context.
     *
     * @param versionId          version id
     * @param applicationContext application context
     * @throws AppCloudException
     */
    public static void addApplicationContext(int versionId, String applicationContext) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().addApplicationContext(dbConnection, tenantId, versionId, applicationContext);
            dbConnection.commit();
        } catch (AppCloudException e) {
            String msg = "Error while adding application context for versionId : " + versionId +
                    " and applicationContext : " + applicationContext + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } catch (SQLException e) {
            String msg = "Error while committing transaction for adding application context for versionId : " +
                    versionId + " and applicationContext : " + applicationContext + " for tenant id : " + tenantId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get all cloud types
     *
     * @return cloud types
     * @throws AppCloudException
     */
    public static String[] getCloudTypes() throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            List<String> cloudTypes = ApplicationDAO.getInstance().getCloudTypes(dbConnection);
            return cloudTypes.toArray(new String[cloudTypes.size()]);
        } catch (AppCloudException e) {
            String msg = "Error while retrieving cloud types from database";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to check if given environment variable exists
     *
     * @param versionKey     version hash id
     * @param envVariableKey environment variable key
     * @return if the environment variable exists or not
     * @throws AppCloudException
     */
    public static boolean isEnvironmentVariableExist(String versionKey, String envVariableKey)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().
                    isEnvironmentVariableExist(dbConnection, versionKey, envVariableKey, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while checking if environment variable exists for version hash id: " + versionKey +
                    " and tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to check if given tag exists
     *
     * @param versionKey version hash id
     * @param tagKey     tag key
     * @return if the tag exists or not
     * @throws AppCloudException
     */
    public static boolean isTagExist(String versionKey, String tagKey) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().isTagExist(dbConnection, versionKey, tagKey, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while checking if tag exists for version hash id: " + versionKey +
                    " and tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to check if the given version exists in the applications version list
     *
     * @param applicationName application name
     * @param versionName     version name
     * @return if the given version exists or not
     * @throws AppCloudException
     */
    public static boolean isVersionExist(String applicationName, String versionName) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            int matchingVersionCount = ApplicationDAO.getInstance().
                    getMatchingVersionCount(dbConnection, applicationName, versionName, tenantId);
            return (matchingVersionCount > 0);
        } catch (AppCloudException e) {
            String msg = "Error while checking if version exists for application name: " + applicationName +
                    " version name: " + versionName + " and tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to get the exposure level of a given application version
     *
     * @param versionKey version hash id
     * @return exposure level of the given application version
     * @throws AppCloudException
     */
    public static String getExposureLevel(String versionKey) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getExposureLevel(dbConnection, versionKey, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while checking for the exposure level for application version: " + versionKey +
                    " and tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * This method updates the exposure level of a given version
     *
     * @param exposureLevel exposure level to be updated for the given version
     * @param versionKey version hash id
     * @throws AppCloudException
     */
    public static void updateVersionExposureLevel(String exposureLevel, String versionKey) throws  AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().updateVersionExposureLevel(dbConnection, versionKey, tenantId, exposureLevel);
        } catch (AppCloudException e) {
            String msg = "Error while checking for the exposure level for application version: " + versionKey +
                    " and tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to get custom domain details for tenant
     *
     * @return list of custom domain details for all applications of tenant
     * @throws AppCloudException
     */
    public static Application[] getCustomDomainDetailsForTenant() throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            List<Application> applicationDetailsList = ApplicationDAO.getInstance().
                    getCustomDomainDetailsForTenant(dbConnection, tenantId);
            return applicationDetailsList.toArray(new Application[applicationDetailsList.size()]);
        } catch (AppCloudException e) {
            String msg = "Error while getting custom domain details for tenant with tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to check if the custom domain is available
     *
     * @param customDomain custom domain
     * @return if the custom domain is available or not
     * @throws AppCloudException
     */
    public static boolean isCustomDomainAvailable(String customDomain) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().isCustomDomainAvailable(dbConnection, customDomain, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while checking if the custom domain exists for domain: " + customDomain +
                    " for tenant with tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * This method will update the replication count for a given version
     *
     * @param replicaCount replication count to be updated
     * @param versionKey version hash id
     * @throws AppCloudException
     */
    public static void updateReplicationCountForDeployment(int replicaCount, String versionKey) throws  AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            ApplicationDAO.getInstance().updateReplicationCountForDeployment(dbConnection, versionKey, replicaCount, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while updating database for scaling deployment: " + versionKey +
                    " and tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method for get replica existing replica count for a given version
     *
     * @param versionKey version hash id
     * @return current replica count
     * @throws AppCloudException
     */
    public static int getReplicaCountForVersion(String versionKey) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        try {
            return ApplicationDAO.getInstance().getReplicaCountForVersion(dbConnection, versionKey, tenantId);
        } catch (AppCloudException e) {
            String msg = "Error while checking replica count for the application version: " + versionKey +
                    " and tenant id: " + tenantId + ".";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to get subscriotion details
     *
     * @param tenantId  tenant id
     * @param cloudType cloud type
     * @return Subscriotion object
     * @throws AppCloudException
     */
    public static Subscription getSubscription(int tenantId, String cloudType) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getSubscription(dbConnection, tenantId, cloudType);
        } catch (AppCloudException e) {
            String msg = "Error while retrieving subscription info for tenant id : " + tenantId + " and cloud : "
                    + cloudType;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to create new subscription
     *
     * @param subscription subscription object
     * @throws AppCloudException
     */
    public static void addNewSubscription(Subscription subscription) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            ApplicationDAO.getInstance().addSubscription(dbConnection, subscription);
        } catch (AppCloudException e) {
            String msg = "Error while adding subscription for tenant id: " + subscription.getTenantId() + ", cloud : "
                    + subscription.getCloudType();
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Method to update subscription
     *
     * @param subscription subscription object
     * @throws AppCloudException
     */
    public static void updateSubscription(Subscription subscription) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            ApplicationDAO.getInstance().updateSubscription(dbConnection, subscription);
        } catch (AppCloudException e) {
            String msg = "Error while updating subscription for tenant id: " + subscription.getTenantId() + ", cloud : "
                    + subscription.getCloudType();
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get version by hash id
     *
     * @param hashId hash id of version
     * @return version info
     * @throws AppCloudException
     */
    public static Version getVersionByHashId(String hashId) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().getVersionByHashId(dbConnection, hashId);
        } catch (AppCloudException e) {
            String msg = "Error while retrieving version info for version hash id : " + hashId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get allowed container specifications for runtime
     *
     * @param runtimeId id of runtime
     * @return list of container specifications
     * @throws AppCloudException
     */
    public static ContainerSpecification[] getAllowedContainerSpecificationsForRuntime(int runtimeId)
            throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            List<ContainerSpecification> containerSpecifications = ApplicationDAO.getInstance()
                    .getAllowedContainerSpecificationsForRuntime(dbConnection, runtimeId);
            return containerSpecifications.toArray(new ContainerSpecification[containerSpecifications.size()]);
        } catch (AppCloudException e) {
            String msg = "Error while retrieving container specs for runtime id : " + runtimeId;
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get trial application versions by running time period.
     *
     * @param numberOfHours number of hours the application version has been running
     * @return array of version objects
     * @throws AppCloudException
     */
    public static Version[] getTrialApplicationVersionsByRunningTimePeriod(int numberOfHours) throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().
                    getTrialApplicationVersionsByRunningTimePeriod(dbConnection, numberOfHours);
        } catch (AppCloudException e) {
            String msg = "Error while retrieving TRIAL application versions which was created before " + numberOfHours + " hours ";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }

    /**
     * Get application versions which have reached cancel effective date.
     *
     * @return array of version objects
     * @throws AppCloudException
     */
    public static Version[] getApplicationVersionsReachedCancelEffectiveDate() throws AppCloudException {
        Connection dbConnection = DBUtil.getDBConnection();
        try {
            return ApplicationDAO.getInstance().
                    getApplicationVersionsReachedCancelEffectiveDate(dbConnection);
        } catch (AppCloudException e) {
            String msg = "Error while retrieving application versions which have reached cancel effective date";
            log.error(msg, e);
            throw new AppCloudException(msg, e);
        } finally {
            DBUtil.closeConnection(dbConnection);
        }
    }
}


text:
Target/Movies, Music & Books/Books
A Peculiar Indifference - by Elliott Currie (Hardcover)
undefined out of 5 stars with 0 reviews
be the first!be the first! ratings
Genre: Social Science
Sub-Genre: Violence in Society
Publisher: Metropolitan Books
Author: Elliott Currie
Origin: Made in the USA or Imported
"A smart, timely, deeply disturbing and essential book by a veteran scholar and leading expert on the criminal legal system... Currie's book is the first comprehensive study to present a meta-analysis of peer-reviewed research - a study of studies - showing how anti-Black racism in the form of state and private violence upholds 'an essentially exploitative and discriminatory social order.'... This is not a Black crisis but a national emergency."
--Khalil Gibran Muhammad, The New York Times Book Review
"Jaw-dropping... The most powerful takeaway from A Peculiar Indifference is that to prove once and for all that Black lives matter, Americans must stop ignoring the violence devastating Black communities."
--The Progressive
"A damning examination of violence in black America and a call for intervention that is long overdue... Meticulously researched and densely packed with stats and studies, Currie's book paints a heartbreaking picture, but it also makes an urgent case for bold measures to turn the tide in black communities."
--Kirkus Reviews (starred review)
An infuriatingly necessary read . . . What Currie's numbers show is a crisis with no signs of abating. Especially as long as the country turns a blind eye to it.
--PopMatters
"For too many Americans, reports of lethal violence in black communities evoke momentary concern but then are quickly dismissed as incidents that occur in 'those neighborhoods.' Elliott Currie boldly confronts this peculiar indifference, conveying tragic stories of unjust suffering and stunning statistics about the high cost of living in fear. Most important, he debunks any excuses for inaction, presenting ambitious but practical ways to make black lives matter. A distinguished scholar long concerned about crime and racial inequality, Currie has written a compelling book that reflects both his brilliant mind and compassionate heart. Simply put, A Peculiar Indifference is a contemporary classic."
--Francis T. Cullen, past president of the American Society of Criminology
"Elliott Currie writes like James Baldwin and embraces the public morality of William Barber. A Peculiar Indifference brilliantly reminds America of the many economic, education, public health, and criminal justice reforms needed--and proven--to reduce violence, inequality, poverty, and racial injustice. It enjoins the citizenry to seize the day, reframe the public discourse, rewrite the social contract, and acknowledge that 'normal' is the problem."
--Alan Curtis, president of the Eisenhower Foundation
Estimated ship dimensions: 1 inches length x 5.7 inches width x 8.3 inches height
We regret that this item cannot be shipped to PO Boxes.
This item cannot be shipped to the following locations: APO/FPO, Virgin Islands, U.S., United States Minor Outlying Islands, Guam (see also separate entry under GU), Northern Mariana Islands, American Samoa (see also separate entry under AS), Puerto Rico (see also separate entry under PR)

redpajama_set_name: RedPajamaCommonCrawl


In operation is uncertain, particularly whenever your current enterprise will be trying to accomplish its possibilities. If occur to be sick and tired of coping with this particular dilemma and also wish just for much better alternatives, certainly it can time for it to look for for expert support. Enterprise consultants help Philippine businesses improve all their methods and even techniques, helping it to complete far better and even achieve their own targets.
Enterprise consultants assistance businesses for the different elements associated with performing a enterprise. They are instigators connected with change offering exterior parts of look at for providers hunting for alterations. Brokers can certainly either specialise in aiding online companies, small companies, and big establishments.
Their very own operate on start-up is usually to contrast and make strategies at industry projects. Many entrepreneurs might hire these individuals before they make any practices or starting point an party. Once the following occurs, specialists become analysts. Business experts examine enterprise plans together with oversee the way achievable the main plans are usually in relation to help finances, merchandise or program delivered, along with locates place by the would-be business person.
Organization services buy and sell since regulators to be able to check out some part for the businesses. This may perhaps can include inspecting process pertaining to sales, supply manage, expense, as well as promotional and internet marketing systems. Their particular obligation can be to discern trouble patches plus create much better operations.
Consultants may perhaps give rather same methods to large organisations. Even nonetheless numerous great organizations typically only have special alterations regarding systems, in particular when they presume many spots are possessing holdups hindrances impediments as well as slowdowns.
Experts frequently have background objects in internet business obama administration. Several of all of them now do the job or simply until now went all their own businesses. Many, otherwise all, tend to be backed " up " simply by academic testimonials together with hands-on practical experience. These kinds of features are very important while looking with regard to services in order to employ.
Proficiency as well as increased efficiency happen to be the primary advantages offered by companies sending business inquiring. Philippine company proprietors who tried released these kinds of expert services commonly take note ways enhancements released more significant final results. Several owners suddenly found themselves having additional time to need on additional pursuits, as they had the ability to assign give good results effectively. Other individuals record much better staffing of which translates in order to less significant business expense costs regarding salaries as well as overtime repayment. There will be also empire owners commenced having better workflow, getting more source of income leads and even more significant revenue.
Cost depend upon time period and service assigned for business consulting. Filipino businesses in quest of more guidance should count on bigger cost because involving the desire they necessitate out of professionals. Like in the event you need to build up the entire firm so that you can boost deliver the results functions, some might charge a fee higher. This happens since much more people in addition to time attained to solution the project.
In case you're going to hire brokers, be confident to learn their experience and many years in the actual business. Check out fees purchased at different firms engaged with small business consulting. Philippine consultancies' awareness demonstrates on their past together with current clientele so avoid neglect to help always check the, very. Once you've found a agency so that you can get close to with, demand from customers a deal to learn the assistance that you simply receiving.


HONOLULU (AP) — A U.S. judge on Wednesday approved the sale of a home belonging to a retired Honolulu police chief and his former prosecutor wife mired in a corruption investigation.
A buyer is offering more than $1.3 million in cash for Louis and Katherine Kealoha's home in Hawaii Kai, an upscale Honolulu neighborhood. There were multiple offers, said Jonathan Lai, an attorney representing Hawaii Central Federal Credit Union, which filed a foreclosure lawsuit that said the Kealohas weren't paying their mortgage.
The real estate listing said the four-bedroom home "captures island living" with custom travertine floors, renovated kitchen and heated pool.
The Kealohas are central to a wide-ranging corruption investigation that has resulted in an indictment against them and current and former officers alleging they used police resources to frame Katherine's uncle for stealing their home mailbox. Prosecutors say the framing was part of a scheme to cover up financial fraud.
A trial for the mailbox conspiracy has been postponed to May because of Katherine Kealoha's cancer treatment.
That is also pushing back a second trial against the Kealohas on allegations Katherine bilked banks, relatives and others to fund their lavish lifestyle. A magistrate judge Wednesday scheduled that trial for October.
Katherine Kealoha and her pain physician brother are facing another trial after a separate indictment accused them of dealing opioids and using her position as a prosecutor to cover up their crimes.
Targets of the ongoing investigation include high-ranking Honolulu officials.
The Kealohas have pleaded not guilty to all the charges against them.
The Kealohas purchased the four-bedroom home for $1.2 million in 2013.
Before confirming the sale, U.S. District Judge J. Michael Seabright asked if anyone attending the hearing wanted to bid on the house. No hands were raised.
Seabright said he will revisit whether the Kealohas must help pay for their taxpayer-funded defense team, now that they are no longer responsible for the home's mortgage.
Seabright previously approved court-appointed attorneys for the couple because they said they couldn't afford to hire lawyers. Seabright found that the mortgage payments on the Hawaii Kai house ate up most of Louis Kealoha's pension.
The judge said he wants to see updated financial affidavits from the couple.
The sale of the home is scheduled to close on March 29.


Pama is in Burkina Faso. The IATA code (ID) for this city is XPA. The population of Pama is approximately 8 000 people.
Time zone in Pama: 0 GMT. Please keep in mind that airplane tickets show the local departure time, so you will have to set your watch prior to your flight.


The CAMTRI Sprint American Cup is an elite draft-legal triathlon in Richmond, VA. This race is part of the East Coast Triathlon Festival, a full day triathlon event with races for some of the top elites in the world, the top junior elites in the country, and amateur youth athletes.
All elites must register for the race with their National Federation AND register/make payment with the LOC at http://www.endorphinfitness.com/races-eventseast-coast-triathlon-festival/.
Please do your best to register online at https://secure.getmeregistered.com/get_information.php?event_id=131561#top. Registering with LOC at race site is an additional 10 USD and must be completed on Saturday, May 4th between 12-5 pm (BEORE briefing) at the packet pick up tent.
* Each event's awards will immediately follow the conclusion of the event (30-60 minutes after last finisher).
With all options below, mention "East Coast Triathlon Festival Room Block" to get the special rate. Must reserve by 4/2/2019.
Call 804-346-5427 for special rate of $119/night.
Call 804-747-9644 for special rate of $119/night (King Studio) or $129/night (Double Studio); includes breakfast.
Call 804-217-8000 for special rate of $114/night (King Suite) or $119/night (Doubles); includes breakfast.
Homestays available. Contact jill@livered.org by April 16 with dates you need a homestay to be considered. Transportation will not be provided in most cases so please arrange transportation.


The house was newly renovated in 2017. It has triple glass windows that shut out all noises from outside. The public transportation couldn't be any closer as the U-8 is located directly in front of the house.
You will find only high-quality equipment in the apartment. The kitchen counter is made of marble and there's everything you need to cook in the kitchen. There's parquet floor in the whole flat. You will find cozy beds in the two bedrooms which are equipped with high-quality mattresses. There's enough room for up to four people. There's a very large smart tv in the living room. High-speed wi-fi is of course available.
You will be living in the vibrant area of Brunnenviertel in Mitte. You will find all amenities like restaurants, grocery stores, coffee shops and bars in the immediate vicinity of the apartment. You will also be living very close to the very popular Mauerpark, which offers open-air Karaoke on Sundays, and is one of the few parks in the city where you are allowed to have barbecues.


text:
Theater Works
The Me Nobody Knows
Based on the Book "The Me Nobody Knows", Edited by Stephen M. Joseph
Adapted by Robert H. Livingston and Herb Schapiro
Lyrics: Will Holt
Additional Lyrics: Herb Schapiro
Directed by: Robert H. Livingston
Opened off-Broadway in 1970 at the Orpheum Theater and transferred to Broadway at the Helen Hayes and Longacre Theaters.
Cast included Irene Cara, Hattie Winston, Beverly Bremers, Melanie Henderson and Northern Calloway.
Won the OBIE and DRAMA DESK Awards and was nominated for 5 TONY Awards.
Spawned the 5th Dimension hit "Light Sings" and top R&B song "This World", recorded by The Staple Singers.
THE ME NOBODY KNOWS IS AVAILABLE FOR STOCK AND AMATEUR LICENSING THROUGH CONCORD THEATRICALS.
AmazonItunes
Bring in The Morning
Book and Lyrics: Herb Schapiro
Directed by: Sheldon Epps
Opened off-Broadway in 1994 at the Variety Arts Theater. After revisions, it was presented at the Apollo Theater for a limited run. The cast included recording artist Lauren Hill.
BRING IN THE MORNING IS AVAILABLE FOR STOCK AND AMATEUR LICENSING THROUGH MUSIC THEATRE INTERNATIONAL.
Taking My Turn
Conceived and Directed by: Robert H. Livingston
Opened off-Broadway in 1983 at the Entermedia Theater. The cast included Margaret Whiting, Marni Nixon, Tiger Haynes and Cissy Houston.
It won the OUTER CRITICS CIRCLE Award and was featured on the PBS Great Performance Series.
Watch YouTube Playlist of Taking My Turn Celebration Concert at 54Below, NYC March 2020!
TAKING MY TURN IS AVAILABLE FOR STOCK AND AMATEUR LICENSING THROUGH CONCORD THEATRICALS.
Merton of the Movies
Book by Mel Shapiro, Robert Lorick and Stevie Holland
Lyrics: Robert Lorick
Additional Lyrics: Stevie Holland
Originally staged at Carnegie Mellon University and directed by Mel Shapiro, the show has now been revised and updated.
Book and Lyrics: Sharleen Cooper Cohen
Directed and Choreographed by: Tony Stevens
Opened off-Broadway in 1996 at Playhouse 91 to great critical acclaim. It was held over and became the most successful musical in New York Jewish Repertory Theater's 23 year history.
Based on an original idea by Andy Krey
Book and Lyrics: Thomas Mitz
Presented in 2000 for a limited run at St. Luke's Parish Theater in New York, directed by Nancy Rhodes. This inspirational musical featured Stevie Holland as the Angel who inspires Leonardo da Vinci to complete the famous mural. It continues to be performed in regional theaters each Lent season. (www.lastsuppermusical.com)
THE LAST SUPPER IS AVAILABLE FOR STOCK AND AMATEUR LICENSING THROUGH CONCORD THEATRICALS.
Love Linda
Book by Stevie Holland with Gary William Friedman
Lyrics and Music: Cole Porter
Arrangements and Additional Music: Gary William Friedman
Love, Linda tells the story of Linda Lee Thomas, the Southern beauty who married and was a driving force behind legendary songwriter Cole Porter at the dawn of the roaring twenties. The show enjoyed a successful off-Broadway premiere in 2013-14 at the York Theatre, starring acclaimed jazz vocalist Stevie Holland, and directed by TONY award-winning Richard Maltby, JR.
It was filmed in 2021 and can be streamed at BroadwayHD / Amazon Prime.
LOVE, LINDA IS AVAILABLE FOR WORLDWIDE LICENSING THROUGH CONCORD THEATRICALS.
Platinum Dreams
Book: Stevie Holland
Adapted from Sunset by Will Holt and Platinum by Will Holt and Bruce Vilanch
Platinum Dreams was conceived utilizing the scores from Platinum and Sunset (plus new songs by Holland and Friedman).
Sunset opened at the Arena Stage in Buffalo in 1977 directed by Tommy Tune, starring Alexis Smith. It was then re-titled Platinum.
After revisions, it opened on Broadway in 1978 at the Mark Hellinger Theater still starring Alexis Smith but directed by Joe Layton. After the Platinum run, it was re-titled Sunset and presented off-Broadway starring Tammy Grimes.
Platinum Dreams will have a world premiere concert presentation at 54Below in NYC in January 2023.
Additional Theatre Works
Book by Sherman Yellen
Presented at Theatre Three, Port Jefferson, NY.
Winner of 2012 Broadway World LI Award Best Musical
By: Joshua Sobol
Adapted by: Jack Viertal
English Lyrics: Sheldon Harnick & Jim Friedman
Directed by: Gordon Davidson
Opened in the 1986 season at the Mark Taper Forum in Los Angeles. Authentic songs from the Vilna Ghetto were arranged and conducted by Gary William Friedman along with his original music. The cast included Andrea Marcovicci, David Wohl and Harry Groener.
RUMPLESTILTSKIN
Book and Lyrics: Ross Yockey
A children's musical which had its world premiere in 1992 at the Lancaster Music Festival in Ohio.
WALKING PAPERS
Book and Lyrics: Sandra Hochman
Presented at Circle in The Square, NYC. Directed by Ted Mann in 1976.
Book by Edward Gallardo
Lyrics: Edward Gallardo
A musical about two emotionally challenged youths and the world of NYC bicycle messengers. Premiered at the NYMF in 2007.
THE APPRENTICESHIP OF DUDDY KRAVITZ
Yiddish Musical Adaptation
Presented at the Dora Wasserman Yiddish Theatre in Montreal 1997.
LAUGH A LITTLE, CRY A LITTLE
Book and Lyrics: Arnold Horwitt
Presented in a National Tour, starring Jan Pierce in 1974.
Gary William Friedman
TheaterClassicalFilmThe Electric CompanyRecordingsListen
VideosContact
© 2022 Gary William Friedman and 150 Music


Vasai-Virar City Municipal Corporation (VVCMC) published recruitment notice on their official website. There are 135 vacancies for the posts of Gynecologist, Pediatrician, Physician, Surgeon, Radiologist, Anesthetist, Nephrologist, Medical Officer (MBBS) and so on. The details eligibility and application process are given & mentioned in below.
वसई-विरार सिटी महानगरपालिका (व्हीव्हीसीएमसी) ने त्यांच्या अधिकृत वेबसाइटवर भर्ती नोटिस प्रकाशित केले. हे पार्वघर जिल्ह्यातील सर्वाधिक लोकसंख्येच्या भाग असलेल्या पश्चिम भारतातील महाराष्ट्र राज्यातील वसई-विरार तहसीलमधील क्षेत्र आणि गावांना प्रशासित करते. हा मुंबईचा विस्तारित उपनगर आहे. स्त्री रोग विशेषज्ञ, बालरोगतज्ञ, फिजिशियन, सर्जन, रेडिओलॉजिस्ट, ऍनेस्थेटिस्ट, नेफोलॉजिस्ट, मेडिकल ऑफिसर (एमबीबीएस), पीएचएन (पब्लिक हेल्थ नर्स), जीएनएम (नर्स) एएनएम, फार्मासिस्ट, प्रयोगशाळा सहाय्यक आणि एक्स-रे सहाय्यकांच्या पदांसाठी 135 जागा आहेत. पोस्ट्स या पोस्टसाठी वॉक-इन मुलाखत आयोजित केली गेली आहे आणि दिनांक 28 जानेवारी 2019 आणि 29 जानेवारी 2019 आहेत. पुढील पत्ता वॉच-इन मुलाखतीसाठी दिलेला आहे. या पोस्टसाठी स्वारस्य असलेल्या आणि त्यानुसार पात्रता निकषांनुसार त्यांनी सबमिट केले पाहिजे तेथे फॉर्म आहेत. खाली पात्रता आणि अर्जाची प्रक्रिया खाली दिलेली आहे.
नाव पद: स्त्री रोग विशेषज्ञ, बालरोगतज्ज्ञ, फिजिशियन, सर्जन, रेडिओलॉजिस्ट, ऍनेस्थेटिस्ट, नेफोलॉजिस्ट, मेडिकल ऑफिसर (एमबीबीएस), पीएचएन (पब्लिक हेल्थ नर्स), जीएनएम (नर्स) एएनएम, फार्मासिस्ट, प्रयोगशाळा सहाय्यक आणि एक्स-रे सहाय्यक पोस्ट.
Vasai-Virar City Municipal Corporation (VVCMC) published recruitment notice on their official website(vvcmc.in/vvmc/). It is the civic body that governs areas and villages in Vasai-Virar tehsil in Maharashtra state, western India comprising the most populated part of Palghar district. It is an extended suburb of Mumbai. There are 135 vacancies for the posts of Gynecologist, Pediatrician, Physician, Surgeon, Radiologist, Anesthetist, Nephrologist, Medical Officer (MBBS), PHN (Public Health Nurse), GNM (Nurse) ANM, Pharmacist, Laboratory Assistant and X-Ray Assistant Posts. The walk-in interview is conduct for this posts and the dates are 28th January 2019 and 29th January 2019. The following address is given for the walk-in interview.Those who are interested for this posts and according to they eligibility criteria they should submit there forms. The details eligibility and application process are given & mentioned in below.
Name Posts : Gynecologist, Pediatrician, Physician, Surgeon, Radiologist, Anesthetist, Nephrologist, Medical Officer (MBBS), PHN (Public Health Nurse), GNM (Nurse) ANM, Pharmacist, Laboratory Assistant and X-Ray Assistant Posts.
Address: Vasai-Virar City Municipal Corporation, 4th Floor, Municipal Multipurpose Building, Ward Committee, 'C' office, Virar (East).