// Path: src/org/onesocialweb/client/Inbox.java
// public interface Inbox {
// 	
// 	public ActivityEntry getEntry(String id);
// 	
// 	public List<ActivityEntry> getEntries();
// 	
// 	public void setEntries(List<ActivityEntry> entries);
// 	
// 	public void addEntry(ActivityEntry entry);
// 	
// 	public void removeEntry(ActivityEntry entry);
// 	
// 	public void updateEntry(ActivityEntry entry);
// 	
// 	public boolean refresh();
// 	
// 	public void registerInboxEventHandler(InboxEventHandler handler);
// 	
// 	public void unregisterInboxEventHandler(InboxEventHandler handler);
// 	
// 	public int getSize();
// 
// }
// 
// Path: src/org/onesocialweb/client/InboxEventHandler.java
// public interface InboxEventHandler {
// 
// 	public void onMessageReceived(ActivityEntry entry);
// 	
// 	public void onMessageDeleted(ActivityEntry entry);
// 	
// 	public void onMessageUpdated(ActivityEntry entry);
// 	
// 	public void onRefresh(List<ActivityEntry> activities);
// 	
// }
// 
// Path: src/org/onesocialweb/client/exception/AuthenticationRequired.java
// @SuppressWarnings("serial")
// public class AuthenticationRequired extends Exception {
// 
// }
// 
// Path: src/org/onesocialweb/client/exception/ConnectionRequired.java
// @SuppressWarnings("serial")
// public class ConnectionRequired extends Exception {
// 
// }
// 
// Path: src/org/onesocialweb/client/exception/RequestException.java
// @SuppressWarnings("serial")
// public class RequestException extends Exception {
// 
// 	public RequestException(String message) {
// 		super(message);
// 	}
// }


import java.util.ArrayList;
import java.util.List;
import org.onesocialweb.client.Inbox;
import org.onesocialweb.client.InboxEventHandler;
import org.onesocialweb.client.exception.AuthenticationRequired;
import org.onesocialweb.client.exception.ConnectionRequired;
import org.onesocialweb.client.exception.RequestException;
import org.onesocialweb.model.activity.ActivityEntry;
/*
 *  Copyright 2010 Vodafone Group Services Ltd.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *    
 */
package org.onesocialweb.smack;



public class InboxImp implements Inbox {

	private final List<InboxEventHandler> handlers = new ArrayList<InboxEventHandler>();

	private final OswServiceImp service;

	private List<ActivityEntry> entries = new ArrayList<ActivityEntry>();
	
	public InboxImp(OswServiceImp service) {
		this.service = service;
	}
	
	@Override
	public List<ActivityEntry> getEntries() {
		return entries;
	}

	@Override
	public boolean refresh() {
		try {
			return service.refreshInbox();
		} catch (ConnectionRequired e) {

// Path: src/org/onesocialweb/client/Inbox.java
// public interface Inbox {
// 	
// 	public ActivityEntry getEntry(String id);
// 	
// 	public List<ActivityEntry> getEntries();
// 	
// 	public void setEntries(List<ActivityEntry> entries);
// 	
// 	public void addEntry(ActivityEntry entry);
// 	
// 	public void removeEntry(ActivityEntry entry);
// 	
// 	public void updateEntry(ActivityEntry entry);
// 	
// 	public boolean refresh();
// 	
// 	public void registerInboxEventHandler(InboxEventHandler handler);
// 	
// 	public void unregisterInboxEventHandler(InboxEventHandler handler);
// 	
// 	public int getSize();
// 
// }
// 
// Path: src/org/onesocialweb/client/InboxEventHandler.java
// public interface InboxEventHandler {
// 
// 	public void onMessageReceived(ActivityEntry entry);
// 	
// 	public void onMessageDeleted(ActivityEntry entry);
// 	
// 	public void onMessageUpdated(ActivityEntry entry);
// 	
// 	public void onRefresh(List<ActivityEntry> activities);
// 	
// }
// 
// Path: src/org/onesocialweb/client/exception/AuthenticationRequired.java
// @SuppressWarnings("serial")
// public class AuthenticationRequired extends Exception {
// 
// }
// 
// Path: src/org/onesocialweb/client/exception/ConnectionRequired.java
// @SuppressWarnings("serial")
// public class ConnectionRequired extends Exception {
// 
// }
// 
// Path: src/org/onesocialweb/client/exception/RequestException.java
// @SuppressWarnings("serial")
// public class RequestException extends Exception {
// 
// 	public RequestException(String message) {
// 		super(message);
// 	}
// }


// Path: src/org/onesocialweb/smack/InboxImp.java
import java.util.ArrayList;
import java.util.List;
import org.onesocialweb.client.Inbox;
import org.onesocialweb.client.InboxEventHandler;
import org.onesocialweb.client.exception.AuthenticationRequired;
import org.onesocialweb.client.exception.ConnectionRequired;
import org.onesocialweb.client.exception.RequestException;
import org.onesocialweb.model.activity.ActivityEntry;

/*
 *  Copyright 2010 Vodafone Group Services Ltd.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *    
 */
package org.onesocialweb.smack;



public class InboxImp implements Inbox {

	private final List<InboxEventHandler> handlers = new ArrayList<InboxEventHandler>();

	private final OswServiceImp service;

	private List<ActivityEntry> entries = new ArrayList<ActivityEntry>();
	
	public InboxImp(OswServiceImp service) {
		this.service = service;
	}
	
	@Override
	public List<ActivityEntry> getEntries() {
		return entries;
	}

	@Override
	public boolean refresh() {
		try {
			return service.refreshInbox();
		} catch (ConnectionRequired e) {

		} catch (AuthenticationRequired e) {