001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package javax.naming.spi;
019:
020: import java.util.Hashtable;
021: import javax.naming.Name;
022: import javax.naming.Context;
023: import javax.naming.NamingException;
024: import javax.naming.directory.Attributes;
025:
026: /**
027: * The <code>DirStateFactory</code> interface describes a factory used to get
028: * the state of an object to be bound. <code>DirStateFactory</code> is a
029: * specific version of <code>StateFactory</code> for
030: * <code>DirectoryManager</code>.
031: *
032: * @see StateFactory
033: * @see DirectoryManager
034: */
035: public interface DirStateFactory extends StateFactory {
036:
037: /**
038: * Similar to <code>StateFactory.getStateToBind</code> with an additional
039: * <code>attributes</code> parameter.
040: *
041: * @param o
042: * an object
043: * @param n
044: * a name
045: * @param c
046: * a context
047: * @param envmt
048: * a context environment
049: * @param a
050: * some attributes
051: * @return the state as a <code>Result</code> instance, containing an
052: * object and associated attributes.
053: * @throws NamingException
054: * if an exception occurs
055: * @see StateFactory#getStateToBind(Object, Name, Context, Hashtable)
056: */
057: Result getStateToBind(Object o, Name n, Context c,
058: Hashtable<?, ?> envmt, Attributes a) throws NamingException;
059:
060: /**
061: * Used by the <code>DirectoryManager.getStateToBind</code> method as the
062: * returning value.
063: */
064: public static class Result {
065:
066: // the Object returned by DirectoryManager.getStateToBind.
067: private Object obj;
068:
069: // the Attributes returned by DirectoryManager.getStateToBind.
070: private Attributes attrs;
071:
072: /**
073: * Creates an instance of <code>DirStateFactory.Result</code>
074: *
075: * @param o
076: * the object returned by
077: * <code>DirectoryManager.getStateToBind</code>. May be
078: * null.
079: * @param a
080: * the attributes returned by
081: * <code>DirectoryManager.getStateToBind</code>. May be
082: * null.
083: */
084: public Result(Object o, Attributes a) {
085: this .obj = o;
086: this .attrs = a;
087: }
088:
089: /**
090: * Returns the object associated with this result.
091: *
092: * @return the object associated with this result.
093: */
094: public Object getObject() {
095: return this .obj;
096: }
097:
098: /**
099: * Returns the attributes associated with this result.
100: *
101: * @return the attributes associated with this result.
102: */
103: public Attributes getAttributes() {
104: return this.attrs;
105: }
106: }
107:
108: }
|