[jboss-svn-commits] JBoss Portal SVN: r5586 - in trunk/wsrp/src/main/org/jboss/portal/wsrp/producer: . registration
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Nov 5 10:56:15 EST 2006
Author: chris.laprun at jboss.com
Date: 2006-11-05 10:56:13 -0500 (Sun, 05 Nov 2006)
New Revision: 5586
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/Registration.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationConversionException.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationConverter.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationMetaData.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationPolicy.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationRegistry.java
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
Log:
First commit of Registration design, essentially for synch purposes... Work in progress!
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-11-04 11:37:34 UTC (rev 5585)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2006-11-05 15:56:13 UTC (rev 5586)
@@ -23,8 +23,9 @@
package org.jboss.portal.wsrp.producer;
-import org.apache.log4j.Logger;
+import org.jboss.logging.Logger;
import org.jboss.portal.wsrp.WSRPTypeFactory;
+import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.core.ModifyRegistration;
@@ -34,6 +35,8 @@
import org.jboss.portal.wsrp.core.RegistrationState;
import org.jboss.portal.wsrp.core.ReturnAny;
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
+import org.jboss.portal.wsrp.producer.registration.Registration;
+import org.jboss.portal.wsrp.producer.registration.RegistrationRegistry;
import java.rmi.RemoteException;
@@ -46,17 +49,30 @@
{
private final Logger log = Logger.getLogger(getClass());
+ private RegistrationRegistry registry = new RegistrationRegistry();
RegistrationHandler(WSRPProducerImpl producer)
{
super(producer);
}
- public RegistrationContext register(RegistrationData register) throws MissingParametersFault, OperationFailedFault,
+ public RegistrationContext register(RegistrationData registrationData) throws MissingParametersFault, OperationFailedFault,
RemoteException
{
- // todo: compute registration handle, record registration handle in registry
- return WSRPTypeFactory.createRegistrationContext(register.getConsumerName());
+ WSRPUtils.throwOperationFailedFaultIfValueIsMissing(registrationData, "RegistrationData");
+ String consumerName = registrationData.getConsumerName();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerName, "consumer name", "RegistrationData");
+ String consumerAgent = registrationData.getConsumerAgent();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerAgent, "consumer agent", "RegistrationData");
+
+ Registration registration = registry.register(registrationData);
+ RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(registration.getRegistrationHandle());
+ byte[] registrationState = registration.getRegistrationState();
+ if (registrationState != null && registrationState.length > 0)
+ {
+ registrationContext.setRegistrationState(registrationState);
+ }
+ return registrationContext;
}
public ReturnAny deregister(RegistrationContext deregister) throws OperationFailedFault, InvalidRegistrationFault,
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/Registration.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/Registration.java 2006-11-04 11:37:34 UTC (rev 5585)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/Registration.java 2006-11-05 15:56:13 UTC (rev 5586)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.wsrp.producer.registration;
+
+import java.util.List;
+
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.wsrp.producer.registration.Registration">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class Registration
+{
+ private RegistrationMetaData registrationMetaData;
+
+ public String getRegistrationHandle()
+ {
+ return null; // todo: implement
+ }
+
+ public byte[] getRegistrationState()
+ {
+ return null; // todo: implement
+ }
+
+ public boolean supportsGetMethod()
+ {
+ return false; // todo: implement
+ }
+
+ public List getSupportedModes()
+ {
+ return null; // todo: implement
+ }
+
+ public List getSupportedWindowStates()
+ {
+ return null; // todo: implement
+ }
+
+ public List getSupportedUserScopes()
+ {
+ return null; // todo: implement
+ }
+
+ public List getSupportedUserProfileData()
+ {
+ return null; // todo: implement
+ }
+
+ public RegistrationMetaData getMetaData()
+ {
+ return registrationMetaData;
+ }
+
+ public void setRegistrationMetaData(RegistrationMetaData registrationMetaData)
+ {
+ this.registrationMetaData = registrationMetaData;
+ }
+}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationConversionException.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationConversionException.java 2006-11-04 11:37:34 UTC (rev 5585)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationConversionException.java 2006-11-05 15:56:13 UTC (rev 5586)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.wsrp.producer.registration;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.wsrp.producer.registration.RegistrationConversionException">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationConversionException extends Exception
+{
+
+ public RegistrationConversionException()
+ {
+ }
+
+ public RegistrationConversionException(String message)
+ {
+ super(message);
+ }
+
+ public RegistrationConversionException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public RegistrationConversionException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationConverter.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationConverter.java 2006-11-04 11:37:34 UTC (rev 5585)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationConverter.java 2006-11-05 15:56:13 UTC (rev 5586)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.wsrp.producer.registration;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.wsrp.producer.registration.RegistrationConverter">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationConverter
+{
+ /**
+ * Marshall the registration as a byte array.
+ *
+ * @param registration the registration
+ * @return the marshalled registration
+ * @throws RegistrationConversionException
+ * if marshalling cannot be performed
+ * @throws IllegalArgumentException if the registration is null
+ */
+ byte[] marshall(Registration registration) throws RegistrationConversionException, IllegalArgumentException;
+
+ /**
+ * Unmarshall the producer state from a byte array.
+ *
+ * @param marshalledState the marshalled state
+ * @return the producer state
+ * @throws RegistrationConversionException
+ * if unmarshalling cannot be performed
+ * @throws IllegalArgumentException if the argument is null
+ */
+ Registration unmarshall(byte[] marshalledState) throws RegistrationConversionException, IllegalArgumentException;
+}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationMetaData.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationMetaData.java 2006-11-04 11:37:34 UTC (rev 5585)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationMetaData.java 2006-11-05 15:56:13 UTC (rev 5586)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * 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.wsrp.producer.registration;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.wsrp.producer.registration.RegistrationMetadata">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationMetaData
+{
+ // TBD
+}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationPolicy.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationPolicy.java 2006-11-04 11:37:34 UTC (rev 5585)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationPolicy.java 2006-11-05 15:56:13 UTC (rev 5586)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.wsrp.producer.registration;
+
+import org.jboss.portal.wsrp.core.RegistrationData;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.wsrp.producer.registration.RegistrationPolicy">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface RegistrationPolicy
+{
+ Registration getRegistrationFor(RegistrationData registrationData);
+}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationRegistry.java 2006-11-04 11:37:34 UTC (rev 5585)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/RegistrationRegistry.java 2006-11-05 15:56:13 UTC (rev 5586)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.wsrp.producer.registration;
+
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.RegistrationData;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun at jboss.com?subject=org.jboss.portal.wsrp.producer.registration.RegistrationRegistry">Chris
+ * Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationRegistry
+{
+ private RegistrationPolicy policy;
+ private Map registrations = new ConcurrentHashMap();
+
+ public RegistrationPolicy getPolicy()
+ {
+ return policy;
+ }
+
+ public void setPolicy(RegistrationPolicy policy)
+ {
+ this.policy = policy;
+ }
+
+ public Registration register(RegistrationData registrationData) throws MissingParametersFault, OperationFailedFault
+ {
+ Registration registration = policy.getRegistrationFor(registrationData);
+ if (registration != null)
+ {
+ registrations.put(registration.getRegistrationHandle(), registration);
+ }
+ throw new OperationFailedFault();
+ }
+}
More information about the jboss-svn-commits
mailing list