/*
(non-Javadoc)
@see javax.slee.resource.ResourceAdaptor#raConfigure(javax.slee.resource.ConfigProperties)
2526
public void raConfigure(ConfigProperties properties) {
		
		if (tracer.isFineEnabled()) {
			tracer.fine("Configuring RA.");
		}
		
		this.port = (Integer) properties.getProperty(SIP_PORT_BIND).getValue();
		this.stackAddress = (String) properties.getProperty(SIP_BIND_ADDRESS).getValue();
		if (this.stackAddress.equals("")) {
			this.stackAddress = this.getJBossAddress();
		}

		this.transportsProperty = (String) properties.getProperty(TRANSPORTS_BIND).getValue();
		this.transports.clear();
		for (String transport : this.transportsProperty.split(",")) {
			this.transports.add(transport);
		}

		Property p = properties.getProperty(LOOSE_DIALOG_VALIDATION);
		if(p!=null && p.getValue()!=null)
		{
			this.looseDialogSeqValidation = (Boolean) p.getValue();
		}


		// read optional key specifying location of sipra.properties
		p = properties.getProperty(SIPRA_PROPERTIES_LOCATION);
		if (p != null && p.getValue()!=null) {
			this.sipRaPropertiesLocation = (String) p.getValue();
		}

		p = properties.getProperty(SIP_TRACE_LEVEL);
        if (p != null && p.getValue() != null) {
            this.sipTraceLevel = (String) p.getValue();
        }
        
		tracer.info("RA entity named "+raContext.getEntityName()+" bound to port " + this.port);
		
	}
958053
protected void configure(Properties p) {
        _properties = p;
        _host = (String)p.remove(HOST);
        if (_host == null) throw new NoSuchElementException(HOST);
        _path = (String)p.remove(PATH);
        if (_path == null) throw new NoSuchElementException(PATH);
    }
619118
public void setConfiguration(Configuration configuration) {

        this.configuration = configuration;

        // init ParamReaders with the new <Configuration>
        ParamReaders.getInstance().setConfiguration(configuration);

        // register as listener to configuration change
        FoundationConfigurationListenerRegistry.addFoundationConfigurationListener(this);

        // verify that all configured values are correct
        verifyConfiguration();

    }
1147166
@Override
    protected void configure() {
        // ***** Properties *****
        java.util.Properties properties = new java.util.Properties();
        URL resource = getClass().getResource("/rsimulator.properties");
        if (resource == null) {
            properties.setProperty("simulatorCache", "false");
        } else {
            try (BufferedInputStream bis = new BufferedInputStream(resource.openStream())) {
                properties.load(bis);
            } catch (Exception e) {
                log.error("Error reading properties from: {}", resource.getPath(), e);
            }
        }
        bind(java.util.Properties.class).annotatedWith(Names.named("rsimulator-core-properties")).toInstance(properties);

        // ***** Handlers *****
        Map<String, Handler> map = new HashMap<String, Handler>();
        JsonHandler jsonHandler = new JsonHandler();
        requestInjection(jsonHandler);
        TxtHandler txtHandler = new TxtHandler();
        requestInjection(txtHandler);
        XmlHandler xmlHandler = new XmlHandler();
        requestInjection(xmlHandler);
        map.put("json", jsonHandler);
        map.put("txt", txtHandler);
        map.put("xml", xmlHandler);

        bind(new TypeLiteral<Map<String, Handler>>() {
        }).annotatedWith(Names.named("handlers")).toInstance(map);

        // ***** Interceptors for cache and script *****
        CacheManager.create();

        bind(net.sf.ehcache.Cache.class).annotatedWith(Names.named("SimulatorCache")).toInstance(
                CacheManager.create().getCache("SimulatorCache"));
        bind(net.sf.ehcache.Cache.class).annotatedWith(Names.named("FileUtilsCache")).toInstance(
                CacheManager.create().getCache("FileUtilsCache"));
        bind(net.sf.ehcache.Cache.class).annotatedWith(Names.named("PropsCache")).toInstance(
                CacheManager.create().getCache("PropsCache"));

        SimulatorPropertiesInterceptor simulatorPropertiesInterceptor = new SimulatorPropertiesInterceptor();
        SimulatorCacheInterceptor simulatorCacheInterceptor = new SimulatorCacheInterceptor();
        SimulatorScriptInterceptor simulatorScriptInterceptor = new SimulatorScriptInterceptor();
        FileUtilsCacheInterceptor fileUtilsCacheInterceptor = new FileUtilsCacheInterceptor();
        PropsCacheInterceptor propsCacheInterceptor = new PropsCacheInterceptor();

        requestInjection(simulatorPropertiesInterceptor);
        requestInjection(simulatorCacheInterceptor);
        requestInjection(simulatorScriptInterceptor);
        requestInjection(fileUtilsCacheInterceptor);
        requestInjection(propsCacheInterceptor);

        // Order is significant
        bindInterceptor(Matchers.subclassesOf(Simulator.class), Matchers.annotatedWith(Properties.class),
                simulatorPropertiesInterceptor);
        bindInterceptor(Matchers.subclassesOf(Simulator.class), Matchers.annotatedWith(Cache.class),
                simulatorCacheInterceptor);
        bindInterceptor(Matchers.subclassesOf(Simulator.class), Matchers.annotatedWith(Script.class),
                simulatorScriptInterceptor);
        bindInterceptor(Matchers.subclassesOf(FileUtils.class), Matchers.annotatedWith(Cache.class),
                fileUtilsCacheInterceptor);
        bindInterceptor(Matchers.subclassesOf(Props.class), Matchers.annotatedWith(Cache.class),
                propsCacheInterceptor);
    }
96485
@Override
    protected void configure() {

        install(new GuiceJerseyBinder());

        // POJOs
        bind(MyDependency.class).to(DefaultMyDependency.class);

        // vertx-mod-jersey interfaces
        Multibinder.newSetBinder(binder(), VertxRequestProcessor.class).addBinding().to(GuiceRequestProcessor.class);
        Multibinder.newSetBinder(binder(), VertxResponseProcessor.class).addBinding().to(GuiceResponseProcessor.class);
        Multibinder.newSetBinder(binder(), VertxPostResponseProcessor.class).addBinding().to(GuicePostResponseProcessor.class);

        // Jersey interfaces
        Multibinder.newSetBinder(binder(), ContainerRequestFilter.class).addBinding().to(GuiceRequestFilter.class);
        Multibinder.newSetBinder(binder(), ContainerResponseFilter.class).addBinding().to(GuiceResponseFilter.class);

        Multibinder.newSetBinder(binder(), ExceptionMapper.class).addBinding().to(GuiceExceptionMapper.class);

    }
1064597
public void setConfigurations(java.util.Collection<Configuration> configurations) {
        if (configurations == null) {
            this.configurations = null;
            return;
        }

        this.configurations = new java.util.ArrayList<Configuration>(configurations);
    }
906236
@Override
    public void configure(String parameters) {
        if (parameters.isEmpty()) {
            return;
        }
        List<String> values = Op.split(parameters, " ");
        int required = 4;
        if (values.size() < required) {
            throw new RuntimeException(String.format(
                    "[configuration error] term <%s> requires <%d> parameters",
                    this.getClass().getSimpleName(), required));
        }
        Iterator<String> it = values.iterator();
        setMeanA(Op.toDouble(it.next()));
        setStandardDeviationA(Op.toDouble(it.next()));
        setMeanB(Op.toDouble(it.next()));
        setStandardDeviationB(Op.toDouble(it.next()));
        if (values.size() > required) {
            setHeight(Op.toDouble(it.next()));
        }
    }
74700
@Override
	protected void configure(AuthenticationManagerBuilder auth) throws Exception {
		OpenIDAuthenticationProvider openidProvider = new OpenIDAuthenticationProvider();
		openidProvider.setAuthenticationUserDetailsService(new SimpleUserService());
		auth.authenticationProvider(openidProvider);

		RememberMeAuthenticationProvider rmeProvider = new RememberMeAuthenticationProvider(Config.APP_SECRET_KEY);
		auth.authenticationProvider(rmeProvider);

		JWTAuthenticationProvider jwtProvider = new JWTAuthenticationProvider();
		auth.authenticationProvider(jwtProvider);

		LDAPAuthenticationProvider ldapProvider = new LDAPAuthenticationProvider();
		auth.authenticationProvider(ldapProvider);
	}
609341
public void reconfigure(SecurityConfig config) {
        this.config = config;

        LOGGER.debug("reconfiguring with {} rules", config.getRules().size());

        Map<String, Map<String, ResourcePermission>> newPermissions = new HashMap<>();
        for (SecurityRule rule : config.getRules()) {
            String resourceType = rule.getResourceType();
            if (resourceType == null) {
                Class<?> resourceClass = rule.getResourceClass();
                if (resourceClass != null) {
                    resourceType = toType(resourceClass);
                }
            }

            if (resourceType == null) {
                Collection<RegistryEntry> entries = context.getResourceRegistry().getEntries();
                for (RegistryEntry entry : entries) {
                    String entryResourceType = entry.getResourceInformation().getResourceType();
                    configureRule(newPermissions, entryResourceType, rule.getRole(), rule.getPermission());
                }
            } else {
                ResourceRegistry resourceRegistry = context.getResourceRegistry();
                RegistryEntry entry = resourceRegistry.getEntry(resourceType);
                if (entry == null) {
                    throw new RepositoryNotFoundException(resourceType);
                }
                configureRule(newPermissions, resourceType, rule.getRole(), rule.getPermission());
            }
        }
        this.permissions = newPermissions;
    }
976254
@Override
    public void configure(String parameters) {
        if (parameters.isEmpty()) {
            return;
        }
        List<String> values = Op.split(parameters, " ", true);
        final int required = 2;
        if (values.size() < required) {
            throw new RuntimeException(MessageFormat.format(
                    "[configuration error] activation {0} requires {1} parameters",
                    this.getClass().getSimpleName(), required));
        }

        setNumberOfRules(Integer.parseInt(values.get(0)));
        setThreshold(Op.toDouble(values.get(1)));
    }
883416
public void setResourceAdaptorContext(javax.slee.resource.ResourceAdaptorContext raContext) {
		this.raContext = raContext; 
		this.tracer = raContext.getTracer("XCAPClientResourceAdaptor");
		sbbInterface = new XCAPClientResourceAdaptorSbbInterfaceImpl(this);
        this.sleeEndpoint = raContext.getSleeEndpoint();
        this.eventLookupFacility = raContext.getEventLookupFacility();

        try {
        	this.getResponseEvent = eventLookupFacility.getFireableEventType(new EventTypeID("GetResponseEvent", "org.restcomm", "2.0"));
        	this.putResponseEvent = eventLookupFacility.getFireableEventType(new EventTypeID("PutResponseEvent", "org.restcomm", "2.0"));
        	this.deleteResponseEvent = eventLookupFacility.getFireableEventType(new EventTypeID("DeleteResponseEvent", "org.restcomm", "2.0"));
        }
        catch(Exception e) {
        	if(tracer.isWarningEnabled())
        		tracer.warning("Could not look up Response Event",e);
        }	
	}
1146662
@Override
    public void configure(String parameters) {
        if (parameters.isEmpty()) {
            return;
        }
        List<String> values = Op.split(parameters, " ");
        int required = 4;
        if (values.size() < required) {
            throw new RuntimeException(String.format(
                    "[configuration error] term <%s> requires <%d> parameters",
                    this.getClass().getSimpleName(), required));
        }
        Iterator<String> it = values.iterator();
        setLeft(Op.toDouble(it.next()));
        setRising(Op.toDouble(it.next()));
        setFalling(Op.toDouble(it.next()));
        setRight(Op.toDouble(it.next()));
        if (values.size() > required) {
            setHeight(Op.toDouble(it.next()));
        }
    }
679790
public static void configure() {
        InputStream inputStream = null;

        try {
            URL configUrl = getConfigUrl();

            if (configUrl == null) {
                throw new ConfigurationException("esigate.properties configuration file "
                        + "was not found in the classpath");
            }

            inputStream = configUrl.openStream();

            Properties merged = new Properties();
            if (inputStream != null) {
                Properties props = new Properties();
                props.load(inputStream);
                merged.putAll(props);
            }

            configure(merged);
        } catch (IOException e) {
            throw new ConfigurationException("Error loading configuration", e);
        } finally {
            try {
                if (inputStream != null) {
                    inputStream.close();
                }

            } catch (IOException e) {
                throw new ConfigurationException("failed to close stream", e);
            }
        }
    }
1013925
public void configure(Object configuration) {

        if (!(configuration instanceof Properties) && !(configuration.toString() instanceof String))
            throw new IllegalArgumentException("Configuration for DAR must be of type Properties or String; "
                    + configuration.getClass().getName() + " was received");

        Properties properties = new Properties();
        if (configuration instanceof String) {
            try {
                properties.load(new StringReader((String) configuration));
            } catch (IOException e) {
                throw new IllegalArgumentException(e);
            }
        } else if (configuration instanceof Properties) {
            properties = (Properties) configuration;
        }
        try {
            defaultSipApplicationRouterInfos = this.defaultApplicationRouterParser.parse(properties);
        } catch (ParseException e1) {
            throw new IllegalArgumentException("Failed to parse the new DAR properties", e1);
        }

        String configFileLocation = defaultApplicationRouterParser.getDarConfigurationFileLocation();

        if (configFileLocation.startsWith("file:/")) {
            int i = 5;
            while (configFileLocation.charAt(i) == '/')
                i++;
            configFileLocation = configFileLocation.substring(i - 1);
        } else {
            log.warn("Can not write persist DAR configuration to "
                    + configFileLocation
                    + ". Make sure you have write permissions and make sure it's a local file. NOTE THAT THE NEW DAR CONFIGURATION IS LOADED AND EFFECTIVE.");
            return;
        }

        if (configFileLocation == null || configFileLocation.length() < 1)
            throw new IllegalStateException("Configuration file name is empty.");

        File configFile = new File(configFileLocation);
        FileOutputStream fis = null;
        try {
            fis = new FileOutputStream(configFile);
            properties.store(fis, "Application Router Configuration");
        } catch (Exception e) {
            throw new IllegalStateException("Failed to store configuration file.", e);
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    log.error("fail to close the following file " + configFile.getAbsolutePath(), e);
                }
            }
        }

        log.info("Stored DAR configuration in " + configFile.getAbsolutePath());
    }
1118163
public static void setSpecificSARLConfigurationFor(
			IProject project,
			IPath outputPath) {
		final IPreferenceStore preferenceStore = getSARLPreferencesFor(project);
		// Force to use a specific configuration for the SARL
		preferenceStore.setValue(IS_PROJECT_SPECIFIC, true);

		// Loop on the Xtext configurations embedded in the SARL compiler.
		String key;
		for (final OutputConfiguration projectConfiguration : getXtextConfigurationsFor(project)) {
			//
			// OUTPUT PATH
			key = BuilderPreferenceAccess.getKey(
					projectConfiguration,
					EclipseOutputConfigurationProvider.OUTPUT_DIRECTORY);
			preferenceStore.setValue(key, outputPath.toOSString());

			//
			// CREATE THE OUTPUT DIRECTORY
			key = BuilderPreferenceAccess.getKey(
					projectConfiguration,
					EclipseOutputConfigurationProvider.OUTPUT_CREATE_DIRECTORY);
			preferenceStore.setValue(key, true);

			//
			// OVERWRITE THE EXISTING FILES
			key = BuilderPreferenceAccess.getKey(
					projectConfiguration,
					EclipseOutputConfigurationProvider.OUTPUT_OVERRIDE);
			preferenceStore.setValue(key, true);

			//
			// SET GENERATED FILES AS DERIVED
			key = BuilderPreferenceAccess.getKey(
					projectConfiguration,
					EclipseOutputConfigurationProvider.OUTPUT_DERIVED);
			preferenceStore.setValue(key, true);

			//
			// CLEAN THE GENERATED FILES
			key = BuilderPreferenceAccess.getKey(
					projectConfiguration,
					EclipseOutputConfigurationProvider.OUTPUT_CLEANUP_DERIVED);
			preferenceStore.setValue(key, true);

			//
			// CLEAN THE OUTPUT DIRECTORY
			key = BuilderPreferenceAccess.getKey(
					projectConfiguration,
					EclipseOutputConfigurationProvider.OUTPUT_CLEAN_DIRECTORY);
			preferenceStore.setValue(key, true);
		}
	}
1357399
public void configure(int resId) {
        Resources resources = context.getResources();

        try {
            InputStream rawResource = resources.openRawResource(resId);
            Properties properties = loadProperties(rawResource);
            startConfiguration(properties);
        } catch (NotFoundException e) {
            Log.e(TAG, "Did not find  resource." + e);
        } catch (IOException e) {
            Log.e(TAG, "Failed to read the resource." + e);
        }
    }
147294
public void setConfigurationProperties(java.util.Collection<SdkConfigurationProperty> configurationProperties) {
        if (configurationProperties == null) {
            this.configurationProperties = null;
            return;
        }

        this.configurationProperties = new java.util.ArrayList<SdkConfigurationProperty>(configurationProperties);
    }