Package org.wso2.carbon.base

Examples of org.wso2.carbon.base.ServerConfiguration


        String value = System.getProperty(name);
        if (value != null) {
            return value;
        }

        ServerConfiguration serverConfig = ServerConfiguration.getInstance();
        return serverConfig.getFirstProperty(name);
    }
View Full Code Here


        IMHostObject im = (IMHostObject) thisObj;
        String username;
        String password;

        if (args.length == 0) {
            ServerConfiguration serverConfig = ServerConfiguration.getInstance();
            String key = MashupConstants.IM_CONFIG + "." + im.protocol;
            username = serverConfig.getFirstProperty(key + "." +
                    MashupConstants.USERNAME);
            password = serverConfig.getFirstProperty(key + "." +
                    MashupConstants.PASSWORD);
        } else if (args.length == 2) {
            username = (String) args[0];
            password = (String) args[1];
        } else {
View Full Code Here

        emailHostObject.properties = props;
        emailHostObject.multipart = new MimeMultipart();

        String host, username, password;
        String port = null;
        ServerConfiguration serverConfig = ServerConfiguration.getInstance();

        int length = args.length;
        if (length == 3) {
            // We assume that the three parameters are host, username and password
            host = (String) args[0];
            username = (String) args[1];
            password = (String) args[2];
            port = serverConfig.getFirstProperty(MashupConstants.PORT);
        } else if (length == 4) {
            //We assume that the parameters are host, port, username and password
            host = (String) args[0];
            port = (String) args[1];
            username = (String) args[2];
View Full Code Here

                    serviceQName = service.getQName();
                    endpointName = returnPort.getName();

                }
            }
            ServerConfiguration serverConfig = ServerConfiguration.getInstance();
            String clientRepositoryLocation =
                    serverConfig.getFirstProperty(CLIENT_REPOSITORY_LOCATION);
            String clientAxis2XmlLocationn =
                    serverConfig.getFirstProperty(CLIENT_AXIS2_XML_LOCATION);
            //Creating the Client side configuration context
            ConfigurationContext configurationContext = ConfigurationContextFactory
                    .createConfigurationContextFromFileSystem(clientRepositoryLocation,
                            clientAxis2XmlLocationn);
            wsRequest.sender =
View Full Code Here

        StatisticsReporterThread reporterThread =
                new StatisticsReporterThread(synEnvService, mediationStatStore);
        reporterThread.setName("mediation-stat-collector-" + tenantId);

        // Set a custom interval value if required
        ServerConfiguration serverConf = ServerConfiguration.getInstance();
        String interval = serverConf.getFirstProperty(StatisticsConstants.STAT_REPORTING_INTERVAL);
        if (interval != null) {
            reporterThread.setDelay(Long.parseLong(interval));
        }

        String tracing = serverConf.getFirstProperty(StatisticsConstants.STAT_TRACING);
        if ("enabled".equals(tracing)) {
            reporterThread.setTracingEnabled(true);
        }

        // Engage the persisting stat observer if required
        String persistence = serverConf.getFirstProperty(StatisticsConstants.STAT_PERSISTENCE);
        if ("enabled".equals(persistence)) {
            String root = serverConf.getFirstProperty(
                    StatisticsConstants.STAT_PERSISTENCE_ROOT);
            if (root != null) {
                log.info("Enabling mediation statistics persistence. Statistics will be " +
                        "stored at: " + root);
                mediationStatStore.registerObserver(new PersistingStatisticsObserver(root));
            } else {
                log.warn(StatisticsConstants.STAT_PERSISTENCE_ROOT + " parameter has not " +
                        "been specified in the server configuration to activate " +
                        "statistics persistence");
            }
        }

        // Engage custom observer implementations (user written extensions)
        String observers = serverConf.getFirstProperty(StatisticsConstants.STAT_OBSERVERS);
        if (observers != null && !"".equals(observers)) {
            String[] classNames = observers.split(",");
            for (String className : classNames) {
                try {
                    Class clazz = this.getClass().getClassLoader().loadClass(className.trim());
View Full Code Here

        KeyStoreAdmin admin = null;
        KeyStoreData[] keystores = null;
        String privateKeyAlias = null;
        String keyStoreName = null;
        String issuerName = null;
        ServerConfiguration serverConfig = null;

        configRegistry = STSServiceDataHolder.getInstance().getRegistryService()
                .getConfigSystemRegistry();
        governRegistry = STSServiceDataHolder.getInstance().getRegistryService()
                .getGovernanceSystemRegistry();

        if (configRegistry == null || config.getService(ServerConstants.STS_NAME) == null) {
            if (log.isDebugEnabled()) {
                log.debug("configRegistry not set or STS service is unavailable");
            }
            return;
        }

        serverConfig = ServerConfiguration.getInstance();
        keyAlias = serverConfig.getFirstProperty("Security.KeyStore.KeyAlias");
        keyPassword = serverConfig.getFirstProperty("Security.KeyStore.KeyPassword");
        issuerName = serverConfig.getFirstProperty("HostName");

        if (issuerName == null) {
            // HostName not set :-( use wso2wsas-sts
            issuerName = ServerConstants.STS_NAME;
        }

        admin = new KeyStoreAdmin(governRegistry);
        keystores = admin.getKeyStores();

        for (int i = 0; i < keystores.length; i++) {
            if (KeyStoreUtil.isPrimaryStore(keystores[i].getKeyStoreName())) {
                keyStoreName = keystores[i].getKeyStoreName();
                privateKeyAlias = KeyStoreUtil.getPrivateKeyAlias(KeyStoreManager.getInstance(
                        STSServiceDataHolder.getInstance().getRegistryService().getGovernanceSystemRegistry())
                        .getKeyStore(keyStoreName));
                break;
            }
        }

        if (privateKeyAlias != null) {
            service = config.getService(ServerConstants.STS_NAME);

            String cryptoProvider = ServerCrypto.class.getName();

            Properties props = RampartConfigUtil.getServerCryptoProperties(
                    new String[]{keyStoreName}, keyStoreName, privateKeyAlias);

            SAMLTokenIssuerConfig stsSamlConfig = new SAMLTokenIssuerConfig(issuerName,
                    cryptoProvider, props);
            stsSamlConfig.setIssuerKeyAlias(keyAlias);
            stsSamlConfig.setIssuerKeyPassword(keyPassword);
            stsSamlConfig.setAddRequestedAttachedRef(true);
            stsSamlConfig.setAddRequestedUnattachedRef(true);
            stsSamlConfig.setKeyComputation(2);
            stsSamlConfig.setProofKeyType(TokenIssuerUtil.BINARY_SECRET);

            String resourcePath = null;
            resourcePath = RegistryResources.SERVICE_GROUPS + ServerConstants.STS_NAME
                    + RegistryResources.SERVICES + ServerConstants.STS_NAME + "/trustedServices";
            if (configRegistry.resourceExists(resourcePath)) {
                Resource trustedService = null;
                Properties properties = null;
                Iterator iterator = null;
                trustedService = configRegistry.get(resourcePath);
                properties = trustedService.getProperties();
                if (properties != null && !properties.isEmpty()) {
                    iterator = properties.entrySet().iterator();
                    while (iterator.hasNext()) {
                        Entry entry = (Entry) iterator.next();
                        stsSamlConfig.addTrustedServiceEndpointAddress((String) entry.getKey(),
                                (String) ((List) entry.getValue()).get(0));
                    }
                }
            }

            //Set the TTL value read from the carbon.xml
            String ttl = serverConfig.getFirstProperty("STSTimeToLive");

            if (ttl != null && ttl.length() > 0) {
                try {
                    stsSamlConfig.setTtl(Long.parseLong(ttl));
                    if (log.isDebugEnabled()) {
View Full Code Here

        String value = System.getProperty(name);
        if (value != null) {
            return value;
        }

        ServerConfiguration serverConf = ServerConfiguration.getInstance();
        return serverConf.getFirstProperty(name);
    }
View Full Code Here

    public static void initPersistence(SynapseConfiguration synCfgConfiguration,
                                       UserRegistry registry, String configurationLocation,
                                       AxisConfiguration axisConfiguration,
                                       String name) throws ConfigurationInitilizerException {
        // Initialize the mediation persistence manager if required
        ServerConfiguration serverConf = ServerConfiguration.getInstance();
        String persistence = serverConf.getFirstProperty(ServiceBusConstants.PERSISTENCE);

        // Check whether persistence is disabled
        if (!ServiceBusConstants.DISABLED.equals(persistence)) {
            // Check registry persistence is disabled or not
            String regPersistence = serverConf.getFirstProperty(
                    ServiceBusConstants.REGISTRY_PERSISTENCE);

            // Check the worker interval is set or not
            String interval = serverConf.getFirstProperty(ServiceBusConstants.WORKER_INTERVAL);
            long intervalInMillis = 5000L;
            if (interval != null && !"".equals(interval)) {
                try {
                    intervalInMillis = Long.parseLong(interval);
                } catch (NumberFormatException e) {
View Full Code Here

      @Deprecated
      public static Policy getDefaultRampartConfig() {

          //Extract the primary keystore information from server configuration
          ServerConfiguration serverConfig = ServerConfiguration.getInstance();
          String keyStore = serverConfig.getFirstProperty("Security.KeyStore.Location");
          String keyStoreType = serverConfig.getFirstProperty("Security.KeyStore.Type");
          String keyStorePassword = serverConfig.getFirstProperty("Security.KeyStore.Password");
          String privateKeyAlias = serverConfig.getFirstProperty("Security.KeyStore.KeyAlias");
          String privateKeyPassword = serverConfig.getFirstProperty("Security.KeyStore.KeyPassword");

          //Populate Rampart Configuration
          RampartConfig rampartConfig = new RampartConfig();
          rampartConfig.setUser(privateKeyAlias);
          //TODO use a registry based callback handler
View Full Code Here

      }
     
      public static void addUser() {
        //Extract the primary keystore information from server configuration
          ServerConfiguration serverConfig = ServerConfiguration.getInstance();
          String privateKeyAlias = serverConfig.getFirstProperty("Security.KeyStore.KeyAlias");
          String privateKeyPassword = serverConfig.getFirstProperty("Security.KeyStore.KeyPassword");
        //Set the private key alias and private key password in the password callback handler
          InMemoryPasswordCallbackHandler.addUser(privateKeyAlias, privateKeyPassword);
      }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.base.ServerConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.