Uklug 2014 connections dev faq

Post on 29-Nov-2014

303 views 3 download

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.

Transcript of Uklug 2014 connections dev faq

The Unofficial FAQ for Connections Integration

Development.

• A Member of the London Developer Co-op

– Twitter: @stickfight

– Email: Mark@londc.com

– skype: stickfight

• Developer from a support background

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

Mark Myers

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.

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

Please Interrupt

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

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

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

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.

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

Opensocial Config Example

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

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

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)

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

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

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)

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.

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

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)

It’s a Database thing – Connecting

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

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,

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

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

It’s a Database thing – Connecting

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

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

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:

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”

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

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

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

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

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

It’s a Database thing – Clob

It’s a Database thing – Clob

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

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.

It’s a Database thing – User IDS

It’s a Database thing – User IDS

It’s a Database thing – User IDS

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

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

Questions / Abuse ?