|
SilverStream Application Server 3.5 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Implemented by objects that contain other items. Servers, databases, directories, and groups are containers. AgiAdmContainerBase defines the basic container functionality, which is refined by its subclasses.
| Field Summary | |
static int |
GET_CHILDREN_DFLT
Defines the default mode for the getChildren method. |
| Method Summary | |
void |
addChild(String name,
String type,
Hashtable props)
Add a child object to the container. |
AgiAdmElementBase |
getChild(String name,
String type,
Hashtable info)
Get an object that is a child of the container. |
Enumeration |
getChildren(int options)
Enumerates the children of the container. |
| Field Detail |
public static final int GET_CHILDREN_DFLT
| Method Detail |
public void addChild(String name,
String type,
Hashtable props)
throws AgoUnrecoverableSystemException,
AgoSecurityException
name - the name of the childtype - the type of the childprops - additional properties describing the child, if any
Refer to the following for the type parameter:
AgiAdmServer
AgiAdmDesignElement
AgiAdmDirectory
AgiAdmGroup
AgiAdmUser
AgiAdmUserReference
AgiAdmLBClusterEnv
AgiAdmLBElement
AgiAdmLBContainer
props parameter:
AgiAdmElement
AgiAdmElement
AgiAdmDatabase
AgiAdmLBElement
AgiAdmLBContainer
AgiAdmLBClusterEnv
AgiAdmServer.
Adding a database
When adding a database to the server, note the following about which properties are required:
See the examples below.
// a) Add the database 'Silver' to server 'myServer'
// Get to the Server Admin object
AgiAdmServer server = AgAdmin.getServer("myServer", -1);
Hashtable childProps = new Hashtable();
// Specify the database user parameter
childProps.put(AgiAdmDatabase.PROP_DBUSER, "dba");
// Specify the password parameter
childProps.put(AgiAdmDatabase.PROP_DBPASSWD, "sql");
// Specify the JDBC URL parameter (it's optional and is needed only if the connection type is
// non-SilverStream)
childProps.put(AgiAdmDatabase.PROP_JDBCURL,
"jdbc:sybase:Tds:pancake:2638/?SERVICENAME=MainDB");
// Specify the JDBC URL attributes, if any (this is optional and is needed only if the connection type
// is non-SilverStream)
childProps.put(AgiAdmDatabase.PROP_JDBCURLATTR, "cache=100");
// Specify the logical data source key
childProps.put(AgiAdmDatabase.PROP_LDSKEY, "SybAdaptiveV6JConnect5");
// Add the database to the server
server.addChild("Silver", AgiAdmDatabase.DATABASE, childProps);
//b) Add the database "myDB" to server "myServer",
// with the system tables stored in a separate database "myDB2"
// Get to the Server Admin object
AgiAdmServer server = AgAdmin.getServer("myServer", -1);
Hashtable childProps = new Hashtable();
// Specify the database user parameter
childProps.put(AgiAdmDatabase.PROP_DBUSER, "dba");
// Specify the password parameter
childProps.put(AgiAdmDatabase.PROP_DBPASSWD, "sql");
// Specify the logical data source key
childProps.put(AgiAdmDatabase.PROP_LDSKEY, "SybAdaptiveV6AgBridge");
// We'll be storing the system tables in a separate database
childProps.put(AgiAdmDatabase.PROP_ISSHADOWED, new Boolean(true));
// Specify the name of the "shadow" database
childProps.put(AgiAdmDatabase.PROP_SDBNAME, "myDB2");
// Specify the db user for the "shadow" database
childProps.put(AgiAdmDatabase.PROP_SDBUSER, "dba");
// Specify the db user password for the "shadow" database
childProps.put(AgiAdmDatabase.PROP_SDBPASSWD, "sql");
// Specify the LDS key for the "shadow" database
childProps.put(AgiAdmDatabase.PROP_SLDSKEY, "SybSQLAnyV5AgBridge");
// Add the database to the server
server.addChild("myDB", AgiAdmDatabase.DATABASE, childProps);
// c) add a SilverUser to a group
AgiAdmServer server = ...
AgiAdmGroup group = (AgiAdmGroup)server.getElement(
"myGroup", AgiAdmGroup.SILVERGROUP, null);
group.addChild("user1", AgiAdmUser.SILVERUSER, null);
// d) add an NT user to the group
Hashtable info = new Hashtable();
info.put(AgiAdmElement.PROP_DOMAIN, "brilliant");
group.addChild("brilliant\\testuser", AgiAdmUser.NTUSER, info);
public AgiAdmElementBase getChild(String name,
String type,
Hashtable info)
throws AgoUnrecoverableSystemException,
AgoSecurityException
name - the name of the childtype - the type of the childinfo - additional properties describing the child, if any
For information concerning the type and info parameters,
see the list of types and properties
for addChild.
public Enumeration getChildren(int options)
throws AgoUnrecoverableSystemException,
AgoSecurityException
options - the options for enumerating the children
At each level of the API object hierarchy, containers may hold
different types of children. The API users can use the instanceof
operator and/or the AgiAdmElementBase.getType() method to find out
what type of entity each of the children is.
For a list of values for the options parameter,
see AgiAdmContainer.
// get a reference to AgiAdmServer AgiAdmServer server = ... // a) get an unsorted list of databases (children of server) Enumeration e = server.getChildren(AgiAdmContainerBase.GET_CHILDREN_DFLT); // b) get a sorted list of forms residing in the Forms directory Hashtable info = new Hashtable(); info.put(AgiAdmServer.INFO_DATABASE_NAME, "myDatabase"); AgiAdmDirectory formsDir = (AgiAdmDirectory)server.getElement( AgiAdmDirectory.FORMS, AgiAdmDirectory.FORMS, info); Enumeration e = formsDir.getChildren(AgiAdmContainer.GET_CHILDREN_SORTED); AgiAdmDirectory ntSecurity = (AgiAdmDirectory)server.getElement( AgiAdmDirectory.NT_SECURITY, AgiAdmDirectory.NT_SECURITY, null); // c) get the list of primary NT domains Enumeration primary = ntSecurity.getChildren( AgiAdmContainer.GET_CHILDREN_NTDOMAINS_PRIMARY_ONLY); // d) get the list of trusted domains (sorted) Enumeration trusted = ntSecurity.getChildren( AgiAdmContainer.GET_CHILDREN_NTDOMAINS_TRUSTED_ONLY | AgiAdmContainer.GET_CHILDREN_SORTED); // e) get the list of NT groups in an NT domain with all the group properties // (this may be slow) Hashtable info = new Hashtable(); info.put(AgiAdmElement.PROP_DOMAIN, "brilliant"); AgiAdmDirectory ntGroupsDir = (AgiAdmDirectory)server.getElement( AgiAdmDirectory.NTGROUPS, AgiAdmDirectory.NTGROUPS, info); Enumeration ntGroups = ntGroupsDir.getChildren(AgiAdmContainer.GET_CHILDREN_WITH_INFO);+ *
|
SilverStream Application Server 3.5 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||