http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/services/AccountMgtService.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/services/AccountMgtService.java b/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/services/AccountMgtService.java deleted file mode 100644 index 22835cc..0000000 --- a/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/services/AccountMgtService.java +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.account.mgt.services; - -import org.wso2.carbon.core.AbstractAdmin; -import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber; -import org.wso2.carbon.registry.core.RegistryConstants; -import org.wso2.carbon.registry.core.Resource; -import org.wso2.carbon.registry.core.session.UserRegistry; -import org.wso2.carbon.registry.core.utils.UUIDGenerator; -import org.apache.stratos.common.beans.TenantInfoBean; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.common.util.ClaimsMgtUtil; -import org.apache.stratos.common.util.CommonUtil; -import org.wso2.carbon.tenant.mgt.util.TenantMgtUtil; -import org.wso2.carbon.user.core.UserCoreConstants; -import org.wso2.carbon.user.core.UserStoreException; -import org.wso2.carbon.user.core.UserStoreManager; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.user.core.tenant.Tenant; -import org.wso2.carbon.user.core.tenant.TenantManager; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.account.mgt.beans.AccountInfoBean; -import org.apache.stratos.account.mgt.util.Util; - -import java.util.HashMap; -import java.util.Map; - -/** - * Account Management Service Class - */ -public class AccountMgtService extends AbstractAdmin { - private static final Log log = LogFactory.getLog(AccountMgtService.class); - - /** - * Updates the contact email. - * - * @param contactEmail email - * @throws Exception, if update contact failed. - */ - public void updateContact(String contactEmail) throws Exception { - EmailVerifcationSubscriber emailverifier = Util.getEmailVerificationService(); - - TenantManager tenantManager = Util.getTenantManager(); - UserRegistry registry = (UserRegistry) getGovernanceRegistry(); - if (registry == null) { - // we can't continue without having a valid registry in the session - String msg = "Error in retrieving the registry for the login tenant."; - log.error(msg); - throw new Exception(msg); - } - int tenantId = registry.getTenantId(); - - Tenant tenant; - try { - tenant = (Tenant) tenantManager.getTenant(tenantId); - } catch (UserStoreException e) { - String msg = "Error in retrieving the tenant information for the tenant id: " + - tenantId + "."; - log.error(msg, e); - throw new Exception(msg, e); - } - - // generating the confirmation key - String confirmationKey = UUIDGenerator.generateUUID(); - UserRegistry superTenantSystemRegistry = - Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID); - Resource resource; - String emailVerificationPath = StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH + - RegistryConstants.PATH_SEPARATOR + tenantId; - if (superTenantSystemRegistry.resourceExists(emailVerificationPath)) { - resource = superTenantSystemRegistry.get(emailVerificationPath); - } else { - resource = superTenantSystemRegistry.newResource(); - } - resource.setContent(confirmationKey); - superTenantSystemRegistry.put(emailVerificationPath, resource); - - try { - Map<String, String> datatostore = new HashMap<String, String>(); - datatostore.put("first-name", - ClaimsMgtUtil.getFirstName(Util.getRealmService(), tenantId)); - datatostore.put("email", contactEmail); - datatostore.put("userName", tenant.getAdminName()); - datatostore.put("tenantDomain", tenant.getDomain()); - datatostore.put("confirmationKey", confirmationKey); - emailverifier.requestUserVerification(datatostore, Util.getEmailVerifierConfig()); - } catch (Exception e) { - String msg = "Error in adding tenant, tenant domain: " + tenant.getDomain() + "."; - log.error(msg); - throw new Exception(msg, e); - } - } - - /** - * gets the contact of the tenant admin - * - * @throws Exception, if getting the contact email address failed. - * @return, the contact email address - */ - public String getContact() throws Exception { - TenantManager tenantManager = Util.getTenantManager(); - UserRegistry registry = (UserRegistry) getGovernanceRegistry(); - if (registry == null) { - // we can't continue without having a valid registry in the session - String msg = "Error in retrieving the registry for the login tenant."; - log.error(msg); - throw new Exception(msg); - } - int tenantId = registry.getTenantId(); - // get the tenant information from the tenant manager - Tenant tenant; - try { - tenant = (Tenant) tenantManager.getTenant(tenantId); - } catch (UserStoreException e) { - String msg = "Error in retrieving the tenant information for the tenant id: " + - tenantId + "."; - log.error(msg, e); - throw new Exception(msg, e); - } - return tenant.getEmail(); - } - - /** - * Updates the fullname information - * - * @param accountInfoBean profile information stored in AccountInfoBean - * @return true, if updated successfully. - * @throws Exception UserStoreException. - */ - public boolean updateFullname(AccountInfoBean accountInfoBean) throws Exception { - TenantManager tenantManager = Util.getTenantManager(); - UserRegistry registry = (UserRegistry) getGovernanceRegistry(); - if (registry == null) { - // we can't continue without having a valid registry in the session - String msg = "Error in retrieving the registry for the login tenant."; - log.error(msg); - throw new Exception(msg); - } - int tenantId = registry.getTenantId(); - // get the tenant information from the tenant manager - Tenant tenant; - try { - tenant = (Tenant) tenantManager.getTenant(tenantId); - } catch (UserStoreException e) { - String msg = "Error in retrieving the tenant information for the tenant id: " + - tenantId + "."; - log.info(msg, e); - throw new Exception(msg, e); - } - RealmService realmService = Util.getRealmService(); - try { - Map<String, String> claimsMap = new HashMap<String, String>(); - claimsMap.put(UserCoreConstants.ClaimTypeURIs.GIVEN_NAME, accountInfoBean.getFirstName()); - claimsMap.put(UserCoreConstants.ClaimTypeURIs.SURNAME, accountInfoBean.getLastName()); - UserStoreManager userStoreManager = (UserStoreManager) realmService.getTenantUserRealm(tenantId) - .getUserStoreManager(); - userStoreManager.setUserClaimValues(ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId), - claimsMap, UserCoreConstants.DEFAULT_PROFILE); - log.info("FirstName: " + accountInfoBean.getFirstName() + " of the tenant " + tenant.getDomain() + " has " + - "been updated to the tenant admin " + ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, - tenantId) + " of " + tenant.getDomain()); - - //Notify tenant update to all listeners - TenantInfoBean tenantInfoBean = new TenantInfoBean(); - tenantInfoBean.setTenantId(tenantId); - tenantInfoBean.setFirstName(accountInfoBean.getFirstName()); - tenantInfoBean.setLastName(accountInfoBean.getLastName()); - Util.alertTenantUpdate(tenantInfoBean); - - return true; - } catch (Exception e) { - // this is expected, as many users haven't given their fullnames - // during their registration. - String msg = - "Error in updating first name: " + accountInfoBean.getFirstName() + - " for the tenant admin: " + - ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId); - log.info(msg); - throw new Exception(msg, e); - } - } - - /** - * gets the profile information - saved as claims - - * currently saved claims are first name and last name - hence the profile so far is a fullname. - * - * @return AccountInfoBean - Currently depicts the fullname as an object. - * @throws Exception, UserStoreException - */ - public AccountInfoBean getFullname() throws Exception { - - String firstname = "", lastname = ""; - TenantManager tenantManager = Util.getTenantManager(); - UserRegistry registry = (UserRegistry) getGovernanceRegistry(); - if (registry == null) { - // we can't continue without having a valid registry in the session - String msg = "Error in retrieving the registry for the login tenant."; - log.error(msg); - throw new Exception(msg); - } - int tenantId = registry.getTenantId(); - // get the tenant information from the tenant manager - Tenant tenant; - try { - tenant = (Tenant) tenantManager.getTenant(tenantId); - } catch (UserStoreException e) { - String msg = "Error in retrieving the tenant information for the tenant id: " + - tenantId + "."; - log.info(msg, e); - throw new Exception(msg, e); - } - - // getting the other parameters from the claims. - try { - firstname = ClaimsMgtUtil.getFirstName(Util.getRealmService(), tenantId); - - } catch (Exception e) { - String msg = "Error in retrieving the firstname for the admin of the domain " + - tenant.getDomain(); - log.info(msg); - } - try { - lastname = ClaimsMgtUtil.getLastName(Util.getRealmService(), tenantId); - } catch (Exception e) { - // this is expected, as many users haven't given their lastnames - // during their registration. - String msg = "Error in retrieving the Lastname for the admin of the domain " + - tenant.getDomain(); - log.info(msg); - } - - AccountInfoBean accountInfoBean = new AccountInfoBean(); - accountInfoBean.setFirstName(firstname); - accountInfoBean.setLastName(lastname); - return accountInfoBean; - } - - - /** - * deactivates the tenant - * - * @throws Exception, if deactivating the tenant failed. - */ - public void deactivate() throws Exception { - // The one who have a proper permission will be able to deactivate the tenant. - TenantManager tenantManager = Util.getTenantManager(); - UserRegistry registry = (UserRegistry) getGovernanceRegistry(); - if (registry == null) { - // we can't continue without having a valid registry in the session - String msg = "Error in retrieving the registry for the login tenant."; - log.error(msg); - throw new Exception(msg); - } - int tenantId = registry.getTenantId(); - try { - tenantManager.deactivateTenant(tenantId); - } catch (UserStoreException e) { - String msg = "Error in deactivating the tenant id: " + tenantId + "."; - log.error(msg, e); - throw new Exception(msg, e); - } - - //Notify tenant deactivation to Listeners - Util.alertTenantDeactivation(tenantId); - } - - /** - * checks whether the domain is validated. - * - * @return true, if the domain has been validated. - * @throws Exception, if the domain validation failed. - */ - public boolean isDomainValidated() throws Exception { - // first we will get the current domain name - TenantManager tenantManager = Util.getTenantManager(); - UserRegistry registry = (UserRegistry) getGovernanceRegistry(); - if (registry == null) { - // we can't continue without having a valid registry in the session - String msg = "Error in retrieving the registry for the login tenant."; - log.error(msg); - throw new Exception(msg); - } - int tenantId = registry.getTenantId(); - // get the tenant information from the tenant manager - Tenant tenant; - try { - tenant = (Tenant) tenantManager.getTenant(tenantId); - } catch (UserStoreException e) { - String msg = "Error in retrieving the tenant information for the tenant id: " + - tenantId + "."; - log.error(msg, e); - throw new Exception(msg, e); - } - String domainName = tenant.getDomain(); - TenantMgtUtil.validateDomain(domainName); - - String domainValidationPath = StratosConstants.TENANT_DOMAIN_VERIFICATION_FLAG_PATH + - RegistryConstants.PATH_SEPARATOR + tenantId; - UserRegistry superTenantRegistry = Util.getGovernanceSystemRegistry( - MultitenantConstants.SUPER_TENANT_ID); - if (superTenantRegistry.resourceExists(domainValidationPath)) { - Resource validationFlagR = superTenantRegistry.get(domainValidationPath); - return "true".equals(validationFlagR.getProperty(domainName)); - } - return false; - } - - /** - * If the domain validation has been completed. - * - * @param validatedDomain the domain being validated. - * @param successKey success key - * @return true, if the domain has been validated successfully. - * @throws Exception, if the domain validation failed. - */ - public boolean finishedDomainValidation( - String validatedDomain, String successKey) throws Exception { - // create a flag on domain validation, so that we can move the content - // of the current domain name to the new validated domain name - if (!CommonUtil.validateDomainFromSuccessKey(Util.getGovernanceSystemRegistry( - MultitenantConstants.SUPER_TENANT_ID), validatedDomain, successKey)) { - String msg = "Domain: " + validatedDomain + " is not validated against successKey: " + - successKey + "."; - log.error(msg); - throw new Exception(msg); - } - - // we keep an entry about domain validation here. - - // first we will get the current domain name - UserRegistry registry = (UserRegistry) getGovernanceRegistry(); - if (registry == null) { - // we can't continue without having a valid registry in the session - String msg = "Error in retrieving the registry for the login tenant."; - log.error(msg); - throw new Exception(msg); - } - int tenantId = registry.getTenantId(); - - // keep the domain validation path. - - String domainValidationPath = StratosConstants.TENANT_DOMAIN_VERIFICATION_FLAG_PATH + - RegistryConstants.PATH_SEPARATOR + tenantId; - UserRegistry superTenantRegistry = - Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID); - Resource validationFlagR = superTenantRegistry.newResource(); - validationFlagR.setProperty(validatedDomain, "true"); - superTenantRegistry.put(domainValidationPath, validationFlagR); - - return true; - } - - /** - * Check whether the domain is available. - * - * @param domainName domain name - * @return true, if the domain is available to register. - * @throws Exception, if the domain validation failed. - */ - public boolean checkDomainAvailability(String domainName) throws Exception { - TenantManager tenantManager = Util.getTenantManager(); - int tenantId = tenantManager.getTenantId(domainName); - return tenantId < 0; - } - - /** - * check whether the email has been validated. - * - * @throws Exception, if the validation failed. - * @return, true if already validated. - */ - public boolean isEmailValidated() throws Exception { - UserRegistry userRegistry = (UserRegistry) getGovernanceRegistry(); - if (userRegistry.getTenantId() == MultitenantConstants.SUPER_TENANT_ID) { - // no email validation step required for super tenant - return true; - } - - String email = getContact(); - UserRegistry superTenantSystemRegistry = - Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID); - String emailVerificationPath = StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH + - RegistryConstants.PATH_SEPARATOR + - userRegistry.getTenantId(); - if (!superTenantSystemRegistry.resourceExists(emailVerificationPath)) { - // the confirmation key should exist,otherwise fail registration - return false; - } - Resource resource = superTenantSystemRegistry.get(emailVerificationPath); - - return "true".equals(resource.getProperty(email)); - } -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/services/EmailValidationService.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/services/EmailValidationService.java b/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/services/EmailValidationService.java deleted file mode 100644 index 4f50d87..0000000 --- a/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/services/EmailValidationService.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.account.mgt.services; - -import org.wso2.carbon.registry.core.RegistryConstants; -import org.wso2.carbon.registry.core.Resource; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.registry.core.session.UserRegistry; -import org.apache.stratos.common.beans.TenantInfoBean; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.common.util.CommonUtil; -import org.wso2.carbon.user.api.Tenant; -import org.wso2.carbon.user.core.UserStoreException; -import org.wso2.carbon.user.core.tenant.TenantManager; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.account.mgt.internal.AccountMgtServiceComponent; -import org.apache.stratos.account.mgt.util.Util; - -/** - * Email Validation Service - */ -public class EmailValidationService { - private static final Log log = LogFactory.getLog(EmailValidationService.class); - - /** - * Proceed updating the contact email address - * - * @param domain tenant domain - * @param email email address - * @param confirmationKey confirmation key. - * @throws Exception, RegistryException. - */ - public void proceedUpdateContact(String domain, String email, String confirmationKey) - throws Exception { - - TenantManager tenantManager = Util.getTenantManager(); - int tenantId; - - try { - tenantId = tenantManager.getTenantId(domain); - } catch (UserStoreException e) { - String msg = "Error in adding tenant, tenant domain: " + domain + "."; - log.error(msg); - throw new RegistryException(msg, e); - } - - UserRegistry superTenantSystemRegistry = Util.getGovernanceSystemRegistry( - MultitenantConstants.SUPER_TENANT_ID); - String emailVerificationPath = - StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH + - RegistryConstants.PATH_SEPARATOR + tenantId; - if (!superTenantSystemRegistry.resourceExists(emailVerificationPath)) { - // the confirmation key should exist,otherwise fail registraion - String msg = "The confirmationKey doesn't exist in service."; - log.error(msg); - throw new RegistryException(msg); - } - Resource resource = superTenantSystemRegistry.get(emailVerificationPath); - String actualConfirmationKey = null; - Object content = resource.getContent(); - if (content instanceof String) { - actualConfirmationKey = (String) content; - } else if (content instanceof byte[]) { - actualConfirmationKey = new String((byte[]) content); - } - - if (actualConfirmationKey == null || !actualConfirmationKey.equals(confirmationKey)) { - // validation will fail. - String msg = "The email confirmation key is not matching"; - log.error(msg); - throw new RegistryException(msg); - } - - resource.setProperty(email, "true"); - - // now we will really update the tenant email - Tenant tenant; - try { - tenant = tenantManager.getTenant(tenantId); - } catch (UserStoreException e) { - String msg = - "Error in retrieving the tenant information for the tenant id: " + tenantId + - "."; - log.error(msg, e); - throw new RegistryException(msg, e); - } - - // If TenantActivation is moderated, the mail address associated with the validation link - // would not be the tenant email. Otherwise, the validation mail would be the tenant email. - if (!CommonUtil.isTenantActivationModerated()) { - tenant.setEmail(email); - } - - try { - tenantManager.updateTenant(tenant); - } catch (UserStoreException e) { - String msg = - "Error in updating the tenant information for the tenant id: " + tenantId + "."; - log.error(msg, e); - throw new RegistryException(msg, e); - } - - // activate the tenant on successful validation of the email, if it is not already activated. - if ("false".equals(resource.getProperty(StratosConstants.IS_EMAIL_VALIDATED))) { - tenantManager.activateTenant(tenantId); - // set the registry flag - resource.editPropertyValue(StratosConstants.IS_EMAIL_VALIDATED, "false", "true"); - - if (log.isDebugEnabled()) { - log.debug("Tenant : " + tenantId + " is activated after validating the " + - "email of the tenant admin."); - } - - //Notify all the listeners that tenant has been activated for the first time - Util.alertTenantInitialActivation(tenantId); - - //Activating the usage plan - try{ - AccountMgtServiceComponent.getBillingService().activateUsagePlan(domain); - }catch(Exception e){ - log.error("Error occurred while activating the usage plan for tenant: " + domain - + " tenant Id: " + tenantId, e); - } - - } - - //This is considered an update. Hence notify the update to all listeners - TenantInfoBean tenantInfoBean = new TenantInfoBean(); - tenantInfoBean.setTenantId(tenantId); - tenantInfoBean.setTenantDomain(domain); - tenantInfoBean.setEmail(email); - Util.alertTenantUpdate(tenantInfoBean); - - // update the registry - superTenantSystemRegistry.put(emailVerificationPath, resource); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/util/Util.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/util/Util.java b/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/util/Util.java deleted file mode 100644 index df45f7c..0000000 --- a/components/org.apache.stratos.account.mgt/src/main/java/org/apache/stratos/account/mgt/util/Util.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.stratos.account.mgt.util; - -import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber; -import org.wso2.carbon.email.verification.util.EmailVerifierConfig; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.registry.core.service.RegistryService; -import org.wso2.carbon.registry.core.session.UserRegistry; -import org.apache.stratos.common.beans.TenantInfoBean; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.common.exception.ApacheStratosException; -import org.apache.stratos.common.listeners.TenantMgtListener; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.user.core.tenant.TenantManager; -import org.wso2.carbon.utils.CarbonUtils; - -import org.apache.axis2.context.MessageContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; - -/** - * Util methods for AccountMgt - */ -public class Util { - - private static final Log log = LogFactory.getLog(Util.class); - - private static RegistryService registryService; - private static RealmService realmService; - private static EmailVerifcationSubscriber emailVerificationService = null; - private static EmailVerifierConfig emailVerifierConfig = null; - private static List<TenantMgtListener> tenantMgtListeners = new ArrayList<TenantMgtListener>(); - - public static synchronized void setRegistryService(RegistryService service) { - if (registryService == null) { - registryService = service; - } - } - - - public static RealmService getRealmService() { - return realmService; - } - - - public static RegistryService getRegistryService() { - return registryService; - } - - public static synchronized void setEmailVerificationService(EmailVerifcationSubscriber service) { - if (emailVerificationService == null) { - emailVerificationService = service; - } - } - - public static EmailVerifcationSubscriber getEmailVerificationService() { - return emailVerificationService; - } - - - public static synchronized void setRealmService(RealmService service) { - if (realmService == null) { - realmService = service; - } - } - - - public static TenantManager getTenantManager() { - return realmService.getTenantManager(); - } - - public static UserRegistry getGovernanceSystemRegistry(int tenantId) throws RegistryException { - return registryService.getGovernanceSystemRegistry(tenantId); - } - - public static HttpSession getRequestSession() throws RegistryException { - MessageContext messageContext = MessageContext.getCurrentMessageContext(); - if (messageContext == null) { - String msg = "Could not get the user's session. Message context not found."; - log.error(msg); - throw new RegistryException(msg); - } - - HttpServletRequest request = - (HttpServletRequest) messageContext.getProperty("transport.http.servletRequest"); - - return request.getSession(); - } - - public static void loadEmailVerificationConfig() { - String configXml = CarbonUtils.getCarbonConfigDirPath()+ File.separator - + StratosConstants.EMAIL_CONFIG +File.separator +"email-update.xml"; - emailVerifierConfig = org.wso2.carbon.email.verification.util.Util.loadeMailVerificationConfig(configXml); - } - - public static EmailVerifierConfig getEmailVerifierConfig() { - return emailVerifierConfig; - } - - public static void addTenantMgtListenerService(TenantMgtListener tenantMgtListener) { - tenantMgtListeners.add(tenantMgtListener); - sortTenantMgtListeners(); - } - - public static void removeTenantMgtListenerService(TenantMgtListener tenantMgtListener) { - tenantMgtListeners.remove(tenantMgtListener); - sortTenantMgtListeners(); - } - - private static void sortTenantMgtListeners() { - Collections.sort(tenantMgtListeners, new Comparator<TenantMgtListener>() { - public int compare(TenantMgtListener o1, TenantMgtListener o2) { - return o1.getListenerOrder() - o2.getListenerOrder(); - } - }); - } - - public static void alertTenantRenames(int tenantId, String oldName, - String newName) throws ApacheStratosException { - - for (TenantMgtListener tenantMgtLister : tenantMgtListeners) { - tenantMgtLister.onTenantRename(tenantId, oldName, newName); - } - } - - public static void alertTenantDeactivation(int tenantId) throws ApacheStratosException { - - for (TenantMgtListener tenantMgtLister : tenantMgtListeners) { - tenantMgtLister.onTenantDeactivation(tenantId); - } - } - - public static void alertTenantInitialActivation(int tenantId) throws ApacheStratosException { - - for (TenantMgtListener tenantMgtLister : tenantMgtListeners) { - tenantMgtLister.onTenantInitialActivation(tenantId); - } - } - - public static void alertTenantUpdate(TenantInfoBean tenantInfoBean) throws ApacheStratosException { - - for (TenantMgtListener tenantMgtLister : tenantMgtListeners) { - tenantMgtLister.onTenantUpdate(tenantInfoBean); - } - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.account.mgt/src/main/resources/META-INF/component.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.account.mgt/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.account.mgt/src/main/resources/META-INF/component.xml deleted file mode 100644 index 822b6b9..0000000 --- a/components/org.apache.stratos.account.mgt/src/main/resources/META-INF/component.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - # Licensed to the Apache Software Foundation (ASF) under one - # or more contributor license agreements. See the NOTICE file - # distributed with this work for additional information - # regarding copyright ownership. The ASF licenses this file - # to you under the Apache License, Version 2.0 (the - # "License"); you may not use this file except in compliance - # with the License. You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, - # software distributed under the License is distributed on an - # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - # KIND, either express or implied. See the License for the - # specific language governing permissions and limitations - # under the License. - --> -<component xmlns="http://products.wso2.org/carbon"> - <ManagementPermissions> - <ManagementPermission> - <DisplayName>Configure</DisplayName> - <ResourceId>/permission/admin/configure</ResourceId> - </ManagementPermission> - <ManagementPermission> - <DisplayName>Account</DisplayName> - <ResourceId>/permission/admin/configure/account</ResourceId> - </ManagementPermission> - </ManagementPermissions> -</component> http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.account.mgt/src/main/resources/META-INF/services.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.account.mgt/src/main/resources/META-INF/services.xml b/components/org.apache.stratos.account.mgt/src/main/resources/META-INF/services.xml deleted file mode 100644 index df0ab98..0000000 --- a/components/org.apache.stratos.account.mgt/src/main/resources/META-INF/services.xml +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - # Licensed to the Apache Software Foundation (ASF) under one - # or more contributor license agreements. See the NOTICE file - # distributed with this work for additional information - # regarding copyright ownership. The ASF licenses this file - # to you under the Apache License, Version 2.0 (the - # "License"); you may not use this file except in compliance - # with the License. You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, - # software distributed under the License is distributed on an - # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - # KIND, either express or implied. See the License for the - # specific language governing permissions and limitations - # under the License. - --> -<serviceGroup> - - <service name="AccountMgtService" scope="transportsession"> - <transports> - <transport>https</transport> - </transports> - <parameter name="ServiceClass" locked="false"> - org.apache.stratos.account.mgt.services.AccountMgtService - </parameter> - - <operation name="updateContact"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - - <operation name="getContact"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - - <operation name="updateFullname"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - - <operation name="getFullname"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - - <operation name="deactivate"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - - <operation name="isDomainValidated"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - - <operation name="finishedDomainValidation"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - - <operation name="checkDomainAvailability"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - - <operation name="isEmailValidated"> - <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter> - </operation> - <parameter name="adminService" locked="true">true</parameter> - </service> - - <service name="EmailValidationService" scope="transportsession"> - <transports> - <transport>https</transport> - </transports> - <parameter name="ServiceClass" locked="false"> - org.apache.stratos.account.mgt.services.EmailValidationService - </parameter> - - <operation name="proceedUpdateContact"> - </operation> - </service> - - <parameter name="hiddenService" locked="true">true</parameter> - -</serviceGroup> http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/pom.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/pom.xml b/components/org.apache.stratos.tenant.activity.ui/pom.xml deleted file mode 100644 index 91a7861..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/pom.xml +++ /dev/null @@ -1,133 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.apache.stratos</groupId> - <artifactId>stratos-components-parent</artifactId> - <version>4.1.0-SNAPSHOT</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>org.apache.stratos.tenant.activity.ui</artifactId> - <packaging>bundle</packaging> - <name>Apache Stratos - Tenant Activity - User Interface</name> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <version>1.4.0</version> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> - <Bundle-Name>${project.artifactId}</Bundle-Name> - <Private-Package> - org.apache.stratos.tenant.activity.ui.internal.*, - </Private-Package> - <Export-Package> - org.apache.stratos.tenant.activity.ui.*, - </Export-Package> - <Import-Package> - org.apache.stratos.tenant.activity.stub.*; - version="${carbon.platform.package.import.version.range}", - org.apache.stratos.common.*, - javax.servlet;version="${imp.pkg.version.javax.servlet}", - javax.servlet.http;version="${imp.pkg.version.javax.servlet}", - !javax.xml.namespace, - javax.xml.namespace; version=0.0.0, - org.apache.lucene.*, - *;resolution:=optional - </Import-Package> - <Carbon-Component>UIBundle</Carbon-Component> - </instructions> - </configuration> - </plugin> - - </plugins> - </build> - - <dependencies> - - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </dependency> - <dependency> - <groupId>commons-codec.wso2</groupId> - <artifactId>commons-codec</artifactId> - <version>${version.commons.codec}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.registry.common.ui</artifactId> - <version>${wso2carbon.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.registry.core</artifactId> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - <dependency> - <groupId>org.eclipse.equinox</groupId> - <artifactId>javax.servlet</artifactId> - <version>3.0.0.v201112011016</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.axis2.wso2</groupId> - <artifactId>axis2</artifactId> - </dependency> - <dependency> - <groupId>org.apache.ws.commons.axiom.wso2</groupId> - <artifactId>axiom</artifactId> - <version>${axiom.wso2.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.ui</artifactId> - <version>${wso2carbon.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.stratos</groupId> - <artifactId>org.apache.stratos.common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.stratos</groupId> - <artifactId>org.apache.stratos.tenant.activity.stub</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <properties> - <version.commons.codec>1.4.0.wso2v1</version.commons.codec> - </properties> - -</project> http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/clients/TenantActivityServiceClient.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/clients/TenantActivityServiceClient.java b/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/clients/TenantActivityServiceClient.java deleted file mode 100644 index 554bb37..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/clients/TenantActivityServiceClient.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.tenant.activity.ui.clients; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.client.Options; -import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.authenticator.proxy.AuthenticationAdminClient; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.apache.stratos.tenant.activity.stub.TenantActivityServiceExceptionException; -import org.apache.stratos.tenant.activity.stub.beans.xsd.*; -import org.apache.stratos.tenant.activity.ui.internal.TenantActivityUIServiceComponent; -import org.wso2.carbon.ui.CarbonUIUtil; -import org.wso2.carbon.user.core.UserStoreException; -import org.wso2.carbon.utils.ServerConstants; -import org.apache.stratos.tenant.activity.stub.TenantActivityServiceStub; - -import javax.servlet.ServletConfig; -import javax.servlet.http.HttpSession; -import java.rmi.RemoteException; - -public class TenantActivityServiceClient { - private static final Log log = LogFactory.getLog(TenantActivityServiceClient.class); - - private TenantActivityServiceStub stub; - private String epr; - - - public TenantActivityServiceClient( - String cookie, String backendServerURL, ConfigurationContext configContext) - throws RegistryException { - - epr = backendServerURL + "TenantMonitorService"; - - try { - stub = new TenantActivityServiceStub(configContext, epr); - ServiceClient client = stub._getServiceClient(); - Options option = client.getOptions(); - option.setManageSession(true); - option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); - - } catch (AxisFault axisFault) { - String msg = "Failed to initiate TenantMonitorService service client. " + axisFault.getMessage(); - log.error(msg, axisFault); - throw new RegistryException(msg, axisFault); - } - } - - public TenantActivityServiceClient(ServletConfig config, HttpSession session) - throws RegistryException { - String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); - String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); - ConfigurationContext configContext = (ConfigurationContext) config. - getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); - epr = backendServerURL + "TenantActivityService"; - - try { - stub = new TenantActivityServiceStub(configContext, epr); - - ServiceClient client = stub._getServiceClient(); - Options option = client.getOptions(); - option.setManageSession(true); - option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); - - } catch (AxisFault axisFault) { - String msg = "Failed to initiate TenantMonitorService service client. " + axisFault.getMessage(); - log.error(msg, axisFault); - throw new RegistryException(msg, axisFault); - } - } - - public TenantActivityServiceClient(String url, ServletConfig config, HttpSession session) - throws Exception { - //String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); - ConfigurationContext configContext = (ConfigurationContext) config. - getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); - try { - String cookie = login(url + "/services/", - TenantActivityUIServiceComponent.stratosConfiguration.getAdminUserName(), - TenantActivityUIServiceComponent.stratosConfiguration.getAdminPassword(), - configContext); - epr = url + "/services/TenantActivityService"; - stub = new TenantActivityServiceStub(configContext, epr); - ServiceClient client = stub._getServiceClient(); - Options option = client.getOptions(); - option.setManageSession(true); - option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); - - } catch (AxisFault axisFault) { - String msg = "Failed to initiate TenantMonitorService service client. "; - log.error(msg, axisFault); - throw new RegistryException(msg, axisFault); - } - } - - - public int getActiveTenantCount() throws TenantActivityServiceExceptionException, RemoteException { - int count = stub.getActiveTenantCount(); - return count; - } - - /*public String[] getActiveTenantList() throws TenantActivityServiceExceptionException, RemoteException { - return stub.getActiveTenantList(); - } */ - - public PaginatedTenantDataBean getPaginatedActiveTenantList(int pageNumber) throws TenantActivityServiceExceptionException, RemoteException { - return stub.retrievePaginatedActiveTenants(pageNumber); - } - - /* public TenantDataBean[] getAllActiveTenantList() throws TenantActivityServiceExceptionException, RemoteException { - return stub.getAllActiveTenantList(); - }*/ - - public boolean isTenantActiveInService(String domainName) throws TenantActivityServiceExceptionException, RemoteException { - return stub.isActiveTenantOnService(domainName); - } - - private String login(String serverUrl, String userName, - String password, ConfigurationContext confContext) throws UserStoreException { - String sessionCookie = null; - try { - AuthenticationAdminClient client = - new AuthenticationAdminClient(confContext, serverUrl, null, null, false); - //TODO : get the correct IP - boolean isLogin = client.login(userName, password, "127.0.0.1"); - if (isLogin) { - sessionCookie = client.getAdminCookie(); - } - } catch (Exception e) { - throw new UserStoreException("Error in login to the server server: " + serverUrl + - "username: " + userName + ".", e); - } - return sessionCookie; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java b/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java deleted file mode 100644 index 3d50383..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.tenant.activity.ui.internal; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; -import org.apache.stratos.common.util.StratosConfiguration; -import org.wso2.carbon.utils.ConfigurationContextService; - -/** - * @scr.component name="org.apache.stratos.tenant.activity.ui" immediate="true" - * @scr.reference name="config.context.service" - * interface="org.wso2.stratos.utils.ConfigurationContextService" - * cardinality="1..1" policy="dynamic" bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="stratos.config.service" - * interface="org.apache.stratos.common.util.StratosConfiguration" cardinality="1..1" - * policy="dynamic" bind="setStratosConfigurationService" unbind="unsetStratosConfigurationService" - */ -public class TenantActivityUIServiceComponent { - private static Log log = LogFactory.getLog(TenantActivityUIServiceComponent.class); - public static ConfigurationContextService contextService; - public static StratosConfiguration stratosConfiguration; - - protected void activate(ComponentContext context) { - try { - if (log.isDebugEnabled()) { - log.error("******* Tenant Activity UI bundle is activated ******* "); - } - } catch (Exception e) { - log.error("******* Error in activating Tenant Activity UI bundle ******* ", e); - } - } - - protected void deactivate(ComponentContext context) { - if (log.isDebugEnabled()) { - log.debug("******* Tenant Activity UI bundle is deactivated ******* "); - } - } - - protected void setStratosConfigurationService(StratosConfiguration stratosConfigService) { - TenantActivityUIServiceComponent.stratosConfiguration = stratosConfigService; - } - - protected void unsetStratosConfigurationService(StratosConfiguration ccService) { - TenantActivityUIServiceComponent.stratosConfiguration = null; - } - - protected void setConfigurationContextService(ConfigurationContextService contextService) { - TenantActivityUIServiceComponent.contextService = contextService; - } - - protected void unsetConfigurationContextService(ConfigurationContextService contextService) { - TenantActivityUIServiceComponent.contextService = null; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/ManagerConfigurations.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/ManagerConfigurations.java b/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/ManagerConfigurations.java deleted file mode 100644 index 1cf4ca1..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/ManagerConfigurations.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.tenant.activity.ui.utils; - -import org.apache.axiom.om.OMElement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.common.util.CommonUtil; -import org.wso2.carbon.utils.CarbonUtils; - -import javax.xml.namespace.QName; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - - -public class ManagerConfigurations { - - private static final String CONFIG_FILE = "throttling-agent-config.xml"; - - private static final String MANAGER_SERVICE_URL_PARAM_NAME = "managerServiceUrl"; - private static final String USERNAME_PARAM_NAME = "userName"; - private static final String PASSWORD_PARAM_NAME = "password"; - - - private String managerServerUrl; - private String userName; - private String password; - - private final static Log log = LogFactory.getLog(ManagerConfigurations.class); - - private static final String CONFIG_NS = - "http://wso2.com/stratos/multitenancy/throttling/agent/config"; - private static final String PARAMTERS_ELEMENT_NAME = "parameters"; - private static final String PARAMTER_ELEMENT_NAME = "parameter"; - private static final String PARAMTER_NAME_ATTR_NAME = "name"; - private Map<String, String> parameters = new HashMap<String, String>(); - - - - - public String getConfigFileName() throws Exception { - - String configFileName = CarbonUtils.getCarbonConfigDirPath() + - File.separator + StratosConstants.MULTITENANCY_CONFIG_FOLDER + - File.separator + CONFIG_FILE; - - return configFileName; - - } - - - public ManagerConfigurations() throws Exception { - - String throttlingAgentConfigFile = this.getConfigFileName(); - try { - OMElement meteringConfig = - CommonUtil.buildOMElement(new FileInputStream(throttlingAgentConfigFile)); - deSerialize(meteringConfig); - Map<String, String> throttlingAgentParams = getParameters(); - this.setUserName(throttlingAgentParams.get(USERNAME_PARAM_NAME)); - this.setPassword(throttlingAgentParams.get(PASSWORD_PARAM_NAME)); - this.setManagerServerUrl(throttlingAgentParams.get(MANAGER_SERVICE_URL_PARAM_NAME)); - } catch (FileNotFoundException e) { - String msg = "Unable to find the file: " + throttlingAgentConfigFile + "."; - log.error(msg, e); - } - } - - public void deSerialize(OMElement throttlingConfigEle) throws Exception { - Iterator meteringConfigChildIt = throttlingConfigEle.getChildElements(); - while (meteringConfigChildIt.hasNext()) { - Object meteringConfigChild = meteringConfigChildIt.next(); - if (!(meteringConfigChild instanceof OMElement)) { - continue; - } - OMElement meteringConfigChildEle = (OMElement) meteringConfigChild; - if (new QName(CONFIG_NS, PARAMTERS_ELEMENT_NAME, "").equals(meteringConfigChildEle - .getQName())) { - Iterator parametersChildIt = meteringConfigChildEle.getChildElements(); - while (parametersChildIt.hasNext()) { - Object taskConfigChild = parametersChildIt.next(); - if (!(taskConfigChild instanceof OMElement)) { - continue; - } - OMElement parameterChildEle = (OMElement) taskConfigChild; - if (!new QName(CONFIG_NS, PARAMTER_ELEMENT_NAME, "").equals(parameterChildEle - .getQName())) { - continue; - } - String parameterName = - parameterChildEle.getAttributeValue(new QName(PARAMTER_NAME_ATTR_NAME)); - String parameterValue = parameterChildEle.getText(); - parameters.put(parameterName, parameterValue); - } - } - } - } - - public Map<String, String> getParameters() { - return parameters; - } - - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getManagerServerUrl() { - return managerServerUrl; - } - - public void setManagerServerUrl(String managerServerUrl) { - this.managerServerUrl = managerServerUrl; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/TenantMonitorUtil.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/TenantMonitorUtil.java b/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/TenantMonitorUtil.java deleted file mode 100644 index 27468eb..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/TenantMonitorUtil.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.tenant.activity.ui.utils; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.config.CloudServiceConfig; -import org.apache.stratos.common.config.CloudServiceConfigParser; -import org.apache.stratos.common.config.CloudServicesDescConfig; - -import java.util.*; - -import org.apache.stratos.tenant.activity.stub.beans.xsd.PaginatedTenantDataBean; -import org.apache.stratos.tenant.activity.stub.beans.xsd.TenantDataBean; - -public class TenantMonitorUtil { - private static final Log log = LogFactory.getLog(TenantMonitorUtil.class); - - public static Map<String, String[]> tenantList = new HashMap<String, String[]>(); - public static Map<String, TenantDataBean[]> tenantDataList = new HashMap<String, TenantDataBean[]>(); - - - private static ManagerConfigurations managerConfig = null; - - - public static ManagerConfigurations getManagerConfig() { - return managerConfig; - } - - public static void setManagerConfig(ManagerConfigurations managerConfig) { - TenantMonitorUtil.managerConfig = managerConfig; - } - - /* public static Map<String, Integer> getActiveTenantCount(ServletConfig config, HttpSession session) throws Exception { - Map<String, Integer> map = new HashMap<String, Integer>(); - try { - CloudServicesDescConfig cloudServicesDescConfig = CloudServiceConfigParser.loadCloudServicesConfiguration(); - - Map<String, CloudServiceConfig> cloudServicesConfigs = cloudServicesDescConfig.getCloudServiceConfigs(); - for (String serviceName : cloudServicesConfigs.keySet()) { - String backEndURL = cloudServicesConfigs.get(serviceName).getLink(); - System.out.println(backEndURL); - if (backEndURL == null) { - try { - TenantActivityServiceClient client = new TenantActivityServiceClient(config, session); - map.put(serviceName, client.getActiveTenantCount()); - for (String nn : client.getActiveTenantList()) { - System.out.println(nn); - } - } catch (Exception e) { - log.error("Failed to get active tenants for manager service"); - } - - } else { - try { - TenantActivityServiceClient client = new TenantActivityServiceClient(backEndURL, config, session); - map.put(serviceName, client.getActiveTenantCount()); - } catch (Exception e) { - log.error("failed to get Active tenants for" + serviceName + e.toString()); - } - } - - } - } catch (Exception e) { - log.error("Error while retrieving cloud desc configuration"); - - } - return map; - }*/ - - public static Map<String, CloudServiceConfig> getCloudServiceConfigMap() { - try { - CloudServicesDescConfig cloudServicesDescConfig = CloudServiceConfigParser.loadCloudServicesConfiguration(); - return cloudServicesDescConfig.getCloudServiceConfigs(); - } catch (Exception e) { - log.error("Error while getting service names " + e.toString()); - } - return null; - } - - public static PaginatedTenantDataBean getPaginatedTenantData(int pageNumber, String serviceName) { - int entriesPerPage = 15; - List<TenantDataBean> tenantListOnService = Arrays.asList(tenantDataList.get(serviceName)); - List<TenantDataBean> tenantUsages = new ArrayList<TenantDataBean>(); - int i = 0; - int numberOfPages = 0; - for (TenantDataBean tenant : tenantListOnService) { - if (i % entriesPerPage == 0) { - numberOfPages++; - } - if (numberOfPages == pageNumber) { - tenantUsages.add(tenant); - } - i++; - - } - PaginatedTenantDataBean paginatedTenantInfo = new PaginatedTenantDataBean(); - paginatedTenantInfo.setTenantInfoBeans( - tenantUsages.toArray(new TenantDataBean[tenantUsages.size()])); - paginatedTenantInfo.setNumberOfPages(numberOfPages); - return paginatedTenantInfo; - } - - public static boolean isTenantActiveOnService(String serviceName, String domain) { - boolean status = false; - for (TenantDataBean tenantBean : tenantDataList.get(serviceName)) { - if (tenantBean.getDomain().equalsIgnoreCase(domain)) { - status = true; - } - } - return status; - } - - public static Map<String, String> getAdminParameters() { - Map<String, String> adminParameters = new HashMap<String, String>(); - if (managerConfig == null) { - try { - managerConfig = new ManagerConfigurations(); - } catch (Exception e) { - log.error("Failed to get administrator credentials" + e.toString()); - } - } - adminParameters.put("userName", managerConfig.getUserName()); - adminParameters.put("password", managerConfig.getPassword()); - return adminParameters; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/resources/META-INF/component.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.tenant.activity.ui/src/main/resources/META-INF/component.xml deleted file mode 100644 index 99fafef..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/META-INF/component.xml +++ /dev/null @@ -1,36 +0,0 @@ -<!-- - # Licensed to the Apache Software Foundation (ASF) under one - # or more contributor license agreements. See the NOTICE file - # distributed with this work for additional information - # regarding copyright ownership. The ASF licenses this file - # to you under the Apache License, Version 2.0 (the - # "License"); you may not use this file except in compliance - # with the License. You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, - # software distributed under the License is distributed on an - # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - # KIND, either express or implied. See the License for the - # specific language governing permissions and limitations - # under the License. - --> -<component xmlns="http://products.wso2.org/carbon"> - <!-- sample menu configuration --> - <menus> - <menu> - <id>all_tenant_monitor_menu</id> - <i18n-key>Tenant Activity Monitor</i18n-key> - <i18n-bundle>org.apache.stratos.tenant.activity.ui.i18n.Resources</i18n-bundle> - <parent-menu>monitor_menu</parent-menu> - <link>../tenant-activity/tenant-activity.jsp</link> - <region>region4</region> - <order>50</order> - <style-class>manage</style-class> - <icon>../tenant-activity/images/tenant-usage-report.gif</icon> - <require-permission>/permission/protected/monitor/userUsage</require-permission> - <require-super-tenant>true</require-super-tenant> - </menu> - </menus> -</component> http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/JSResources.properties ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/JSResources.properties b/components/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/JSResources.properties deleted file mode 100644 index d207695..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/JSResources.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -session.timed.out=Session timed out. Please login again \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/Resources.properties ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/Resources.properties b/components/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/Resources.properties deleted file mode 100644 index 5b4ecd8..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/Resources.properties +++ /dev/null @@ -1,28 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -service.name=Service Name -active.user.count=Active User Count -active.tenants.services= Active Tenants on Services -view.list=View List -active.tenant.count=Active Tenant Count -active.tenants.on= Active Tenants on -tenant.domain= Tenant Domain -active.status=State -enter.tenant.domain=Enter Tenant Domain -tenant.status=Tenant State -tenant.state.on.services.for.tenant= Tenant State on Services For Tenant Domain http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/css/tenant-usage.css ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/css/tenant-usage.css b/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/css/tenant-usage.css deleted file mode 100644 index 6fb3b36..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/css/tenant-usage.css +++ /dev/null @@ -1,47 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -.disableLink { - color: #aaaaaa; -} - -.pageLinks { - background: #FFFFFF none repeat scroll 0%; - border: 1px solid #DDDDDD; - padding: 2px 3px; - text-decoration: none; - margin: 0px; - margin-left: 2px; - margin-right: 2px; -} - -.pageLinks-selected { - background: #e8e9ae none repeat scroll 0%; - border: 1px solid #DDDDDD; - padding: 2px 3px; - text-decoration: none; - margin: 0px; - margin-left: 2px; - margin-right: 2px; -} - -a { - color: #386698; - cursor: pointer; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/images/view-usage.png ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/images/view-usage.png b/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/images/view-usage.png deleted file mode 100644 index 3d036c0..0000000 Binary files a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/images/view-usage.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/userguide.html ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/userguide.html b/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/userguide.html deleted file mode 100644 index 9e7914c..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/userguide.html +++ /dev/null @@ -1,77 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> - <title>View Usage - User Guide</title> - <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" /> -</head> - -<body> -<h1>View Usage</h1> - -<p> -You can view usage of the stratos resource by your organization from this page -</p> - -<p> -<img src="images/view-usage.png" alt="View Usage"/> -<div><strong>Figure1: View Usage</strong></div> -</p> - -<p> - -<table> - <thead> - <td> - The Form Field - </td> - <td> - Description - </td> - </thead> - <tbody> - <tr> - <td>Year-Month</td> - <td>The year and the month the usage is metered.</td> - </tr> - <tr> - <td>Number of Users</td> - <td>Number of users of your stratos account.</td> - </tr> - <tr> - <td>Active data storage</td> - <td>The registry data storage amount.</td> - </tr> - <tr> - <td>Registry Total Bandwidth</td> - <td>Total bandwidth consumed by the registry accesses.</td> - </tr> - <tr> - <td>Service Total Bandwidth</td> - <td>The bandwidth consumed by the web services.</td> - </tr> - </tbody> -</table> - -</p> - -</body> - -</html> http://git-wip-us.apache.org/repos/asf/stratos/blob/bfc6d758/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp b/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp deleted file mode 100644 index 5e33f77..0000000 --- a/components/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp +++ /dev/null @@ -1,60 +0,0 @@ -<%-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --%> -<%@page contentType="text/html" pageEncoding="UTF-8" %> -<%@ page import="org.json.JSONObject" %> -<%@ page import="org.apache.stratos.billing.mgt.stub.beans.xsd.Invoice" %> -<%@ page import="org.apache.stratos.billing.mgt.stub.beans.xsd.Payment" %> -<%@ page import="org.wso2.carbon.billing.mgt.ui.utils.BillingUtil" %> -<%@ page import="java.util.Date" %> -<%@ page import="org.apache.stratos.tenant.activity.ui.clients.TenantActivityServiceClient" %> -<%@ page import="java.io.Console" %> -<%@ page import="javax.rmi.CORBA.Util" %> -<%@ page import="org.apache.stratos.tenant.activity.ui.utils.TenantMonitorUtil" %> -<%@ page import="org.apache.stratos.tenant.activity.stub.beans.xsd.PaginatedTenantDataBean" %> - -<% - String serverUrl = request.getParameter("backEndUrl"); - String serviceName = request.getParameter("serviceName"); - String domainName = request.getParameter("domainName"); - - boolean state = false; - if (serverUrl == null || "null".equals(serverUrl.trim())) { - try { - TenantActivityServiceClient client = new TenantActivityServiceClient(config, session); - state = client.isTenantActiveInService(domainName); - } catch (Exception e) { - } - - } else { - try { - TenantActivityServiceClient client = new TenantActivityServiceClient(serverUrl, config, session); - state = client.isTenantActiveInService(domainName); - } catch (Exception e) { - } - } - - try { - JSONObject obj = new JSONObject(); - obj.put("isActive", state); - obj.put("service", serviceName); - out.write(obj.toString()); - } catch (Exception e) { - e.printStackTrace(); - } -%>
