January 9, 2010

Good Weekend

Hope everyone is having a good weekend...

January 8, 2010

AzMan API Library II

To continue my post on the AzMan Library, I wanted to show all the basic classes and makeup and since I briefly discussed it yesterday, I figure it is worth showing:
//AzLibApplication
IAzApplication _app;

public AzLibApplication(object app)
{
_app = (IAzApplication)app;
}

public IAzApplication Native
{
get { return _app; }
}

public string Name
{
get { return _app.Name; }
}

public string Description
{
get { return _app.Description; }
}

public List<AzLibOperation> Operations
{
get { return AzLibAzManHelper.GetOps((IAzOperations)_app.Operations); }
}

public List<AzLibRole> Roles
{
get {
return AzLibAzManHelper.GetRoles(
this,
(IAzRoles)_app.Roles,
(IAzTasks)_app.Tasks
);
}
}

public List<AzLibTask> Tasks
{
get { return AzLibAzManHelper.GetTasks((IAzTasks)_app.Tasks); }
}

public List<AzLibScope> Scopes
{
get { return AzLibAzManHelper.GetScopes(this, (IAzScopes)_app.Scopes); }
}

public List<AzLibApplicationGroup> ApplicationGroups
{
get { return AzLibAzManHelper.GetApplicationGroups((IAzApplicationGroups)_app.ApplicationGroups); }
}

I mentioned yesterday the simple objects...some examples below:

public class AzLibOperation
{
IAzOperation _op;

public AzLibOperation(object op)
{
_op = (IAzOperation)op;
}

public string Name
{
get { return _op.Name; }
}

public string Description
{
get { return _op.Description; }
}

public int OperationID
{
get { return _op.OperationID; }
}
}
Store:
 IAzAuthorizationStore _store;

public AzLibStore(IAzAuthorizationStore store)
{
_store = store;
}

public List<AzLibApplication> Applications
{
get { return AzLibAzManHelper.GetApplications((IAzApplications)_store.Applications); }
}

The API Library as I mentioned is broken out into two assemblies and the first one is what I have been explaining yesterday and today. This weekend I'll explain the second part and post the code for the two assemblies. Next week, I'll get onto secondary applictions built off this API such as the AzMan reporter.

January 7, 2010

AzMan API Library

Over the years my work with AzMan has forced me created many applications and libraries. Having re-worked my original Lib, I feel that I need to first show the lib code before we can even get to the secondary external applications that I built around this. The library contains a ton of classes and I will go through some of them this week and upload them as well. I'll start by going through the main AzManHelper class:


public static List<AzLibRole> GetRoles(ITasksSource tasksSource, IAzRoles roles, IAzTasks tasks)
{
List<AzLibRole> result = new List<AzLibRole>();
NamedTasks namedTasks = new NamedTasks(tasks);
List<string> usedTasks = new List<string>();

for (int it = 0; it < roles.Count; it++)
{
IAzRole role = (IAzRole)roles[it + 1];
IAzTask task = namedTasks.FindMatchingTask(role);

if (task != null)
{
result.Add(new AzLibRole(tasksSource, role, task));

// Keep trach of the used task
usedTasks.Add(task.Name);
}
else
{
result.Add(new AzLibRole(tasksSource, role));
}
}

for (int it = 0; it < tasks.Count; it++)
{
IAzTask task = (IAzTask)tasks[it + 1];

if (usedTasks.Contains(task.Name) == false)
{
if (InteropHelper.IsTrue(task.IsRoleDefinition))
result.Add(new AzLibRole(tasksSource, task));
}
}

return result;
}

public static List<AzLibOperation> GetOps(IAzOperations ops)
{
List<AzLibOperation> result = new List<AzLibOperation>();

for (int it = 0; it < ops.Count; it++)
{
result.Add(new AzLibOperation(ops[it + 1]));
}

return result;
}

public static List<AzLibScope> GetScopes(AzLibApplication app, IAzScopes scopes)
{
List<AzLibScope> result = new List<AzLibScope>();

for (int it = 0; it < scopes.Count; it++)
{
result.Add(new AzLibScope(scopes[it + 1], app));
}

return result;
}

public static List<AzLibApplication> GetApplications(IAzApplications apps)
{
List<AzLibApplication> result = new List<AzLibApplication>();

for (int it = 0; it < apps.Count; it++)
{
result.Add(new AzLibApplication(apps[it + 1]));
}

return result;
}

public static List<AzLibApplicationGroup> GetApplicationGroups(IAzApplicationGroups groups)
{
List<AzLibApplicationGroup> result = new List<AzLibApplicationGroup>();

for (int it = 0; it < groups.Count; it++)
{
result.Add(new AzLibApplicationGroup(groups[it + 1]));
}

return result;
}

public static AzLibClientContext GetContext(AzLibApplication app)
{
IAzClientContext context = app.Native.InitializeClientContextFromToken(0, null);
return new AzLibClientContext(context);
}

The above does not show, but the AzLibOperation (and tasks, roles, etc.) just are simple objects that are gets of the Name, Description, and ID from AzMan. It will be clear once you look at all the code...but let's take it one step at a time.

January 6, 2010

All nighter...

Still up trying to get things done for a deadline today...I am finally almost done!

January 5, 2010

Crazy Day

I will do my best to post the AzMan reporter sometime this week as someone just requested it...

January 4, 2010

Start Android Application on Boot

Here is an article on how to do that...will try it out tomorrow.

January 3, 2010

Powerboots

It has been a long time since I used powerboots...I had a need for it today and you can find the codebase on codeplex.