G Suite Developers Blog
Information for G Suite Developers
Dito Directory integration with Google Apps
March 10, 2010
Editor's Note: This post was written by Jim McNelis and Vinay Thakker of
Dito
, a provider of Google Apps deployment, training, integration, and support services, and makers of Dito Directory
. We invited Dito to share their experiences building an application for the
Google Apps Marketplace
on top of Google Apps utilizing some of our APIs. You can meet Dito at
Google I/O
May 19 - 20 in San Francisco where they will be in the
Developers Sandbox
.
The Google Apps Marketplace is a
great sales channel
that allows us to market our products to millions of Google Apps users. Dito Directory for Google Apps is just the first step for Dito's custom application development on Google technologies like Google App Engine, Google Apps APIs, and Google Web Toolkit. We are excited that Google is now providing us with an advantageous delivery platform for 3rd party apps.
Dito, an IT solution provider specializing in Google Apps, was founded in 2007 by brothers Jim and Dan McNelis to help small and medium sized business enhance their IT infrastructure with cloud-based solutions. Since then, upwards of 40% of our customers have found us on the Google Apps Marketplace, so it was a logical choice to list our application there as well.
The Google Apps Marketplace allows domain administrators to install Dito Directory with a couple easy clicks, making the purchase as painless as possible. Dito Directory uses OpenID for user authentication, which means no additional login is necessary. Once installed via the Marketplace, Dito Directory becomes accessible instantly for Google Apps users via Google's universal navigation.
Dito Directory was developed as a result of customer demand for better contact management. We make it easy to import your existing contacts in bulk via the Google Spreadsheets API, which polls an admins spreadsheets and allows them to easily import existing contacts. As with all of our interactions with user and company data, we leverage 2-legged OAuth for authentication and OpenID for single sign-on. This allows our application to safely and securely access your information without the risk of compromising it to 3rd parties.
Sometimes, Google Apps users need more direct access to a domain shared contact's information. With the "Copy to My Contacts" feature in Dito Directory, admins and users can copy any domain shared contact to their personal contacts, instantly. If a users contacts are synced with their mobile device, the contact will show up on their device nearly as fast. Dito Directory interacts directly with a users contacts via the Contacts API.
Enough about the what and the why...let's talk about how we developed Dito Directory. For that, Vinay Thakker, our Google App Engine-eer, is going to give you his perspective.
Leveraging Google scalability
A week before the launch, we decided to gut the app and start fresh. Despite my successes with application architecture in the past, there was one big thing, from a developer's standpoint, that I didn't like with our first attempt:
It didn't scale well.
Of course, I mean that in terms of adding features to it, since App Engine effortlessly handles the load distribution and scaling for us. As the client-side of our app grew, its statefulness became exponentially more difficult to manage. Most of our widgets needed to know about the state of other widgets. Generally, for UI elements, we do this using events. The number of event handlers required to obtain complete state communication in the application grows like the graph of a factorial with each additional widget (no kidding, it's painful).
My initial design was the bomb, though. So, why change?
The ease of using GWT makes developing event handlers a breeze, so in the beginning you may not realize what you're signing yourself up for. You can make a monstrous improvement by centralizing your event bus. In doing this, you should consider using the
command pattern design
. It's benefits are ridiculously awesome, and how you would implement it is probably better to be left to Wikipedia to explain, since that's what I would paraphrase.
Browser history and state related issues
The second big thing that helped us was when we decided to account for browser history. You have to do this from the beginning of your design, but the good news is it's freakin' easy to implement. I'll show you how in a minute, but first let me mention that implementing GWT's History class is a forcing function for state in your application. By virtue of implementing history across our application, we solved 91% of our state-related issues. On top of that, the user gets their beloved back and forward browser buttons back, as well as some other cool stuff, like the ability to bookmark and link to states of Directory. Using GWT's built-in History class is a two-and-a-half step process. Here's how you do it:
Step 1
: Create a class that implements the HistoryListener interface. It's really just one function, onHistoryChanged, in which you tell the app how it should render itself, based on the incoming state. Make it short; have your main class that does onModuleLoad implement HistoryListener.
public class MyApp implements EntryPoint, HistoryListener
{
public void onModuleLoad()
{
}
public void onHistoryChanged(String historyToken)
{
}
}// MyApp
Step 2
: Tell the History class that you have a class that wants to listen to changes in the History state. Let's do this in onModuleLoad(). Also, you can choose to fire off the current history state so your onHistoryChange method from above gets called on load. If it makes sense for your app, force it into an initial state, also shown here.
public void onModuleLoad()
{
if (History.getToken().isEmpty())
History.newItem(“myInitialState”);
History.addHistoryListener(this);
History.fireCurrentHistoryState(this);
}
Step 2.5
: This isn't really a step. This part belongs to all of the development you would have been doing anyway. This is where you actually add code to your onHistoryChanged method to make it do something useful based on the state.
public void onHistoryChanged(String historyToken)
{
if (“myInitialState”.equals(historyToken))
{
// render the app appropriately for this state.
// this state is accessible at thisPage.html#myInitialState
}
if (“myOtherStateName”.equals(historyToken))
{
// render it another way..
}
}
You can see how this would force state on your app. You'll find that in a lot of cases, you will be able to use traditional anchor links where you might have otherwise created a new Java function and binded it to the onClick event of some object or widget.
Cool stuff. Let us know what you think, or ask Vinay a question, email vinay@ditoweb.com.
Free Trial
Labels
.NET
3
#io15
1
#io16
1
Admin SDK
10
Administrative APIs
31
AdSense
1
analytics
5
Android
8
API
3
APIs
3
App Engine
5
Apps
1
Apps Script
118
Audit
2
Auth
5
billing
4
Charts
2
Chrome OS
1
classroom
3
Cloud Storage API
1
Community
1
decks
1
Design
1
Developers
12
Directory API
3
Drive
4
Drive SDK
41
execution API
2
Firebase
1
Forms
1
Freemium
1
Fusion Tables
2
G Suite
24
Gadgets
5
Gmail
7
Gmail APIs
23
Google
3
Google APIs
36
Google Apps
33
Google Apps Marketplace
7
Google Calendar API
25
Google Classroom
4
Google Cloud Directory
1
Google Contacts API
4
Google Data Protocol
8
google docs
5
Google Docs API
22
Google Drive
8
Google Drive SDK
7
Google Forms
8
Google I/O
3
Google Prediction API
3
Google Profiles API
2
Google sheets
11
Google Sheets API
7
Google Sites API
5
Google Slides API
10
Google Spreadsheets API
5
Google Talk
1
Google Tasks API
8
Google+
3
googlenew
1
Groups
2
GSuite
3
Guest Post
43
Hangouts Chat API
1
I
1
Inbox
1
iOS
2
issue tracker
1
ISVs
2
java
1
JavaScript
6
marketing
3
Marketplace
47
Marketplace ISV Guest
21
Migration
2
Mobile
5
mpstaffpick
1
oauth
16
OpenID
8
PHP
1
presentations
1
python
7
realtime API
2
Resellers
2
Ruby
1
SaaS
1
security
5
Sheets API
3
spreadsheets
3
Staff Picks
2
tool
1
tools
2
tutorials
2
video
4
videos
1
webinar
2
Archive
2018
Jul
Jun
May
Mar
Feb
Jan
2017
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2016
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Jan
2015
Dec
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
2014
Dec
Oct
Sep
Aug
Jul
Jun
May
Mar
Feb
Jan
2013
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2012
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2011
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2010
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Feed
Google
on
Follow @gsuitedevs