001: /*
002: * This file is part of PFIXCORE.
003: *
004: * PFIXCORE is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU Lesser General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * PFIXCORE is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public License
015: * along with PFIXCORE; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018:
019: package de.schlund.pfixcore.editor2.frontend.util;
020:
021: import de.schlund.pfixcore.editor2.frontend.resources.DynIncludesResource;
022: import de.schlund.pfixcore.editor2.frontend.resources.ImagesResource;
023: import de.schlund.pfixcore.editor2.frontend.resources.IncludesResource;
024: import de.schlund.pfixcore.editor2.frontend.resources.PagesResource;
025: import de.schlund.pfixcore.editor2.frontend.resources.ProjectsResource;
026: import de.schlund.pfixcore.editor2.frontend.resources.SessionResource;
027: import de.schlund.pfixcore.editor2.frontend.resources.TargetsResource;
028: import de.schlund.pfixcore.editor2.frontend.resources.UsersResource;
029: import de.schlund.pfixcore.lucefix.ContextSearch;
030: import de.schlund.pfixcore.workflow.Context;
031:
032: /**
033: * Provides helper methods to get a ContextResource
034: *
035: * @author Sebastian Marsching <sebastian.marsching@1und1.de>
036: */
037: public abstract class EditorResourceLocator {
038: /**
039: * Returns SessionResource implementation
040: *
041: * @param context
042: * Context to use
043: * @return SessionResource for context
044: */
045: public final static SessionResource getSessionResource(
046: Context context) {
047: return (SessionResource) context.getContextResourceManager()
048: .getResource(SessionResource.class.getName());
049: }
050:
051: /**
052: * Returns ProjectsResource Implementation
053: *
054: * @param context
055: * Context to use
056: * @return ProjectsResource for context
057: */
058: public final static ProjectsResource getProjectsResource(
059: Context context) {
060: return (ProjectsResource) context.getContextResourceManager()
061: .getResource(ProjectsResource.class.getName());
062: }
063:
064: /**
065: * Returns PagesResource Implementation
066: *
067: * @param context
068: * Context to use
069: * @return PagesResource for context
070: */
071: public final static PagesResource getPagesResource(Context context) {
072: return (PagesResource) context.getContextResourceManager()
073: .getResource(PagesResource.class.getName());
074: }
075:
076: /**
077: * Returns TargetsResource Implementation
078: *
079: * @param context
080: * Context to use
081: * @return TargetsResource for context
082: */
083: public final static TargetsResource getTargetsResource(
084: Context context) {
085: return (TargetsResource) context.getContextResourceManager()
086: .getResource(TargetsResource.class.getName());
087: }
088:
089: /**
090: * Returns ImagesResource Implementation
091: *
092: * @param context
093: * Context to use
094: * @return ImagesResource for context
095: */
096: public final static ImagesResource getImagesResource(Context context) {
097: return (ImagesResource) context.getContextResourceManager()
098: .getResource(ImagesResource.class.getName());
099: }
100:
101: /**
102: * Returns IncludesResource Implementation
103: *
104: * @param context
105: * Context to use
106: * @return IncludesResource for context
107: */
108: public final static IncludesResource getIncludesResource(
109: Context context) {
110: return (IncludesResource) context.getContextResourceManager()
111: .getResource(IncludesResource.class.getName());
112: }
113:
114: /**
115: * Returns DynIncludesResource Implementation
116: *
117: * @param context
118: * Context to use
119: * @return DynIncludesResource for context
120: */
121: public final static DynIncludesResource getDynIncludesResource(
122: Context context) {
123: return (DynIncludesResource) context
124: .getContextResourceManager().getResource(
125: DynIncludesResource.class.getName());
126: }
127:
128: /**
129: * Returns UsersResource Implementation
130: *
131: * @param context
132: * Context to use
133: * @return UsersResource for context
134: */
135: public final static UsersResource getUsersResource(Context context) {
136: return (UsersResource) context.getContextResourceManager()
137: .getResource(UsersResource.class.getName());
138: }
139:
140: public final static ContextSearch getContextSearch(Context context) {
141: return (ContextSearch) context.getContextResourceManager()
142: .getResource(ContextSearch.class.getName());
143: }
144: }
|