ServiceLocationManager.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright (c) 1999 by Sun Microsystems, Inc.
* All rights reserved.
*
*/
// SCCS Status: @(#)ServiceLocationManager.java 1.18 07/23/97
// %M : The service locator object.
// Author: Erik Guttman
//
/**
* The ServiceLocationManager class provides entry to SLP services.
* The ServiceLocationManager class uses static methods
* to provide objects encapsulating the connection with the Service
* Location facility. In addition, it provides access to known
* scopes.
*
* @version %R%.%L% %D%
* @author Erik Guttman
*
*/
abstract public class ServiceLocationManager extends Object {
// Properties.
// Public interface
/**
* The property accessor for the Locator object. If user agent
* functionality is not available, returns null.
*
* @param locale The Locale of the Locator object. Use null for default.
* @return The Locator object.
* @exception ServiceLocationException Thrown if the locator can't
* be created.
*
*/
throws ServiceLocationException
{
}
if (locatorClass == null) {
className = "com.sun.slp.UARequester";
}
}
}
}
return locator;
}
/**
* The property accessor for the Advertiser object. If service agent
* functionality is not available, returns null.
*
* @param locale The Locale of the Advertiser object. Use null for default.
* @return The Advertiser object.
* @exception ServiceLocationException Thrown if the locator can't
* be created.
*
*/
throws ServiceLocationException {
}
if (advertiser == null) {
if (advertiserClass == null) {
className = "com.sun.slp.SARequester";
}
}
if (advertiser != null) {
}
}
return advertiser;
}
/**
* Returns a vector of known scope names. It will include any
* scopes defined in the configuration file and ensure that the
* <i>order</i> of those scope strings is kept in the list of
* scopes which is returned. This method enforces the constraint
* that the default scope is returned if no other is available.
*
* @param typeHint Type to look for if SA advertisment required.
* @return Vector containing Strings with scope names.
*/
public static synchronized Vector findScopes()
throws ServiceLocationException {
// For the UA, return configured scopes if we have them.
// If no configured scopes, get discovered scopes from
// DA table.
// If still none, perform SA discovery.
// If still none, then return default scope. The client won`t
// be able to contact anyone because there`s nobody out there.
}
}
}
return accessableScopes;
}
/**
* Returns the maximum across all DAs of the min-refresh-interval
* attribute. This value satisfies the advertised refresh interval
* bounds for all DAs, and, if used by the SA, assures that no
* refresh registration will be rejected. If no DA advertises a
* min-refresh-interval attribute, a value of 0 is returned.
*
* @return The maximum min-refresh-interval attribute value.
*/
public static int getRefreshInterval() throws ServiceLocationException {
// Get the min-refresh-interval attribute values for all DA's from
// the server.
// We don't simply do Locator.findAttributes() here because we
// need to contact the SA server directly.
tags);
// Send it down the pipe to the IPC process. It's a bad bug
// if the reply comes back as not a CAttrMsg.
// Check error code.
short errCode =
rply.getErrorCode());
throw
"loopback_error",
new Object[] {
}
// Sort through the attribute values to determine reply.
int ri = 0;
null);
for (i = 0; i < n; i++) {
}
}
return ri;
}
//
// Private implementation.
//
// Return the requested class, or null if it can't be found.
try {
} catch (ClassNotFoundException ex) {
}
return ret;
}
// Return an instance from the class.
try {
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (InvocationTargetException ex) {
} catch (NoSuchMethodException ex) {
}
}
return ret;
}
// Perform SA discovery, since no DA scopes found.
private static Vector performSADiscovery()
throws ServiceLocationException {
// Get type hint if any.
// Format query.
for (i = 0; i < n; i++) {
}
// Add logical disjunction if more than one element.
if (i > 1) {
}
// Form SA discovery request.
new Vector(), // seeking scopes...
// Transact the advert request.
rqst,
null);
// DA table not needed...
return scopes;
}
// Initialize SLPConfig and DATable.
static {
}
}
}
}