Repositorypublic class Repository extends Object
Fields Summary |
---|
private static Logger | _logger | private Context | ctx | private String | name |
Constructors Summary |
---|
public Repository(String repositoryName)Constructor.....
Properties env = new Properties();
env.put("java.naming.factory.initial",
"com.sun.enterprise.repository.RepositoryInitContextFactory");
env.put("com.sun.enterprise.repository.name", repositoryName);
name = repositoryName;
init(env);
| public Repository(String repositoryName, String repositoryDir)Constructor.....
Properties env = new Properties();
env.put("java.naming.factory.initial",
"com.sun.enterprise.repository.RepositoryInitContextFactory");
env.put("com.sun.enterprise.repository.name", repositoryName);
env.put("com.sun.enterprise.repository.dir", repositoryDir);
name = repositoryName;
init(env);
|
Methods Summary |
---|
public boolean | add(java.lang.String name, java.lang.String value)Adds a value corresponding to a name within this Repository.
try {
ctx.rebind(name, value);
// System.out.println("Added " + name + ", " + value);
// START OF IASRI 4660742
//if(_logger.isLoggable(Level.FINE))
// _logger.log(Level.FINE,"Added " + name + ", " + value);
// END OF IASRI 4660742
return true;
} catch (NamingException ne) {
// IASRI 4660742 ne.printStackTrace();
// START OF IASRI 4660742
_logger.log(Level.SEVERE,"enterprise.addinrepository_exception",ne);
// END OF IASRI 4660742
return false;
}
| public java.lang.String | find(java.lang.String name)Finds a value corresponding to a name stored within this
Repository.
_logger=LogDomains.getLogger(LogDomains.ROOT_LOGGER);
try {
String value = (String) ctx.lookup(name);
// System.out.println(name + " is bound to " + value);
// START OF IASRI 4660742
// _logger.log(Level.FINE,name + " is bound to " + value);
// END OF IASRI 4660742
return value;
} catch (Exception e) {
// e.printStackTrace();
// START OF IASRI 4660742
// _logger.log(Level.SEVERE,"enterprise.findinrepository_exception",e);
// END OF IASRI 4660742
return null;
}
| public java.lang.String | getName()
return RepositoryContext.getRepositoryName(name);
| private void | init(java.util.Properties env)Initializing the context...
try {
ctx = new InitialContext(env);
} catch (NamingException ne) {
// IASRI 4660742 ne.printStackTrace();
// START OF IASRI 4660742
_logger.log(Level.SEVERE,"enterprise.naming_exception",ne);
// END OF IASRI 4660742
ctx = null;
}
| public java.lang.String[] | keys()
Vector v = new Vector(10);
Enumeration e = null;
try {
e = ctx.listBindings("");
} catch (NamingException ne) {
// IASRI 4660742 ne.printStackTrace();
// START OF IASRI 4660742
_logger.log(Level.SEVERE,"enterprise.naming_exception",ne);
// END OF IASRI 4660742
}
while((e != null) && e.hasMoreElements())
{
Binding b = (Binding) e.nextElement();
v.add(b.getName());
}
String[] keynames = new String[v.size()];
v.copyInto(keynames);
return keynames;
| public boolean | remove(java.lang.String name)
try {
ctx.unbind(name);
// System.out.println("Added " + name + ", " + value);
// START OF IASRI 4660742
//if(_logger.isLoggable(Level.FINE))
// _logger.log(Level.FINE,"Added " + name + ", " + value);
// END OF IASRI 4660742
return true;
} catch (NamingException ne) {
// IASRI 4660742 ne.printStackTrace();
// START OF IASRI 4660742
_logger.log(Level.SEVERE,"enterprise.delinrepository_exception",ne);
// END OF IASRI 4660742
return false;
}
|
|