Author: bdaw
Date: 2008-06-23 10:45:48 -0400 (Mon, 23 Jun 2008)
New Revision: 11113
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/EventCoordinationManager.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/EventWiringInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/IllegalCoordinationException.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ParameterBindingInfo.java
Log:
Interfaces for explicit event wiring and shared parameters binding
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/EventCoordinationManager.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/EventCoordinationManager.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/EventCoordinationManager.java 2008-06-23
14:45:48 UTC (rev 11113)
@@ -0,0 +1,235 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.core.controller.portlet;
+
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PageContainer;
+import org.jboss.portal.portlet.controller.event.Event;
+
+import javax.xml.namespace.QName;
+import java.util.Set;
+import java.util.Collection;
+
+/**
+ * Interface defining operations for explicit event wiring management
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface EventCoordinationManager
+{
+
+ public enum ImplicitStrategy
+ {
+ // Explicit wiring takes precedence
+ FALLBACK,
+
+ // Only implicit wiring enabled
+ EXCLUSIVE,
+
+ // Implicit wiring disabled
+ DISABLED,
+
+ // Inherited by children nodes in the tree
+ RECURSIVE_FALLBACK,
+
+ // .
+ RECURSIVE_EXCLUSIVE,
+
+ // .
+ RECURSIVE_DISABLED
+
+ }
+
+ public
+
+
+ // Event Discovery
+
+ /**
+ * @param event
+ * @return all windows that given event should be delivered to with current wirings
and configuration
+ */
+ Collection<Window> getEventWindows(Event event);
+
+ // Management
+
+ /**
+ * Defines a wiring for a given even QName between multiply source and destination
windows
+ *
+ * @param sources
+ * @param targets
+ * @param eventQName
+ * @throws IllegalCoordinationException
+ */
+ void setEventWiring(Set<Window> sources, Set<Window> targets, QName
eventQName) throws IllegalCoordinationException;
+
+ /**
+ * Remove wiring
+ *
+ * @param eventWiringInfo
+ * @throws IllegalCoordinationException
+ */
+ void removeEventWiring(EventWiringInfo eventWiringInfo) throws
IllegalCoordinationException;
+
+ /**
+ * Defines a wiring between qnames at the page level. Event with given qname will be
delivered
+ * to all windows being destination of destination qnames. All qnames need to be
compatible - have no or the same
+ * payload - otherwise IllegalCoordinationException will be thrown.
+ * This method overrites any previous wiring for this qname in the page. Empty
destinations collection removes the
+ * wiring.
+ *
+ * @param source
+ * @param destinations
+ * @param page
+ * @throws IllegalCoordinationException
+ */
+ void setQNameEventWiring(QName source, Collection<QName> destinations, Page
page) throws IllegalCoordinationException;
+
+
+ /**
+ * Sets implicit wiring strategy for a given page
+ *
+ * @param pageContainer
+ * @param strategy
+ * @throws IllegalCoordinationException
+ */
+ void setImplicitEventWiringStrategy(PageContainer pageContainer, ImplicitStrategy
strategy) throws IllegalCoordinationException;
+
+ /**
+ * @param page
+ * @return implicit wiring strategy for a given page
+ */
+ ImplicitStrategy getImplicitEventWiringStrategy(Page page);
+
+ /**
+ * @param page
+ * @param source
+ * @return a collection of qnames that are wired with a given gname in scope of given
page
+ * @throws IllegalCoordinationException
+ */
+ Collection<QName> getQNameEventWiring(Page page, QName source) throws
IllegalCoordinationException;
+
+
+ /**
+ * @param eventQName
+ * @return all wirings defined for a given qname
+ */
+ Collection<EventWiringInfo> getEventWirings(QName eventQName);
+
+ /**
+ * @param page
+ * @return all wirings defined in the scope of a given page
+ */
+ Collection<EventWiringInfo> getEventWirings(Page page);
+
+ /**
+ * @param window
+ * @return all wirings where given window is a source
+ */
+ Collection<EventWiringInfo> getEventSourceWirings(Window window);
+
+ /**
+ * @param window
+ * @return all wirings where given window is a destination
+ */
+ Collection<EventWiringInfo> getEventDestinationWirings(Window window);
+
+ /**
+ * Defines shared parameter binding for a given collection of windows.
+ *
+ * @param qname
+ * @param windows
+ * @throws IllegalCoordinationException
+ */
+ void setParameterBinding(QName qname, Collection<Window> windows) throws
IllegalCoordinationException;
+
+ /**
+ * Removes given parameter binding
+ *
+ * @param parameterBinding
+ * @throws IllegalCoordinationException
+ */
+ void removeParameterBinding(ParameterBindingInfo parameterBinding) throws
IllegalCoordinationException;
+
+ /**
+ * Defines page scoped alias for shared parameter. All parameters with a local part
equal to given name will
+ * share request value
+ *
+ * @param page
+ * @param name
+ */
+ void setParameterAlias(Page page, String name);
+
+ /**
+ * Get a collection of aliases defined for a given page
+ *
+ * @param page
+ * @return
+ */
+ Collection<String> getParameterAliases(Page page);
+
+ /**
+ * Remove alias
+ *
+ * @param page
+ * @param name
+ * @throws IllegalCoordinationException
+ */
+ void removeParameterAlias(Page page, String name) throws
IllegalCoordinationException;
+
+ /**
+ * Set implicit strategy for a given page container
+ *
+ * @param pageContainer
+ * @param implicitStrategy
+ * @throws IllegalCoordinationException
+ */
+ void setImplicitParameterBindingStrategy(PageContainer pageContainer, ImplicitStrategy
implicitStrategy) throws IllegalCoordinationException;
+
+ /**
+ * @param pageContainer
+ * @return implicit strategy for a given page container
+ */
+ ImplicitStrategy getImplicitParameterBindingStrategy(PageContainer pageContainer);
+
+ /**
+ * @param parameterQName
+ * @return parameter bindings for a given parameter qname
+ */
+ Collection<ParameterBindingInfo> getParameterBindings(QName parameterQName);
+
+ /**
+ * @param page
+ * @return parameter bindings define in the scope of a given page
+ */
+ Collection<ParameterBindingInfo> getParameterBindings(Page page);
+
+ /**
+ * @param window
+ * @return parameter bindings where given window is involved
+ */
+ Collection<ParameterBindingInfo> getParameterBindings(Window window);
+
+}
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/EventWiringInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/EventWiringInfo.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/EventWiringInfo.java 2008-06-23
14:45:48 UTC (rev 11113)
@@ -0,0 +1,42 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.core.controller.portlet;
+
+import org.jboss.portal.core.model.portal.Window;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface EventWiringInfo
+{
+
+ QName getName();
+
+ Collection<Window> getSources();
+
+ Collection<Window> getDestinations();
+}
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/IllegalCoordinationException.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/IllegalCoordinationException.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/IllegalCoordinationException.java 2008-06-23
14:45:48 UTC (rev 11113)
@@ -0,0 +1,31 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.core.controller.portlet;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IllegalCoordinationException extends Exception
+{
+}
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ParameterBindingInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ParameterBindingInfo.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/portlet/ParameterBindingInfo.java 2008-06-23
14:45:48 UTC (rev 11113)
@@ -0,0 +1,40 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+
+package org.jboss.portal.core.controller.portlet;
+
+import org.jboss.portal.core.model.portal.Window;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface ParameterBindingInfo
+{
+ QName getName();
+
+ Collection<Window> getWindows();
+
+}