001    /*
002     * JBoss DNA (http://www.jboss.org/dna)
003     * See the COPYRIGHT.txt file distributed with this work for information
004     * regarding copyright ownership.  Some portions may be licensed
005     * to Red Hat, Inc. under one or more contributor license agreements.
006     * See the AUTHORS.txt file in the distribution for a full listing of 
007     * individual contributors. 
008     *
009     * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
010     * is licensed to you under the terms of the GNU Lesser General Public License as
011     * published by the Free Software Foundation; either version 2.1 of
012     * the License, or (at your option) any later version.
013     *
014     * JBoss DNA is distributed in the hope that it will be useful,
015     * but WITHOUT ANY WARRANTY; without even the implied warranty of
016     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017     * Lesser General Public License for more details.
018     *
019     * You should have received a copy of the GNU Lesser General Public
020     * License along with this software; if not, write to the Free
021     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
022     * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
023     */
024    package org.jboss.dna.common.jdbc.model.spi;
025    
026    import java.util.Map;
027    import java.util.HashMap;
028    import org.jboss.dna.common.jdbc.model.api.DatabaseNamedObject;
029    
030    /**
031     * Provides database named object specific metadata.
032     * 
033     * @author <a href="mailto:litsenko_sergey@yahoo.com">Sergiy Litsenko</a>
034     */
035    public class DatabaseNamedObjectBean extends CoreMetaDataBean implements DatabaseNamedObject {
036        private static final long serialVersionUID = 5784316298846262968L;
037        private String name;
038        private String remarks;
039        private Map<String, Object> extraProperties = new HashMap<String, Object>();
040    
041        /**
042         * Default constructor
043         */
044        public DatabaseNamedObjectBean() {
045        }
046    
047        /**
048         * Gets database named object name
049         * 
050         * @return database named object name
051         */
052        public String getName() {
053            return name;
054        }
055    
056        /**
057         * Sets database named object name
058         * 
059         * @param name the database named object name
060         */
061        public void setName( String name ) {
062            this.name = name;
063        }
064    
065        /**
066         * Gets explanatory comment on the database named object
067         * 
068         * @return explanatory comment on the database named object
069         */
070        public String getRemarks() {
071            return remarks;
072        }
073    
074        /**
075         * Sets explanatory comment on the database named object
076         * 
077         * @param remarks the explanatory comment on the database named object
078         */
079        public void setRemarks( String remarks ) {
080            this.remarks = remarks;
081        }
082    
083        /**
084         * Gets extra (non standard) properties if provided by database.
085         * 
086         * @return extra properties if provided by database
087         */
088        public Map<String, Object> getExtraProperties() {
089            return extraProperties;
090        }
091    
092        /**
093         * Gets extra (non standard) property if provided by database.
094         * 
095         * @param key the key
096         * @return extra property if provided by database
097         */
098        public Object getExtraProperty( String key ) {
099            return extraProperties.get(key);
100        }
101    
102        /**
103         * Adds extra property
104         * 
105         * @param key the key
106         * @param value the value
107         */
108        public void addExtraProperty( String key,
109                                      Object value ) {
110            extraProperties.put(key, value);
111        }
112    
113        /**
114         * deletes extra property
115         * 
116         * @param key the key
117         * 
118         */
119        public void deleteExtraProperty( String key ) {
120            extraProperties.remove(key);
121        }
122    }