📄 distinguishedname.java
字号:
/* * The contents of this file are subject to the Dyade Public License, * as defined by the file DYADE_PUBLIC_LICENSE.TXT * * You may not use this file except in compliance with the License. You may * obtain a copy of the License on the Dyade web site (www.dyade.fr). * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific terms governing rights and limitations under the License. * * The Original Code is CmisJava API, including the java package * fr.dyade.cmis, released September 5, 2000. * * The Initial Developer of the Original Code is Dyade. The Original Code and * portions created by Dyade are Copyright Bull and Copyright INRIA. * All Rights Reserved. *//* Copyright 1996-2000 by Institut National de Recherche en Informatique * et en Automatique (INRIA) * All rights reserved. See COPYRIGHT in top-level directory. * * Authors: Laurent Andrey, Eric Dillon, Olivier Festor *///---------------------------------------------------------------------------//// CVS Info//---------------------------------------------------------------------------////// $Id: DistinguishedName.java,v 1.2 2000/09/05 13:30:37 festor Exp $////---------------------------------------------------------------------------//// Todo//---------------------------------------------------------------------------////package fr.dyade.cmis.api.types;// Java related Packagesimport java.util.Vector;import java.util.Enumeration;/** * Java representation for ASN.1 Distinguished Name datatype * <p> * The implementation uses java.lang.Vector. The <code>DistinguishedName</code> must be instanciated with * the first <code>RelativeDistinguishedName</code> element, * then the user may call the <code>add(...)</code> method to add <code>RelativeDistinguishedName</code> elements. * @see RelativeDistinguishedName * @version cvs $Id: DistinguishedName.java,v 1.2 2000/09/05 13:30:37 festor Exp $ */public class DistinguishedName extends CMISType { /** * Creates a new instance of DistinguishedName, with pRDN as first element. * @param pRDN The first <code>RelativeDistinguishedName</code> element to use for creation. */ public DistinguishedName( RelativeDistinguishedName pRDN ) { fElts.addElement( pRDN ); } /** * Create a DN with a first RDN built from one ava. * This constructor is dedicated to quick build of MIB top level DN (i.e system) * @param pAva the ava which is the full DN indeed. */ public DistinguishedName( Ava pAva ) { this(new Ava[] {pAva}); } /** * Create a DN with a first RDN built from one ava table. * This constructor is dedicated to quickly build a "normalized" DN. * @param pAva the ava table which is the full DN indeed. */ public DistinguishedName( Ava[] pAvaTable ) { this(new RelativeDistinguishedName(pAvaTable)); } /** Create an DN with a first RDN built from a first an unique ava given as an OId string dotted notation and value. * @param pAvaIdStr the OID in dotted notation * @param pAvaValue the value for the ava. */ public DistinguishedName( String pAvaIdStr, Value pAvaValue ) { this(new RelativeDistinguishedName(pAvaIdStr, pAvaValue)); } /** * Adds a <code>RelativeDistinguishedName</code> to the list * @param pRDN the <code>RelativeDistinguishedName</code> to add. */ public void add( RelativeDistinguishedName pRDN ) { fElts.addElement(pRDN); } /** Add a <code>RelativeDistinguishedName</code> to the list of RDN * This convenient methods add a new RDN at the end of this DN from * an attribute id (dotted notation) and and the value to associate with. * @param pAvaIdStr the attribute id for the newly created RDN's first ava * @param pAvaValue the value for the newly created RDN's first ava */ public void add( String pAvaIdStr, Value pAvaValue ) { fElts.addElement(new RelativeDistinguishedName(pAvaIdStr, pAvaValue)); } /** Add a <code>RelativeDistinguishedName</code> to the list of RDN * This convenient methods add a new RDN at the end of this DN from * an unique attribute value (Ava). * @param pAva the AVA for the newly created RDN's first ava */ public void add( Ava pAva ) { fElts.addElement(new RelativeDistinguishedName(pAva)); } /** List elements, via java enumeration. * This method gives access to Attribute elements of the list, via java enumeration. * @return The enumeration of the list elements. * NOTE: Use cast to <code>{@link RelativeDistinguishedName}RelativeDistinguishedName</code> * when calling the <code>java.util.nextElement()</code> method of the result. */ public Enumeration getElts() { return fElts.elements(); } public String toString() { String lResult = ""; for (Enumeration e=fElts.elements(); e.hasMoreElements() ;) { lResult += e.nextElement().toString(); if (e.hasMoreElements()) {lResult+="; ";} } return lResult; } public Ava[] getNormalizedForm() { int lAvaCount=0; for (Enumeration e=fElts.elements(); e.hasMoreElements() ;) { lAvaCount+=((RelativeDistinguishedName)e.nextElement()).getAvaTable().length; } Ava[] lResult= new Ava[lAvaCount]; int i=0; for (Enumeration e=fElts.elements(); e.hasMoreElements() ;) { Ava[] lAvaTable=((RelativeDistinguishedName)e.nextElement()).getAvaTable(); for (int j=0; j<lAvaTable.length; j++) { lResult[i]=lAvaTable[j]; i++; } } return lResult; } /** Actual RelativeDistiguishedName list. * @see fr.dyade.cmis.api.types.RelativeDistinguishedName */ private Vector fElts = new Vector();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -