public void activate()

in collector/jmx/src/main/java/org/apache/karaf/decanter/collector/jmx/JmxCollector.java [75:107]


    public void activate(ComponentContext context) {
        this.properties = context.getProperties();
        String type = getProperty(this.properties, "type", "jmx-local");
        String url = getProperty(this.properties, "url", "local");
        String username = getProperty(this.properties, "username", null);
        String password = getProperty(this.properties, "password", null);
        String remoteProtocolPkgs = getProperty(this.properties, "jmx.remote.protocol.provider.pkgs", null);
        Dictionary<String, String> serviceProperties = new Hashtable<> ();
        serviceProperties.put("decanter.collector.name", type);

        this.type = type;
        this.url = url;
        this.username = username;
        this.password = password;
        // remove jmx connection credentials from properties to not expose them as collected data
        if (Objects.nonNull(this.username)) this.properties.remove("username");
        if (Objects.nonNull(this.password)) this.properties.remove("password");
        this.remoteProtocolPkgs = remoteProtocolPkgs;

        this.objectNames = new HashSet<> ();
        this.operations = new HashMap<>();
        for (Enumeration<String> e = properties.keys(); e.hasMoreElements(); ) {
        	String key = e.nextElement();
        	if( "object.name".equals( key ) || key.startsWith( "object.name." )) {
        		Object value = this.properties.get( key );
        		if (value != null)
        			this.objectNames.add( value.toString());
        	}
        	if (key.startsWith("operation.name.")) {
        	    operations.put(key.substring("operation.name.".length()), (String) properties.get(key));
            }
        }
    }