Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/intabulas/sandler/introspection/impl/IntrospectionImpl.java


1   /**
2    * Copyright (c) 2003, Mark Lussier
3    * All rights reserved.
4    *
5    * Portions Copyright (c) 2003 by David A. Czarnecki
6    *
7    * Redistribution and use in source and binary forms, with or without
8    * modification, are permitted provided that the following conditions are met:
9    *
10   * Redistributions of source code must retain the above copyright notice,
11   *      this list of conditions and the following disclaimer.
12   * Redistributions in binary form must reproduce the above copyright notice,
13   *      this list of conditions and the following disclaimer in the documentation
14   *      and/or other materials provided with the distribution.
15   * Neither the name of the "Mark Lussier" and "Sandler" nor the names of
16   * its contributors may be used to endorse or promote products derived from
17   * this software without specific prior written permission.
18   * Products derived from this software may not be called "Sandler",
19   * nor may "Sandler" appear in their name, without prior written permission of
20   * Mark Lussier
21   *
22   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23   * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
26   * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
27   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31   * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
34   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35   */
36  package org.intabulas.sandler.introspection.impl;
37  
38  import org.intabulas.sandler.elements.AtomElement;
39  import org.intabulas.sandler.introspection.Introspection;
40  
41  
42  /**
43   * IntrospectionImpl
44   *
45   * @author Mark Lussier
46   * @version $Id: IntrospectionImpl.java,v 1.1 2003/09/10 16:20:48 intabulas Exp $
47   */
48  public class IntrospectionImpl implements Introspection, AtomElement {
49  
50      private String _searchUrl;
51      private String _createUrl;
52  
53  
54      /**
55       * Set's the Search URL to return whn an Introspection Query is made
56       *
57       * @param url a String representing the Search Entries URL
58       */
59      public void setSearchUrl(String url) {
60          _searchUrl = url;
61      }
62  
63      /**
64       * Returns the Search URL used in  an Introspection Query is made
65       * @return a String representing the Search Entries URL
66       */
67      public String getSearchUrl() {
68          return _searchUrl;
69      }
70  
71      /**
72       * Set's the Create URL to return whn an Introspection Query is made
73       * @param url a String representing the Create Entries URL
74       */
75      public void setCreateUrl(String url) {
76          _createUrl = url;
77      }
78  
79      /**
80       * Returns the Create URL used in  an Introspection Query is made
81       * @return a String representing the Create Entries URL
82       */
83      public String getCreateUrl() {
84          return _createUrl;
85      }
86  
87  
88      /**
89       * Returns a string representation of the object.
90       *
91       * @return  a String representation of the object.
92       */
93      public String toString() {
94          StringBuffer buffer = new StringBuffer(HTMLTAG_START).append(ELEMENT_INTROSPECTION).append(" xmlns=");
95          buffer.append(ATOM_NAMESPACE).append(HTMLTAG_CLOSE);
96  
97          if (_searchUrl != null && !"".equals(_searchUrl)) {
98              buffer.append(HTMLTAG_START).append(ELEMENT_SEARCHENTRY).append(HTMLTAG_CLOSE);
99              buffer.append(_searchUrl);
100             buffer.append(HTMLTAG_BEGIN).append(ELEMENT_SEARCHENTRY).append(HTMLTAG_CLOSE);
101         }
102 
103 
104         if (_createUrl != null && !"".equals(_createUrl)) {
105             buffer.append(HTMLTAG_START).append(ELEMENT_CREATEENTRY).append(HTMLTAG_CLOSE);
106             buffer.append(_createUrl);
107             buffer.append(HTMLTAG_BEGIN).append(ELEMENT_CREATEENTRY).append(HTMLTAG_CLOSE);
108         }
109 
110 
111         buffer.append(HTMLTAG_BEGIN).append(ELEMENT_INTROSPECTION).append(HTMLTAG_CLOSE);
112         return buffer.toString();
113     }
114 }