001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 021 package org.apache.directory.shared.ldap.schema.syntaxCheckers; 022 023 024 /** 025 * An OpenLDAP object identifier macro. 026 * See http://www.openldap.org/doc/admin24/schema.html#OID%20Macros 027 * <br/> 028 * <code>objectIdentifier <name> { <oid> | <name>[:<suffix>] }</code> 029 * 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 * @version $Rev$, $Date$ 032 */ 033 public class OpenLdapObjectIdentifierMacro 034 { 035 private String name; 036 037 private String rawOidOrNameSuffix; 038 039 private String resolvedOid; 040 041 042 /** 043 * Instantiates a new OpenLDAP object identifier macro. 044 */ 045 public OpenLdapObjectIdentifierMacro() 046 { 047 name = null; 048 rawOidOrNameSuffix = null; 049 resolvedOid = null; 050 } 051 052 053 /** 054 * Gets the name. 055 * 056 * @return the name 057 */ 058 public String getName() 059 { 060 return name; 061 } 062 063 064 /** 065 * Sets the name. 066 * 067 * @param name the new name 068 */ 069 public void setName( String name ) 070 { 071 this.name = name; 072 } 073 074 075 /** 076 * Gets the raw OID or name plus suffix. 077 * 078 * @return the raw OID or name plus suffix 079 */ 080 public String getRawOidOrNameSuffix() 081 { 082 return rawOidOrNameSuffix; 083 } 084 085 086 /** 087 * Sets the raw OID or name plus suffix. 088 * 089 * @param rawOidOrNameSuffix the new raw OID or name plus suffix 090 */ 091 public void setRawOidOrNameSuffix( String rawOidOrNameSuffix ) 092 { 093 this.rawOidOrNameSuffix = rawOidOrNameSuffix; 094 } 095 096 097 /** 098 * Gets the resolved OID, null if not yet resolved. 099 * 100 * @return the resolved OID 101 */ 102 public String getResolvedOid() 103 { 104 return resolvedOid; 105 } 106 107 108 /** 109 * Checks if is resolved. 110 * 111 * @return true, if is resolved 112 */ 113 public boolean isResolved() 114 { 115 return getResolvedOid() != null; 116 } 117 118 119 /** 120 * Sets the resolved OID. 121 * 122 * @param resolvedOid the new resolved OID 123 */ 124 public void setResolvedOid( String resolvedOid ) 125 { 126 this.resolvedOid = resolvedOid; 127 } 128 129 130 public String toString() 131 { 132 if ( isResolved() ) 133 { 134 return "resolved: " + name + " " + resolvedOid; 135 } 136 else 137 { 138 return "unresolved: " + name + " " + rawOidOrNameSuffix; 139 } 140 } 141 142 }