001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.wicket.request.handler.resource; 018 019import java.util.Locale; 020 021import org.apache.wicket.request.ILogData; 022 023/** 024 * Contains logging data related to resources requests. 025 * 026 * @author Emond Papegaaij 027 */ 028public abstract class ResourceLogData implements ILogData 029{ 030 private static final long serialVersionUID = 1L; 031 032 private final String name; 033 private final String locale; 034 private final String style; 035 private final String variation; 036 037 /** 038 * Construct. 039 * 040 * @param name 041 * @param locale 042 * @param style 043 * @param variation 044 */ 045 public ResourceLogData(String name, Locale locale, String style, String variation) 046 { 047 this.name = name; 048 this.locale = locale == null ? null : locale.toString(); 049 this.style = style; 050 this.variation = variation; 051 } 052 053 /** 054 * @return (file)name 055 */ 056 public final String getName() 057 { 058 return name; 059 } 060 061 /** 062 * @return locale 063 */ 064 public final String getLocale() 065 { 066 return locale; 067 } 068 069 /** 070 * @return style 071 */ 072 public final String getStyle() 073 { 074 return style; 075 } 076 077 /** 078 * @return variation 079 */ 080 public final String getVariation() 081 { 082 return variation; 083 } 084 085 protected void fillToString(StringBuilder sb) 086 { 087 sb.append("name="); 088 sb.append(getName()); 089 sb.append(",locale="); 090 sb.append(getLocale()); 091 sb.append(",style="); 092 sb.append(getStyle()); 093 sb.append(",variation="); 094 sb.append(getVariation()); 095 } 096}