001/* 002 Licensed to the Apache Software Foundation (ASF) under one 003 or more contributor license agreements. See the NOTICE file 004 distributed with this work for additional information 005 regarding copyright ownership. The ASF licenses this file 006 to you under the Apache License, Version 2.0 (the 007 "License"); you may not use this file except in compliance 008 with the License. You may obtain a copy of the License at 009 010 http://www.apache.org/licenses/LICENSE-2.0 011 012 Unless required by applicable law or agreed to in writing, 013 software distributed under the License is distributed on an 014 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 KIND, either express or implied. See the License for the 016 specific language governing permissions and limitations 017 under the License. 018 */ 019package org.apache.wiki.api.spi; 020 021import org.apache.wiki.api.core.Attachment; 022import org.apache.wiki.api.core.Engine; 023import org.apache.wiki.api.core.Page; 024 025 026public class ContentsDSL { 027 028 final ContentsSPI contentsSPI; 029 030 ContentsDSL( final ContentsSPI contentsSPI ) { 031 this.contentsSPI = contentsSPI; 032 } 033 034 /** 035 * Creates a new {@link Attachment}. The final name of the attachment will be a synthesis of the parent page name and the file name. 036 * 037 * @param engine The Engine which is hosting this attachment. 038 * @param parentPage The page which will contain this attachment. 039 * @param fileName The file name for the attachment. 040 * @return new {@link Attachment} instance. 041 */ 042 public Attachment attachment( final Engine engine, final String parentPage, final String fileName ) { 043 return contentsSPI.attachment( engine, parentPage, fileName ); 044 } 045 046 /** 047 * Creates a {@link Page} instance. 048 * 049 * @param engine The Engine that owns this page. 050 * @param name The name of the page. 051 * @return new {@link Page} instance. 052 */ 053 public Page page( final Engine engine, final String name ) { 054 return contentsSPI.page( engine, name ); 055 } 056 057}