⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schemabroker.java

📁 JAVA开源LDAP浏览器jxplorer的源码!
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    {
        return request.setException(new Exception("schemaOps exists not yet implemented")); //XXX
    }

     
    protected DataQuery doSearchQuery(DataQuery request)
    {
        return request.setException(new Exception("schemaOps search not allowed"));
    }
                
    /**
     *  Operation is not allowed - sets an exception in the request 
     */
     
    protected DataQuery doModifyQuery(DataQuery request)
    {
        return request.setException(new Exception("schemaOps modification not allowed"));
    }
                
    /**
     *  Operation is not allowed - sets an exception in the request 
     */
     
    protected DataQuery doCopyQuery(DataQuery request)
    {
        return request.setException(new Exception("schemaOps copy not allowed"));
    }
                
    /**
     *  Operation is not allowed - sets an exception in the request 
     */
     
    protected DataQuery doGetAllOCsQuery(DataQuery request)
    {
        return request.setException(new Exception("schemaOps object class list not allowed"));
    }
                
    /**
     *  Operation is not allowed - sets an exception in the request 
     */
     
    protected DataQuery doGetRecOCsQuery(DataQuery request)
    {
        return request.setException(new Exception("schemaOps rec. object class list not allowed"));
    }  
    
    
    /**
     *   returns the next level of a directory tree, returning
     *   a Enumeration of the results
     *
     *   @param searchbase the node in the tree to expand
     *   @return list of results (NameClassPair); the next layer of the tree... 
     */
     
    public DXNamingEnumeration unthreadedList(DN searchbase)
    {
        try
        {
            if (schemaOps == null) // not initialised.
                return null;

            ArrayList nextLevel = schemaOps.listEntryNames(searchbase.toString());
            int size = nextLevel.size();
            for (int i=0; i<size; i++)
            {
                nextLevel.set(i, new NameClassPair("schema="+ (String)nextLevel.get(i),"schema", false));
            }
            return new DXNamingEnumeration(nextLevel);
        }
        catch (NamingException e)
        {
            System.out.println("hurm.");
            return null;
        }
    }
    
    /**
     *   Not Implemented.
     *
     *   @param dn the domain name (relative to initial context in ldap) to seach from.
     *   @param filter the non-null filter to use for the search 
     *   @param search_level whether to search the base object, the next level or the whole subtree.
     *   @param returnAttributes a vector of string names of attributes to return in the search.  (Currently inoperative)
     *   @return list of results ('SearchResult's); the next layer of the tree... 
     */
     
    public DXNamingEnumeration unthreadedSearch(DN dn, String filter, int search_level, String[] returnAttributes) { return null; }
    
   /**
     *   Not Implemented.
    *     
    *    @param oldNodeDN the original DN of the sub tree root 
    *           to be copied (may be a single entry).
    *    @param newNodeDN the target DN for the tree to be moved to.
    */
    public void unthreadedCopy(DN oldNodeDN, DN newNodeDN)
        throws NamingException
   {
       throw new NamingException("unable to modify schema");
   }

    /**
     *   Not Implemented.
     *    @return whether the entry could be found in the directory.
     */
     
    public boolean unthreadedExists(DN checkMe) {return false;}
    
    /**
     *   Not Implemented.
     */

    public Vector unthreadedGetAllOCs() { return null; }

    /**
     *   Reads a 'virtual' schemaOps entry.  (i.e. reads a schemaOps attribute value, parsing and
     *   presenting the information as if it were an entry in its own right).
     *   @param entryDN the DN of the object to read.
     *   @param returnAttributes a vector of string names of attributes to return in the search.
     *          (null means 'return all entries', a zero length array means 'return no attributes'.)
     *   @return an entry returning a schemaOps group; null if unreadable.
     */
     
    public DXEntry unthreadedReadEntry(DN entryDN, String[] returnAttributes)
        throws NamingException
    {
            if (schemaOps == null) // not initialised.
                return null;

            DXEntry returnEntry = new DXEntry(entryDN);

            Attributes atts = schemaOps.getAttributes(entryDN.toString());

            if (atts == null || atts.size() == 0)
            {
                returnEntry = null;                 // no result
            }
            else if (returnAttributes == null)
            {
                returnEntry.put(atts.getAll());     // return the complete schemaOps entry
            }
            else if (returnAttributes.length == 0)
            {
                                                   // do nothing - just return the named, empty, DXEntry object
            }
            else                                    // XXX - may need to be implemented at some stage...
            {
                log.warning("return of partial schemaOps attributes not implemented - returning all");
                returnEntry.put(atts.getAll());
            }

            return returnEntry;
/*
        Attributes temp;

    	// add a synthetic schemaOps object class, so that it looks and acts like a normal
    	// directory entry.
        BasicAttribute oc = new BasicAttribute("objectClass", "top");
        oc.add("schemaOps");

        temp = jndiBroker.getSchemaData(entryDN, returnAttributes);

        if (temp == null)
        {
            System.err.println("unable to read schemaOps; null attributes returned");
            return null;
        }

        if (useRawData == false)
        {
            // Do some translation work to make things pretty for users.
            String type = entryDN.getRDNValue(1);
            oc.add(type);

            if (type.equals("AttributeDefinition"))
                temp = addAttributeInfo(temp);
            else if (type.equals("ClassDefinition"))
                temp = addClassInfo(temp);
    //      else if (type.equals("SyntaxDefinition"))
    //          temp = addSyntaxInfo(temp);
    		temp.put(oc);

        }

        return new DXEntry(temp, entryDN);
*/
    }

   /**
     *   Not Implemented.
    *    @param oldEntry the old set of attributes of the object.
    *    @param newEntry the replacement set of attributes..
    */
    
    public void unthreadedModify(DXEntry oldEntry, DXEntry newEntry)
           throws NamingException
      {
          throw new NamingException("unable to modify schema");
      }

    /**
     *   Not Implemented.
     *    @param dn the dn of the parent to determine likely
     *              child object classes for
     *    @return list of recommended object classes...             
     */
    
    public ArrayList unthreadedGetRecOCs(DN dn) { return null; }
    
    
    
    
    
    
    
    
    
    
    
    
    
    /** 
     *   Chains request to jndiBroker to satisfy broker interface
     */
     
    public DirContext getDirContext() { return jndiBroker.getDirContext(); }
 
    /**
     *    Whether the schemaOps is modifiable - usually false.
     */
     
    public boolean isModifiable() { return false; }
    
    /**
     *    The schemaOps Broker is always active (even if there is no connection)
     *    because it will fall back on hard-coded default values if necessary.
     */
     
    public boolean isActive() { return true; }
    
    /** 
     *   Chains request to jndiBroker to satisfy broker interface
     */
     
    public SchemaOps getSchemaOps() { return schemaOps; }
    
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -