Skip to content
Permalink
Browse files
Moved further classes to the API package
  • Loading branch information
stephan committed Apr 7, 2005
1 parent fcc72cc commit 61cfea61cad7c7482666cfc450aed53f69a64345
Showing 91 changed files with 153 additions and 250 deletions.
@@ -223,7 +223,7 @@
<fileset dir="${target}/util/" includes="snipsnap/api/**"/>
</jar>
</target>

<!-- create server code -->
<target depends="compile-jsp, compile-server,installer-war,snipsnap-war" description="create server jar" name="jar-server">
<copy file="conf/copyright.txt" tofile="${target}/server/conf/copyright.txt" filtering="true">
@@ -143,7 +143,7 @@ to be accessed through Application though.
<subsubsection title="SnipViewServlet">
HTTP requests are handled by \textit{org.snipsnap.net.SnipViewServlet} which is
mapped to /space in the default application. The URL is parsed to extract the snip name and
the SnipSpace is retrieved via \textit{org.snipsnap.container.Components} which stores
the SnipSpace is retrieved via \textit{snipsnap.api.container.Components} which stores
all components in a PicoContainer. Then the snip is loaded by name and
placed in request scope.

@@ -9,7 +9,7 @@
org.dom4j.Node,
java.io.FilenameFilter,
snipsnap.api.snip.Snip,
org.snipsnap.container.Components,
snipsnap.api.container.Components,
snipsnap.api.snip.SnipSpace,
org.snipsnap.net.admin.ThemeHelper"%>
<%--
@@ -1,7 +1,7 @@
<%@ page import="java.util.*,
snipsnap.api.config.Configuration,
snipsnap.api.app.Application,
org.snipsnap.container.Components,
snipsnap.api.container.Components,
org.snipsnap.user.UserManager"%>
<%--
** User management
@@ -1,5 +1,5 @@
<%@ page import="org.snipsnap.user.UserManager,
org.snipsnap.container.Components,
snipsnap.api.container.Components,
java.util.List"
%>
<%--
@@ -7,7 +7,7 @@
<%@ page import="snipsnap.api.snip.SnipSpace,
snipsnap.api.app.Application,
snipsnap.api.snip.SnipSpaceFactory,
org.snipsnap.container.Components,
snipsnap.api.container.Components,
snipsnap.api.snip.Snip"%>
<%@ page pageEncoding="iso-8859-1" %>
<% response.setContentType("text/html; charset="+Application.get().getConfiguration().getEncoding()); %>
@@ -30,7 +30,7 @@
import snipsnap.api.snip.Snip;
import snipsnap.api.config.*;
import snipsnap.api.config.Configuration;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.radeox.util.logging.Logger;

import java.util.HashMap;
@@ -27,7 +27,7 @@
import snipsnap.api.app.Application;
import org.snipsnap.app.ApplicationManager;
import org.snipsnap.app.ApplicationStorage;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.snip.HomePage;
import snipsnap.api.snip.Snip;
import snipsnap.api.snip.SnipSpace;
@@ -35,6 +35,7 @@
import org.snipsnap.versioning.cookbook.CookbookDifferenceService;
import org.snipsnap.xmlrpc.*;
import snipsnap.api.snip.SnipSpace;
import snipsnap.api.container.*;

import javax.sql.DataSource;
import java.util.ArrayList;
@@ -83,7 +84,7 @@ public void init() {
addComponent(AuthenticationService.class, DefaultAuthenticationService.class);
addComponent(PasswordService.class);
addComponent(SessionService.class, DefaultSessionService.class);
addComponent(Components.DEFAULT_ENGINE, SnipRenderEngine.class);
addComponent(snipsnap.api.container.Components.DEFAULT_ENGINE, SnipRenderEngine.class);
addComponent(PlainTextRenderEngine.class);
addComponent(SnipSpace.class, SnipSpaceImpl.class);

@@ -24,7 +24,7 @@
*/
package org.snipsnap.graph;

import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.graph.builder.TreeBuilder;
import org.snipsnap.graph.graph.Tree;
import org.snipsnap.graph.graph.TreeNode;
@@ -39,7 +39,7 @@ public NameSpaceTreeBuilder(String root) {
}

public Tree build() {
SnipSpace space = (snipsnap.api.snip.SnipSpace) Components.getComponent(SnipSpace.class);
SnipSpace space = (snipsnap.api.snip.SnipSpace) snipsnap.api.container.Components.getComponent(SnipSpace.class);

snipsnap.api.snip.Snip[] snips = space.match(root);

@@ -31,7 +31,7 @@
import org.snipsnap.user.Roles;
import snipsnap.api.user.User;
import org.snipsnap.security.AccessController;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;

import java.security.GeneralSecurityException;

@@ -28,7 +28,7 @@
import snipsnap.api.app.Application;

import snipsnap.api.user.User;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.security.AccessController;

import java.security.GeneralSecurityException;
@@ -28,7 +28,7 @@
import gabriel.components.context.OwnerAccessContext;
import org.radeox.util.logging.Logger;
import snipsnap.api.app.Application;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.security.AccessController;
import snipsnap.api.snip.Snip;
import snipsnap.api.snip.SnipSpaceFactory;
@@ -81,7 +81,7 @@ public void setPermission(String permission) {
}

protected boolean condition() throws JspTagException {
AccessController controller = (AccessController) Components.getComponent(AccessController.class);
AccessController controller = (AccessController) snipsnap.api.container.Components.getComponent(AccessController.class);

Application app = snipsnap.api.app.Application.get();
User user = app.getUser();
@@ -32,7 +32,7 @@
import snipsnap.api.snip.SnipSpaceFactory;
import snipsnap.api.label.Label;
import org.snipsnap.snip.label.LabelManager;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.net.filter.MultipartWrapper;
import org.radeox.util.logging.Logger;

@@ -83,7 +83,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro
request.setAttribute("snip", snip);

String labelType = request.getParameter("labeltype");
LabelManager manager = (LabelManager)Components.getComponent(LabelManager.class);
LabelManager manager = (LabelManager)snipsnap.api.container.Components.getComponent(LabelManager.class);
snipsnap.api.label.Label label = manager.getLabel(labelType);
request.setAttribute("label", label);

@@ -30,7 +30,7 @@
import org.snipsnap.user.UserManager;
import org.snipsnap.user.PasswordService;
import org.snipsnap.user.UserManagerFactory;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.container.SessionService;
import snipsnap.api.config.Configuration;

@@ -63,7 +63,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response)
if (request.getParameter("cancel") == null) {
snipsnap.api.user.User user;
if (null != password1 && password1.equals(password2)) {
PasswordService passwordService = (PasswordService) Components.getComponent(PasswordService.class);
PasswordService passwordService = (PasswordService) snipsnap.api.container.Components.getComponent(PasswordService.class);
user = passwordService.changePassWord(key, password1);
} else {
request.setAttribute("error", "user.password.error.nomatch");
@@ -27,7 +27,7 @@
import org.radeox.util.logging.Logger;
import snipsnap.api.app.Application;
import snipsnap.api.config.Configuration;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.net.filter.MultipartWrapper;
import snipsnap.api.snip.Snip;
import org.snipsnap.snip.SnipFormatter;
@@ -81,7 +81,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response)
HttpSession session = request.getSession();
if (session != null) {
snipsnap.api.user.User user = snipsnap.api.app.Application.get().getUser();
AuthenticationService service = (AuthenticationService) Components.getComponent(AuthenticationService.class);
AuthenticationService service = (AuthenticationService) snipsnap.api.container.Components.getComponent(AuthenticationService.class);

if (snip != null && service.isAuthenticated(user)) {
snip.getComments().postComment(content);
@@ -26,7 +26,7 @@

import snipsnap.api.app.Application;
import snipsnap.api.config.Configuration;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import snipsnap.api.snip.Snip;
import snipsnap.api.snip.SnipSpace;
import org.snipsnap.util.ApplicationAwareMap;
@@ -26,7 +26,7 @@

import snipsnap.api.app.Application;
import snipsnap.api.config.Configuration;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import snipsnap.api.snip.Snip;
import snipsnap.api.snip.SnipSpace;
import org.snipsnap.versioning.VersionManager;
@@ -61,7 +61,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response)
int oldVersion = Integer.parseInt(oldString);
int newVersion = Integer.parseInt(newString);

snipsnap.api.snip.SnipSpace space = (snipsnap.api.snip.SnipSpace)Components.getComponent(snipsnap.api.snip.SnipSpace.class);
snipsnap.api.snip.SnipSpace space = (snipsnap.api.snip.SnipSpace)snipsnap.api.container.Components.getComponent(snipsnap.api.snip.SnipSpace.class);
snipsnap.api.snip.Snip snip = space.load(name);

VersionManager versionManager = (VersionManager) Components.getComponent(VersionManager.class);
@@ -30,7 +30,7 @@
import snipsnap.api.snip.Snip;
import org.snipsnap.snip.attachment.Attachment;
import org.snipsnap.snip.attachment.storage.AttachmentStorage;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
@@ -75,7 +75,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response)
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

AttachmentStorage attachmentStorage = (AttachmentStorage) Components.getComponent(AttachmentStorage.class);
AttachmentStorage attachmentStorage = (AttachmentStorage) snipsnap.api.container.Components.getComponent(AttachmentStorage.class);

Snip snip = (Snip) request.getAttribute(SNIP);
String fileName = (String) request.getAttribute(FILENAME);
@@ -39,7 +39,7 @@
import org.snipsnap.user.Roles;
import org.snipsnap.user.Security;
import snipsnap.api.user.User;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.security.AccessController;

import javax.servlet.RequestDispatcher;
@@ -27,7 +27,7 @@
import groovy.text.SimpleTemplateEngine;
import groovy.text.Template;
import snipsnap.api.app.Application;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import snipsnap.api.snip.SnipSpace;

import javax.servlet.ServletException;
@@ -26,7 +26,7 @@

import snipsnap.api.app.Application;
import snipsnap.api.config.Configuration;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import snipsnap.api.snip.Snip;
import snipsnap.api.snip.SnipSpace;
import org.snipsnap.versioning.VersionManager;
@@ -33,7 +33,7 @@
import snipsnap.api.label.Labels;
import snipsnap.api.app.Application;
import snipsnap.api.config.Configuration;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.net.filter.MultipartWrapper;
import org.radeox.util.logging.Logger;

@@ -27,7 +27,7 @@
import org.radeox.util.logging.Logger;
import snipsnap.api.app.Application;
import snipsnap.api.config.Configuration;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.container.SessionService;
import org.snipsnap.net.filter.MultipartWrapper;
import org.snipsnap.user.AuthenticationService;
@@ -32,7 +32,7 @@
import org.snipsnap.user.PasswordService;
import org.snipsnap.user.UserManagerFactory;
import org.snipsnap.util.mail.Mail;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
@@ -27,7 +27,7 @@
import org.radeox.util.logging.Logger;
import snipsnap.api.app.Application;
import snipsnap.api.config.Configuration;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import org.snipsnap.container.SessionService;
import org.snipsnap.net.filter.MultipartWrapper;
import org.snipsnap.snip.HomePage;
@@ -28,9 +28,10 @@
import groovy.text.Template;
import org.radeox.util.logging.Logger;
import snipsnap.api.app.Application;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import snipsnap.api.snip.Snip;
import snipsnap.api.snip.SnipSpace;
import snipsnap.api.plugin.ServletPlugin;
import org.snipsnap.snip.label.TypeLabel;
import org.snipsnap.user.Permissions;
import org.snipsnap.user.Roles;
@@ -26,7 +26,7 @@

import snipsnap.api.snip.SnipSpace;
import snipsnap.api.snip.Snip;
import org.snipsnap.container.Components;
import snipsnap.api.container.Components;
import snipsnap.api.config.Configuration;

import javax.servlet.ServletException;
@@ -49,7 +49,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
String name = request.getHeader("User-Agent");
String host = request.getRemoteHost();

SnipSpace space = (SnipSpace) Components.getComponent(SnipSpace.class);
SnipSpace space = (SnipSpace) snipsnap.api.container.Components.getComponent(SnipSpace.class);
if(space.exists(Configuration.SNIPSNAP_CONFIG_ROBOTS_TXT)) {
snipsnap.api.snip.Snip robotstxt = space.load(Configuration.SNIPSNAP_CONFIG_ROBOTS_TXT);
PrintWriter writer = new PrintWriter(response.getOutputStream());

This file was deleted.