Increasing library size for Connections communities using policies

A customer wanted more files to be added to a particular five communities. The default is a cumulative 512MB allowed to be uploaded to a community library. Changing the global value from 512MB to 1GB wasn’t the way to go about it so a new policy needed to be created to be applied to these five communities.

The customer wasn’t allowed access to the communities so the easiest way was to use the browse option as we only had the user’s word on what the name of all five were and searching on the name would require the syntax to be correct which it turns out was not the case…..

Start wsadmin

execfile(“D:\IBM\WebSphere\AppServer\profiles\Dmgr01\config\bin_lc_admin\filesAdmin.py”)

FilesLibraryService.browseCommunity(“title”, “true”, 1, 20)

FilesLibraryService.browseCommunity(“title”, “true”, 2, 20)

And so forth
FilesLibraryService.browseCommunity(“title”, “true”, 3, 20)

As I mentioned above, the communities were not listed. I’m not sure why as I do not have access to the servers nor saw the output.

As a catch all I asked the customer to dump all the communities using the following command

FilesLibraryService.exportSyncedResourceInfo(“c:/community_output.xml”, “community”)

(Note – It is meant to be a forward slash as it’s an xml).

This listed all their communities and from it I was able to find that the community names provided by the user were incorrect.

Now the syntax of the community names were corrected the following command was used which provided the community information.

commList = FilesLibraryService.browseCommunity(“title”, “true”, 1, FilesLibraryService.getCommunityCount())

FilesUtilService.filterListByString(commList, “title”, “Community”)

Output of the command is as follows (actual output after new policy applied):

FilesLibraryService.getById(“66530fc2-2859-48aa-a376-8ade74782611”)
{maximumSize=1073741824, size=523164256, percentUsed=0.4872346818447113, summary
=, createDate=Tue Feb 05 12:02:54 CET 2013, policyId=a4785094-6804-40a0-b68c-005
8e0541d91, externalContainerId=c702d7f1-c297-418e-b4a8-50ac1ee0aff2, themeName=d
efault, label=W59c3266be40d_4d80_925a_e8e85a278ec2, title=Community, own
erUserId=00000000-0000-0000-0000-000000000000, type=community, id=66530fc2-2859-
48aa-a376-8ade74782611
, externalInstanceId=W59c3266be40d_4d80_925a_e8e85a278ec2,
lastUpdate=Tue Apr 16 14:09:51 CEST 2013}

The libraryid is listed “id” in bold above, that is the value needed.

You can also get this value (which I didn’t realise at the time) in community_output.xml which was run earlier. The xml produced below shows the libraryid which is in bold.

-<snx:resource xmlns:snx=”http://www.ibm.com/xmlns/prod/sn&#8221; name=”Community” widgetInstanceId=”W59c3266be40d_4d80_925a_e8e85a278ec2″ id=”c702d7f1-c297-418e-b4a8-50ac1ee0aff2″ type=”community”>-<snx:creator xmlns:snx=”http://www.ibm.com/xmlns/prod/sn”><email xmlns=”http://www.w3.org/2005/Atom”/><snx:userid xmlns:snx=”http://www.ibm.com/xmlns/prod/sn”>00000000-0000-0000-0000-000000000000</snx:userid></snx:creator>-<snx:lastmodby xmlns:snx=”http://www.ibm.com/xmlns/prod/sn”><email xmlns=”http://www.w3.org/2005/Atom”>joe.bloggs@collaborationben.com</email><snx:userid xmlns:snx=”http://www.ibm.com/xmlns/prod/sn”>88aff0d8-465d-4987-bb4e-c3eea13b51be</snx:userid></snx:lastmodby><snx:property xmlns:snx=”http://www.ibm.com/xmlns/prod/sn&#8221; name=”communityType”>private</snx:property><snx:property xmlns:snx=”http://www.ibm.com/xmlns/prod/sn&#8221; name=”communityThemeId”>default</snx:property><snx:property xmlns:snx=”http://www.ibm.com/xmlns/prod/sn&#8221; name=”contentApproval”>false</snx:property><snx:property xmlns:snx=”http://www.ibm.com/xmlns/prod/sn&#8221; name=”contentFlagging”>false</snx:property><snx:objectIdentifyingTerm xmlns:snx=”http://www.ibm.com/xmlns/prod/sn”>Community</snx:objectIdentifyingTerm><snx:objectIdentifyingId xmlns:snx=”http://www.ibm.com/xmlns/prod/sn”&gt;66530fc2-2859-48aa-a376-8ade74782611</snx:objectIdentifyingId></snx:resource>

Now the libraryid is obtained you have to create a new policy.

Create the policy

FilesPolicyService.add(“1GB Community Policy”, 1073741824)

Take a note of the UUID created (in this format 00000000-0000-0000-0000-000000000000) as this will need to be applied replacing the values in red.

Apply the new policy to the community

FilesLibraryService.assignPolicy(“66530fc2-2859-48aa-a376-8ade74782611”, “string policyId“)

Check that the community is now applied

FilesLibraryService.getById(“66530fc2-2859-48aa-a376-8ade74782611”)

You should see that the values in blue below have changed and are in line with the new policy.

{maximumSize=1073741824, size=523164256, percentUsed=0.4872346818447113, summary
=, createDate=Tue Feb 05 12:02:54 CET 2013, policyId=a4785094-6804-40a0-b68c-005
8e0541d91, externalContainerId=c702d7f1-c297-418e-b4a8-50ac1ee0aff2, themeName=d
efault, label=W59c3266be40d_4d80_925a_e8e85a278ec2, title=Community, own
erUserId=00000000-0000-0000-0000-000000000000, type=community, id=66530fc2-2859-
48aa-a376-8ade74782611
, externalInstanceId=W59c3266be40d_4d80_925a_e8e85a278ec2,
lastUpdate=Tue Apr 16 14:09:51 CEST 2013}

Advertisements

com.ibm.bsf.BSFException when running a wsadmin script

This was seen the other day when attempting to execute a Connections script once connected to wsadmin:

wsadmin>execfile(“/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/bin_lc_admin/wikisAdmin.py”)
WASX7015E: Exception running command: “execfile(“/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/bin_lc_admin/wikisAdmin.py”)”

; exception information:
 com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File “<input>”, line 1, in ?
  File “/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/bin_lc_admin/wikisAdmin.py”, line 19, in ?
NameError: java

This is because the default langauge for wsadmin is JACL and the script is JYTHON.

Ensure when starting the wsadmin utility, “-lang jython” is added to the command line.

Problem creating a community blog – “Error 409: conflict”

The customer reported a problem when trying to add the blogs widget to a community, an “error 409: conflict” appeared stopping the user from being able to create a blog. Interestingly, the user could see from a list of their own blogs a blog with the same name as the community. Further inspection shows that the blog is restricted like the community is.

The history is somewhat unclear, the community owner didn’t know when this broke.

The below is a snippet from the SystemOut.log

07/02/12 16:17:06:226 GMT] 0000002a EventPropagat E com.ibm.lconn.widgets.service.EventPropagater postRemoteEvent CLFWZ0003E: Failed to post event notification to remote widget application handler: Conflict
com.ibm.lconn.widgets.model.NoRetryConflictException: Conflict
at com.ibm.lconn.widgets.service.EventPropagater.postRemoteEvent(EventPropagater.java:467)
at com.ibm.lconn.widgets.service.EventPropagater.addWidget(EventPropagater.java:664)
at com.ibm.lconn.widgets.service.WidgetInfoService.addWidgetPropagateInternal(WidgetInfoService.java:223)
at com.ibm.lconn.widgets.service.WidgetInfoService.addWidget(WidgetInfoService.java:308)
at com.ibm.lconn.widgets.actions.AddWidgetAction.execute(AddWidgetAction.java:67)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)

Checking the community queued events showed nothing pending to be actioned:

wsadmin>CommunitiesQEventService.viewQueuedEventsByResourceType(“community”, None, 100)
Remote App                Resource Id                       Event Type                          Event Id
Forum   1212121-47e4-4c0a-8320-0fe580e39167    remote.app.added        Wdf3e4e9995c1_4051_86be_e2a21c0d264b
Forum   1212121-47e4-4c0a-8320-0fe580e39167    community.prepare.delete        W7932e51b96d8_4fa6_a791_850222cc7942

{EventType=205, InsertedLong=1328106813866, EventId=W7932e51b96d8_4fa6_a791_850222cc7942, ResourceType=1, Inserted=2012-02-01 14:33:33.866, ResourceId=41a5d0d7-47e4-4c0a-8320-0fe580e39167, ResourceTypeStr=community, RemAppDefId=Forum, EventTypeStr=community.prepare.delete}

wsadmin>CommunitiesQEventService.viewQueuedEventsByResourceId(“community”, “123456-ba1e-4fae-9315-1e268bbc7b23”, None, 100)
Remote App                Resource Id                       Event Type                          Event Id

wsadmin>CommunitiesQEventService.viewQueuedEventsByRemoteAppDefId(“Blog”, None, 100)
Resource Type           Resource Id                         Event Type                          Event Id

Enabling trace and taking Fiddler logs provided with nothing more than the “409 conflict” error in the trace.log.

com.ibm.lconn.widgets.*=all:com.ibm.lconn.extdatamodel.*=all:com.ibm.connections.httpClient.*=all

What did work was the following steps all detailed in the Connections wiki.

Comparing remote application data with the Communities database

This step was not really necessary but was more interesting to ensure the IDs tallied.

execfile(“blogsAdmin.py”)

BlogsAdminService.exportSyncedResourceInfo(“/tmp/blogsOutput.xml”, “community”)

blogsOutput.xml
<snx:resource type=”community” id=”04e92737-ba1e-4fae-9315-1e268bbc7b23“>
<snx:property name=”communityType”>private</snx:property>
<snx:property name=”communityThemeId”>blue</snx:property>
<snx:objectIdentifyingTerm>ACME Jobs</snx:objectIdentifyingTerm>
<snx:objectIdentifyingId>65e0bc22-7994-4b39-bca3-37f15b0d0966</snx:objectIdentifyingId>
</snx:resource>

Generating a synchronization report

This produces two documents. The orphanedRemoteApplications.html file lists the remote applications for which there is either no associated community or whose associated community is missing the orphaned data’s widget, this is the one of interest. From it you can see the affected community and the id of the orphaned blog.

execfile(“communitiesAdmin.py”)

CommunitiesRemoteAppService.generateSyncReports(“/tmp/blogsOutput.xml”, “/tmp”)

In the Blog_orphanedRemoteApps.html I see the Community in question (as well as others….)

No widgets with widget definition id of Blog were found.
community name: ACME Jobs
community uuid: 04e92737-ba1e-4fae-9315-1e268bbc7b23
Identifying Term (Blog Name): ACME Jobs
Identifying Id (BlogUuid): 65e0bc22-7994-4b39-bca3-37f15b0d0966

Assigning orphaned remote applications to a community

execfile(“communitiesAdmin.py”)

CommunitiesRemoteAppService.assignRemoteApp(“Blog”, “65e0bc22-7994-4b39-bca3-37f15b0d0966“, “04e92737-ba1e-4fae-9315-1e268bbc7b23“, “04e92737-ba1e-4fae-9315-1e268bbc7b23“, “col2”)

Assignment succeeded

Inspecting the community now shows the blogs widget and the owner has the ability to create a new entry or view previous entries.