ApplicationManager.java revision 7fbf6b22256a0379d74136f78c432dd19cfef6fc
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: ApplicationManager.java,v 1.11 2010/01/13 23:41:57 veiming Exp $
*/
/**
* Application Manager handles addition, deletion and listing of applications
* for each realm.
*/
public final class ApplicationManager {
private static final ReentrantReadWriteLock readWriteLock =
new ReentrantReadWriteLock();
private ApplicationManager() {
}
/**
* Returns the application names in a realm.
*
* @param adminSubject Admin Subject who has the rights to access
* configuration datastore.
* @param realm Realm name.
* @param filters Search Filters
* @return application names in a realm.
*/
) throws EntitlementException {
}
}
) {
try {
}
}
} catch (EntitlementException ex) {
"ApplicationManager.fitlerApplicationNames", ex);
}
}
} else {
}
return results;
}
for (SearchFilter f : filters) {
return false;
}
return false;
}
return false;
}
} else if (filterName.equals(
return false;
}
f.getOperator())
) {
return false;
}
} else if (filterName.equals(
){
f.getOperator())
) {
return false;
}
}
}
return true;
}
private static boolean match(
long value,
long pattern,
) {
}
}
}
return false;
}
}
char c = strPattern.charAt(i);
if (c == '*') {
} else {
}
}
if (lastChar == '*') {
} else {
}
}
return true;
}
/**
* Returns the application names in a realm.
*
* @param adminSubject Admin Subject who has the rights to access
* configuration datastore.
* @param realm Realm name.
* @return application names in a realm.
*/
) throws EntitlementException {
}
return results;
}
throws EntitlementException {
try {
return appls;
}
} finally {
}
try {
}
return appls;
} finally {
}
}
return appls;
}
}
}
return accessible;
}
/**
* Returns application.
*
* @param realm Realm name.
* @param name Name of Application.
* @return application.
*/
public static Application getApplicationForEvaluation(
) throws EntitlementException {
name);
}
/**
* Returns application.
*
* @param adminSubject Admin Subject who has the rights to access
* configuration datastore.
* @param realm Realm name.
* @param name Name of Application.
* @return application.
*/
public static Application getApplication(
) throws EntitlementException {
}
return appl;
}
}
// try again, to get application for sub realm.
return appl;
}
}
return null;
}
/**
* Removes application.
*
* @param adminSubject Admin Subject who has the rights to access
* configuration datastore.
* @param realm Realm Name.
* @param name Application Name.
* @throws EntitlementException
*/
public static void deleteApplication(
) throws EntitlementException {
if (!allowed) {
}
if (!allowed) {
throw new EntitlementException(326);
}
if (!app.canBeDeleted()) {
throw new EntitlementException(404);
}
}
}
/**
* Saves application data.
*
* @param adminSubject Admin Subject who has the rights to access
* configuration datastore.
* @param realm Realm Name.
* @param application Application object.
*/
public static void saveApplication(
) throws EntitlementException {
if (!allow) {
} else {
}
}
if (!allow) {
throw new EntitlementException(326);
}
throw new EntitlementException(228);
}
application.getName());
if (creationDate == -1) {
if (principalName != null) {
}
} else {
application.getName());
{
} else {
}
}
}
}
if (principalName != null) {
}
}
private static String getApplicationCreatedBy(
) {
try {
} catch (EntitlementException ex) {
// new application.
return null;
}
}
private static long getApplicationCreationDate(
) {
try {
} catch (EntitlementException ex) {
// new application.
return -1;
}
}
private static boolean isReferredApplication(
realm);
return true;
}
}
return false;
}
private static boolean hasAccessToApplication(
// applicationNames may be empty if the sub realm is removed.
// or the sub realm really do not have referral privilege assigned to
// it. In the latter case, clearing the cache for referral privilege
// should be ok.
return applicationNames.isEmpty() ||
}
private static boolean hasAccessToApplication(
}
private static boolean isNewApplication(
) throws EntitlementException {
return false;
}
}
return true;
}
private static void validateApplication(
) throws EntitlementException {
}
}
}
private static void validateApplication(
for (String r : referredRes) {
return;
}
}
}
/**
* Clears the cached applications. Must be called when notifications are
* received for changes to applications.
*/
try {
i.hasNext(); ) {
i.remove();
break;
}
}
} finally {
}
}
/**
* Refers resources to another realm.
*
* @param adminSubject Admin Subject who has the rights to access
* configuration datastore.
* @param parentRealm Parent realm name.
* @param referRealm Referred realm name.
* @param applicationName Application name.
* @param resources Referred resources.
* @throws EntitlementException if resources cannot be referred.
*/
public static void referApplication(
) throws EntitlementException {
if (!allowed) {
}
if (!allowed) {
throw new EntitlementException(326);
}
}
}
/**
* Derefers resources from a realm.
*
* @param adminSubject Admin Subject who has the rights to access
* configuration datastore.
* @param referRealm Referred realm name,
* @param applicationName Application name.
* @param resources Resources to be dereferred.
* @throws EntitlementException if resources cannot be dereferred.
*/
public static void dereferApplication(
) throws EntitlementException {
if (!allowed) {
}
if (!allowed) {
throw new EntitlementException(326);
}
}
/**
* Returns referred resources for a realm.
*
* @param adminSubject Admin Subject who has the rights to access
* configuration datastore.
* @param realm Realm name
* @param applicationTypeName Application Type Name.
* @return referred resources for a realm.
* @throws EntitlementException if referred resources cannot be returned.
*/
) throws EntitlementException {
if (!allowed) {
}
if (!allowed) {
return Collections.EMPTY_SET;
}
}
/**
* Creates an application.
*
* @param realm Realm name.
* @param name Name of application.
* @param applicationType application type.
* @throws EntitlementException if application class is not found.
*/
public static Application newApplication(
) throws EntitlementException {
ApplicationType.class};
try {
} catch (NoSuchMethodException ex) {
} catch (SecurityException ex) {
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (IllegalArgumentException ex) {
} catch (InvocationTargetException ex) {
}
}
}