Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies')
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IAccount.java62
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddy.java100
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyContainer.java40
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyProvider.java42
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyStateEvent.java56
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaboration.java88
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationContainer.java40
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationProvider.java42
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacility.java58
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacilityInstalledEvent.java56
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembership.java46
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipContainer.java40
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipKey.java42
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipProvider.java42
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessage.java42
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessageEvent.java42
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java62
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISessionProvider.java46
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Account.java158
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java452
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java304
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java594
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java304
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java236
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java260
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipKey.java144
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MessageEvent.java74
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/bundle/OM.java100
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateIndication.java74
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java80
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftIndication.java140
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java78
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageIndication.java114
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java88
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolConstants.java110
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolUtil.java452
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ClientFacilityFactory.java52
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java132
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Message.java104
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ServerFacilityFactory.java52
40 files changed, 2524 insertions, 2524 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IAccount.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IAccount.java
index a71816c5a4..78e472fdf5 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IAccount.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IAccount.java
@@ -1,31 +1,31 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.security.IUserAware;
-
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public interface IAccount extends IUserAware
-{
- public void setPassword(String password);
-
- public boolean authenticate(String password);
-
- public Map<String, String> getProperties();
-
- public void touch();
-
- public long getTimeStamp();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.security.IUserAware;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IAccount extends IUserAware
+{
+ public void setPassword(String password);
+
+ public boolean authenticate(String password);
+
+ public Map<String, String> getProperties();
+
+ public void touch();
+
+ public long getTimeStamp();
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddy.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddy.java
index 14663439c3..303c2a65b0 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddy.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddy.java
@@ -1,50 +1,50 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.security.IUserAware;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public interface IBuddy extends IUserAware, IMembershipContainer, ICollaborationProvider, IAdaptable
-{
- public State getState();
-
- public IAccount getAccount();
-
- public ISession getSession();
-
- public Set<String> getFacilityTypes();
-
- public IMembership initiate();
-
- public IMembership initiate(IBuddy buddy);
-
- public IMembership[] initiate(Collection<IBuddy> buddies);
-
- public IMembership join(long collaborationID);
-
- public IMembership join(Object invitationToken);
-
- /**
- * @author Eike Stepper
- */
- public enum State
- {
- AVAILABLE, LONESOME, AWAY, DO_NOT_DISTURB
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.security.IUserAware;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IBuddy extends IUserAware, IMembershipContainer, ICollaborationProvider, IAdaptable
+{
+ public State getState();
+
+ public IAccount getAccount();
+
+ public ISession getSession();
+
+ public Set<String> getFacilityTypes();
+
+ public IMembership initiate();
+
+ public IMembership initiate(IBuddy buddy);
+
+ public IMembership[] initiate(Collection<IBuddy> buddies);
+
+ public IMembership join(long collaborationID);
+
+ public IMembership join(Object invitationToken);
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum State
+ {
+ AVAILABLE, LONESOME, AWAY, DO_NOT_DISTURB
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyContainer.java
index 3789e1ab43..1dda8a8a97 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyContainer.java
@@ -1,20 +1,20 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.container.IContainer;
-
-/**
- * @author Eike Stepper
- */
-public interface IBuddyContainer extends IBuddyProvider, IContainer<IBuddy>
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IBuddyContainer extends IBuddyProvider, IContainer<IBuddy>
+{
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyProvider.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyProvider.java
index a48b85cf0b..ca81e2d12c 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyProvider.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-/**
- * @author Eike Stepper
- */
-public interface IBuddyProvider
-{
- public IBuddy[] getBuddies();
-
- public IBuddy getBuddy(String userID);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IBuddyProvider
+{
+ public IBuddy[] getBuddies();
+
+ public IBuddy getBuddy(String userID);
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyStateEvent.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyStateEvent.java
index 1cb9f4f793..ca2cd1a18f 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyStateEvent.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IBuddyStateEvent.java
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.event.IEvent;
-
-/**
- * @author Eike Stepper
- */
-public interface IBuddyStateEvent extends IEvent
-{
- /**
- * @since 3.0
- */
- public IBuddy getSource();
-
- public IBuddy.State getOldState();
-
- public IBuddy.State getNewState();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.event.IEvent;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IBuddyStateEvent extends IEvent
+{
+ /**
+ * @since 3.0
+ */
+ public IBuddy getSource();
+
+ public IBuddy.State getOldState();
+
+ public IBuddy.State getNewState();
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaboration.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaboration.java
index 44981c5f1d..63dc42346b 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaboration.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaboration.java
@@ -1,44 +1,44 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * @author Eike Stepper
- */
-public interface ICollaboration extends IMembershipContainer, IBuddyProvider, IAdaptable
-{
- public long getID();
-
- public String getTitle();
-
- public String getDescription();
-
- public Visibility getVisibility();
-
- public boolean isPublic();
-
- public void setPublic(String title, String description);
-
- public void setPrivate();
-
- public String[] getFacilityTypes();
-
- public IFacility[] getFacilities();
-
- public IFacility getFacility(String type);
-
- public enum Visibility
- {
- PRIVATE, PUBLIC
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * @author Eike Stepper
+ */
+public interface ICollaboration extends IMembershipContainer, IBuddyProvider, IAdaptable
+{
+ public long getID();
+
+ public String getTitle();
+
+ public String getDescription();
+
+ public Visibility getVisibility();
+
+ public boolean isPublic();
+
+ public void setPublic(String title, String description);
+
+ public void setPrivate();
+
+ public String[] getFacilityTypes();
+
+ public IFacility[] getFacilities();
+
+ public IFacility getFacility(String type);
+
+ public enum Visibility
+ {
+ PRIVATE, PUBLIC
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationContainer.java
index cbff595029..78af2986a6 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationContainer.java
@@ -1,20 +1,20 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.container.IContainer;
-
-/**
- * @author Eike Stepper
- */
-public interface ICollaborationContainer extends ICollaborationProvider, IContainer<ICollaboration>
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+/**
+ * @author Eike Stepper
+ */
+public interface ICollaborationContainer extends ICollaborationProvider, IContainer<ICollaboration>
+{
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationProvider.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationProvider.java
index 7dcedb238f..125b069f83 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ICollaborationProvider.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-/**
- * @author Eike Stepper
- */
-public interface ICollaborationProvider
-{
- public ICollaboration[] getCollaborations();
-
- public ICollaboration getCollaboration(long id);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+/**
+ * @author Eike Stepper
+ */
+public interface ICollaborationProvider
+{
+ public ICollaboration[] getCollaborations();
+
+ public ICollaboration getCollaboration(long id);
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacility.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacility.java
index aa623bc3fe..c92036a60b 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacility.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacility.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.event.INotifier;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * @author Eike Stepper
- */
-public interface IFacility extends INotifier, IAdaptable
-{
- public String getType();
-
- public ICollaboration getCollaboration();
-
- public void setCollaboration(ICollaboration collaboration);
-
- public void sendMessage(IMessage message);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.event.INotifier;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IFacility extends INotifier, IAdaptable
+{
+ public String getType();
+
+ public ICollaboration getCollaboration();
+
+ public void setCollaboration(ICollaboration collaboration);
+
+ public void sendMessage(IMessage message);
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacilityInstalledEvent.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacilityInstalledEvent.java
index 3cb3eb61d9..05ef1c360a 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacilityInstalledEvent.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IFacilityInstalledEvent.java
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.event.IEvent;
-
-/**
- * @author Eike Stepper
- */
-public interface IFacilityInstalledEvent extends IEvent
-{
- /**
- * @since 3.0
- */
- public ICollaboration getSource();
-
- public IFacility getFacility();
-
- public boolean fromRemote();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.event.IEvent;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IFacilityInstalledEvent extends IEvent
+{
+ /**
+ * @since 3.0
+ */
+ public ICollaboration getSource();
+
+ public IFacility getFacility();
+
+ public boolean fromRemote();
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembership.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembership.java
index ebffb6e182..073780340a 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembership.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembership.java
@@ -1,23 +1,23 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.container.IContainer;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * @author Eike Stepper
- */
-public interface IMembership extends IMembershipKey, IContainer<Object>, IAdaptable
-{
- public long getStartTime();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IMembership extends IMembershipKey, IContainer<Object>, IAdaptable
+{
+ public long getStartTime();
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipContainer.java
index 8162bc9df0..5a830a46c3 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipContainer.java
@@ -1,20 +1,20 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.container.IContainer;
-
-/**
- * @author Eike Stepper
- */
-public interface IMembershipContainer extends IMembershipProvider, IContainer<IMembership>
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IMembershipContainer extends IMembershipProvider, IContainer<IMembership>
+{
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipKey.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipKey.java
index 0644d7d47d..2602a7148b 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipKey.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipKey.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-/**
- * @author Eike Stepper
- */
-public interface IMembershipKey
-{
- public IBuddy getBuddy();
-
- public ICollaboration getCollaboration();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IMembershipKey
+{
+ public IBuddy getBuddy();
+
+ public ICollaboration getCollaboration();
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipProvider.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipProvider.java
index fc3e1ffb75..bdadda1ace 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMembershipProvider.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-/**
- * @author Eike Stepper
- */
-public interface IMembershipProvider
-{
- public IMembership[] getMemberships();
-
- public IMembership getMembership(IBuddy buddy, ICollaboration collaboration);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IMembershipProvider
+{
+ public IMembership[] getMemberships();
+
+ public IMembership getMembership(IBuddy buddy, ICollaboration collaboration);
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessage.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessage.java
index 7cd87d5e71..fb720a421e 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessage.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessage.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * @author Eike Stepper
- */
-public interface IMessage extends IAdaptable
-{
- public String getSenderID();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IMessage extends IAdaptable
+{
+ public String getSenderID();
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessageEvent.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessageEvent.java
index d09bf2e835..c459d891c3 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessageEvent.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/IMessageEvent.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.util.event.IEvent;
-
-/**
- * @author Eike Stepper
- */
-public interface IMessageEvent extends IEvent
-{
- public IMessage getMessage();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.util.event.IEvent;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IMessageEvent extends IEvent
+{
+ public IMessage getMessage();
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java
index c2845c48b6..a1a1a5636f 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISession.java
@@ -1,31 +1,31 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-import org.eclipse.net4j.protocol.IProtocol;
-import org.eclipse.net4j.util.event.INotifier;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * @author Eike Stepper
- */
-public interface ISession extends INotifier, IAdaptable
-{
- /**
- * @since 2.0
- */
- public IProtocol<?> getProtocol();
-
- public IBuddy getSelf();
-
- public void close();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+import org.eclipse.net4j.protocol.IProtocol;
+import org.eclipse.net4j.util.event.INotifier;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * @author Eike Stepper
+ */
+public interface ISession extends INotifier, IAdaptable
+{
+ /**
+ * @since 2.0
+ */
+ public IProtocol<?> getProtocol();
+
+ public IBuddy getSelf();
+
+ public void close();
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISessionProvider.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISessionProvider.java
index 43ac446225..abe98aeae7 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISessionProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/common/ISessionProvider.java
@@ -1,23 +1,23 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.common;
-
-/**
- * @author Eike Stepper
- */
-public interface ISessionProvider
-{
- public ISession[] getSessions();
-
- public ISession getSession(String userID);
-
- public ISession getSession(IBuddy buddy);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.common;
+
+/**
+ * @author Eike Stepper
+ */
+public interface ISessionProvider
+{
+ public ISession[] getSessions();
+
+ public ISession getSession(String userID);
+
+ public ISession getSession(IBuddy buddy);
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Account.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Account.java
index e062c9d5b4..52e914d2bc 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Account.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Account.java
@@ -1,79 +1,79 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.IAccount;
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class Account implements IAccount, Serializable
-{
- private static final long serialVersionUID = 1L;
-
- private String userID;
-
- private transient String password;
-
- private Map<String, String> properties = new HashMap<String, String>();
-
- private long timeStamp;
-
- protected Account()
- {
- }
-
- public Account(String userID, String password)
- {
- this.userID = userID;
- this.password = password;
- }
-
- public String getUserID()
- {
- return userID;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- public boolean authenticate(String password)
- {
- return ObjectUtil.equals(password, this.password);
- }
-
- public Map<String, String> getProperties()
- {
- return properties;
- }
-
- public void touch()
- {
- timeStamp = System.currentTimeMillis();
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.IAccount;
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class Account implements IAccount, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String userID;
+
+ private transient String password;
+
+ private Map<String, String> properties = new HashMap<String, String>();
+
+ private long timeStamp;
+
+ protected Account()
+ {
+ }
+
+ public Account(String userID, String password)
+ {
+ this.userID = userID;
+ this.password = password;
+ }
+
+ public String getUserID()
+ {
+ return userID;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public boolean authenticate(String password)
+ {
+ return ObjectUtil.equals(password, this.password);
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public void touch()
+ {
+ timeStamp = System.currentTimeMillis();
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
index 0f6379ea24..6e1acd620c 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
@@ -1,226 +1,226 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.IBuddyStateEvent;
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.buddies.common.ISession;
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.event.Event;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public abstract class Buddy extends MembershipContainer implements IBuddy
-{
- private ISession session;
-
- private State state = State.AVAILABLE;
-
- private Set<String> facilityTypes;
-
- public Buddy(ISession session, Set<String> facilityTypes)
- {
- this.session = session;
- this.facilityTypes = facilityTypes == null ? null : Collections.unmodifiableSet(facilityTypes);
- }
-
- public ISession getSession()
- {
- return session;
- }
-
- public void setSession(ISession session)
- {
- this.session = session;
- }
-
- public State getState()
- {
- return state;
- }
-
- public void setState(State state)
- {
- if (this.state != state)
- {
- IEvent event = new BuddyStateEvent(this.state, state);
- this.state = state;
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(event, listeners);
- }
- }
- }
-
- public Set<String> getFacilityTypes()
- {
- if (facilityTypes == null)
- {
- facilityTypes = Collections.unmodifiableSet(loadFacilityTypes());
- }
-
- return facilityTypes;
- }
-
- public IMembership getMembership(Collaboration collaboration)
- {
- return getMembership(this, collaboration);
- }
-
- public IMembership removeMembership(Collaboration collaboration)
- {
- return removeMembership(this, collaboration);
- }
-
- public ICollaboration getCollaboration(long collaborationID)
- {
- for (IMembership membership : getMemberships())
- {
- ICollaboration collaboration = membership.getCollaboration();
- if (collaboration.getID() == collaborationID)
- {
- return collaboration;
- }
- }
-
- return null;
- }
-
- public ICollaboration[] getCollaborations()
- {
- List<ICollaboration> collaborations = new ArrayList<ICollaboration>();
- for (IMembership membership : getMemberships())
- {
- ICollaboration collaboration = membership.getCollaboration();
- collaborations.add(collaboration);
- }
-
- return collaborations.toArray(new ICollaboration[collaborations.size()]);
- }
-
- public IMembership initiate()
- {
- return initiate((IBuddy)null);
- }
-
- public IMembership initiate(IBuddy buddy)
- {
- HashSet<IBuddy> buddies = new HashSet<IBuddy>();
- if (buddy != null)
- {
- buddies.add(buddy);
- }
-
- IMembership[] memberships = initiate(buddies);
- return memberships.length == 0 ? null : memberships[0];
- }
-
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter)
- {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof IBuddy)
- {
- IBuddy buddy = (IBuddy)obj;
- return ObjectUtil.equals(getUserID(), buddy.getUserID());
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return ObjectUtil.hashCode(getUserID());
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}[{1}]", getClass().getSimpleName(), getUserID()); //$NON-NLS-1$
- }
-
- protected Set<String> loadFacilityTypes()
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @author Eike Stepper
- */
- private final class BuddyStateEvent extends Event implements IBuddyStateEvent
- {
- private static final long serialVersionUID = 1L;
-
- private State oldState;
-
- private State newState;
-
- public BuddyStateEvent(State oldState, State newState)
- {
- super(Buddy.this);
- this.oldState = oldState;
- this.newState = newState;
- }
-
- @Override
- public IBuddy getSource()
- {
- return (IBuddy)super.getSource();
- }
-
- public State getOldState()
- {
- return oldState;
- }
-
- public State getNewState()
- {
- return newState;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("BuddyStateEvent[source={0}, oldState={1}, newState={2}]", getSource(), //$NON-NLS-1$
- getOldState(), getNewState());
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.IBuddyStateEvent;
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.buddies.common.ISession;
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.event.Event;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class Buddy extends MembershipContainer implements IBuddy
+{
+ private ISession session;
+
+ private State state = State.AVAILABLE;
+
+ private Set<String> facilityTypes;
+
+ public Buddy(ISession session, Set<String> facilityTypes)
+ {
+ this.session = session;
+ this.facilityTypes = facilityTypes == null ? null : Collections.unmodifiableSet(facilityTypes);
+ }
+
+ public ISession getSession()
+ {
+ return session;
+ }
+
+ public void setSession(ISession session)
+ {
+ this.session = session;
+ }
+
+ public State getState()
+ {
+ return state;
+ }
+
+ public void setState(State state)
+ {
+ if (this.state != state)
+ {
+ IEvent event = new BuddyStateEvent(this.state, state);
+ this.state = state;
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(event, listeners);
+ }
+ }
+ }
+
+ public Set<String> getFacilityTypes()
+ {
+ if (facilityTypes == null)
+ {
+ facilityTypes = Collections.unmodifiableSet(loadFacilityTypes());
+ }
+
+ return facilityTypes;
+ }
+
+ public IMembership getMembership(Collaboration collaboration)
+ {
+ return getMembership(this, collaboration);
+ }
+
+ public IMembership removeMembership(Collaboration collaboration)
+ {
+ return removeMembership(this, collaboration);
+ }
+
+ public ICollaboration getCollaboration(long collaborationID)
+ {
+ for (IMembership membership : getMemberships())
+ {
+ ICollaboration collaboration = membership.getCollaboration();
+ if (collaboration.getID() == collaborationID)
+ {
+ return collaboration;
+ }
+ }
+
+ return null;
+ }
+
+ public ICollaboration[] getCollaborations()
+ {
+ List<ICollaboration> collaborations = new ArrayList<ICollaboration>();
+ for (IMembership membership : getMemberships())
+ {
+ ICollaboration collaboration = membership.getCollaboration();
+ collaborations.add(collaboration);
+ }
+
+ return collaborations.toArray(new ICollaboration[collaborations.size()]);
+ }
+
+ public IMembership initiate()
+ {
+ return initiate((IBuddy)null);
+ }
+
+ public IMembership initiate(IBuddy buddy)
+ {
+ HashSet<IBuddy> buddies = new HashSet<IBuddy>();
+ if (buddy != null)
+ {
+ buddies.add(buddy);
+ }
+
+ IMembership[] memberships = initiate(buddies);
+ return memberships.length == 0 ? null : memberships[0];
+ }
+
+ /**
+ * @see PlatformObject#getAdapter(Class)
+ */
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof IBuddy)
+ {
+ IBuddy buddy = (IBuddy)obj;
+ return ObjectUtil.equals(getUserID(), buddy.getUserID());
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ObjectUtil.hashCode(getUserID());
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}[{1}]", getClass().getSimpleName(), getUserID()); //$NON-NLS-1$
+ }
+
+ protected Set<String> loadFacilityTypes()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class BuddyStateEvent extends Event implements IBuddyStateEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private State oldState;
+
+ private State newState;
+
+ public BuddyStateEvent(State oldState, State newState)
+ {
+ super(Buddy.this);
+ this.oldState = oldState;
+ this.newState = newState;
+ }
+
+ @Override
+ public IBuddy getSource()
+ {
+ return (IBuddy)super.getSource();
+ }
+
+ public State getOldState()
+ {
+ return oldState;
+ }
+
+ public State getNewState()
+ {
+ return newState;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("BuddyStateEvent[source={0}, oldState={1}, newState={2}]", getSource(), //$NON-NLS-1$
+ getOldState(), getNewState());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java
index e92d4db9f2..063404dca4 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java
@@ -1,152 +1,152 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.IBuddyContainer;
-import org.eclipse.net4j.util.container.IContainerDelta;
-import org.eclipse.net4j.util.container.SingleDeltaContainerEvent;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleEvent;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class BuddyContainer extends Lifecycle implements IBuddyContainer, IListener
-{
- private Map<String, IBuddy> buddies = new HashMap<String, IBuddy>();
-
- public BuddyContainer(Collection<IBuddy> buddies)
- {
- if (buddies != null)
- {
- for (IBuddy buddy : buddies)
- {
- this.buddies.put(buddy.getUserID(), buddy);
- buddy.addListener(this);
- }
- }
- }
-
- public BuddyContainer()
- {
- }
-
- public boolean addBuddy(IBuddy buddy)
- {
- String userID = buddy.getUserID();
- synchronized (buddies)
- {
- if (!buddies.containsKey(userID))
- {
- buddies.put(userID, buddy);
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new SingleDeltaContainerEvent<IBuddy>(this, buddy, IContainerDelta.Kind.ADDED), listeners);
- }
-
- buddy.addListener(this);
- return true;
- }
- }
-
- return false;
- }
-
- public IBuddy removeBuddy(String userID)
- {
- IBuddy buddy;
- synchronized (buddies)
- {
- buddy = buddies.remove(userID);
- }
-
- if (buddy != null)
- {
- buddy.removeListener(this);
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new SingleDeltaContainerEvent<IBuddy>(this, buddy, IContainerDelta.Kind.REMOVED), listeners);
- }
- }
-
- return buddy;
- }
-
- public IBuddy[] getBuddies()
- {
- synchronized (buddies)
- {
- return buddies.values().toArray(new IBuddy[buddies.size()]);
- }
- }
-
- public IBuddy getBuddy(String userID)
- {
- synchronized (buddies)
- {
- return buddies.get(userID);
- }
- }
-
- public IBuddy[] getElements()
- {
- return getBuddies();
- }
-
- public boolean isEmpty()
- {
- synchronized (buddies)
- {
- return buddies.isEmpty();
- }
- }
-
- public void notifyEvent(IEvent event)
- {
- if (event.getSource() instanceof IBuddy)
- {
- notifyBuddyEvent(event);
- if (event instanceof LifecycleEvent)
- {
- LifecycleEvent e = (LifecycleEvent)event;
- if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
- {
- removeBuddy(((IBuddy)e.getSource()).getUserID());
- }
- }
- }
- }
-
- protected void notifyBuddyEvent(IEvent event)
- {
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- for (IBuddy buddy : getBuddies())
- {
- buddy.removeListener(this);
- }
-
- super.doDeactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.IBuddyContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.SingleDeltaContainerEvent;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.util.lifecycle.LifecycleEvent;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuddyContainer extends Lifecycle implements IBuddyContainer, IListener
+{
+ private Map<String, IBuddy> buddies = new HashMap<String, IBuddy>();
+
+ public BuddyContainer(Collection<IBuddy> buddies)
+ {
+ if (buddies != null)
+ {
+ for (IBuddy buddy : buddies)
+ {
+ this.buddies.put(buddy.getUserID(), buddy);
+ buddy.addListener(this);
+ }
+ }
+ }
+
+ public BuddyContainer()
+ {
+ }
+
+ public boolean addBuddy(IBuddy buddy)
+ {
+ String userID = buddy.getUserID();
+ synchronized (buddies)
+ {
+ if (!buddies.containsKey(userID))
+ {
+ buddies.put(userID, buddy);
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<IBuddy>(this, buddy, IContainerDelta.Kind.ADDED), listeners);
+ }
+
+ buddy.addListener(this);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public IBuddy removeBuddy(String userID)
+ {
+ IBuddy buddy;
+ synchronized (buddies)
+ {
+ buddy = buddies.remove(userID);
+ }
+
+ if (buddy != null)
+ {
+ buddy.removeListener(this);
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<IBuddy>(this, buddy, IContainerDelta.Kind.REMOVED), listeners);
+ }
+ }
+
+ return buddy;
+ }
+
+ public IBuddy[] getBuddies()
+ {
+ synchronized (buddies)
+ {
+ return buddies.values().toArray(new IBuddy[buddies.size()]);
+ }
+ }
+
+ public IBuddy getBuddy(String userID)
+ {
+ synchronized (buddies)
+ {
+ return buddies.get(userID);
+ }
+ }
+
+ public IBuddy[] getElements()
+ {
+ return getBuddies();
+ }
+
+ public boolean isEmpty()
+ {
+ synchronized (buddies)
+ {
+ return buddies.isEmpty();
+ }
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ if (event.getSource() instanceof IBuddy)
+ {
+ notifyBuddyEvent(event);
+ if (event instanceof LifecycleEvent)
+ {
+ LifecycleEvent e = (LifecycleEvent)event;
+ if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
+ {
+ removeBuddy(((IBuddy)e.getSource()).getUserID());
+ }
+ }
+ }
+ }
+
+ protected void notifyBuddyEvent(IEvent event)
+ {
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ for (IBuddy buddy : getBuddies())
+ {
+ buddy.removeListener(this);
+ }
+
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
index 765b57795f..040ed3ecb0 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
@@ -1,297 +1,297 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IFacility;
-import org.eclipse.net4j.buddies.common.IFacilityInstalledEvent;
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.buddies.common.IMessage;
-import org.eclipse.net4j.buddies.internal.common.bundle.OM;
-import org.eclipse.net4j.buddies.internal.common.protocol.MessageNotification;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.event.Event;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * @author Eike Stepper
- */
-public class Collaboration extends MembershipContainer implements ICollaboration
-{
- private long id;
-
- private String title;
-
- private String description;
-
- private Visibility visibility = Visibility.PRIVATE;
-
- private ConcurrentMap<String, IFacility> facilities = new ConcurrentHashMap<String, IFacility>();
-
- public Collaboration(long id)
- {
- this.id = id;
- }
-
- public long getID()
- {
- return id;
- }
-
- public String getTitle()
- {
- return title == null ? String.valueOf(id) : title;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public Visibility getVisibility()
- {
- return visibility;
- }
-
- public boolean isPublic()
- {
- return visibility == Visibility.PUBLIC;
- }
-
- public void setPublic(String title, String description)
- {
- visibility = Visibility.PUBLIC;
- this.title = title;
- this.description = description;
- }
-
- public void setPrivate()
- {
- visibility = Visibility.PRIVATE;
- title = null;
- description = null;
- }
-
- public IMembership getMembership(IBuddy buddy)
- {
- return getMembership(buddy, this);
- }
-
- public IMembership removeMembership(IBuddy buddy)
- {
- return removeMembership(buddy, this);
- }
-
- public IBuddy getBuddy(String userID)
- {
- for (IMembership membership : getMemberships())
- {
- IBuddy buddy = membership.getBuddy();
- if (ObjectUtil.equals(buddy.getUserID(), userID))
- {
- return buddy;
- }
- }
-
- return null;
- }
-
- public IBuddy[] getBuddies()
- {
- List<IBuddy> buddies = new ArrayList<IBuddy>();
- for (IMembership membership : getMemberships())
- {
- IBuddy buddy = membership.getBuddy();
- buddies.add(buddy);
- }
-
- return buddies.toArray(new IBuddy[buddies.size()]);
- }
-
- public String[] getFacilityTypes()
- {
- return facilities.keySet().toArray(new String[facilities.size()]);
- }
-
- public IFacility[] getFacilities()
- {
- return facilities.values().toArray(new IFacility[facilities.size()]);
- }
-
- public IFacility getFacility(String type)
- {
- return facilities.get(type);
- }
-
- public boolean addFacility(IFacility facility, boolean remote)
- {
- String type = facility.getType();
- if (!facilities.containsKey(type))
- {
- facilities.put(type, facility);
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new FacilityInstalledEvent(this, facility, remote), listeners);
- }
-
- facility.addListener(this);
- return true;
- }
-
- return false;
- }
-
- public void sendMessage(long collaborationID, String facilityType, IMessage message)
- {
- IMembership[] elements = getElements();
- for (IMembership membership : elements)
- {
- IBuddy receiver = membership.getBuddy();
- if (!ObjectUtil.equals(receiver.getUserID(), message.getSenderID()))
- {
- try
- {
- SignalProtocol<?> protocol = (SignalProtocol<?>)receiver.getSession().getProtocol();
- new MessageNotification(protocol, collaborationID, facilityType, message).sendAsync();
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
- }
- }
-
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter)
- {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof ICollaboration)
- {
- ICollaboration collaboration = (ICollaboration)obj;
- return getID() == collaboration.getID();
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return ObjectUtil.hashCode(id);
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}[{1}]", getClass().getSimpleName(), getTitle()); //$NON-NLS-1$
- }
-
- @Override
- public void notifyEvent(IEvent event)
- {
- super.notifyEvent(event);
- if (event.getSource() instanceof IFacility)
- {
- notifyFacilityEvent(event);
- }
- }
-
- protected void notifyFacilityEvent(IEvent event)
- {
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- for (IFacility facility : getFacilities())
- {
- facility.removeListener(this);
- LifecycleUtil.deactivate(facility);
- }
-
- for (IMembership membership : getMemberships())
- {
- LifecycleUtil.deactivate(membership);
- }
-
- super.doDeactivate();
- }
-
- /**
- * @author Eike Stepper
- */
- private static final class FacilityInstalledEvent extends Event implements IFacilityInstalledEvent
- {
- private static final long serialVersionUID = 1L;
-
- private IFacility facility;
-
- private boolean remote;
-
- public FacilityInstalledEvent(ICollaboration source, IFacility facility, boolean remote)
- {
- super(source);
- this.facility = facility;
- this.remote = remote;
- }
-
- @Override
- public ICollaboration getSource()
- {
- return (ICollaboration)super.getSource();
- }
-
- public IFacility getFacility()
- {
- return facility;
- }
-
- public boolean fromRemote()
- {
- return remote;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("FacilityInstalledEvent[source={0}, facility={1}, remote={2}]", getSource(), //$NON-NLS-1$
- facility, remote);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IFacility;
+import org.eclipse.net4j.buddies.common.IFacilityInstalledEvent;
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.buddies.common.IMessage;
+import org.eclipse.net4j.buddies.internal.common.bundle.OM;
+import org.eclipse.net4j.buddies.internal.common.protocol.MessageNotification;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.event.Event;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * @author Eike Stepper
+ */
+public class Collaboration extends MembershipContainer implements ICollaboration
+{
+ private long id;
+
+ private String title;
+
+ private String description;
+
+ private Visibility visibility = Visibility.PRIVATE;
+
+ private ConcurrentMap<String, IFacility> facilities = new ConcurrentHashMap<String, IFacility>();
+
+ public Collaboration(long id)
+ {
+ this.id = id;
+ }
+
+ public long getID()
+ {
+ return id;
+ }
+
+ public String getTitle()
+ {
+ return title == null ? String.valueOf(id) : title;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public Visibility getVisibility()
+ {
+ return visibility;
+ }
+
+ public boolean isPublic()
+ {
+ return visibility == Visibility.PUBLIC;
+ }
+
+ public void setPublic(String title, String description)
+ {
+ visibility = Visibility.PUBLIC;
+ this.title = title;
+ this.description = description;
+ }
+
+ public void setPrivate()
+ {
+ visibility = Visibility.PRIVATE;
+ title = null;
+ description = null;
+ }
+
+ public IMembership getMembership(IBuddy buddy)
+ {
+ return getMembership(buddy, this);
+ }
+
+ public IMembership removeMembership(IBuddy buddy)
+ {
+ return removeMembership(buddy, this);
+ }
+
+ public IBuddy getBuddy(String userID)
+ {
+ for (IMembership membership : getMemberships())
+ {
+ IBuddy buddy = membership.getBuddy();
+ if (ObjectUtil.equals(buddy.getUserID(), userID))
+ {
+ return buddy;
+ }
+ }
+
+ return null;
+ }
+
+ public IBuddy[] getBuddies()
+ {
+ List<IBuddy> buddies = new ArrayList<IBuddy>();
+ for (IMembership membership : getMemberships())
+ {
+ IBuddy buddy = membership.getBuddy();
+ buddies.add(buddy);
+ }
+
+ return buddies.toArray(new IBuddy[buddies.size()]);
+ }
+
+ public String[] getFacilityTypes()
+ {
+ return facilities.keySet().toArray(new String[facilities.size()]);
+ }
+
+ public IFacility[] getFacilities()
+ {
+ return facilities.values().toArray(new IFacility[facilities.size()]);
+ }
+
+ public IFacility getFacility(String type)
+ {
+ return facilities.get(type);
+ }
+
+ public boolean addFacility(IFacility facility, boolean remote)
+ {
+ String type = facility.getType();
+ if (!facilities.containsKey(type))
+ {
+ facilities.put(type, facility);
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new FacilityInstalledEvent(this, facility, remote), listeners);
+ }
+
+ facility.addListener(this);
+ return true;
+ }
+
+ return false;
+ }
+
+ public void sendMessage(long collaborationID, String facilityType, IMessage message)
+ {
+ IMembership[] elements = getElements();
+ for (IMembership membership : elements)
+ {
+ IBuddy receiver = membership.getBuddy();
+ if (!ObjectUtil.equals(receiver.getUserID(), message.getSenderID()))
+ {
+ try
+ {
+ SignalProtocol<?> protocol = (SignalProtocol<?>)receiver.getSession().getProtocol();
+ new MessageNotification(protocol, collaborationID, facilityType, message).sendAsync();
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+ }
+ }
+
+ /**
+ * @see PlatformObject#getAdapter(Class)
+ */
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof ICollaboration)
+ {
+ ICollaboration collaboration = (ICollaboration)obj;
+ return getID() == collaboration.getID();
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ObjectUtil.hashCode(id);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}[{1}]", getClass().getSimpleName(), getTitle()); //$NON-NLS-1$
+ }
+
+ @Override
+ public void notifyEvent(IEvent event)
+ {
+ super.notifyEvent(event);
+ if (event.getSource() instanceof IFacility)
+ {
+ notifyFacilityEvent(event);
+ }
+ }
+
+ protected void notifyFacilityEvent(IEvent event)
+ {
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ for (IFacility facility : getFacilities())
+ {
+ facility.removeListener(this);
+ LifecycleUtil.deactivate(facility);
+ }
+
+ for (IMembership membership : getMemberships())
+ {
+ LifecycleUtil.deactivate(membership);
+ }
+
+ super.doDeactivate();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class FacilityInstalledEvent extends Event implements IFacilityInstalledEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private IFacility facility;
+
+ private boolean remote;
+
+ public FacilityInstalledEvent(ICollaboration source, IFacility facility, boolean remote)
+ {
+ super(source);
+ this.facility = facility;
+ this.remote = remote;
+ }
+
+ @Override
+ public ICollaboration getSource()
+ {
+ return (ICollaboration)super.getSource();
+ }
+
+ public IFacility getFacility()
+ {
+ return facility;
+ }
+
+ public boolean fromRemote()
+ {
+ return remote;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("FacilityInstalledEvent[source={0}, facility={1}, remote={2}]", getSource(), //$NON-NLS-1$
+ facility, remote);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java
index 5d33d0440c..4dda2ae001 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java
@@ -1,152 +1,152 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.ICollaborationContainer;
-import org.eclipse.net4j.util.container.IContainerDelta;
-import org.eclipse.net4j.util.container.SingleDeltaContainerEvent;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleEvent;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CollaborationContainer extends Lifecycle implements ICollaborationContainer, IListener
-{
- private Map<Long, ICollaboration> collaborations = new HashMap<Long, ICollaboration>();
-
- public CollaborationContainer(Collection<ICollaboration> collaborations)
- {
- if (collaborations != null)
- {
- for (ICollaboration collaboration : collaborations)
- {
- this.collaborations.put(collaboration.getID(), collaboration);
- collaboration.addListener(this);
- }
- }
- }
-
- public CollaborationContainer()
- {
- }
-
- public void addCollaboration(ICollaboration collaboration)
- {
- long id = collaboration.getID();
- synchronized (collaborations)
- {
- if (!collaborations.containsKey(id))
- {
- collaborations.put(id, collaboration);
- }
- }
-
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new SingleDeltaContainerEvent<ICollaboration>(this, collaboration, IContainerDelta.Kind.ADDED),
- listeners);
- }
-
- collaboration.addListener(this);
- }
-
- public ICollaboration removeCollaboration(long id)
- {
- ICollaboration collaboration;
- synchronized (collaborations)
- {
- collaboration = collaborations.remove(id);
- }
-
- if (collaboration != null)
- {
- collaboration.removeListener(this);
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new SingleDeltaContainerEvent<ICollaboration>(this, collaboration, IContainerDelta.Kind.REMOVED),
- listeners);
- }
- }
-
- return collaboration;
- }
-
- public ICollaboration[] getCollaborations()
- {
- synchronized (collaborations)
- {
- return collaborations.values().toArray(new ICollaboration[collaborations.size()]);
- }
- }
-
- public ICollaboration getCollaboration(long id)
- {
- synchronized (collaborations)
- {
- return collaborations.get(id);
- }
- }
-
- public ICollaboration[] getElements()
- {
- return getCollaborations();
- }
-
- public boolean isEmpty()
- {
- synchronized (collaborations)
- {
- return collaborations.isEmpty();
- }
- }
-
- public void notifyEvent(IEvent event)
- {
- if (event.getSource() instanceof ICollaboration)
- {
- notifyCollaborationEvent(event);
- if (event instanceof LifecycleEvent)
- {
- LifecycleEvent e = (LifecycleEvent)event;
- if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
- {
- removeCollaboration(((ICollaboration)e.getSource()).getID());
- }
- }
- }
- }
-
- protected void notifyCollaborationEvent(IEvent event)
- {
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- for (ICollaboration collaboration : getCollaborations())
- {
- collaboration.removeListener(this);
- }
-
- super.doDeactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.ICollaborationContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.SingleDeltaContainerEvent;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.util.lifecycle.LifecycleEvent;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CollaborationContainer extends Lifecycle implements ICollaborationContainer, IListener
+{
+ private Map<Long, ICollaboration> collaborations = new HashMap<Long, ICollaboration>();
+
+ public CollaborationContainer(Collection<ICollaboration> collaborations)
+ {
+ if (collaborations != null)
+ {
+ for (ICollaboration collaboration : collaborations)
+ {
+ this.collaborations.put(collaboration.getID(), collaboration);
+ collaboration.addListener(this);
+ }
+ }
+ }
+
+ public CollaborationContainer()
+ {
+ }
+
+ public void addCollaboration(ICollaboration collaboration)
+ {
+ long id = collaboration.getID();
+ synchronized (collaborations)
+ {
+ if (!collaborations.containsKey(id))
+ {
+ collaborations.put(id, collaboration);
+ }
+ }
+
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<ICollaboration>(this, collaboration, IContainerDelta.Kind.ADDED),
+ listeners);
+ }
+
+ collaboration.addListener(this);
+ }
+
+ public ICollaboration removeCollaboration(long id)
+ {
+ ICollaboration collaboration;
+ synchronized (collaborations)
+ {
+ collaboration = collaborations.remove(id);
+ }
+
+ if (collaboration != null)
+ {
+ collaboration.removeListener(this);
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<ICollaboration>(this, collaboration, IContainerDelta.Kind.REMOVED),
+ listeners);
+ }
+ }
+
+ return collaboration;
+ }
+
+ public ICollaboration[] getCollaborations()
+ {
+ synchronized (collaborations)
+ {
+ return collaborations.values().toArray(new ICollaboration[collaborations.size()]);
+ }
+ }
+
+ public ICollaboration getCollaboration(long id)
+ {
+ synchronized (collaborations)
+ {
+ return collaborations.get(id);
+ }
+ }
+
+ public ICollaboration[] getElements()
+ {
+ return getCollaborations();
+ }
+
+ public boolean isEmpty()
+ {
+ synchronized (collaborations)
+ {
+ return collaborations.isEmpty();
+ }
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ if (event.getSource() instanceof ICollaboration)
+ {
+ notifyCollaborationEvent(event);
+ if (event instanceof LifecycleEvent)
+ {
+ LifecycleEvent e = (LifecycleEvent)event;
+ if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
+ {
+ removeCollaboration(((ICollaboration)e.getSource()).getID());
+ }
+ }
+ }
+ }
+
+ protected void notifyCollaborationEvent(IEvent event)
+ {
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ for (ICollaboration collaboration : getCollaborations())
+ {
+ collaboration.removeListener(this);
+ }
+
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
index 2b1954e7e0..e6315db3a4 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
@@ -1,118 +1,118 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.buddies.common.IMembershipKey;
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
-/**
- * @author Eike Stepper
- */
-public class Membership extends Lifecycle implements IMembership
-{
- private MembershipKey key;
-
- private long startTime;
-
- private transient Object[] elements;
-
- private Membership(IBuddy buddy, ICollaboration collaboration)
- {
- key = new MembershipKey(buddy, collaboration);
- elements = new Object[] { buddy, collaboration };
- startTime = System.currentTimeMillis();
- activate();
- }
-
- public IBuddy getBuddy()
- {
- return key.getBuddy();
- }
-
- public ICollaboration getCollaboration()
- {
- return key.getCollaboration();
- }
-
- public long getStartTime()
- {
- return startTime;
- }
-
- public Object[] getElements()
- {
- return elements;
- }
-
- public boolean isEmpty()
- {
- return false;
- }
-
- public MembershipKey getKey()
- {
- return key;
- }
-
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter)
- {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof IMembershipKey)
- {
- IMembershipKey key = (IMembershipKey)obj;
- return ObjectUtil.equals(getBuddy(), key.getBuddy())
- && ObjectUtil.equals(getCollaboration(), key.getCollaboration());
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return key.hashCode();
- }
-
- @Override
- public String toString()
- {
- return key.toString();
- }
-
- public static IMembership create(IBuddy buddy, ICollaboration collaboration)
- {
- Membership membership = new Membership(buddy, collaboration);
- ((Buddy)buddy).addMembership(membership);
- ((Collaboration)collaboration).addMembership(membership);
- return membership;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.buddies.common.IMembershipKey;
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+
+/**
+ * @author Eike Stepper
+ */
+public class Membership extends Lifecycle implements IMembership
+{
+ private MembershipKey key;
+
+ private long startTime;
+
+ private transient Object[] elements;
+
+ private Membership(IBuddy buddy, ICollaboration collaboration)
+ {
+ key = new MembershipKey(buddy, collaboration);
+ elements = new Object[] { buddy, collaboration };
+ startTime = System.currentTimeMillis();
+ activate();
+ }
+
+ public IBuddy getBuddy()
+ {
+ return key.getBuddy();
+ }
+
+ public ICollaboration getCollaboration()
+ {
+ return key.getCollaboration();
+ }
+
+ public long getStartTime()
+ {
+ return startTime;
+ }
+
+ public Object[] getElements()
+ {
+ return elements;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public MembershipKey getKey()
+ {
+ return key;
+ }
+
+ /**
+ * @see PlatformObject#getAdapter(Class)
+ */
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof IMembershipKey)
+ {
+ IMembershipKey key = (IMembershipKey)obj;
+ return ObjectUtil.equals(getBuddy(), key.getBuddy())
+ && ObjectUtil.equals(getCollaboration(), key.getCollaboration());
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return key.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return key.toString();
+ }
+
+ public static IMembership create(IBuddy buddy, ICollaboration collaboration)
+ {
+ Membership membership = new Membership(buddy, collaboration);
+ ((Buddy)buddy).addMembership(membership);
+ ((Collaboration)collaboration).addMembership(membership);
+ return membership;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java
index 615ade15bf..da520870b6 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java
@@ -1,130 +1,130 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.buddies.common.IMembershipContainer;
-import org.eclipse.net4j.buddies.common.IMembershipKey;
-import org.eclipse.net4j.util.container.IContainerDelta;
-import org.eclipse.net4j.util.container.SingleDeltaContainerEvent;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * @author Eike Stepper
- */
-public class MembershipContainer extends Lifecycle implements IMembershipContainer, IListener
-{
- private ConcurrentMap<IMembershipKey, IMembership> memberships = new ConcurrentHashMap<IMembershipKey, IMembership>();
-
- public MembershipContainer()
- {
- }
-
- public void addMembership(IMembership membership)
- {
- if (memberships.putIfAbsent(membership, membership) == null)
- {
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new SingleDeltaContainerEvent<IMembership>(this, membership, IContainerDelta.Kind.ADDED), listeners);
- }
-
- membership.addListener(this);
- }
- }
-
- public IMembership removeMembership(IBuddy buddy, ICollaboration collaboration)
- {
- return removeMembership(new MembershipKey(buddy, collaboration));
- }
-
- public IMembership removeMembership(IMembershipKey key)
- {
- // for (IMembership membership : memberships.values())
- // {
- //
- // }
- //
- IMembership membership = memberships.remove(key);
- if (membership != null)
- {
- membership.removeListener(this);
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new SingleDeltaContainerEvent<IMembership>(this, membership, IContainerDelta.Kind.REMOVED), listeners);
- }
- }
-
- return membership;
- }
-
- public IMembership[] getMemberships()
- {
- return memberships.values().toArray(new IMembership[memberships.size()]);
- }
-
- public IMembership getMembership(IBuddy buddy, ICollaboration collaboration)
- {
- return memberships.get(new MembershipKey(buddy, collaboration));
- }
-
- public IMembership[] getElements()
- {
- return getMemberships();
- }
-
- public boolean isEmpty()
- {
- return memberships.isEmpty();
- }
-
- public void notifyEvent(IEvent event)
- {
- if (event.getSource() instanceof IMembership)
- {
- IMembership membership = (IMembership)event.getSource();
- notifyMembershipEvent(event);
- if (event instanceof ILifecycleEvent)
- {
- ILifecycleEvent e = (ILifecycleEvent)event;
- if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
- {
- removeMembership(membership);
- }
- }
- }
- }
-
- protected void notifyMembershipEvent(IEvent event)
- {
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- for (IMembership membership : getMemberships())
- {
- membership.removeListener(this);
- }
-
- super.doDeactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.buddies.common.IMembershipContainer;
+import org.eclipse.net4j.buddies.common.IMembershipKey;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.container.SingleDeltaContainerEvent;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * @author Eike Stepper
+ */
+public class MembershipContainer extends Lifecycle implements IMembershipContainer, IListener
+{
+ private ConcurrentMap<IMembershipKey, IMembership> memberships = new ConcurrentHashMap<IMembershipKey, IMembership>();
+
+ public MembershipContainer()
+ {
+ }
+
+ public void addMembership(IMembership membership)
+ {
+ if (memberships.putIfAbsent(membership, membership) == null)
+ {
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<IMembership>(this, membership, IContainerDelta.Kind.ADDED), listeners);
+ }
+
+ membership.addListener(this);
+ }
+ }
+
+ public IMembership removeMembership(IBuddy buddy, ICollaboration collaboration)
+ {
+ return removeMembership(new MembershipKey(buddy, collaboration));
+ }
+
+ public IMembership removeMembership(IMembershipKey key)
+ {
+ // for (IMembership membership : memberships.values())
+ // {
+ //
+ // }
+ //
+ IMembership membership = memberships.remove(key);
+ if (membership != null)
+ {
+ membership.removeListener(this);
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<IMembership>(this, membership, IContainerDelta.Kind.REMOVED), listeners);
+ }
+ }
+
+ return membership;
+ }
+
+ public IMembership[] getMemberships()
+ {
+ return memberships.values().toArray(new IMembership[memberships.size()]);
+ }
+
+ public IMembership getMembership(IBuddy buddy, ICollaboration collaboration)
+ {
+ return memberships.get(new MembershipKey(buddy, collaboration));
+ }
+
+ public IMembership[] getElements()
+ {
+ return getMemberships();
+ }
+
+ public boolean isEmpty()
+ {
+ return memberships.isEmpty();
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ if (event.getSource() instanceof IMembership)
+ {
+ IMembership membership = (IMembership)event.getSource();
+ notifyMembershipEvent(event);
+ if (event instanceof ILifecycleEvent)
+ {
+ ILifecycleEvent e = (ILifecycleEvent)event;
+ if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
+ {
+ removeMembership(membership);
+ }
+ }
+ }
+ }
+
+ protected void notifyMembershipEvent(IEvent event)
+ {
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ for (IMembership membership : getMemberships())
+ {
+ membership.removeListener(this);
+ }
+
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipKey.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipKey.java
index 21ff4deaf9..eb2119f2d8 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipKey.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipKey.java
@@ -1,72 +1,72 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IMembershipKey;
-import org.eclipse.net4j.util.ObjectUtil;
-
-/**
- * @author Eike Stepper
- */
-public class MembershipKey implements IMembershipKey
-{
- private IBuddy buddy;
-
- private ICollaboration collaboration;
-
- public MembershipKey(IBuddy buddy, ICollaboration collaboration)
- {
- this.buddy = buddy;
- this.collaboration = collaboration;
- }
-
- public IBuddy getBuddy()
- {
- return buddy;
- }
-
- public ICollaboration getCollaboration()
- {
- return collaboration;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof IMembershipKey)
- {
- IMembershipKey key = (IMembershipKey)obj;
- return ObjectUtil.equals(getBuddy(), key.getBuddy())
- && ObjectUtil.equals(getCollaboration(), key.getCollaboration());
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return ObjectUtil.hashCode(buddy) ^ ObjectUtil.hashCode(collaboration);
- }
-
- @Override
- public String toString()
- {
- return buddy + "(" + collaboration + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IMembershipKey;
+import org.eclipse.net4j.util.ObjectUtil;
+
+/**
+ * @author Eike Stepper
+ */
+public class MembershipKey implements IMembershipKey
+{
+ private IBuddy buddy;
+
+ private ICollaboration collaboration;
+
+ public MembershipKey(IBuddy buddy, ICollaboration collaboration)
+ {
+ this.buddy = buddy;
+ this.collaboration = collaboration;
+ }
+
+ public IBuddy getBuddy()
+ {
+ return buddy;
+ }
+
+ public ICollaboration getCollaboration()
+ {
+ return collaboration;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof IMembershipKey)
+ {
+ IMembershipKey key = (IMembershipKey)obj;
+ return ObjectUtil.equals(getBuddy(), key.getBuddy())
+ && ObjectUtil.equals(getCollaboration(), key.getCollaboration());
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ObjectUtil.hashCode(buddy) ^ ObjectUtil.hashCode(collaboration);
+ }
+
+ @Override
+ public String toString()
+ {
+ return buddy + "(" + collaboration + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MessageEvent.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MessageEvent.java
index e1f1fa39eb..7828824234 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MessageEvent.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MessageEvent.java
@@ -1,37 +1,37 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common;
-
-import org.eclipse.net4j.buddies.common.IMessage;
-import org.eclipse.net4j.buddies.common.IMessageEvent;
-import org.eclipse.net4j.util.event.Event;
-import org.eclipse.net4j.util.event.INotifier;
-
-/**
- * @author Eike Stepper
- */
-public final class MessageEvent extends Event implements IMessageEvent
-{
- private static final long serialVersionUID = 1L;
-
- private IMessage message;
-
- public MessageEvent(INotifier notifier, IMessage message)
- {
- super(notifier);
- this.message = message;
- }
-
- public IMessage getMessage()
- {
- return message;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common;
+
+import org.eclipse.net4j.buddies.common.IMessage;
+import org.eclipse.net4j.buddies.common.IMessageEvent;
+import org.eclipse.net4j.util.event.Event;
+import org.eclipse.net4j.util.event.INotifier;
+
+/**
+ * @author Eike Stepper
+ */
+public final class MessageEvent extends Event implements IMessageEvent
+{
+ private static final long serialVersionUID = 1L;
+
+ private IMessage message;
+
+ public MessageEvent(INotifier notifier, IMessage message)
+ {
+ super(notifier);
+ this.message = message;
+ }
+
+ public IMessage getMessage()
+ {
+ return message;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/bundle/OM.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/bundle/OM.java
index dfcd3c4751..148e5e94fc 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/bundle/OM.java
@@ -1,50 +1,50 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.bundle;
-
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OSGiActivator;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.net4j.buddies.common"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_PROTOCOL = DEBUG.tracer("protocol"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_MODEL = DEBUG.tracer("model"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_REVISION = DEBUG.tracer("revision"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.net4j.buddies.common"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_PROTOCOL = DEBUG.tracer("protocol"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_MODEL = DEBUG.tracer("model"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_REVISION = DEBUG.tracer("revision"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateIndication.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateIndication.java
index b97d2ac1ee..b1fc427a94 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateIndication.java
@@ -1,37 +1,37 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.protocol;
-
-import org.eclipse.net4j.buddies.common.IBuddy.State;
-import org.eclipse.net4j.signal.Indication;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-
-/**
- * @author Eike Stepper
- */
-public abstract class BuddyStateIndication extends Indication
-{
- public BuddyStateIndication(SignalProtocol<?> protocol)
- {
- super(protocol, ProtocolConstants.SIGNAL_BUDDY_STATE);
- }
-
- @Override
- protected void indicating(ExtendedDataInputStream in) throws Exception
- {
- String userID = in.readString();
- State state = ProtocolUtil.readState(in);
- stateChanged(userID, state);
- }
-
- protected abstract void stateChanged(String userID, State state);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.protocol;
+
+import org.eclipse.net4j.buddies.common.IBuddy.State;
+import org.eclipse.net4j.signal.Indication;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class BuddyStateIndication extends Indication
+{
+ public BuddyStateIndication(SignalProtocol<?> protocol)
+ {
+ super(protocol, ProtocolConstants.SIGNAL_BUDDY_STATE);
+ }
+
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws Exception
+ {
+ String userID = in.readString();
+ State state = ProtocolUtil.readState(in);
+ stateChanged(userID, state);
+ }
+
+ protected abstract void stateChanged(String userID, State state);
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java
index d641e32f47..a9c6f85e74 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/BuddyStateNotification.java
@@ -1,40 +1,40 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.protocol;
-
-import org.eclipse.net4j.buddies.common.IBuddy.State;
-import org.eclipse.net4j.signal.Request;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-
-/**
- * @author Eike Stepper
- */
-public class BuddyStateNotification extends Request
-{
- private String userID;
-
- private State state;
-
- public BuddyStateNotification(SignalProtocol<?> protocol, String userID, State state)
- {
- super(protocol, ProtocolConstants.SIGNAL_BUDDY_STATE);
- this.userID = userID;
- this.state = state;
- }
-
- @Override
- protected void requesting(ExtendedDataOutputStream out) throws Exception
- {
- out.writeString(userID);
- ProtocolUtil.writeState(out, state);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.protocol;
+
+import org.eclipse.net4j.buddies.common.IBuddy.State;
+import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuddyStateNotification extends Request
+{
+ private String userID;
+
+ private State state;
+
+ public BuddyStateNotification(SignalProtocol<?> protocol, String userID, State state)
+ {
+ super(protocol, ProtocolConstants.SIGNAL_BUDDY_STATE);
+ this.userID = userID;
+ this.state = state;
+ }
+
+ @Override
+ protected void requesting(ExtendedDataOutputStream out) throws Exception
+ {
+ out.writeString(userID);
+ ProtocolUtil.writeState(out, state);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftIndication.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftIndication.java
index d16d6ca202..0e6a32d83c 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftIndication.java
@@ -1,70 +1,70 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.protocol;
-
-import org.eclipse.net4j.buddies.common.IBuddyProvider;
-import org.eclipse.net4j.buddies.common.ICollaborationProvider;
-import org.eclipse.net4j.buddies.internal.common.Buddy;
-import org.eclipse.net4j.buddies.internal.common.Collaboration;
-import org.eclipse.net4j.signal.Indication;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-
-/**
- * @author Eike Stepper
- */
-public class CollaborationLeftIndication extends Indication
-{
- private IBuddyProvider buddyProvider;
-
- private ICollaborationProvider collaborationProvider;
-
- public CollaborationLeftIndication(SignalProtocol<?> protocol, IBuddyProvider buddyProvider,
- ICollaborationProvider collaborationProvider)
- {
- super(protocol, ProtocolConstants.SIGNAL_COLLABORATION_LEFT);
- this.buddyProvider = buddyProvider;
- this.collaborationProvider = collaborationProvider;
- }
-
- @Override
- protected void indicating(ExtendedDataInputStream in) throws Exception
- {
- long collaborationID = in.readLong();
- String userID = in.readString();
-
- Collaboration collaboration = getCollaboration(collaborationID);
- if (collaboration != null)
- {
- Buddy buddy = getBuddy(userID);
- if (buddy != null)
- {
- collaborationLeft(buddy, collaboration);
- }
- }
- }
-
- protected void collaborationLeft(Buddy buddy, Collaboration collaboration)
- {
- collaboration.removeMembership(buddy);
- buddy.removeMembership(collaboration);
- }
-
- protected Collaboration getCollaboration(long collaborationID)
- {
- return (Collaboration)collaborationProvider.getCollaboration(collaborationID);
- }
-
- protected Buddy getBuddy(String userID)
- {
- return (Buddy)buddyProvider.getBuddy(userID);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.protocol;
+
+import org.eclipse.net4j.buddies.common.IBuddyProvider;
+import org.eclipse.net4j.buddies.common.ICollaborationProvider;
+import org.eclipse.net4j.buddies.internal.common.Buddy;
+import org.eclipse.net4j.buddies.internal.common.Collaboration;
+import org.eclipse.net4j.signal.Indication;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public class CollaborationLeftIndication extends Indication
+{
+ private IBuddyProvider buddyProvider;
+
+ private ICollaborationProvider collaborationProvider;
+
+ public CollaborationLeftIndication(SignalProtocol<?> protocol, IBuddyProvider buddyProvider,
+ ICollaborationProvider collaborationProvider)
+ {
+ super(protocol, ProtocolConstants.SIGNAL_COLLABORATION_LEFT);
+ this.buddyProvider = buddyProvider;
+ this.collaborationProvider = collaborationProvider;
+ }
+
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws Exception
+ {
+ long collaborationID = in.readLong();
+ String userID = in.readString();
+
+ Collaboration collaboration = getCollaboration(collaborationID);
+ if (collaboration != null)
+ {
+ Buddy buddy = getBuddy(userID);
+ if (buddy != null)
+ {
+ collaborationLeft(buddy, collaboration);
+ }
+ }
+ }
+
+ protected void collaborationLeft(Buddy buddy, Collaboration collaboration)
+ {
+ collaboration.removeMembership(buddy);
+ buddy.removeMembership(collaboration);
+ }
+
+ protected Collaboration getCollaboration(long collaborationID)
+ {
+ return (Collaboration)collaborationProvider.getCollaboration(collaborationID);
+ }
+
+ protected Buddy getBuddy(String userID)
+ {
+ return (Buddy)buddyProvider.getBuddy(userID);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java
index cfbf01f4ef..4415b7a8e3 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/CollaborationLeftNotification.java
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.protocol;
-
-import org.eclipse.net4j.signal.Request;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-
-/**
- * @author Eike Stepper
- */
-public class CollaborationLeftNotification extends Request
-{
- private long collaborationID;
-
- private String userID;
-
- public CollaborationLeftNotification(SignalProtocol<?> protocol, long collaborationID, String userID)
- {
- super(protocol, ProtocolConstants.SIGNAL_COLLABORATION_LEFT);
- this.collaborationID = collaborationID;
- this.userID = userID;
- }
-
- @Override
- protected void requesting(ExtendedDataOutputStream out) throws Exception
- {
- out.writeLong(collaborationID);
- out.writeString(userID);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.protocol;
+
+import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public class CollaborationLeftNotification extends Request
+{
+ private long collaborationID;
+
+ private String userID;
+
+ public CollaborationLeftNotification(SignalProtocol<?> protocol, long collaborationID, String userID)
+ {
+ super(protocol, ProtocolConstants.SIGNAL_COLLABORATION_LEFT);
+ this.collaborationID = collaborationID;
+ this.userID = userID;
+ }
+
+ @Override
+ protected void requesting(ExtendedDataOutputStream out) throws Exception
+ {
+ out.writeLong(collaborationID);
+ out.writeString(userID);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageIndication.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageIndication.java
index 8d06c60263..e968f371fa 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageIndication.java
@@ -1,57 +1,57 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.protocol;
-
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.ICollaborationProvider;
-import org.eclipse.net4j.buddies.common.IMessage;
-import org.eclipse.net4j.buddies.spi.common.Facility;
-import org.eclipse.net4j.signal.Indication;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-
-/**
- * @author Eike Stepper
- */
-public class MessageIndication extends Indication
-{
- private ICollaborationProvider collaborationProvider;
-
- public MessageIndication(SignalProtocol<?> protocol, ICollaborationProvider collaborationProvider)
- {
- super(protocol, ProtocolConstants.SIGNAL_MESSAGE);
- this.collaborationProvider = collaborationProvider;
- }
-
- @Override
- protected void indicating(ExtendedDataInputStream in) throws Exception
- {
- long collaborationID = in.readLong();
- String facilityType = in.readString();
- Facility facility = getFacility(collaborationID, facilityType);
- if (facility != null)
- {
- IMessage message = ProtocolUtil.readMessage(in, facility.getClass().getClassLoader());
- facility.handleMessage(message);
- }
- }
-
- private Facility getFacility(long collaborationID, String facilityType)
- {
- ICollaboration collaboration = collaborationProvider.getCollaboration(collaborationID);
- if (collaboration == null)
- {
- return null;
- }
-
- return (Facility)collaboration.getFacility(facilityType);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.protocol;
+
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.ICollaborationProvider;
+import org.eclipse.net4j.buddies.common.IMessage;
+import org.eclipse.net4j.buddies.spi.common.Facility;
+import org.eclipse.net4j.signal.Indication;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public class MessageIndication extends Indication
+{
+ private ICollaborationProvider collaborationProvider;
+
+ public MessageIndication(SignalProtocol<?> protocol, ICollaborationProvider collaborationProvider)
+ {
+ super(protocol, ProtocolConstants.SIGNAL_MESSAGE);
+ this.collaborationProvider = collaborationProvider;
+ }
+
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws Exception
+ {
+ long collaborationID = in.readLong();
+ String facilityType = in.readString();
+ Facility facility = getFacility(collaborationID, facilityType);
+ if (facility != null)
+ {
+ IMessage message = ProtocolUtil.readMessage(in, facility.getClass().getClassLoader());
+ facility.handleMessage(message);
+ }
+ }
+
+ private Facility getFacility(long collaborationID, String facilityType)
+ {
+ ICollaboration collaboration = collaborationProvider.getCollaboration(collaborationID);
+ if (collaboration == null)
+ {
+ return null;
+ }
+
+ return (Facility)collaboration.getFacility(facilityType);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java
index 7b6739cdcc..19aa61a095 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/MessageNotification.java
@@ -1,44 +1,44 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.protocol;
-
-import org.eclipse.net4j.buddies.common.IMessage;
-import org.eclipse.net4j.signal.Request;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-
-/**
- * @author Eike Stepper
- */
-public class MessageNotification extends Request
-{
- private long collaborationID;
-
- private String facilityType;
-
- private IMessage message;
-
- public MessageNotification(SignalProtocol<?> protocol, long collaborationID, String facilityType, IMessage message)
- {
- super(protocol, ProtocolConstants.SIGNAL_MESSAGE);
- this.collaborationID = collaborationID;
- this.facilityType = facilityType;
- this.message = message;
- }
-
- @Override
- protected void requesting(ExtendedDataOutputStream out) throws Exception
- {
- out.writeLong(collaborationID);
- out.writeString(facilityType);
- ProtocolUtil.writeMessage(out, message);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.protocol;
+
+import org.eclipse.net4j.buddies.common.IMessage;
+import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public class MessageNotification extends Request
+{
+ private long collaborationID;
+
+ private String facilityType;
+
+ private IMessage message;
+
+ public MessageNotification(SignalProtocol<?> protocol, long collaborationID, String facilityType, IMessage message)
+ {
+ super(protocol, ProtocolConstants.SIGNAL_MESSAGE);
+ this.collaborationID = collaborationID;
+ this.facilityType = facilityType;
+ this.message = message;
+ }
+
+ @Override
+ protected void requesting(ExtendedDataOutputStream out) throws Exception
+ {
+ out.writeLong(collaborationID);
+ out.writeString(facilityType);
+ ProtocolUtil.writeMessage(out, message);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolConstants.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolConstants.java
index ade2ef4d78..8b1827f4d6 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolConstants.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolConstants.java
@@ -1,55 +1,55 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.protocol;
-
-/**
- * @author Eike Stepper
- */
-public interface ProtocolConstants
-{
- public static final String PROTOCOL_NAME = "buddies"; //$NON-NLS-1$
-
- public static final short SIGNAL_OPEN_SESSION = 1;
-
- public static final short SIGNAL_LOAD_ACCOUNT = 2;
-
- public static final short SIGNAL_BUDDY_ADDED = 3;
-
- public static final short SIGNAL_BUDDY_REMOVED = 4;
-
- public static final short SIGNAL_BUDDY_STATE = 5;
-
- public static final short SIGNAL_INITIATE_COLLABORATION = 6;
-
- public static final short SIGNAL_COLLABORATION_INITIATED = 7;
-
- public static final short SIGNAL_COLLABORATION_LEFT = 8;
-
- public static final short SIGNAL_INVITE_BUDDIES = 9;
-
- public static final short SIGNAL_BUDDIES_INVITED = 10;
-
- public static final short SIGNAL_INSTALL_FACILITY = 11;
-
- public static final short SIGNAL_FACILITY_INSTALLED = 12;
-
- public static final short SIGNAL_MESSAGE = 13;
-
- public static final long TIMEOUT = 5000L;
-
- public static final byte STATE_AVAILABLE = 1;
-
- public static final byte STATE_LONESOME = 2;
-
- public static final byte STATE_AWAY = 3;
-
- public static final byte STATE_DO_NOT_DISTURB = 4;
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.protocol;
+
+/**
+ * @author Eike Stepper
+ */
+public interface ProtocolConstants
+{
+ public static final String PROTOCOL_NAME = "buddies"; //$NON-NLS-1$
+
+ public static final short SIGNAL_OPEN_SESSION = 1;
+
+ public static final short SIGNAL_LOAD_ACCOUNT = 2;
+
+ public static final short SIGNAL_BUDDY_ADDED = 3;
+
+ public static final short SIGNAL_BUDDY_REMOVED = 4;
+
+ public static final short SIGNAL_BUDDY_STATE = 5;
+
+ public static final short SIGNAL_INITIATE_COLLABORATION = 6;
+
+ public static final short SIGNAL_COLLABORATION_INITIATED = 7;
+
+ public static final short SIGNAL_COLLABORATION_LEFT = 8;
+
+ public static final short SIGNAL_INVITE_BUDDIES = 9;
+
+ public static final short SIGNAL_BUDDIES_INVITED = 10;
+
+ public static final short SIGNAL_INSTALL_FACILITY = 11;
+
+ public static final short SIGNAL_FACILITY_INSTALLED = 12;
+
+ public static final short SIGNAL_MESSAGE = 13;
+
+ public static final long TIMEOUT = 5000L;
+
+ public static final byte STATE_AVAILABLE = 1;
+
+ public static final byte STATE_LONESOME = 2;
+
+ public static final byte STATE_AWAY = 3;
+
+ public static final byte STATE_DO_NOT_DISTURB = 4;
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolUtil.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolUtil.java
index 7fcc66bfb5..61b875f995 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolUtil.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/protocol/ProtocolUtil.java
@@ -1,226 +1,226 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.common.protocol;
-
-import org.eclipse.net4j.buddies.common.IAccount;
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.IBuddyContainer;
-import org.eclipse.net4j.buddies.common.IMessage;
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public final class ProtocolUtil
-{
- private ProtocolUtil()
- {
- }
-
- public static void writeBuddies(ExtendedDataOutputStream out, Collection<IBuddy> buddies) throws IOException
- {
- if (buddies == null)
- {
- out.writeInt(0);
- }
- else
- {
- out.writeInt(buddies.size());
- for (IBuddy buddy : buddies)
- {
- out.writeString(buddy.getUserID());
- }
- }
- }
-
- public static Set<IBuddy> readBuddies(ExtendedDataInputStream in, IBuddyContainer buddyContainer) throws IOException
- {
- int size = in.readInt();
- Set<IBuddy> buddies = new HashSet<IBuddy>();
- for (int i = 0; i < size; i++)
- {
- String userID = in.readString();
- IBuddy buddy = buddyContainer.getBuddy(userID);
- if (buddy != null)
- {
- buddies.add(buddy);
- }
- }
-
- return buddies;
- }
-
- public static String[] readUserIDs(ExtendedDataInputStream in) throws IOException
- {
- int size = in.readInt();
- String[] userIDs = new String[size];
- for (int i = 0; i < size; i++)
- {
- userIDs[i] = in.readString();
- }
-
- return userIDs;
- }
-
- public static void writeAccount(ExtendedDataOutputStream out, IAccount account) throws IOException
- {
- if (account != null)
- {
- out.writeBoolean(true);
- ObjectOutputStream oos = new ObjectOutputStream(out);
- oos.writeObject(account);
- }
- else
- {
- out.writeBoolean(false);
- }
- }
-
- public static IAccount readAccount(ExtendedDataInputStream in) throws IOException
- {
- boolean exists = in.readBoolean();
- if (!exists)
- {
- return null;
- }
-
- try
- {
- ObjectInputStream ois = new ObjectInputStream(in);
- return (IAccount)ois.readObject();
- }
- catch (IOException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- public static void writeState(ExtendedDataOutputStream out, IBuddy.State state) throws IOException
- {
- switch (state)
- {
- case AVAILABLE:
- out.writeByte(ProtocolConstants.STATE_AVAILABLE);
- break;
-
- case LONESOME:
- out.writeByte(ProtocolConstants.STATE_LONESOME);
- break;
-
- case AWAY:
- out.writeByte(ProtocolConstants.STATE_AWAY);
- break;
-
- case DO_NOT_DISTURB:
- out.writeByte(ProtocolConstants.STATE_DO_NOT_DISTURB);
- break;
-
- default:
- throw new IllegalArgumentException("Illegal state: " + state); //$NON-NLS-1$
- }
- }
-
- public static IBuddy.State readState(ExtendedDataInputStream in) throws IOException
- {
- byte state = in.readByte();
- switch (state)
- {
- case ProtocolConstants.STATE_AVAILABLE:
- return IBuddy.State.AVAILABLE;
-
- case ProtocolConstants.STATE_LONESOME:
- return IBuddy.State.LONESOME;
-
- case ProtocolConstants.STATE_AWAY:
- return IBuddy.State.AWAY;
-
- case ProtocolConstants.STATE_DO_NOT_DISTURB:
- return IBuddy.State.DO_NOT_DISTURB;
-
- default:
- throw new IllegalArgumentException("Illegal state: " + state); //$NON-NLS-1$
- }
- }
-
- public static void writeFacilityTypes(ExtendedDataOutputStream out, String[] facilityTypes) throws IOException
- {
- if (facilityTypes == null)
- {
- out.writeInt(0);
- }
- else
- {
- out.writeInt(facilityTypes.length);
- for (String facilityType : facilityTypes)
- {
- out.writeString(facilityType);
- }
- }
- }
-
- public static String[] readFacilityTypes(ExtendedDataInputStream in) throws IOException
- {
- int size = in.readInt();
- String[] facilityTypes = new String[size];
- for (int i = 0; i < size; i++)
- {
- facilityTypes[i] = in.readString();
- }
-
- return facilityTypes;
- }
-
- public static void writeMessage(ExtendedDataOutputStream out, IMessage message) throws IOException
- {
- ObjectOutputStream oos = new ObjectOutputStream(out);
- oos.writeObject(message);
- }
-
- public static IMessage readMessage(ExtendedDataInputStream in, final ClassLoader classLoader) throws IOException
- {
- try
- {
- ObjectInputStream ois = new ObjectInputStream(in)
- {
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException
- {
- String className = desc.getName();
- return classLoader.loadClass(className);
- }
- };
-
- return (IMessage)ois.readObject();
- }
- catch (IOException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.common.protocol;
+
+import org.eclipse.net4j.buddies.common.IAccount;
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.IBuddyContainer;
+import org.eclipse.net4j.buddies.common.IMessage;
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ProtocolUtil
+{
+ private ProtocolUtil()
+ {
+ }
+
+ public static void writeBuddies(ExtendedDataOutputStream out, Collection<IBuddy> buddies) throws IOException
+ {
+ if (buddies == null)
+ {
+ out.writeInt(0);
+ }
+ else
+ {
+ out.writeInt(buddies.size());
+ for (IBuddy buddy : buddies)
+ {
+ out.writeString(buddy.getUserID());
+ }
+ }
+ }
+
+ public static Set<IBuddy> readBuddies(ExtendedDataInputStream in, IBuddyContainer buddyContainer) throws IOException
+ {
+ int size = in.readInt();
+ Set<IBuddy> buddies = new HashSet<IBuddy>();
+ for (int i = 0; i < size; i++)
+ {
+ String userID = in.readString();
+ IBuddy buddy = buddyContainer.getBuddy(userID);
+ if (buddy != null)
+ {
+ buddies.add(buddy);
+ }
+ }
+
+ return buddies;
+ }
+
+ public static String[] readUserIDs(ExtendedDataInputStream in) throws IOException
+ {
+ int size = in.readInt();
+ String[] userIDs = new String[size];
+ for (int i = 0; i < size; i++)
+ {
+ userIDs[i] = in.readString();
+ }
+
+ return userIDs;
+ }
+
+ public static void writeAccount(ExtendedDataOutputStream out, IAccount account) throws IOException
+ {
+ if (account != null)
+ {
+ out.writeBoolean(true);
+ ObjectOutputStream oos = new ObjectOutputStream(out);
+ oos.writeObject(account);
+ }
+ else
+ {
+ out.writeBoolean(false);
+ }
+ }
+
+ public static IAccount readAccount(ExtendedDataInputStream in) throws IOException
+ {
+ boolean exists = in.readBoolean();
+ if (!exists)
+ {
+ return null;
+ }
+
+ try
+ {
+ ObjectInputStream ois = new ObjectInputStream(in);
+ return (IAccount)ois.readObject();
+ }
+ catch (IOException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ public static void writeState(ExtendedDataOutputStream out, IBuddy.State state) throws IOException
+ {
+ switch (state)
+ {
+ case AVAILABLE:
+ out.writeByte(ProtocolConstants.STATE_AVAILABLE);
+ break;
+
+ case LONESOME:
+ out.writeByte(ProtocolConstants.STATE_LONESOME);
+ break;
+
+ case AWAY:
+ out.writeByte(ProtocolConstants.STATE_AWAY);
+ break;
+
+ case DO_NOT_DISTURB:
+ out.writeByte(ProtocolConstants.STATE_DO_NOT_DISTURB);
+ break;
+
+ default:
+ throw new IllegalArgumentException("Illegal state: " + state); //$NON-NLS-1$
+ }
+ }
+
+ public static IBuddy.State readState(ExtendedDataInputStream in) throws IOException
+ {
+ byte state = in.readByte();
+ switch (state)
+ {
+ case ProtocolConstants.STATE_AVAILABLE:
+ return IBuddy.State.AVAILABLE;
+
+ case ProtocolConstants.STATE_LONESOME:
+ return IBuddy.State.LONESOME;
+
+ case ProtocolConstants.STATE_AWAY:
+ return IBuddy.State.AWAY;
+
+ case ProtocolConstants.STATE_DO_NOT_DISTURB:
+ return IBuddy.State.DO_NOT_DISTURB;
+
+ default:
+ throw new IllegalArgumentException("Illegal state: " + state); //$NON-NLS-1$
+ }
+ }
+
+ public static void writeFacilityTypes(ExtendedDataOutputStream out, String[] facilityTypes) throws IOException
+ {
+ if (facilityTypes == null)
+ {
+ out.writeInt(0);
+ }
+ else
+ {
+ out.writeInt(facilityTypes.length);
+ for (String facilityType : facilityTypes)
+ {
+ out.writeString(facilityType);
+ }
+ }
+ }
+
+ public static String[] readFacilityTypes(ExtendedDataInputStream in) throws IOException
+ {
+ int size = in.readInt();
+ String[] facilityTypes = new String[size];
+ for (int i = 0; i < size; i++)
+ {
+ facilityTypes[i] = in.readString();
+ }
+
+ return facilityTypes;
+ }
+
+ public static void writeMessage(ExtendedDataOutputStream out, IMessage message) throws IOException
+ {
+ ObjectOutputStream oos = new ObjectOutputStream(out);
+ oos.writeObject(message);
+ }
+
+ public static IMessage readMessage(ExtendedDataInputStream in, final ClassLoader classLoader) throws IOException
+ {
+ try
+ {
+ ObjectInputStream ois = new ObjectInputStream(in)
+ {
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException
+ {
+ String className = desc.getName();
+ return classLoader.loadClass(className);
+ }
+ };
+
+ return (IMessage)ois.readObject();
+ }
+ catch (IOException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ClientFacilityFactory.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ClientFacilityFactory.java
index 7bdc045c5a..88343a122e 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ClientFacilityFactory.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ClientFacilityFactory.java
@@ -1,26 +1,26 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.spi.common;
-
-import org.eclipse.net4j.util.factory.Factory;
-
-/**
- * @author Eike Stepper
- */
-public abstract class ClientFacilityFactory extends Factory
-{
- public static final String PRODUCT_GROUP = "org.eclipse.net4j.buddies.clientFacilities"; //$NON-NLS-1$
-
- public ClientFacilityFactory(String type)
- {
- super(PRODUCT_GROUP, type);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.spi.common;
+
+import org.eclipse.net4j.util.factory.Factory;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ClientFacilityFactory extends Factory
+{
+ public static final String PRODUCT_GROUP = "org.eclipse.net4j.buddies.clientFacilities"; //$NON-NLS-1$
+
+ public ClientFacilityFactory(String type)
+ {
+ super(PRODUCT_GROUP, type);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
index d6e3bf9e97..09b3f540b1 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
@@ -1,66 +1,66 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.spi.common;
-
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IFacility;
-import org.eclipse.net4j.buddies.common.IMessage;
-import org.eclipse.net4j.buddies.internal.common.Collaboration;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
-/**
- * @author Eike Stepper
- */
-public abstract class Facility extends Lifecycle implements IFacility
-{
- private String type;
-
- private Collaboration collaboration;
-
- public Facility(String type)
- {
- this.type = type;
- }
-
- public String getType()
- {
- return type;
- }
-
- public Collaboration getCollaboration()
- {
- return collaboration;
- }
-
- public void setCollaboration(ICollaboration collaboration)
- {
- this.collaboration = (Collaboration)collaboration;
- }
-
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter)
- {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- public void sendMessage(IMessage message)
- {
- collaboration.sendMessage(collaboration.getID(), type, message);
- }
-
- public abstract void handleMessage(IMessage message);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.spi.common;
+
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IFacility;
+import org.eclipse.net4j.buddies.common.IMessage;
+import org.eclipse.net4j.buddies.internal.common.Collaboration;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class Facility extends Lifecycle implements IFacility
+{
+ private String type;
+
+ private Collaboration collaboration;
+
+ public Facility(String type)
+ {
+ this.type = type;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public Collaboration getCollaboration()
+ {
+ return collaboration;
+ }
+
+ public void setCollaboration(ICollaboration collaboration)
+ {
+ this.collaboration = (Collaboration)collaboration;
+ }
+
+ /**
+ * @see PlatformObject#getAdapter(Class)
+ */
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class adapter)
+ {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
+
+ public void sendMessage(IMessage message)
+ {
+ collaboration.sendMessage(collaboration.getID(), type, message);
+ }
+
+ public abstract void handleMessage(IMessage message);
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Message.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Message.java
index 701f99dff6..27fa2dd76c 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Message.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Message.java
@@ -1,52 +1,52 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.spi.common;
-
-import org.eclipse.net4j.buddies.common.IMessage;
-import org.eclipse.net4j.util.StringUtil;
-
-import org.eclipse.core.runtime.PlatformObject;
-
-import java.io.Serializable;
-
-/**
- * @author Eike Stepper
- */
-public abstract class Message extends PlatformObject implements IMessage, Serializable
-{
- private static final long serialVersionUID = 1L;
-
- private String senderID;
-
- protected Message()
- {
- }
-
- public String getSenderID()
- {
- return senderID;
- }
-
- public void setSenderID(String senderID)
- {
- this.senderID = senderID;
- }
-
- protected String encode(String text)
- {
- return text.replaceAll(StringUtil.NL, "\n"); //$NON-NLS-1$
- }
-
- protected String decode(String text)
- {
- return text.replaceAll("\n", StringUtil.NL); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.spi.common;
+
+import org.eclipse.net4j.buddies.common.IMessage;
+import org.eclipse.net4j.util.StringUtil;
+
+import org.eclipse.core.runtime.PlatformObject;
+
+import java.io.Serializable;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class Message extends PlatformObject implements IMessage, Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String senderID;
+
+ protected Message()
+ {
+ }
+
+ public String getSenderID()
+ {
+ return senderID;
+ }
+
+ public void setSenderID(String senderID)
+ {
+ this.senderID = senderID;
+ }
+
+ protected String encode(String text)
+ {
+ return text.replaceAll(StringUtil.NL, "\n"); //$NON-NLS-1$
+ }
+
+ protected String decode(String text)
+ {
+ return text.replaceAll("\n", StringUtil.NL); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ServerFacilityFactory.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ServerFacilityFactory.java
index feacd32365..e98fbedf91 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ServerFacilityFactory.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/ServerFacilityFactory.java
@@ -1,26 +1,26 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.spi.common;
-
-import org.eclipse.net4j.util.factory.Factory;
-
-/**
- * @author Eike Stepper
- */
-public abstract class ServerFacilityFactory extends Factory
-{
- public static final String PRODUCT_GROUP = "org.eclipse.net4j.buddies.serverFacilities"; //$NON-NLS-1$
-
- public ServerFacilityFactory(String type)
- {
- super(PRODUCT_GROUP, type);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.spi.common;
+
+import org.eclipse.net4j.util.factory.Factory;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ServerFacilityFactory extends Factory
+{
+ public static final String PRODUCT_GROUP = "org.eclipse.net4j.buddies.serverFacilities"; //$NON-NLS-1$
+
+ public ServerFacilityFactory(String type)
+ {
+ super(PRODUCT_GROUP, type);
+ }
+}

Back to the top