/*
 * Copyright (C) 2004-2005  exedio GmbH (www.exedio.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package com.exedio.cope.pattern;

import com.exedio.cope.Pattern;
import com.exedio.cope.Type;

class HttpPath extends Pattern
{
	private String urlPath = null;
	private String datadirURL = null;

	public void initialize()
	{
		final String name = getName();
		
		final Type type = getType();
		urlPath = type.getID() + '/' + name + '/';
		datadirURL = type.getModel().getProperties().getDatadirUrl();
	}
	
	final String getUrlPath()
	{
		if(urlPath==null)
			throw new RuntimeException("http entity not yet initialized");
		
		return urlPath;
	}
	
	final String getDatadirURL()
	{
		if(datadirURL==null)
			throw new RuntimeException("http entity not yet initialized");
		
		return datadirURL;
	}
	
	public final static class Log
	{
		private int counter = 0;
		private final Object lock = new Object();
		
		public final void increment()
		{
			synchronized(lock)
			{
				counter++;
			}
		}

		public final int get()
		{
			synchronized(lock)
			{
				return counter;
			}
		}

		final void reset()
		{
			synchronized(lock)
			{
				counter = 0;
			}
		}
	}

}

@@ -866,37 +866,8 @@
 ern;
-%0Aimport com.exedio.cope.Type;
 %0A%0Acl
@@ -1034,39 +1034,8 @@
 %0A%09%09%0A
-%09%09final Type type = getType();%0A
 %09%09ur
@@ -1042,20 +1042,25 @@
 lPath = 
-t
+getT
 ype
+()
 .getID()
@@ -1084,72 +1084,8 @@
 /';%0A
-%09%09datadirURL = type.getModel().getProperties().getDatadirUrl();%0A
 %09%7D%0A%09
@@ -1290,68 +1290,72 @@
 %0A%09%09%09
-throw new RuntimeException(%22http entity not yet initialized%22
+datadirURL = getType().getModel().getProperties().getDatadirUrl(
 );%0A%09

fix NoClassDefFoundError from previous revision