本文整理汇总了Java中org.apache.harmony.jndi.internal.nls.Messages类的典型用法代码示例。如果您正苦于以下问题:Java Messages类的具体用法?Java Messages怎么用?Java Messages使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Messages类属于org.apache.harmony.jndi.internal.nls包,在下文中一共展示了Messages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rebind
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void rebind(Name name, Object obj) throws NamingException {
if (!(name instanceof CompositeName)) {
// jndi.26=URL context can't accept non-composite name: {0}
throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
}
if (name.size() == 1) {
rebind(name.get(0), obj);
} else {
Context context = getContinuationContext(name);
try {
context.rebind(name.getSuffix(1), obj);
} finally {
context.close();
}
}
}
示例2: getByteFromHexString
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
private static byte[] getByteFromHexString(String val) {
String str = val.substring(val.indexOf("#") + 1);
if (str.length() % 2 != 0) {
throw new IllegalArgumentException(Messages.getString("ldap.1A"));
}
byte[] ret = null;
try {
ret = new byte[str.length() / 2];
for (int i = 0; i < ret.length; i++) {
ret[i] = (byte) Integer.parseInt(str
.substring(2 * i, 2 * i + 2), 16);
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException(Messages.getString("ldap.17")
+ val);
}
return ret;
}
示例3: rebind
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
/**
* This method is not supported.
*
* @see Context#rebind(Name, Object)
*/
public void rebind(Name arg0, Object arg1) throws NamingException {
ContextNamePair pair;
try {
pair = getTargetNamespaceContextNamePair(arg0);
} catch (IllegalArgumentException e) {
throw new OperationNotSupportedException();
}
if (pair.context instanceof Context) {
((Context) pair.context).rebind(pair.name, arg1);
} else {
// jndi.4E=found object is not a Context
throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$
}
}
示例4: bind
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
public void bind(Name name, Object obj, Attributes attributes)
throws NamingException {
if (!(name instanceof CompositeName)) {
// jndi.26=URL context can't accept non-composite name: {0}
throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
}
if (name.size() == 1) {
bind(name.get(0), obj, attributes);
return;
}
DirContext context = getContinuationContext(name);
try {
context.bind(name.getSuffix(1), obj, attributes);
} finally {
context.close();
}
}
示例5: Rdn
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
public Rdn(String type, Object value) throws InvalidNameException {
if (type == null) {
throw new NullPointerException("type "
+ Messages.getString("ldap.00"));
}
if (value == null) {
throw new NullPointerException("value "
+ Messages.getString("ldap.00"));
}
if (type.length() == 0) {
throw new InvalidNameException("type "
+ Messages.getString("ldap.04"));
}
if (value instanceof String && ((String) value).length() == 0) {
throw new InvalidNameException("value "
+ Messages.getString("ldap.04"));
}
list = convertToAttributeArrayList(new BasicAttributes(type, value,
true));
}
示例6: getNameParser
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
/**
* Returns the name parser for given name.
*
* @param name
* a name in the string form to return a name parser for
* @return the name parser found
* @throws NotContextException
* if found object is not a context
* @throws NamingException
* if such exception was encountered during lookup
* @see DNSContext#getNameParser(Name) for details
* @see Context#getNameParser(String)
*/
public NameParser getNameParser(String name) throws NamingException {
Object obj;
if (name == null) {
// jndi.2E=The name is null
throw new NullPointerException(Messages.getString("jndi.2E")); //$NON-NLS-1$
}
obj = lookup(name);
if (obj instanceof DNSContext) {
return nameParser;
} else if (obj instanceof Context) {
return ((Context) obj).getNameParser(""); //$NON-NLS-1$
}
// jndi.4E=found object is not a Context
throw new NotContextException(Messages.getString("jndi.4E")); //$NON-NLS-1$
}
示例7: getStateToBind
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
/**
* Prepares object for binding. It calls
* {@link NamingManager#getStateToBind(Object, Name, Context, Hashtable)}
* and makes the resulting object {@link Remote} by wrapping it into
* {@link RemoteReferenceWrapper}.
*
* @param name
* Object name.
*
* @param obj
* Object to prepare for binding.
*
* @return Object ready for binding.
*
* @throws NamingException
* If some naming error occurs.
*
* @throws RemoteException
* If remote exception occurs.
*/
protected Remote getStateToBind(String name, Object obj)
throws NamingException, RemoteException {
obj = NamingManager.getStateToBind(obj, new CompositeName().add(name),
this, environment);
if (obj instanceof Remote) {
return (Remote) obj;
}
if (obj instanceof Reference) {
return new RemoteReferenceWrapper((Reference) obj);
}
if (obj instanceof Referenceable) {
return new RemoteReferenceWrapper(((Referenceable) obj)
.getReference());
}
// jndi.82=Cannot bind to RMI Registry object that is neither Remote nor
// Reference nor Referenceable
throw new IllegalArgumentException(Messages.getString("jndi.82")); //$NON-NLS-1$
}
示例8: DNSContext
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
/**
* A DNS context constructor. Should not be accessed directly.
*
* @param env
* the hash table with environment variables. The context will
* make a clone of given hash table.
* @throws InvalidNameException
* something wrong with domain names given in
* <code>java.naming.provider.url</code> property
* @throws ConfigurationException
* if some error occurred during parsing of configuration
* parameters
* @throws NamingException
* if some parse error occurred
* @throws NullPointerException
* if the environment is null
*
*/
@SuppressWarnings("unchecked")
DNSContext(Hashtable<?, ?> env) throws NamingException {
nameParser = new DNSNameParser();
if (env == null) {
// jndi.45=environment is null
throw new NullPointerException(Messages.getString("jndi.45")); //$NON-NLS-1$
}
this.environment = (Hashtable<Object, Object>) env.clone();
parseBoolProp(Context.AUTHORITATIVE);
parseLookupProp();
if (environment.containsKey(RECURSION)) {
parseBoolProp(RECURSION);
}
if (environment.containsKey(TIMEOUT_INITIAL)) {
parseIntProp(TIMEOUT_INITIAL);
}
if (environment.containsKey(TIMEOUT_RETRIES)) {
parseIntProp(TIMEOUT_RETRIES);
}
parseIntProp(THREADS_MAX);
resolver = new Resolver(timeoutInitial, timeoutRetries, maxThreads,
authoritative, recursion);
parseProviderUrlProp();
}
示例9: destroySubcontext
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void destroySubcontext(Name name) throws NamingException {
if (!(name instanceof CompositeName)) {
// jndi.26=URL context can't accept non-composite name: {0}
throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
}
if (name.size() == 1) {
destroySubcontext(name.get(0));
} else {
Context context = getContinuationContext(name);
try {
context.destroySubcontext(name.getSuffix(1));
} finally {
context.close();
}
}
}
示例10: rename
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
@Override
public void rename(Name nOld, Name nNew) throws NamingException {
if (nOld == null || nNew == null) {
throw new NullPointerException();
}
if (nOld.size() == 0 || nNew.size() == 0) {
// ldap.3A=Can't rename empty name
throw new InvalidNameException(Messages.getString("ldap.3A")); //$NON-NLS-1$
}
if (nOld.size() > 1 || nNew.size() > 1) {
// ldap.3B=Can't rename across contexts
throw new InvalidNameException(Messages.getString("ldap.3B")); //$NON-NLS-1$
}
// ldap.39=Can't rename schema
throw new SchemaViolationException(Messages.getString("ldap.39")); //$NON-NLS-1$
}
示例11: getAttributes
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
public Attributes getAttributes(Name name, String[] as)
throws NamingException {
if (!(name instanceof CompositeName)) {
// jndi.26=URL context can't accept non-composite name: {0}
throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
}
if (name.size() == 1) {
return getAttributes(name.get(0), as);
}
DirContext context = getContinuationContext(name);
try {
return context.getAttributes(name.getSuffix(1), as);
} finally {
context.close();
}
}
示例12: getSchemaClassDefinition
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
public DirContext getSchemaClassDefinition(Name name)
throws NamingException {
if (!(name instanceof CompositeName)) {
// jndi.26=URL context can't accept non-composite name: {0}
throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
}
if (name.size() == 1) {
return getSchemaClassDefinition(name.get(0));
}
DirContext context = getContinuationContext(name);
try {
return context.getSchemaClassDefinition(name.getSuffix(1));
} finally {
context.close();
}
}
示例13: writeBytes
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
/**
* Creates a sequence of bytes that represents the current question record.
*
* @param buffer
* the buffer in which the result byte sequence will be written
* @param startIdx
* the index in the buffer to start at
* @return updated index of the buffer array
*/
public int writeBytes(byte[] buffer, int startIdx)
throws DomainProtocolException {
int idx = startIdx;
// basic checkings
if (buffer == null) {
// jndi.32=buffer is null
throw new DomainProtocolException(Messages.getString("jndi.32")); //$NON-NLS-1$
}
if (startIdx >= buffer.length || startIdx < 0) {
throw new ArrayIndexOutOfBoundsException();
}
// write the name
idx = ProviderMgr.writeName(qName, buffer, idx);
// QTYPE
idx = ProviderMgr.write16Int(qType, buffer, idx);
// QCLASS
idx = ProviderMgr.write16Int(qClass, buffer, idx);
return idx;
}
示例14: search
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
public NamingEnumeration<SearchResult> search(Name name, String filter,
Object[] objs, SearchControls searchControls)
throws NamingException {
if (!(name instanceof CompositeName)) {
// jndi.26=URL context can't accept non-composite name: {0}
throw new InvalidNameException(Messages.getString("jndi.26", name)); //$NON-NLS-1$
}
if (name.size() == 1) {
return search(name.get(0), filter, objs, searchControls);
}
DirContext context = getContinuationContext(name);
try {
return context.search(name.getSuffix(1), filter, objs,
searchControls);
} finally {
context.close();
}
}
示例15: convertFromStringToName
import org.apache.harmony.jndi.internal.nls.Messages; //导入依赖的package包/类
/**
* convert <code>String</code> name to <code>Name</code> instance, we
* assume the <code>String</code> name parameter is using composite name
* syntax (see LDAP service providers guidlines, part 4).
*
* @param s
* <code>String</code> name to be converted
* @return <code>Name</code> instance equivalent to <code>s</code>
* @throws InvalidNameException
* occurs error while converting
*/
protected Name convertFromStringToName(String s)
throws InvalidNameException {
if (s == null) {
// jndi.2E=The name is null
throw new NullPointerException(Messages.getString("jndi.2E")); //$NON-NLS-1$
}
CompositeName name = new CompositeName(s);
if (name.size() == 0) {
// return empty name
return new LdapName(""); //$NON-NLS-1$
}
return name;
}