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 */ 020package org.apache.directory.api.ldap.schema.converter; 021 022 023import java.io.InputStream; 024import java.io.Writer; 025 026 027/** 028 * A bean used to hold a schema. We keep its name and we associate with this 029 * object an inputStream mapped on the OpenLdap schema to read, and a writer 030 * in which the ldif file will be dumped. 031 * 032 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 033 */ 034public class Schema 035{ 036 /** The schema name */ 037 private String name; 038 039 /** The inputStream mapped on the file to read */ 040 private InputStream in; 041 042 /** The writer where we dump the ldif lines */ 043 private Writer out; 044 045 046 /** 047 * Set the schema name to parse. This name is the prefix of the 048 * schema file, which postfix is '.schema'. 049 * 050 * For instance, 'test.schema' being the file to parse, its name 051 * will be 'test' 052 * @param name The schema name 053 */ 054 public void setName( String name ) 055 { 056 this.name = name; 057 } 058 059 060 /** 061 * @return The schema name. 062 */ 063 public String getName() 064 { 065 return name; 066 } 067 068 069 /** 070 * Set the inputStream mapped on the schema file 071 * @param in The InputStream mapped on the schema file 072 */ 073 public void setInput( InputStream in ) 074 { 075 this.in = in; 076 } 077 078 079 /** 080 * @return The InputStream mapped on the schema file 081 */ 082 public InputStream getInput() 083 { 084 return in; 085 } 086 087 088 /** 089 * @return The writer in which the ldif lines will be dumped 090 */ 091 public Writer getOutput() 092 { 093 return out; 094 } 095 096 097 /** 098 * Set a writer to dump the ldif files 099 * @param out The writer 100 */ 101 public void setOutput( Writer out ) 102 { 103 this.out = out; 104 } 105 106 107 /** 108 * @see Object#toString() 109 */ 110 @Override 111 public String toString() 112 { 113 return "Schema " + name + ".schema"; 114 } 115}