41
The Unofficial FAQ for Connections Integration Development.

Uklug 2014 connections dev faq

Embed Size (px)

DESCRIPTION

Developing Connections Plug-ins and applications is full of "What the??" moments, from what browser technologies and versions are supported through to common functions working in different ways in different parts of Connections, any of these can put a real dent in your delivery date but most are easy to cure and avoid with a little bit of hindsight and knowledge, here is that knowledge for you to take home and help you deliver on time.

Citation preview

Page 1: Uklug 2014  connections dev faq

The Unofficial FAQ for Connections Integration

Development.

Page 2: Uklug 2014  connections dev faq

• A Member of the London Developer Co-op

– Twitter: @stickfight

– Email: [email protected]

– skype: stickfight

• Developer from a support background

• 13+ years on IBM technology, 16+ years in IT

Mark Myers

Page 3: Uklug 2014  connections dev faq

This Session

• Connections is a very powerful platform but badly documented and a bit of a patchwork

• Most of the fun things you can do are not on IBM official list of interfaces and methods

• There are tons of WTF moments that can cost you a delivery date, lets see if we can head a couple off at the pass.

Page 4: Uklug 2014  connections dev faq

This Session Content

• Its all in the Config – Lessons learnt and examples of intergrading your code into Connections user interface

• Into the database – Shhhh! we should not be in here, it is the fun place

Page 5: Uklug 2014  connections dev faq

Please Interrupt

(Connections is freaky enough with out trying to remember stuff for later)

Page 6: Uklug 2014  connections dev faq

It’s all in the Config

• Front end Integration with connections is based on 2 standards, IWidget 1.0 and OpenSocial 2.5

• As neither are used much outside of connections its best to avoid them as much as possible and just use normal web standards

Page 7: Uklug 2014  connections dev faq

It’s all in the Config

IWidget 1.0 OpenSocial 2.5

Activity Streams X

Share Dialog X

Home Page X X

User Widgets X X

Profiles X

Communities X

You can only use certain standards in certain places

Page 8: Uklug 2014  connections dev faq

It’s all in the Config

• The easiest way to deal with this is to store BOTH the IWidget and Open social config in your project.

Page 9: Uklug 2014  connections dev faq

IWidget Config Example

This is the “context-root” you can either set in in the ear file application.xml or ask your admin to set it in websphere

Page 10: Uklug 2014  connections dev faq

Opensocial Config Example

A width of 450px is a nice safe width to make central content widgets

Page 11: Uklug 2014  connections dev faq

Showing the Widgets

• You will have to provide your admins with some XML so your widgets show up in the right place.

• This will need to go in the widgets-config.xml

Page 12: Uklug 2014  connections dev faq

Showing the Widgets

• First you need a define the widget e.g.

• And place it inside the<definitions></definitions>

<widgetDef defId=“UKICON 2014 Widget" url="/ukicon2014/iwidgetConfig.xml" modes="view"></widgetDef>

tag (there will be a load of other stuff already in there)

Page 13: Uklug 2014  connections dev faq

Showing the Widgets

• Then tell connections where to show the widget,

• And place it inside the

<widgetInstance uiLocation="col3" defIdRef=" UKICON 2014 Widget"/>

<page pageId=“XXX"></page>

tag “XXX” is the present page name such as “communityOverview” or “profilesView”

Column number

Page 14: Uklug 2014  connections dev faq

It’s a Database thing

• Sometimes the connections ATOM feeds are not enough– Not the data you need– Not fast enough– IBM don’t want you to do that but your

clients do , e.g. edit activity feeds.

• Its time to dig into the real data, the 12 db2 databases that back connections

Page 15: Uklug 2014  connections dev faq

It’s a Database thing – Tips #1

• Each database implements referential integrity, however this does not work across the different databases.

• When asking for database access, the read only db2 role does not cut the mustard as it lets you see the databases but not the contents (all selects will return blank)

Page 16: Uklug 2014  connections dev faq

It’s a Database thing – Tips #2

• The 12 Databases are never really meant to see each other, so there is a lot of reuse of identifier names (fields and tables)– This means that most of the automatic

reverse engineering tools (hibernate, JPA etc etc), get really confused when you import multiple databases as well as eating up a lot of memory

– Stick to static SQL if you have multiple database apps.

Page 17: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

• Recommended SQL client for dealing with Connections Dev is Squirrel SQL (http://squirrel-sql.sourceforge.net/) – Java client So experiences the same

issues as your code– Uses IBM’s own jar files.– hellishly powerful– FREE

Page 18: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

• Downloaded and run the install Jar– Only change on a default install is to

select the IBM DB2 option (just a tick box)

Page 19: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

• When you first open it you will get a screen like this (We need to do some config)

Page 20: Uklug 2014  connections dev faq

It’s a Database thing – Connecting• Click on the big “Drivers” button on the left hand

side, find the “IBM DB2 App Driver” entry, you will see that like nearly all the other entries, it has a red X by it,

Page 21: Uklug 2014  connections dev faq

It’s a Database thing – Connecting• Now Double Click on the entry and in the pop up

box, move to the “Extra Class Path” Tab

Page 22: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

• Next click on the “Add” button and go hunting for the driver Jar files, these are best to get of the DB2 server, they are:– db2jcc.jar– db2jcc_licence_cu.jar

• You will tend to find them on any machine that has db2 installed in the directory

• X:\Program Files\IBM\SQLLIB\java• Once you have added them, change the “Class

Name” drop down to– com.ibm.db2.jcc.DB2Driver

Page 23: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

Page 24: Uklug 2014  connections dev faq

It’s a Database thing – Connecting• That’s you driver sorted, now make some

connections– Click on the “Aliases” button then the “+” button to add

a new Aliases

Page 25: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

• Select the driver you just setup, from the drop down field

• Then in the URL field put the connection string for the database you want to get to in the format

jdbc:db2://XXX.XXX.XXX.XXX:50000/XXXX (port 50000 is the default port for db2)

for example• jdbc:db2://localdb2.ldc.com:50000/BLOGSwill get me the blogs database on my local server

Page 26: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

• Connections App: Files, DataBase: FILES• Connections App: Activities, DataBase: OPNACT• Connections App: Blogs, DataBase: BLOGS• Connections App: Communities, DataBase: SNCOMM• Connections App: Community Events, DataBase: SNCOMM• Connections App: HomePage , News,

Search, DataBase: HOMEPAGE• Connections App: Metrics, DataBase: METRICS• Connections App: Mobile, DataBase: MOBILE• Connections App: Profiles, DataBase: PEOPLEDB• Connections App: Wiki, DataBase: WIKIS• Connections App: BookMarks, DataBase: DOGEAR• Connections App: Forums, DataBase: FORUM

The Full List of connections databases:

Page 27: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

• Then just use enter the username and password (hint, you will NEVER get the lsuser account off your admin)

• Click “OK”

Page 28: Uklug 2014  connections dev faq

It’s a Database thing – Connecting

You now have an alias that you can double click to connect to the specified database, You are going to have to create one for each of the Connections databases You can make things easier by right clicking on a alias and copying

Page 29: Uklug 2014  connections dev faq

It’s a Database thing – ConnectingSquirrel SQL makes it easy to backup tables, so you can work locally to test your SQL

- “Create Table Script” to make a clone of the table- “Create Data Script” to make a clone of the data

Page 30: Uklug 2014  connections dev faq

It’s a Database thing – Version

• The database fields are a moving target

• You need to be able to tell which version you are connected to.

• Each database has its own schema version

Page 31: Uklug 2014  connections dev faq

It’s a Database thing – Version

Eg. for the home page db: SELECT DBSCHEMAVER FROM

"HOMEPAGE"."HOMEPAGE_SCHEMA";– Connections v4.0 BASE : 110 – Connections v4.5 BASE: 210 – Connections v4.5 CR4 : 213

•http://www.stickfight.co.uk/blog/Living-Document-Connections-Db-Schema-Versions

Page 32: Uklug 2014  connections dev faq

It’s a Database thing – Clob

• IBM are fond of the CLOB data type• Designed to store ASCII text data,

including formatted text such as HTML or PostScript.

• A pain to get via SQL

Page 33: Uklug 2014  connections dev faq

It’s a Database thing – Clob

Page 34: Uklug 2014  connections dev faq

It’s a Database thing – Clob

SELECT DBMS_LOB.substr(VALUE, 3000) FROM "BLOGS"."ROLLER_PROPERTIES" where NAME = 'database.schema.version';

Page 35: Uklug 2014  connections dev faq

It’s a Database thing – User IDS

• In Connections each application and database contains a separate user name table

• This table stores a foreign key that is the global directory ID provided by the profile database.

Page 36: Uklug 2014  connections dev faq

It’s a Database thing – User IDS

Page 37: Uklug 2014  connections dev faq

It’s a Database thing – User IDS

Page 38: Uklug 2014  connections dev faq

It’s a Database thing – User IDS

Page 39: Uklug 2014  connections dev faq

Summing Up #1

• The basic integration interfaces you will end up using will be– Standard Eclipse dynamic web project

using your framework of choice to make content + a few IBM config files

– Command Line Jar– Notes / Xpages

Page 40: Uklug 2014  connections dev faq

Summing Up #2

• Do NOT expect the IBM interfaces to deliver on the marketing promise, – The IBM devs are not given enough time

to complete any given interface or framework

• Do NOT treat connections as a unified frame work – Treat is like a Websphere box with access

to db2, Congnos, file net etc etc and a load of pre done apps

Page 41: Uklug 2014  connections dev faq

Questions / Abuse ?