1 package org.exoplatform.services.wcm.friendly;
2 /*
3 * Copyright (C) 2003-2009 eXo Platform SAS.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Affero General Public License
7 * as published by the Free Software Foundation; either version 3
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see<http://www.gnu.org/licenses/>.
17 */
18
19 import java.util.Map;
20
21 import org.exoplatform.services.wcm.friendly.impl.FriendlyPlugin;
22
23 /**
24 * Provides support for friendly URL in Content.
25 * <p></p>
26 * For example:
27 * If URL is
28 * http://mysite.com/portal/public/acme/detail?path=/repository/collaboration/sites content/live/acme/web contents/news/news1
29 * where the friendly key could be: acme
30 * with unfriendly value as: /public/acme/detail?path=/repository/collaboration/sites content/live/acme/web contents,
31 * the friendly URL becomes: http://mysite.com/portal/content/acme/news/news1.
32 *
33 * @LevelAPI Experimental
34 *
35 */
36 public interface FriendlyService {
37
38 /**
39 * Uses a servlet in the portal app to forward the friendly URL to its corresponding unfriendly one.
40 * By default, the servelt name is "content".
41 *
42 * @return The servlet name.
43 */
44 public String getServletName();
45
46 /**
47 * Checks if the Friendly Service is active.
48 *
49 * @return "True" if the Friendly Service is active. Otherwise, it returns "false".
50 */
51 public boolean isEnabled();
52
53 /**
54 * Allows to add configuration to the Friendly Service.
55 *
56 * @param plugin The Friendly plugin.
57 */
58 public void addConfiguration(FriendlyPlugin plugin);
59
60 /**
61 * Gets the friendly URI corresponding to an unfriendly URI.
62 * <p></p>
63 * For example:<br>
64 *
65 * friendly = acme<br>
66 * unfriendly = /public/acme/detail?path=/repository/collaboration/sites content/live/acme/web contents<br>
67 *
68 * @param unfriendlyUri The current unfriendly URI.
69 * @return The friendly URI.
70 */
71 public String getFriendlyUri(String unfriendlyUri);
72
73 /**
74 * Gets the unfriendly URI corresponding to a friendly URI.
75 * <br>
76 * For example:<br>
77 *
78 * friendly = acme<br>
79 * unfriendly = /public/acme/detail?path=/repository/collaboration/sites content/live/acme/web contents<br>
80 *
81 * @param friendlyUri The current friendly URI.
82 * @return The unfriendly URI.
83 */
84 public String getUnfriendlyUri(String friendlyUri);
85
86 /**
87 * Adds a new {friendly, unfriendly} couple.
88 *
89 * @param friendlyUri The friendly URI.
90 * @param unfriendlyUri The unfriendly URI.
91 */
92 public void addFriendly(String friendlyUri, String unfriendlyUri);
93
94 /**
95 * Removes a friendly entry based on the friendly key.
96 *
97 * @param friendlyUri The friendly URI.
98 */
99 public void removeFriendly(String friendlyUri);
100
101
102 /**
103 * Gets all {friendly, unfriendly} entries.
104 *
105 * @return The map of entries.
106 */
107 public Map<String, String> getFriendlies();
108 }