Home

 

Create and populate communities


Overview

Use scripts accessed using the wsadmin command-line tool to create and populate a community. You can only add individuals to a community; you cannot add a group to a community. Changes to Communities administrative settings do not require a server restart to take effect, and no file checkout is necessary.

To use administrative commands, use the wsadmin client.

The config-admin Jython scripts that get and set properties use the implicit AdminConfig object available in IBM WebSphere Application Server Admin (wsadmin) to interact with the Communities server. If an error occurs when you are using the MBean following commands, you can determine what went wrong by examining the SystemOut.log file.


Create and populate a new community

  1. Start the wsadmin client so that you can access Communities configuration files.

    1. Access the Communities configuration files:

      If you are asked to select a server, you can select any server.

  2. Community and populate it with a set of members.

    Option Description
    CommunitiesService.createCommunityWithEmail(String community name, String ownerName, int memberRole, String dsmlFile) Creates a community whose membership list is initialized from a Directory Services Markup Language (DSML) file exported from the LDAP The DSML file must be local to the system running the script. For more information about how to create DSML files from your LDAP directory, see http://www.dsmltools.org/.

    The script parses the DSML file and extracts the mail values. These values are used to populate the membership list of the community. A typical mail attribute in a DSML file is

    <attr name="mail">
     <value>john_doe@example.com</value>
    </attr>
    

    In the following example, a community named AJ's Community is created with Ann Jones as the community owner/creator. The command parses the file /opt/myDSML.xml, looks for each of the mail attributes, and then adds those e-mail addresses to the new community with member access.

      CommunitiesService.createCommunityWithEmail("AJ's Community", "ann_jones@example.com", 1, "/opt/myDSML.xml")

    1. communityName, ownerName, and dsmlFile are strings and must be enclosed in quotation marks (").

    2. memberRole can be set to 0 (member) or 1 (owner). Do not enclose this setting in quotation marks.
    CommunitiesService.createCommunityWithLoginName(String communityName, String ownerName, int memberRole, String dsmlFile) Creates a community whose membership list is initialized from a DSML file exported from the LDAP The DSML file must be local to the system running the script. For more information about how to create DSML files from your LDAP directory, see http://www.dsmltools.org/.

    The script parses the DSML XML file and extracts the login name values. These values are used to populate the membership list of the community. In the following example, a community named AJ's Community is created with Ann Jones as the community owner/creator. The command parses the file /opt/myDSML.xml and looks for each of the login attributes and adds those login names to the new community with member access.

      CommunitiesService.createCommunityWithLoginName("AJ's Community", "ann_jones", 1, "/opt/myDSML.xml")

    1. communityName, ownerName, and dsmlFile are strings and must be enclosed in quotation marks.

    2. memberRole can be set to 0 (member) or 1 (owner). Do not enclose this setting in quotation marks.

 

Related tasks

Administer Communities
Add owners and members to a community

+

Search Tips   |   Advanced Search