You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Chris Papagrigoriou (JIRA)" <ji...@apache.org> on 2012/05/23 02:42:41 UTC

[jira] [Created] (SLING-2491) How can I change the self.registration.enabled property in java?

Chris Papagrigoriou created SLING-2491:
------------------------------------------

             Summary: How can I change the self.registration.enabled property in java?
                 Key: SLING-2491
                 URL: https://issues.apache.org/jira/browse/SLING-2491
             Project: Sling
          Issue Type: Task
          Components: JCR
    Affects Versions: JCR Jackrabbit User Manager 2.1.0
         Environment: Xubuntu
            Reporter: Chris Papagrigoriou


Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
I tried it via the ConfigurationAdmin but it doesn't seem to work.

Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Chris Papademos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13410258#comment-13410258 ] 

Chris Papademos commented on SLING-2491:
----------------------------------------

A word and a blow. What if config.getProperties() returns null though? Or am I doing something wrong?

public void activateSelfRegistration(BundleContext context) {
		ServiceReference reference = context
				.getServiceReference(ConfigurationAdmin.class.getName());
		ConfigurationAdmin confAdmin = (ConfigurationAdmin) context
				.getService(reference);
		try {
			Configuration config = confAdmin.getConfiguration("org.apache.sling.jackrabbit.usermanager.impl.post.CreateUserServlet");
			Dictionary props = config.getProperties();
			if (props == null) {
				System.out.println("This is not supposed to happen...");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
                
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler closed SLING-2491.
-----------------------------------

    
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Chris Papademos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411376#comment-13411376 ] 

Chris Papademos commented on SLING-2491:
----------------------------------------

I found out, why I get null when using config.getProperties()

Upon starting sling for the first time, the Component CreateUserServlet doesn't have any Configuration bound to it, thats why I get null.

I dont know though how to bind the UserManager Configuration to the Component, without using the UI. Maybe I should just modify the sling source and recompile...
                
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Chris Papademos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13410190#comment-13410190 ] 

Chris Papademos commented on SLING-2491:
----------------------------------------

Sorry for posting it at the wrong place. I tried to change the property by using the ScrService:

@SuppressWarnings("unchecked")
	public void activateSelfRegistration(BundleContext context) {
		ServiceReference reference = context.getServiceReference( ScrService.class.getName() );
		ScrService scrService = (ScrService) context.getService(reference);
		Component component = scrService.getComponent(17);
		component.getProperties().put("self.registration.enabled", true);
		context.ungetService(reference);
	}
                
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Chris Papademos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13411376#comment-13411376 ] 

Chris Papademos edited comment on SLING-2491 at 7/11/12 10:18 AM:
------------------------------------------------------------------

I found out, why I get null when using config.getProperties()

Upon starting sling for the first time, the Component CreateUserServlet doesn't have any Configuration bound to it, thats why I get null. Just adding the key-value pair "self.registration.enabled"-"true" doesn't seem to work and I don't know how to bind the UserManager Configuration to the Component, without using the UI. Maybe I should just modify the sling source and recompile...
                
      was (Author: odiny):
    I found out, why I get null when using config.getProperties()

Upon starting sling for the first time, the Component CreateUserServlet doesn't have any Configuration bound to it, thats why I get null.

I dont know though how to bind the UserManager Configuration to the Component, without using the UI. Maybe I should just modify the sling source and recompile...
                  
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13410092#comment-13410092 ] 

Carsten Ziegeler commented on SLING-2491:
-----------------------------------------

Your first approach using the config admin is the correct way, could you post what you exactly tried?
In the future, if you have questions, please use the mailing list and not the issue tracker. Thanks
                
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13412593#comment-13412593 ] 

Carsten Ziegeler commented on SLING-2491:
-----------------------------------------

First, use confAdmin.getConfiguration(pid, null) - this ensures that a new configuration is not bound to your code.
Second, config.getProperties() returns null, if this is a new configuration, in that case just create a new dictionary
Once you call update(Dictionary), either a new configuration with these values is created or the existing one is updated

For further information please read chapter 104 of the OSGi compendium spec (Configuration Admin)
                
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13410231#comment-13410231 ] 

Carsten Ziegeler commented on SLING-2491:
-----------------------------------------

You can't change the prop through the scr service, you have to use the config admin: get the configuration from the config admin, get the properties from the configuration, change the property and then call update(props) on the configuration
                
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler resolved SLING-2491.
-------------------------------------

    Resolution: Invalid
    
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2491) How can I change the self.registration.enabled property in java?

Posted by "Chris Papademos (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2491?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13409587#comment-13409587 ] 

Chris Papademos commented on SLING-2491:
----------------------------------------

I was able to access the self.registration.enabled property by using the SrcService.

	ServiceReference reference = context.getServiceReference( ScrService.class.getName() );
		ScrService scrService = (ScrService) context.getService(reference);
		Component component = scrService.getComponent(17);
		component.getProperties().put("self.registration.enabled", true);

After trying to add a new User, it still doesn't seem to work. self.registration.enabled is still on false. Anyone knows what's missing?
                
> How can I change the self.registration.enabled property in java?
> ----------------------------------------------------------------
>
>                 Key: SLING-2491
>                 URL: https://issues.apache.org/jira/browse/SLING-2491
>             Project: Sling
>          Issue Type: Task
>          Components: JCR
>    Affects Versions: JCR Jackrabbit User Manager 2.1.0
>         Environment: Xubuntu
>            Reporter: Chris Papagrigoriou
>
> Hey I kinda can't find out how to change the the self.registration.enabled property of the CreateUserServlet.
> I tried it via the ConfigurationAdmin but it doesn't seem to work.
> Can anyone tell me how to change it?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira